@stripe/extensibility-script-build-tools 1.5.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 (63) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +180 -0
  3. package/dist/config-introspect.d.ts +17 -0
  4. package/dist/config-introspect.d.ts.map +1 -0
  5. package/dist/dispatch.d.ts +24 -0
  6. package/dist/dispatch.d.ts.map +1 -0
  7. package/dist/errors.d.ts +26 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/extensibility-script-build-tools-alpha.d.ts +19 -0
  10. package/dist/extensibility-script-build-tools-beta.d.ts +19 -0
  11. package/dist/extensibility-script-build-tools-internal.d.ts +93 -0
  12. package/dist/extensibility-script-build-tools-public.d.ts +19 -0
  13. package/dist/index.cjs +237827 -0
  14. package/dist/index.d.cts +89 -0
  15. package/dist/index.d.ts +89 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +237820 -0
  18. package/dist/plugin.d.ts +41 -0
  19. package/dist/plugin.d.ts.map +1 -0
  20. package/dist/runtime-introspect.d.ts +24 -0
  21. package/dist/runtime-introspect.d.ts.map +1 -0
  22. package/dist/sdk-types/extensions/billing/bill/discount_calculation.d.ts +226 -0
  23. package/dist/sdk-types/extensions/billing/bill/discount_calculation.d.ts.map +1 -0
  24. package/dist/sdk-types/extensions/billing/bill/index.d.ts +2 -0
  25. package/dist/sdk-types/extensions/billing/bill/index.d.ts.map +1 -0
  26. package/dist/sdk-types/extensions/billing/customer_balance_application.d.ts +82 -0
  27. package/dist/sdk-types/extensions/billing/customer_balance_application.d.ts.map +1 -0
  28. package/dist/sdk-types/extensions/billing/index.d.ts +8 -0
  29. package/dist/sdk-types/extensions/billing/index.d.ts.map +1 -0
  30. package/dist/sdk-types/extensions/billing/invoice_collection_setting.d.ts +117 -0
  31. package/dist/sdk-types/extensions/billing/invoice_collection_setting.d.ts.map +1 -0
  32. package/dist/sdk-types/extensions/billing/prorations.d.ts +222 -0
  33. package/dist/sdk-types/extensions/billing/prorations.d.ts.map +1 -0
  34. package/dist/sdk-types/extensions/billing/recurring_billing_item_handling.d.ts +326 -0
  35. package/dist/sdk-types/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -0
  36. package/dist/sdk-types/extensions/billing/types.d.ts +33 -0
  37. package/dist/sdk-types/extensions/billing/types.d.ts.map +1 -0
  38. package/dist/sdk-types/extensions/context.d.ts +9 -0
  39. package/dist/sdk-types/extensions/context.d.ts.map +1 -0
  40. package/dist/sdk-types/extensions/core/index.d.ts +3 -0
  41. package/dist/sdk-types/extensions/core/index.d.ts.map +1 -0
  42. package/dist/sdk-types/extensions/core/workflows/custom_action.d.ts +142 -0
  43. package/dist/sdk-types/extensions/core/workflows/custom_action.d.ts.map +1 -0
  44. package/dist/sdk-types/extensions/core/workflows/index.d.ts +2 -0
  45. package/dist/sdk-types/extensions/core/workflows/index.d.ts.map +1 -0
  46. package/dist/sdk-types/extensions/extend/index.d.ts +3 -0
  47. package/dist/sdk-types/extensions/extend/index.d.ts.map +1 -0
  48. package/dist/sdk-types/extensions/extend/workflows/custom_action.d.ts +142 -0
  49. package/dist/sdk-types/extensions/extend/workflows/custom_action.d.ts.map +1 -0
  50. package/dist/sdk-types/extensions/extend/workflows/index.d.ts +2 -0
  51. package/dist/sdk-types/extensions/extend/workflows/index.d.ts.map +1 -0
  52. package/dist/sdk-types/extensions/index.d.ts +9 -0
  53. package/dist/sdk-types/extensions/index.d.ts.map +1 -0
  54. package/dist/sdk-types/extensions/registry.d.ts +19 -0
  55. package/dist/sdk-types/extensions/registry.d.ts.map +1 -0
  56. package/dist/sdk-types/extensions/types.d.ts +10 -0
  57. package/dist/sdk-types/extensions/types.d.ts.map +1 -0
  58. package/dist/transform.d.ts +49 -0
  59. package/dist/transform.d.ts.map +1 -0
  60. package/dist/tsconfig.build.tsbuildinfo +1 -0
  61. package/dist/types.d.ts +40 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/package.json +57 -0
@@ -0,0 +1,89 @@
1
+ import * as esbuild from 'esbuild';
2
+
3
+ /**
4
+ * Thrown when the user's extension source contains a problem that prevents
5
+ * the platform dispatch plugin from processing it. The message is directly
6
+ * actionable by the extension author.
7
+ * @internal
8
+ */
9
+ declare class _BuildUserError extends Error {
10
+ /** Error class name, overridden for stack trace readability. */
11
+ name: string;
12
+ }
13
+ /**
14
+ * Wraps an unexpected error caught by the platform dispatch plugin. Indicates
15
+ * a bug in the plugin or an unanticipated environment condition, not a problem
16
+ * with the extension author's code.
17
+ * @internal
18
+ */
19
+ declare class _BuildSystemError extends Error {
20
+ /** The original error that triggered this system error. */
21
+ readonly cause: unknown;
22
+ /** Error class name, overridden for stack trace readability. */
23
+ name: string;
24
+ constructor(message: string,
25
+ /** The original error that triggered this system error. */
26
+ cause: unknown);
27
+ }
28
+
29
+ declare const _brand: unique symbol;
30
+ /**
31
+ * Pre-computed analysis result from `_analyzeForDispatch`. Treat as opaque —
32
+ * pass directly to `_createPlatformDispatchPlugin` without inspecting or
33
+ * constructing.
34
+ * @internal
35
+ */
36
+ interface _DispatchAnalysis {
37
+ /** Nominal brand that prevents construction outside this module. */
38
+ readonly [_brand]: never;
39
+ }
40
+ /**
41
+ * Analyzes the extension entry point to determine if a full platform dispatch
42
+ * shim can be built. Returns opaque analysis data when all conditions are met:
43
+ *
44
+ * - The entry point has a named default export
45
+ * - The export implements a recognised extension interface
46
+ * - The installed SDK version provides `$platformWrap*` factories
47
+ *
48
+ * Returns `null` if any condition is not met (old SDK, unrecognised interface,
49
+ * no named default export, or non-extension script). The caller should treat
50
+ * `null` as "build without the plugin".
51
+ *
52
+ * Throws `_BuildUserError` if a reserved identifier collision is detected in
53
+ * the source (only checked when a shim would otherwise be installed).
54
+ * @internal
55
+ */
56
+ declare function _analyzeForDispatch(entryPoint: string): _DispatchAnalysis | null;
57
+ /**
58
+ * Creates an esbuild plugin that appends a proxy dispatch table export
59
+ * (`__stripe_platform_dispatch__`) to the extension entry point.
60
+ *
61
+ * Requires pre-computed analysis from `_analyzeForDispatch`. The plugin uses
62
+ * the cached source and descriptor data directly, avoiding redundant file
63
+ * reads and SDK introspection during the build.
64
+ * @internal
65
+ */
66
+ declare function _createPlatformDispatchPlugin(analysis: _DispatchAnalysis): esbuild.Plugin;
67
+
68
+ /**
69
+ * Creates a platform dispatch invoker from a bundled extension module.
70
+ *
71
+ * Reads `mod['__stripe_platform_dispatch__'].dispatch` and returns a callable
72
+ * that forwards to it.
73
+ *
74
+ * Returns `null` only if the dispatch table export is entirely absent —
75
+ * meaning the module was not built with the platform dispatch plugin at all.
76
+ * When the plugin was used, the table is always present (even for entry points
77
+ * with no recognised extension interface), so callers can use `null` as an
78
+ * unambiguous "plugin not run" signal.
79
+ * @internal
80
+ */
81
+ declare function _createPlatformDispatch(mod: Record<string, unknown>): ((exportName: string, methodName: string, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown) | null;
82
+
83
+ /**
84
+ * Name of the dispatch table export injected by the platform dispatch plugin.
85
+ * @internal
86
+ */
87
+ declare const _DISPATCH_TABLE_EXPORT = "__stripe_platform_dispatch__";
88
+
89
+ export { _BuildSystemError, _BuildUserError, _DISPATCH_TABLE_EXPORT, type _DispatchAnalysis, _analyzeForDispatch, _createPlatformDispatch, _createPlatformDispatchPlugin };
@@ -0,0 +1,89 @@
1
+ import * as esbuild from 'esbuild';
2
+
3
+ /**
4
+ * Thrown when the user's extension source contains a problem that prevents
5
+ * the platform dispatch plugin from processing it. The message is directly
6
+ * actionable by the extension author.
7
+ * @internal
8
+ */
9
+ declare class _BuildUserError extends Error {
10
+ /** Error class name, overridden for stack trace readability. */
11
+ name: string;
12
+ }
13
+ /**
14
+ * Wraps an unexpected error caught by the platform dispatch plugin. Indicates
15
+ * a bug in the plugin or an unanticipated environment condition, not a problem
16
+ * with the extension author's code.
17
+ * @internal
18
+ */
19
+ declare class _BuildSystemError extends Error {
20
+ /** The original error that triggered this system error. */
21
+ readonly cause: unknown;
22
+ /** Error class name, overridden for stack trace readability. */
23
+ name: string;
24
+ constructor(message: string,
25
+ /** The original error that triggered this system error. */
26
+ cause: unknown);
27
+ }
28
+
29
+ declare const _brand: unique symbol;
30
+ /**
31
+ * Pre-computed analysis result from `_analyzeForDispatch`. Treat as opaque —
32
+ * pass directly to `_createPlatformDispatchPlugin` without inspecting or
33
+ * constructing.
34
+ * @internal
35
+ */
36
+ interface _DispatchAnalysis {
37
+ /** Nominal brand that prevents construction outside this module. */
38
+ readonly [_brand]: never;
39
+ }
40
+ /**
41
+ * Analyzes the extension entry point to determine if a full platform dispatch
42
+ * shim can be built. Returns opaque analysis data when all conditions are met:
43
+ *
44
+ * - The entry point has a named default export
45
+ * - The export implements a recognised extension interface
46
+ * - The installed SDK version provides `$platformWrap*` factories
47
+ *
48
+ * Returns `null` if any condition is not met (old SDK, unrecognised interface,
49
+ * no named default export, or non-extension script). The caller should treat
50
+ * `null` as "build without the plugin".
51
+ *
52
+ * Throws `_BuildUserError` if a reserved identifier collision is detected in
53
+ * the source (only checked when a shim would otherwise be installed).
54
+ * @internal
55
+ */
56
+ declare function _analyzeForDispatch(entryPoint: string): _DispatchAnalysis | null;
57
+ /**
58
+ * Creates an esbuild plugin that appends a proxy dispatch table export
59
+ * (`__stripe_platform_dispatch__`) to the extension entry point.
60
+ *
61
+ * Requires pre-computed analysis from `_analyzeForDispatch`. The plugin uses
62
+ * the cached source and descriptor data directly, avoiding redundant file
63
+ * reads and SDK introspection during the build.
64
+ * @internal
65
+ */
66
+ declare function _createPlatformDispatchPlugin(analysis: _DispatchAnalysis): esbuild.Plugin;
67
+
68
+ /**
69
+ * Creates a platform dispatch invoker from a bundled extension module.
70
+ *
71
+ * Reads `mod['__stripe_platform_dispatch__'].dispatch` and returns a callable
72
+ * that forwards to it.
73
+ *
74
+ * Returns `null` only if the dispatch table export is entirely absent —
75
+ * meaning the module was not built with the platform dispatch plugin at all.
76
+ * When the plugin was used, the table is always present (even for entry points
77
+ * with no recognised extension interface), so callers can use `null` as an
78
+ * unambiguous "plugin not run" signal.
79
+ * @internal
80
+ */
81
+ declare function _createPlatformDispatch(mod: Record<string, unknown>): ((exportName: string, methodName: string, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown) | null;
82
+
83
+ /**
84
+ * Name of the dispatch table export injected by the platform dispatch plugin.
85
+ * @internal
86
+ */
87
+ declare const _DISPATCH_TABLE_EXPORT = "__stripe_platform_dispatch__";
88
+
89
+ export { _BuildSystemError, _BuildUserError, _DISPATCH_TABLE_EXPORT, type _DispatchAnalysis, _analyzeForDispatch, _createPlatformDispatch, _createPlatformDispatchPlugin };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}