@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
@@ -165,35 +165,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
165
165
  `
166
166
  },
167
167
  {
168
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
168
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
169
169
  content: `import { beforeEach, describe, it, expect } from 'vitest';
170
170
 
171
- import MyInvoiceCollectionSetting from './index.js';
171
+ import MyInvoiceCollectionOptions from './index.js';
172
172
 
173
- describe('MyInvoiceCollectionSetting', () => {
174
- let instance: MyInvoiceCollectionSetting;
173
+ describe('MyInvoiceCollectionOptions', () => {
174
+ let instance: MyInvoiceCollectionOptions;
175
175
 
176
176
  beforeEach(() => {
177
- instance = new MyInvoiceCollectionSetting();
177
+ instance = new MyInvoiceCollectionOptions();
178
178
  });
179
179
 
180
180
  it('should be constructable', () => {
181
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
181
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
182
182
  });
183
183
  });
184
184
  `
185
185
  },
186
186
  {
187
- path: "extensions/billing.invoice_collection_setting/index.ts",
187
+ path: "extensions/billing.invoice_collection_options/index.ts",
188
188
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
189
189
 
190
190
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
191
- interface MyInvoiceCollectionSettingConfig {}
191
+ interface MyInvoiceCollectionOptionsConfig {}
192
192
 
193
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
194
- collectionOverride(
195
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
196
- _config: MyInvoiceCollectionSettingConfig,
193
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
194
+ overrideOptions(
195
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
196
+ _config: MyInvoiceCollectionOptionsConfig,
197
197
  _context: Context
198
198
  ) {
199
199
  // TODO: implement your collection setting logic here
@@ -665,6 +665,99 @@ install-deps.log
665
665
 
666
666
  # generated schemas
667
667
  generated
668
+ `
669
+ },
670
+ {
671
+ path: "root/custom-objects/eslint.config.mts",
672
+ content: `import eslint from '@eslint/js';
673
+ import { defineConfig } from 'eslint/config';
674
+ import tseslint from 'typescript-eslint';
675
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
676
+
677
+ import globals from 'globals';
678
+
679
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
680
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
681
+
682
+ export default defineConfig([
683
+ eslint.configs.recommended,
684
+ ...tseslint.configs.recommended,
685
+ ...stripeAppsConfig,
686
+ ...customObjectsConfig,
687
+
688
+ // Global ignores
689
+ {
690
+ ignores: ['dist', 'generated', 'node_modules'],
691
+ },
692
+
693
+ // TypeScript source files (with type-checking)
694
+ {
695
+ name: 'sources',
696
+ files: ['src/**/*.ts'],
697
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
698
+ languageOptions: {
699
+ globals: {
700
+ ...globals.node,
701
+ },
702
+ parserOptions: {
703
+ projectService: true,
704
+ tsconfigRootDir: import.meta.dirname,
705
+ },
706
+ },
707
+ },
708
+
709
+ // Test files
710
+ {
711
+ name: 'tests',
712
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
713
+ languageOptions: {
714
+ globals: {
715
+ ...globals.node,
716
+ },
717
+ parserOptions: {
718
+ projectService: true,
719
+ tsconfigRootDir: import.meta.dirname,
720
+ },
721
+ },
722
+ },
723
+
724
+ // Config files
725
+ {
726
+ name: 'ts-configs',
727
+ files: ['*.config.m?ts', 'eslint.config.mts'],
728
+ languageOptions: {
729
+ globals: {
730
+ ...globals.node,
731
+ },
732
+ parserOptions: {
733
+ projectService: false,
734
+ },
735
+ },
736
+ rules: {
737
+ '@typescript-eslint/no-unused-vars': 'off',
738
+ },
739
+ },
740
+
741
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
742
+ // disable the TS-parser-specific rule that doesn't apply without it.
743
+ {
744
+ name: 'js-configs',
745
+ files: ['**/*.js', '**/*.mjs'],
746
+ languageOptions: {
747
+ globals: {
748
+ ...globals.node,
749
+ },
750
+ parserOptions: {
751
+ projectService: false,
752
+ },
753
+ },
754
+ rules: {
755
+ '@typescript-eslint/no-require-imports': 'off',
756
+ },
757
+ },
758
+
759
+ eslintConfigPrettier,
760
+ ]);
668
761
  `
669
762
  },
670
763
  {
@@ -677,7 +770,9 @@ generated
677
770
  "private": true,
678
771
  "scripts": {
679
772
  "build": "test -d src && custom-objects-build --input src --output dist || true",
773
+ "lint": "pnpm lint:types && pnpm lint:eslint",
680
774
  "lint:types": "test ! -d src || tsc --noEmit",
775
+ "lint:eslint": "eslint .",
681
776
  "test": "vitest run"
682
777
  },
683
778
  "dependencies": {
@@ -700,8 +795,20 @@ generated
700
795
  "moduleResolution": "bundler",
701
796
  "types": ["vitest/globals"]
702
797
  },
798
+ "include": ["src/**/*.ts"],
703
799
  "exclude": ["dist"]
704
800
  }
801
+ `
802
+ },
803
+ {
804
+ path: "root/custom-objects/vitest.config.mts",
805
+ content: `import { defineConfig } from 'vitest/config';
806
+
807
+ export default defineConfig({
808
+ test: {
809
+ globals: true,
810
+ },
811
+ });
705
812
  `
706
813
  },
707
814
  {
@@ -819,7 +926,7 @@ export default defineConfig([
819
926
  "build": "pnpm -r --if-present build",
820
927
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
821
928
  "lint:types": "pnpm -r --if-present lint:types",
822
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
929
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
823
930
  "lint:format": "prettier --check .",
824
931
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
825
932
  "fix:format": "prettier --write .",
@@ -848,6 +955,10 @@ export default defineConfig([
848
955
 
849
956
  overrides:
850
957
  vite: ^6.0.0
958
+
959
+ allowBuilds:
960
+ core-js-pure: false
961
+ esbuild: false
851
962
  `
852
963
  },
853
964
  {
@@ -865,7 +976,7 @@ declarations:
865
976
  content: `#!/usr/bin/env tsx
866
977
  /**
867
978
  * Runs tests across the workspace:
868
- * - vitest for script extensions and custom objects (extensions/*)
979
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
869
980
  * - jest for UI extensions (ui/)
870
981
  */
871
982
  import { existsSync, readdirSync } from 'node:fs';
@@ -875,6 +986,8 @@ const hasExtensions =
875
986
  existsSync('extensions') &&
876
987
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
877
988
 
989
+ const hasCustomObjects = existsSync('custom-objects/package.json');
990
+
878
991
  const hasUI = existsSync('ui/package.json');
879
992
 
880
993
  let exitCode = 0;
@@ -887,7 +1000,7 @@ function run(cmd: string): void {
887
1000
  }
888
1001
  }
889
1002
 
890
- if (hasExtensions) {
1003
+ if (hasExtensions || hasCustomObjects) {
891
1004
  run('vitest run');
892
1005
  }
893
1006
 
@@ -1572,8 +1685,30 @@ var _DependencyManager = class {
1572
1685
  }
1573
1686
  };
1574
1687
 
1688
+ // src/workspace-versions.json
1689
+ var workspace_versions_default = {
1690
+ "@stripe/extensibility-custom-objects": "1.0.0",
1691
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
1692
+ "@stripe/extensibility-dev-tools": "1.0.2",
1693
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
1694
+ "@stripe/extensibility-language-server": "1.0.0",
1695
+ "@stripe/extensibility-sdk": "1.0.0",
1696
+ "@stripe/extensibility-test-helpers": "1.0.0"
1697
+ };
1698
+
1699
+ // src/workspace-versions.ts
1700
+ var _workspaceVersions = workspace_versions_default;
1701
+ function _workspaceVersion(packageName) {
1702
+ const v = _workspaceVersions[packageName];
1703
+ if (v === void 0) {
1704
+ throw new Error(
1705
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1706
+ );
1707
+ }
1708
+ return v;
1709
+ }
1710
+
1575
1711
  // src/templates/extensions/base.ts
1576
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
1577
1712
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1578
1713
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1579
1714
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -1878,14 +2013,14 @@ var billing_bill_discount_calculation_default = {
1878
2013
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1879
2014
  };
1880
2015
 
1881
- // src/templates/extensions/billing.invoice_collection_setting.ts
1882
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1883
- var invoiceCollectionSettingTemplate = {
2016
+ // src/templates/extensions/billing.invoice_collection_options.ts
2017
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
2018
+ var invoiceCollectionOptionsTemplate = {
1884
2019
  hidden: true,
1885
2020
  methods: {
1886
- collection_override: { implementation_types: ["script"] }
2021
+ override_options: { implementation_types: ["script"] }
1887
2022
  },
1888
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
2023
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1889
2024
  generate: (params, context) => {
1890
2025
  const { id } = params;
1891
2026
  const { fs: fs2 } = context;
@@ -1913,15 +2048,15 @@ var invoiceCollectionSettingTemplate = {
1913
2048
  ...base.files
1914
2049
  ],
1915
2050
  methods: {
1916
- collection_override: {
2051
+ override_options: {
1917
2052
  implementation_type: "script"
1918
2053
  }
1919
2054
  }
1920
2055
  };
1921
2056
  }
1922
2057
  };
1923
- var billing_invoice_collection_setting_default = {
1924
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
2058
+ var billing_invoice_collection_options_default = {
2059
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1925
2060
  };
1926
2061
 
1927
2062
  // src/templates/extensions/billing.prorations.ts
@@ -2029,7 +2164,7 @@ var DEFAULT_TEMPLATES = {
2029
2164
  ...extend_workflows_custom_action_default,
2030
2165
  ...billing_customer_balance_application_default,
2031
2166
  ...billing_bill_discount_calculation_default,
2032
- ...billing_invoice_collection_setting_default,
2167
+ ...billing_invoice_collection_options_default,
2033
2168
  ...billing_prorations_default,
2034
2169
  ...billing_recurring_billing_item_handling_default
2035
2170
  };
@@ -3243,9 +3378,8 @@ async function toggleDiffContext(state, filePath, newContent, existingContent) {
3243
3378
  }
3244
3379
 
3245
3380
  // src/templates/root/index.ts
3246
- import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
3247
3381
  var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
3248
- var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion2(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
3382
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
3249
3383
  var _rootWorkspaceTemplate = {
3250
3384
  generate: (params, context) => {
3251
3385
  const { fs: fs2 } = context;
@@ -3300,14 +3434,14 @@ var _rootWorkspaceTemplate = {
3300
3434
  path: "custom-objects/package.json",
3301
3435
  content: fs2.mustache(
3302
3436
  {
3303
- customObjectsVersion: _workspaceVersion2(
3437
+ customObjectsVersion: _workspaceVersion(
3304
3438
  "@stripe/extensibility-custom-objects"
3305
3439
  ),
3306
- sdkVersion: _workspaceVersion2("@stripe/extensibility-sdk"),
3307
- customObjectsToolsVersion: _workspaceVersion2(
3440
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
3441
+ customObjectsToolsVersion: _workspaceVersion(
3308
3442
  "@stripe/extensibility-custom-objects-tools"
3309
3443
  ),
3310
- testHelpersVersion: _workspaceVersion2("@stripe/extensibility-test-helpers")
3444
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
3311
3445
  },
3312
3446
  "custom-objects",
3313
3447
  "package.json.mustache"
@@ -3319,6 +3453,16 @@ var _rootWorkspaceTemplate = {
3319
3453
  content: fs2.textFile("custom-objects/tsconfig.json"),
3320
3454
  precious: true
3321
3455
  },
3456
+ {
3457
+ path: "custom-objects/eslint.config.mts",
3458
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
3459
+ precious: true
3460
+ },
3461
+ {
3462
+ path: "custom-objects/vitest.config.mts",
3463
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
3464
+ precious: true
3465
+ },
3322
3466
  {
3323
3467
  path: "ui/package.json",
3324
3468
  content: fs2.textFile("ui/package.json"),
@@ -3345,7 +3489,7 @@ var _rootWorkspaceTemplate = {
3345
3489
  _devNpmDep("@types/node", "^20.19.0"),
3346
3490
  _devNpmDep(
3347
3491
  "@stripe/extensibility-dev-tools",
3348
- `^${_workspaceVersion2("@stripe/extensibility-dev-tools")}`
3492
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
3349
3493
  ),
3350
3494
  _devNpmDep("concurrently", "^9.2.1"),
3351
3495
  _devNpmDep("eslint", "^9.0.0"),
@@ -3543,9 +3687,9 @@ function resolveMode(options, projectRoot, packageDir) {
3543
3687
  workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
3544
3688
  generate: async (svc) => {
3545
3689
  const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
3546
- const workspaceExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json"));
3690
+ const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
3547
3691
  const objectResult = await svc.generateCustomObject({ name: objectName });
3548
- if (workspaceExists) {
3692
+ if (workspaceScaffoldingExists) {
3549
3693
  return objectResult;
3550
3694
  }
3551
3695
  const workspaceResult = await svc.generateCustomObjectsWorkspace({});