@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.
Files changed (113) hide show
  1. package/LICENSE.md +19 -0
  2. package/dist/config-values/generate.cjs +262 -0
  3. package/dist/config-values/generate.d.ts +38 -0
  4. package/dist/config-values/generate.d.ts.map +1 -0
  5. package/dist/config-values/generate.js +232 -0
  6. package/dist/config-values/parse.d.ts +87 -0
  7. package/dist/config-values/parse.d.ts.map +1 -0
  8. package/dist/extensibility-sdk-alpha.d.ts +542 -0
  9. package/dist/extensibility-sdk-beta.d.ts +542 -0
  10. package/dist/extensibility-sdk-config-values-alpha.d.ts +27 -0
  11. package/dist/extensibility-sdk-config-values-beta.d.ts +27 -0
  12. package/dist/extensibility-sdk-config-values-internal.d.ts +118 -0
  13. package/dist/extensibility-sdk-config-values-public.d.ts +27 -0
  14. package/dist/extensibility-sdk-extensions-alpha.d.ts +1592 -0
  15. package/dist/extensibility-sdk-extensions-beta.d.ts +1592 -0
  16. package/dist/extensibility-sdk-extensions-internal.d.ts +1655 -0
  17. package/dist/extensibility-sdk-extensions-public.d.ts +1592 -0
  18. package/dist/extensibility-sdk-internal-alpha.d.ts +9 -0
  19. package/dist/extensibility-sdk-internal-beta.d.ts +9 -0
  20. package/dist/extensibility-sdk-internal-internal.d.ts +23 -0
  21. package/dist/extensibility-sdk-internal-public.d.ts +9 -0
  22. package/dist/extensibility-sdk-internal.d.ts +915 -0
  23. package/dist/extensibility-sdk-jsonschema-alpha.d.ts +3 -0
  24. package/dist/extensibility-sdk-jsonschema-beta.d.ts +3 -0
  25. package/dist/extensibility-sdk-jsonschema-internal.d.ts +15 -0
  26. package/dist/extensibility-sdk-jsonschema-public.d.ts +3 -0
  27. package/dist/extensibility-sdk-public.d.ts +542 -0
  28. package/dist/extensibility-sdk-stdlib-alpha.d.ts +531 -0
  29. package/dist/extensibility-sdk-stdlib-beta.d.ts +531 -0
  30. package/dist/extensibility-sdk-stdlib-internal.d.ts +904 -0
  31. package/dist/extensibility-sdk-stdlib-public.d.ts +531 -0
  32. package/dist/extensions/billing/bill/discount_calculation.d.ts +226 -0
  33. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -0
  34. package/dist/extensions/billing/bill/index.d.ts +2 -0
  35. package/dist/extensions/billing/bill/index.d.ts.map +1 -0
  36. package/dist/extensions/billing/customer_balance_application.d.ts +82 -0
  37. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -0
  38. package/dist/extensions/billing/index.d.ts +8 -0
  39. package/dist/extensions/billing/index.d.ts.map +1 -0
  40. package/dist/extensions/billing/invoice_collection_setting.d.ts +117 -0
  41. package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -0
  42. package/dist/extensions/billing/prorations.d.ts +222 -0
  43. package/dist/extensions/billing/prorations.d.ts.map +1 -0
  44. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +326 -0
  45. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -0
  46. package/dist/extensions/billing/types.d.ts +33 -0
  47. package/dist/extensions/billing/types.d.ts.map +1 -0
  48. package/dist/extensions/context.d.ts +9 -0
  49. package/dist/extensions/context.d.ts.map +1 -0
  50. package/dist/extensions/core/index.d.ts +3 -0
  51. package/dist/extensions/core/index.d.ts.map +1 -0
  52. package/dist/extensions/core/workflows/custom_action.d.ts +142 -0
  53. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -0
  54. package/dist/extensions/core/workflows/index.d.ts +2 -0
  55. package/dist/extensions/core/workflows/index.d.ts.map +1 -0
  56. package/dist/extensions/extend/index.d.ts +3 -0
  57. package/dist/extensions/extend/index.d.ts.map +1 -0
  58. package/dist/extensions/extend/workflows/custom_action.d.ts +142 -0
  59. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -0
  60. package/dist/extensions/extend/workflows/index.d.ts +2 -0
  61. package/dist/extensions/extend/workflows/index.d.ts.map +1 -0
  62. package/dist/extensions/index.cjs +2356 -0
  63. package/dist/extensions/index.d.ts +9 -0
  64. package/dist/extensions/index.d.ts.map +1 -0
  65. package/dist/extensions/index.js +2435 -0
  66. package/dist/extensions/registry.d.ts +19 -0
  67. package/dist/extensions/registry.d.ts.map +1 -0
  68. package/dist/extensions/types.d.ts +10 -0
  69. package/dist/extensions/types.d.ts.map +1 -0
  70. package/dist/index.cjs +1519 -0
  71. package/dist/index.d.ts +12 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +1460 -0
  74. package/dist/internal.cjs +156 -0
  75. package/dist/internal.d.ts +3 -0
  76. package/dist/internal.d.ts.map +1 -0
  77. package/dist/internal.js +128 -0
  78. package/dist/jsonschema.cjs +18 -0
  79. package/dist/jsonschema.d.ts +2 -0
  80. package/dist/jsonschema.d.ts.map +1 -0
  81. package/dist/jsonschema.js +0 -0
  82. package/dist/stdlib/brand.d.ts +27 -0
  83. package/dist/stdlib/brand.d.ts.map +1 -0
  84. package/dist/stdlib/decimal.d.ts +324 -0
  85. package/dist/stdlib/decimal.d.ts.map +1 -0
  86. package/dist/stdlib/extension-method.d.ts +27 -0
  87. package/dist/stdlib/extension-method.d.ts.map +1 -0
  88. package/dist/stdlib/generated.d.ts +15 -0
  89. package/dist/stdlib/generated.d.ts.map +1 -0
  90. package/dist/stdlib/index.cjs +1519 -0
  91. package/dist/stdlib/index.d.ts +18 -0
  92. package/dist/stdlib/index.d.ts.map +1 -0
  93. package/dist/stdlib/index.js +1460 -0
  94. package/dist/stdlib/refs.d.ts +62 -0
  95. package/dist/stdlib/refs.d.ts.map +1 -0
  96. package/dist/stdlib/scalars.d.ts +141 -0
  97. package/dist/stdlib/scalars.d.ts.map +1 -0
  98. package/dist/stdlib/transform-strategies.d.ts +74 -0
  99. package/dist/stdlib/transform-strategies.d.ts.map +1 -0
  100. package/dist/stdlib/transforms.d.ts +97 -0
  101. package/dist/stdlib/transforms.d.ts.map +1 -0
  102. package/dist/stdlib/type-utils.d.ts +9 -0
  103. package/dist/stdlib/type-utils.d.ts.map +1 -0
  104. package/dist/stdlib/types.d.ts +281 -0
  105. package/dist/stdlib/types.d.ts.map +1 -0
  106. package/dist/stdlib/utils.d.ts +7 -0
  107. package/dist/stdlib/utils.d.ts.map +1 -0
  108. package/dist/tsconfig.build.tsbuildinfo +1 -0
  109. package/package.json +111 -0
  110. package/tslibs/5.9.3/lib.es2022.egress.d.ts +4328 -0
  111. package/tslibs/5.9.3/lib.es2022.restricted.d.ts +4067 -0
  112. package/tslibs/lib.egress.globals.d.ts +112 -0
  113. package/tslibs/lib.restricted.globals.d.ts +1 -0
@@ -0,0 +1,62 @@
1
+ import { type __brand, type __stripeType, type StripeTypeSymbol } from './brand.js';
2
+ import type { ExtractObjectTag } from './type-utils.js';
3
+ /**
4
+ * Object reference — a typed pointer to another API resource.
5
+ *
6
+ * @example
7
+ * ```
8
+ * { type: "v2.core.customer", id: "cus_1234" }
9
+ * ```
10
+ *
11
+ * The type parameter T must have a readonly `object` property
12
+ * whose string literal type becomes the `type` field's value.
13
+ *
14
+ * @discriminator :type T
15
+ *
16
+ * @public
17
+ */
18
+ export type Ref<T extends {
19
+ readonly object: string;
20
+ } = {
21
+ readonly object: string;
22
+ }> = {
23
+ /** The object tag of the referenced resource (e.g., "v2.core.customer"). */
24
+ type: ExtractObjectTag<T>;
25
+ /** The ID of the referenced resource. */
26
+ id: string;
27
+ } & {
28
+ readonly [__brand]: 'Ref';
29
+ readonly __type?: T;
30
+ readonly [__stripeType]: 'string';
31
+ };
32
+ /** Factory for creating {@link (Ref:type)} values from an object with `object` and `id` fields. @public */
33
+ export declare const Ref: {
34
+ create: <T extends {
35
+ readonly object: string;
36
+ }>(step: T & {
37
+ readonly id: string;
38
+ }) => Ref<T>;
39
+ };
40
+ /**
41
+ * A paginated list of references to objects of type T.
42
+ *
43
+ * @public
44
+ */
45
+ export type PaginatedRefList<T extends {
46
+ readonly object: string;
47
+ } = {
48
+ readonly object: string;
49
+ }> = Ref<T>[] & {
50
+ readonly [__brand]: 'PaginatedRefList';
51
+ readonly __type?: T;
52
+ readonly [__stripeType]: `list<${Ref<T>[StripeTypeSymbol]}>`;
53
+ };
54
+ /** Factory for creating {@link PaginatedRefList} values from an array of {@link Ref} items. @public */
55
+ export declare const PaginatedRefList: {
56
+ create: <T extends {
57
+ readonly object: string;
58
+ } = {
59
+ readonly object: string;
60
+ }>(items?: Ref<T>[]) => PaginatedRefList<T>;
61
+ };
62
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/stdlib/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,IAAI;IACrF,4EAA4E;IAC5E,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC1B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG;IACF,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC;CACnC,CAAC;AAEF,2GAA2G;AAC3G,eAAO,MAAM,GAAG;aACL,CAAC,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,QACtC,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,KAChC,GAAG,CAAC,CAAC,CAAC;CAOV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAC1B,CAAC,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,IACjE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;IACb,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC;CAC9D,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,gBAAgB;aAClB,CAAC,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE;yBAAsB,MAAM;eACjE,GAAG,CAAC,CAAC,CAAC,EAAE,KACd,gBAAgB,CAAC,CAAC,CAAC;CAIvB,CAAC"}
@@ -0,0 +1,141 @@
1
+ import { type __integerBrand } from '@formspec/core';
2
+ import { type __brand, type __stripeType } from './brand.js';
3
+ /** A branded object type representing a JSON map (`map<string>`) in the Stripe type system. @public */
4
+ export type JsonObject = object & {
5
+ readonly [__brand]: 'JsonObject';
6
+ readonly [__stripeType]: 'map<string>';
7
+ };
8
+ /** Factory for creating {@link JsonObject} branded values. @public */
9
+ export declare const JsonObject: {
10
+ create: (value: object) => JsonObject;
11
+ };
12
+ /** A branded integer — a `number` guaranteed to satisfy `Number.isInteger`. @public */
13
+ export type Integer = number & {
14
+ readonly [__integerBrand]: true;
15
+ readonly [__stripeType]: 'int';
16
+ };
17
+ /**
18
+ * Distinct brand for PositiveInteger so an Integer is not assignable to
19
+ * PositiveInteger without going through the guard. PositiveInteger is a
20
+ * subtype of Integer (it carries both brands), so it can be used wherever
21
+ * Integer is expected.
22
+ * @internal
23
+ */
24
+ declare const __positiveIntegerBrand: unique symbol;
25
+ /**
26
+ * A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
27
+ *
28
+ * This is a subtype of {@link (Integer:type)}: every non-negative integer is an
29
+ * integer, so `PositiveInteger` values are assignable to `Integer` contexts.
30
+ * The reverse is not true — an `Integer` cannot be assigned where a
31
+ * `PositiveInteger` is expected without going through the `PositiveInteger.is()`
32
+ * type guard or `PositiveInteger.from()` factory.
33
+ *
34
+ * @remarks
35
+ * Despite the name, this type includes zero (`>= 0`, not `> 0`).
36
+ * The schema-level constraint `@minimum 0` should be added to fields
37
+ * typed as `PositiveInteger` to ensure the non-negativity invariant
38
+ * is enforced at validation time.
39
+ *
40
+ * @public
41
+ */
42
+ export type PositiveInteger = number & {
43
+ readonly [__integerBrand]: true;
44
+ readonly [__positiveIntegerBrand]: true;
45
+ readonly [__stripeType]: 'int';
46
+ };
47
+ /**
48
+ * Rounding directions for coercing a number to an integer.
49
+ *
50
+ * A focused subset of {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3:
51
+ *
52
+ * | Direction | Behavior | Examples (→ integer) |
53
+ * | -------------- | ---------------------------- | ------------------------------ |
54
+ * | `'ceil'` | Toward +∞ | 1.1→2, -1.1→-1 |
55
+ * | `'floor'` | Toward -∞ | 1.9→1, -1.1→-2 |
56
+ * | `'round-down'` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
57
+ * | `'round-up'` | Away from zero | 1.1→2, -1.1→-2 |
58
+ * | `'half-up'` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
59
+ *
60
+ * @public
61
+ */
62
+ export type IntegerRoundDirection = 'ceil' | 'floor' | 'round-down' | 'round-up' | 'half-up';
63
+ /** Factory and type guard for {@link (Integer:type)} branded values. @public */
64
+ export declare const Integer: {
65
+ /**
66
+ * Type guard that narrows a `number` to {@link (Integer:type)}.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const n: number = getCount();
71
+ * if (Integer.is(n)) {
72
+ * // n is Integer here
73
+ * config.retryCount = n;
74
+ * }
75
+ * ```
76
+ * @public
77
+ */
78
+ is: (value: number) => value is Integer;
79
+ /**
80
+ * Coerces a number to an {@link (Integer:type)} by rounding.
81
+ * Throws if the value is not finite.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const price = 9.99;
86
+ * const rounded = Integer.from(price, 'floor'); // 9
87
+ * const ceiled = Integer.from(price, 'ceil'); // 10
88
+ * ```
89
+ * @public
90
+ */
91
+ from: (value: number, rounding: IntegerRoundDirection) => Integer;
92
+ };
93
+ /** Factory and type guard for {@link (PositiveInteger:type)} branded values. @public */
94
+ export declare const PositiveInteger: {
95
+ /**
96
+ * Type guard that narrows a `number` to {@link (PositiveInteger:type)}.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const n: number = getRetryCount();
101
+ * if (PositiveInteger.is(n)) {
102
+ * // n is PositiveInteger here
103
+ * config.maxRetries = n;
104
+ * }
105
+ * ```
106
+ * @public
107
+ */
108
+ is: (value: number) => value is PositiveInteger;
109
+ /**
110
+ * Coerces a number to a {@link (PositiveInteger:type)} by rounding.
111
+ * Throws if the value is not finite or the rounded result is negative.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * const ratio = 2.7;
116
+ * const count = PositiveInteger.from(ratio, 'floor'); // 2
117
+ * ```
118
+ * @public
119
+ */
120
+ from: (value: number, rounding: IntegerRoundDirection) => PositiveInteger;
121
+ };
122
+ /** A branded string representing a street address. @public */
123
+ export type StreetAddress = string & {
124
+ readonly [__brand]: 'StreetAddress';
125
+ readonly [__stripeType]: 'string';
126
+ };
127
+ /** Factory for creating {@link (StreetAddress:type)} branded values. @public */
128
+ export declare const StreetAddress: {
129
+ create: (address: string) => StreetAddress;
130
+ };
131
+ /** A branded string representing an ISO 8601 datetime. @public */
132
+ export type Timestamp = string & {
133
+ readonly [__brand]: 'Timestamp';
134
+ readonly [__stripeType]: 'string';
135
+ };
136
+ /** Factory for creating {@link (Timestamp:type)} branded values. @public */
137
+ export declare const Timestamp: {
138
+ create: (value: string) => Timestamp;
139
+ };
140
+ export {};
141
+ //# sourceMappingURL=scalars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../../src/stdlib/scalars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D,uGAAuG;AACvG,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAChC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;CACxC,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,UAAU;oBACL,MAAM,KAAG,UAAU;CAIpC,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC7B,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;IAChC,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,OAAO,CAAC,MAAM,sBAAsB,EAAE,OAAO,MAAM,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IACrC,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;IAChC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,EAAE,IAAI,CAAC;IACxC,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,OAAO,GACP,YAAY,GACZ,UAAU,GACV,SAAS,CAAC;AAuBd,gFAAgF;AAChF,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;OAYG;gBACS,MAAM,KAAG,KAAK,IAAI,OAAO;IAErC;;;;;;;;;;;OAWG;kBACW,MAAM,YAAY,qBAAqB,KAAG,OAAO;CAOhE,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,eAAe;IAC1B;;;;;;;;;;;;OAYG;gBACS,MAAM,KAAG,KAAK,IAAI,eAAe;IAE7C;;;;;;;;;;OAUG;kBACW,MAAM,YAAY,qBAAqB,KAAG,eAAe;CAcxE,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IACnC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC;CACnC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,aAAa;sBACN,MAAM,KAAG,aAAa;CAIzC,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAC/B,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAEhC,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC;CACnC,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,SAAS;oBACJ,MAAM,KAAG,SAAS;CAInC,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Concrete ApplyStrategy implementations.
3
+ *
4
+ * Three strategy constants encapsulate transformation direction:
5
+ * ProtoWireToType — proto wire → SDK (incoming)
6
+ * TypeToProtoWire — SDK → proto wire (outgoing)
7
+ * JsonWireToType — config JSON → SDK
8
+ */
9
+ import { _ShapeDescriptor } from './types.js';
10
+ import type { _JsonWireToTypeStrategy, _ProtoWireToTypeStrategy, _TypeToProtoWireStrategy } from './types.js';
11
+ /**
12
+ * Strategy for transforming incoming proto wire data to SDK types.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare const _ProtoWireToType: _ProtoWireToTypeStrategy;
17
+ /**
18
+ * Strategy for transforming outgoing SDK types to proto wire data.
19
+ *
20
+ * @internal
21
+ */
22
+ export declare const _TypeToProtoWire: _TypeToProtoWireStrategy;
23
+ /**
24
+ * Context values threaded into config application at runtime.
25
+ *
26
+ * The platform dispatch layer builds this from the extension context
27
+ * (`_configAppContextFromContext`) and passes it through the config
28
+ * transformer into `_applyConfig`.
29
+ *
30
+ * @internal
31
+ */
32
+ export interface _ConfigApplicationContext {
33
+ /** ISO 8601 clock time for Billing test clocks. */
34
+ clockTime?: string;
35
+ }
36
+ /**
37
+ * Builds a `ConfigApplicationContext` from the raw extension context.
38
+ *
39
+ * Extracts `clockTime` when present and validates it is a string.
40
+ * Returns an empty context when the field is absent or ctx is not an object.
41
+ *
42
+ * @internal
43
+ */
44
+ export declare function _configAppContextFromContext(ctx: unknown): _ConfigApplicationContext;
45
+ /**
46
+ * Strategy for transforming JSON config data to SDK types.
47
+ *
48
+ * @internal
49
+ */
50
+ export declare const _JsonWireToType: _JsonWireToTypeStrategy;
51
+ /**
52
+ * Apply _ProtoWireToType to a descriptor, returning the typed SDK value.
53
+ * Eliminates the `as unknown as T` exit cast at call sites.
54
+ *
55
+ * @internal
56
+ */
57
+ export declare function _applyIncoming<T, S extends _ProtoWireToTypeStrategy>(descriptor: _ShapeDescriptor<S, T>, inputObject: unknown): T;
58
+ /**
59
+ * Apply _TypeToProtoWire to a descriptor. The input is typed as `T`,
60
+ * catching wrong-direction mistakes at compile time.
61
+ *
62
+ * @internal
63
+ */
64
+ export declare function _applyOutgoing<T, S extends _TypeToProtoWireStrategy>(descriptor: _ShapeDescriptor<S, T>, inputObject: T): Record<string, unknown>;
65
+ /**
66
+ * Apply _JsonWireToType to a config descriptor, returning the typed config value.
67
+ *
68
+ * When `appCtx` is provided and contains a `clockTime`, empty datetime fields
69
+ * are backfilled from the clock time instead of returning `undefined`.
70
+ *
71
+ * @internal
72
+ */
73
+ export declare function _applyConfig<T, S extends _JsonWireToTypeStrategy>(descriptor: _ShapeDescriptor<S, T>, inputObject: unknown, appCtx?: _ConfigApplicationContext): T;
74
+ //# sourceMappingURL=transform-strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-strategies.d.ts","sourceRoot":"","sources":["../../src/stdlib/transform-strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,gBAAgB,EAKjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAGV,uBAAuB,EAEvB,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAmCpB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,wBAuF9B,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,wBAuF9B,CAAC;AAMF;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAAyB;IACxC,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB,CAYpF;AAMD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,uBAiE7B,CAAC;AAgJF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,wBAAwB,EAClE,UAAU,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAClC,WAAW,EAAE,OAAO,GACnB,CAAC,CAGH;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,wBAAwB,EAClE,UAAU,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAClC,WAAW,EAAE,CAAC,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,uBAAuB,EAC/D,UAAU,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAClC,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE,yBAAyB,GACjC,CAAC,CAKH"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Core transform loop and primitive field transformers.
3
+ *
4
+ * `apply` drives the per-field loop: for each `FieldDescriptor` in a
5
+ * `ShapeDescriptor`, it delegates to `strategy.applyField`, which owns key
6
+ * selection and error wrapping for the given direction.
7
+ *
8
+ * The primitive transformers (`identity`, `required`, `translateDecimal`,
9
+ * `translateDateTime`, `translateEnum`, `translateShape`, `translateUnion`,
10
+ * `translateArray`, `translateMap`) are the building blocks used by generated
11
+ * extension code to populate `FieldDescriptor.transform`.
12
+ *
13
+ * Types (`ShapeDescriptor`, `UnionDescriptor`, `ApplyStrategy`, etc.) are in
14
+ * types.ts. Concrete strategy objects (`ProtoWireToType`, `TypeToProtoWire`,
15
+ * `JsonWireToType`) are in transform-strategies.ts.
16
+ */
17
+ import type { _ApplyStrategy, _EnumSpec, _FieldTransformer, _ShapeDescriptor, _UnionDescriptor } from './types.js';
18
+ /**
19
+ * Apply a strategy to a field array, transforming each field.
20
+ * The strategy determines direction (proto→SDK, SDK→proto, or JSON→SDK).
21
+ *
22
+ * @internal
23
+ */
24
+ export declare function _apply<S extends _ApplyStrategy>(descriptor: _ShapeDescriptor<S>, strategy: S, inputObject: unknown, typeName?: string): Record<string, unknown>;
25
+ /**
26
+ * Pass a value through unchanged.
27
+ *
28
+ * @internal
29
+ */
30
+ export declare const _identity: _FieldTransformer;
31
+ /**
32
+ * Wraps a transformer so that a `null` / `undefined` result throws
33
+ * `WireParseError('Required field is missing')`, which `strategy.applyField`
34
+ * will catch and re-throw as WireReadError / WireWriteError with field context.
35
+ *
36
+ * The inner transformer runs first, so strategies that backfill absent values
37
+ * (e.g. clock-aware `translateDateTime`) can satisfy the requirement.
38
+ *
39
+ * @internal
40
+ */
41
+ export declare function _required(fn?: _FieldTransformer): _FieldTransformer;
42
+ /**
43
+ * Translate a field using the strategy's decimal conversion.
44
+ *
45
+ * @internal
46
+ */
47
+ export declare const _translateDecimal: _FieldTransformer;
48
+ /**
49
+ * Translate a field using the strategy's datetime conversion.
50
+ *
51
+ * @internal
52
+ */
53
+ export declare const _translateDateTime: _FieldTransformer;
54
+ /**
55
+ * Create a _FieldTransformer that translates an enum value using the given spec.
56
+ * For bidirectional proto enums, pass a `_ProtoEnum` instance.
57
+ * For config validation, pass a `_ConfigEnum` instance.
58
+ *
59
+ * @internal
60
+ */
61
+ export declare function _translateEnum(spec: _EnumSpec): _FieldTransformer;
62
+ /**
63
+ * Create a _FieldTransformer that applies a nested _ShapeDescriptor,
64
+ * threading the strategy through. Returns `undefined` for null/undefined input.
65
+ *
66
+ * Accepts a factory `() => _ShapeDescriptor` rather than a descriptor directly,
67
+ * so that the descriptor constant is resolved lazily at call time. This allows
68
+ * generated descriptors to reference each other without regard to declaration
69
+ * order (avoiding temporal dead zone errors with `const`).
70
+ *
71
+ * @internal
72
+ */
73
+ export declare function _translateShape(getDesc: () => _ShapeDescriptor): _FieldTransformer;
74
+ /**
75
+ * Create a _FieldTransformer that applies a _UnionDescriptor via the strategy.
76
+ * Returns `undefined` for null/undefined input.
77
+ *
78
+ * Accepts a factory `() => _UnionDescriptor` rather than a descriptor directly,
79
+ * for the same reason as `_translateShape` — lazy resolution avoids TDZ errors
80
+ * when generated descriptors reference each other.
81
+ *
82
+ * @internal
83
+ */
84
+ export declare function _translateUnion(getDesc: () => _UnionDescriptor): _FieldTransformer;
85
+ /**
86
+ * Apply an element transform to each item in an array.
87
+ *
88
+ * @internal
89
+ */
90
+ export declare function _translateArray(elementFn: _FieldTransformer): _FieldTransformer;
91
+ /**
92
+ * Apply key/value transforms to every entry in a Record.
93
+ *
94
+ * @internal
95
+ */
96
+ export declare function _translateMap(keyFn: _FieldTransformer, valueFn: _FieldTransformer): _FieldTransformer;
97
+ //# sourceMappingURL=transforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/stdlib/transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,cAAc,EAC7C,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC/B,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,OAAO,EACpB,QAAQ,SAAsB,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8CzB;AAMD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,iBAA+C,CAAC;AAExE;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,EAAE,GAAE,iBAA6B,GAAG,iBAAiB,CAQ9E;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBACE,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,iBACE,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAEjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,gBAAgB,GAAG,iBAAiB,CAKlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,gBAAgB,GAAG,iBAAiB,CAKlF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,iBAAiB,GAAG,iBAAiB,CAQ/E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,iBAAiB,GACzB,iBAAiB,CAqBnB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Extracts the string literal type of the `object` property from T.
3
+ *
4
+ * @public
5
+ */
6
+ export type ExtractObjectTag<T> = T extends {
7
+ readonly object: infer O;
8
+ } ? O extends string ? O : never : never;
9
+ //# sourceMappingURL=type-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../src/stdlib/type-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACpE,CAAC,SAAS,MAAM,GACd,CAAC,GACD,KAAK,GACP,KAAK,CAAC"}