@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
@@ -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 .",
@@ -865,7 +972,7 @@ declarations:
865
972
  content: `#!/usr/bin/env tsx
866
973
  /**
867
974
  * Runs tests across the workspace:
868
- * - vitest for script extensions and custom objects (extensions/*)
975
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
869
976
  * - jest for UI extensions (ui/)
870
977
  */
871
978
  import { existsSync, readdirSync } from 'node:fs';
@@ -875,6 +982,8 @@ const hasExtensions =
875
982
  existsSync('extensions') &&
876
983
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
877
984
 
985
+ const hasCustomObjects = existsSync('custom-objects/package.json');
986
+
878
987
  const hasUI = existsSync('ui/package.json');
879
988
 
880
989
  let exitCode = 0;
@@ -887,7 +996,7 @@ function run(cmd: string): void {
887
996
  }
888
997
  }
889
998
 
890
- if (hasExtensions) {
999
+ if (hasExtensions || hasCustomObjects) {
891
1000
  run('vitest run');
892
1001
  }
893
1002
 
@@ -1572,8 +1681,30 @@ var _DependencyManager = class {
1572
1681
  }
1573
1682
  };
1574
1683
 
1684
+ // src/workspace-versions.json
1685
+ var workspace_versions_default = {
1686
+ "@stripe/extensibility-custom-objects": "0.8.0",
1687
+ "@stripe/extensibility-custom-objects-tools": "0.42.1",
1688
+ "@stripe/extensibility-dev-tools": "0.25.1",
1689
+ "@stripe/extensibility-eslint-plugin": "0.17.1",
1690
+ "@stripe/extensibility-language-server": "0.3.4",
1691
+ "@stripe/extensibility-sdk": "0.27.1",
1692
+ "@stripe/extensibility-test-helpers": "0.2.7"
1693
+ };
1694
+
1695
+ // src/workspace-versions.ts
1696
+ var _workspaceVersions = workspace_versions_default;
1697
+ function _workspaceVersion(packageName) {
1698
+ const v = _workspaceVersions[packageName];
1699
+ if (v === void 0) {
1700
+ throw new Error(
1701
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1702
+ );
1703
+ }
1704
+ return v;
1705
+ }
1706
+
1575
1707
  // src/templates/extensions/base.ts
1576
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
1577
1708
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1578
1709
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1579
1710
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -1878,14 +2009,14 @@ var billing_bill_discount_calculation_default = {
1878
2009
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1879
2010
  };
1880
2011
 
1881
- // src/templates/extensions/billing.invoice_collection_setting.ts
1882
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1883
- var invoiceCollectionSettingTemplate = {
2012
+ // src/templates/extensions/billing.invoice_collection_options.ts
2013
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
2014
+ var invoiceCollectionOptionsTemplate = {
1884
2015
  hidden: true,
1885
2016
  methods: {
1886
- collection_override: { implementation_types: ["script"] }
2017
+ override_options: { implementation_types: ["script"] }
1887
2018
  },
1888
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
2019
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1889
2020
  generate: (params, context) => {
1890
2021
  const { id } = params;
1891
2022
  const { fs: fs2 } = context;
@@ -1913,15 +2044,15 @@ var invoiceCollectionSettingTemplate = {
1913
2044
  ...base.files
1914
2045
  ],
1915
2046
  methods: {
1916
- collection_override: {
2047
+ override_options: {
1917
2048
  implementation_type: "script"
1918
2049
  }
1919
2050
  }
1920
2051
  };
1921
2052
  }
1922
2053
  };
1923
- var billing_invoice_collection_setting_default = {
1924
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
2054
+ var billing_invoice_collection_options_default = {
2055
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1925
2056
  };
1926
2057
 
1927
2058
  // src/templates/extensions/billing.prorations.ts
@@ -2029,7 +2160,7 @@ var DEFAULT_TEMPLATES = {
2029
2160
  ...extend_workflows_custom_action_default,
2030
2161
  ...billing_customer_balance_application_default,
2031
2162
  ...billing_bill_discount_calculation_default,
2032
- ...billing_invoice_collection_setting_default,
2163
+ ...billing_invoice_collection_options_default,
2033
2164
  ...billing_prorations_default,
2034
2165
  ...billing_recurring_billing_item_handling_default
2035
2166
  };
@@ -3243,9 +3374,8 @@ async function toggleDiffContext(state, filePath, newContent, existingContent) {
3243
3374
  }
3244
3375
 
3245
3376
  // src/templates/root/index.ts
3246
- import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
3247
3377
  var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
3248
- var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion2(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
3378
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
3249
3379
  var _rootWorkspaceTemplate = {
3250
3380
  generate: (params, context) => {
3251
3381
  const { fs: fs2 } = context;
@@ -3300,14 +3430,14 @@ var _rootWorkspaceTemplate = {
3300
3430
  path: "custom-objects/package.json",
3301
3431
  content: fs2.mustache(
3302
3432
  {
3303
- customObjectsVersion: _workspaceVersion2(
3433
+ customObjectsVersion: _workspaceVersion(
3304
3434
  "@stripe/extensibility-custom-objects"
3305
3435
  ),
3306
- sdkVersion: _workspaceVersion2("@stripe/extensibility-sdk"),
3307
- customObjectsToolsVersion: _workspaceVersion2(
3436
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
3437
+ customObjectsToolsVersion: _workspaceVersion(
3308
3438
  "@stripe/extensibility-custom-objects-tools"
3309
3439
  ),
3310
- testHelpersVersion: _workspaceVersion2("@stripe/extensibility-test-helpers")
3440
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
3311
3441
  },
3312
3442
  "custom-objects",
3313
3443
  "package.json.mustache"
@@ -3319,6 +3449,16 @@ var _rootWorkspaceTemplate = {
3319
3449
  content: fs2.textFile("custom-objects/tsconfig.json"),
3320
3450
  precious: true
3321
3451
  },
3452
+ {
3453
+ path: "custom-objects/eslint.config.mts",
3454
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
3455
+ precious: true
3456
+ },
3457
+ {
3458
+ path: "custom-objects/vitest.config.mts",
3459
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
3460
+ precious: true
3461
+ },
3322
3462
  {
3323
3463
  path: "ui/package.json",
3324
3464
  content: fs2.textFile("ui/package.json"),
@@ -3345,7 +3485,7 @@ var _rootWorkspaceTemplate = {
3345
3485
  _devNpmDep("@types/node", "^20.19.0"),
3346
3486
  _devNpmDep(
3347
3487
  "@stripe/extensibility-dev-tools",
3348
- `^${_workspaceVersion2("@stripe/extensibility-dev-tools")}`
3488
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
3349
3489
  ),
3350
3490
  _devNpmDep("concurrently", "^9.2.1"),
3351
3491
  _devNpmDep("eslint", "^9.0.0"),
@@ -3543,9 +3683,9 @@ function resolveMode(options, projectRoot, packageDir) {
3543
3683
  workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
3544
3684
  generate: async (svc) => {
3545
3685
  const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
3546
- const workspaceExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json"));
3686
+ const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
3547
3687
  const objectResult = await svc.generateCustomObject({ name: objectName });
3548
- if (workspaceExists) {
3688
+ if (workspaceScaffoldingExists) {
3549
3689
  return objectResult;
3550
3690
  }
3551
3691
  const workspaceResult = await svc.generateCustomObjectsWorkspace({});