Skip to content

Commit 1dc29f0

Browse files
authored
Merge pull request #137 from lumalabs/release-please--branches--main--changes--next--components--lumaai
release: 1.20.1
2 parents 58f4cc6 + 9bd9174 commit 1dc29f0

10 files changed

Lines changed: 76 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@ jobs:
5555
run: ./scripts/build
5656

5757
- name: Get GitHub OIDC Token
58-
if: github.repository == 'stainless-sdks/luma_ai-node'
58+
if: |-
59+
github.repository == 'stainless-sdks/luma_ai-node' &&
60+
!startsWith(github.ref, 'refs/heads/stl/')
5961
id: github-oidc
6062
uses: actions/github-script@v8
6163
with:
6264
script: core.setOutput('github_token', await core.getIDToken());
6365

6466
- name: Upload tarball
65-
if: github.repository == 'stainless-sdks/luma_ai-node'
67+
if: |-
68+
github.repository == 'stainless-sdks/luma_ai-node' &&
69+
!startsWith(github.ref, 'refs/heads/stl/')
6670
env:
6771
URL: https://pkg.stainless.com/s
6872
AUTH: ${{ steps.github-oidc.outputs.github_token }}

.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.20.0"
2+
".": "1.20.1"
33
}

CHANGELOG.md

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

3+
## 1.20.1 (2026-03-07)
4+
5+
Full Changelog: [v1.20.0...v1.20.1](https://github.com/lumalabs/lumaai-node/compare/v1.20.0...v1.20.1)
6+
7+
### Bug Fixes
8+
9+
* **client:** preserve URL params already embedded in path ([bd71801](https://github.com/lumalabs/lumaai-node/commit/bd718018365cbd54350cb25fec6d4696dd4a4142))
10+
* **docs/contributing:** correct pnpm link command ([35ace89](https://github.com/lumalabs/lumaai-node/commit/35ace89e0c1a84d1d241dbbd48e6f6b879b8f5f6))
11+
12+
13+
### Chores
14+
15+
* **ci:** skip uploading artifacts on stainless-internal branches ([0948668](https://github.com/lumalabs/lumaai-node/commit/0948668b08784afc6d6308b959d7c0812fe5e9f1))
16+
* **internal:** codegen related update ([16451fa](https://github.com/lumalabs/lumaai-node/commit/16451fa5bdd71a79efc12586a717ae9e24cb794a))
17+
* **internal:** move stringifyQuery implementation to internal function ([c8f608f](https://github.com/lumalabs/lumaai-node/commit/c8f608f2b3b52db38d2e2fccdc4a262ea4538d14))
18+
* **test:** do not count install time for mock server timeout ([1905253](https://github.com/lumalabs/lumaai-node/commit/1905253f076eaa16e2d3ef16919b913ee4ccc11b))
19+
* update mock server docs ([f625696](https://github.com/lumalabs/lumaai-node/commit/f625696b39864ebef7090f47bf9513a017efa08c))
20+
321
## 1.20.0 (2026-02-08)
422

523
Full Changelog: [v1.19.1...v1.20.0](https://github.com/lumalabs/lumaai-node/compare/v1.19.1...v1.20.0)

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ $ yarn link lumaai
6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -global lumaai
63+
$ pnpm link --global lumaai
6464
```
6565

6666
## Running tests
6767

6868
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
6969

7070
```sh
71-
$ npx prism mock path/to/your/openapi.yml
71+
$ ./scripts/mock
7272
```
7373

7474
```sh

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lumaai",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "The official TypeScript library for the LumaAI API",
55
"author": "LumaAI <support+api@lumalabs.ai>",
66
"types": "dist/index.d.ts",

scripts/mock

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}"
2121

2222
# Run prism mock on the given spec
2323
if [ "$1" == "--daemon" ]; then
24+
# Pre-install the package so the download doesn't eat into the startup timeout
25+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
26+
2427
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
2528

26-
# Wait for server to come online
29+
# Wait for server to come online (max 30s)
2730
echo -n "Waiting for server"
31+
attempts=0
2832
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
33+
attempts=$((attempts + 1))
34+
if [ "$attempts" -ge 300 ]; then
35+
echo
36+
echo "Timed out waiting for Prism server to start"
37+
cat .prism.log
38+
exit 1
39+
fi
2940
echo -n "."
3041
sleep 0.1
3142
done

src/core.ts

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
APIConnectionTimeoutError,
77
APIUserAbortError,
88
} from './error';
9+
import { stringifyQuery } from './internal/utils/query';
910
import {
1011
kind as shimsKind,
1112
type Readable,
@@ -523,32 +524,20 @@ export abstract class APIClient {
523524
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
524525

525526
const defaultQuery = this.defaultQuery();
526-
if (!isEmptyObj(defaultQuery)) {
527-
query = { ...defaultQuery, ...query } as Req;
527+
const pathQuery = Object.fromEntries(url.searchParams);
528+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
529+
query = { ...pathQuery, ...defaultQuery, ...query } as Req;
528530
}
529531

530532
if (typeof query === 'object' && query && !Array.isArray(query)) {
531-
url.search = this.stringifyQuery(query as Record<string, unknown>);
533+
url.search = this.stringifyQuery(query);
532534
}
533535

534536
return url.toString();
535537
}
536538

537-
protected stringifyQuery(query: Record<string, unknown>): string {
538-
return Object.entries(query)
539-
.filter(([_, value]) => typeof value !== 'undefined')
540-
.map(([key, value]) => {
541-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
542-
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
543-
}
544-
if (value === null) {
545-
return `${encodeURIComponent(key)}=`;
546-
}
547-
throw new LumaAIError(
548-
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
549-
);
550-
})
551-
.join('&');
539+
protected stringifyQuery(query: object | Record<string, unknown>): string {
540+
return stringifyQuery(query);
552541
}
553542

554543
async fetchWithTimeout(
@@ -630,9 +619,9 @@ export abstract class APIClient {
630619
}
631620
}
632621

633-
// If the API asks us to wait a certain amount of time (and it's a reasonable amount),
634-
// just do what it says, but otherwise calculate a default
635-
if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
622+
// If the API asks us to wait a certain amount of time, do what it says.
623+
// Otherwise calculate a default.
624+
if (timeoutMillis === undefined) {
636625
const maxRetries = options.maxRetries ?? this.maxRetries;
637626
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
638627
}

src/internal/utils/query.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { LumaAIError } from '../../error';
4+
5+
/**
6+
* Basic re-implementation of `qs.stringify` for primitive types.
7+
*/
8+
export function stringifyQuery(query: object | Record<string, unknown>) {
9+
return Object.entries(query)
10+
.filter(([_, value]) => typeof value !== 'undefined')
11+
.map(([key, value]) => {
12+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
14+
}
15+
if (value === null) {
16+
return `${encodeURIComponent(key)}=`;
17+
}
18+
throw new LumaAIError(
19+
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
20+
);
21+
})
22+
.join('&');
23+
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '1.20.0'; // x-release-please-version
1+
export const VERSION = '1.20.1'; // x-release-please-version

tests/stringifyQuery.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import { LumaAI } from 'lumaai';
4-
5-
const { stringifyQuery } = LumaAI.prototype as any;
3+
import { stringifyQuery } from 'lumaai/internal/utils/query';
64

75
describe(stringifyQuery, () => {
86
for (const [input, expected] of [
@@ -15,7 +13,7 @@ describe(stringifyQuery, () => {
1513
'e=f',
1614
)}=${encodeURIComponent('g&h')}`,
1715
],
18-
]) {
16+
] as const) {
1917
it(`${JSON.stringify(input)} -> ${expected}`, () => {
2018
expect(stringifyQuery(input)).toEqual(expected);
2119
});

0 commit comments

Comments
 (0)