@stripe/extensibility-sdk 1.1.0 → 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,1096 @@
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
+ /**
19
+ * Unique brand key for the `Decimal` type.
20
+ *
21
+ * Using a dedicated key (rather than the shared `__brand`) lets formspec's
22
+ * structural brand-detection distinguish `Decimal` from other SDK branded
23
+ * types (e.g., `Ref`) that also carry `[__brand]`.
24
+ *
25
+ * String-literal const (not `unique symbol`) so that independent
26
+ * declaration rollups (root vs subpath) produce structurally compatible
27
+ * branded types.
28
+ *
29
+ * @internal
30
+ */
31
+ export declare const __decimalBrand: '__decimalBrand';
32
+
33
+ /**
34
+ * Distinct brand key for PositiveInteger so an Integer is not assignable to
35
+ * PositiveInteger without going through the guard. PositiveInteger is a
36
+ * subtype of Integer (it carries both brands), so it can be used wherever
37
+ * Integer is expected.
38
+ *
39
+ * String-literal const (not `unique symbol`) so that independent
40
+ * declaration rollups (root vs subpath) produce structurally compatible
41
+ * branded types.
42
+ *
43
+ * For internal use only — may be removed in a future release.
44
+ *
45
+ * @public
46
+ */
47
+ export declare const __positiveIntegerBrand: '__positiveIntegerBrand';
48
+
49
+ /**
50
+ * Opaque type-tag key used by SDK scalar types to carry Stripe type metadata.
51
+ *
52
+ * @remarks
53
+ * You do not need to use this directly — it is already embedded in
54
+ * branded values returned by factory functions like {@link (Integer:type)}.from().
55
+ *
56
+ * String-literal const (not `unique symbol`) so that independent
57
+ * declaration rollups (root vs subpath) produce structurally compatible
58
+ * branded types.
59
+ *
60
+ * @public
61
+ */
62
+ export declare const __stripeType: '__stripeType';
63
+
64
+ /**
65
+ * Stage-2 outgoing strategy: transforms API-JSON to proto wire format.
66
+ * Performs structural transformations (camelCase → snake_case key renaming,
67
+ * SDK enum → proto enum translation, discriminated union → proto oneof,
68
+ * plain string → `{value: string}` decimal wrapping).
69
+ *
70
+ * @internal
71
+ */
72
+ export declare const _ApiJsonToProto: _ApiJsonToProtoStrategy;
73
+
74
+ /**
75
+ * Branded strategy for API-JSON → proto wire (stage 2 outgoing).
76
+ * Performs structural transformations (key renaming back to snake_case,
77
+ * enum translation to proto values, union restructuring to oneof, decimal
78
+ * wrapping as `{value: string}`).
79
+ *
80
+ * @internal
81
+ */
82
+ export declare interface _ApiJsonToProtoStrategy extends _ApplyStrategy {
83
+ /**
84
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
85
+ * @internal
86
+ */
87
+ readonly _brand: 'ApiJsonToProto';
88
+ }
89
+
90
+ /**
91
+ * Stage-2 incoming strategy: hydrates SDK objects from API-JSON.
92
+ * Reads from camelCase keys (already renamed by stage 1), constructs
93
+ * Decimal and Date instances from plain strings, validates required
94
+ * fields, and recursively hydrates nested shapes and unions that are
95
+ * already in discriminated form.
96
+ *
97
+ * @internal
98
+ */
99
+ export declare const _ApiJsonToType: _ApiJsonToTypeStrategy;
100
+
101
+ /**
102
+ * Branded strategy for API-JSON → SDK types (stage 2 incoming).
103
+ * Hydrates JS objects (Decimal, Date) from the already-restructured
104
+ * API-JSON intermediate format.
105
+ *
106
+ * @internal
107
+ */
108
+ export declare interface _ApiJsonToTypeStrategy extends _ApplyStrategy {
109
+ /**
110
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
111
+ * @internal
112
+ */
113
+ readonly _brand: 'ApiJsonToType';
114
+ }
115
+
116
+ /**
117
+ * Apply a strategy to a field array, transforming each field.
118
+ * The strategy determines direction (proto→SDK, SDK→proto, or JSON→SDK).
119
+ *
120
+ * @internal
121
+ */
122
+ export declare function _apply<S extends _ApplyStrategy>(descriptor: _ShapeDescriptor<S>, strategy: S, inputObject: unknown, typeName?: string): Record<string, unknown>;
123
+
124
+ /**
125
+ * Apply _JsonWireToType to a config descriptor, returning the typed config value.
126
+ *
127
+ * When `appCtx` is provided and contains a `clockTime`, empty datetime fields
128
+ * are backfilled from the clock time instead of returning `undefined`.
129
+ *
130
+ * @internal
131
+ */
132
+ export declare function _applyConfig<T, S extends _JsonWireToTypeStrategy>(descriptor: _ShapeDescriptor<S, T>, inputObject: unknown, appCtx?: _ConfigApplicationContext): T;
133
+
134
+ /**
135
+ * Apply _ProtoWireToType to a descriptor, returning the typed SDK value.
136
+ *
137
+ * @internal
138
+ */
139
+ export declare function _applyIncoming<T, S extends _ProtoWireToTypeStrategy>(descriptor: _ShapeDescriptor<S, T>, inputObject: unknown): T;
140
+
141
+ /**
142
+ * Apply _TypeToProtoWire to a descriptor.
143
+ *
144
+ * @internal
145
+ */
146
+ export declare function _applyOutgoing<T, S extends _TypeToProtoWireStrategy>(descriptor: _ShapeDescriptor<S, T>, inputObject: T): Record<string, unknown>;
147
+
148
+ /**
149
+ * Encapsulates transformation direction and direction-specific primitives.
150
+ *
151
+ * @internal
152
+ */
153
+ export declare interface _ApplyStrategy {
154
+ /**
155
+ * Given a field descriptor and the whole input object, produces the
156
+ * [outputKey, outputValue] pair for one field. Strategy owns key selection,
157
+ * value extraction, and error wrapping. `typeName` is used to prefix
158
+ * error messages as `TypeName.fieldName: message`.
159
+ */
160
+ applyField(typeName: string, desc: _FieldDescriptor, input: Record<string, unknown>, strategy: _ApplyStrategy): [outputKey: string, outputValue: unknown];
161
+ /** Creates the null-input error for this strategy direction. */
162
+ createNotObjectError(loc: string, received: string): Error;
163
+ /** Converts a decimal value for this strategy's direction. */
164
+ translateDecimal(value: unknown): unknown;
165
+ /** Converts a datetime value for this strategy's direction. */
166
+ translateDateTime(value: unknown): unknown;
167
+ /** Validates or translates an enum value using the given spec. */
168
+ translateEnum(spec: _EnumSpec, value: unknown): unknown;
169
+ /** Transforms a discriminated union value for this strategy's direction. */
170
+ applyUnion(descriptor: _UnionDescriptor, input: unknown): unknown;
171
+ /**
172
+ * Transforms a oneof field within a shape (mixed message).
173
+ * Merges the oneof's key-value pairs directly into `result`.
174
+ *
175
+ * `excludeWireKeys` lists all wire keys on the parent object that should
176
+ * not be claimed as an unknown oneof variant: regular fields, all known
177
+ * oneof branch keys (including this oneof's own), and keys already claimed
178
+ * by a previous oneof's 'other' fallback.
179
+ */
180
+ applyOneofField(typeName: string, oneof: _OneofFieldDescriptor, input: Record<string, unknown>, strategy: _ApplyStrategy, result: Record<string, unknown>, excludeWireKeys: Set<string>): void;
181
+ }
182
+
183
+ /** The type of the opaque brand key used as a property key in SDK branded types. @public */
184
+ export declare type BrandSymbol = typeof __brand;
185
+
186
+ /**
187
+ * Builds a `ConfigApplicationContext` from the raw extension context.
188
+ *
189
+ * Extracts `clockTime` when present and validates it is a string.
190
+ * Returns an empty context when the field is absent or ctx is not an object.
191
+ *
192
+ * @internal
193
+ */
194
+ export declare function _configAppContextFromContext(ctx: unknown): _ConfigApplicationContext;
195
+
196
+ /**
197
+ * Context values threaded into config application at runtime.
198
+ *
199
+ * The platform dispatch layer builds this from the extension context
200
+ * (`_configAppContextFromContext`) and passes it through the config
201
+ * transformer into `_applyConfig`.
202
+ *
203
+ * @internal
204
+ */
205
+ export declare interface _ConfigApplicationContext {
206
+ /** ISO 8601 clock time for Billing test clocks. */
207
+ clockTime?: string;
208
+ }
209
+
210
+ /**
211
+ * Validation-only enum spec for config values. Accepts a set of known
212
+ * SDK values; both `fromWire` and `toWire` return the value unchanged
213
+ * if it is known, or `null` if it is not.
214
+ *
215
+ * @internal
216
+ */
217
+ export declare class _ConfigEnum implements _EnumSpec {
218
+ private readonly _values;
219
+ constructor(values: string[]);
220
+ /**
221
+ * Validate and return the wire value unchanged, or `null` if unknown.
222
+ * @internal
223
+ */
224
+ fromWire(value: string): null | string;
225
+ /**
226
+ * Validate and return the SDK value unchanged, or `null` if unknown.
227
+ * @internal
228
+ */
229
+ toWire(value: string): null | string;
230
+ }
231
+
232
+ /**
233
+ * Union of strategies that process config data (JSON → SDK types).
234
+ *
235
+ * @internal
236
+ */
237
+ export declare type _ConfigStrategy = _JsonWireToTypeStrategy;
238
+
239
+ /** @public */
240
+ 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';
241
+
242
+ /**
243
+ * Arbitrary-precision decimal type for billing calculations.
244
+ *
245
+ * @remarks
246
+ * `Decimal` values are created by the {@link (Decimal:variable) | Decimal companion object}
247
+ * and store values as `coefficient × 10^exponent` using `BigInt`. They avoid
248
+ * every common binary floating-point pitfall — `Decimal.from('0.1').add(Decimal.from('0.2'))`
249
+ * is exactly `0.3`.
250
+ *
251
+ * Instances are immutable (frozen) and all arithmetic returns a new
252
+ * `Decimal`. The public type carries two brand symbols so the type system
253
+ * prevents accidental assignment from plain `number`, `string`, or
254
+ * `bigint`.
255
+ *
256
+ * Create values via the companion object:
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk';
261
+ *
262
+ * const price = Decimal.from('19.99');
263
+ * const tax = price.mul(Decimal.from('0.0825'));
264
+ * const total = price.add(tax);
265
+ *
266
+ * console.log(total.toFixed(2, 'half-up')); // "21.64"
267
+ * console.log(JSON.stringify({ total })); // '{"total":"21.639175"}'
268
+ * console.log(total.toFixed(2, 'half-even')); // "21.64"
269
+ * ```
270
+ *
271
+ * @public
272
+ */
273
+ export declare interface Decimal {
274
+ /**
275
+ * Nominal brand tag.
276
+ * @internal
277
+ */
278
+ readonly [__brand]: 'Decimal';
279
+ /** @internal */
280
+ readonly [__decimalBrand]: true;
281
+ /**
282
+ * Stripe type discriminator.
283
+ * @internal
284
+ */
285
+ readonly [__stripeType]: 'decimal';
286
+ /**
287
+ * Return the sum of this value and `other`.
288
+ * @public
289
+ */
290
+ add(other: DecimalLike): Decimal;
291
+ /**
292
+ * Return the difference of this value and `other`.
293
+ * @public
294
+ */
295
+ sub(other: DecimalLike): Decimal;
296
+ /**
297
+ * Return the product of this value and `other`.
298
+ * @public
299
+ */
300
+ mul(other: DecimalLike): Decimal;
301
+ /**
302
+ * Return the quotient of this value divided by `other`.
303
+ * @public
304
+ */
305
+ div(other: DecimalLike, precision: number, direction: RoundDirection): Decimal;
306
+ /**
307
+ * Three-way comparison: returns `-1`, `0`, or `1`.
308
+ * @public
309
+ */
310
+ cmp(other: DecimalLike): -1 | 0 | 1;
311
+ /**
312
+ * Return `true` if this value is numerically equal to `other`.
313
+ * @public
314
+ */
315
+ eq(other: DecimalLike): boolean;
316
+ /**
317
+ * Return `true` if this value is strictly less than `other`.
318
+ * @public
319
+ */
320
+ lt(other: DecimalLike): boolean;
321
+ /**
322
+ * Return `true` if this value is less than or equal to `other`.
323
+ * @public
324
+ */
325
+ lte(other: DecimalLike): boolean;
326
+ /**
327
+ * Return `true` if this value is strictly greater than `other`.
328
+ * @public
329
+ */
330
+ gt(other: DecimalLike): boolean;
331
+ /**
332
+ * Return `true` if this value is greater than or equal to `other`.
333
+ * @public
334
+ */
335
+ gte(other: DecimalLike): boolean;
336
+ /**
337
+ * Return `true` if this value is exactly zero.
338
+ * @public
339
+ */
340
+ isZero(): boolean;
341
+ /**
342
+ * Return `true` if this value is strictly less than zero.
343
+ * @public
344
+ */
345
+ isNegative(): boolean;
346
+ /**
347
+ * Return `true` if this value is strictly greater than zero.
348
+ * @public
349
+ */
350
+ isPositive(): boolean;
351
+ /**
352
+ * Return the additive inverse of this value.
353
+ * @public
354
+ */
355
+ neg(): Decimal;
356
+ /**
357
+ * Return the absolute value.
358
+ * @public
359
+ */
360
+ abs(): Decimal;
361
+ /**
362
+ * Round this value to the specified precision.
363
+ * @public
364
+ */
365
+ round(direction: RoundDirection, options: DecimalRoundingOptions | keyof typeof DecimalRoundingPresets): Decimal;
366
+ /**
367
+ * Return the canonical string representation.
368
+ * @public
369
+ */
370
+ toString(): string;
371
+ /**
372
+ * Return the JSON-serializable string representation.
373
+ * @public
374
+ */
375
+ toJSON(): string;
376
+ /**
377
+ * Convert to a JavaScript `number` (lossy).
378
+ * @public
379
+ */
380
+ toNumber(): number;
381
+ /**
382
+ * Format as a fixed-point string with exactly `decimalPlaces` digits.
383
+ * @public
384
+ */
385
+ toFixed(decimalPlaces: number, direction: RoundDirection): string;
386
+ /**
387
+ * Convert to an {@link (Integer:type)} by rounding.
388
+ * @public
389
+ */
390
+ toInteger(direction: RoundDirection): Integer;
391
+ /**
392
+ * Rejects implicit coercion; explicit `String(d)` and template literals still work.
393
+ * @public
394
+ */
395
+ [Symbol.toPrimitive](hint: 'default' | 'number' | 'string'): string;
396
+ /**
397
+ * Returns the string representation; invoked by the JavaScript engine as a fallback coercion path.
398
+ * @public
399
+ */
400
+ valueOf(): string;
401
+ }
402
+
403
+ /**
404
+ * Companion object for creating `Decimal` instances.
405
+ *
406
+ * @public
407
+ */
408
+ export declare const Decimal: DecimalCompanion;
409
+
410
+ /** @public */
411
+ export declare interface DecimalCompanion {
412
+ /** Type guard: narrows `unknown` to `Decimal`. @public */
413
+ is(value: unknown): value is Decimal;
414
+ /** Assertion guard: throws if not a `Decimal`. @public */
415
+ assert(value: unknown): asserts value is Decimal;
416
+ /** Create a Decimal from a {@link DecimalLike} value. @public */
417
+ from(value: DecimalLike): Decimal;
418
+ /** The Decimal value `0`. @public */
419
+ readonly zero: Decimal;
420
+ }
421
+
422
+ /**
423
+ * Values that can be coerced to a `Decimal` via `Decimal.from()`.
424
+ *
425
+ * @remarks
426
+ * This union is accepted by `Decimal.from()` and by all arithmetic and
427
+ * comparison methods on `Decimal` instances. Non-Decimal values are
428
+ * coerced via `Decimal.from()` before the operation.
429
+ *
430
+ * @public
431
+ */
432
+ export declare type DecimalLike = bigint | Decimal | Integer | number | string;
433
+
434
+ /**
435
+ * Precision specification for `Decimal.round()`.
436
+ *
437
+ * @remarks
438
+ * Two modes are supported:
439
+ * - `"decimal-places"` — round to a fixed number of digits after the decimal point.
440
+ * - `"significant-figures"` — round to a fixed number of significant digits.
441
+ *
442
+ * @example
443
+ * ```ts
444
+ * // Round to 2 decimal places
445
+ * amount.round('half-even', { mode: 'decimal-places', value: 2 });
446
+ *
447
+ * // Round to 4 significant figures
448
+ * amount.round('half-up', { mode: 'significant-figures', value: 4 });
449
+ * ```
450
+ *
451
+ * @public
452
+ */
453
+ export declare interface DecimalRoundingOptions {
454
+ /** Whether to count digits from the decimal point (`"decimal-places"`) or from the most significant digit (`"significant-figures"`). */
455
+ mode: 'decimal-places' | 'significant-figures';
456
+ /**
457
+ * The number of digits to retain. Interpreted as decimal places when
458
+ * `mode` is `"decimal-places"`, or as significant figures when `mode`
459
+ * is `"significant-figures"`.
460
+ * @public
461
+ */
462
+ value: number;
463
+ }
464
+
465
+ /**
466
+ * Built-in rounding presets keyed by semantic name.
467
+ *
468
+ * @remarks
469
+ * Stripe defines the full set of supported preset names accepted by
470
+ * `Decimal.round()`.
471
+ *
472
+ * | Preset | Equivalent DecimalRoundingOptions |
473
+ * | ------------------- | ----------------------------------------------------- |
474
+ * | `"ubb-usage-count"` | `{ mode: "significant-figures", value: 15 }` |
475
+ * | `"v1-api"` | `{ mode: "decimal-places", value: 12 }` |
476
+ *
477
+ * @public
478
+ */
479
+ export declare const DecimalRoundingPresets: Readonly<{
480
+ 'ubb-usage-count': Readonly<{
481
+ mode: "significant-figures";
482
+ value: number;
483
+ }>;
484
+ 'v1-api': Readonly<{
485
+ mode: "decimal-places";
486
+ value: number;
487
+ }>;
488
+ }>;
489
+
490
+ /**
491
+ * Recursively converts a type to a deeply-readonly version.
492
+ *
493
+ * Primitive types (`string`, `number`, `boolean`, `bigint`, `symbol`,
494
+ * `undefined`, `null`) are returned as-is. Arrays become `readonly` arrays
495
+ * of deeply-readonly elements. Object types have each property marked
496
+ * `readonly`, and the type of each property is recursively transformed.
497
+ *
498
+ * @public
499
+ */
500
+ 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;
501
+
502
+ /**
503
+ * The IEEE 754 decimal128 coefficient size (34 digits) — the recommended
504
+ * precision for `Decimal.div()` when full precision is desired.
505
+ *
506
+ * @remarks
507
+ * Pass this as the `precision` argument to `div()` when you want the
508
+ * maximum available precision. Division requires explicit precision —
509
+ * no invisible defaults in financial code.
510
+ *
511
+ * @example
512
+ * ```ts
513
+ * // Use the full decimal128 precision explicitly
514
+ * a.div(b, DEFAULT_DIV_PRECISION, 'half-even');
515
+ * ```
516
+ *
517
+ * @public
518
+ */
519
+ export declare const DEFAULT_DIV_PRECISION = 34;
520
+
521
+ /**
522
+ * Common interface for enum conversion specs. `fromWire` converts an
523
+ * incoming wire string to an SDK value; `toWire` does the reverse.
524
+ * Both return `null` for unknown values.
525
+ *
526
+ * @internal
527
+ */
528
+ export declare interface _EnumSpec {
529
+ /**
530
+ * Convert a wire value to an SDK value, or `null` if unknown.
531
+ * @internal
532
+ */
533
+ fromWire(value: string): null | string;
534
+ /**
535
+ * Convert an SDK value to a wire value, or `null` if unknown.
536
+ * @internal
537
+ */
538
+ toWire(value: string): null | string;
539
+ }
540
+
541
+ /**
542
+ * Extracts the string literal type of the `object` property from T.
543
+ *
544
+ * @public
545
+ */
546
+ export declare type ExtractObjectTag<T> = T extends { readonly object: infer O } ? O extends string ? O : never : never;
547
+
548
+ /**
549
+ * Describes how to map one field in a shape.
550
+ *
551
+ * @internal
552
+ */
553
+ export declare interface _FieldDescriptor {
554
+ /** Wire key for this field; falls back to `type` if absent. */
555
+ wire?: string;
556
+ /** SDK / type key for this field. */
557
+ type: string;
558
+ /** Transform to apply; if absent, passthrough (identity). */
559
+ transform?: _FieldTransformer;
560
+ }
561
+
562
+ /**
563
+ * A field transformer with the strategy threaded through so transforms can
564
+ * delegate direction-specific behavior (e.g. decimal parsing vs serialization)
565
+ * to the strategy.
566
+ *
567
+ * @internal
568
+ */
569
+ export declare type _FieldTransformer = (strategy: _ApplyStrategy, value: unknown) => unknown;
570
+
571
+ /**
572
+ * Pass a value through unchanged.
573
+ *
574
+ * @internal
575
+ */
576
+ export declare const _identity: _FieldTransformer;
577
+
578
+ /**
579
+ * Union of strategies that process incoming runtime data (proto-JSON or
580
+ * API-JSON). Descriptors branded with this type can be used with either the
581
+ * full composed pipeline (_ProtoWireToType) or just the hydration stage
582
+ * (_ApiJsonToType) when structural transformation has already occurred.
583
+ *
584
+ * @internal
585
+ */
586
+ export declare type _IncomingRuntimeStrategy = _ApiJsonToTypeStrategy | _ProtoWireToTypeStrategy;
587
+
588
+ /** A branded integer — a `number` guaranteed to satisfy `Number.isInteger`. @public */
589
+ export declare type Integer = {
590
+ readonly [__integerBrand]: true;
591
+ readonly [__stripeType]: 'int';
592
+ } & number;
593
+
594
+ /** Factory, type guard, and utilities for {@link (Integer:type)} branded values. @public */
595
+ export declare const Integer: IntegerCompanion;
596
+
597
+ /** @public */
598
+ export declare interface IntegerCompanion {
599
+ /** The Integer value `0`. @public */
600
+ readonly zero: Integer;
601
+ /** Type guard: narrows `unknown` to {@link (Integer:type)}. @public */
602
+ is(value: unknown): value is Integer;
603
+ /** Assertion guard: throws if not an {@link (Integer:type)}. @public */
604
+ assert(value: unknown): asserts value is Integer;
605
+ /** Coerce a value to {@link (Integer:type)} by rounding. @public */
606
+ from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): Integer;
607
+ /** Lossless conversion to `Decimal`. @public */
608
+ toDecimal(value: Integer): Decimal;
609
+ /** Type guard: narrows {@link (Integer:type)} to {@link (PositiveInteger:type)}. @public */
610
+ isPositive(value: Integer): value is PositiveInteger;
611
+ /** Assertion guard: throws if the Integer is negative. @public */
612
+ assertIsPositive(value: Integer): asserts value is PositiveInteger;
613
+ }
614
+
615
+ /**
616
+ * Rounding directions for coercing a number to an integer.
617
+ *
618
+ * A focused subset of {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3:
619
+ *
620
+ * | Direction | Behavior | Examples (→ integer) |
621
+ * | -------------- | ---------------------------- | ------------------------------ |
622
+ * | `'ceil'` | Toward +∞ | 1.1→2, -1.1→-1 |
623
+ * | `'floor'` | Toward -∞ | 1.9→1, -1.1→-2 |
624
+ * | `'round-down'` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
625
+ * | `'round-up'` | Away from zero | 1.1→2, -1.1→-2 |
626
+ * | `'half-up'` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
627
+ *
628
+ * @public
629
+ */
630
+ export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
631
+
632
+ /**
633
+ * Returns `true` if `value` conforms to the `PromiseLike` contract:
634
+ * a non-null object or function with a callable `then` method.
635
+ *
636
+ * @internal
637
+ */
638
+ export declare function _isPromiseLike(value: unknown): value is PromiseLike<unknown>;
639
+
640
+ /**
641
+ * Strategy for transforming JSON config data to SDK types.
642
+ *
643
+ * @internal
644
+ */
645
+ export declare const _JsonWireToType: _JsonWireToTypeStrategy;
646
+
647
+ /**
648
+ * Branded strategy for JSON config → SDK transformations.
649
+ *
650
+ * @internal
651
+ */
652
+ export declare interface _JsonWireToTypeStrategy extends _ApplyStrategy {
653
+ /**
654
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
655
+ * @internal
656
+ */
657
+ readonly _brand: 'JsonWireToType';
658
+ }
659
+
660
+ /**
661
+ * Represents a monetary value with amount and currency.
662
+ * @format monetary-amount
663
+ * @public
664
+ */
665
+ export declare interface MonetaryAmount {
666
+ /** The numerical value. */
667
+ amount: Decimal;
668
+ /** The currency code. */
669
+ currency: Currency;
670
+ }
671
+
672
+ /**
673
+ * Describes one branch of a oneof field embedded in a shape.
674
+ *
675
+ * @internal
676
+ */
677
+ export declare interface _OneofBranchDescriptor {
678
+ /** Wire key for this branch on the parent object (e.g. `'price'`). */
679
+ wireKey: string;
680
+ /** SDK discriminant value for this branch (e.g. `'price'`). */
681
+ typeKey: string;
682
+ /** Transform to apply to the branch value; if absent, passthrough. */
683
+ transform?: _FieldTransformer;
684
+ }
685
+
686
+ /**
687
+ * Describes a oneof field within a shape — a set of mutually exclusive wire
688
+ * keys that map to a single discriminated SDK field.
689
+ *
690
+ * @internal
691
+ */
692
+ export declare interface _OneofFieldDescriptor {
693
+ /** SDK field name for the discriminant (e.g. `'priceKind'`). */
694
+ discriminant: string;
695
+ /** Whether the oneof is optional (no branch set → field absent). */
696
+ optional: boolean;
697
+ /** The branches for this oneof. */
698
+ branches: _OneofBranchDescriptor[];
699
+ }
700
+
701
+ /**
702
+ * Union of strategies that process outgoing runtime data (SDK types to
703
+ * proto-JSON or API-JSON). Descriptors branded with this type can be used
704
+ * with either the full composed pipeline (_TypeToProtoWire) or just the
705
+ * dehydration stage (_TypeToApiJson) when structural transformation will
706
+ * occur externally.
707
+ *
708
+ * @internal
709
+ */
710
+ export declare type _OutgoingRuntimeStrategy = _TypeToApiJsonStrategy | _TypeToProtoWireStrategy;
711
+
712
+ /**
713
+ * A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
714
+ *
715
+ * This is a subtype of {@link (Integer:type)}: every non-negative integer is an
716
+ * integer, so `PositiveInteger` values are assignable to `Integer` contexts.
717
+ * The reverse is not true — an `Integer` cannot be assigned where a
718
+ * `PositiveInteger` is expected without going through the `PositiveInteger.is()`
719
+ * type guard or `PositiveInteger.from()` factory.
720
+ *
721
+ * @remarks
722
+ * Despite the name, this type includes zero (`>= 0`, not `> 0`).
723
+ * The schema-level constraint `@minimum 0` should be added to fields
724
+ * typed as `PositiveInteger` to ensure the non-negativity invariant
725
+ * is enforced at validation time.
726
+ *
727
+ * @public
728
+ */
729
+ export declare type PositiveInteger = {
730
+ readonly [__integerBrand]: true;
731
+ readonly [__positiveIntegerBrand]: true;
732
+ readonly [__stripeType]: 'int';
733
+ } & number;
734
+
735
+ /** Factory, type guard, and utilities for {@link (PositiveInteger:type)} branded values. @public */
736
+ export declare const PositiveInteger: PositiveIntegerCompanion;
737
+
738
+ /** @public */
739
+ export declare interface PositiveIntegerCompanion {
740
+ /** Type guard: narrows `unknown` to {@link (PositiveInteger:type)}. @public */
741
+ is(value: unknown): value is PositiveInteger;
742
+ /** Assertion guard: throws if not a {@link (PositiveInteger:type)}. @public */
743
+ assert(value: unknown): asserts value is PositiveInteger;
744
+ /** Coerce a value to {@link (PositiveInteger:type)} by rounding. Throws if negative. @public */
745
+ from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): PositiveInteger;
746
+ }
747
+
748
+ /**
749
+ * Bidirectional enum spec for proto-backed enums. Accepts a single
750
+ * `fromProto` map and derives the inverse; throws if the map is not
751
+ * bijective (duplicate target values).
752
+ *
753
+ * @internal
754
+ */
755
+ export declare class _ProtoEnum implements _EnumSpec {
756
+ private readonly _from;
757
+ private readonly _to;
758
+ constructor(fromProto: Record<string, string>);
759
+ /**
760
+ * Convert a proto wire value to an SDK value, or `null` if unknown.
761
+ * @internal
762
+ */
763
+ fromWire(value: string): null | string;
764
+ /**
765
+ * Convert an SDK value to a proto wire value, or `null` if unknown.
766
+ * @internal
767
+ */
768
+ toWire(value: string): null | string;
769
+ }
770
+
771
+ /**
772
+ * Stage-1 incoming strategy: transforms proto wire data to API-JSON.
773
+ * Performs all structural operations (key renaming, enum translation,
774
+ * union/oneof restructuring) but leaves values as plain JSON -- decimals
775
+ * become plain strings (unwrapped from the proto `{value}` wrapper) and
776
+ * datetimes pass through as ISO strings.
777
+ *
778
+ * @internal
779
+ */
780
+ export declare const _ProtoToApiJson: _ProtoToApiJsonStrategy;
781
+
782
+ /**
783
+ * Branded strategy for proto wire → API-JSON (stage 1 incoming).
784
+ * Performs structural transformations (key renaming, enum translation,
785
+ * union restructuring, decimal unwrapping) without hydrating JS objects.
786
+ *
787
+ * @internal
788
+ */
789
+ export declare interface _ProtoToApiJsonStrategy extends _ApplyStrategy {
790
+ /**
791
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
792
+ * @internal
793
+ */
794
+ readonly _brand: 'ProtoToApiJson';
795
+ }
796
+
797
+ /**
798
+ * Composed incoming strategy (proto wire → SDK types).
799
+ * Delegates structural work to {@link _ProtoToApiJson} and hydration to
800
+ * {@link _ApiJsonToType}, composed at the per-field-translator level.
801
+ *
802
+ * @internal
803
+ */
804
+ export declare const _ProtoWireToType: _ProtoWireToTypeStrategy;
805
+
806
+ /**
807
+ * Branded strategy for proto wire → SDK transformations.
808
+ *
809
+ * @internal
810
+ */
811
+ export declare interface _ProtoWireToTypeStrategy extends _ApplyStrategy {
812
+ /**
813
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
814
+ * @internal
815
+ */
816
+ readonly _brand: 'ProtoWireToType';
817
+ }
818
+
819
+ /**
820
+ * Object reference — a typed pointer to another API resource.
821
+ *
822
+ * @example
823
+ * ```
824
+ * { type: "v2.core.customer", id: "cus_1234" }
825
+ * ```
826
+ *
827
+ * The type parameter T must have a readonly `object` property
828
+ * whose string literal type becomes the `type` field's value.
829
+ *
830
+ * @discriminator :type T
831
+ *
832
+ * @public
833
+ */
834
+ export declare type Ref<T extends {
835
+ readonly object: string;
836
+ } = {
837
+ readonly object: string;
838
+ }> = {
839
+ id: string;
840
+ type: ExtractObjectTag<T>;
841
+ } & {
842
+ readonly __type?: T;
843
+ readonly [__brand]: 'Ref';
844
+ readonly [__stripeType]: 'string';
845
+ };
846
+
847
+ /**
848
+ * Wraps a transformer so that a `null` / `undefined` result throws
849
+ * `WireParseError('Required field is missing')`, which `strategy.applyField`
850
+ * will catch and re-throw as _WireReadError / _WireWriteError with field context.
851
+ *
852
+ * The inner transformer runs first, so strategies that backfill absent values
853
+ * (e.g. clock-aware `translateDateTime`) can satisfy the requirement.
854
+ *
855
+ * @internal
856
+ */
857
+ export declare function _required(fn?: _FieldTransformer): _FieldTransformer;
858
+
859
+ /**
860
+ * Rounding direction for Decimal operations.
861
+ *
862
+ * @remarks
863
+ * Seven modes corresponding to
864
+ * {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3
865
+ * rounding-direction attributes:
866
+ *
867
+ * | Direction | IEEE 754 name | Behavior | Examples (→ integer) |
868
+ * | -------------- | ----------------------- | --------------------------------- | ------------------------------------- |
869
+ * | `'ceil'` | `roundTowardPositive` | Toward +∞ | 1.1→2, -1.1→-1 |
870
+ * | `'floor'` | `roundTowardNegative` | Toward -∞ | 1.9→1, -1.1→-2 |
871
+ * | `'round-down'` | `roundTowardZero` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
872
+ * | `'round-up'` | — | Away from zero | 1.1→2, -1.1→-2 |
873
+ * | `'half-up'` | `roundTiesToAway` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
874
+ * | `'half-down'` | — | Nearest; ties toward zero | 0.5→0, -0.5→0, 1.6→2 |
875
+ * | `'half-even'` | `roundTiesToEven` | Nearest; ties to even (banker's) | 0.5→0, 1.5→2, 2.5→2, 3.5→4 |
876
+ *
877
+ * @public
878
+ */
879
+ export declare type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even' | 'half-up' | 'round-down' | 'round-up';
880
+
881
+ /**
882
+ * Describes how to map a named type. The generic parameter `S` brands the
883
+ * descriptor with the set of strategies it accepts; `apply` enforces this.
884
+ *
885
+ * @internal
886
+ */
887
+ export declare class _ShapeDescriptor<_S extends _ApplyStrategy = _ApplyStrategy, _T = unknown> {
888
+ /** The type name, used in error messages. */
889
+ readonly typeName: string;
890
+ /** The field descriptors for this shape. */
891
+ readonly fields: _FieldDescriptor[];
892
+ /** Optional oneof field descriptors (mixed messages with regular + oneof fields). */
893
+ readonly oneofFields?: _OneofFieldDescriptor[];
894
+ constructor(typeName: string, fields: _FieldDescriptor[], oneofFields?: _OneofFieldDescriptor[]);
895
+ }
896
+
897
+ /** The type of the opaque Stripe type-tag key used in SDK scalar types. @public */
898
+ export declare type StripeTypeSymbol = typeof __stripeType;
899
+
900
+ /**
901
+ * Deep-freezes `value` and returns it typed as {@link DeepReadonly}`<T>`.
902
+ *
903
+ * Use this helper for module-scoped constant objects and arrays to satisfy
904
+ * the `dsl/no-module-scoped-mutable-const` lint rule. Unlike `Object.freeze`,
905
+ * which is shallow, `toConst` recursively freezes all nested objects and arrays.
906
+ *
907
+ * @example
908
+ * ```typescript
909
+ * import { toConst } from '@stripe/extensibility-sdk';
910
+ *
911
+ * const DEFAULTS = toConst({ timeout: 30, retries: 3 });
912
+ * // Type: { readonly timeout: 30; readonly retries: 3 }
913
+ *
914
+ * const STATUSES = toConst(['active', 'pending', 'cancelled']);
915
+ * // Type: readonly ["active", "pending", "cancelled"]
916
+ * ```
917
+ *
918
+ * @public
919
+ */
920
+ export declare function toConst<T>(value: T): DeepReadonly<T>;
921
+
922
+ /**
923
+ * Apply an element transform to each item in an array.
924
+ *
925
+ * @internal
926
+ */
927
+ export declare function _translateArray(elementFn: _FieldTransformer): _FieldTransformer;
928
+
929
+ /**
930
+ * Translate a field using the strategy's datetime conversion.
931
+ *
932
+ * @internal
933
+ */
934
+ export declare const _translateDateTime: _FieldTransformer;
935
+
936
+ /**
937
+ * Translate a field using the strategy's decimal conversion.
938
+ *
939
+ * @internal
940
+ */
941
+ export declare const _translateDecimal: _FieldTransformer;
942
+
943
+ /**
944
+ * Create a _FieldTransformer that translates an enum value using the given spec.
945
+ * For bidirectional proto enums, pass a `_ProtoEnum` instance.
946
+ * For config validation, pass a `_ConfigEnum` instance.
947
+ *
948
+ * @internal
949
+ */
950
+ export declare function _translateEnum(spec: _EnumSpec): _FieldTransformer;
951
+
952
+ /**
953
+ * Apply key/value transforms to every entry in a Record.
954
+ *
955
+ * @internal
956
+ */
957
+ export declare function _translateMap(keyFn: _FieldTransformer, valueFn: _FieldTransformer): _FieldTransformer;
958
+
959
+ /**
960
+ * Create a _FieldTransformer that applies a nested _ShapeDescriptor,
961
+ * threading the strategy through. Returns `undefined` for null/undefined input.
962
+ *
963
+ * Accepts a factory `() => _ShapeDescriptor` rather than a descriptor directly,
964
+ * so that the descriptor constant is resolved lazily at call time. This allows
965
+ * generated descriptors to reference each other without regard to declaration
966
+ * order (avoiding temporal dead zone errors with `const`).
967
+ *
968
+ * @internal
969
+ */
970
+ export declare function _translateShape(getDesc: () => _ShapeDescriptor): _FieldTransformer;
971
+
972
+ /**
973
+ * Create a _FieldTransformer that applies a _UnionDescriptor via the strategy.
974
+ * Returns `undefined` for null/undefined input.
975
+ *
976
+ * Accepts a factory `() => _UnionDescriptor` rather than a descriptor directly,
977
+ * for the same reason as `_translateShape` — lazy resolution avoids TDZ errors
978
+ * when generated descriptors reference each other.
979
+ *
980
+ * @internal
981
+ */
982
+ export declare function _translateUnion(getDesc: () => _UnionDescriptor): _FieldTransformer;
983
+
984
+ /**
985
+ * Stage-1 outgoing strategy: dehydrates SDK objects to API-JSON.
986
+ * Converts Decimal → string, Date → ISO string, but keeps camelCase keys
987
+ * and SDK enum values unchanged (structural transformation is stage 2).
988
+ *
989
+ * @internal
990
+ */
991
+ export declare const _TypeToApiJson: _TypeToApiJsonStrategy;
992
+
993
+ /**
994
+ * Branded strategy for SDK types → API-JSON (stage 1 outgoing).
995
+ * Dehydrates JS objects (Decimal → string, Date → ISO string) without
996
+ * performing structural transformations (key renaming stays camelCase).
997
+ *
998
+ * @internal
999
+ */
1000
+ export declare interface _TypeToApiJsonStrategy extends _ApplyStrategy {
1001
+ /**
1002
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
1003
+ * @internal
1004
+ */
1005
+ readonly _brand: 'TypeToApiJson';
1006
+ }
1007
+
1008
+ /**
1009
+ * Composed outgoing strategy (SDK types → proto wire).
1010
+ * Delegates dehydration to {@link _TypeToApiJson} and structural
1011
+ * transformation to {@link _ApiJsonToProto}, composed at the
1012
+ * per-field-translator level.
1013
+ *
1014
+ * @internal
1015
+ */
1016
+ export declare const _TypeToProtoWire: _TypeToProtoWireStrategy;
1017
+
1018
+ /**
1019
+ * Branded strategy for SDK → proto wire transformations.
1020
+ *
1021
+ * @internal
1022
+ */
1023
+ export declare interface _TypeToProtoWireStrategy extends _ApplyStrategy {
1024
+ /**
1025
+ * Brand marker distinguishing this strategy from other `_ApplyStrategy` implementations.
1026
+ * @internal
1027
+ */
1028
+ readonly _brand: 'TypeToProtoWire';
1029
+ }
1030
+
1031
+ /**
1032
+ * Describes one branch of a discriminated union.
1033
+ *
1034
+ * @internal
1035
+ */
1036
+ export declare interface _UnionBranchDescriptor {
1037
+ /** Wire key for this branch (e.g. `'one_time'`). */
1038
+ wireKey: string;
1039
+ /** SDK discriminant value for this branch (e.g. `'oneTime'`). */
1040
+ typeKey: string;
1041
+ /** Field descriptors for this branch. */
1042
+ shape: _FieldDescriptor[];
1043
+ }
1044
+
1045
+ /**
1046
+ * Describes how to map a discriminated union type between wire format and
1047
+ * SDK format. The generic parameter `_S` brands the descriptor with the set
1048
+ * of strategies it accepts (mirrors `_ShapeDescriptor<_S>`).
1049
+ *
1050
+ * @internal
1051
+ */
1052
+ export declare class _UnionDescriptor<_S extends _ApplyStrategy = _ApplyStrategy, _T = unknown> {
1053
+ /** The type name, used in error messages. */
1054
+ readonly typeName: string;
1055
+ /** The SDK-side discriminant field name (e.g. `'value'`, `'kind'`). */
1056
+ readonly discriminantFieldName: string;
1057
+ /** The branch descriptors for this union. */
1058
+ readonly branches: _UnionBranchDescriptor[];
1059
+ constructor(typeName: string, discriminantFieldName: string, branches: _UnionBranchDescriptor[]);
1060
+ }
1061
+
1062
+ /**
1063
+ * Shared types and error classes for the transform pipeline.
1064
+ * See transforms.ts for the module overview.
1065
+ */
1066
+ /**
1067
+ * Thrown when incoming wire data (proto → SDK) cannot be parsed.
1068
+ * Indicates malformed or unexpected data from the proto infrastructure —
1069
+ * not a bug in the user's code.
1070
+ *
1071
+ * @internal
1072
+ */
1073
+ export declare class _WireReadError extends Error {
1074
+ /**
1075
+ * Error class name for `instanceof`-free identification.
1076
+ * @internal
1077
+ */
1078
+ name: string;
1079
+ }
1080
+
1081
+ /**
1082
+ * Thrown when outgoing SDK data (SDK → proto) cannot be serialized.
1083
+ * Indicates that the user's code returned a value that cannot be translated
1084
+ * back to wire format.
1085
+ *
1086
+ * @internal
1087
+ */
1088
+ export declare class _WireWriteError extends Error {
1089
+ /**
1090
+ * Error class name for `instanceof`-free identification.
1091
+ * @internal
1092
+ */
1093
+ name: string;
1094
+ }
1095
+
1096
+ export { }