Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.29.0"
".": "0.29.1"
}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <dev-feedback@flowglad.com>",
"types": "dist/index.d.ts",
Expand Down
11 changes: 9 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,10 @@ export class Flowglad {
controller: AbortController,
): Promise<Response> {
const { signal, method, ...options } = init || {};
if (signal) signal.addEventListener('abort', () => controller.abort());
const abort = this._makeAbort(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) ||
Expand Down Expand Up @@ -797,6 +798,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;
Expand Down
6 changes: 6 additions & 0 deletions src/internal/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/resources/checkout-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export interface PurchaseCheckoutSessionClientSelectSchema {

paymentMethodType?: 'card' | 'link' | 'us_bank_account' | 'sepa_debit' | null;

preserveBillingCycleAnchor?: boolean;
preserveBillingCycleAnchor?: false;

successUrl?: string | null;

Expand Down Expand Up @@ -411,7 +411,7 @@ export namespace CheckoutSessionCreateParams {

type: 'product';

anonymous?: boolean;
anonymous?: false;

/**
* JSON object
Expand Down
26 changes: 13 additions & 13 deletions src/resources/customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export interface NonRenewingSubscriptionDetails {

pricingModelId: string;

renews: boolean;
renews: false;

replacedBySubscriptionId: string | null;

Expand Down Expand Up @@ -226,13 +226,13 @@ export namespace NonRenewingSubscriptionDetails {

pricingModelId: string;

quantity: number;
quantity: 0;

subscriptionId: string;

type: 'static';

unitPrice: number;
unitPrice: 0;

/**
* Epoch milliseconds.
Expand Down Expand Up @@ -506,13 +506,13 @@ export namespace StandardSubscriptionDetails {

pricingModelId: string;

quantity: number;
quantity: 0;

subscriptionId: string;

type: 'static';

unitPrice: number;
unitPrice: 0;

/**
* Epoch milliseconds.
Expand Down Expand Up @@ -789,13 +789,13 @@ export namespace CustomerCreateResponse {

pricingModelId: string;

quantity: number;
quantity: 0;

subscriptionId: string;

type: 'static';

unitPrice: number;
unitPrice: 0;

/**
* Epoch milliseconds.
Expand Down Expand Up @@ -907,7 +907,7 @@ export namespace CustomerRetrieveBillingResponse {

customerId: string;

firstInvoiceValue: number;
firstInvoiceValue: 0;

/**
* A positive integer
Expand Down Expand Up @@ -949,7 +949,7 @@ export namespace CustomerRetrieveBillingResponse {
*/
totalPurchaseValue: null;

trialPeriodDays: number;
trialPeriodDays: 0;

/**
* Epoch milliseconds.
Expand Down Expand Up @@ -993,7 +993,7 @@ export namespace CustomerRetrieveBillingResponse {

customerId: string;

firstInvoiceValue: number;
firstInvoiceValue: 0;

/**
* Omitted.
Expand Down Expand Up @@ -1033,7 +1033,7 @@ export namespace CustomerRetrieveBillingResponse {

status: 'open' | 'pending' | 'failed' | 'paid' | 'refunded' | 'partial_refund' | 'fraudulent';

totalPurchaseValue: number;
totalPurchaseValue: 0;

/**
* Omitted.
Expand Down Expand Up @@ -1082,7 +1082,7 @@ export namespace CustomerRetrieveBillingResponse {

customerId: string;

firstInvoiceValue: number;
firstInvoiceValue: 0;

/**
* Omitted.
Expand Down Expand Up @@ -1122,7 +1122,7 @@ export namespace CustomerRetrieveBillingResponse {

status: 'open' | 'pending' | 'failed' | 'paid' | 'refunded' | 'partial_refund' | 'fraudulent';

totalPurchaseValue: number;
totalPurchaseValue: 0;

/**
* Omitted.
Expand Down
2 changes: 1 addition & 1 deletion src/resources/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Payments extends APIResource {
export interface PaymentClientSelectSchema {
id: string;

amount: number;
amount: 0;

applicationFee: number | null;

Expand Down
16 changes: 8 additions & 8 deletions src/resources/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;

Expand All @@ -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.
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/resources/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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.
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/resources/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface NonRenewingSubscriptionRecord {

pricingModelId: string;

renews: boolean;
renews: false;

replacedBySubscriptionId: string | null;

Expand Down
Loading