@stripe/extensibility-dev-tools 0.24.3 → 1.0.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/dist/bin/build-custom-object-definitions.cjs +169 -34
  2. package/dist/bin/build-custom-object-definitions.js +160 -25
  3. package/dist/bin/create-upload-image.cjs +168 -33
  4. package/dist/bin/create-upload-image.js +160 -25
  5. package/dist/bin/dev-tools-rpc.cjs +203 -59
  6. package/dist/bin/dev-tools-rpc.js +178 -34
  7. package/dist/bin/gen-workspace.cjs +191 -47
  8. package/dist/bin/gen-workspace.js +178 -34
  9. package/dist/bin/template-info.cjs +165 -30
  10. package/dist/bin/template-info.js +160 -25
  11. package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts +32 -0
  12. package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts.map +1 -1
  13. package/dist/custom-objects/generated/proto/google/protobuf/descriptor.pb.d.ts +2 -2
  14. package/dist/custom-objects/generated/proto/google/protobuf/wrappers.pb.d.ts +168 -0
  15. package/dist/custom-objects/generated/proto/google/protobuf/wrappers.pb.d.ts.map +1 -0
  16. package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts +4 -4
  17. package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts.map +1 -1
  18. package/dist/custom-objects/generated/proto/vendor/proto/model/common/common_model.pb.d.ts +1553 -0
  19. package/dist/custom-objects/generated/proto/vendor/proto/model/common/common_model.pb.d.ts.map +1 -0
  20. package/dist/custom-objects/generated/proto/vendor/proto/model/common/kronos_model.pb.d.ts +1372 -0
  21. package/dist/custom-objects/generated/proto/vendor/proto/model/common/kronos_model.pb.d.ts.map +1 -0
  22. package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts +2 -0
  23. package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts.map +1 -1
  24. package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts +2 -0
  25. package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts.map +1 -1
  26. package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts +14 -2
  27. package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts.map +1 -1
  28. package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts +6 -0
  29. package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts.map +1 -1
  30. package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts +74 -0
  31. package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts.map +1 -1
  32. package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts +10 -3
  33. package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts.map +1 -1
  34. package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts +1 -0
  35. package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts.map +1 -1
  36. package/dist/index.cjs +196 -52
  37. package/dist/index.js +178 -34
  38. package/dist/templates/extensions/billing.invoice_collection_options.d.ts +6 -0
  39. package/dist/templates/extensions/billing.invoice_collection_options.d.ts.map +1 -0
  40. package/dist/templates/index.cjs +178 -34
  41. package/dist/templates/index.js +176 -32
  42. package/dist/templates/root/index.d.ts.map +1 -1
  43. package/dist/tsconfig.build.tsbuildinfo +1 -1
  44. package/dist/workspace/index.cjs +187 -43
  45. package/dist/workspace/index.d.ts.map +1 -1
  46. package/dist/workspace/index.js +178 -34
  47. package/dist/workspace-versions.d.ts +26 -0
  48. package/dist/workspace-versions.d.ts.map +1 -0
  49. package/package.json +4 -4
  50. package/templates/extensions/billing.invoice_collection_options/index.test.ts +15 -0
  51. package/templates/extensions/billing.invoice_collection_options/index.ts +16 -0
  52. package/templates/root/custom-objects/eslint.config.mts +89 -0
  53. package/templates/root/custom-objects/package.json.mustache +2 -0
  54. package/templates/root/custom-objects/tsconfig.json +1 -0
  55. package/templates/root/custom-objects/vitest.config.mts +7 -0
  56. package/templates/root/package.json.mustache +1 -1
  57. package/templates/root/pnpm-workspace.yaml +4 -0
  58. package/templates/root/tools/test.mts +4 -2
  59. package/dist/templates/extensions/billing.invoice_collection_setting.d.ts +0 -6
  60. package/dist/templates/extensions/billing.invoice_collection_setting.d.ts.map +0 -1
  61. package/templates/extensions/billing.invoice_collection_setting/index.test.ts +0 -15
  62. package/templates/extensions/billing.invoice_collection_setting/index.ts +0 -16
package/dist/index.js CHANGED
@@ -90,35 +90,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
90
90
  `
91
91
  },
92
92
  {
93
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
93
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
94
94
  content: `import { beforeEach, describe, it, expect } from 'vitest';
95
95
 
96
- import MyInvoiceCollectionSetting from './index.js';
96
+ import MyInvoiceCollectionOptions from './index.js';
97
97
 
98
- describe('MyInvoiceCollectionSetting', () => {
99
- let instance: MyInvoiceCollectionSetting;
98
+ describe('MyInvoiceCollectionOptions', () => {
99
+ let instance: MyInvoiceCollectionOptions;
100
100
 
101
101
  beforeEach(() => {
102
- instance = new MyInvoiceCollectionSetting();
102
+ instance = new MyInvoiceCollectionOptions();
103
103
  });
104
104
 
105
105
  it('should be constructable', () => {
106
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
106
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
107
107
  });
108
108
  });
109
109
  `
110
110
  },
111
111
  {
112
- path: "extensions/billing.invoice_collection_setting/index.ts",
112
+ path: "extensions/billing.invoice_collection_options/index.ts",
113
113
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
114
114
 
115
115
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
116
- interface MyInvoiceCollectionSettingConfig {}
116
+ interface MyInvoiceCollectionOptionsConfig {}
117
117
 
118
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
119
- collectionOverride(
120
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
121
- _config: MyInvoiceCollectionSettingConfig,
118
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
119
+ overrideOptions(
120
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
121
+ _config: MyInvoiceCollectionOptionsConfig,
122
122
  _context: Context
123
123
  ) {
124
124
  // TODO: implement your collection setting logic here
@@ -590,6 +590,99 @@ install-deps.log
590
590
 
591
591
  # generated schemas
592
592
  generated
593
+ `
594
+ },
595
+ {
596
+ path: "root/custom-objects/eslint.config.mts",
597
+ content: `import eslint from '@eslint/js';
598
+ import { defineConfig } from 'eslint/config';
599
+ import tseslint from 'typescript-eslint';
600
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
601
+
602
+ import globals from 'globals';
603
+
604
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
605
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
606
+
607
+ export default defineConfig([
608
+ eslint.configs.recommended,
609
+ ...tseslint.configs.recommended,
610
+ ...stripeAppsConfig,
611
+ ...customObjectsConfig,
612
+
613
+ // Global ignores
614
+ {
615
+ ignores: ['dist', 'generated', 'node_modules'],
616
+ },
617
+
618
+ // TypeScript source files (with type-checking)
619
+ {
620
+ name: 'sources',
621
+ files: ['src/**/*.ts'],
622
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
623
+ languageOptions: {
624
+ globals: {
625
+ ...globals.node,
626
+ },
627
+ parserOptions: {
628
+ projectService: true,
629
+ tsconfigRootDir: import.meta.dirname,
630
+ },
631
+ },
632
+ },
633
+
634
+ // Test files
635
+ {
636
+ name: 'tests',
637
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
638
+ languageOptions: {
639
+ globals: {
640
+ ...globals.node,
641
+ },
642
+ parserOptions: {
643
+ projectService: true,
644
+ tsconfigRootDir: import.meta.dirname,
645
+ },
646
+ },
647
+ },
648
+
649
+ // Config files
650
+ {
651
+ name: 'ts-configs',
652
+ files: ['*.config.m?ts', 'eslint.config.mts'],
653
+ languageOptions: {
654
+ globals: {
655
+ ...globals.node,
656
+ },
657
+ parserOptions: {
658
+ projectService: false,
659
+ },
660
+ },
661
+ rules: {
662
+ '@typescript-eslint/no-unused-vars': 'off',
663
+ },
664
+ },
665
+
666
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
667
+ // disable the TS-parser-specific rule that doesn't apply without it.
668
+ {
669
+ name: 'js-configs',
670
+ files: ['**/*.js', '**/*.mjs'],
671
+ languageOptions: {
672
+ globals: {
673
+ ...globals.node,
674
+ },
675
+ parserOptions: {
676
+ projectService: false,
677
+ },
678
+ },
679
+ rules: {
680
+ '@typescript-eslint/no-require-imports': 'off',
681
+ },
682
+ },
683
+
684
+ eslintConfigPrettier,
685
+ ]);
593
686
  `
594
687
  },
595
688
  {
@@ -602,7 +695,9 @@ generated
602
695
  "private": true,
603
696
  "scripts": {
604
697
  "build": "test -d src && custom-objects-build --input src --output dist || true",
698
+ "lint": "pnpm lint:types && pnpm lint:eslint",
605
699
  "lint:types": "test ! -d src || tsc --noEmit",
700
+ "lint:eslint": "eslint .",
606
701
  "test": "vitest run"
607
702
  },
608
703
  "dependencies": {
@@ -625,8 +720,20 @@ generated
625
720
  "moduleResolution": "bundler",
626
721
  "types": ["vitest/globals"]
627
722
  },
723
+ "include": ["src/**/*.ts"],
628
724
  "exclude": ["dist"]
629
725
  }
726
+ `
727
+ },
728
+ {
729
+ path: "root/custom-objects/vitest.config.mts",
730
+ content: `import { defineConfig } from 'vitest/config';
731
+
732
+ export default defineConfig({
733
+ test: {
734
+ globals: true,
735
+ },
736
+ });
630
737
  `
631
738
  },
632
739
  {
@@ -744,7 +851,7 @@ export default defineConfig([
744
851
  "build": "pnpm -r --if-present build",
745
852
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
746
853
  "lint:types": "pnpm -r --if-present lint:types",
747
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
854
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
748
855
  "lint:format": "prettier --check .",
749
856
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
750
857
  "fix:format": "prettier --write .",
@@ -773,6 +880,10 @@ export default defineConfig([
773
880
 
774
881
  overrides:
775
882
  vite: ^6.0.0
883
+
884
+ allowBuilds:
885
+ core-js-pure: false
886
+ esbuild: false
776
887
  `
777
888
  },
778
889
  {
@@ -790,7 +901,7 @@ declarations:
790
901
  content: `#!/usr/bin/env tsx
791
902
  /**
792
903
  * Runs tests across the workspace:
793
- * - vitest for script extensions and custom objects (extensions/*)
904
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
794
905
  * - jest for UI extensions (ui/)
795
906
  */
796
907
  import { existsSync, readdirSync } from 'node:fs';
@@ -800,6 +911,8 @@ const hasExtensions =
800
911
  existsSync('extensions') &&
801
912
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
802
913
 
914
+ const hasCustomObjects = existsSync('custom-objects/package.json');
915
+
803
916
  const hasUI = existsSync('ui/package.json');
804
917
 
805
918
  let exitCode = 0;
@@ -812,7 +925,7 @@ function run(cmd: string): void {
812
925
  }
813
926
  }
814
927
 
815
- if (hasExtensions) {
928
+ if (hasExtensions || hasCustomObjects) {
816
929
  run('vitest run');
817
930
  }
818
931
 
@@ -2132,8 +2245,30 @@ var _DependencyManager = class {
2132
2245
  }
2133
2246
  };
2134
2247
 
2248
+ // src/workspace-versions.json
2249
+ var workspace_versions_default = {
2250
+ "@stripe/extensibility-custom-objects": "1.0.0",
2251
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
2252
+ "@stripe/extensibility-dev-tools": "1.0.2",
2253
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
2254
+ "@stripe/extensibility-language-server": "1.0.0",
2255
+ "@stripe/extensibility-sdk": "1.0.0",
2256
+ "@stripe/extensibility-test-helpers": "1.0.0"
2257
+ };
2258
+
2259
+ // src/workspace-versions.ts
2260
+ var _workspaceVersions = workspace_versions_default;
2261
+ function _workspaceVersion(packageName) {
2262
+ const v = _workspaceVersions[packageName];
2263
+ if (v === void 0) {
2264
+ throw new Error(
2265
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
2266
+ );
2267
+ }
2268
+ return v;
2269
+ }
2270
+
2135
2271
  // src/templates/extensions/base.ts
2136
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
2137
2272
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
2138
2273
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
2139
2274
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -2438,14 +2573,14 @@ var billing_bill_discount_calculation_default = {
2438
2573
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
2439
2574
  };
2440
2575
 
2441
- // src/templates/extensions/billing.invoice_collection_setting.ts
2442
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
2443
- var invoiceCollectionSettingTemplate = {
2576
+ // src/templates/extensions/billing.invoice_collection_options.ts
2577
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
2578
+ var invoiceCollectionOptionsTemplate = {
2444
2579
  hidden: true,
2445
2580
  methods: {
2446
- collection_override: { implementation_types: ["script"] }
2581
+ override_options: { implementation_types: ["script"] }
2447
2582
  },
2448
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
2583
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
2449
2584
  generate: (params, context) => {
2450
2585
  const { id } = params;
2451
2586
  const { fs: fs2 } = context;
@@ -2473,15 +2608,15 @@ var invoiceCollectionSettingTemplate = {
2473
2608
  ...base.files
2474
2609
  ],
2475
2610
  methods: {
2476
- collection_override: {
2611
+ override_options: {
2477
2612
  implementation_type: "script"
2478
2613
  }
2479
2614
  }
2480
2615
  };
2481
2616
  }
2482
2617
  };
2483
- var billing_invoice_collection_setting_default = {
2484
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
2618
+ var billing_invoice_collection_options_default = {
2619
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
2485
2620
  };
2486
2621
 
2487
2622
  // src/templates/extensions/billing.prorations.ts
@@ -2589,7 +2724,7 @@ var DEFAULT_TEMPLATES = {
2589
2724
  ...extend_workflows_custom_action_default,
2590
2725
  ...billing_customer_balance_application_default,
2591
2726
  ...billing_bill_discount_calculation_default,
2592
- ...billing_invoice_collection_setting_default,
2727
+ ...billing_invoice_collection_options_default,
2593
2728
  ...billing_prorations_default,
2594
2729
  ...billing_recurring_billing_item_handling_default
2595
2730
  };
@@ -2602,9 +2737,8 @@ var _templateManager = new _ExtensionTemplateManager(
2602
2737
  );
2603
2738
 
2604
2739
  // src/templates/root/index.ts
2605
- import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
2606
2740
  var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
2607
- var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion2(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2741
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2608
2742
  var _rootWorkspaceTemplate = {
2609
2743
  generate: (params, context) => {
2610
2744
  const { fs: fs2 } = context;
@@ -2659,14 +2793,14 @@ var _rootWorkspaceTemplate = {
2659
2793
  path: "custom-objects/package.json",
2660
2794
  content: fs2.mustache(
2661
2795
  {
2662
- customObjectsVersion: _workspaceVersion2(
2796
+ customObjectsVersion: _workspaceVersion(
2663
2797
  "@stripe/extensibility-custom-objects"
2664
2798
  ),
2665
- sdkVersion: _workspaceVersion2("@stripe/extensibility-sdk"),
2666
- customObjectsToolsVersion: _workspaceVersion2(
2799
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
2800
+ customObjectsToolsVersion: _workspaceVersion(
2667
2801
  "@stripe/extensibility-custom-objects-tools"
2668
2802
  ),
2669
- testHelpersVersion: _workspaceVersion2("@stripe/extensibility-test-helpers")
2803
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
2670
2804
  },
2671
2805
  "custom-objects",
2672
2806
  "package.json.mustache"
@@ -2678,6 +2812,16 @@ var _rootWorkspaceTemplate = {
2678
2812
  content: fs2.textFile("custom-objects/tsconfig.json"),
2679
2813
  precious: true
2680
2814
  },
2815
+ {
2816
+ path: "custom-objects/eslint.config.mts",
2817
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
2818
+ precious: true
2819
+ },
2820
+ {
2821
+ path: "custom-objects/vitest.config.mts",
2822
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
2823
+ precious: true
2824
+ },
2681
2825
  {
2682
2826
  path: "ui/package.json",
2683
2827
  content: fs2.textFile("ui/package.json"),
@@ -2704,7 +2848,7 @@ var _rootWorkspaceTemplate = {
2704
2848
  _devNpmDep("@types/node", "^20.19.0"),
2705
2849
  _devNpmDep(
2706
2850
  "@stripe/extensibility-dev-tools",
2707
- `^${_workspaceVersion2("@stripe/extensibility-dev-tools")}`
2851
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
2708
2852
  ),
2709
2853
  _devNpmDep("concurrently", "^9.2.1"),
2710
2854
  _devNpmDep("eslint", "^9.0.0"),
@@ -3485,9 +3629,9 @@ function resolveMode(options, projectRoot, packageDir) {
3485
3629
  workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
3486
3630
  generate: async (svc) => {
3487
3631
  const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
3488
- const workspaceExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json"));
3632
+ const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
3489
3633
  const objectResult = await svc.generateCustomObject({ name: objectName });
3490
- if (workspaceExists) {
3634
+ if (workspaceScaffoldingExists) {
3491
3635
  return objectResult;
3492
3636
  }
3493
3637
  const workspaceResult = await svc.generateCustomObjectsWorkspace({});
@@ -0,0 +1,6 @@
1
+ import type { _ExtensionTemplate } from './types.js';
2
+ declare const _default: {
3
+ "billing.invoice_collection_options": _ExtensionTemplate;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=billing.invoice_collection_options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.invoice_collection_options.d.ts","sourceRoot":"","sources":["../../../src/templates/extensions/billing.invoice_collection_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;;;;AAgDrD,wBAEE"}