@stripe/extensibility-sdk 1.0.1 → 1.3.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 (97) hide show
  1. package/README.md +17 -15
  2. package/dist/config-values/generate.cjs +1 -1
  3. package/dist/config-values/generate.d.ts +1 -1
  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 +29 -157
  7. package/dist/extensibility-sdk-beta.d.ts +29 -157
  8. package/dist/extensibility-sdk-config-values-internal.d.ts +1 -1
  9. package/dist/extensibility-sdk-extensions-alpha.d.ts +7 -157
  10. package/dist/extensibility-sdk-extensions-beta.d.ts +7 -157
  11. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-alpha.d.ts +631 -0
  12. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-beta.d.ts +631 -0
  13. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-internal.d.ts +666 -0
  14. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-public.d.ts +631 -0
  15. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-alpha.d.ts +475 -0
  16. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-beta.d.ts +475 -0
  17. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-internal.d.ts +510 -0
  18. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-public.d.ts +475 -0
  19. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-alpha.d.ts +110 -0
  20. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-beta.d.ts +110 -0
  21. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-internal.d.ts +123 -0
  22. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-public.d.ts +110 -0
  23. package/dist/extensibility-sdk-extensions-billing-prorations-alpha.d.ts +607 -0
  24. package/dist/extensibility-sdk-extensions-billing-prorations-beta.d.ts +607 -0
  25. package/dist/extensibility-sdk-extensions-billing-prorations-internal.d.ts +642 -0
  26. package/dist/extensibility-sdk-extensions-billing-prorations-public.d.ts +607 -0
  27. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-alpha.d.ts +735 -0
  28. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-beta.d.ts +735 -0
  29. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-internal.d.ts +772 -0
  30. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-public.d.ts +735 -0
  31. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-alpha.d.ts +126 -0
  32. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-beta.d.ts +126 -0
  33. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-internal.d.ts +140 -0
  34. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-public.d.ts +126 -0
  35. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-alpha.d.ts +126 -0
  36. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-beta.d.ts +126 -0
  37. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-internal.d.ts +140 -0
  38. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-public.d.ts +126 -0
  39. package/dist/extensibility-sdk-extensions-internal.d.ts +7 -157
  40. package/dist/extensibility-sdk-extensions-public.d.ts +7 -157
  41. package/dist/extensibility-sdk-internal-internal.d.ts +2 -2
  42. package/dist/extensibility-sdk-internal.d.ts +145 -162
  43. package/dist/extensibility-sdk-public.d.ts +29 -157
  44. package/dist/extensibility-sdk-stdlib-alpha.d.ts +593 -0
  45. package/dist/extensibility-sdk-stdlib-beta.d.ts +593 -0
  46. package/dist/extensibility-sdk-stdlib-internal.d.ts +1096 -0
  47. package/dist/extensibility-sdk-stdlib-public.d.ts +593 -0
  48. package/dist/extensions/billing/bill/discount_calculation.cjs +437 -0
  49. package/dist/extensions/billing/bill/discount_calculation.d.ts +0 -20
  50. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -1
  51. package/dist/extensions/billing/bill/discount_calculation.js +430 -0
  52. package/dist/extensions/billing/customer_balance_application.cjs +297 -0
  53. package/dist/extensions/billing/customer_balance_application.d.ts +0 -20
  54. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -1
  55. package/dist/extensions/billing/customer_balance_application.js +284 -0
  56. package/dist/extensions/billing/invoice_collection_options.cjs +166 -0
  57. package/dist/extensions/billing/invoice_collection_options.d.ts +4 -24
  58. package/dist/extensions/billing/invoice_collection_options.d.ts.map +1 -1
  59. package/dist/extensions/billing/invoice_collection_options.js +155 -0
  60. package/dist/extensions/billing/prorations.cjs +501 -0
  61. package/dist/extensions/billing/prorations.d.ts +0 -20
  62. package/dist/extensions/billing/prorations.d.ts.map +1 -1
  63. package/dist/extensions/billing/prorations.js +492 -0
  64. package/dist/extensions/billing/recurring_billing_item_handling.cjs +639 -0
  65. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +0 -30
  66. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
  67. package/dist/extensions/billing/recurring_billing_item_handling.js +632 -0
  68. package/dist/extensions/core/workflows/custom_action.cjs +124 -0
  69. package/dist/extensions/core/workflows/custom_action.d.ts +1 -21
  70. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -1
  71. package/dist/extensions/core/workflows/custom_action.js +111 -0
  72. package/dist/extensions/extend/workflows/custom_action.cjs +124 -0
  73. package/dist/extensions/extend/workflows/custom_action.d.ts +1 -21
  74. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -1
  75. package/dist/extensions/extend/workflows/custom_action.js +111 -0
  76. package/dist/extensions/index.cjs +27 -265
  77. package/dist/extensions/index.js +27 -265
  78. package/dist/extensions/registry.d.ts +2 -2
  79. package/dist/extensions/registry.d.ts.map +1 -1
  80. package/dist/index.cjs +452 -2390
  81. package/dist/index.js +479 -2286
  82. package/dist/internal.cjs +22 -54
  83. package/dist/internal.js +22 -54
  84. package/dist/stdlib/generated.d.ts +1 -1
  85. package/dist/stdlib/generated.d.ts.map +1 -1
  86. package/dist/stdlib/index.cjs +2003 -0
  87. package/dist/stdlib/index.d.ts +2 -2
  88. package/dist/stdlib/index.d.ts.map +1 -1
  89. package/dist/stdlib/index.js +1943 -0
  90. package/dist/stdlib/transform-strategies.d.ts +46 -6
  91. package/dist/stdlib/transform-strategies.d.ts.map +1 -1
  92. package/dist/stdlib/types.d.ts +82 -0
  93. package/dist/stdlib/types.d.ts.map +1 -1
  94. package/dist/tsconfig.build.tsbuildinfo +1 -1
  95. package/package.json +65 -1
  96. package/dist/stdlib/extension-method.d.ts +0 -27
  97. package/dist/stdlib/extension-method.d.ts.map +0 -1
@@ -0,0 +1,593 @@
1
+ import { __integerBrand } from '@formspec/core';
2
+
3
+ /**
4
+ * Opaque brand key used as a property key in SDK branded types.
5
+ *
6
+ * @remarks
7
+ * You do not need to use this directly — it is already embedded in
8
+ * branded values returned by factory functions like {@link (Integer:type)}.from().
9
+ *
10
+ * String-literal const (not `unique symbol`) so that independent
11
+ * declaration rollups (root vs subpath) produce structurally compatible
12
+ * branded types.
13
+ *
14
+ * @public
15
+ */
16
+ export declare const __brand: '__brand';
17
+
18
+ /* Excluded from this release type: __decimalBrand */
19
+
20
+ /**
21
+ * Distinct brand key for PositiveInteger so an Integer is not assignable to
22
+ * PositiveInteger without going through the guard. PositiveInteger is a
23
+ * subtype of Integer (it carries both brands), so it can be used wherever
24
+ * Integer is expected.
25
+ *
26
+ * String-literal const (not `unique symbol`) so that independent
27
+ * declaration rollups (root vs subpath) produce structurally compatible
28
+ * branded types.
29
+ *
30
+ * For internal use only — may be removed in a future release.
31
+ *
32
+ * @public
33
+ */
34
+ export declare const __positiveIntegerBrand: '__positiveIntegerBrand';
35
+
36
+ /**
37
+ * Opaque type-tag key used by SDK scalar types to carry Stripe type metadata.
38
+ *
39
+ * @remarks
40
+ * You do not need to use this directly — it is already embedded in
41
+ * branded values returned by factory functions like {@link (Integer:type)}.from().
42
+ *
43
+ * String-literal const (not `unique symbol`) so that independent
44
+ * declaration rollups (root vs subpath) produce structurally compatible
45
+ * branded types.
46
+ *
47
+ * @public
48
+ */
49
+ export declare const __stripeType: '__stripeType';
50
+
51
+ /* Excluded from this release type: _ApiJsonToProto */
52
+
53
+ /* Excluded from this release type: _ApiJsonToProtoStrategy */
54
+
55
+ /* Excluded from this release type: _ApiJsonToType */
56
+
57
+ /* Excluded from this release type: _ApiJsonToTypeStrategy */
58
+
59
+ /* Excluded from this release type: _apply */
60
+
61
+ /* Excluded from this release type: _applyConfig */
62
+
63
+ /* Excluded from this release type: _applyIncoming */
64
+
65
+ /* Excluded from this release type: _applyOutgoing */
66
+
67
+ /* Excluded from this release type: _ApplyStrategy */
68
+
69
+ /** The type of the opaque brand key used as a property key in SDK branded types. @public */
70
+ export declare type BrandSymbol = typeof __brand;
71
+
72
+ /* Excluded from this release type: _configAppContextFromContext */
73
+
74
+ /* Excluded from this release type: _ConfigApplicationContext */
75
+
76
+ /* Excluded from this release type: _ConfigEnum */
77
+
78
+ /* Excluded from this release type: _ConfigStrategy */
79
+
80
+ /** @public */
81
+ export declare type Currency = 'aed' | 'afn' | 'all' | 'amd' | 'ang' | 'aoa' | 'apt' | 'arb' | 'ars' | 'aud' | 'avax' | 'awg' | 'azn' | 'bam' | 'bbd' | 'bdt' | 'bgn' | 'bhd' | 'bif' | 'bmd' | 'bnb' | 'bnd' | 'bob' | 'bov' | 'brl' | 'bsd' | 'btc' | 'btn' | 'buidl' | 'bwp' | 'byn' | 'byr' | 'bzd' | 'cad' | 'cdf' | 'celo' | 'che' | 'chf' | 'chw' | 'clf' | 'clp' | 'cny' | 'cop' | 'cou' | 'crc' | 'cuc' | 'cup' | 'cve' | 'czk' | 'dai' | 'djf' | 'dkk' | 'dop' | 'dzd' | 'eek' | 'egp' | 'ern' | 'etb' | 'eth' | 'eur' | 'eurc' | 'fjd' | 'fkp' | 'frxusd' | 'gbp' | 'gel' | 'ghc' | 'ghs' | 'gip' | 'gmd' | 'gnf' | 'gtq' | 'gyd' | 'hkd' | 'hnl' | 'hrk' | 'htg' | 'huf' | 'hype' | 'idr' | 'ils' | 'inr' | 'iqd' | 'irr' | 'isk' | 'jmd' | 'jod' | 'jpy' | 'kes' | 'kgs' | 'khr' | 'kmf' | 'kpw' | 'krw' | 'kwd' | 'kyd' | 'kzt' | 'lak' | 'lbp' | 'lkr' | 'lrd' | 'lsl' | 'ltl' | 'lvl' | 'lyd' | 'lzd' | 'm' | 'mad' | 'mdl' | 'mga' | 'mkd' | 'mmk' | 'mnt' | 'mon' | 'mop' | 'mro' | 'mru' | 'mur' | 'mvr' | 'mwk' | 'mxn' | 'mxv' | 'myr' | 'mzn' | 'nad' | 'ngn' | 'nio' | 'nok' | 'npr' | 'nzd' | 'omr' | 'open_usd' | 'ord' | 'pab' | 'pen' | 'pgk' | 'php' | 'pkr' | 'pln' | 'pol' | 'pyg' | 'pyusd' | 'qar' | 'rd' | 're' | 'ron' | 'rsd' | 'rub' | 'rwf' | 'sar' | 'sbd' | 'scr' | 'sdg' | 'sek' | 'sgd' | 'shp' | 'sle' | 'sll' | 'sol' | 'sos' | 'srd' | 'ssp' | 'std' | 'stn' | 'sui' | 'svc' | 'syp' | 'szl' | 'thb' | 'tjs' | 'tmt' | 'tnd' | 'top' | 'trx' | 'try' | 'ttd' | 'twd' | 'tzs' | 'uah' | 'ugx' | 'usd' | 'usdb' | 'usdc' | 'usdg' | 'usdp' | 'usdsui' | 'usdt' | 'usn' | 'ustb' | 'uyi' | 'uyu' | 'uzs' | 'vef' | 'ves' | 'vnd' | 'vuv' | 'wst' | 'xaf' | 'xcd' | 'xcg' | 'xeur' | 'xlm' | 'xof' | 'xpf' | 'xpl' | 'xusd' | 'yer' | 'zar' | 'zmk' | 'zmw' | 'zwd' | 'zwg' | 'zwl';
82
+
83
+ /**
84
+ * Arbitrary-precision decimal type for billing calculations.
85
+ *
86
+ * @remarks
87
+ * `Decimal` values are created by the {@link (Decimal:variable) | Decimal companion object}
88
+ * and store values as `coefficient × 10^exponent` using `BigInt`. They avoid
89
+ * every common binary floating-point pitfall — `Decimal.from('0.1').add(Decimal.from('0.2'))`
90
+ * is exactly `0.3`.
91
+ *
92
+ * Instances are immutable (frozen) and all arithmetic returns a new
93
+ * `Decimal`. The public type carries two brand symbols so the type system
94
+ * prevents accidental assignment from plain `number`, `string`, or
95
+ * `bigint`.
96
+ *
97
+ * Create values via the companion object:
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk';
102
+ *
103
+ * const price = Decimal.from('19.99');
104
+ * const tax = price.mul(Decimal.from('0.0825'));
105
+ * const total = price.add(tax);
106
+ *
107
+ * console.log(total.toFixed(2, 'half-up')); // "21.64"
108
+ * console.log(JSON.stringify({ total })); // '{"total":"21.639175"}'
109
+ * console.log(total.toFixed(2, 'half-even')); // "21.64"
110
+ * ```
111
+ *
112
+ * @public
113
+ */
114
+ export declare interface Decimal {
115
+ /* Excluded from this release type: __brand */
116
+ /* Excluded from this release type: __decimalBrand */
117
+ /* Excluded from this release type: __stripeType */
118
+ /**
119
+ * Return the sum of this value and `other`.
120
+ * @public
121
+ */
122
+ add(other: DecimalLike): Decimal;
123
+ /**
124
+ * Return the difference of this value and `other`.
125
+ * @public
126
+ */
127
+ sub(other: DecimalLike): Decimal;
128
+ /**
129
+ * Return the product of this value and `other`.
130
+ * @public
131
+ */
132
+ mul(other: DecimalLike): Decimal;
133
+ /**
134
+ * Return the quotient of this value divided by `other`.
135
+ * @public
136
+ */
137
+ div(other: DecimalLike, precision: number, direction: RoundDirection): Decimal;
138
+ /**
139
+ * Three-way comparison: returns `-1`, `0`, or `1`.
140
+ * @public
141
+ */
142
+ cmp(other: DecimalLike): -1 | 0 | 1;
143
+ /**
144
+ * Return `true` if this value is numerically equal to `other`.
145
+ * @public
146
+ */
147
+ eq(other: DecimalLike): boolean;
148
+ /**
149
+ * Return `true` if this value is strictly less than `other`.
150
+ * @public
151
+ */
152
+ lt(other: DecimalLike): boolean;
153
+ /**
154
+ * Return `true` if this value is less than or equal to `other`.
155
+ * @public
156
+ */
157
+ lte(other: DecimalLike): boolean;
158
+ /**
159
+ * Return `true` if this value is strictly greater than `other`.
160
+ * @public
161
+ */
162
+ gt(other: DecimalLike): boolean;
163
+ /**
164
+ * Return `true` if this value is greater than or equal to `other`.
165
+ * @public
166
+ */
167
+ gte(other: DecimalLike): boolean;
168
+ /**
169
+ * Return `true` if this value is exactly zero.
170
+ * @public
171
+ */
172
+ isZero(): boolean;
173
+ /**
174
+ * Return `true` if this value is strictly less than zero.
175
+ * @public
176
+ */
177
+ isNegative(): boolean;
178
+ /**
179
+ * Return `true` if this value is strictly greater than zero.
180
+ * @public
181
+ */
182
+ isPositive(): boolean;
183
+ /**
184
+ * Return the additive inverse of this value.
185
+ * @public
186
+ */
187
+ neg(): Decimal;
188
+ /**
189
+ * Return the absolute value.
190
+ * @public
191
+ */
192
+ abs(): Decimal;
193
+ /**
194
+ * Round this value to the specified precision.
195
+ * @public
196
+ */
197
+ round(direction: RoundDirection, options: DecimalRoundingOptions | keyof typeof DecimalRoundingPresets): Decimal;
198
+ /**
199
+ * Return the canonical string representation.
200
+ * @public
201
+ */
202
+ toString(): string;
203
+ /**
204
+ * Return the JSON-serializable string representation.
205
+ * @public
206
+ */
207
+ toJSON(): string;
208
+ /**
209
+ * Convert to a JavaScript `number` (lossy).
210
+ * @public
211
+ */
212
+ toNumber(): number;
213
+ /**
214
+ * Format as a fixed-point string with exactly `decimalPlaces` digits.
215
+ * @public
216
+ */
217
+ toFixed(decimalPlaces: number, direction: RoundDirection): string;
218
+ /**
219
+ * Convert to an {@link (Integer:type)} by rounding.
220
+ * @public
221
+ */
222
+ toInteger(direction: RoundDirection): Integer;
223
+ /**
224
+ * Rejects implicit coercion; explicit `String(d)` and template literals still work.
225
+ * @public
226
+ */
227
+ [Symbol.toPrimitive](hint: 'default' | 'number' | 'string'): string;
228
+ /**
229
+ * Returns the string representation; invoked by the JavaScript engine as a fallback coercion path.
230
+ * @public
231
+ */
232
+ valueOf(): string;
233
+ }
234
+
235
+ /**
236
+ * Companion object for creating `Decimal` instances.
237
+ *
238
+ * @public
239
+ */
240
+ export declare const Decimal: DecimalCompanion;
241
+
242
+ /** @public */
243
+ export declare interface DecimalCompanion {
244
+ /** Type guard: narrows `unknown` to `Decimal`. @public */
245
+ is(value: unknown): value is Decimal;
246
+ /** Assertion guard: throws if not a `Decimal`. @public */
247
+ assert(value: unknown): asserts value is Decimal;
248
+ /** Create a Decimal from a {@link DecimalLike} value. @public */
249
+ from(value: DecimalLike): Decimal;
250
+ /** The Decimal value `0`. @public */
251
+ readonly zero: Decimal;
252
+ }
253
+
254
+ /**
255
+ * Values that can be coerced to a `Decimal` via `Decimal.from()`.
256
+ *
257
+ * @remarks
258
+ * This union is accepted by `Decimal.from()` and by all arithmetic and
259
+ * comparison methods on `Decimal` instances. Non-Decimal values are
260
+ * coerced via `Decimal.from()` before the operation.
261
+ *
262
+ * @public
263
+ */
264
+ export declare type DecimalLike = bigint | Decimal | Integer | number | string;
265
+
266
+ /**
267
+ * Precision specification for `Decimal.round()`.
268
+ *
269
+ * @remarks
270
+ * Two modes are supported:
271
+ * - `"decimal-places"` — round to a fixed number of digits after the decimal point.
272
+ * - `"significant-figures"` — round to a fixed number of significant digits.
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * // Round to 2 decimal places
277
+ * amount.round('half-even', { mode: 'decimal-places', value: 2 });
278
+ *
279
+ * // Round to 4 significant figures
280
+ * amount.round('half-up', { mode: 'significant-figures', value: 4 });
281
+ * ```
282
+ *
283
+ * @public
284
+ */
285
+ export declare interface DecimalRoundingOptions {
286
+ /** Whether to count digits from the decimal point (`"decimal-places"`) or from the most significant digit (`"significant-figures"`). */
287
+ mode: 'decimal-places' | 'significant-figures';
288
+ /**
289
+ * The number of digits to retain. Interpreted as decimal places when
290
+ * `mode` is `"decimal-places"`, or as significant figures when `mode`
291
+ * is `"significant-figures"`.
292
+ * @public
293
+ */
294
+ value: number;
295
+ }
296
+
297
+ /**
298
+ * Built-in rounding presets keyed by semantic name.
299
+ *
300
+ * @remarks
301
+ * Stripe defines the full set of supported preset names accepted by
302
+ * `Decimal.round()`.
303
+ *
304
+ * | Preset | Equivalent DecimalRoundingOptions |
305
+ * | ------------------- | ----------------------------------------------------- |
306
+ * | `"ubb-usage-count"` | `{ mode: "significant-figures", value: 15 }` |
307
+ * | `"v1-api"` | `{ mode: "decimal-places", value: 12 }` |
308
+ *
309
+ * @public
310
+ */
311
+ export declare const DecimalRoundingPresets: Readonly<{
312
+ 'ubb-usage-count': Readonly<{
313
+ mode: "significant-figures";
314
+ value: number;
315
+ }>;
316
+ 'v1-api': Readonly<{
317
+ mode: "decimal-places";
318
+ value: number;
319
+ }>;
320
+ }>;
321
+
322
+ /**
323
+ * Recursively converts a type to a deeply-readonly version.
324
+ *
325
+ * Primitive types (`string`, `number`, `boolean`, `bigint`, `symbol`,
326
+ * `undefined`, `null`) are returned as-is. Arrays become `readonly` arrays
327
+ * of deeply-readonly elements. Object types have each property marked
328
+ * `readonly`, and the type of each property is recursively transformed.
329
+ *
330
+ * @public
331
+ */
332
+ export declare type DeepReadonly<T> = T extends bigint | boolean | null | number | string | symbol | undefined ? T : T extends readonly (infer Item)[] ? readonly DeepReadonly<Item>[] : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
333
+
334
+ /**
335
+ * The IEEE 754 decimal128 coefficient size (34 digits) — the recommended
336
+ * precision for `Decimal.div()` when full precision is desired.
337
+ *
338
+ * @remarks
339
+ * Pass this as the `precision` argument to `div()` when you want the
340
+ * maximum available precision. Division requires explicit precision —
341
+ * no invisible defaults in financial code.
342
+ *
343
+ * @example
344
+ * ```ts
345
+ * // Use the full decimal128 precision explicitly
346
+ * a.div(b, DEFAULT_DIV_PRECISION, 'half-even');
347
+ * ```
348
+ *
349
+ * @public
350
+ */
351
+ export declare const DEFAULT_DIV_PRECISION = 34;
352
+
353
+ /* Excluded from this release type: _EnumSpec */
354
+
355
+ /**
356
+ * Extracts the string literal type of the `object` property from T.
357
+ *
358
+ * @public
359
+ */
360
+ export declare type ExtractObjectTag<T> = T extends { readonly object: infer O } ? O extends string ? O : never : never;
361
+
362
+ /* Excluded from this release type: _FieldDescriptor */
363
+
364
+ /* Excluded from this release type: _FieldTransformer */
365
+
366
+ /* Excluded from this release type: _identity */
367
+
368
+ /* Excluded from this release type: _IncomingRuntimeStrategy */
369
+
370
+ /** A branded integer — a `number` guaranteed to satisfy `Number.isInteger`. @public */
371
+ export declare type Integer = {
372
+ readonly [__integerBrand]: true;
373
+ readonly [__stripeType]: 'int';
374
+ } & number;
375
+
376
+ /** Factory, type guard, and utilities for {@link (Integer:type)} branded values. @public */
377
+ export declare const Integer: IntegerCompanion;
378
+
379
+ /** @public */
380
+ export declare interface IntegerCompanion {
381
+ /** The Integer value `0`. @public */
382
+ readonly zero: Integer;
383
+ /** Type guard: narrows `unknown` to {@link (Integer:type)}. @public */
384
+ is(value: unknown): value is Integer;
385
+ /** Assertion guard: throws if not an {@link (Integer:type)}. @public */
386
+ assert(value: unknown): asserts value is Integer;
387
+ /** Coerce a value to {@link (Integer:type)} by rounding. @public */
388
+ from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): Integer;
389
+ /** Lossless conversion to `Decimal`. @public */
390
+ toDecimal(value: Integer): Decimal;
391
+ /** Type guard: narrows {@link (Integer:type)} to {@link (PositiveInteger:type)}. @public */
392
+ isPositive(value: Integer): value is PositiveInteger;
393
+ /** Assertion guard: throws if the Integer is negative. @public */
394
+ assertIsPositive(value: Integer): asserts value is PositiveInteger;
395
+ }
396
+
397
+ /**
398
+ * Rounding directions for coercing a number to an integer.
399
+ *
400
+ * A focused subset of {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3:
401
+ *
402
+ * | Direction | Behavior | Examples (→ integer) |
403
+ * | -------------- | ---------------------------- | ------------------------------ |
404
+ * | `'ceil'` | Toward +∞ | 1.1→2, -1.1→-1 |
405
+ * | `'floor'` | Toward -∞ | 1.9→1, -1.1→-2 |
406
+ * | `'round-down'` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
407
+ * | `'round-up'` | Away from zero | 1.1→2, -1.1→-2 |
408
+ * | `'half-up'` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
409
+ *
410
+ * @public
411
+ */
412
+ export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
413
+
414
+ /* Excluded from this release type: _isPromiseLike */
415
+
416
+ /* Excluded from this release type: _JsonWireToType */
417
+
418
+ /* Excluded from this release type: _JsonWireToTypeStrategy */
419
+
420
+ /**
421
+ * Represents a monetary value with amount and currency.
422
+ * @format monetary-amount
423
+ * @public
424
+ */
425
+ export declare interface MonetaryAmount {
426
+ /** The numerical value. */
427
+ amount: Decimal;
428
+ /** The currency code. */
429
+ currency: Currency;
430
+ }
431
+
432
+ /* Excluded from this release type: _OneofBranchDescriptor */
433
+
434
+ /* Excluded from this release type: _OneofFieldDescriptor */
435
+
436
+ /* Excluded from this release type: _OutgoingRuntimeStrategy */
437
+
438
+ /**
439
+ * A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
440
+ *
441
+ * This is a subtype of {@link (Integer:type)}: every non-negative integer is an
442
+ * integer, so `PositiveInteger` values are assignable to `Integer` contexts.
443
+ * The reverse is not true — an `Integer` cannot be assigned where a
444
+ * `PositiveInteger` is expected without going through the `PositiveInteger.is()`
445
+ * type guard or `PositiveInteger.from()` factory.
446
+ *
447
+ * @remarks
448
+ * Despite the name, this type includes zero (`>= 0`, not `> 0`).
449
+ * The schema-level constraint `@minimum 0` should be added to fields
450
+ * typed as `PositiveInteger` to ensure the non-negativity invariant
451
+ * is enforced at validation time.
452
+ *
453
+ * @public
454
+ */
455
+ export declare type PositiveInteger = {
456
+ readonly [__integerBrand]: true;
457
+ readonly [__positiveIntegerBrand]: true;
458
+ readonly [__stripeType]: 'int';
459
+ } & number;
460
+
461
+ /** Factory, type guard, and utilities for {@link (PositiveInteger:type)} branded values. @public */
462
+ export declare const PositiveInteger: PositiveIntegerCompanion;
463
+
464
+ /** @public */
465
+ export declare interface PositiveIntegerCompanion {
466
+ /** Type guard: narrows `unknown` to {@link (PositiveInteger:type)}. @public */
467
+ is(value: unknown): value is PositiveInteger;
468
+ /** Assertion guard: throws if not a {@link (PositiveInteger:type)}. @public */
469
+ assert(value: unknown): asserts value is PositiveInteger;
470
+ /** Coerce a value to {@link (PositiveInteger:type)} by rounding. Throws if negative. @public */
471
+ from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): PositiveInteger;
472
+ }
473
+
474
+ /* Excluded from this release type: _ProtoEnum */
475
+
476
+ /* Excluded from this release type: _ProtoToApiJson */
477
+
478
+ /* Excluded from this release type: _ProtoToApiJsonStrategy */
479
+
480
+ /* Excluded from this release type: _ProtoWireToType */
481
+
482
+ /* Excluded from this release type: _ProtoWireToTypeStrategy */
483
+
484
+ /**
485
+ * Object reference — a typed pointer to another API resource.
486
+ *
487
+ * @example
488
+ * ```
489
+ * { type: "v2.core.customer", id: "cus_1234" }
490
+ * ```
491
+ *
492
+ * The type parameter T must have a readonly `object` property
493
+ * whose string literal type becomes the `type` field's value.
494
+ *
495
+ * @discriminator :type T
496
+ *
497
+ * @public
498
+ */
499
+ export declare type Ref<T extends {
500
+ readonly object: string;
501
+ } = {
502
+ readonly object: string;
503
+ }> = {
504
+ id: string;
505
+ type: ExtractObjectTag<T>;
506
+ } & {
507
+ readonly __type?: T;
508
+ readonly [__brand]: 'Ref';
509
+ readonly [__stripeType]: 'string';
510
+ };
511
+
512
+ /* Excluded from this release type: _required */
513
+
514
+ /**
515
+ * Rounding direction for Decimal operations.
516
+ *
517
+ * @remarks
518
+ * Seven modes corresponding to
519
+ * {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3
520
+ * rounding-direction attributes:
521
+ *
522
+ * | Direction | IEEE 754 name | Behavior | Examples (→ integer) |
523
+ * | -------------- | ----------------------- | --------------------------------- | ------------------------------------- |
524
+ * | `'ceil'` | `roundTowardPositive` | Toward +∞ | 1.1→2, -1.1→-1 |
525
+ * | `'floor'` | `roundTowardNegative` | Toward -∞ | 1.9→1, -1.1→-2 |
526
+ * | `'round-down'` | `roundTowardZero` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
527
+ * | `'round-up'` | — | Away from zero | 1.1→2, -1.1→-2 |
528
+ * | `'half-up'` | `roundTiesToAway` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
529
+ * | `'half-down'` | — | Nearest; ties toward zero | 0.5→0, -0.5→0, 1.6→2 |
530
+ * | `'half-even'` | `roundTiesToEven` | Nearest; ties to even (banker's) | 0.5→0, 1.5→2, 2.5→2, 3.5→4 |
531
+ *
532
+ * @public
533
+ */
534
+ export declare type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even' | 'half-up' | 'round-down' | 'round-up';
535
+
536
+ /* Excluded from this release type: _ShapeDescriptor */
537
+
538
+ /** The type of the opaque Stripe type-tag key used in SDK scalar types. @public */
539
+ export declare type StripeTypeSymbol = typeof __stripeType;
540
+
541
+ /**
542
+ * Deep-freezes `value` and returns it typed as {@link DeepReadonly}`<T>`.
543
+ *
544
+ * Use this helper for module-scoped constant objects and arrays to satisfy
545
+ * the `dsl/no-module-scoped-mutable-const` lint rule. Unlike `Object.freeze`,
546
+ * which is shallow, `toConst` recursively freezes all nested objects and arrays.
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * import { toConst } from '@stripe/extensibility-sdk';
551
+ *
552
+ * const DEFAULTS = toConst({ timeout: 30, retries: 3 });
553
+ * // Type: { readonly timeout: 30; readonly retries: 3 }
554
+ *
555
+ * const STATUSES = toConst(['active', 'pending', 'cancelled']);
556
+ * // Type: readonly ["active", "pending", "cancelled"]
557
+ * ```
558
+ *
559
+ * @public
560
+ */
561
+ export declare function toConst<T>(value: T): DeepReadonly<T>;
562
+
563
+ /* Excluded from this release type: _translateArray */
564
+
565
+ /* Excluded from this release type: _translateDateTime */
566
+
567
+ /* Excluded from this release type: _translateDecimal */
568
+
569
+ /* Excluded from this release type: _translateEnum */
570
+
571
+ /* Excluded from this release type: _translateMap */
572
+
573
+ /* Excluded from this release type: _translateShape */
574
+
575
+ /* Excluded from this release type: _translateUnion */
576
+
577
+ /* Excluded from this release type: _TypeToApiJson */
578
+
579
+ /* Excluded from this release type: _TypeToApiJsonStrategy */
580
+
581
+ /* Excluded from this release type: _TypeToProtoWire */
582
+
583
+ /* Excluded from this release type: _TypeToProtoWireStrategy */
584
+
585
+ /* Excluded from this release type: _UnionBranchDescriptor */
586
+
587
+ /* Excluded from this release type: _UnionDescriptor */
588
+
589
+ /* Excluded from this release type: _WireReadError */
590
+
591
+ /* Excluded from this release type: _WireWriteError */
592
+
593
+ export { }