@stripe/extensibility-dev-tools 0.24.2 → 0.25.1

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 +203 -46
  2. package/dist/bin/build-custom-object-definitions.js +194 -37
  3. package/dist/bin/create-upload-image.cjs +206 -46
  4. package/dist/bin/create-upload-image.js +201 -41
  5. package/dist/bin/dev-tools-rpc.cjs +199 -59
  6. package/dist/bin/dev-tools-rpc.js +174 -34
  7. package/dist/bin/gen-workspace.cjs +187 -47
  8. package/dist/bin/gen-workspace.js +174 -34
  9. package/dist/bin/template-info.cjs +161 -30
  10. package/dist/bin/template-info.js +156 -25
  11. package/dist/custom-objects/build-definitions.d.ts.map +1 -1
  12. package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts +32 -0
  13. package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts.map +1 -1
  14. package/dist/custom-objects/generated/proto/google/protobuf/descriptor.pb.d.ts +2 -2
  15. package/dist/custom-objects/generated/proto/google/protobuf/wrappers.pb.d.ts +168 -0
  16. package/dist/custom-objects/generated/proto/google/protobuf/wrappers.pb.d.ts.map +1 -0
  17. package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts +4 -4
  18. package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts.map +1 -1
  19. package/dist/custom-objects/generated/proto/vendor/proto/model/common/common_model.pb.d.ts +1553 -0
  20. package/dist/custom-objects/generated/proto/vendor/proto/model/common/common_model.pb.d.ts.map +1 -0
  21. package/dist/custom-objects/generated/proto/vendor/proto/model/common/kronos_model.pb.d.ts +1372 -0
  22. package/dist/custom-objects/generated/proto/vendor/proto/model/common/kronos_model.pb.d.ts.map +1 -0
  23. package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts +2 -0
  24. package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts.map +1 -1
  25. package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts +2 -0
  26. package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts.map +1 -1
  27. package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts +14 -2
  28. package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts.map +1 -1
  29. package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts +6 -0
  30. package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts.map +1 -1
  31. package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts +74 -0
  32. package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts.map +1 -1
  33. package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts +10 -3
  34. package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts.map +1 -1
  35. package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts +1 -0
  36. package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts.map +1 -1
  37. package/dist/index.cjs +192 -52
  38. package/dist/index.js +174 -34
  39. package/dist/templates/extensions/billing.invoice_collection_options.d.ts +6 -0
  40. package/dist/templates/extensions/billing.invoice_collection_options.d.ts.map +1 -0
  41. package/dist/templates/index.cjs +174 -34
  42. package/dist/templates/index.js +172 -32
  43. package/dist/templates/root/index.d.ts.map +1 -1
  44. package/dist/tsconfig.build.tsbuildinfo +1 -1
  45. package/dist/workspace/index.cjs +183 -43
  46. package/dist/workspace/index.d.ts.map +1 -1
  47. package/dist/workspace/index.js +174 -34
  48. package/dist/workspace-versions.d.ts +26 -0
  49. package/dist/workspace-versions.d.ts.map +1 -0
  50. package/package.json +4 -4
  51. package/templates/extensions/billing.invoice_collection_options/index.test.ts +15 -0
  52. package/templates/extensions/billing.invoice_collection_options/index.ts +16 -0
  53. package/templates/root/custom-objects/eslint.config.mts +89 -0
  54. package/templates/root/custom-objects/package.json.mustache +2 -0
  55. package/templates/root/custom-objects/tsconfig.json +1 -0
  56. package/templates/root/custom-objects/vitest.config.mts +7 -0
  57. package/templates/root/package.json.mustache +1 -1
  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 .",
@@ -790,7 +897,7 @@ declarations:
790
897
  content: `#!/usr/bin/env tsx
791
898
  /**
792
899
  * Runs tests across the workspace:
793
- * - vitest for script extensions and custom objects (extensions/*)
900
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
794
901
  * - jest for UI extensions (ui/)
795
902
  */
796
903
  import { existsSync, readdirSync } from 'node:fs';
@@ -800,6 +907,8 @@ const hasExtensions =
800
907
  existsSync('extensions') &&
801
908
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
802
909
 
910
+ const hasCustomObjects = existsSync('custom-objects/package.json');
911
+
803
912
  const hasUI = existsSync('ui/package.json');
804
913
 
805
914
  let exitCode = 0;
@@ -812,7 +921,7 @@ function run(cmd: string): void {
812
921
  }
813
922
  }
814
923
 
815
- if (hasExtensions) {
924
+ if (hasExtensions || hasCustomObjects) {
816
925
  run('vitest run');
817
926
  }
818
927
 
@@ -2132,8 +2241,30 @@ var _DependencyManager = class {
2132
2241
  }
2133
2242
  };
2134
2243
 
2244
+ // src/workspace-versions.json
2245
+ var workspace_versions_default = {
2246
+ "@stripe/extensibility-custom-objects": "0.8.0",
2247
+ "@stripe/extensibility-custom-objects-tools": "0.42.1",
2248
+ "@stripe/extensibility-dev-tools": "0.25.1",
2249
+ "@stripe/extensibility-eslint-plugin": "0.17.1",
2250
+ "@stripe/extensibility-language-server": "0.3.4",
2251
+ "@stripe/extensibility-sdk": "0.27.1",
2252
+ "@stripe/extensibility-test-helpers": "0.2.7"
2253
+ };
2254
+
2255
+ // src/workspace-versions.ts
2256
+ var _workspaceVersions = workspace_versions_default;
2257
+ function _workspaceVersion(packageName) {
2258
+ const v = _workspaceVersions[packageName];
2259
+ if (v === void 0) {
2260
+ throw new Error(
2261
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
2262
+ );
2263
+ }
2264
+ return v;
2265
+ }
2266
+
2135
2267
  // src/templates/extensions/base.ts
2136
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
2137
2268
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
2138
2269
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
2139
2270
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -2438,14 +2569,14 @@ var billing_bill_discount_calculation_default = {
2438
2569
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
2439
2570
  };
2440
2571
 
2441
- // src/templates/extensions/billing.invoice_collection_setting.ts
2442
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
2443
- var invoiceCollectionSettingTemplate = {
2572
+ // src/templates/extensions/billing.invoice_collection_options.ts
2573
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
2574
+ var invoiceCollectionOptionsTemplate = {
2444
2575
  hidden: true,
2445
2576
  methods: {
2446
- collection_override: { implementation_types: ["script"] }
2577
+ override_options: { implementation_types: ["script"] }
2447
2578
  },
2448
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
2579
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
2449
2580
  generate: (params, context) => {
2450
2581
  const { id } = params;
2451
2582
  const { fs: fs2 } = context;
@@ -2473,15 +2604,15 @@ var invoiceCollectionSettingTemplate = {
2473
2604
  ...base.files
2474
2605
  ],
2475
2606
  methods: {
2476
- collection_override: {
2607
+ override_options: {
2477
2608
  implementation_type: "script"
2478
2609
  }
2479
2610
  }
2480
2611
  };
2481
2612
  }
2482
2613
  };
2483
- var billing_invoice_collection_setting_default = {
2484
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
2614
+ var billing_invoice_collection_options_default = {
2615
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
2485
2616
  };
2486
2617
 
2487
2618
  // src/templates/extensions/billing.prorations.ts
@@ -2589,7 +2720,7 @@ var DEFAULT_TEMPLATES = {
2589
2720
  ...extend_workflows_custom_action_default,
2590
2721
  ...billing_customer_balance_application_default,
2591
2722
  ...billing_bill_discount_calculation_default,
2592
- ...billing_invoice_collection_setting_default,
2723
+ ...billing_invoice_collection_options_default,
2593
2724
  ...billing_prorations_default,
2594
2725
  ...billing_recurring_billing_item_handling_default
2595
2726
  };
@@ -2602,9 +2733,8 @@ var _templateManager = new _ExtensionTemplateManager(
2602
2733
  );
2603
2734
 
2604
2735
  // src/templates/root/index.ts
2605
- import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
2606
2736
  var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
2607
- var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion2(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2737
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2608
2738
  var _rootWorkspaceTemplate = {
2609
2739
  generate: (params, context) => {
2610
2740
  const { fs: fs2 } = context;
@@ -2659,14 +2789,14 @@ var _rootWorkspaceTemplate = {
2659
2789
  path: "custom-objects/package.json",
2660
2790
  content: fs2.mustache(
2661
2791
  {
2662
- customObjectsVersion: _workspaceVersion2(
2792
+ customObjectsVersion: _workspaceVersion(
2663
2793
  "@stripe/extensibility-custom-objects"
2664
2794
  ),
2665
- sdkVersion: _workspaceVersion2("@stripe/extensibility-sdk"),
2666
- customObjectsToolsVersion: _workspaceVersion2(
2795
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
2796
+ customObjectsToolsVersion: _workspaceVersion(
2667
2797
  "@stripe/extensibility-custom-objects-tools"
2668
2798
  ),
2669
- testHelpersVersion: _workspaceVersion2("@stripe/extensibility-test-helpers")
2799
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
2670
2800
  },
2671
2801
  "custom-objects",
2672
2802
  "package.json.mustache"
@@ -2678,6 +2808,16 @@ var _rootWorkspaceTemplate = {
2678
2808
  content: fs2.textFile("custom-objects/tsconfig.json"),
2679
2809
  precious: true
2680
2810
  },
2811
+ {
2812
+ path: "custom-objects/eslint.config.mts",
2813
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
2814
+ precious: true
2815
+ },
2816
+ {
2817
+ path: "custom-objects/vitest.config.mts",
2818
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
2819
+ precious: true
2820
+ },
2681
2821
  {
2682
2822
  path: "ui/package.json",
2683
2823
  content: fs2.textFile("ui/package.json"),
@@ -2704,7 +2844,7 @@ var _rootWorkspaceTemplate = {
2704
2844
  _devNpmDep("@types/node", "^20.19.0"),
2705
2845
  _devNpmDep(
2706
2846
  "@stripe/extensibility-dev-tools",
2707
- `^${_workspaceVersion2("@stripe/extensibility-dev-tools")}`
2847
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
2708
2848
  ),
2709
2849
  _devNpmDep("concurrently", "^9.2.1"),
2710
2850
  _devNpmDep("eslint", "^9.0.0"),
@@ -3485,9 +3625,9 @@ function resolveMode(options, projectRoot, packageDir) {
3485
3625
  workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
3486
3626
  generate: async (svc) => {
3487
3627
  const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
3488
- const workspaceExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json"));
3628
+ const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
3489
3629
  const objectResult = await svc.generateCustomObject({ name: objectName });
3490
- if (workspaceExists) {
3630
+ if (workspaceScaffoldingExists) {
3491
3631
  return objectResult;
3492
3632
  }
3493
3633
  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"}