@stripe/extensibility-dev-tools 0.23.5 → 0.24.2

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 (62) hide show
  1. package/README.md +28 -0
  2. package/dist/bin/build-custom-object-definitions.cjs +42 -36
  3. package/dist/bin/build-custom-object-definitions.js +42 -36
  4. package/dist/bin/create-upload-image.cjs +42 -36
  5. package/dist/bin/create-upload-image.js +42 -36
  6. package/dist/bin/dev-tools-rpc.cjs +42 -31
  7. package/dist/bin/dev-tools-rpc.js +42 -31
  8. package/dist/bin/gen-workspace.cjs +42 -31
  9. package/dist/bin/gen-workspace.js +42 -31
  10. package/dist/bin/template-info.cjs +28 -30
  11. package/dist/bin/template-info.js +28 -30
  12. package/dist/custom-objects/to-proto-json.d.ts +2 -1
  13. package/dist/custom-objects/to-proto-json.d.ts.map +1 -1
  14. package/dist/index.cjs +42 -31
  15. package/dist/index.js +42 -31
  16. package/dist/templates/extensions/base.d.ts +1 -1
  17. package/dist/templates/extensions/base.d.ts.map +1 -1
  18. package/dist/templates/extensions/core.workflows.custom_action.d.ts.map +1 -1
  19. package/dist/templates/index.cjs +42 -31
  20. package/dist/templates/index.js +42 -31
  21. package/dist/templates/root/index.d.ts.map +1 -1
  22. package/dist/tsconfig.build.tsbuildinfo +1 -1
  23. package/dist/workspace/index.cjs +42 -31
  24. package/dist/workspace/index.js +42 -31
  25. package/package.json +4 -4
  26. package/templates/extensions/billing.bill.discount_calculation/index.ts +2 -3
  27. package/templates/extensions/billing.customer_balance_application/index.test.ts +5 -5
  28. package/templates/extensions/billing.customer_balance_application/index.ts +4 -4
  29. package/templates/extensions/billing.invoice_collection_setting/index.ts +2 -2
  30. package/templates/extensions/billing.prorations/index.ts +2 -2
  31. package/templates/extensions/billing.recurring_billing_item_handling/index.ts +2 -2
  32. package/templates/extensions/core.workflows.custom_action/index.ts +2 -3
  33. package/templates/extensions/extend.workflows.custom_action/index.ts +2 -3
  34. package/templates/root/custom-objects/{package.json → package.json.mustache} +4 -4
  35. package/dist/extensibility-dev-tools-alpha.d.ts +0 -199
  36. package/dist/extensibility-dev-tools-beta.d.ts +0 -199
  37. package/dist/extensibility-dev-tools-dependencies-alpha.d.ts +0 -51
  38. package/dist/extensibility-dev-tools-dependencies-beta.d.ts +0 -51
  39. package/dist/extensibility-dev-tools-dependencies-internal.d.ts +0 -372
  40. package/dist/extensibility-dev-tools-dependencies-public.d.ts +0 -51
  41. package/dist/extensibility-dev-tools-internal.d.ts +0 -1722
  42. package/dist/extensibility-dev-tools-jsonschema-tools-alpha.d.ts +0 -57
  43. package/dist/extensibility-dev-tools-jsonschema-tools-beta.d.ts +0 -57
  44. package/dist/extensibility-dev-tools-jsonschema-tools-internal.d.ts +0 -123
  45. package/dist/extensibility-dev-tools-jsonschema-tools-public.d.ts +0 -57
  46. package/dist/extensibility-dev-tools-manifest-alpha.d.ts +0 -31
  47. package/dist/extensibility-dev-tools-manifest-beta.d.ts +0 -31
  48. package/dist/extensibility-dev-tools-manifest-internal.d.ts +0 -461
  49. package/dist/extensibility-dev-tools-manifest-public.d.ts +0 -31
  50. package/dist/extensibility-dev-tools-public.d.ts +0 -199
  51. package/dist/extensibility-dev-tools-schemas-alpha.d.ts +0 -9
  52. package/dist/extensibility-dev-tools-schemas-beta.d.ts +0 -9
  53. package/dist/extensibility-dev-tools-schemas-internal.d.ts +0 -41
  54. package/dist/extensibility-dev-tools-schemas-public.d.ts +0 -9
  55. package/dist/extensibility-dev-tools-templates-alpha.d.ts +0 -67
  56. package/dist/extensibility-dev-tools-templates-beta.d.ts +0 -67
  57. package/dist/extensibility-dev-tools-templates-internal.d.ts +0 -554
  58. package/dist/extensibility-dev-tools-templates-public.d.ts +0 -67
  59. package/dist/extensibility-dev-tools-workspace-alpha.d.ts +0 -51
  60. package/dist/extensibility-dev-tools-workspace-beta.d.ts +0 -51
  61. package/dist/extensibility-dev-tools-workspace-internal.d.ts +0 -410
  62. package/dist/extensibility-dev-tools-workspace-public.d.ts +0 -51
@@ -1,51 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /* Excluded from this release type: _CliContext */
4
-
5
- /* Excluded from this release type: _CliUx */
6
-
7
- /* Excluded from this release type: _defaultServices */
8
-
9
- /* Excluded from this release type: _EndpointAuth */
10
-
11
- /* Excluded from this release type: _EndpointDefinition */
12
-
13
- /* Excluded from this release type: _PackageMetadata */
14
-
15
- /* Excluded from this release type: _regenAppProjectWorkspace */
16
-
17
- /* Excluded from this release type: _RegenWorkspaceOptions */
18
-
19
- /* Excluded from this release type: _regenWorkspaceOptionsSchema */
20
-
21
- /* Excluded from this release type: _resolvePackageMetadata */
22
-
23
- /* Excluded from this release type: _WorkspaceDependency */
24
-
25
- /* Excluded from this release type: _WorkspaceDependencyManager */
26
-
27
- /* Excluded from this release type: _WorkspaceExtensionConfig */
28
-
29
- /* Excluded from this release type: _WorkspaceFileWriteResult */
30
-
31
- /* Excluded from this release type: _WorkspaceFileWriterOptions */
32
-
33
- /* Excluded from this release type: _WorkspaceGeneratedFile */
34
-
35
- /* Excluded from this release type: _WorkspaceGenerateResult */
36
-
37
- /* Excluded from this release type: _WorkspaceManifest */
38
-
39
- /* Excluded from this release type: _WorkspaceOverwriteDecision */
40
-
41
- /* Excluded from this release type: _WorkspaceOverwritePromptCallback */
42
-
43
- /* Excluded from this release type: _WorkspacePendingChange */
44
-
45
- /* Excluded from this release type: _WorkspacePostGenerationHook */
46
-
47
- /* Excluded from this release type: _WorkspaceServices */
48
-
49
- /* Excluded from this release type: _WorkspaceWriteMode */
50
-
51
- export { }
@@ -1,410 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /**
4
- * Shared context threaded through CLI operations.
5
- *
6
- * Carry this through call chains so that output can be redirected in tests
7
- * without patching global `process.stdout`/`process.stderr`.
8
- *
9
- * @internal
10
- */
11
- declare interface _CliContext {
12
- /** Output abstraction for writing to stdout/stderr. */
13
- readonly ux: _CliUx;
14
- }
15
-
16
- /**
17
- * Thin output abstraction used by CLI entry points and the functions they call.
18
- *
19
- * Inject a `_CliUx` constructed with `PassThrough` streams in tests to capture
20
- * output without spying on `process.stdout`/`process.stderr`.
21
- *
22
- * @internal
23
- */
24
- declare class _CliUx {
25
- #private;
26
- constructor(options?: {
27
- readonly stderr?: NodeJS.WritableStream;
28
- readonly stdout?: NodeJS.WritableStream;
29
- });
30
- /** Write a product output line to stdout (or the configured stream). */
31
- print(message: string): void;
32
- /** Write a status/progress line to stderr (or the configured stream). */
33
- log(message: string): void;
34
- /**
35
- * Error message to **stderr** (or the configured stderr stream).
36
- *
37
- * Behaviorally identical to {@link _CliUx.log} today. Use `error()` for failures
38
- * and `log()` for progress/status — the distinction supports future
39
- * formatting differentiation (color, prefixes, severity filtering).
40
- */
41
- error(message: string): void;
42
- }
43
-
44
- /**
45
- * Default workspace services using real filesystem and dependency implementations.
46
- * @internal
47
- */
48
- export declare const _defaultServices: _WorkspaceServices;
49
-
50
- /**
51
- * Authentication configuration for an endpoint.
52
- * @internal
53
- */
54
- declare interface _EndpointAuth {
55
- /** The type of authentication. */
56
- type: 'bearer_token' | 'header';
57
- /** The name of the secret containing the authentication credential. */
58
- secret_name: string;
59
- /** The name of the header to use for authentication (required when type is 'header'). */
60
- header_name?: string;
61
- }
62
-
63
- /**
64
- * Configuration for a single endpoint environment (live, test, managed_sandbox).
65
- * @internal
66
- */
67
- declare interface _EndpointDefinition {
68
- /** The HTTPS URL of the endpoint. */
69
- url?: string;
70
- /** The purpose of the endpoint. */
71
- purpose?: string;
72
- /** Authentication configuration. */
73
- auth?: _EndpointAuth;
74
- }
75
-
76
- /**
77
- * Package metadata (id, name, version)
78
- * @internal - Exported for testing only
79
- */
80
- export declare interface _PackageMetadata {
81
- /** The package identifier (from package.json `name`). */
82
- id: string;
83
- /** Human-readable display name (from package.json `description`). */
84
- name: string;
85
- /** Package version string (from package.json `version`). */
86
- version: string;
87
- }
88
-
89
- /**
90
- * Regenerate workspace files from templates
91
- *
92
- * @param options - Regeneration options
93
- * @param services - Injectable collaborators (defaults to real implementations)
94
- * @param context - CLI context for user-facing output. Defaults to a new context with standard stdout/stderr streams.
95
- *
96
- * @example
97
- * ```typescript
98
- * // Regenerate root workspace (scenario 1)
99
- * await regenAppProjectWorkspace({ packageDir: '.' });
100
- *
101
- * // Create new extension (scenario 2)
102
- * await regenAppProjectWorkspace({
103
- * templateId: 'core.workflows.custom_action',
104
- * workspaceId: 'my-ext',
105
- * });
106
- *
107
- * // Regenerate extension from its directory (scenario 3)
108
- * await regenAppProjectWorkspace({
109
- * root: '../..',
110
- * packageDir: '.',
111
- * templateId: 'core.workflows.custom_action',
112
- * });
113
- *
114
- * // Regenerate extension from project root (scenario 4)
115
- * await regenAppProjectWorkspace({
116
- * packageDir: 'extensions/my-ext',
117
- * templateId: 'core.workflows.custom_action',
118
- * });
119
- *
120
- * // Ensure custom-objects workspace (scenario 5)
121
- * await regenAppProjectWorkspace({
122
- * templateId: 'custom-objects',
123
- * workspaceId: 'custom-objects',
124
- * });
125
- * ```
126
- * @internal
127
- */
128
- export declare function _regenAppProjectWorkspace(options: _RegenWorkspaceOptions, services?: _WorkspaceServices, context?: _CliContext): Promise<void>;
129
-
130
- /**
131
- * Options for regenerating a workspace from templates.
132
- * @internal
133
- */
134
- export declare type _RegenWorkspaceOptions = z.infer<typeof _regenWorkspaceOptionsSchema>;
135
-
136
- /**
137
- * Options for workspace regeneration
138
- * @internal
139
- */
140
- export declare const _regenWorkspaceOptionsSchema: z.ZodObject<{
141
- force: z.ZodOptional<z.ZodBoolean>;
142
- implementationType: z.ZodOptional<z.ZodEnum<{
143
- "remote-function": "remote-function";
144
- script: "script";
145
- }>>;
146
- name: z.ZodOptional<z.ZodString>;
147
- packageDir: z.ZodOptional<z.ZodString>;
148
- root: z.ZodOptional<z.ZodString>;
149
- skipDependencies: z.ZodOptional<z.ZodBoolean>;
150
- skipHooks: z.ZodOptional<z.ZodBoolean>;
151
- templateId: z.ZodOptional<z.ZodString>;
152
- workspaceId: z.ZodOptional<z.ZodString>;
153
- workspaceName: z.ZodOptional<z.ZodString>;
154
- }, z.core.$strip>;
155
-
156
- /**
157
- * Resolve package ID, name, and version from options or package.json
158
- *
159
- * @param providedId - ID from options
160
- * @param providedName - Name from options (overrides package.json)
161
- * @param packageDir - Directory containing package.json, or undefined to skip reading
162
- * @returns Object with id, name, and version
163
- * @throws Error if ID cannot be determined, or if both providedId and package.json ID
164
- * exist and differ
165
- * @internal - Exported for testing only
166
- */
167
- export declare function _resolvePackageMetadata(providedId: string | undefined, providedName: string | undefined, packageDir: string | undefined): Promise<_PackageMetadata>;
168
-
169
- /**
170
- * A dependency required by a workspace: runtime npm, dev npm, or Stripe CLI plugin.
171
- * @internal
172
- */
173
- export declare type _WorkspaceDependency = {
174
- minVersion?: string;
175
- name: string;
176
- type: 'stripe-cli-plugin';
177
- } | {
178
- name: string;
179
- type: 'dev-npm';
180
- version: string;
181
- } | {
182
- name: string;
183
- type: 'npm';
184
- version: string;
185
- };
186
-
187
- /**
188
- * Interface for managing workspace dependency installation.
189
- * @internal
190
- */
191
- export declare interface _WorkspaceDependencyManager {
192
- /** Analyze and queue the given dependencies for installation. */
193
- ensureDependencies(input: {
194
- optional?: _WorkspaceDependency[];
195
- required: _WorkspaceDependency[];
196
- }): Promise<_WorkspacePendingChange[]>;
197
- /** Mark a conflicting dependency as resolved so it will be force-installed. */
198
- resolveConflict(dep: _WorkspaceDependency): void;
199
- /** Apply all queued dependency changes. */
200
- commit(): Promise<unknown>;
201
- }
202
-
203
- /**
204
- * Extension configuration used by the workspace manifest interface.
205
- * @internal
206
- */
207
- export declare interface _WorkspaceExtensionConfig {
208
- /** Extension identifier. */
209
- id: string;
210
- /** Human-readable extension name. */
211
- name: string;
212
- /** Extension interface ID. */
213
- interface_id: string;
214
- /** Extension version string. */
215
- version: string;
216
- /** Legacy entry point script path. */
217
- script_entry_point?: string;
218
- /** Inline script definition. */
219
- script?: {
220
- content: string;
221
- type: string;
222
- };
223
- /** Required permissions for the extension. */
224
- permissions: string[];
225
- /** Method implementations keyed by method name. */
226
- methods: Record<string, unknown>;
227
- /** Optional configuration schemas. */
228
- configuration?: {
229
- input_schema: {
230
- content: string;
231
- type: 'json_schema' | 'jsonforms';
232
- };
233
- ui_schema: {
234
- content: string;
235
- type: 'json_schema' | 'jsonforms';
236
- };
237
- };
238
- /** Remote function endpoints. */
239
- endpoints?: {
240
- id: string;
241
- live?: _EndpointDefinition;
242
- managed_sandbox?: _EndpointDefinition;
243
- test?: _EndpointDefinition;
244
- type: 'custom_http' | 'remote_function';
245
- }[];
246
- }
247
-
248
- /**
249
- * Result of writing workspace files to disk.
250
- * @internal
251
- */
252
- export declare interface _WorkspaceFileWriteResult {
253
- /** Paths of files that were written or overwritten. */
254
- written: string[];
255
- /** Paths of files that already existed and were not overwritten. */
256
- existing: string[];
257
- /** Whether all remaining files were skipped. */
258
- skipped: boolean;
259
- /** Whether the write operation was aborted by the user. */
260
- aborted: boolean;
261
- }
262
-
263
- /**
264
- * Options for writing workspace generated files to disk.
265
- * @internal
266
- */
267
- export declare interface _WorkspaceFileWriterOptions {
268
- /** Working directory to resolve file paths against. */
269
- cwd?: string;
270
- /** Controls how existing files are handled. */
271
- write?: _WorkspaceWriteMode;
272
- /** Called after a file is written or overwritten. */
273
- onFileWritten?: (file: _WorkspaceGeneratedFile, wasOverwrite: boolean) => void;
274
- /** Called when a file is skipped due to the write mode. */
275
- onFileSkipped?: (file: _WorkspaceGeneratedFile) => void;
276
- /** Called when a file is identical to the existing one on disk. */
277
- onFileIdentical?: (file: _WorkspaceGeneratedFile) => void;
278
- }
279
-
280
- /**
281
- * A file generated by a workspace template.
282
- * @internal
283
- */
284
- export declare interface _WorkspaceGeneratedFile {
285
- /** Path to the file, relative to the project root. */
286
- path: string;
287
- /** File content as a string. */
288
- content: string;
289
- /** If true, the file will never be overwritten even with `--force`. */
290
- precious?: boolean;
291
- }
292
-
293
- /**
294
- * Result returned by a workspace template generator.
295
- * @internal
296
- */
297
- export declare interface _WorkspaceGenerateResult {
298
- /** Files to write to disk. */
299
- files: _WorkspaceGeneratedFile[];
300
- /** Dependencies to install after file generation. */
301
- dependencies?: {
302
- dev?: _WorkspaceDependency[];
303
- runtime?: _WorkspaceDependency[];
304
- };
305
- /** Hooks to run after dependencies are installed. */
306
- postGenerationHooks?: _WorkspacePostGenerationHook[];
307
- /** Methods configuration for the stripe-app.yaml extension entry. */
308
- methods?: Record<string, unknown>;
309
- }
310
-
311
- /**
312
- * Interface for reading and writing the stripe-app.yaml manifest.
313
- * @internal
314
- */
315
- export declare interface _WorkspaceManifest {
316
- /** Add a new extension or replace an existing one by ID; returns the extension ID. */
317
- addOrUpdateExtension(config: _WorkspaceExtensionConfig): string;
318
- /** Get a read-only view of all registered extensions. */
319
- getExtensions(): readonly Readonly<_WorkspaceExtensionConfig>[];
320
- /** Check whether a custom object entry is already registered in the manifest. */
321
- hasCustomObject(entry: {
322
- className: string;
323
- filePath: string;
324
- }): boolean;
325
- /** Add a custom object entry to the manifest; returns true if added, false if already present. */
326
- addCustomObject(entry: {
327
- className: string;
328
- filePath: string;
329
- }): boolean;
330
- /** Persist the manifest to disk. */
331
- save(): Promise<void>;
332
- }
333
-
334
- /**
335
- * Decision returned by an overwrite prompt callback when a file already exists.
336
- * @internal
337
- */
338
- export declare type _WorkspaceOverwriteDecision = 'abort' | 'overwrite-all' | 'overwrite' | 'skip';
339
-
340
- /**
341
- * Callback invoked when a file to be written already exists, prompting for an overwrite decision.
342
- * @internal
343
- */
344
- export declare type _WorkspaceOverwritePromptCallback = (path: string, cwd: string, newContent: string) => Promise<_WorkspaceOverwriteDecision>;
345
-
346
- /**
347
- * A pending dependency change in the workspace dependency manager.
348
- * @internal
349
- */
350
- export declare interface _WorkspacePendingChange {
351
- /** The dependency this change applies to. */
352
- dependency: _WorkspaceDependency;
353
- /** The action that will be taken. */
354
- action: 'add' | 'already-satisfied' | 'conflict' | 'update';
355
- }
356
-
357
- /**
358
- * A post-generation hook to run after files are written: either a pnpm script or a direct exec.
359
- * @internal
360
- */
361
- export declare type _WorkspacePostGenerationHook = {
362
- description?: string;
363
- exec: string;
364
- } | {
365
- description?: string;
366
- script: string;
367
- };
368
-
369
- /**
370
- * Injectable collaborators for _regenAppProjectWorkspace.
371
- * Defaults to real implementations; override individual fields for testing.
372
- * @internal
373
- */
374
- export declare interface _WorkspaceServices {
375
- /** Generate root workspace files from template variables. */
376
- generateRoot: (vars: {
377
- appId: string;
378
- appName: string;
379
- version: string;
380
- }) => Promise<_WorkspaceGenerateResult>;
381
- /** Generate extension workspace files for the given template key and variables. */
382
- generateExtension: (key: string, vars: {
383
- id: string;
384
- name: string;
385
- version: string;
386
- }) => Promise<_WorkspaceGenerateResult>;
387
- /** Write generated files to disk with the given options. */
388
- writeFiles: (files: _WorkspaceGeneratedFile[], options?: _WorkspaceFileWriterOptions) => Promise<_WorkspaceFileWriteResult>;
389
- /** Create a dependency manager scoped to the given working directory. */
390
- createDepManager: (opts: {
391
- context?: _CliContext;
392
- cwd: string;
393
- }) => _WorkspaceDependencyManager;
394
- /** Generate custom object files (definition and test) from a name. */
395
- generateCustomObject: (vars: { name: string }) => Promise<_WorkspaceGenerateResult>;
396
- /** Generate the custom-objects workspace scaffolding (package.json, tsconfig.json). */
397
- generateCustomObjectsWorkspace: (vars: { packagesSubfolder?: string }) => Promise<_WorkspaceGenerateResult>;
398
- /** Load the stripe-app.yaml manifest from the given path. */
399
- loadManifest: (manifestPath: string) => Promise<_WorkspaceManifest>;
400
- /** Run post-generation hooks in the given working directory. */
401
- runHooks: (hooks: _WorkspacePostGenerationHook[] | undefined, workingDir: string, disabled?: boolean, context?: _CliContext) => Promise<void>;
402
- }
403
-
404
- /**
405
- * Controls how the file writer handles existing files.
406
- * @internal
407
- */
408
- export declare type _WorkspaceWriteMode = _WorkspaceOverwritePromptCallback | 'abort-if-existing' | 'if-missing' | 'overwrite-all';
409
-
410
- export { }
@@ -1,51 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /* Excluded from this release type: _CliContext */
4
-
5
- /* Excluded from this release type: _CliUx */
6
-
7
- /* Excluded from this release type: _defaultServices */
8
-
9
- /* Excluded from this release type: _EndpointAuth */
10
-
11
- /* Excluded from this release type: _EndpointDefinition */
12
-
13
- /* Excluded from this release type: _PackageMetadata */
14
-
15
- /* Excluded from this release type: _regenAppProjectWorkspace */
16
-
17
- /* Excluded from this release type: _RegenWorkspaceOptions */
18
-
19
- /* Excluded from this release type: _regenWorkspaceOptionsSchema */
20
-
21
- /* Excluded from this release type: _resolvePackageMetadata */
22
-
23
- /* Excluded from this release type: _WorkspaceDependency */
24
-
25
- /* Excluded from this release type: _WorkspaceDependencyManager */
26
-
27
- /* Excluded from this release type: _WorkspaceExtensionConfig */
28
-
29
- /* Excluded from this release type: _WorkspaceFileWriteResult */
30
-
31
- /* Excluded from this release type: _WorkspaceFileWriterOptions */
32
-
33
- /* Excluded from this release type: _WorkspaceGeneratedFile */
34
-
35
- /* Excluded from this release type: _WorkspaceGenerateResult */
36
-
37
- /* Excluded from this release type: _WorkspaceManifest */
38
-
39
- /* Excluded from this release type: _WorkspaceOverwriteDecision */
40
-
41
- /* Excluded from this release type: _WorkspaceOverwritePromptCallback */
42
-
43
- /* Excluded from this release type: _WorkspacePendingChange */
44
-
45
- /* Excluded from this release type: _WorkspacePostGenerationHook */
46
-
47
- /* Excluded from this release type: _WorkspaceServices */
48
-
49
- /* Excluded from this release type: _WorkspaceWriteMode */
50
-
51
- export { }