@stripe/extensibility-sdk 0.22.4 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/api-surface.d.ts.map +1 -0
  2. package/dist/config-values/generate.cjs +1 -1
  3. package/dist/config-values/generate.d.ts +2 -2
  4. package/dist/config-values/generate.d.ts.map +1 -1
  5. package/dist/config-values/generate.js +1 -1
  6. package/dist/extensibility-sdk-alpha.d.ts +1293 -1
  7. package/dist/extensibility-sdk-beta.d.ts +1293 -1
  8. package/dist/extensibility-sdk-config-values-internal.d.ts +2 -2
  9. package/dist/extensibility-sdk-extensions-alpha.d.ts +56 -77
  10. package/dist/extensibility-sdk-extensions-beta.d.ts +56 -77
  11. package/dist/extensibility-sdk-extensions-internal.d.ts +67 -110
  12. package/dist/extensibility-sdk-extensions-public.d.ts +56 -77
  13. package/dist/extensibility-sdk-internal.d.ts +1304 -1
  14. package/dist/extensibility-sdk-public.d.ts +1293 -1
  15. package/dist/extensions/billing/bill/discount_calculation.d.ts +3 -5
  16. package/dist/extensions/billing/customer_balance_application.d.ts +1 -3
  17. package/dist/extensions/billing/invoice_collection_setting.d.ts +11 -15
  18. package/dist/extensions/billing/prorations.d.ts +21 -30
  19. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +23 -41
  20. package/dist/extensions/billing/types.d.ts +4 -4
  21. package/dist/extensions/core/workflows/custom_action.d.ts +2 -6
  22. package/dist/extensions/extend/workflows/custom_action.d.ts +2 -6
  23. package/dist/index.cjs +2317 -0
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +2320 -0
  27. package/dist/stdlib/decimal.d.ts +4 -40
  28. package/dist/stdlib/refs.d.ts +7 -21
  29. package/dist/stdlib/scalars.d.ts +16 -71
  30. package/dist/stdlib/type-utils.d.ts +1 -3
  31. package/dist/stdlib/types.d.ts +6 -6
  32. package/dist/tsconfig.build.tsbuildinfo +1 -1
  33. package/package.json +2 -10
  34. package/dist/extensibility-sdk-jsonschema-alpha.d.ts +0 -3
  35. package/dist/extensibility-sdk-jsonschema-beta.d.ts +0 -3
  36. package/dist/extensibility-sdk-jsonschema-internal.d.ts +0 -15
  37. package/dist/extensibility-sdk-jsonschema-public.d.ts +0 -3
  38. package/dist/jsonschema.cjs +0 -18
  39. package/dist/jsonschema.d.ts +0 -2
  40. package/dist/jsonschema.d.ts.map +0 -1
  41. package/dist/jsonschema.js +0 -0
@@ -29,7 +29,7 @@ declare const __decimalBrand: unique symbol;
29
29
  *
30
30
  * @public
31
31
  */
32
- export type RoundDirection = 'ceil' | 'floor' | 'round-down' | 'round-up' | 'half-up' | 'half-down' | 'half-even';
32
+ export type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even' | 'half-up' | 'round-down' | 'round-up';
33
33
  /**
34
34
  * Precision specification for `Decimal.round()`.
35
35
  *
@@ -225,7 +225,7 @@ export interface Decimal {
225
225
  * Round this value to the specified precision.
226
226
  * @public
227
227
  */
228
- round(direction: RoundDirection, options: keyof typeof DecimalRoundingPresets | DecimalRoundingOptions): Decimal;
228
+ round(direction: RoundDirection, options: DecimalRoundingOptions | keyof typeof DecimalRoundingPresets): Decimal;
229
229
  /**
230
230
  * Return the canonical string representation.
231
231
  * @public
@@ -250,7 +250,7 @@ export interface Decimal {
250
250
  * Rejects implicit coercion; explicit `String(d)` and template literals still work.
251
251
  * @public
252
252
  */
253
- [Symbol.toPrimitive](hint: 'string' | 'number' | 'default'): string;
253
+ [Symbol.toPrimitive](hint: 'default' | 'number' | 'string'): string;
254
254
  /**
255
255
  * Returns the string representation; invoked by the JavaScript engine as a fallback coercion path.
256
256
  * @public
@@ -281,43 +281,7 @@ export declare function isDecimal(value: unknown): value is Decimal;
281
281
  * @public
282
282
  */
283
283
  export declare const Decimal: {
284
- /**
285
- * Create a `Decimal` from a string, number, or bigint.
286
- *
287
- * @remarks
288
- * - **string**: Parsed as a decimal literal. Accepts an optional sign,
289
- * integer digits, an optional fractional part, and an optional `e`/`E`
290
- * exponent. Leading/trailing whitespace is trimmed.
291
- * - **number**: Must be finite. Converted via `Number.prototype.toString()`
292
- * then parsed, so `Decimal.from(0.1)` produces `"0.1"` (not the
293
- * 53-bit binary approximation).
294
- * - **bigint**: Treated as an integer with exponent 0.
295
- *
296
- * @example
297
- * ```ts
298
- * Decimal.from('1.23'); // string
299
- * Decimal.from(42); // number
300
- * Decimal.from(100n); // bigint
301
- * Decimal.from('1.5e3'); // scientific notation → 1500
302
- * ```
303
- *
304
- * @param value - The value to convert.
305
- * @returns A new frozen `Decimal` instance.
306
- * @throws Error if `value` is a non-finite number, an empty
307
- * string, or a string that does not match the decimal literal grammar.
308
- *
309
- * @public
310
- */
311
- from(value: string | number | bigint): Decimal;
312
- /**
313
- * The `Decimal` value representing zero.
314
- *
315
- * @remarks
316
- * Pre-allocated singleton — prefer `Decimal.zero` over
317
- * `Decimal.from(0)` to avoid an unnecessary allocation.
318
- *
319
- * @public
320
- */
284
+ from(value: bigint | number | string): Decimal;
321
285
  zero: Decimal;
322
286
  };
323
287
  export {};
@@ -20,23 +20,15 @@ export type Ref<T extends {
20
20
  } = {
21
21
  readonly object: string;
22
22
  }> = {
23
- /** The object tag of the referenced resource (e.g., "v2.core.customer"). */
24
- type: ExtractObjectTag<T>;
25
- /** The ID of the referenced resource. */
26
23
  id: string;
24
+ type: ExtractObjectTag<T>;
27
25
  } & {
28
- readonly [__brand]: 'Ref';
29
26
  readonly __type?: T;
27
+ readonly [__brand]: 'Ref';
30
28
  readonly [__stripeType]: 'string';
31
29
  };
32
30
  /** Factory for creating {@link (Ref:type)} values from an object with `object` and `id` fields. @public */
33
- export declare const Ref: {
34
- create: <T extends {
35
- readonly object: string;
36
- }>(step: T & {
37
- readonly id: string;
38
- }) => Ref<T>;
39
- };
31
+ export declare const Ref: { create: <T extends { readonly object: string }>(step: { readonly id: string } & T) => Ref<T> };
40
32
  /**
41
33
  * A paginated list of references to objects of type T.
42
34
  *
@@ -46,17 +38,11 @@ export type PaginatedRefList<T extends {
46
38
  readonly object: string;
47
39
  } = {
48
40
  readonly object: string;
49
- }> = Ref<T>[] & {
50
- readonly [__brand]: 'PaginatedRefList';
41
+ }> = {
51
42
  readonly __type?: T;
43
+ readonly [__brand]: 'PaginatedRefList';
52
44
  readonly [__stripeType]: `list<${Ref<T>[StripeTypeSymbol]}>`;
53
- };
45
+ } & Ref<T>[];
54
46
  /** Factory for creating {@link PaginatedRefList} values from an array of {@link Ref} items. @public */
55
- export declare const PaginatedRefList: {
56
- create: <T extends {
57
- readonly object: string;
58
- } = {
59
- readonly object: string;
60
- }>(items?: Ref<T>[]) => PaginatedRefList<T>;
61
- };
47
+ export declare const PaginatedRefList: { create: <T extends { readonly object: string } = { readonly object: string }>(items?: Ref<T>[]) => PaginatedRefList<T> };
62
48
  //# sourceMappingURL=refs.d.ts.map
@@ -1,19 +1,17 @@
1
1
  import { type __integerBrand } from '@formspec/core';
2
2
  import { type __brand, type __stripeType } from './brand.js';
3
3
  /** A branded object type representing a JSON map (`map<string>`) in the Stripe type system. @public */
4
- export type JsonObject = object & {
4
+ export type JsonObject = {
5
5
  readonly [__brand]: 'JsonObject';
6
6
  readonly [__stripeType]: 'map<string>';
7
- };
7
+ } & object;
8
8
  /** Factory for creating {@link JsonObject} branded values. @public */
9
- export declare const JsonObject: {
10
- create: (value: object) => JsonObject;
11
- };
9
+ export declare const JsonObject: { create: (value: object) => JsonObject };
12
10
  /** A branded integer — a `number` guaranteed to satisfy `Number.isInteger`. @public */
13
- export type Integer = number & {
11
+ export type Integer = {
14
12
  readonly [__integerBrand]: true;
15
13
  readonly [__stripeType]: 'int';
16
- };
14
+ } & number;
17
15
  /**
18
16
  * Distinct brand for PositiveInteger so an Integer is not assignable to
19
17
  * PositiveInteger without going through the guard. PositiveInteger is a
@@ -39,11 +37,11 @@ declare const __positiveIntegerBrand: unique symbol;
39
37
  *
40
38
  * @public
41
39
  */
42
- export type PositiveInteger = number & {
40
+ export type PositiveInteger = {
43
41
  readonly [__integerBrand]: true;
44
42
  readonly [__positiveIntegerBrand]: true;
45
43
  readonly [__stripeType]: 'int';
46
- };
44
+ } & number;
47
45
  /**
48
46
  * Rounding directions for coercing a number to an integer.
49
47
  *
@@ -59,83 +57,30 @@ export type PositiveInteger = number & {
59
57
  *
60
58
  * @public
61
59
  */
62
- export type IntegerRoundDirection = 'ceil' | 'floor' | 'round-down' | 'round-up' | 'half-up';
60
+ export type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
63
61
  /** Factory and type guard for {@link (Integer:type)} branded values. @public */
64
62
  export declare const Integer: {
65
- /**
66
- * Type guard that narrows a `number` to {@link (Integer:type)}.
67
- *
68
- * @example
69
- * ```ts
70
- * const n: number = getCount();
71
- * if (Integer.is(n)) {
72
- * // n is Integer here
73
- * config.retryCount = n;
74
- * }
75
- * ```
76
- * @public
77
- */
78
- is: (value: number) => value is Integer;
79
- /**
80
- * Coerces a number to an {@link (Integer:type)} by rounding.
81
- * Throws if the value is not finite.
82
- *
83
- * @example
84
- * ```ts
85
- * const price = 9.99;
86
- * const rounded = Integer.from(price, 'floor'); // 9
87
- * const ceiled = Integer.from(price, 'ceil'); // 10
88
- * ```
89
- * @public
90
- */
91
63
  from: (value: number, rounding: IntegerRoundDirection) => Integer;
64
+ is: (value: number) => value is Integer;
92
65
  };
93
66
  /** Factory and type guard for {@link (PositiveInteger:type)} branded values. @public */
94
67
  export declare const PositiveInteger: {
95
- /**
96
- * Type guard that narrows a `number` to {@link (PositiveInteger:type)}.
97
- *
98
- * @example
99
- * ```ts
100
- * const n: number = getRetryCount();
101
- * if (PositiveInteger.is(n)) {
102
- * // n is PositiveInteger here
103
- * config.maxRetries = n;
104
- * }
105
- * ```
106
- * @public
107
- */
108
- is: (value: number) => value is PositiveInteger;
109
- /**
110
- * Coerces a number to a {@link (PositiveInteger:type)} by rounding.
111
- * Throws if the value is not finite or the rounded result is negative.
112
- *
113
- * @example
114
- * ```ts
115
- * const ratio = 2.7;
116
- * const count = PositiveInteger.from(ratio, 'floor'); // 2
117
- * ```
118
- * @public
119
- */
120
68
  from: (value: number, rounding: IntegerRoundDirection) => PositiveInteger;
69
+ is: (value: number) => value is PositiveInteger;
121
70
  };
122
71
  /** A branded string representing a street address. @public */
123
- export type StreetAddress = string & {
72
+ export type StreetAddress = {
124
73
  readonly [__brand]: 'StreetAddress';
125
74
  readonly [__stripeType]: 'string';
126
- };
75
+ } & string;
127
76
  /** Factory for creating {@link (StreetAddress:type)} branded values. @public */
128
- export declare const StreetAddress: {
129
- create: (address: string) => StreetAddress;
130
- };
77
+ export declare const StreetAddress: { create: (address: string) => StreetAddress };
131
78
  /** A branded string representing an ISO 8601 datetime. @public */
132
- export type Timestamp = string & {
79
+ export type Timestamp = {
133
80
  readonly [__brand]: 'Timestamp';
134
81
  readonly [__stripeType]: 'string';
135
- };
82
+ } & string;
136
83
  /** Factory for creating {@link (Timestamp:type)} branded values. @public */
137
- export declare const Timestamp: {
138
- create: (value: string) => Timestamp;
139
- };
84
+ export declare const Timestamp: { create: (value: string) => Timestamp };
140
85
  export {};
141
86
  //# sourceMappingURL=scalars.d.ts.map
@@ -3,7 +3,5 @@
3
3
  *
4
4
  * @public
5
5
  */
6
- export type ExtractObjectTag<T> = T extends {
7
- readonly object: infer O;
8
- } ? O extends string ? O : never : never;
6
+ export type ExtractObjectTag<T> = T extends { readonly object: infer O } ? O extends string ? O : never : never;
9
7
  //# sourceMappingURL=type-utils.d.ts.map
@@ -52,12 +52,12 @@ export interface _EnumSpec {
52
52
  * Convert a wire value to an SDK value, or `null` if unknown.
53
53
  * @internal
54
54
  */
55
- fromWire(value: string): string | null;
55
+ fromWire(value: string): null | string;
56
56
  /**
57
57
  * Convert an SDK value to a wire value, or `null` if unknown.
58
58
  * @internal
59
59
  */
60
- toWire(value: string): string | null;
60
+ toWire(value: string): null | string;
61
61
  }
62
62
  /**
63
63
  * Bidirectional enum spec for proto-backed enums. Accepts a single
@@ -74,12 +74,12 @@ export declare class _ProtoEnum implements _EnumSpec {
74
74
  * Convert a proto wire value to an SDK value, or `null` if unknown.
75
75
  * @internal
76
76
  */
77
- fromWire(value: string): string | null;
77
+ fromWire(value: string): null | string;
78
78
  /**
79
79
  * Convert an SDK value to a proto wire value, or `null` if unknown.
80
80
  * @internal
81
81
  */
82
- toWire(value: string): string | null;
82
+ toWire(value: string): null | string;
83
83
  }
84
84
  /**
85
85
  * Validation-only enum spec for config values. Accepts a set of known
@@ -95,12 +95,12 @@ export declare class _ConfigEnum implements _EnumSpec {
95
95
  * Validate and return the wire value unchanged, or `null` if unknown.
96
96
  * @internal
97
97
  */
98
- fromWire(value: string): string | null;
98
+ fromWire(value: string): null | string;
99
99
  /**
100
100
  * Validate and return the SDK value unchanged, or `null` if unknown.
101
101
  * @internal
102
102
  */
103
- toWire(value: string): string | null;
103
+ toWire(value: string): null | string;
104
104
  }
105
105
  /**
106
106
  * A field transformer with the strategy threaded through so transforms can