From ab1bfe8705631f229c10ac023bc8ae205c4edd46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Jan 2026 06:44:42 +0000 Subject: [PATCH 1/7] chore(ci): upgrade `actions/github-script` --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c19ecfb..66ef3d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/flowglad-typescript' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); From 56900bed3729ab2a7f4d872fad1692a888cbf802 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 08:16:47 +0000 Subject: [PATCH 2/7] fix(client): avoid memory leak with abort signals --- src/client.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index 173cb9c..3e33f69 100644 --- a/src/client.ts +++ b/src/client.ts @@ -628,9 +628,10 @@ export class Flowglad { controller: AbortController, ): Promise { const { signal, method, ...options } = init || {}; - if (signal) signal.addEventListener('abort', () => controller.abort()); + const abort = controller.abort.bind(controller); + if (signal) signal.addEventListener('abort', abort, { once: true }); - const timeout = setTimeout(() => controller.abort(), ms); + const timeout = setTimeout(abort, ms); const isReadableBody = ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || From fdf283447a556e939343febecc89663c4b2ac9e6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 08:19:25 +0000 Subject: [PATCH 3/7] chore(client): do not parse responses with empty content-length --- src/internal/parse.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/internal/parse.ts b/src/internal/parse.ts index 9b5eabc..6e3092e 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -29,6 +29,12 @@ export async function defaultParseResponse(client: Flowglad, props: APIRespon const mediaType = contentType?.split(';')[0]?.trim(); const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json'); if (isJSON) { + const contentLength = response.headers.get('content-length'); + if (contentLength === '0') { + // if there is no content we can't do anything + return undefined as T; + } + const json = await response.json(); return json as T; } From 55978f2f8d4ece515b0613b7e47833a5dd7c1a84 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 05:42:50 +0000 Subject: [PATCH 4/7] chore(client): restructure abort controller binding --- src/client.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index 3e33f69..c75a767 100644 --- a/src/client.ts +++ b/src/client.ts @@ -628,7 +628,7 @@ export class Flowglad { controller: AbortController, ): Promise { const { signal, method, ...options } = init || {}; - const abort = controller.abort.bind(controller); + const abort = this._makeAbort(controller); if (signal) signal.addEventListener('abort', abort, { once: true }); const timeout = setTimeout(abort, ms); @@ -654,6 +654,7 @@ export class Flowglad { return await this.fetch.call(undefined, url, fetchOptions); } finally { clearTimeout(timeout); + if (signal) signal.removeEventListener('abort', abort); } } @@ -798,6 +799,12 @@ export class Flowglad { return headers.values; } + private _makeAbort(controller: AbortController) { + // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure + // would capture all request options, and cause a memory leak. + return () => controller.abort(); + } + private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): { bodyHeaders: HeadersLike; body: BodyInit | undefined; From d98d3e7d87551397703c141d873e8b4234a8a889 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 08:09:56 +0000 Subject: [PATCH 5/7] fix(types): correctly define false enum --- src/resources/checkout-sessions.ts | 4 +- src/resources/customers.ts | 26 ++++++------ src/resources/payments.ts | 2 +- src/resources/prices.ts | 16 ++++---- src/resources/products.ts | 16 ++++---- src/resources/shared.ts | 2 +- src/resources/subscriptions.ts | 40 +++++++++---------- tests/api-resources/checkout-sessions.test.ts | 2 +- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/resources/checkout-sessions.ts b/src/resources/checkout-sessions.ts index b1e18e0..5e0db32 100644 --- a/src/resources/checkout-sessions.ts +++ b/src/resources/checkout-sessions.ts @@ -323,7 +323,7 @@ export interface PurchaseCheckoutSessionClientSelectSchema { paymentMethodType?: 'card' | 'link' | 'us_bank_account' | 'sepa_debit' | null; - preserveBillingCycleAnchor?: boolean; + preserveBillingCycleAnchor?: false; successUrl?: string | null; @@ -411,7 +411,7 @@ export namespace CheckoutSessionCreateParams { type: 'product'; - anonymous?: boolean; + anonymous?: false; /** * JSON object diff --git a/src/resources/customers.ts b/src/resources/customers.ts index 311ea94..57791cf 100644 --- a/src/resources/customers.ts +++ b/src/resources/customers.ts @@ -149,7 +149,7 @@ export interface NonRenewingSubscriptionDetails { pricingModelId: string; - renews: boolean; + renews: false; replacedBySubscriptionId: string | null; @@ -226,13 +226,13 @@ export namespace NonRenewingSubscriptionDetails { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -506,13 +506,13 @@ export namespace StandardSubscriptionDetails { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -789,13 +789,13 @@ export namespace CustomerCreateResponse { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -907,7 +907,7 @@ export namespace CustomerRetrieveBillingResponse { customerId: string; - firstInvoiceValue: number; + firstInvoiceValue: 0; /** * A positive integer @@ -949,7 +949,7 @@ export namespace CustomerRetrieveBillingResponse { */ totalPurchaseValue: null; - trialPeriodDays: number; + trialPeriodDays: 0; /** * Epoch milliseconds. @@ -993,7 +993,7 @@ export namespace CustomerRetrieveBillingResponse { customerId: string; - firstInvoiceValue: number; + firstInvoiceValue: 0; /** * Omitted. @@ -1033,7 +1033,7 @@ export namespace CustomerRetrieveBillingResponse { status: 'open' | 'pending' | 'failed' | 'paid' | 'refunded' | 'partial_refund' | 'fraudulent'; - totalPurchaseValue: number; + totalPurchaseValue: 0; /** * Omitted. @@ -1082,7 +1082,7 @@ export namespace CustomerRetrieveBillingResponse { customerId: string; - firstInvoiceValue: number; + firstInvoiceValue: 0; /** * Omitted. @@ -1122,7 +1122,7 @@ export namespace CustomerRetrieveBillingResponse { status: 'open' | 'pending' | 'failed' | 'paid' | 'refunded' | 'partial_refund' | 'fraudulent'; - totalPurchaseValue: number; + totalPurchaseValue: 0; /** * Omitted. diff --git a/src/resources/payments.ts b/src/resources/payments.ts index dd679a1..778bc4e 100644 --- a/src/resources/payments.ts +++ b/src/resources/payments.ts @@ -34,7 +34,7 @@ export class Payments extends APIResource { export interface PaymentClientSelectSchema { id: string; - amount: number; + amount: 0; applicationFee: number | null; diff --git a/src/resources/prices.ts b/src/resources/prices.ts index b833bd8..5acb924 100644 --- a/src/resources/prices.ts +++ b/src/resources/prices.ts @@ -207,7 +207,7 @@ export interface SinglePaymentPriceClientSelectSchema { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -423,7 +423,7 @@ export interface SubscriptionPriceClientSelectSchema { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -444,7 +444,7 @@ export interface SubscriptionPriceClientSelectSchema { * The trial period in days. If the trial period is 0 or null, there will be no * trial period. */ - trialPeriodDays?: number | null; + trialPeriodDays?: 0 | null; } export interface UsagePriceClientSelectSchema { @@ -632,7 +632,7 @@ export interface UsagePriceClientSelectSchema { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -715,7 +715,7 @@ export namespace PriceCreateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; active?: boolean; @@ -727,7 +727,7 @@ export namespace PriceCreateParams { * The trial period in days. If the trial period is 0 or null, there will be no * trial period. */ - trialPeriodDays?: number | null; + trialPeriodDays?: 0 | null; /** * Omitted. @@ -760,7 +760,7 @@ export namespace PriceCreateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; active?: boolean; @@ -816,7 +816,7 @@ export namespace PriceCreateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; /** * The number of usage events per unit. Used to determine how to map usage events diff --git a/src/resources/products.ts b/src/resources/products.ts index 6d4066f..370045c 100644 --- a/src/resources/products.ts +++ b/src/resources/products.ts @@ -230,7 +230,7 @@ export namespace ProductCreateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; active?: boolean; @@ -242,7 +242,7 @@ export namespace ProductCreateParams { * The trial period in days. If the trial period is 0 or null, there will be no * trial period. */ - trialPeriodDays?: number | null; + trialPeriodDays?: 0 | null; /** * Omitted. @@ -270,7 +270,7 @@ export namespace ProductCreateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; active?: boolean; @@ -326,7 +326,7 @@ export namespace ProductCreateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; /** * The number of usage events per unit. Used to determine how to map usage events @@ -436,7 +436,7 @@ export namespace ProductUpdateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; active?: boolean; @@ -448,7 +448,7 @@ export namespace ProductUpdateParams { * The trial period in days. If the trial period is 0 or null, there will be no * trial period. */ - trialPeriodDays?: number | null; + trialPeriodDays?: 0 | null; /** * Omitted. @@ -481,7 +481,7 @@ export namespace ProductUpdateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; active?: boolean; @@ -537,7 +537,7 @@ export namespace ProductUpdateParams { * example, if the currency is USD, GBP, CAD, EUR or SGD, the price should be in * cents. */ - unitPrice: number; + unitPrice: 0; /** * The number of usage events per unit. Used to determine how to map usage events diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 434565e..2408d49 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -96,7 +96,7 @@ export interface NonRenewingSubscriptionRecord { pricingModelId: string; - renews: boolean; + renews: false; replacedBySubscriptionId: string | null; diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index a99d04e..eee60ff 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -136,13 +136,13 @@ export namespace SubscriptionAdjustResponse { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -303,13 +303,13 @@ export namespace SubscriptionAdjustParams { */ addedDate: number; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Used as a flag to soft delete a subscription item without losing its history for @@ -357,13 +357,13 @@ export namespace SubscriptionAdjustParams { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -389,13 +389,13 @@ export namespace SubscriptionAdjustParams { */ addedDate: number; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Used as a flag to soft delete a subscription item without losing its history for @@ -467,13 +467,13 @@ export namespace SubscriptionAdjustParams { */ addedDate: number; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Used as a flag to soft delete a subscription item without losing its history for @@ -521,13 +521,13 @@ export namespace SubscriptionAdjustParams { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -553,13 +553,13 @@ export namespace SubscriptionAdjustParams { */ addedDate: number; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Used as a flag to soft delete a subscription item without losing its history for @@ -640,13 +640,13 @@ export namespace SubscriptionAdjustParams { */ addedDate: number; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Used as a flag to soft delete a subscription item without losing its history for @@ -694,13 +694,13 @@ export namespace SubscriptionAdjustParams { pricingModelId: string; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Epoch milliseconds. @@ -726,13 +726,13 @@ export namespace SubscriptionAdjustParams { */ addedDate: number; - quantity: number; + quantity: 0; subscriptionId: string; type: 'static'; - unitPrice: number; + unitPrice: 0; /** * Used as a flag to soft delete a subscription item without losing its history for diff --git a/tests/api-resources/checkout-sessions.test.ts b/tests/api-resources/checkout-sessions.test.ts index 043bc3c..243549f 100644 --- a/tests/api-resources/checkout-sessions.test.ts +++ b/tests/api-resources/checkout-sessions.test.ts @@ -35,7 +35,7 @@ describe('resource checkoutSessions', () => { customerExternalId: 'customerExternalId', successUrl: 'successUrl', type: 'product', - anonymous: true, + anonymous: false, outputMetadata: { foo: 'string' }, outputName: 'outputName', preserveBillingCycleAnchor: true, From db6b522ba19e11051a8d26be9905d8a88796d455 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 08:11:40 +0000 Subject: [PATCH 6/7] fix(client): avoid removing abort listener too early --- src/client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index c75a767..f3bc9ba 100644 --- a/src/client.ts +++ b/src/client.ts @@ -654,7 +654,6 @@ export class Flowglad { return await this.fetch.call(undefined, url, fetchOptions); } finally { clearTimeout(timeout); - if (signal) signal.removeEventListener('abort', abort); } } From 10438e53c5c835018dfc8b40ac2af223712c5961 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 08:12:01 +0000 Subject: [PATCH 7/7] release: 0.29.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8316a6d..712789e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.29.0" + ".": "0.29.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c6055d7..4546072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,21 @@ # Changelog +## 0.29.1 (2026-02-06) + +Full Changelog: [v0.29.0...v0.29.1](https://github.com/flowglad/flowglad-node/compare/v0.29.0...v0.29.1) + +### Bug Fixes + +* **client:** avoid memory leak with abort signals ([56900be](https://github.com/flowglad/flowglad-node/commit/56900bed3729ab2a7f4d872fad1692a888cbf802)) +* **client:** avoid removing abort listener too early ([db6b522](https://github.com/flowglad/flowglad-node/commit/db6b522ba19e11051a8d26be9905d8a88796d455)) +* **types:** correctly define false enum ([d98d3e7](https://github.com/flowglad/flowglad-node/commit/d98d3e7d87551397703c141d873e8b4234a8a889)) + + +### Chores + +* **ci:** upgrade `actions/github-script` ([ab1bfe8](https://github.com/flowglad/flowglad-node/commit/ab1bfe8705631f229c10ac023bc8ae205c4edd46)) +* **client:** do not parse responses with empty content-length ([fdf2834](https://github.com/flowglad/flowglad-node/commit/fdf283447a556e939343febecc89663c4b2ac9e6)) +* **client:** restructure abort controller binding ([55978f2](https://github.com/flowglad/flowglad-node/commit/55978f2f8d4ece515b0613b7e47833a5dd7c1a84)) + ## 0.29.0 (2026-01-18) Full Changelog: [v0.28.0...v0.29.0](https://github.com/flowglad/flowglad-node/compare/v0.28.0...v0.29.0) diff --git a/package.json b/package.json index 93fd708..d7b15df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@flowglad/node", - "version": "0.29.0", + "version": "0.29.1", "description": "The official TypeScript library for the Flowglad API", "author": "Flowglad ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index bef2b64..b8b7a27 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.29.0'; // x-release-please-version +export const VERSION = '0.29.1'; // x-release-please-version