@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.
- package/README.md +17 -15
- package/dist/config-values/generate.cjs +1 -1
- package/dist/config-values/generate.d.ts +1 -1
- package/dist/config-values/generate.d.ts.map +1 -1
- package/dist/config-values/generate.js +1 -1
- package/dist/extensibility-sdk-alpha.d.ts +29 -157
- package/dist/extensibility-sdk-beta.d.ts +29 -157
- package/dist/extensibility-sdk-config-values-internal.d.ts +1 -1
- package/dist/extensibility-sdk-extensions-alpha.d.ts +7 -157
- package/dist/extensibility-sdk-extensions-beta.d.ts +7 -157
- package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-alpha.d.ts +631 -0
- package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-beta.d.ts +631 -0
- package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-internal.d.ts +666 -0
- package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-public.d.ts +631 -0
- package/dist/extensibility-sdk-extensions-billing-customer_balance_application-alpha.d.ts +475 -0
- package/dist/extensibility-sdk-extensions-billing-customer_balance_application-beta.d.ts +475 -0
- package/dist/extensibility-sdk-extensions-billing-customer_balance_application-internal.d.ts +510 -0
- package/dist/extensibility-sdk-extensions-billing-customer_balance_application-public.d.ts +475 -0
- package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-alpha.d.ts +110 -0
- package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-beta.d.ts +110 -0
- package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-internal.d.ts +123 -0
- package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-public.d.ts +110 -0
- package/dist/extensibility-sdk-extensions-billing-prorations-alpha.d.ts +607 -0
- package/dist/extensibility-sdk-extensions-billing-prorations-beta.d.ts +607 -0
- package/dist/extensibility-sdk-extensions-billing-prorations-internal.d.ts +642 -0
- package/dist/extensibility-sdk-extensions-billing-prorations-public.d.ts +607 -0
- package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-alpha.d.ts +735 -0
- package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-beta.d.ts +735 -0
- package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-internal.d.ts +772 -0
- package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-public.d.ts +735 -0
- package/dist/extensibility-sdk-extensions-core-workflows-custom_action-alpha.d.ts +126 -0
- package/dist/extensibility-sdk-extensions-core-workflows-custom_action-beta.d.ts +126 -0
- package/dist/extensibility-sdk-extensions-core-workflows-custom_action-internal.d.ts +140 -0
- package/dist/extensibility-sdk-extensions-core-workflows-custom_action-public.d.ts +126 -0
- package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-alpha.d.ts +126 -0
- package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-beta.d.ts +126 -0
- package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-internal.d.ts +140 -0
- package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-public.d.ts +126 -0
- package/dist/extensibility-sdk-extensions-internal.d.ts +7 -157
- package/dist/extensibility-sdk-extensions-public.d.ts +7 -157
- package/dist/extensibility-sdk-internal-internal.d.ts +2 -2
- package/dist/extensibility-sdk-internal.d.ts +145 -162
- package/dist/extensibility-sdk-public.d.ts +29 -157
- package/dist/extensibility-sdk-stdlib-alpha.d.ts +593 -0
- package/dist/extensibility-sdk-stdlib-beta.d.ts +593 -0
- package/dist/extensibility-sdk-stdlib-internal.d.ts +1096 -0
- package/dist/extensibility-sdk-stdlib-public.d.ts +593 -0
- package/dist/extensions/billing/bill/discount_calculation.cjs +437 -0
- package/dist/extensions/billing/bill/discount_calculation.d.ts +0 -20
- package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -1
- package/dist/extensions/billing/bill/discount_calculation.js +430 -0
- package/dist/extensions/billing/customer_balance_application.cjs +297 -0
- package/dist/extensions/billing/customer_balance_application.d.ts +0 -20
- package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -1
- package/dist/extensions/billing/customer_balance_application.js +284 -0
- package/dist/extensions/billing/invoice_collection_options.cjs +166 -0
- package/dist/extensions/billing/invoice_collection_options.d.ts +4 -24
- package/dist/extensions/billing/invoice_collection_options.d.ts.map +1 -1
- package/dist/extensions/billing/invoice_collection_options.js +155 -0
- package/dist/extensions/billing/prorations.cjs +501 -0
- package/dist/extensions/billing/prorations.d.ts +0 -20
- package/dist/extensions/billing/prorations.d.ts.map +1 -1
- package/dist/extensions/billing/prorations.js +492 -0
- package/dist/extensions/billing/recurring_billing_item_handling.cjs +639 -0
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts +0 -30
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
- package/dist/extensions/billing/recurring_billing_item_handling.js +632 -0
- package/dist/extensions/core/workflows/custom_action.cjs +124 -0
- package/dist/extensions/core/workflows/custom_action.d.ts +1 -21
- package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -1
- package/dist/extensions/core/workflows/custom_action.js +111 -0
- package/dist/extensions/extend/workflows/custom_action.cjs +124 -0
- package/dist/extensions/extend/workflows/custom_action.d.ts +1 -21
- package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -1
- package/dist/extensions/extend/workflows/custom_action.js +111 -0
- package/dist/extensions/index.cjs +27 -265
- package/dist/extensions/index.js +27 -265
- package/dist/extensions/registry.d.ts +2 -2
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/index.cjs +452 -2390
- package/dist/index.js +479 -2286
- package/dist/internal.cjs +22 -54
- package/dist/internal.js +22 -54
- package/dist/stdlib/generated.d.ts +1 -1
- package/dist/stdlib/generated.d.ts.map +1 -1
- package/dist/stdlib/index.cjs +2003 -0
- package/dist/stdlib/index.d.ts +2 -2
- package/dist/stdlib/index.d.ts.map +1 -1
- package/dist/stdlib/index.js +1943 -0
- package/dist/stdlib/transform-strategies.d.ts +46 -6
- package/dist/stdlib/transform-strategies.d.ts.map +1 -1
- package/dist/stdlib/types.d.ts +82 -0
- package/dist/stdlib/types.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +65 -1
- package/dist/stdlib/extension-method.d.ts +0 -27
- package/dist/stdlib/extension-method.d.ts.map +0 -1
|
@@ -0,0 +1,735 @@
|
|
|
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
|
+
declare const __brand: '__brand';
|
|
17
|
+
|
|
18
|
+
/* Excluded from this release type: __decimalBrand */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Distinct brand key for PositiveInteger so an Integer is not assignable to
|
|
22
|
+
* PositiveInteger without going through the guard. PositiveInteger is a
|
|
23
|
+
* subtype of Integer (it carries both brands), so it can be used wherever
|
|
24
|
+
* Integer is expected.
|
|
25
|
+
*
|
|
26
|
+
* String-literal const (not `unique symbol`) so that independent
|
|
27
|
+
* declaration rollups (root vs subpath) produce structurally compatible
|
|
28
|
+
* branded types.
|
|
29
|
+
*
|
|
30
|
+
* For internal use only — may be removed in a future release.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
declare const __positiveIntegerBrand: '__positiveIntegerBrand';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Opaque type-tag key used by SDK scalar types to carry Stripe type metadata.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* You do not need to use this directly — it is already embedded in
|
|
41
|
+
* branded values returned by factory functions like {@link (Integer:type)}.from().
|
|
42
|
+
*
|
|
43
|
+
* String-literal const (not `unique symbol`) so that independent
|
|
44
|
+
* declaration rollups (root vs subpath) produce structurally compatible
|
|
45
|
+
* branded types.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
declare const __stripeType: '__stripeType';
|
|
50
|
+
|
|
51
|
+
/** @public */
|
|
52
|
+
declare type AnyTimeRange = {
|
|
53
|
+
at: Date;
|
|
54
|
+
value: 'oneTime';
|
|
55
|
+
} | {
|
|
56
|
+
endDate: Date;
|
|
57
|
+
startDate: Date;
|
|
58
|
+
value: 'timeRange';
|
|
59
|
+
} | {
|
|
60
|
+
otherValue: string;
|
|
61
|
+
value: 'other';
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/* Excluded from this release type: _ConfigApplicationContext */
|
|
65
|
+
|
|
66
|
+
/** @public */
|
|
67
|
+
declare interface Context {
|
|
68
|
+
type: string;
|
|
69
|
+
id: string;
|
|
70
|
+
livemode: boolean;
|
|
71
|
+
stripeContext?: string;
|
|
72
|
+
clockTime?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @public */
|
|
76
|
+
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';
|
|
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';
|
|
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
|
+
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
|
+
declare const Decimal: DecimalCompanion;
|
|
236
|
+
|
|
237
|
+
/** @public */
|
|
238
|
+
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
|
+
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
|
+
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
|
+
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
|
+
/** A branded integer — a `number` guaranteed to satisfy `Number.isInteger`. @public */
|
|
318
|
+
declare type Integer = {
|
|
319
|
+
readonly [__integerBrand]: true;
|
|
320
|
+
readonly [__stripeType]: 'int';
|
|
321
|
+
} & number;
|
|
322
|
+
|
|
323
|
+
/** Factory, type guard, and utilities for {@link (Integer:type)} branded values. @public */
|
|
324
|
+
declare const Integer: IntegerCompanion;
|
|
325
|
+
|
|
326
|
+
/** @public */
|
|
327
|
+
declare interface IntegerCompanion {
|
|
328
|
+
/** The Integer value `0`. @public */
|
|
329
|
+
readonly zero: Integer;
|
|
330
|
+
/** Type guard: narrows `unknown` to {@link (Integer:type)}. @public */
|
|
331
|
+
is(value: unknown): value is Integer;
|
|
332
|
+
/** Assertion guard: throws if not an {@link (Integer:type)}. @public */
|
|
333
|
+
assert(value: unknown): asserts value is Integer;
|
|
334
|
+
/** Coerce a value to {@link (Integer:type)} by rounding. @public */
|
|
335
|
+
from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): Integer;
|
|
336
|
+
/** Lossless conversion to `Decimal`. @public */
|
|
337
|
+
toDecimal(value: Integer): Decimal;
|
|
338
|
+
/** Type guard: narrows {@link (Integer:type)} to {@link (PositiveInteger:type)}. @public */
|
|
339
|
+
isPositive(value: Integer): value is PositiveInteger;
|
|
340
|
+
/** Assertion guard: throws if the Integer is negative. @public */
|
|
341
|
+
assertIsPositive(value: Integer): asserts value is PositiveInteger;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Rounding directions for coercing a number to an integer.
|
|
346
|
+
*
|
|
347
|
+
* A focused subset of {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3:
|
|
348
|
+
*
|
|
349
|
+
* | Direction | Behavior | Examples (→ integer) |
|
|
350
|
+
* | -------------- | ---------------------------- | ------------------------------ |
|
|
351
|
+
* | `'ceil'` | Toward +∞ | 1.1→2, -1.1→-1 |
|
|
352
|
+
* | `'floor'` | Toward -∞ | 1.9→1, -1.1→-2 |
|
|
353
|
+
* | `'round-down'` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
|
|
354
|
+
* | `'round-up'` | Away from zero | 1.1→2, -1.1→-2 |
|
|
355
|
+
* | `'half-up'` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
|
|
356
|
+
*
|
|
357
|
+
* @public
|
|
358
|
+
*/
|
|
359
|
+
declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
|
|
363
|
+
*
|
|
364
|
+
* This is a subtype of {@link (Integer:type)}: every non-negative integer is an
|
|
365
|
+
* integer, so `PositiveInteger` values are assignable to `Integer` contexts.
|
|
366
|
+
* The reverse is not true — an `Integer` cannot be assigned where a
|
|
367
|
+
* `PositiveInteger` is expected without going through the `PositiveInteger.is()`
|
|
368
|
+
* type guard or `PositiveInteger.from()` factory.
|
|
369
|
+
*
|
|
370
|
+
* @remarks
|
|
371
|
+
* Despite the name, this type includes zero (`>= 0`, not `> 0`).
|
|
372
|
+
* The schema-level constraint `@minimum 0` should be added to fields
|
|
373
|
+
* typed as `PositiveInteger` to ensure the non-negativity invariant
|
|
374
|
+
* is enforced at validation time.
|
|
375
|
+
*
|
|
376
|
+
* @public
|
|
377
|
+
*/
|
|
378
|
+
declare type PositiveInteger = {
|
|
379
|
+
readonly [__integerBrand]: true;
|
|
380
|
+
readonly [__positiveIntegerBrand]: true;
|
|
381
|
+
readonly [__stripeType]: 'int';
|
|
382
|
+
} & number;
|
|
383
|
+
|
|
384
|
+
/** Factory, type guard, and utilities for {@link (PositiveInteger:type)} branded values. @public */
|
|
385
|
+
declare const PositiveInteger: PositiveIntegerCompanion;
|
|
386
|
+
|
|
387
|
+
/** @public */
|
|
388
|
+
declare interface PositiveIntegerCompanion {
|
|
389
|
+
/** Type guard: narrows `unknown` to {@link (PositiveInteger:type)}. @public */
|
|
390
|
+
is(value: unknown): value is PositiveInteger;
|
|
391
|
+
/** Assertion guard: throws if not a {@link (PositiveInteger:type)}. @public */
|
|
392
|
+
assert(value: unknown): asserts value is PositiveInteger;
|
|
393
|
+
/** Coerce a value to {@link (PositiveInteger:type)} by rounding. Throws if negative. @public */
|
|
394
|
+
from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): PositiveInteger;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** @public */
|
|
398
|
+
export declare namespace RecurringBillingItemHandling {
|
|
399
|
+
/** @public */
|
|
400
|
+
export type PricingTierMode = 'graduated' | 'volume';
|
|
401
|
+
/** @public */
|
|
402
|
+
export type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
403
|
+
/** @public */
|
|
404
|
+
export type PriceType = 'one_time' | 'recurring';
|
|
405
|
+
/** @public */
|
|
406
|
+
export type PricingScheme = 'per_unit' | 'tiered';
|
|
407
|
+
/** @public */
|
|
408
|
+
export type UsageType = 'licensed' | 'metered';
|
|
409
|
+
/** @public */
|
|
410
|
+
export type ItemType = 'credit' | 'debit';
|
|
411
|
+
/**
|
|
412
|
+
* The result of the group items extension.
|
|
413
|
+
* @public
|
|
414
|
+
*/
|
|
415
|
+
export interface GroupItemsResult {
|
|
416
|
+
/** The groups of items, each corresponding to a separate invoice. */
|
|
417
|
+
groups: ItemGroup[];
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* A group of items to place on a single invoice.
|
|
421
|
+
* @public
|
|
422
|
+
*/
|
|
423
|
+
export interface ItemGroup {
|
|
424
|
+
/** The items in this group. */
|
|
425
|
+
items: GroupedItem[];
|
|
426
|
+
/** Whether this group sets the latest invoice reference on the subscription. */
|
|
427
|
+
setsLatestInvoice: boolean;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* An item assigned to a group.
|
|
431
|
+
* @public
|
|
432
|
+
*/
|
|
433
|
+
export interface GroupedItem {
|
|
434
|
+
/** The unique identifier of the item, matching a key from the input. */
|
|
435
|
+
key: string;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The input to the group items extension.
|
|
439
|
+
* @public
|
|
440
|
+
*/
|
|
441
|
+
export interface GroupItemsInput {
|
|
442
|
+
/** The list of items to group across invoices. */
|
|
443
|
+
items: Item[];
|
|
444
|
+
}
|
|
445
|
+
/** @public */
|
|
446
|
+
export type Item = ({
|
|
447
|
+
creditedItems: 'invoiceItem';
|
|
448
|
+
invoiceItem: CreditedInvoiceItem;
|
|
449
|
+
} | {
|
|
450
|
+
creditedItems: 'invoiceLineItems';
|
|
451
|
+
invoiceLineItems: InvoiceLineItems;
|
|
452
|
+
} | {
|
|
453
|
+
creditedItems: 'other';
|
|
454
|
+
otherCreditedItems: string;
|
|
455
|
+
} | { creditedItems?: never }) & ({
|
|
456
|
+
customPricingUnitOverageRate: CustomPricingUnitOverageRate;
|
|
457
|
+
priceKind: 'customPricingUnitOverageRate';
|
|
458
|
+
} | {
|
|
459
|
+
licenseFee: LicenseFee;
|
|
460
|
+
priceKind: 'licenseFee';
|
|
461
|
+
} | {
|
|
462
|
+
otherPriceKind: string;
|
|
463
|
+
priceKind: 'other';
|
|
464
|
+
} | {
|
|
465
|
+
price: Price;
|
|
466
|
+
priceKind: 'price';
|
|
467
|
+
} | {
|
|
468
|
+
priceKind: 'rateCardRate';
|
|
469
|
+
rateCardRate: RateCardRate;
|
|
470
|
+
} | { priceKind?: never }) & {
|
|
471
|
+
isProration: boolean;
|
|
472
|
+
key: string;
|
|
473
|
+
prorationFactor: Decimal;
|
|
474
|
+
servicePeriod: AnyTimeRange;
|
|
475
|
+
type: ItemType;
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* The invoice item corresponding to a credit item.
|
|
479
|
+
* @public
|
|
480
|
+
*/
|
|
481
|
+
export interface CreditedInvoiceItem {
|
|
482
|
+
/** The id of the invoice item. */
|
|
483
|
+
id: string;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Information about debit line items corresponding to a credit item.
|
|
487
|
+
* @public
|
|
488
|
+
*/
|
|
489
|
+
export interface InvoiceLineItems {
|
|
490
|
+
/** The invoice containing the line items. */
|
|
491
|
+
invoice: CreditedInvoice;
|
|
492
|
+
/** The line items corresponding to the credit. */
|
|
493
|
+
invoiceLineItems: CreditedInvoiceLineItem[];
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* The invoice line item corresponding to a credit item.
|
|
497
|
+
* @public
|
|
498
|
+
*/
|
|
499
|
+
export interface CreditedInvoiceLineItem {
|
|
500
|
+
/** The id of the invoice line item. */
|
|
501
|
+
id: string;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The invoice corresponding to a credit item.
|
|
505
|
+
* @public
|
|
506
|
+
*/
|
|
507
|
+
export interface CreditedInvoice {
|
|
508
|
+
/** The id of the invoice. */
|
|
509
|
+
id: string;
|
|
510
|
+
}
|
|
511
|
+
/** @public */
|
|
512
|
+
export interface CustomPricingUnitOverageRate {
|
|
513
|
+
id: string;
|
|
514
|
+
metadata: Record<string, string>;
|
|
515
|
+
rateCard: RateCard;
|
|
516
|
+
customPricingUnit: string;
|
|
517
|
+
unitAmount: Decimal;
|
|
518
|
+
}
|
|
519
|
+
/** @public */
|
|
520
|
+
export interface RateCard {
|
|
521
|
+
id: string;
|
|
522
|
+
currency: Currency;
|
|
523
|
+
}
|
|
524
|
+
/** @public */
|
|
525
|
+
export interface RateCardRate {
|
|
526
|
+
id: string;
|
|
527
|
+
metadata: Record<string, string>;
|
|
528
|
+
rateCard: RateCard;
|
|
529
|
+
tieringMode?: PricingTierMode;
|
|
530
|
+
tiers: RateCardRateTier[];
|
|
531
|
+
unitAmount?: Decimal;
|
|
532
|
+
}
|
|
533
|
+
/** @public */
|
|
534
|
+
export interface RateCardRateTier {
|
|
535
|
+
flatAmount?: Decimal;
|
|
536
|
+
unitAmount?: Decimal;
|
|
537
|
+
upTo?: Decimal;
|
|
538
|
+
}
|
|
539
|
+
/** @public */
|
|
540
|
+
export interface LicenseFee {
|
|
541
|
+
id: string;
|
|
542
|
+
lookupKey?: string;
|
|
543
|
+
metadata: Record<string, string>;
|
|
544
|
+
serviceInterval: RecurringPriceInterval;
|
|
545
|
+
serviceIntervalCount: number;
|
|
546
|
+
tieringMode?: PricingTierMode;
|
|
547
|
+
tiers: LicenseFeeTier[];
|
|
548
|
+
currency: Currency;
|
|
549
|
+
unitAmount?: Decimal;
|
|
550
|
+
}
|
|
551
|
+
/** @public */
|
|
552
|
+
export interface LicenseFeeTier {
|
|
553
|
+
flatAmount?: Decimal;
|
|
554
|
+
unitAmount?: Decimal;
|
|
555
|
+
upTo?: Decimal;
|
|
556
|
+
}
|
|
557
|
+
/** @public */
|
|
558
|
+
export interface Price {
|
|
559
|
+
id: string;
|
|
560
|
+
product: Product;
|
|
561
|
+
recurring?: RecurringPrice;
|
|
562
|
+
billingScheme: PricingScheme;
|
|
563
|
+
tiers: PriceTier[];
|
|
564
|
+
type: PriceType;
|
|
565
|
+
tiersMode?: PricingTierMode;
|
|
566
|
+
metadata: Record<string, string>;
|
|
567
|
+
currency: Currency;
|
|
568
|
+
unitAmount?: Decimal;
|
|
569
|
+
}
|
|
570
|
+
/** @public */
|
|
571
|
+
export interface PriceTier {
|
|
572
|
+
flatAmount?: Decimal;
|
|
573
|
+
unitAmount?: Decimal;
|
|
574
|
+
upTo?: number;
|
|
575
|
+
}
|
|
576
|
+
/** @public */
|
|
577
|
+
export interface RecurringPrice {
|
|
578
|
+
interval: RecurringPriceInterval;
|
|
579
|
+
intervalCount: number;
|
|
580
|
+
usageType?: UsageType;
|
|
581
|
+
meter?: string;
|
|
582
|
+
}
|
|
583
|
+
/** @public */
|
|
584
|
+
export interface Product {
|
|
585
|
+
id: string;
|
|
586
|
+
name: string;
|
|
587
|
+
metadata: Record<string, string>;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* The result of the filter items extension.
|
|
591
|
+
* @public
|
|
592
|
+
*/
|
|
593
|
+
export interface FilterItemsResult {
|
|
594
|
+
/** The items to include on the invoice. */
|
|
595
|
+
items: ItemToInvoice[];
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* An item selected for inclusion on the invoice.
|
|
599
|
+
* @public
|
|
600
|
+
*/
|
|
601
|
+
export interface ItemToInvoice {
|
|
602
|
+
/** The unique identifier of the item, matching a key from the input. */
|
|
603
|
+
key: string;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* The input to the filter items extension.
|
|
607
|
+
* @public
|
|
608
|
+
*/
|
|
609
|
+
export interface FilterItemsInput {
|
|
610
|
+
/** The list of items to evaluate for inclusion on the invoice. */
|
|
611
|
+
items: Item[];
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* The result of the before item creation extension.
|
|
615
|
+
* @public
|
|
616
|
+
*/
|
|
617
|
+
export interface BeforeItemCreationResult {
|
|
618
|
+
/** The items with their creation strategies. */
|
|
619
|
+
items: ItemWithCreationStrategy[];
|
|
620
|
+
}
|
|
621
|
+
/** @public */
|
|
622
|
+
export type ItemWithCreationStrategy = ({
|
|
623
|
+
creationStrategy: 'other';
|
|
624
|
+
otherCreationStrategy: string;
|
|
625
|
+
} | { creationStrategy: 'doNotCreate' } | { creationStrategy: 'invoice' } | { creationStrategy?: never }) & { key: string };
|
|
626
|
+
/** @public */
|
|
627
|
+
export type Invoice = Record<string, never>;
|
|
628
|
+
/** @public */
|
|
629
|
+
export type DoNotCreate = Record<string, never>;
|
|
630
|
+
/**
|
|
631
|
+
* The input to the before item creation extension.
|
|
632
|
+
* @public
|
|
633
|
+
*/
|
|
634
|
+
export interface BeforeItemCreationInput {
|
|
635
|
+
/** The list of items to evaluate for creation. */
|
|
636
|
+
items: Item[];
|
|
637
|
+
}
|
|
638
|
+
/* Excluded from this release type: $platformWrapBeforeItemCreation */
|
|
639
|
+
/* Excluded from this release type: $platformWrapFilterItems */
|
|
640
|
+
/* Excluded from this release type: $platformWrapGroupItems */
|
|
641
|
+
/**
|
|
642
|
+
* Runs before invoice items are created. Decides whether each item should be created or skipped.
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
export type BeforeItemCreationFunction<Config> = (request: BeforeItemCreationInput, config: Config, context: Context) => BeforeItemCreationResult;
|
|
646
|
+
/**
|
|
647
|
+
* Runs before invoices are created. Decides which items to include on the invoice. Items not included are deferred as pending invoice items.
|
|
648
|
+
* @public
|
|
649
|
+
*/
|
|
650
|
+
export type FilterItemsFunction<Config> = (request: FilterItemsInput, config: Config, context: Context) => FilterItemsResult;
|
|
651
|
+
/**
|
|
652
|
+
* Runs before invoices are created. Decides how items are grouped across one or more invoices.
|
|
653
|
+
* @public
|
|
654
|
+
*/
|
|
655
|
+
export type GroupItemsFunction<Config> = (request: GroupItemsInput, config: Config, context: Context) => GroupItemsResult;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* @example
|
|
660
|
+
* ```ts
|
|
661
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
662
|
+
*
|
|
663
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
664
|
+
* interface MyRecurringBillingItemHandlingConfig {}
|
|
665
|
+
*
|
|
666
|
+
* export default class MyRecurringBillingItemHandling implements Billing.RecurringBillingItemHandling<MyRecurringBillingItemHandlingConfig> {
|
|
667
|
+
* beforeItemCreation(
|
|
668
|
+
* _request: Billing.RecurringBillingItemHandling.BeforeItemCreationInput,
|
|
669
|
+
* _config: MyRecurringBillingItemHandlingConfig,
|
|
670
|
+
* _context: Context
|
|
671
|
+
* ) {
|
|
672
|
+
* // TODO: implement your before-item-creation logic here
|
|
673
|
+
*
|
|
674
|
+
* return {
|
|
675
|
+
* items: [],
|
|
676
|
+
* };
|
|
677
|
+
* }
|
|
678
|
+
*
|
|
679
|
+
* filterItems(
|
|
680
|
+
* _request: Billing.RecurringBillingItemHandling.FilterItemsInput,
|
|
681
|
+
* _config: MyRecurringBillingItemHandlingConfig,
|
|
682
|
+
* _context: Context
|
|
683
|
+
* ) {
|
|
684
|
+
* // TODO: implement your filter-items logic here
|
|
685
|
+
*
|
|
686
|
+
* return {
|
|
687
|
+
* items: [],
|
|
688
|
+
* };
|
|
689
|
+
* }
|
|
690
|
+
*
|
|
691
|
+
* groupItems(
|
|
692
|
+
* _request: Billing.RecurringBillingItemHandling.GroupItemsInput,
|
|
693
|
+
* _config: MyRecurringBillingItemHandlingConfig,
|
|
694
|
+
* _context: Context
|
|
695
|
+
* ) {
|
|
696
|
+
* // TODO: implement your group-items logic here
|
|
697
|
+
*
|
|
698
|
+
* return {
|
|
699
|
+
* groups: [],
|
|
700
|
+
* };
|
|
701
|
+
* }
|
|
702
|
+
* }
|
|
703
|
+
*
|
|
704
|
+
* ```
|
|
705
|
+
* @public
|
|
706
|
+
*/
|
|
707
|
+
export declare interface RecurringBillingItemHandling<Config> {
|
|
708
|
+
beforeItemCreation: RecurringBillingItemHandling.BeforeItemCreationFunction<Config>;
|
|
709
|
+
filterItems: RecurringBillingItemHandling.FilterItemsFunction<Config>;
|
|
710
|
+
groupItems: RecurringBillingItemHandling.GroupItemsFunction<Config>;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Rounding direction for Decimal operations.
|
|
715
|
+
*
|
|
716
|
+
* @remarks
|
|
717
|
+
* Seven modes corresponding to
|
|
718
|
+
* {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3
|
|
719
|
+
* rounding-direction attributes:
|
|
720
|
+
*
|
|
721
|
+
* | Direction | IEEE 754 name | Behavior | Examples (→ integer) |
|
|
722
|
+
* | -------------- | ----------------------- | --------------------------------- | ------------------------------------- |
|
|
723
|
+
* | `'ceil'` | `roundTowardPositive` | Toward +∞ | 1.1→2, -1.1→-1 |
|
|
724
|
+
* | `'floor'` | `roundTowardNegative` | Toward -∞ | 1.9→1, -1.1→-2 |
|
|
725
|
+
* | `'round-down'` | `roundTowardZero` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
|
|
726
|
+
* | `'round-up'` | — | Away from zero | 1.1→2, -1.1→-2 |
|
|
727
|
+
* | `'half-up'` | `roundTiesToAway` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
|
|
728
|
+
* | `'half-down'` | — | Nearest; ties toward zero | 0.5→0, -0.5→0, 1.6→2 |
|
|
729
|
+
* | `'half-even'` | `roundTiesToEven` | Nearest; ties to even (banker's) | 0.5→0, 1.5→2, 2.5→2, 3.5→4 |
|
|
730
|
+
*
|
|
731
|
+
* @public
|
|
732
|
+
*/
|
|
733
|
+
declare type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even' | 'half-up' | 'round-down' | 'round-up';
|
|
734
|
+
|
|
735
|
+
export { }
|