Skip to content

Commit 4c5c311

Browse files
jar-stripeclaude
andauthored
fix: CJS companion namespace access for resource types at all depths (#2765)
* fix: regenerate types for CJS companion namespace access at all depths Regenerated from stripe/sdk-codegen#3768 which fixes: - Resource sub-types (e.g. Stripe.Price.Recurring) now accessible in CJS - Nested resource types (e.g. Stripe.Billing.Alert.Status) now accessible in both CJS and ESM - Deep params namespaces (e.g. AccountCreateParams.BusinessProfile.AnnualRevenue) now accessible in CJS Fixes #2683 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Committed-By-Agent: claude * test: add regression tests for nested namespace type access Adds type assertions for patterns that were previously broken in CJS (and some in ESM too): - Resource sub-types: Stripe.Price.Recurring, Stripe.Customer.InvoiceSettings - Deep resource sub-types: Stripe.Subscription.BillingMode.Type - Nested resource sub-types: Stripe.Billing.Alert.Status, Stripe.Terminal.Configuration.Tipping, Stripe.Apps.Secret.Scope - Deep params: Stripe.AccountCreateParams.BusinessProfile.AnnualRevenue Added to both testProjects/types/ (ESM) and testProjects/types-cjs-node16/ (CJS) so both declaration files are covered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Committed-By-Agent: claude * test: add namespace regression tests to types-cjs project Same coverage as types/ and types-cjs-node16/ — covers module: commonjs / moduleResolution: node resolution mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Committed-By-Agent: claude --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b8e8c23 commit 4c5c311

72 files changed

Lines changed: 29564 additions & 17903 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/resources/Apps/Secrets.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,23 @@ export interface Secret {
100100
*/
101101
payload?: string | null;
102102

103-
scope: Apps.Secret.Scope;
103+
scope: Secret.Scope;
104104
}
105-
export namespace Apps {
106-
export namespace Secret {
107-
export interface Scope {
108-
/**
109-
* The secret scope type.
110-
*/
111-
type: Scope.Type;
105+
export namespace Secret {
106+
export interface Scope {
107+
/**
108+
* The secret scope type.
109+
*/
110+
type: Scope.Type;
112111

113-
/**
114-
* The user ID, if type is set to "user"
115-
*/
116-
user?: string;
117-
}
112+
/**
113+
* The user ID, if type is set to "user"
114+
*/
115+
user?: string;
116+
}
118117

119-
export namespace Scope {
120-
export type Type = 'account' | 'user';
121-
}
118+
export namespace Scope {
119+
export type Type = 'account' | 'user';
122120
}
123121
}
124122
export namespace Apps {

src/resources/Billing/Alerts.ts

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export interface Alert {
117117
/**
118118
* Status of the alert. This can be active, inactive or archived.
119119
*/
120-
status: Billing.Alert.Status | null;
120+
status: Alert.Status | null;
121121

122122
/**
123123
* Title of the alert.
@@ -127,43 +127,41 @@ export interface Alert {
127127
/**
128128
* Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://docs.stripe.com/api/billing/meter).
129129
*/
130-
usage_threshold: Billing.Alert.UsageThreshold | null;
130+
usage_threshold: Alert.UsageThreshold | null;
131131
}
132-
export namespace Billing {
133-
export namespace Alert {
134-
export type Status = 'active' | 'archived' | 'inactive';
132+
export namespace Alert {
133+
export type Status = 'active' | 'archived' | 'inactive';
135134

136-
export interface UsageThreshold {
137-
/**
138-
* The filters allow limiting the scope of this usage alert. You can only specify up to one filter at this time.
139-
*/
140-
filters: Array<UsageThreshold.Filter> | null;
135+
export interface UsageThreshold {
136+
/**
137+
* The filters allow limiting the scope of this usage alert. You can only specify up to one filter at this time.
138+
*/
139+
filters: Array<UsageThreshold.Filter> | null;
141140

142-
/**
143-
* The value at which this alert will trigger.
144-
*/
145-
gte: number;
141+
/**
142+
* The value at which this alert will trigger.
143+
*/
144+
gte: number;
146145

147-
/**
148-
* The [Billing Meter](https://docs.stripe.com/api/billing/meter) ID whose usage is monitored.
149-
*/
150-
meter: string | Meter;
146+
/**
147+
* The [Billing Meter](https://docs.stripe.com/api/billing/meter) ID whose usage is monitored.
148+
*/
149+
meter: string | Meter;
150+
151+
/**
152+
* Defines how the alert will behave.
153+
*/
154+
recurrence: 'one_time';
155+
}
151156

157+
export namespace UsageThreshold {
158+
export interface Filter {
152159
/**
153-
* Defines how the alert will behave.
160+
* Limit the scope of the alert to this customer ID
154161
*/
155-
recurrence: 'one_time';
156-
}
162+
customer: string | Customer | null;
157163

158-
export namespace UsageThreshold {
159-
export interface Filter {
160-
/**
161-
* Limit the scope of the alert to this customer ID
162-
*/
163-
customer: string | Customer | null;
164-
165-
type: 'customer';
166-
}
164+
type: 'customer';
167165
}
168166
}
169167
}

src/resources/Billing/CreditBalanceSummary.ts

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface CreditBalanceSummary {
2929
/**
3030
* The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
3131
*/
32-
balances: Array<Billing.CreditBalanceSummary.Balance>;
32+
balances: Array<CreditBalanceSummary.Balance>;
3333

3434
/**
3535
* The customer the balance is for.
@@ -46,65 +46,63 @@ export interface CreditBalanceSummary {
4646
*/
4747
livemode: boolean;
4848
}
49-
export namespace Billing {
50-
export namespace CreditBalanceSummary {
51-
export interface Balance {
52-
available_balance: Balance.AvailableBalance;
49+
export namespace CreditBalanceSummary {
50+
export interface Balance {
51+
available_balance: Balance.AvailableBalance;
52+
53+
ledger_balance: Balance.LedgerBalance;
54+
}
55+
56+
export namespace Balance {
57+
export interface AvailableBalance {
58+
/**
59+
* The monetary amount.
60+
*/
61+
monetary: AvailableBalance.Monetary | null;
62+
63+
/**
64+
* The type of this amount. We currently only support `monetary` billing credits.
65+
*/
66+
type: 'monetary';
67+
}
68+
69+
export interface LedgerBalance {
70+
/**
71+
* The monetary amount.
72+
*/
73+
monetary: LedgerBalance.Monetary | null;
5374

54-
ledger_balance: Balance.LedgerBalance;
75+
/**
76+
* The type of this amount. We currently only support `monetary` billing credits.
77+
*/
78+
type: 'monetary';
5579
}
5680

57-
export namespace Balance {
58-
export interface AvailableBalance {
81+
export namespace AvailableBalance {
82+
export interface Monetary {
5983
/**
60-
* The monetary amount.
84+
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
6185
*/
62-
monetary: AvailableBalance.Monetary | null;
86+
currency: string;
6387

6488
/**
65-
* The type of this amount. We currently only support `monetary` billing credits.
89+
* A positive integer representing the amount.
6690
*/
67-
type: 'monetary';
91+
value: number;
6892
}
93+
}
6994

70-
export interface LedgerBalance {
95+
export namespace LedgerBalance {
96+
export interface Monetary {
7197
/**
72-
* The monetary amount.
98+
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
7399
*/
74-
monetary: LedgerBalance.Monetary | null;
100+
currency: string;
75101

76102
/**
77-
* The type of this amount. We currently only support `monetary` billing credits.
103+
* A positive integer representing the amount.
78104
*/
79-
type: 'monetary';
80-
}
81-
82-
export namespace AvailableBalance {
83-
export interface Monetary {
84-
/**
85-
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
86-
*/
87-
currency: string;
88-
89-
/**
90-
* A positive integer representing the amount.
91-
*/
92-
value: number;
93-
}
94-
}
95-
96-
export namespace LedgerBalance {
97-
export interface Monetary {
98-
/**
99-
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
100-
*/
101-
currency: string;
102-
103-
/**
104-
* A positive integer representing the amount.
105-
*/
106-
value: number;
107-
}
105+
value: number;
108106
}
109107
}
110108
}

0 commit comments

Comments
 (0)