@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.
Files changed (97) hide show
  1. package/README.md +17 -15
  2. package/dist/config-values/generate.cjs +1 -1
  3. package/dist/config-values/generate.d.ts +1 -1
  4. package/dist/config-values/generate.d.ts.map +1 -1
  5. package/dist/config-values/generate.js +1 -1
  6. package/dist/extensibility-sdk-alpha.d.ts +29 -157
  7. package/dist/extensibility-sdk-beta.d.ts +29 -157
  8. package/dist/extensibility-sdk-config-values-internal.d.ts +1 -1
  9. package/dist/extensibility-sdk-extensions-alpha.d.ts +7 -157
  10. package/dist/extensibility-sdk-extensions-beta.d.ts +7 -157
  11. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-alpha.d.ts +631 -0
  12. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-beta.d.ts +631 -0
  13. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-internal.d.ts +666 -0
  14. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-public.d.ts +631 -0
  15. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-alpha.d.ts +475 -0
  16. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-beta.d.ts +475 -0
  17. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-internal.d.ts +510 -0
  18. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-public.d.ts +475 -0
  19. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-alpha.d.ts +110 -0
  20. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-beta.d.ts +110 -0
  21. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-internal.d.ts +123 -0
  22. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-public.d.ts +110 -0
  23. package/dist/extensibility-sdk-extensions-billing-prorations-alpha.d.ts +607 -0
  24. package/dist/extensibility-sdk-extensions-billing-prorations-beta.d.ts +607 -0
  25. package/dist/extensibility-sdk-extensions-billing-prorations-internal.d.ts +642 -0
  26. package/dist/extensibility-sdk-extensions-billing-prorations-public.d.ts +607 -0
  27. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-alpha.d.ts +735 -0
  28. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-beta.d.ts +735 -0
  29. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-internal.d.ts +772 -0
  30. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-public.d.ts +735 -0
  31. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-alpha.d.ts +126 -0
  32. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-beta.d.ts +126 -0
  33. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-internal.d.ts +140 -0
  34. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-public.d.ts +126 -0
  35. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-alpha.d.ts +126 -0
  36. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-beta.d.ts +126 -0
  37. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-internal.d.ts +140 -0
  38. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-public.d.ts +126 -0
  39. package/dist/extensibility-sdk-extensions-internal.d.ts +7 -157
  40. package/dist/extensibility-sdk-extensions-public.d.ts +7 -157
  41. package/dist/extensibility-sdk-internal-internal.d.ts +2 -2
  42. package/dist/extensibility-sdk-internal.d.ts +145 -162
  43. package/dist/extensibility-sdk-public.d.ts +29 -157
  44. package/dist/extensibility-sdk-stdlib-alpha.d.ts +593 -0
  45. package/dist/extensibility-sdk-stdlib-beta.d.ts +593 -0
  46. package/dist/extensibility-sdk-stdlib-internal.d.ts +1096 -0
  47. package/dist/extensibility-sdk-stdlib-public.d.ts +593 -0
  48. package/dist/extensions/billing/bill/discount_calculation.cjs +437 -0
  49. package/dist/extensions/billing/bill/discount_calculation.d.ts +0 -20
  50. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -1
  51. package/dist/extensions/billing/bill/discount_calculation.js +430 -0
  52. package/dist/extensions/billing/customer_balance_application.cjs +297 -0
  53. package/dist/extensions/billing/customer_balance_application.d.ts +0 -20
  54. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -1
  55. package/dist/extensions/billing/customer_balance_application.js +284 -0
  56. package/dist/extensions/billing/invoice_collection_options.cjs +166 -0
  57. package/dist/extensions/billing/invoice_collection_options.d.ts +4 -24
  58. package/dist/extensions/billing/invoice_collection_options.d.ts.map +1 -1
  59. package/dist/extensions/billing/invoice_collection_options.js +155 -0
  60. package/dist/extensions/billing/prorations.cjs +501 -0
  61. package/dist/extensions/billing/prorations.d.ts +0 -20
  62. package/dist/extensions/billing/prorations.d.ts.map +1 -1
  63. package/dist/extensions/billing/prorations.js +492 -0
  64. package/dist/extensions/billing/recurring_billing_item_handling.cjs +639 -0
  65. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +0 -30
  66. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
  67. package/dist/extensions/billing/recurring_billing_item_handling.js +632 -0
  68. package/dist/extensions/core/workflows/custom_action.cjs +124 -0
  69. package/dist/extensions/core/workflows/custom_action.d.ts +1 -21
  70. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -1
  71. package/dist/extensions/core/workflows/custom_action.js +111 -0
  72. package/dist/extensions/extend/workflows/custom_action.cjs +124 -0
  73. package/dist/extensions/extend/workflows/custom_action.d.ts +1 -21
  74. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -1
  75. package/dist/extensions/extend/workflows/custom_action.js +111 -0
  76. package/dist/extensions/index.cjs +27 -265
  77. package/dist/extensions/index.js +27 -265
  78. package/dist/extensions/registry.d.ts +2 -2
  79. package/dist/extensions/registry.d.ts.map +1 -1
  80. package/dist/index.cjs +452 -2390
  81. package/dist/index.js +479 -2286
  82. package/dist/internal.cjs +22 -54
  83. package/dist/internal.js +22 -54
  84. package/dist/stdlib/generated.d.ts +1 -1
  85. package/dist/stdlib/generated.d.ts.map +1 -1
  86. package/dist/stdlib/index.cjs +2003 -0
  87. package/dist/stdlib/index.d.ts +2 -2
  88. package/dist/stdlib/index.d.ts.map +1 -1
  89. package/dist/stdlib/index.js +1943 -0
  90. package/dist/stdlib/transform-strategies.d.ts +46 -6
  91. package/dist/stdlib/transform-strategies.d.ts.map +1 -1
  92. package/dist/stdlib/types.d.ts +82 -0
  93. package/dist/stdlib/types.d.ts.map +1 -1
  94. package/dist/tsconfig.build.tsbuildinfo +1 -1
  95. package/package.json +65 -1
  96. package/dist/stdlib/extension-method.d.ts +0 -27
  97. package/dist/stdlib/extension-method.d.ts.map +0 -1
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/extensions/core/workflows/custom_action.ts
21
+ var custom_action_exports = {};
22
+ __export(custom_action_exports, {
23
+ CustomAction: () => CustomAction
24
+ });
25
+ module.exports = __toCommonJS(custom_action_exports);
26
+ var import_stdlib = require("@stripe/extensibility-sdk/stdlib");
27
+ var CustomAction;
28
+ ((CustomAction2) => {
29
+ const GetFormStateResponseDescriptor = new import_stdlib._ShapeDescriptor(
30
+ "GetFormStateResponse",
31
+ [
32
+ { type: "values", transform: (0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity) },
33
+ {
34
+ type: "config",
35
+ transform: (0, import_stdlib._required)(
36
+ (0, import_stdlib._translateMap)(
37
+ import_stdlib._identity,
38
+ (0, import_stdlib._translateShape)(() => FormStateFieldConfigDescriptor)
39
+ )
40
+ )
41
+ }
42
+ ]
43
+ );
44
+ const FormStateFieldConfigDescriptor = new import_stdlib._ShapeDescriptor(
45
+ "FormStateFieldConfig",
46
+ [
47
+ {
48
+ type: "options",
49
+ transform: (0, import_stdlib._required)(
50
+ (0, import_stdlib._translateArray)((0, import_stdlib._translateShape)(() => SelectOptionDescriptor))
51
+ )
52
+ },
53
+ { type: "schema", transform: (0, import_stdlib._required)((0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity)) },
54
+ { type: "disabled", transform: import_stdlib._identity },
55
+ { type: "hidden", transform: import_stdlib._identity },
56
+ { type: "warning", transform: import_stdlib._identity },
57
+ { type: "error", transform: import_stdlib._identity }
58
+ ]
59
+ );
60
+ const SelectOptionDescriptor = new import_stdlib._ShapeDescriptor(
61
+ "SelectOption",
62
+ [
63
+ { type: "value", transform: (0, import_stdlib._required)() },
64
+ { type: "label", transform: (0, import_stdlib._required)() }
65
+ ]
66
+ );
67
+ const GetFormStateRequestDescriptor = new import_stdlib._ShapeDescriptor(
68
+ "GetFormStateRequest",
69
+ [
70
+ { type: "values", transform: (0, import_stdlib._required)((0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity)) },
71
+ { type: "changedField", transform: import_stdlib._identity }
72
+ ]
73
+ );
74
+ const ExecuteCustomActionResponseDescriptor = new import_stdlib._ShapeDescriptor("ExecuteCustomActionResponse", []);
75
+ const ExecuteCustomActionRequestDescriptor = new import_stdlib._ShapeDescriptor("ExecuteCustomActionRequest", [
76
+ { type: "customInput", transform: (0, import_stdlib._required)((0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity)) }
77
+ ]);
78
+ function $platformWrapExecute(configTransformer) {
79
+ return (cls, wireArgs, wireConfig, ctx) => {
80
+ const instance = new cls();
81
+ const request = (0, import_stdlib._apply)(
82
+ ExecuteCustomActionRequestDescriptor,
83
+ import_stdlib._ProtoWireToType,
84
+ wireArgs
85
+ );
86
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, (0, import_stdlib._configAppContextFromContext)(ctx)) : wireConfig;
87
+ const result = instance.execute(request, config, ctx);
88
+ if ((0, import_stdlib._isPromiseLike)(result)) {
89
+ return Promise.resolve(result).then((r) => {
90
+ const typedR = r;
91
+ return (0, import_stdlib._apply)(ExecuteCustomActionResponseDescriptor, import_stdlib._TypeToProtoWire, typedR);
92
+ });
93
+ }
94
+ const typedResult = result;
95
+ return (0, import_stdlib._apply)(ExecuteCustomActionResponseDescriptor, import_stdlib._TypeToProtoWire, typedResult);
96
+ };
97
+ }
98
+ CustomAction2.$platformWrapExecute = $platformWrapExecute;
99
+ function $platformWrapGetFormState(configTransformer) {
100
+ return (cls, wireArgs, wireConfig, ctx) => {
101
+ const instance = new cls();
102
+ const request = (0, import_stdlib._apply)(
103
+ GetFormStateRequestDescriptor,
104
+ import_stdlib._ProtoWireToType,
105
+ wireArgs
106
+ );
107
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, (0, import_stdlib._configAppContextFromContext)(ctx)) : wireConfig;
108
+ const result = instance.getFormState(request, config, ctx);
109
+ if ((0, import_stdlib._isPromiseLike)(result)) {
110
+ return Promise.resolve(result).then((r) => {
111
+ const typedR = r;
112
+ return (0, import_stdlib._apply)(GetFormStateResponseDescriptor, import_stdlib._TypeToProtoWire, typedR);
113
+ });
114
+ }
115
+ const typedResult = result;
116
+ return (0, import_stdlib._apply)(GetFormStateResponseDescriptor, import_stdlib._TypeToProtoWire, typedResult);
117
+ };
118
+ }
119
+ CustomAction2.$platformWrapGetFormState = $platformWrapGetFormState;
120
+ })(CustomAction || (CustomAction = {}));
121
+ // Annotate the CommonJS export names for ESM import in node:
122
+ 0 && (module.exports = {
123
+ CustomAction
124
+ });
@@ -8,7 +8,7 @@ export declare namespace CustomAction {
8
8
  */
9
9
  interface GetFormStateResponse {
10
10
  /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
11
- values: Record<string, unknown>;
11
+ values?: Record<string, unknown>;
12
12
  /** Per-field configuration keyed by field name. */
13
13
  config: Record<string, FormStateFieldConfig>;
14
14
  }
@@ -58,30 +58,10 @@ export declare namespace CustomAction {
58
58
  /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
59
59
  customInput: Record<string, unknown>;
60
60
  }
61
- /**
62
- * @public
63
- * @deprecated Platform dispatch handles wire/SDK conversion.
64
- */
65
- function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
66
- /**
67
- * @public
68
- * @deprecated Platform dispatch handles wire/SDK conversion.
69
- */
70
- function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
71
61
  /** @internal */
72
62
  function $platformWrapExecute(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
73
63
  execute(...a: unknown[]): unknown;
74
64
  }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
75
- /**
76
- * @public
77
- * @deprecated Platform dispatch handles wire/SDK conversion.
78
- */
79
- function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
80
- /**
81
- * @public
82
- * @deprecated Platform dispatch handles wire/SDK conversion.
83
- */
84
- function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
85
65
  /** @internal */
86
66
  function $platformWrapGetFormState(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
87
67
  getFormState(...a: unknown[]): unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"custom_action.d.ts","sourceRoot":"","sources":["../../../../src/extensions/core/workflows/custom_action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE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,CAAC;CAC/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM;IAClC,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;CAC1D"}
1
+ {"version":3,"file":"custom_action.d.ts","sourceRoot":"","sources":["../../../../src/extensions/core/workflows/custom_action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAEV,yBAAyB,EAI1B,MAAM,0BAA0B,CAAC;AAsBlC,cAAc;AACd,yBAAiB,YAAY,CAAC;IAC5B;;;OAGG;IACH,UAAiB,oBAAoB;QACnC,6OAA6O;QAC7O,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,mDAAmD;QACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;KAC9C;IAED;;;OAGG;IACH,UAAiB,oBAAoB;QACnC,oDAAoD;QACpD,OAAO,EAAE,YAAY,EAAE,CAAC;QACxB,wMAAwM;QACxM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,uDAAuD;QACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,iDAAiD;QACjD,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,+EAA+E;QAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,wEAAwE;QACxE,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAED;;;OAGG;IACH,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf;IAED;;;OAGG;IACH,UAAiB,mBAAmB;QAClC,qJAAqJ;QACrJ,MAAM,EAAE,MAAM,C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AoB,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM;IAClC,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;CAC1D"}
@@ -0,0 +1,111 @@
1
+ // src/extensions/core/workflows/custom_action.ts
2
+ import {
3
+ _ProtoWireToType,
4
+ _ShapeDescriptor,
5
+ _TypeToProtoWire,
6
+ _apply,
7
+ _configAppContextFromContext,
8
+ _identity,
9
+ _isPromiseLike,
10
+ _required,
11
+ _translateArray,
12
+ _translateMap,
13
+ _translateShape
14
+ } from "@stripe/extensibility-sdk/stdlib";
15
+ var CustomAction;
16
+ ((CustomAction2) => {
17
+ const GetFormStateResponseDescriptor = new _ShapeDescriptor(
18
+ "GetFormStateResponse",
19
+ [
20
+ { type: "values", transform: _translateMap(_identity, _identity) },
21
+ {
22
+ type: "config",
23
+ transform: _required(
24
+ _translateMap(
25
+ _identity,
26
+ _translateShape(() => FormStateFieldConfigDescriptor)
27
+ )
28
+ )
29
+ }
30
+ ]
31
+ );
32
+ const FormStateFieldConfigDescriptor = new _ShapeDescriptor(
33
+ "FormStateFieldConfig",
34
+ [
35
+ {
36
+ type: "options",
37
+ transform: _required(
38
+ _translateArray(_translateShape(() => SelectOptionDescriptor))
39
+ )
40
+ },
41
+ { type: "schema", transform: _required(_translateMap(_identity, _identity)) },
42
+ { type: "disabled", transform: _identity },
43
+ { type: "hidden", transform: _identity },
44
+ { type: "warning", transform: _identity },
45
+ { type: "error", transform: _identity }
46
+ ]
47
+ );
48
+ const SelectOptionDescriptor = new _ShapeDescriptor(
49
+ "SelectOption",
50
+ [
51
+ { type: "value", transform: _required() },
52
+ { type: "label", transform: _required() }
53
+ ]
54
+ );
55
+ const GetFormStateRequestDescriptor = new _ShapeDescriptor(
56
+ "GetFormStateRequest",
57
+ [
58
+ { type: "values", transform: _required(_translateMap(_identity, _identity)) },
59
+ { type: "changedField", transform: _identity }
60
+ ]
61
+ );
62
+ const ExecuteCustomActionResponseDescriptor = new _ShapeDescriptor("ExecuteCustomActionResponse", []);
63
+ const ExecuteCustomActionRequestDescriptor = new _ShapeDescriptor("ExecuteCustomActionRequest", [
64
+ { type: "customInput", transform: _required(_translateMap(_identity, _identity)) }
65
+ ]);
66
+ function $platformWrapExecute(configTransformer) {
67
+ return (cls, wireArgs, wireConfig, ctx) => {
68
+ const instance = new cls();
69
+ const request = _apply(
70
+ ExecuteCustomActionRequestDescriptor,
71
+ _ProtoWireToType,
72
+ wireArgs
73
+ );
74
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
75
+ const result = instance.execute(request, config, ctx);
76
+ if (_isPromiseLike(result)) {
77
+ return Promise.resolve(result).then((r) => {
78
+ const typedR = r;
79
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedR);
80
+ });
81
+ }
82
+ const typedResult = result;
83
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedResult);
84
+ };
85
+ }
86
+ CustomAction2.$platformWrapExecute = $platformWrapExecute;
87
+ function $platformWrapGetFormState(configTransformer) {
88
+ return (cls, wireArgs, wireConfig, ctx) => {
89
+ const instance = new cls();
90
+ const request = _apply(
91
+ GetFormStateRequestDescriptor,
92
+ _ProtoWireToType,
93
+ wireArgs
94
+ );
95
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
96
+ const result = instance.getFormState(request, config, ctx);
97
+ if (_isPromiseLike(result)) {
98
+ return Promise.resolve(result).then((r) => {
99
+ const typedR = r;
100
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedR);
101
+ });
102
+ }
103
+ const typedResult = result;
104
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedResult);
105
+ };
106
+ }
107
+ CustomAction2.$platformWrapGetFormState = $platformWrapGetFormState;
108
+ })(CustomAction || (CustomAction = {}));
109
+ export {
110
+ CustomAction
111
+ };
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/extensions/extend/workflows/custom_action.ts
21
+ var custom_action_exports = {};
22
+ __export(custom_action_exports, {
23
+ CustomAction: () => CustomAction
24
+ });
25
+ module.exports = __toCommonJS(custom_action_exports);
26
+ var import_stdlib = require("@stripe/extensibility-sdk/stdlib");
27
+ var CustomAction;
28
+ ((CustomAction2) => {
29
+ const GetFormStateResponseDescriptor = new import_stdlib._ShapeDescriptor(
30
+ "GetFormStateResponse",
31
+ [
32
+ { type: "values", transform: (0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity) },
33
+ {
34
+ type: "config",
35
+ transform: (0, import_stdlib._required)(
36
+ (0, import_stdlib._translateMap)(
37
+ import_stdlib._identity,
38
+ (0, import_stdlib._translateShape)(() => FormStateFieldConfigDescriptor)
39
+ )
40
+ )
41
+ }
42
+ ]
43
+ );
44
+ const FormStateFieldConfigDescriptor = new import_stdlib._ShapeDescriptor(
45
+ "FormStateFieldConfig",
46
+ [
47
+ {
48
+ type: "options",
49
+ transform: (0, import_stdlib._required)(
50
+ (0, import_stdlib._translateArray)((0, import_stdlib._translateShape)(() => SelectOptionDescriptor))
51
+ )
52
+ },
53
+ { type: "schema", transform: (0, import_stdlib._required)((0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity)) },
54
+ { type: "disabled", transform: import_stdlib._identity },
55
+ { type: "hidden", transform: import_stdlib._identity },
56
+ { type: "warning", transform: import_stdlib._identity },
57
+ { type: "error", transform: import_stdlib._identity }
58
+ ]
59
+ );
60
+ const SelectOptionDescriptor = new import_stdlib._ShapeDescriptor(
61
+ "SelectOption",
62
+ [
63
+ { type: "value", transform: (0, import_stdlib._required)() },
64
+ { type: "label", transform: (0, import_stdlib._required)() }
65
+ ]
66
+ );
67
+ const GetFormStateRequestDescriptor = new import_stdlib._ShapeDescriptor(
68
+ "GetFormStateRequest",
69
+ [
70
+ { type: "values", transform: (0, import_stdlib._required)((0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity)) },
71
+ { type: "changedField", transform: import_stdlib._identity }
72
+ ]
73
+ );
74
+ const ExecuteCustomActionResponseDescriptor = new import_stdlib._ShapeDescriptor("ExecuteCustomActionResponse", []);
75
+ const ExecuteCustomActionRequestDescriptor = new import_stdlib._ShapeDescriptor("ExecuteCustomActionRequest", [
76
+ { type: "customInput", transform: (0, import_stdlib._required)((0, import_stdlib._translateMap)(import_stdlib._identity, import_stdlib._identity)) }
77
+ ]);
78
+ function $platformWrapExecute(configTransformer) {
79
+ return (cls, wireArgs, wireConfig, ctx) => {
80
+ const instance = new cls();
81
+ const request = (0, import_stdlib._apply)(
82
+ ExecuteCustomActionRequestDescriptor,
83
+ import_stdlib._ProtoWireToType,
84
+ wireArgs
85
+ );
86
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, (0, import_stdlib._configAppContextFromContext)(ctx)) : wireConfig;
87
+ const result = instance.execute(request, config, ctx);
88
+ if ((0, import_stdlib._isPromiseLike)(result)) {
89
+ return Promise.resolve(result).then((r) => {
90
+ const typedR = r;
91
+ return (0, import_stdlib._apply)(ExecuteCustomActionResponseDescriptor, import_stdlib._TypeToProtoWire, typedR);
92
+ });
93
+ }
94
+ const typedResult = result;
95
+ return (0, import_stdlib._apply)(ExecuteCustomActionResponseDescriptor, import_stdlib._TypeToProtoWire, typedResult);
96
+ };
97
+ }
98
+ CustomAction2.$platformWrapExecute = $platformWrapExecute;
99
+ function $platformWrapGetFormState(configTransformer) {
100
+ return (cls, wireArgs, wireConfig, ctx) => {
101
+ const instance = new cls();
102
+ const request = (0, import_stdlib._apply)(
103
+ GetFormStateRequestDescriptor,
104
+ import_stdlib._ProtoWireToType,
105
+ wireArgs
106
+ );
107
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, (0, import_stdlib._configAppContextFromContext)(ctx)) : wireConfig;
108
+ const result = instance.getFormState(request, config, ctx);
109
+ if ((0, import_stdlib._isPromiseLike)(result)) {
110
+ return Promise.resolve(result).then((r) => {
111
+ const typedR = r;
112
+ return (0, import_stdlib._apply)(GetFormStateResponseDescriptor, import_stdlib._TypeToProtoWire, typedR);
113
+ });
114
+ }
115
+ const typedResult = result;
116
+ return (0, import_stdlib._apply)(GetFormStateResponseDescriptor, import_stdlib._TypeToProtoWire, typedResult);
117
+ };
118
+ }
119
+ CustomAction2.$platformWrapGetFormState = $platformWrapGetFormState;
120
+ })(CustomAction || (CustomAction = {}));
121
+ // Annotate the CommonJS export names for ESM import in node:
122
+ 0 && (module.exports = {
123
+ CustomAction
124
+ });
@@ -8,7 +8,7 @@ export declare namespace CustomAction {
8
8
  */
9
9
  interface GetFormStateResponse {
10
10
  /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
11
- values: Record<string, unknown>;
11
+ values?: Record<string, unknown>;
12
12
  /** Per-field configuration keyed by field name. */
13
13
  config: Record<string, FormStateFieldConfig>;
14
14
  }
@@ -58,30 +58,10 @@ export declare namespace CustomAction {
58
58
  /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
59
59
  customInput: Record<string, unknown>;
60
60
  }
61
- /**
62
- * @public
63
- * @deprecated Platform dispatch handles wire/SDK conversion.
64
- */
65
- function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
66
- /**
67
- * @public
68
- * @deprecated Platform dispatch handles wire/SDK conversion.
69
- */
70
- function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
71
61
  /** @internal */
72
62
  function $platformWrapExecute(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
73
63
  execute(...a: unknown[]): unknown;
74
64
  }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
75
- /**
76
- * @public
77
- * @deprecated Platform dispatch handles wire/SDK conversion.
78
- */
79
- function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
80
- /**
81
- * @public
82
- * @deprecated Platform dispatch handles wire/SDK conversion.
83
- */
84
- function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
85
65
  /** @internal */
86
66
  function $platformWrapGetFormState(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
87
67
  getFormState(...a: unknown[]): unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"custom_action.d.ts","sourceRoot":"","sources":["../../../../src/extensions/extend/workflows/custom_action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAEV,yBAAyB,EAI1B,MAAM,0BAA0B,CAAC;AAwBlC,cAAc;AACd,yBAAiB,YAAY,CAAC;IAC5B;;;OAGG;IACH,UAAiB,oBAAoB;QACnC,6OAA6O;QAC7O,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,mDAAmD;QACnD,MAAM,EAAE,MAAM,CAA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 +1,111 @@
1
+ // src/extensions/extend/workflows/custom_action.ts
2
+ import {
3
+ _ProtoWireToType,
4
+ _ShapeDescriptor,
5
+ _TypeToProtoWire,
6
+ _apply,
7
+ _configAppContextFromContext,
8
+ _identity,
9
+ _isPromiseLike,
10
+ _required,
11
+ _translateArray,
12
+ _translateMap,
13
+ _translateShape
14
+ } from "@stripe/extensibility-sdk/stdlib";
15
+ var CustomAction;
16
+ ((CustomAction2) => {
17
+ const GetFormStateResponseDescriptor = new _ShapeDescriptor(
18
+ "GetFormStateResponse",
19
+ [
20
+ { type: "values", transform: _translateMap(_identity, _identity) },
21
+ {
22
+ type: "config",
23
+ transform: _required(
24
+ _translateMap(
25
+ _identity,
26
+ _translateShape(() => FormStateFieldConfigDescriptor)
27
+ )
28
+ )
29
+ }
30
+ ]
31
+ );
32
+ const FormStateFieldConfigDescriptor = new _ShapeDescriptor(
33
+ "FormStateFieldConfig",
34
+ [
35
+ {
36
+ type: "options",
37
+ transform: _required(
38
+ _translateArray(_translateShape(() => SelectOptionDescriptor))
39
+ )
40
+ },
41
+ { type: "schema", transform: _required(_translateMap(_identity, _identity)) },
42
+ { type: "disabled", transform: _identity },
43
+ { type: "hidden", transform: _identity },
44
+ { type: "warning", transform: _identity },
45
+ { type: "error", transform: _identity }
46
+ ]
47
+ );
48
+ const SelectOptionDescriptor = new _ShapeDescriptor(
49
+ "SelectOption",
50
+ [
51
+ { type: "value", transform: _required() },
52
+ { type: "label", transform: _required() }
53
+ ]
54
+ );
55
+ const GetFormStateRequestDescriptor = new _ShapeDescriptor(
56
+ "GetFormStateRequest",
57
+ [
58
+ { type: "values", transform: _required(_translateMap(_identity, _identity)) },
59
+ { type: "changedField", transform: _identity }
60
+ ]
61
+ );
62
+ const ExecuteCustomActionResponseDescriptor = new _ShapeDescriptor("ExecuteCustomActionResponse", []);
63
+ const ExecuteCustomActionRequestDescriptor = new _ShapeDescriptor("ExecuteCustomActionRequest", [
64
+ { type: "customInput", transform: _required(_translateMap(_identity, _identity)) }
65
+ ]);
66
+ function $platformWrapExecute(configTransformer) {
67
+ return (cls, wireArgs, wireConfig, ctx) => {
68
+ const instance = new cls();
69
+ const request = _apply(
70
+ ExecuteCustomActionRequestDescriptor,
71
+ _ProtoWireToType,
72
+ wireArgs
73
+ );
74
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
75
+ const result = instance.execute(request, config, ctx);
76
+ if (_isPromiseLike(result)) {
77
+ return Promise.resolve(result).then((r) => {
78
+ const typedR = r;
79
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedR);
80
+ });
81
+ }
82
+ const typedResult = result;
83
+ return _apply(ExecuteCustomActionResponseDescriptor, _TypeToProtoWire, typedResult);
84
+ };
85
+ }
86
+ CustomAction2.$platformWrapExecute = $platformWrapExecute;
87
+ function $platformWrapGetFormState(configTransformer) {
88
+ return (cls, wireArgs, wireConfig, ctx) => {
89
+ const instance = new cls();
90
+ const request = _apply(
91
+ GetFormStateRequestDescriptor,
92
+ _ProtoWireToType,
93
+ wireArgs
94
+ );
95
+ const config = configTransformer !== void 0 ? configTransformer(wireConfig, _configAppContextFromContext(ctx)) : wireConfig;
96
+ const result = instance.getFormState(request, config, ctx);
97
+ if (_isPromiseLike(result)) {
98
+ return Promise.resolve(result).then((r) => {
99
+ const typedR = r;
100
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedR);
101
+ });
102
+ }
103
+ const typedResult = result;
104
+ return _apply(GetFormStateResponseDescriptor, _TypeToProtoWire, typedResult);
105
+ };
106
+ }
107
+ CustomAction2.$platformWrapGetFormState = $platformWrapGetFormState;
108
+ })(CustomAction || (CustomAction = {}));
109
+ export {
110
+ CustomAction
111
+ };