Skip to content

Commit 27aafd8

Browse files
release: 1.1.3 (#56)
* chore: improve publish-npm script --latest tag logic * fix: compat with more runtimes * docs(pagination): improve naming * chore(deps): bump eslint-plugin-prettier * chore(internal): update jest config * chore: adjust eslint.config.mjs ignore pattern * chore(docs): use top-level-await in example snippets * chore(internal): fix readablestream types in node 20 * chore: avoid type error in certain environments * release: 1.1.3 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 31c5b99 commit 27aafd8

16 files changed

Lines changed: 121 additions & 105 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.1.2"
2+
".": "1.1.3"
33
}

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 1.1.3 (2025-06-07)
4+
5+
Full Changelog: [v1.1.2...v1.1.3](https://github.com/GRID-is/api-sdk-ts/compare/v1.1.2...v1.1.3)
6+
7+
### Bug Fixes
8+
9+
* compat with more runtimes ([cfba707](https://github.com/GRID-is/api-sdk-ts/commit/cfba707d477d6c9bcf66e089de14c774f90eb191))
10+
11+
12+
### Chores
13+
14+
* adjust eslint.config.mjs ignore pattern ([425627d](https://github.com/GRID-is/api-sdk-ts/commit/425627d74182a8cf8ddcae7d68940afa71c780c3))
15+
* avoid type error in certain environments ([7c383f5](https://github.com/GRID-is/api-sdk-ts/commit/7c383f5eb9ae59705845de88865d60594222d29d))
16+
* **deps:** bump eslint-plugin-prettier ([6653cbc](https://github.com/GRID-is/api-sdk-ts/commit/6653cbc6d2db6e40d6d7163ed59ad59472b2ee9b))
17+
* **docs:** use top-level-await in example snippets ([2f22e9e](https://github.com/GRID-is/api-sdk-ts/commit/2f22e9eecf71f4c12d06f52fba43f1a67d7d6787))
18+
* improve publish-npm script --latest tag logic ([b202e9c](https://github.com/GRID-is/api-sdk-ts/commit/b202e9cf88b26e64122ccb03659ab94a60e5fac6))
19+
* **internal:** fix readablestream types in node 20 ([5b79c96](https://github.com/GRID-is/api-sdk-ts/commit/5b79c96852159e1ab8785f6c02574ec2fdf499e7))
20+
* **internal:** update jest config ([46f30f8](https://github.com/GRID-is/api-sdk-ts/commit/46f30f8bf492f50b484ec8050c0da32762c96d51))
21+
22+
23+
### Documentation
24+
25+
* **pagination:** improve naming ([455bb5e](https://github.com/GRID-is/api-sdk-ts/commit/455bb5e3b5c5d682a4aa5d38e55230006ffcfa88))
26+
327
## 1.1.2 (2025-05-27)
428

529
Full Changelog: [v1.1.1...v1.1.2](https://github.com/GRID-is/api-sdk-ts/compare/v1.1.1...v1.1.2)

README.md

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ const client = new Grid({
2727
apiKey: "YOUR_API_KEY",
2828
});
2929

30-
async function main() {
31-
const response = await client.workbooks.query('YOUR_WORKBOOK_ID', {
32-
read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'],
33-
});
34-
35-
console.log(response.read);
36-
}
30+
const response = await client.workbooks.query('YOUR_WORKBOOK_ID', {
31+
read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'],
32+
});
3733

38-
main();
34+
console.log(response.read);
3935
```
4036

4137
### Request & Response types
@@ -48,12 +44,8 @@ import Grid from '@grid-is/api';
4844

4945
const client = new Grid();
5046

51-
async function main() {
52-
const params: Grid.WorkbookQueryParams = { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] };
53-
const response: Grid.WorkbookQueryResponse = await client.workbooks.query('YOUR_WORKBOOK_ID', params);
54-
}
55-
56-
main();
47+
const params: Grid.WorkbookQueryParams = { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] };
48+
const response: Grid.WorkbookQueryResponse = await client.workbooks.query('YOUR_WORKBOOK_ID', params);
5749
```
5850

5951
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -95,21 +87,17 @@ a subclass of `APIError` will be thrown:
9587

9688
<!-- prettier-ignore -->
9789
```ts
98-
async function main() {
99-
const response = await client.workbooks
100-
.query('YOUR_WORKBOOK_ID', { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] })
101-
.catch(async (err) => {
102-
if (err instanceof Grid.APIError) {
103-
console.log(err.status); // 400
104-
console.log(err.name); // BadRequestError
105-
console.log(err.headers); // {server: 'nginx', ...}
106-
} else {
107-
throw err;
108-
}
109-
});
110-
}
111-
112-
main();
90+
const response = await client.workbooks
91+
.query('YOUR_WORKBOOK_ID', { read: ['A1', 'Sheet2!B3', '=SUM(A1:A4)'] })
92+
.catch(async (err) => {
93+
if (err instanceof Grid.APIError) {
94+
console.log(err.status); // 400
95+
console.log(err.name); // BadRequestError
96+
console.log(err.headers); // {server: 'nginx', ...}
97+
} else {
98+
throw err;
99+
}
100+
});
113101
```
114102

115103
Error codes are as follows:
@@ -173,13 +161,13 @@ List methods in the Grid API are paginated.
173161
You can use the `for await … of` syntax to iterate through items across all pages:
174162

175163
```ts
176-
async function fetchAllWorkbooks(params) {
177-
const allWorkbooks = [];
164+
async function fetchAllWorkbookListResponses(params) {
165+
const allWorkbookListResponses = [];
178166
// Automatically fetches more pages as needed.
179167
for await (const workbookListResponse of client.workbooks.list({ limit: 50 })) {
180-
allWorkbooks.push(workbookListResponse);
168+
allWorkbookListResponses.push(workbookListResponse);
181169
}
182-
return allWorkbooks;
170+
return allWorkbookListResponses;
183171
}
184172
```
185173

bin/publish-npm

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,35 @@ set -eux
44

55
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
66

7-
# Build the project
87
yarn build
9-
10-
# Navigate to the dist directory
118
cd dist
129

13-
# Get the version from package.json
10+
# Get latest version from npm
11+
#
12+
# If the package doesn't exist, yarn will return
13+
# {"type":"error","data":"Received invalid response from npm."}
14+
# where .data.version doesn't exist so LAST_VERSION will be an empty string.
15+
LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')"
16+
17+
# Get current version from package.json
1418
VERSION="$(node -p "require('./package.json').version")"
1519

16-
# Extract the pre-release tag if it exists
20+
# Check if current version is pre-release (e.g. alpha / beta / rc)
21+
CURRENT_IS_PRERELEASE=false
1722
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
18-
# Extract the part before any dot in the pre-release identifier
19-
TAG="${BASH_REMATCH[1]}"
23+
CURRENT_IS_PRERELEASE=true
24+
CURRENT_TAG="${BASH_REMATCH[1]}"
25+
fi
26+
27+
# Check if last version is a stable release
28+
LAST_IS_STABLE_RELEASE=true
29+
if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then
30+
LAST_IS_STABLE_RELEASE=false
31+
fi
32+
33+
# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease.
34+
if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then
35+
TAG="$CURRENT_TAG"
2036
else
2137
TAG="latest"
2238
fi

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default tseslint.config(
1010
parserOptions: { sourceType: 'module' },
1111
},
1212
files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'],
13-
ignores: ['dist/**'],
13+
ignores: ['dist/'],
1414
plugins: {
1515
'@typescript-eslint': tseslint.plugin,
1616
'unused-imports': unusedImports,

jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const config: JestConfigWithTsJest = {
1515
'<rootDir>/dist/',
1616
'<rootDir>/deno/',
1717
'<rootDir>/deno_tests/',
18+
'<rootDir>/packages/',
1819
],
1920
testPathIgnorePatterns: ['scripts'],
2021
};

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grid-is/api",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "The official TypeScript library for the Grid API",
55
"author": "Grid <info@grid.is>",
66
"types": "dist/index.d.ts",
@@ -34,7 +34,7 @@
3434
"@typescript-eslint/eslint-plugin": "8.31.1",
3535
"@typescript-eslint/parser": "8.31.1",
3636
"eslint": "^9.20.1",
37-
"eslint-plugin-prettier": "^5.2.3",
37+
"eslint-plugin-prettier": "^5.4.1",
3838
"eslint-plugin-unused-imports": "^4.1.4",
3939
"iconv-lite": "^0.6.3",
4040
"jest": "^29.4.0",
@@ -46,9 +46,6 @@
4646
"tsconfig-paths": "^4.0.0",
4747
"typescript": "5.8.3"
4848
},
49-
"resolutions": {
50-
"synckit": "0.8.8"
51-
},
5249
"imports": {
5350
"@grid-is/api": ".",
5451
"@grid-is/api/*": "./src/*"

scripts/build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ npm exec tsc-multi
3737
# when building .mjs
3838
node scripts/utils/fix-index-exports.cjs
3939
cp tsconfig.dist-src.json dist/src/tsconfig.json
40-
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts
41-
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts
4240

4341
node scripts/utils/postprocess-files.cjs
4442

src/core/pagination.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class PagePromise<
9999
* console.log(item)
100100
* }
101101
*/
102-
async *[Symbol.asyncIterator]() {
102+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
103103
const page = await this;
104104
for await (const item of page) {
105105
yield item;

src/internal/detect-platform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ const getPlatformProperties = (): PlatformProperties => {
8585
return {
8686
'X-Stainless-Lang': 'js',
8787
'X-Stainless-Package-Version': VERSION,
88-
'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform),
89-
'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch),
88+
'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform ?? 'unknown'),
89+
'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch ?? 'unknown'),
9090
'X-Stainless-Runtime': 'node',
91-
'X-Stainless-Runtime-Version': (globalThis as any).process.version,
91+
'X-Stainless-Runtime-Version': (globalThis as any).process.version ?? 'unknown',
9292
};
9393
}
9494

0 commit comments

Comments
 (0)