@stripe/extensibility-sdk 0.22.4
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.
- package/LICENSE.md +19 -0
- package/dist/config-values/generate.cjs +262 -0
- package/dist/config-values/generate.d.ts +38 -0
- package/dist/config-values/generate.d.ts.map +1 -0
- package/dist/config-values/generate.js +232 -0
- package/dist/config-values/parse.d.ts +87 -0
- package/dist/config-values/parse.d.ts.map +1 -0
- package/dist/extensibility-sdk-alpha.d.ts +542 -0
- package/dist/extensibility-sdk-beta.d.ts +542 -0
- package/dist/extensibility-sdk-config-values-alpha.d.ts +27 -0
- package/dist/extensibility-sdk-config-values-beta.d.ts +27 -0
- package/dist/extensibility-sdk-config-values-internal.d.ts +118 -0
- package/dist/extensibility-sdk-config-values-public.d.ts +27 -0
- package/dist/extensibility-sdk-extensions-alpha.d.ts +1592 -0
- package/dist/extensibility-sdk-extensions-beta.d.ts +1592 -0
- package/dist/extensibility-sdk-extensions-internal.d.ts +1655 -0
- package/dist/extensibility-sdk-extensions-public.d.ts +1592 -0
- package/dist/extensibility-sdk-internal-alpha.d.ts +9 -0
- package/dist/extensibility-sdk-internal-beta.d.ts +9 -0
- package/dist/extensibility-sdk-internal-internal.d.ts +23 -0
- package/dist/extensibility-sdk-internal-public.d.ts +9 -0
- package/dist/extensibility-sdk-internal.d.ts +915 -0
- package/dist/extensibility-sdk-jsonschema-alpha.d.ts +3 -0
- package/dist/extensibility-sdk-jsonschema-beta.d.ts +3 -0
- package/dist/extensibility-sdk-jsonschema-internal.d.ts +15 -0
- package/dist/extensibility-sdk-jsonschema-public.d.ts +3 -0
- package/dist/extensibility-sdk-public.d.ts +542 -0
- package/dist/extensibility-sdk-stdlib-alpha.d.ts +531 -0
- package/dist/extensibility-sdk-stdlib-beta.d.ts +531 -0
- package/dist/extensibility-sdk-stdlib-internal.d.ts +904 -0
- package/dist/extensibility-sdk-stdlib-public.d.ts +531 -0
- package/dist/extensions/billing/bill/discount_calculation.d.ts +226 -0
- package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -0
- package/dist/extensions/billing/bill/index.d.ts +2 -0
- package/dist/extensions/billing/bill/index.d.ts.map +1 -0
- package/dist/extensions/billing/customer_balance_application.d.ts +82 -0
- package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -0
- package/dist/extensions/billing/index.d.ts +8 -0
- package/dist/extensions/billing/index.d.ts.map +1 -0
- package/dist/extensions/billing/invoice_collection_setting.d.ts +117 -0
- package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -0
- package/dist/extensions/billing/prorations.d.ts +222 -0
- package/dist/extensions/billing/prorations.d.ts.map +1 -0
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts +326 -0
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -0
- package/dist/extensions/billing/types.d.ts +33 -0
- package/dist/extensions/billing/types.d.ts.map +1 -0
- package/dist/extensions/context.d.ts +9 -0
- package/dist/extensions/context.d.ts.map +1 -0
- package/dist/extensions/core/index.d.ts +3 -0
- package/dist/extensions/core/index.d.ts.map +1 -0
- package/dist/extensions/core/workflows/custom_action.d.ts +142 -0
- package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -0
- package/dist/extensions/core/workflows/index.d.ts +2 -0
- package/dist/extensions/core/workflows/index.d.ts.map +1 -0
- package/dist/extensions/extend/index.d.ts +3 -0
- package/dist/extensions/extend/index.d.ts.map +1 -0
- package/dist/extensions/extend/workflows/custom_action.d.ts +142 -0
- package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -0
- package/dist/extensions/extend/workflows/index.d.ts +2 -0
- package/dist/extensions/extend/workflows/index.d.ts.map +1 -0
- package/dist/extensions/index.cjs +2356 -0
- package/dist/extensions/index.d.ts +9 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +2435 -0
- package/dist/extensions/registry.d.ts +19 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/extensions/types.d.ts +10 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/index.cjs +1519 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1460 -0
- package/dist/internal.cjs +156 -0
- package/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +128 -0
- package/dist/jsonschema.cjs +18 -0
- package/dist/jsonschema.d.ts +2 -0
- package/dist/jsonschema.d.ts.map +1 -0
- package/dist/jsonschema.js +0 -0
- package/dist/stdlib/brand.d.ts +27 -0
- package/dist/stdlib/brand.d.ts.map +1 -0
- package/dist/stdlib/decimal.d.ts +324 -0
- package/dist/stdlib/decimal.d.ts.map +1 -0
- package/dist/stdlib/extension-method.d.ts +27 -0
- package/dist/stdlib/extension-method.d.ts.map +1 -0
- package/dist/stdlib/generated.d.ts +15 -0
- package/dist/stdlib/generated.d.ts.map +1 -0
- package/dist/stdlib/index.cjs +1519 -0
- package/dist/stdlib/index.d.ts +18 -0
- package/dist/stdlib/index.d.ts.map +1 -0
- package/dist/stdlib/index.js +1460 -0
- package/dist/stdlib/refs.d.ts +62 -0
- package/dist/stdlib/refs.d.ts.map +1 -0
- package/dist/stdlib/scalars.d.ts +141 -0
- package/dist/stdlib/scalars.d.ts.map +1 -0
- package/dist/stdlib/transform-strategies.d.ts +74 -0
- package/dist/stdlib/transform-strategies.d.ts.map +1 -0
- package/dist/stdlib/transforms.d.ts +97 -0
- package/dist/stdlib/transforms.d.ts.map +1 -0
- package/dist/stdlib/type-utils.d.ts +9 -0
- package/dist/stdlib/type-utils.d.ts.map +1 -0
- package/dist/stdlib/types.d.ts +281 -0
- package/dist/stdlib/types.d.ts.map +1 -0
- package/dist/stdlib/utils.d.ts +7 -0
- package/dist/stdlib/utils.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +111 -0
- package/tslibs/5.9.3/lib.es2022.egress.d.ts +4328 -0
- package/tslibs/5.9.3/lib.es2022.restricted.d.ts +4067 -0
- package/tslibs/lib.egress.globals.d.ts +112 -0
- package/tslibs/lib.restricted.globals.d.ts +1 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { __integerBrand } from '@formspec/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Opaque brand symbol 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)}.create().
|
|
9
|
+
* The `unique symbol` key makes the brand non-enumerable and impossible
|
|
10
|
+
* to forge without access to this symbol.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare const __brand: unique symbol;
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: __decimalBrand */
|
|
17
|
+
|
|
18
|
+
/* Excluded from this release type: __positiveIntegerBrand */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Opaque type-tag symbol used by SDK scalar types to carry Stripe type metadata.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* You do not need to use this directly — it is already embedded in
|
|
25
|
+
* branded values returned by factory functions like {@link (Integer:type)}.create().
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare const __stripeType: unique symbol;
|
|
30
|
+
|
|
31
|
+
/* Excluded from this release type: _apply */
|
|
32
|
+
|
|
33
|
+
/* Excluded from this release type: _applyConfig */
|
|
34
|
+
|
|
35
|
+
/* Excluded from this release type: _applyIncoming */
|
|
36
|
+
|
|
37
|
+
/* Excluded from this release type: _applyOutgoing */
|
|
38
|
+
|
|
39
|
+
/* Excluded from this release type: _ApplyStrategy */
|
|
40
|
+
|
|
41
|
+
/** The type of the opaque brand symbol used as a property key in SDK branded types. @public */
|
|
42
|
+
export declare type BrandSymbol = typeof __brand;
|
|
43
|
+
|
|
44
|
+
/* Excluded from this release type: _configAppContextFromContext */
|
|
45
|
+
|
|
46
|
+
/* Excluded from this release type: _ConfigApplicationContext */
|
|
47
|
+
|
|
48
|
+
/* Excluded from this release type: _ConfigEnum */
|
|
49
|
+
|
|
50
|
+
/** @public */
|
|
51
|
+
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' | 'mop' | 'mro' | 'mru' | 'mur' | 'mvr' | 'mwk' | 'mxn' | 'mxv' | 'myr' | 'mzn' | 'nad' | 'ngn' | 'nio' | 'nok' | 'npr' | 'nzd' | 'omr' | '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' | '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';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Arbitrary-precision decimal type for billing calculations.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* `Decimal` values are created by the {@link (Decimal:variable) | Decimal companion object}
|
|
58
|
+
* and store values as `coefficient × 10^exponent` using `BigInt`. They avoid
|
|
59
|
+
* every common binary floating-point pitfall — `Decimal.from('0.1').add(Decimal.from('0.2'))`
|
|
60
|
+
* is exactly `0.3`.
|
|
61
|
+
*
|
|
62
|
+
* Instances are immutable (frozen) and all arithmetic returns a new
|
|
63
|
+
* `Decimal`. The public type carries two brand symbols so the type system
|
|
64
|
+
* prevents accidental assignment from plain `number`, `string`, or
|
|
65
|
+
* `bigint`.
|
|
66
|
+
*
|
|
67
|
+
* Create values via the companion object:
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { Decimal, RoundDirection } from '@stripe/extensibility-sdk/stdlib';
|
|
72
|
+
*
|
|
73
|
+
* const price = Decimal.from('19.99');
|
|
74
|
+
* const tax = price.mul(Decimal.from('0.0825'));
|
|
75
|
+
* const total = price.add(tax);
|
|
76
|
+
*
|
|
77
|
+
* console.log(total.toFixed(2, 'half-up')); // "21.64"
|
|
78
|
+
* console.log(JSON.stringify({ total })); // '{"total":"21.639175"}'
|
|
79
|
+
* console.log(total.toFixed(2, 'half-even')); // "21.64"
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
export declare interface Decimal {
|
|
85
|
+
/* Excluded from this release type: [__brand] */
|
|
86
|
+
/* Excluded from this release type: [__decimalBrand] */
|
|
87
|
+
/* Excluded from this release type: [__stripeType] */
|
|
88
|
+
/**
|
|
89
|
+
* Return the sum of this value and `other`.
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
add(other: Decimal): Decimal;
|
|
93
|
+
/**
|
|
94
|
+
* Return the difference of this value and `other`.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
sub(other: Decimal): Decimal;
|
|
98
|
+
/**
|
|
99
|
+
* Return the product of this value and `other`.
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
mul(other: Decimal): Decimal;
|
|
103
|
+
/**
|
|
104
|
+
* Return the quotient of this value divided by `other`.
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
div(other: Decimal, precision: number, direction: RoundDirection): Decimal;
|
|
108
|
+
/**
|
|
109
|
+
* Three-way comparison: returns `-1`, `0`, or `1`.
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
cmp(other: Decimal): -1 | 0 | 1;
|
|
113
|
+
/**
|
|
114
|
+
* Return `true` if this value is numerically equal to `other`.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
eq(other: Decimal): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Return `true` if this value is strictly less than `other`.
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
lt(other: Decimal): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Return `true` if this value is less than or equal to `other`.
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
lte(other: Decimal): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Return `true` if this value is strictly greater than `other`.
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
gt(other: Decimal): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Return `true` if this value is greater than or equal to `other`.
|
|
135
|
+
* @public
|
|
136
|
+
*/
|
|
137
|
+
gte(other: Decimal): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Return `true` if this value is exactly zero.
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
isZero(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Return `true` if this value is strictly less than zero.
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
isNegative(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Return `true` if this value is strictly greater than zero.
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
isPositive(): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Return the additive inverse of this value.
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
|
+
neg(): Decimal;
|
|
158
|
+
/**
|
|
159
|
+
* Return the absolute value.
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
abs(): Decimal;
|
|
163
|
+
/**
|
|
164
|
+
* Round this value to the specified precision.
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
round(direction: RoundDirection, options: DecimalRoundingOptions | keyof typeof DecimalRoundingPresets): Decimal;
|
|
168
|
+
/**
|
|
169
|
+
* Return the canonical string representation.
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
toString(): string;
|
|
173
|
+
/**
|
|
174
|
+
* Return the JSON-serializable string representation.
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
toJSON(): string;
|
|
178
|
+
/**
|
|
179
|
+
* Convert to a JavaScript `number` (lossy).
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
toNumber(): number;
|
|
183
|
+
/**
|
|
184
|
+
* Format as a fixed-point string with exactly `decimalPlaces` digits.
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
toFixed(decimalPlaces: number, direction: RoundDirection): string;
|
|
188
|
+
/**
|
|
189
|
+
* Rejects implicit coercion; explicit `String(d)` and template literals still work.
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
[Symbol.toPrimitive](hint: 'default' | 'number' | 'string'): string;
|
|
193
|
+
/**
|
|
194
|
+
* Returns the string representation; invoked by the JavaScript engine as a fallback coercion path.
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
valueOf(): string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Companion object for creating `Decimal` instances.
|
|
202
|
+
*
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
export declare const Decimal: {
|
|
206
|
+
from(value: bigint | number | string): Decimal;
|
|
207
|
+
zero: Decimal;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Precision specification for `Decimal.round()`.
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* Two modes are supported:
|
|
215
|
+
* - `"decimal-places"` — round to a fixed number of digits after the decimal point.
|
|
216
|
+
* - `"significant-figures"` — round to a fixed number of significant digits.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* // Round to 2 decimal places
|
|
221
|
+
* amount.round('half-even', { mode: 'decimal-places', value: 2 });
|
|
222
|
+
*
|
|
223
|
+
* // Round to 4 significant figures
|
|
224
|
+
* amount.round('half-up', { mode: 'significant-figures', value: 4 });
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
export declare interface DecimalRoundingOptions {
|
|
230
|
+
/** Whether to count digits from the decimal point (`"decimal-places"`) or from the most significant digit (`"significant-figures"`). */
|
|
231
|
+
mode: 'decimal-places' | 'significant-figures';
|
|
232
|
+
/**
|
|
233
|
+
* The number of digits to retain. Interpreted as decimal places when
|
|
234
|
+
* `mode` is `"decimal-places"`, or as significant figures when `mode`
|
|
235
|
+
* is `"significant-figures"`.
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
value: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Built-in rounding presets keyed by semantic name.
|
|
243
|
+
*
|
|
244
|
+
* @remarks
|
|
245
|
+
* Stripe defines the full set of supported preset names accepted by
|
|
246
|
+
* `Decimal.round()`.
|
|
247
|
+
*
|
|
248
|
+
* | Preset | Equivalent DecimalRoundingOptions |
|
|
249
|
+
* | ------------------- | ----------------------------------------------------- |
|
|
250
|
+
* | `"ubb-usage-count"` | `{ mode: "significant-figures", value: 15 }` |
|
|
251
|
+
* | `"v1-api"` | `{ mode: "decimal-places", value: 12 }` |
|
|
252
|
+
*
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
export declare const DecimalRoundingPresets: Readonly<{
|
|
256
|
+
'ubb-usage-count': Readonly<{
|
|
257
|
+
mode: "significant-figures";
|
|
258
|
+
value: number;
|
|
259
|
+
}>;
|
|
260
|
+
'v1-api': Readonly<{
|
|
261
|
+
mode: "decimal-places";
|
|
262
|
+
value: number;
|
|
263
|
+
}>;
|
|
264
|
+
}>;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* The IEEE 754 decimal128 coefficient size (34 digits) — the recommended
|
|
268
|
+
* precision for `Decimal.div()` when full precision is desired.
|
|
269
|
+
*
|
|
270
|
+
* @remarks
|
|
271
|
+
* Pass this as the `precision` argument to `div()` when you want the
|
|
272
|
+
* maximum available precision. Division requires explicit precision —
|
|
273
|
+
* no invisible defaults in financial code.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* // Use the full decimal128 precision explicitly
|
|
278
|
+
* a.div(b, DEFAULT_DIV_PRECISION, 'half-even');
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
export declare const DEFAULT_DIV_PRECISION = 34;
|
|
284
|
+
|
|
285
|
+
/* Excluded from this release type: _EnumSpec */
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Extracts the string literal type of the `object` property from T.
|
|
289
|
+
*
|
|
290
|
+
* @public
|
|
291
|
+
*/
|
|
292
|
+
export declare type ExtractObjectTag<T> = T extends { readonly object: infer O } ? O extends string ? O : never : never;
|
|
293
|
+
|
|
294
|
+
/* Excluded from this release type: _FieldDescriptor */
|
|
295
|
+
|
|
296
|
+
/* Excluded from this release type: _FieldTransformer */
|
|
297
|
+
|
|
298
|
+
/* Excluded from this release type: _identity */
|
|
299
|
+
|
|
300
|
+
/** A branded integer — a `number` guaranteed to satisfy `Number.isInteger`. @public */
|
|
301
|
+
export declare type Integer = {
|
|
302
|
+
readonly [__integerBrand]: true;
|
|
303
|
+
readonly [__stripeType]: 'int';
|
|
304
|
+
} & number;
|
|
305
|
+
|
|
306
|
+
/** Factory and type guard for {@link (Integer:type)} branded values. @public */
|
|
307
|
+
export declare const Integer: {
|
|
308
|
+
from: (value: number, rounding: IntegerRoundDirection) => Integer;
|
|
309
|
+
is: (value: number) => value is Integer;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Rounding directions for coercing a number to an integer.
|
|
314
|
+
*
|
|
315
|
+
* A focused subset of {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3:
|
|
316
|
+
*
|
|
317
|
+
* | Direction | Behavior | Examples (→ integer) |
|
|
318
|
+
* | -------------- | ---------------------------- | ------------------------------ |
|
|
319
|
+
* | `'ceil'` | Toward +∞ | 1.1→2, -1.1→-1 |
|
|
320
|
+
* | `'floor'` | Toward -∞ | 1.9→1, -1.1→-2 |
|
|
321
|
+
* | `'round-down'` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
|
|
322
|
+
* | `'round-up'` | Away from zero | 1.1→2, -1.1→-2 |
|
|
323
|
+
* | `'half-up'` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
|
|
324
|
+
*
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
327
|
+
export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Check whether a value is a `Decimal` instance.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* Use this instead of `instanceof` — the underlying class is not
|
|
334
|
+
* publicly exported, so `instanceof` checks are not available to
|
|
335
|
+
* consumers.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* if (isDecimal(value)) {
|
|
340
|
+
* value.add(Decimal.from('1')); // value is Decimal
|
|
341
|
+
* }
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* @public
|
|
345
|
+
*/
|
|
346
|
+
export declare function isDecimal(value: unknown): value is Decimal;
|
|
347
|
+
|
|
348
|
+
/* Excluded from this release type: _isPromiseLike */
|
|
349
|
+
|
|
350
|
+
/* Excluded from this release type: _JsonWireToType */
|
|
351
|
+
|
|
352
|
+
/* Excluded from this release type: _JsonWireToTypeStrategy */
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Represents a monetary value with amount and currency.
|
|
356
|
+
* @format monetary-amount
|
|
357
|
+
* @public
|
|
358
|
+
*/
|
|
359
|
+
export declare interface MonetaryAmount {
|
|
360
|
+
/** The numerical value. */
|
|
361
|
+
amount: Decimal;
|
|
362
|
+
/** The currency code. */
|
|
363
|
+
currency: Currency;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* Excluded from this release type: _OneofBranchDescriptor */
|
|
367
|
+
|
|
368
|
+
/* Excluded from this release type: _OneofFieldDescriptor */
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
|
|
372
|
+
*
|
|
373
|
+
* This is a subtype of {@link (Integer:type)}: every non-negative integer is an
|
|
374
|
+
* integer, so `PositiveInteger` values are assignable to `Integer` contexts.
|
|
375
|
+
* The reverse is not true — an `Integer` cannot be assigned where a
|
|
376
|
+
* `PositiveInteger` is expected without going through the `PositiveInteger.is()`
|
|
377
|
+
* type guard or `PositiveInteger.from()` factory.
|
|
378
|
+
*
|
|
379
|
+
* @remarks
|
|
380
|
+
* Despite the name, this type includes zero (`>= 0`, not `> 0`).
|
|
381
|
+
* The schema-level constraint `@minimum 0` should be added to fields
|
|
382
|
+
* typed as `PositiveInteger` to ensure the non-negativity invariant
|
|
383
|
+
* is enforced at validation time.
|
|
384
|
+
*
|
|
385
|
+
* @public
|
|
386
|
+
*/
|
|
387
|
+
export declare type PositiveInteger = {
|
|
388
|
+
readonly [__integerBrand]: true;
|
|
389
|
+
readonly [__positiveIntegerBrand]: true;
|
|
390
|
+
readonly [__stripeType]: 'int';
|
|
391
|
+
} & number;
|
|
392
|
+
|
|
393
|
+
/** Factory and type guard for {@link (PositiveInteger:type)} branded values. @public */
|
|
394
|
+
export declare const PositiveInteger: {
|
|
395
|
+
from: (value: number, rounding: IntegerRoundDirection) => PositiveInteger;
|
|
396
|
+
is: (value: number) => value is PositiveInteger;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/* Excluded from this release type: _ProtoEnum */
|
|
400
|
+
|
|
401
|
+
/* Excluded from this release type: _ProtoWireToType */
|
|
402
|
+
|
|
403
|
+
/* Excluded from this release type: _ProtoWireToTypeStrategy */
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Object reference — a typed pointer to another API resource.
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```
|
|
410
|
+
* { type: "v2.core.customer", id: "cus_1234" }
|
|
411
|
+
* ```
|
|
412
|
+
*
|
|
413
|
+
* The type parameter T must have a readonly `object` property
|
|
414
|
+
* whose string literal type becomes the `type` field's value.
|
|
415
|
+
*
|
|
416
|
+
* @discriminator :type T
|
|
417
|
+
*
|
|
418
|
+
* @public
|
|
419
|
+
*/
|
|
420
|
+
export declare type Ref<T extends {
|
|
421
|
+
readonly object: string;
|
|
422
|
+
} = {
|
|
423
|
+
readonly object: string;
|
|
424
|
+
}> = {
|
|
425
|
+
id: string;
|
|
426
|
+
type: ExtractObjectTag<T>;
|
|
427
|
+
} & {
|
|
428
|
+
readonly __type?: T;
|
|
429
|
+
readonly [__brand]: 'Ref';
|
|
430
|
+
readonly [__stripeType]: 'string';
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
/** Factory for creating {@link (Ref:type)} values from an object with `object` and `id` fields. @public */
|
|
434
|
+
export declare const Ref: { create: <T extends { readonly object: string }>(step: { readonly id: string } & T) => Ref<T> };
|
|
435
|
+
|
|
436
|
+
/* Excluded from this release type: _required */
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Rounding direction for Decimal operations.
|
|
440
|
+
*
|
|
441
|
+
* @remarks
|
|
442
|
+
* Seven modes corresponding to
|
|
443
|
+
* {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3
|
|
444
|
+
* rounding-direction attributes:
|
|
445
|
+
*
|
|
446
|
+
* | Direction | IEEE 754 name | Behavior | Examples (→ integer) |
|
|
447
|
+
* | -------------- | ----------------------- | --------------------------------- | ------------------------------------- |
|
|
448
|
+
* | `'ceil'` | `roundTowardPositive` | Toward +∞ | 1.1→2, -1.1→-1 |
|
|
449
|
+
* | `'floor'` | `roundTowardNegative` | Toward -∞ | 1.9→1, -1.1→-2 |
|
|
450
|
+
* | `'round-down'` | `roundTowardZero` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
|
|
451
|
+
* | `'round-up'` | — | Away from zero | 1.1→2, -1.1→-2 |
|
|
452
|
+
* | `'half-up'` | `roundTiesToAway` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
|
|
453
|
+
* | `'half-down'` | — | Nearest; ties toward zero | 0.5→0, -0.5→0, 1.6→2 |
|
|
454
|
+
* | `'half-even'` | `roundTiesToEven` | Nearest; ties to even (banker's) | 0.5→0, 1.5→2, 2.5→2, 3.5→4 |
|
|
455
|
+
*
|
|
456
|
+
* @public
|
|
457
|
+
*/
|
|
458
|
+
export declare type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even' | 'half-up' | 'round-down' | 'round-up';
|
|
459
|
+
|
|
460
|
+
/* Excluded from this release type: _ShapeDescriptor */
|
|
461
|
+
|
|
462
|
+
/** A branded string representing a street address. @public */
|
|
463
|
+
export declare type StreetAddress = {
|
|
464
|
+
readonly [__brand]: 'StreetAddress';
|
|
465
|
+
readonly [__stripeType]: 'string';
|
|
466
|
+
} & string;
|
|
467
|
+
|
|
468
|
+
/** Factory for creating {@link (StreetAddress:type)} branded values. @public */
|
|
469
|
+
export declare const StreetAddress: { create: (address: string) => StreetAddress };
|
|
470
|
+
|
|
471
|
+
/** The type of the opaque Stripe type-tag symbol used in SDK scalar types. @public */
|
|
472
|
+
export declare type StripeTypeSymbol = typeof __stripeType;
|
|
473
|
+
|
|
474
|
+
/** A branded string representing an ISO 8601 datetime. @public */
|
|
475
|
+
export declare type Timestamp = {
|
|
476
|
+
readonly [__brand]: 'Timestamp';
|
|
477
|
+
readonly [__stripeType]: 'string';
|
|
478
|
+
} & string;
|
|
479
|
+
|
|
480
|
+
/** Factory for creating {@link (Timestamp:type)} branded values. @public */
|
|
481
|
+
export declare const Timestamp: { create: (value: string) => Timestamp };
|
|
482
|
+
|
|
483
|
+
/* Excluded from this release type: _translateArray */
|
|
484
|
+
|
|
485
|
+
/* Excluded from this release type: _translateDateTime */
|
|
486
|
+
|
|
487
|
+
/* Excluded from this release type: _translateDecimal */
|
|
488
|
+
|
|
489
|
+
/* Excluded from this release type: _translateEnum */
|
|
490
|
+
|
|
491
|
+
/* Excluded from this release type: _translateMap */
|
|
492
|
+
|
|
493
|
+
/* Excluded from this release type: _translateShape */
|
|
494
|
+
|
|
495
|
+
/* Excluded from this release type: _translateUnion */
|
|
496
|
+
|
|
497
|
+
/* Excluded from this release type: _TypeToProtoWire */
|
|
498
|
+
|
|
499
|
+
/* Excluded from this release type: _TypeToProtoWireStrategy */
|
|
500
|
+
|
|
501
|
+
/* Excluded from this release type: _UnionBranchDescriptor */
|
|
502
|
+
|
|
503
|
+
/* Excluded from this release type: _UnionDescriptor */
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Shared types and error classes for the transform pipeline.
|
|
507
|
+
* See transforms.ts for the module overview.
|
|
508
|
+
*/
|
|
509
|
+
/**
|
|
510
|
+
* Thrown when incoming wire data (proto → SDK) cannot be parsed.
|
|
511
|
+
* Indicates malformed or unexpected data from the proto infrastructure —
|
|
512
|
+
* not a bug in the user's code.
|
|
513
|
+
*
|
|
514
|
+
* @public
|
|
515
|
+
*/
|
|
516
|
+
export declare class WireReadError extends Error {
|
|
517
|
+
/* Excluded from this release type: name */
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Thrown when outgoing SDK data (SDK → proto) cannot be serialized.
|
|
522
|
+
* Indicates that the user's code returned a value that cannot be translated
|
|
523
|
+
* back to wire format.
|
|
524
|
+
*
|
|
525
|
+
* @public
|
|
526
|
+
*/
|
|
527
|
+
export declare class WireWriteError extends Error {
|
|
528
|
+
/* Excluded from this release type: name */
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export { }
|