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