Skip to content

Commit f6a80e1

Browse files
authored
Merge pull request #604 from orbcorp/release-please--branches--main--changes--next--components--orb-billing
release: 5.1.0
2 parents 8894eb9 + 06586f7 commit f6a80e1

38 files changed

+1146
-429
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ on:
77
- 'integrated/**'
88
- 'stl-preview-head/**'
99
- 'stl-preview-base/**'
10+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
1014

1115
jobs:
1216
lint:
1317
timeout-minutes: 10
1418
name: lint
1519
runs-on: ${{ github.repository == 'stainless-sdks/orb-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
20+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
1621
steps:
1722
- uses: actions/checkout@v4
1823

@@ -31,6 +36,7 @@ jobs:
3136
timeout-minutes: 5
3237
name: build
3338
runs-on: ${{ github.repository == 'stainless-sdks/orb-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
39+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
3440
permissions:
3541
contents: read
3642
id-token: write
@@ -66,6 +72,7 @@ jobs:
6672
timeout-minutes: 10
6773
name: test
6874
runs-on: ${{ github.repository == 'stainless-sdks/orb-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
75+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
6976
steps:
7077
- uses: actions/checkout@v4
7178

.release-please-manifest.json

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

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 116
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c2a4808c828c8288c5c8dfe2fdfa51d4d7c1bcc33cacc6b859d0cf4b35ce95cc.yml
3-
openapi_spec_hash: a2b5a1bfabbd03dd1b411791576eb502
4-
config_hash: 3c3524be9607afb24d2139ce26ce5389
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml
3+
openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e
4+
config_hash: 8c9a47f104c777e2a1e8f3fad15c093b

CHANGELOG.md

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

3+
## 5.1.0 (2025-07-17)
4+
5+
Full Changelog: [v5.0.0...v5.1.0](https://github.com/orbcorp/orb-node/compare/v5.0.0...v5.1.0)
6+
7+
### Features
8+
9+
* **api:** api update ([5f861b0](https://github.com/orbcorp/orb-node/commit/5f861b076256a7172ff83a2adee978632324665b))
10+
* **api:** api update ([1939793](https://github.com/orbcorp/orb-node/commit/19397931ab0cfc5a7582995af8027117878047ea))
11+
* **api:** api update ([54fb67f](https://github.com/orbcorp/orb-node/commit/54fb67f3f221e4d10f388540e2181bc3f2048780))
12+
* **api:** api update ([b4f8f97](https://github.com/orbcorp/orb-node/commit/b4f8f973a593a4d09e46035dca03475ac39b834c))
13+
* **api:** api update ([ecfef87](https://github.com/orbcorp/orb-node/commit/ecfef87e64aaaf582ee484eb6a55d3c016c33d49))
14+
* **api:** api update ([fc96b5b](https://github.com/orbcorp/orb-node/commit/fc96b5bb78c87225c26e9d02fd42b473daf6cb8c))
15+
* **api:** api update ([44d2c02](https://github.com/orbcorp/orb-node/commit/44d2c02d887d0e09c32d3a7738de8b31c8421b1c))
16+
* **api:** api update ([81496fc](https://github.com/orbcorp/orb-node/commit/81496fc6baf0b872a705372289effad7992fb025))
17+
* **api:** api update ([63e9ce1](https://github.com/orbcorp/orb-node/commit/63e9ce18c1f8ed120cf360fcc58931f8ed9e7e7a))
18+
* **client:** add support for endpoint-specific base URLs ([0e61c32](https://github.com/orbcorp/orb-node/commit/0e61c325001e2ce26b26b2a5f70658d8e91a4458))
19+
20+
21+
### Bug Fixes
22+
23+
* **ci:** release-doctor — report correct token name ([d9bddc1](https://github.com/orbcorp/orb-node/commit/d9bddc13b51bb6854ef04e86da16300dd9a86606))
24+
* **client:** don't send `Content-Type` for bodyless methods ([33ba457](https://github.com/orbcorp/orb-node/commit/33ba457255b066c8ee465be2e0fb63c3956de9cc))
25+
* publish script — handle NPM errors correctly ([1678c34](https://github.com/orbcorp/orb-node/commit/1678c342b2abf1d2fc88e4e253b3c5ac7df4d9a0))
26+
27+
28+
### Chores
29+
30+
* **ci:** enable for pull requests ([77a5b1e](https://github.com/orbcorp/orb-node/commit/77a5b1e22b94ce2c0a27bb2b4fb14359a4203ca4))
31+
* **ci:** only run for pushes and fork pull requests ([5b3d838](https://github.com/orbcorp/orb-node/commit/5b3d838882117c0c23284a0c9f9c2bb2c4add313))
32+
* **internal:** bump test timeout ([d89af51](https://github.com/orbcorp/orb-node/commit/d89af5103034c83a7b52b1a87f2bada06d118d66))
33+
* **internal:** make base APIResource abstract ([9a95185](https://github.com/orbcorp/orb-node/commit/9a95185ee2c315169985d08e5696ef4dd38a3e2b))
34+
* make some internal functions async ([c7e0dab](https://github.com/orbcorp/orb-node/commit/c7e0dab4ae701fa809d524fd9171d17359832fba))
35+
* mention unit type in timeout docs ([132b903](https://github.com/orbcorp/orb-node/commit/132b90306594db72d0c447402ce231e287e7908e))
36+
37+
38+
### Refactors
39+
40+
* **types:** replace Record with mapped types ([509fcfb](https://github.com/orbcorp/orb-node/commit/509fcfb895402525e2d6ce1d6e8ca994ead496a8))
41+
342
## 5.0.0 (2025-06-09)
443

544
Full Changelog: [v4.74.0...v5.0.0](https://github.com/orbcorp/orb-node/compare/v4.74.0...v5.0.0)

bin/check-release-environment

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
errors=()
44

55
if [ -z "${NPM_TOKEN}" ]; then
6-
errors+=("The ORB_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
6+
errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
77
fi
88

99
lenErrors=${#errors[@]}

bin/publish-npm

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,35 @@ npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
77
yarn build
88
cd dist
99

10+
# Get package name and version from package.json
11+
PACKAGE_NAME="$(jq -r -e '.name' ./package.json)"
12+
VERSION="$(jq -r -e '.version' ./package.json)"
13+
1014
# Get latest version from npm
1115
#
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
18-
VERSION="$(node -p "require('./package.json').version")"
16+
# If the package doesn't exist, npm will return:
17+
# {
18+
# "error": {
19+
# "code": "E404",
20+
# "summary": "Unpublished on 2025-06-05T09:54:53.528Z",
21+
# "detail": "'the_package' is not in this registry..."
22+
# }
23+
# }
24+
NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)"
25+
26+
# Check if we got an E404 error
27+
if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then
28+
# Package doesn't exist yet, no last version
29+
LAST_VERSION=""
30+
elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then
31+
# Report other errors
32+
echo "ERROR: npm returned unexpected data:"
33+
echo "$NPM_INFO"
34+
exit 1
35+
else
36+
# Success - get the version
37+
LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes
38+
fi
1939

2040
# Check if current version is pre-release (e.g. alpha / beta / rc)
2141
CURRENT_IS_PRERELEASE=false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "orb-billing",
3-
"version": "5.0.0",
3+
"version": "5.1.0",
44
"description": "The official TypeScript library for the Orb API",
55
"author": "Orb <team@withorb.com>",
66
"types": "dist/index.d.ts",

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fi
2828
node scripts/utils/make-dist-package-json.cjs > dist/package.json
2929

3030
# build to .js/.mjs/.d.ts files
31-
npm exec tsc-multi
31+
./node_modules/.bin/tsc-multi
3232
# copy over handwritten .js/.mjs/.d.ts files
3333
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
3434
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto

scripts/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ else
5353
fi
5454

5555
echo "==> Running tests"
56-
./node_modules/.bin/jest "$@"
56+
./node_modules/.bin/jest --testTimeout=60000 "$@"

src/core.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export class APIPromise<T> extends Promise<T> {
170170

171171
export abstract class APIClient {
172172
baseURL: string;
173+
#baseURLOverridden: boolean;
173174
maxRetries: number;
174175
timeout: number;
175176
httpAgent: Agent | undefined;
@@ -179,18 +180,21 @@ export abstract class APIClient {
179180

180181
constructor({
181182
baseURL,
183+
baseURLOverridden,
182184
maxRetries = 2,
183185
timeout = 60000, // 1 minute
184186
httpAgent,
185187
fetch: overriddenFetch,
186188
}: {
187189
baseURL: string;
190+
baseURLOverridden: boolean;
188191
maxRetries?: number | undefined;
189192
timeout: number | undefined;
190193
httpAgent: Agent | undefined;
191194
fetch: Fetch | undefined;
192195
}) {
193196
this.baseURL = baseURL;
197+
this.#baseURLOverridden = baseURLOverridden;
194198
this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
195199
this.timeout = validatePositiveInteger('timeout', timeout);
196200
this.httpAgent = httpAgent;
@@ -213,7 +217,7 @@ export abstract class APIClient {
213217
protected defaultHeaders(opts: FinalRequestOptions): Headers {
214218
return {
215219
Accept: 'application/json',
216-
'Content-Type': 'application/json',
220+
...(['head', 'get'].includes(opts.method) ? {} : { 'Content-Type': 'application/json' }),
217221
'User-Agent': this.getUserAgent(),
218222
...getPlatformHeaders(),
219223
...this.authHeaders(opts),
@@ -295,12 +299,12 @@ export abstract class APIClient {
295299
return null;
296300
}
297301

298-
buildRequest<Req>(
302+
async buildRequest<Req>(
299303
inputOptions: FinalRequestOptions<Req>,
300304
{ retryCount = 0 }: { retryCount?: number } = {},
301-
): { req: RequestInit; url: string; timeout: number } {
305+
): Promise<{ req: RequestInit; url: string; timeout: number }> {
302306
const options = { ...inputOptions };
303-
const { method, path, query, headers: headers = {} } = options;
307+
const { method, path, query, defaultBaseURL, headers: headers = {} } = options;
304308

305309
const body =
306310
ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
@@ -310,7 +314,7 @@ export abstract class APIClient {
310314
: null;
311315
const contentLength = this.calculateContentLength(body);
312316

313-
const url = this.buildURL(path!, query);
317+
const url = this.buildURL(path!, query, defaultBaseURL);
314318
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
315319
options.timeout = options.timeout ?? this.timeout;
316320
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
@@ -446,7 +450,9 @@ export abstract class APIClient {
446450

447451
await this.prepareOptions(options);
448452

449-
const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
453+
const { req, url, timeout } = await this.buildRequest(options, {
454+
retryCount: maxRetries - retriesRemaining,
455+
});
450456

451457
await this.prepareRequest(req, { url, options });
452458

@@ -503,11 +509,12 @@ export abstract class APIClient {
503509
return new PagePromise<PageClass, Item>(this, request, Page);
504510
}
505511

506-
buildURL<Req>(path: string, query: Req | null | undefined): string {
512+
buildURL<Req>(path: string, query: Req | null | undefined, defaultBaseURL?: string | undefined): string {
513+
const baseURL = (!this.#baseURLOverridden && defaultBaseURL) || this.baseURL;
507514
const url =
508515
isAbsoluteURL(path) ?
509516
new URL(path)
510-
: new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
517+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
511518

512519
const defaultQuery = this.defaultQuery();
513520
if (!isEmptyObj(defaultQuery)) {
@@ -792,6 +799,7 @@ export type RequestOptions<
792799
query?: Req | undefined;
793800
body?: Req | null | undefined;
794801
headers?: Headers | undefined;
802+
defaultBaseURL?: string | undefined;
795803

796804
maxRetries?: number;
797805
stream?: boolean | undefined;
@@ -813,6 +821,7 @@ const requestOptionsKeys: KeysEnum<RequestOptions> = {
813821
query: true,
814822
body: true,
815823
headers: true,
824+
defaultBaseURL: true,
816825

817826
maxRetries: true,
818827
stream: true,

0 commit comments

Comments
 (0)