@stripe/extensibility-sdk 0.24.1 → 0.26.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 +328 -0
- package/dist/config-values/generate.cjs +1 -1
- package/dist/config-values/generate.d.ts +2 -0
- 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 +141 -98
- package/dist/extensibility-sdk-beta.d.ts +141 -98
- package/dist/extensibility-sdk-extensions-alpha.d.ts +155 -25
- package/dist/extensibility-sdk-extensions-beta.d.ts +155 -25
- package/dist/extensibility-sdk-extensions-internal.d.ts +160 -26
- package/dist/extensibility-sdk-extensions-public.d.ts +155 -25
- package/dist/extensibility-sdk-internal-alpha.d.ts +5 -0
- package/dist/extensibility-sdk-internal-beta.d.ts +5 -0
- package/dist/extensibility-sdk-internal-internal.d.ts +5 -0
- package/dist/extensibility-sdk-internal-public.d.ts +5 -0
- package/dist/extensibility-sdk-internal.d.ts +144 -82
- package/dist/extensibility-sdk-public.d.ts +141 -98
- package/dist/extensibility-sdk-stdlib-alpha.d.ts +146 -98
- package/dist/extensibility-sdk-stdlib-beta.d.ts +146 -98
- package/dist/extensibility-sdk-stdlib-internal.d.ts +149 -82
- package/dist/extensibility-sdk-stdlib-public.d.ts +146 -98
- package/dist/extensions/billing/bill/discount_calculation.d.ts +5 -3
- package/dist/extensions/billing/customer_balance_application.d.ts +3 -1
- package/dist/extensions/billing/invoice_collection_setting.d.ts +15 -11
- package/dist/extensions/billing/prorations.d.ts +30 -21
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts +41 -23
- package/dist/extensions/billing/types.d.ts +4 -4
- package/dist/extensions/core/workflows/custom_action.d.ts +6 -2
- package/dist/extensions/extend/workflows/custom_action.d.ts +6 -2
- package/dist/index.cjs +398 -163
- package/dist/index.js +395 -158
- package/dist/internal.d.ts +4 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/stdlib/brand.d.ts +16 -10
- package/dist/stdlib/brand.d.ts.map +1 -1
- package/dist/stdlib/decimal.d.ts +50 -22
- package/dist/stdlib/decimal.d.ts.map +1 -1
- package/dist/stdlib/index.cjs +398 -163
- package/dist/stdlib/index.d.ts +11 -5
- package/dist/stdlib/index.d.ts.map +1 -1
- package/dist/stdlib/index.js +395 -158
- package/dist/stdlib/refs.d.ts +12 -20
- package/dist/stdlib/refs.d.ts.map +1 -1
- package/dist/stdlib/scalars.d.ts +51 -36
- package/dist/stdlib/scalars.d.ts.map +1 -1
- package/dist/stdlib/to-const.d.ts +35 -0
- package/dist/stdlib/to-const.d.ts.map +1 -0
- package/dist/stdlib/transforms.d.ts +1 -1
- package/dist/stdlib/type-utils.d.ts +3 -1
- package/dist/stdlib/types.d.ts +11 -11
- package/dist/stdlib/types.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/dist/api-surface.d.ts.map +0 -1
|
@@ -12,32 +12,52 @@
|
|
|
12
12
|
import { __integerBrand } from '@formspec/core';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Opaque brand
|
|
15
|
+
* Opaque brand key used as a property key in SDK branded types.
|
|
16
16
|
*
|
|
17
17
|
* @remarks
|
|
18
18
|
* You do not need to use this directly — it is already embedded in
|
|
19
|
-
* branded values returned by factory functions like {@link (Integer:type)}.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* branded values returned by factory functions like {@link (Integer:type)}.from().
|
|
20
|
+
*
|
|
21
|
+
* String-literal const (not `unique symbol`) so that independent
|
|
22
|
+
* declaration rollups (root vs subpath) produce structurally compatible
|
|
23
|
+
* branded types.
|
|
22
24
|
*
|
|
23
25
|
* @public
|
|
24
26
|
*/
|
|
25
|
-
export declare const __brand:
|
|
27
|
+
export declare const __brand: '__brand';
|
|
26
28
|
|
|
27
29
|
/* Excluded from this release type: __decimalBrand */
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Distinct brand key for PositiveInteger so an Integer is not assignable to
|
|
33
|
+
* PositiveInteger without going through the guard. PositiveInteger is a
|
|
34
|
+
* subtype of Integer (it carries both brands), so it can be used wherever
|
|
35
|
+
* Integer is expected.
|
|
36
|
+
*
|
|
37
|
+
* String-literal const (not `unique symbol`) so that independent
|
|
38
|
+
* declaration rollups (root vs subpath) produce structurally compatible
|
|
39
|
+
* branded types.
|
|
40
|
+
*
|
|
41
|
+
* For internal use only — may be removed in a future release.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare const __positiveIntegerBrand: '__positiveIntegerBrand';
|
|
30
46
|
|
|
31
47
|
/**
|
|
32
|
-
* Opaque type-tag
|
|
48
|
+
* Opaque type-tag key used by SDK scalar types to carry Stripe type metadata.
|
|
33
49
|
*
|
|
34
50
|
* @remarks
|
|
35
51
|
* You do not need to use this directly — it is already embedded in
|
|
36
|
-
* branded values returned by factory functions like {@link (Integer:type)}.
|
|
52
|
+
* branded values returned by factory functions like {@link (Integer:type)}.from().
|
|
53
|
+
*
|
|
54
|
+
* String-literal const (not `unique symbol`) so that independent
|
|
55
|
+
* declaration rollups (root vs subpath) produce structurally compatible
|
|
56
|
+
* branded types.
|
|
37
57
|
*
|
|
38
58
|
* @public
|
|
39
59
|
*/
|
|
40
|
-
export declare const __stripeType:
|
|
60
|
+
export declare const __stripeType: '__stripeType';
|
|
41
61
|
|
|
42
62
|
/** @public */
|
|
43
63
|
declare type AnyTimeRange = {
|
|
@@ -84,7 +104,7 @@ declare namespace Billing {
|
|
|
84
104
|
}
|
|
85
105
|
export { Billing }
|
|
86
106
|
|
|
87
|
-
/** The type of the opaque brand
|
|
107
|
+
/** The type of the opaque brand key used as a property key in SDK branded types. @public */
|
|
88
108
|
export declare type BrandSymbol = typeof __brand;
|
|
89
109
|
|
|
90
110
|
/* Excluded from this release type: _configAppContextFromContext */
|
|
@@ -489,59 +509,59 @@ declare interface CustomerBalanceApplication<Config> {
|
|
|
489
509
|
* @public
|
|
490
510
|
*/
|
|
491
511
|
export declare interface Decimal {
|
|
492
|
-
/* Excluded from this release type:
|
|
493
|
-
/* Excluded from this release type:
|
|
494
|
-
/* Excluded from this release type:
|
|
512
|
+
/* Excluded from this release type: __brand */
|
|
513
|
+
/* Excluded from this release type: __decimalBrand */
|
|
514
|
+
/* Excluded from this release type: __stripeType */
|
|
495
515
|
/**
|
|
496
516
|
* Return the sum of this value and `other`.
|
|
497
517
|
* @public
|
|
498
518
|
*/
|
|
499
|
-
add(other:
|
|
519
|
+
add(other: DecimalLike): Decimal;
|
|
500
520
|
/**
|
|
501
521
|
* Return the difference of this value and `other`.
|
|
502
522
|
* @public
|
|
503
523
|
*/
|
|
504
|
-
sub(other:
|
|
524
|
+
sub(other: DecimalLike): Decimal;
|
|
505
525
|
/**
|
|
506
526
|
* Return the product of this value and `other`.
|
|
507
527
|
* @public
|
|
508
528
|
*/
|
|
509
|
-
mul(other:
|
|
529
|
+
mul(other: DecimalLike): Decimal;
|
|
510
530
|
/**
|
|
511
531
|
* Return the quotient of this value divided by `other`.
|
|
512
532
|
* @public
|
|
513
533
|
*/
|
|
514
|
-
div(other:
|
|
534
|
+
div(other: DecimalLike, precision: number, direction: RoundDirection): Decimal;
|
|
515
535
|
/**
|
|
516
536
|
* Three-way comparison: returns `-1`, `0`, or `1`.
|
|
517
537
|
* @public
|
|
518
538
|
*/
|
|
519
|
-
cmp(other:
|
|
539
|
+
cmp(other: DecimalLike): -1 | 0 | 1;
|
|
520
540
|
/**
|
|
521
541
|
* Return `true` if this value is numerically equal to `other`.
|
|
522
542
|
* @public
|
|
523
543
|
*/
|
|
524
|
-
eq(other:
|
|
544
|
+
eq(other: DecimalLike): boolean;
|
|
525
545
|
/**
|
|
526
546
|
* Return `true` if this value is strictly less than `other`.
|
|
527
547
|
* @public
|
|
528
548
|
*/
|
|
529
|
-
lt(other:
|
|
549
|
+
lt(other: DecimalLike): boolean;
|
|
530
550
|
/**
|
|
531
551
|
* Return `true` if this value is less than or equal to `other`.
|
|
532
552
|
* @public
|
|
533
553
|
*/
|
|
534
|
-
lte(other:
|
|
554
|
+
lte(other: DecimalLike): boolean;
|
|
535
555
|
/**
|
|
536
556
|
* Return `true` if this value is strictly greater than `other`.
|
|
537
557
|
* @public
|
|
538
558
|
*/
|
|
539
|
-
gt(other:
|
|
559
|
+
gt(other: DecimalLike): boolean;
|
|
540
560
|
/**
|
|
541
561
|
* Return `true` if this value is greater than or equal to `other`.
|
|
542
562
|
* @public
|
|
543
563
|
*/
|
|
544
|
-
gte(other:
|
|
564
|
+
gte(other: DecimalLike): boolean;
|
|
545
565
|
/**
|
|
546
566
|
* Return `true` if this value is exactly zero.
|
|
547
567
|
* @public
|
|
@@ -592,6 +612,11 @@ export declare interface Decimal {
|
|
|
592
612
|
* @public
|
|
593
613
|
*/
|
|
594
614
|
toFixed(decimalPlaces: number, direction: RoundDirection): string;
|
|
615
|
+
/**
|
|
616
|
+
* Convert to an {@link (Integer:type)} by rounding.
|
|
617
|
+
* @public
|
|
618
|
+
*/
|
|
619
|
+
toInteger(direction: RoundDirection): Integer;
|
|
595
620
|
/**
|
|
596
621
|
* Rejects implicit coercion; explicit `String(d)` and template literals still work.
|
|
597
622
|
* @public
|
|
@@ -609,10 +634,31 @@ export declare interface Decimal {
|
|
|
609
634
|
*
|
|
610
635
|
* @public
|
|
611
636
|
*/
|
|
612
|
-
export declare const Decimal:
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
637
|
+
export declare const Decimal: DecimalCompanion;
|
|
638
|
+
|
|
639
|
+
/** @public */
|
|
640
|
+
export declare interface DecimalCompanion {
|
|
641
|
+
/** Type guard: narrows `unknown` to `Decimal`. @public */
|
|
642
|
+
is(value: unknown): value is Decimal;
|
|
643
|
+
/** Assertion guard: throws if not a `Decimal`. @public */
|
|
644
|
+
assert(value: unknown): asserts value is Decimal;
|
|
645
|
+
/** Create a Decimal from a {@link DecimalLike} value. @public */
|
|
646
|
+
from(value: DecimalLike): Decimal;
|
|
647
|
+
/** The Decimal value `0`. @public */
|
|
648
|
+
readonly zero: Decimal;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Values that can be coerced to a `Decimal` via `Decimal.from()`.
|
|
653
|
+
*
|
|
654
|
+
* @remarks
|
|
655
|
+
* This union is accepted by `Decimal.from()` and by all arithmetic and
|
|
656
|
+
* comparison methods on `Decimal` instances. Non-Decimal values are
|
|
657
|
+
* coerced via `Decimal.from()` before the operation.
|
|
658
|
+
*
|
|
659
|
+
* @public
|
|
660
|
+
*/
|
|
661
|
+
export declare type DecimalLike = bigint | Decimal | Integer | number | string;
|
|
616
662
|
|
|
617
663
|
/**
|
|
618
664
|
* Precision specification for `Decimal.round()`.
|
|
@@ -670,6 +716,18 @@ export declare const DecimalRoundingPresets: Readonly<{
|
|
|
670
716
|
}>;
|
|
671
717
|
}>;
|
|
672
718
|
|
|
719
|
+
/**
|
|
720
|
+
* Recursively converts a type to a deeply-readonly version.
|
|
721
|
+
*
|
|
722
|
+
* Primitive types (`string`, `number`, `boolean`, `bigint`, `symbol`,
|
|
723
|
+
* `undefined`, `null`) are returned as-is. Arrays become `readonly` arrays
|
|
724
|
+
* of deeply-readonly elements. Object types have each property marked
|
|
725
|
+
* `readonly`, and the type of each property is recursively transformed.
|
|
726
|
+
*
|
|
727
|
+
* @public
|
|
728
|
+
*/
|
|
729
|
+
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;
|
|
730
|
+
|
|
673
731
|
/**
|
|
674
732
|
* The IEEE 754 decimal128 coefficient size (34 digits) — the recommended
|
|
675
733
|
* precision for `Decimal.div()` when full precision is desired.
|
|
@@ -937,11 +995,26 @@ export declare type Integer = {
|
|
|
937
995
|
readonly [__stripeType]: 'int';
|
|
938
996
|
} & number;
|
|
939
997
|
|
|
940
|
-
/** Factory
|
|
941
|
-
export declare const Integer:
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
998
|
+
/** Factory, type guard, and utilities for {@link (Integer:type)} branded values. @public */
|
|
999
|
+
export declare const Integer: IntegerCompanion;
|
|
1000
|
+
|
|
1001
|
+
/** @public */
|
|
1002
|
+
export declare interface IntegerCompanion {
|
|
1003
|
+
/** The Integer value `0`. @public */
|
|
1004
|
+
readonly zero: Integer;
|
|
1005
|
+
/** Type guard: narrows `unknown` to {@link (Integer:type)}. @public */
|
|
1006
|
+
is(value: unknown): value is Integer;
|
|
1007
|
+
/** Assertion guard: throws if not an {@link (Integer:type)}. @public */
|
|
1008
|
+
assert(value: unknown): asserts value is Integer;
|
|
1009
|
+
/** Coerce a value to {@link (Integer:type)} by rounding. @public */
|
|
1010
|
+
from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): Integer;
|
|
1011
|
+
/** Lossless conversion to `Decimal`. @public */
|
|
1012
|
+
toDecimal(value: Integer): Decimal;
|
|
1013
|
+
/** Type guard: narrows {@link (Integer:type)} to {@link (PositiveInteger:type)}. @public */
|
|
1014
|
+
isPositive(value: Integer): value is PositiveInteger;
|
|
1015
|
+
/** Assertion guard: throws if the Integer is negative. @public */
|
|
1016
|
+
assertIsPositive(value: Integer): asserts value is PositiveInteger;
|
|
1017
|
+
}
|
|
945
1018
|
|
|
946
1019
|
/**
|
|
947
1020
|
* Rounding directions for coercing a number to an integer.
|
|
@@ -1071,25 +1144,6 @@ declare interface InvoiceCollectionSetting<Config> {
|
|
|
1071
1144
|
collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
|
|
1072
1145
|
}
|
|
1073
1146
|
|
|
1074
|
-
/**
|
|
1075
|
-
* Check whether a value is a `Decimal` instance.
|
|
1076
|
-
*
|
|
1077
|
-
* @remarks
|
|
1078
|
-
* Use this instead of `instanceof` — the underlying class is not
|
|
1079
|
-
* publicly exported, so `instanceof` checks are not available to
|
|
1080
|
-
* consumers.
|
|
1081
|
-
*
|
|
1082
|
-
* @example
|
|
1083
|
-
* ```ts
|
|
1084
|
-
* if (isDecimal(value)) {
|
|
1085
|
-
* value.add(Decimal.from('1')); // value is Decimal
|
|
1086
|
-
* }
|
|
1087
|
-
* ```
|
|
1088
|
-
*
|
|
1089
|
-
* @public
|
|
1090
|
-
*/
|
|
1091
|
-
export declare function isDecimal(value: unknown): value is Decimal;
|
|
1092
|
-
|
|
1093
1147
|
/* Excluded from this release type: _isPromiseLike */
|
|
1094
1148
|
|
|
1095
1149
|
/* Excluded from this release type: _JsonWireToType */
|
|
@@ -1154,11 +1208,18 @@ export declare type PositiveInteger = {
|
|
|
1154
1208
|
readonly [__stripeType]: 'int';
|
|
1155
1209
|
} & number;
|
|
1156
1210
|
|
|
1157
|
-
/** Factory
|
|
1158
|
-
export declare const PositiveInteger:
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1211
|
+
/** Factory, type guard, and utilities for {@link (PositiveInteger:type)} branded values. @public */
|
|
1212
|
+
export declare const PositiveInteger: PositiveIntegerCompanion;
|
|
1213
|
+
|
|
1214
|
+
/** @public */
|
|
1215
|
+
export declare interface PositiveIntegerCompanion {
|
|
1216
|
+
/** Type guard: narrows `unknown` to {@link (PositiveInteger:type)}. @public */
|
|
1217
|
+
is(value: unknown): value is PositiveInteger;
|
|
1218
|
+
/** Assertion guard: throws if not a {@link (PositiveInteger:type)}. @public */
|
|
1219
|
+
assert(value: unknown): asserts value is PositiveInteger;
|
|
1220
|
+
/** Coerce a value to {@link (PositiveInteger:type)} by rounding. Throws if negative. @public */
|
|
1221
|
+
from(value: Decimal | Integer | number | string, rounding: IntegerRoundDirection): PositiveInteger;
|
|
1222
|
+
}
|
|
1162
1223
|
|
|
1163
1224
|
/** @public */
|
|
1164
1225
|
declare namespace Prorations {
|
|
@@ -1736,16 +1797,7 @@ export declare type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even
|
|
|
1736
1797
|
|
|
1737
1798
|
/* Excluded from this release type: _ShapeDescriptor */
|
|
1738
1799
|
|
|
1739
|
-
/**
|
|
1740
|
-
export declare type StreetAddress = {
|
|
1741
|
-
readonly [__brand]: 'StreetAddress';
|
|
1742
|
-
readonly [__stripeType]: 'string';
|
|
1743
|
-
} & string;
|
|
1744
|
-
|
|
1745
|
-
/** Factory for creating {@link (StreetAddress:type)} branded values. @public */
|
|
1746
|
-
export declare const StreetAddress: { create: (address: string) => StreetAddress };
|
|
1747
|
-
|
|
1748
|
-
/** The type of the opaque Stripe type-tag symbol used in SDK scalar types. @public */
|
|
1800
|
+
/** The type of the opaque Stripe type-tag key used in SDK scalar types. @public */
|
|
1749
1801
|
export declare type StripeTypeSymbol = typeof __stripeType;
|
|
1750
1802
|
|
|
1751
1803
|
/**
|
|
@@ -1759,14 +1811,27 @@ declare interface TimeRange {
|
|
|
1759
1811
|
endDate: Date;
|
|
1760
1812
|
}
|
|
1761
1813
|
|
|
1762
|
-
/**
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1814
|
+
/**
|
|
1815
|
+
* Deep-freezes `value` and returns it typed as {@link DeepReadonly}`<T>`.
|
|
1816
|
+
*
|
|
1817
|
+
* Use this helper for module-scoped constant objects and arrays to satisfy
|
|
1818
|
+
* the `dsl/no-module-scoped-mutable-const` lint rule. Unlike `Object.freeze`,
|
|
1819
|
+
* which is shallow, `toConst` recursively freezes all nested objects and arrays.
|
|
1820
|
+
*
|
|
1821
|
+
* @example
|
|
1822
|
+
* ```typescript
|
|
1823
|
+
* import { toConst } from '@stripe/extensibility-sdk/stdlib';
|
|
1824
|
+
*
|
|
1825
|
+
* const DEFAULTS = toConst({ timeout: 30, retries: 3 });
|
|
1826
|
+
* // Type: { readonly timeout: 30; readonly retries: 3 }
|
|
1827
|
+
*
|
|
1828
|
+
* const STATUSES = toConst(['active', 'pending', 'cancelled']);
|
|
1829
|
+
* // Type: readonly ["active", "pending", "cancelled"]
|
|
1830
|
+
* ```
|
|
1831
|
+
*
|
|
1832
|
+
* @public
|
|
1833
|
+
*/
|
|
1834
|
+
export declare function toConst<T>(value: T): DeepReadonly<T>;
|
|
1770
1835
|
|
|
1771
1836
|
/* Excluded from this release type: _translateArray */
|
|
1772
1837
|
|
|
@@ -1790,31 +1855,9 @@ export declare const Timestamp: { create: (value: string) => Timestamp };
|
|
|
1790
1855
|
|
|
1791
1856
|
/* Excluded from this release type: _UnionDescriptor */
|
|
1792
1857
|
|
|
1793
|
-
|
|
1794
|
-
* Shared types and error classes for the transform pipeline.
|
|
1795
|
-
* See transforms.ts for the module overview.
|
|
1796
|
-
*/
|
|
1797
|
-
/**
|
|
1798
|
-
* Thrown when incoming wire data (proto → SDK) cannot be parsed.
|
|
1799
|
-
* Indicates malformed or unexpected data from the proto infrastructure —
|
|
1800
|
-
* not a bug in the user's code.
|
|
1801
|
-
*
|
|
1802
|
-
* @public
|
|
1803
|
-
*/
|
|
1804
|
-
export declare class WireReadError extends Error {
|
|
1805
|
-
/* Excluded from this release type: name */
|
|
1806
|
-
}
|
|
1858
|
+
/* Excluded from this release type: _WireReadError */
|
|
1807
1859
|
|
|
1808
|
-
|
|
1809
|
-
* Thrown when outgoing SDK data (SDK → proto) cannot be serialized.
|
|
1810
|
-
* Indicates that the user's code returned a value that cannot be translated
|
|
1811
|
-
* back to wire format.
|
|
1812
|
-
*
|
|
1813
|
-
* @public
|
|
1814
|
-
*/
|
|
1815
|
-
export declare class WireWriteError extends Error {
|
|
1816
|
-
/* Excluded from this release type: name */
|
|
1817
|
-
}
|
|
1860
|
+
/* Excluded from this release type: _WireWriteError */
|
|
1818
1861
|
|
|
1819
1862
|
declare namespace Workflows {
|
|
1820
1863
|
export {
|