@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
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/bin/build-custom-object-definitions.ts
27
- var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
27
+ var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
28
28
 
29
29
  // src/custom-objects/build-definitions.ts
30
30
  var fs2 = __toESM(require("fs"), 1);
@@ -388,35 +388,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
388
388
  `
389
389
  },
390
390
  {
391
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
391
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
392
392
  content: `import { beforeEach, describe, it, expect } from 'vitest';
393
393
 
394
- import MyInvoiceCollectionSetting from './index.js';
394
+ import MyInvoiceCollectionOptions from './index.js';
395
395
 
396
- describe('MyInvoiceCollectionSetting', () => {
397
- let instance: MyInvoiceCollectionSetting;
396
+ describe('MyInvoiceCollectionOptions', () => {
397
+ let instance: MyInvoiceCollectionOptions;
398
398
 
399
399
  beforeEach(() => {
400
- instance = new MyInvoiceCollectionSetting();
400
+ instance = new MyInvoiceCollectionOptions();
401
401
  });
402
402
 
403
403
  it('should be constructable', () => {
404
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
404
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
405
405
  });
406
406
  });
407
407
  `
408
408
  },
409
409
  {
410
- path: "extensions/billing.invoice_collection_setting/index.ts",
410
+ path: "extensions/billing.invoice_collection_options/index.ts",
411
411
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
412
412
 
413
413
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
414
- interface MyInvoiceCollectionSettingConfig {}
414
+ interface MyInvoiceCollectionOptionsConfig {}
415
415
 
416
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
417
- collectionOverride(
418
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
419
- _config: MyInvoiceCollectionSettingConfig,
416
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
417
+ overrideOptions(
418
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
419
+ _config: MyInvoiceCollectionOptionsConfig,
420
420
  _context: Context
421
421
  ) {
422
422
  // TODO: implement your collection setting logic here
@@ -888,6 +888,99 @@ install-deps.log
888
888
 
889
889
  # generated schemas
890
890
  generated
891
+ `
892
+ },
893
+ {
894
+ path: "root/custom-objects/eslint.config.mts",
895
+ content: `import eslint from '@eslint/js';
896
+ import { defineConfig } from 'eslint/config';
897
+ import tseslint from 'typescript-eslint';
898
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
899
+
900
+ import globals from 'globals';
901
+
902
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
903
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
904
+
905
+ export default defineConfig([
906
+ eslint.configs.recommended,
907
+ ...tseslint.configs.recommended,
908
+ ...stripeAppsConfig,
909
+ ...customObjectsConfig,
910
+
911
+ // Global ignores
912
+ {
913
+ ignores: ['dist', 'generated', 'node_modules'],
914
+ },
915
+
916
+ // TypeScript source files (with type-checking)
917
+ {
918
+ name: 'sources',
919
+ files: ['src/**/*.ts'],
920
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
921
+ languageOptions: {
922
+ globals: {
923
+ ...globals.node,
924
+ },
925
+ parserOptions: {
926
+ projectService: true,
927
+ tsconfigRootDir: import.meta.dirname,
928
+ },
929
+ },
930
+ },
931
+
932
+ // Test files
933
+ {
934
+ name: 'tests',
935
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
936
+ languageOptions: {
937
+ globals: {
938
+ ...globals.node,
939
+ },
940
+ parserOptions: {
941
+ projectService: true,
942
+ tsconfigRootDir: import.meta.dirname,
943
+ },
944
+ },
945
+ },
946
+
947
+ // Config files
948
+ {
949
+ name: 'ts-configs',
950
+ files: ['*.config.m?ts', 'eslint.config.mts'],
951
+ languageOptions: {
952
+ globals: {
953
+ ...globals.node,
954
+ },
955
+ parserOptions: {
956
+ projectService: false,
957
+ },
958
+ },
959
+ rules: {
960
+ '@typescript-eslint/no-unused-vars': 'off',
961
+ },
962
+ },
963
+
964
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
965
+ // disable the TS-parser-specific rule that doesn't apply without it.
966
+ {
967
+ name: 'js-configs',
968
+ files: ['**/*.js', '**/*.mjs'],
969
+ languageOptions: {
970
+ globals: {
971
+ ...globals.node,
972
+ },
973
+ parserOptions: {
974
+ projectService: false,
975
+ },
976
+ },
977
+ rules: {
978
+ '@typescript-eslint/no-require-imports': 'off',
979
+ },
980
+ },
981
+
982
+ eslintConfigPrettier,
983
+ ]);
891
984
  `
892
985
  },
893
986
  {
@@ -900,7 +993,9 @@ generated
900
993
  "private": true,
901
994
  "scripts": {
902
995
  "build": "test -d src && custom-objects-build --input src --output dist || true",
996
+ "lint": "pnpm lint:types && pnpm lint:eslint",
903
997
  "lint:types": "test ! -d src || tsc --noEmit",
998
+ "lint:eslint": "eslint .",
904
999
  "test": "vitest run"
905
1000
  },
906
1001
  "dependencies": {
@@ -923,8 +1018,20 @@ generated
923
1018
  "moduleResolution": "bundler",
924
1019
  "types": ["vitest/globals"]
925
1020
  },
1021
+ "include": ["src/**/*.ts"],
926
1022
  "exclude": ["dist"]
927
1023
  }
1024
+ `
1025
+ },
1026
+ {
1027
+ path: "root/custom-objects/vitest.config.mts",
1028
+ content: `import { defineConfig } from 'vitest/config';
1029
+
1030
+ export default defineConfig({
1031
+ test: {
1032
+ globals: true,
1033
+ },
1034
+ });
928
1035
  `
929
1036
  },
930
1037
  {
@@ -1042,7 +1149,7 @@ export default defineConfig([
1042
1149
  "build": "pnpm -r --if-present build",
1043
1150
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
1044
1151
  "lint:types": "pnpm -r --if-present lint:types",
1045
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
1152
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
1046
1153
  "lint:format": "prettier --check .",
1047
1154
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
1048
1155
  "fix:format": "prettier --write .",
@@ -1071,6 +1178,10 @@ export default defineConfig([
1071
1178
 
1072
1179
  overrides:
1073
1180
  vite: ^6.0.0
1181
+
1182
+ allowBuilds:
1183
+ core-js-pure: false
1184
+ esbuild: false
1074
1185
  `
1075
1186
  },
1076
1187
  {
@@ -1088,7 +1199,7 @@ declarations:
1088
1199
  content: `#!/usr/bin/env tsx
1089
1200
  /**
1090
1201
  * Runs tests across the workspace:
1091
- * - vitest for script extensions and custom objects (extensions/*)
1202
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1092
1203
  * - jest for UI extensions (ui/)
1093
1204
  */
1094
1205
  import { existsSync, readdirSync } from 'node:fs';
@@ -1098,6 +1209,8 @@ const hasExtensions =
1098
1209
  existsSync('extensions') &&
1099
1210
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1100
1211
 
1212
+ const hasCustomObjects = existsSync('custom-objects/package.json');
1213
+
1101
1214
  const hasUI = existsSync('ui/package.json');
1102
1215
 
1103
1216
  let exitCode = 0;
@@ -1110,7 +1223,7 @@ function run(cmd: string): void {
1110
1223
  }
1111
1224
  }
1112
1225
 
1113
- if (hasExtensions) {
1226
+ if (hasExtensions || hasCustomObjects) {
1114
1227
  run('vitest run');
1115
1228
  }
1116
1229
 
@@ -1262,11 +1375,33 @@ function _devNpmDep(name, version) {
1262
1375
  return { type: "dev-npm", name, version };
1263
1376
  }
1264
1377
 
1378
+ // src/workspace-versions.json
1379
+ var workspace_versions_default = {
1380
+ "@stripe/extensibility-custom-objects": "1.0.0",
1381
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
1382
+ "@stripe/extensibility-dev-tools": "1.0.2",
1383
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
1384
+ "@stripe/extensibility-language-server": "1.0.0",
1385
+ "@stripe/extensibility-sdk": "1.0.0",
1386
+ "@stripe/extensibility-test-helpers": "1.0.0"
1387
+ };
1388
+
1389
+ // src/workspace-versions.ts
1390
+ var _workspaceVersions = workspace_versions_default;
1391
+ function _workspaceVersion(packageName) {
1392
+ const v = _workspaceVersions[packageName];
1393
+ if (v === void 0) {
1394
+ throw new Error(
1395
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1396
+ );
1397
+ }
1398
+ return v;
1399
+ }
1400
+
1265
1401
  // src/templates/extensions/base.ts
1266
- var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
1267
1402
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1268
1403
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1269
- var LANGUAGE_SERVER_PACKAGE_VERSION = `^${(0, import_extensibility_tool_utils6._workspaceVersion)(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1404
+ var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1270
1405
  function _createExtensionEslintConfigFile(params, context) {
1271
1406
  const { id, extensionInterfaceId } = params;
1272
1407
  const { fs: fs3 } = context;
@@ -1309,7 +1444,7 @@ function _createBaseOutput(params, context) {
1309
1444
  dependencies: {
1310
1445
  // Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
1311
1446
  // must match the version that generated the extension scaffolding.
1312
- runtime: [_npmDep(SDK_PACKAGE_NAME, (0, import_extensibility_tool_utils6._workspaceVersion)(SDK_PACKAGE_NAME))],
1447
+ runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
1313
1448
  dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
1314
1449
  },
1315
1450
  postGenerationHooks: [
@@ -1568,14 +1703,14 @@ var billing_bill_discount_calculation_default = {
1568
1703
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1569
1704
  };
1570
1705
 
1571
- // src/templates/extensions/billing.invoice_collection_setting.ts
1572
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1573
- var invoiceCollectionSettingTemplate = {
1706
+ // src/templates/extensions/billing.invoice_collection_options.ts
1707
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
1708
+ var invoiceCollectionOptionsTemplate = {
1574
1709
  hidden: true,
1575
1710
  methods: {
1576
- collection_override: { implementation_types: ["script"] }
1711
+ override_options: { implementation_types: ["script"] }
1577
1712
  },
1578
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
1713
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1579
1714
  generate: (params, context) => {
1580
1715
  const { id } = params;
1581
1716
  const { fs: fs3 } = context;
@@ -1603,15 +1738,15 @@ var invoiceCollectionSettingTemplate = {
1603
1738
  ...base.files
1604
1739
  ],
1605
1740
  methods: {
1606
- collection_override: {
1741
+ override_options: {
1607
1742
  implementation_type: "script"
1608
1743
  }
1609
1744
  }
1610
1745
  };
1611
1746
  }
1612
1747
  };
1613
- var billing_invoice_collection_setting_default = {
1614
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
1748
+ var billing_invoice_collection_options_default = {
1749
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1615
1750
  };
1616
1751
 
1617
1752
  // src/templates/extensions/billing.prorations.ts
@@ -1719,7 +1854,7 @@ var DEFAULT_TEMPLATES = {
1719
1854
  ...extend_workflows_custom_action_default,
1720
1855
  ...billing_customer_balance_application_default,
1721
1856
  ...billing_bill_discount_calculation_default,
1722
- ...billing_invoice_collection_setting_default,
1857
+ ...billing_invoice_collection_options_default,
1723
1858
  ...billing_prorations_default,
1724
1859
  ...billing_recurring_billing_item_handling_default
1725
1860
  };
@@ -1945,9 +2080,9 @@ function toDefaultValue(value, dataType) {
1945
2080
  }
1946
2081
 
1947
2082
  // src/custom-objects/build-definitions.ts
1948
- var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
2083
+ var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
1949
2084
  async function analyzeAndInjectManifest(options) {
1950
- const context = options.context ?? (0, import_extensibility_tool_utils7._createCliContext)();
2085
+ const context = options.context ?? (0, import_extensibility_tool_utils6._createCliContext)();
1951
2086
  const manifestPath = options.manifestPath ?? "stripe-app.yaml";
1952
2087
  const projectRoot = options.projectRoot ?? path2.dirname(path2.resolve(manifestPath));
1953
2088
  const resolvedManifestPath = path2.resolve(manifestPath);
@@ -2032,7 +2167,7 @@ async function analyzeAndInjectManifest(options) {
2032
2167
  };
2033
2168
  }
2034
2169
  async function writeCustomObjectArtifacts(options, state) {
2035
- const context = options.context ?? (0, import_extensibility_tool_utils7._createCliContext)();
2170
+ const context = options.context ?? (0, import_extensibility_tool_utils6._createCliContext)();
2036
2171
  const targetPath = path2.resolve(options.targetPath);
2037
2172
  const { packageBuild, customObjects, coVersion, coDependencies, projectRoot } = state;
2038
2173
  for (const obj of customObjects) {
@@ -2122,10 +2257,10 @@ function readPackageDependencies(packageJsonPath) {
2122
2257
  }
2123
2258
 
2124
2259
  // src/bin/build-custom-object-definitions.ts
2125
- var import_extensibility_tool_utils9 = require("@stripe/extensibility-tool-utils");
2126
- var logger = (0, import_extensibility_tool_utils8._createLogger)({ name: "build-definitions" });
2260
+ var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
2261
+ var logger = (0, import_extensibility_tool_utils7._createLogger)({ name: "build-definitions" });
2127
2262
  async function main() {
2128
- const ctx = (0, import_extensibility_tool_utils9._createCliContext)();
2263
+ const ctx = (0, import_extensibility_tool_utils8._createCliContext)();
2129
2264
  const [targetPath, manifestPath] = process.argv.slice(2);
2130
2265
  if (!targetPath) {
2131
2266
  ctx.ux.error("Usage: build-custom-object-definitions <target-path> [manifest-path]");
@@ -365,35 +365,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
365
365
  `
366
366
  },
367
367
  {
368
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
368
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
369
369
  content: `import { beforeEach, describe, it, expect } from 'vitest';
370
370
 
371
- import MyInvoiceCollectionSetting from './index.js';
371
+ import MyInvoiceCollectionOptions from './index.js';
372
372
 
373
- describe('MyInvoiceCollectionSetting', () => {
374
- let instance: MyInvoiceCollectionSetting;
373
+ describe('MyInvoiceCollectionOptions', () => {
374
+ let instance: MyInvoiceCollectionOptions;
375
375
 
376
376
  beforeEach(() => {
377
- instance = new MyInvoiceCollectionSetting();
377
+ instance = new MyInvoiceCollectionOptions();
378
378
  });
379
379
 
380
380
  it('should be constructable', () => {
381
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
381
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
382
382
  });
383
383
  });
384
384
  `
385
385
  },
386
386
  {
387
- path: "extensions/billing.invoice_collection_setting/index.ts",
387
+ path: "extensions/billing.invoice_collection_options/index.ts",
388
388
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
389
389
 
390
390
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
391
- interface MyInvoiceCollectionSettingConfig {}
391
+ interface MyInvoiceCollectionOptionsConfig {}
392
392
 
393
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
394
- collectionOverride(
395
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
396
- _config: MyInvoiceCollectionSettingConfig,
393
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
394
+ overrideOptions(
395
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
396
+ _config: MyInvoiceCollectionOptionsConfig,
397
397
  _context: Context
398
398
  ) {
399
399
  // TODO: implement your collection setting logic here
@@ -865,6 +865,99 @@ install-deps.log
865
865
 
866
866
  # generated schemas
867
867
  generated
868
+ `
869
+ },
870
+ {
871
+ path: "root/custom-objects/eslint.config.mts",
872
+ content: `import eslint from '@eslint/js';
873
+ import { defineConfig } from 'eslint/config';
874
+ import tseslint from 'typescript-eslint';
875
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
876
+
877
+ import globals from 'globals';
878
+
879
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
880
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
881
+
882
+ export default defineConfig([
883
+ eslint.configs.recommended,
884
+ ...tseslint.configs.recommended,
885
+ ...stripeAppsConfig,
886
+ ...customObjectsConfig,
887
+
888
+ // Global ignores
889
+ {
890
+ ignores: ['dist', 'generated', 'node_modules'],
891
+ },
892
+
893
+ // TypeScript source files (with type-checking)
894
+ {
895
+ name: 'sources',
896
+ files: ['src/**/*.ts'],
897
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
898
+ languageOptions: {
899
+ globals: {
900
+ ...globals.node,
901
+ },
902
+ parserOptions: {
903
+ projectService: true,
904
+ tsconfigRootDir: import.meta.dirname,
905
+ },
906
+ },
907
+ },
908
+
909
+ // Test files
910
+ {
911
+ name: 'tests',
912
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
913
+ languageOptions: {
914
+ globals: {
915
+ ...globals.node,
916
+ },
917
+ parserOptions: {
918
+ projectService: true,
919
+ tsconfigRootDir: import.meta.dirname,
920
+ },
921
+ },
922
+ },
923
+
924
+ // Config files
925
+ {
926
+ name: 'ts-configs',
927
+ files: ['*.config.m?ts', 'eslint.config.mts'],
928
+ languageOptions: {
929
+ globals: {
930
+ ...globals.node,
931
+ },
932
+ parserOptions: {
933
+ projectService: false,
934
+ },
935
+ },
936
+ rules: {
937
+ '@typescript-eslint/no-unused-vars': 'off',
938
+ },
939
+ },
940
+
941
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
942
+ // disable the TS-parser-specific rule that doesn't apply without it.
943
+ {
944
+ name: 'js-configs',
945
+ files: ['**/*.js', '**/*.mjs'],
946
+ languageOptions: {
947
+ globals: {
948
+ ...globals.node,
949
+ },
950
+ parserOptions: {
951
+ projectService: false,
952
+ },
953
+ },
954
+ rules: {
955
+ '@typescript-eslint/no-require-imports': 'off',
956
+ },
957
+ },
958
+
959
+ eslintConfigPrettier,
960
+ ]);
868
961
  `
869
962
  },
870
963
  {
@@ -877,7 +970,9 @@ generated
877
970
  "private": true,
878
971
  "scripts": {
879
972
  "build": "test -d src && custom-objects-build --input src --output dist || true",
973
+ "lint": "pnpm lint:types && pnpm lint:eslint",
880
974
  "lint:types": "test ! -d src || tsc --noEmit",
975
+ "lint:eslint": "eslint .",
881
976
  "test": "vitest run"
882
977
  },
883
978
  "dependencies": {
@@ -900,8 +995,20 @@ generated
900
995
  "moduleResolution": "bundler",
901
996
  "types": ["vitest/globals"]
902
997
  },
998
+ "include": ["src/**/*.ts"],
903
999
  "exclude": ["dist"]
904
1000
  }
1001
+ `
1002
+ },
1003
+ {
1004
+ path: "root/custom-objects/vitest.config.mts",
1005
+ content: `import { defineConfig } from 'vitest/config';
1006
+
1007
+ export default defineConfig({
1008
+ test: {
1009
+ globals: true,
1010
+ },
1011
+ });
905
1012
  `
906
1013
  },
907
1014
  {
@@ -1019,7 +1126,7 @@ export default defineConfig([
1019
1126
  "build": "pnpm -r --if-present build",
1020
1127
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
1021
1128
  "lint:types": "pnpm -r --if-present lint:types",
1022
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
1129
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
1023
1130
  "lint:format": "prettier --check .",
1024
1131
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
1025
1132
  "fix:format": "prettier --write .",
@@ -1048,6 +1155,10 @@ export default defineConfig([
1048
1155
 
1049
1156
  overrides:
1050
1157
  vite: ^6.0.0
1158
+
1159
+ allowBuilds:
1160
+ core-js-pure: false
1161
+ esbuild: false
1051
1162
  `
1052
1163
  },
1053
1164
  {
@@ -1065,7 +1176,7 @@ declarations:
1065
1176
  content: `#!/usr/bin/env tsx
1066
1177
  /**
1067
1178
  * Runs tests across the workspace:
1068
- * - vitest for script extensions and custom objects (extensions/*)
1179
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1069
1180
  * - jest for UI extensions (ui/)
1070
1181
  */
1071
1182
  import { existsSync, readdirSync } from 'node:fs';
@@ -1075,6 +1186,8 @@ const hasExtensions =
1075
1186
  existsSync('extensions') &&
1076
1187
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1077
1188
 
1189
+ const hasCustomObjects = existsSync('custom-objects/package.json');
1190
+
1078
1191
  const hasUI = existsSync('ui/package.json');
1079
1192
 
1080
1193
  let exitCode = 0;
@@ -1087,7 +1200,7 @@ function run(cmd: string): void {
1087
1200
  }
1088
1201
  }
1089
1202
 
1090
- if (hasExtensions) {
1203
+ if (hasExtensions || hasCustomObjects) {
1091
1204
  run('vitest run');
1092
1205
  }
1093
1206
 
@@ -1239,8 +1352,30 @@ function _devNpmDep(name, version) {
1239
1352
  return { type: "dev-npm", name, version };
1240
1353
  }
1241
1354
 
1355
+ // src/workspace-versions.json
1356
+ var workspace_versions_default = {
1357
+ "@stripe/extensibility-custom-objects": "1.0.0",
1358
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
1359
+ "@stripe/extensibility-dev-tools": "1.0.2",
1360
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
1361
+ "@stripe/extensibility-language-server": "1.0.0",
1362
+ "@stripe/extensibility-sdk": "1.0.0",
1363
+ "@stripe/extensibility-test-helpers": "1.0.0"
1364
+ };
1365
+
1366
+ // src/workspace-versions.ts
1367
+ var _workspaceVersions = workspace_versions_default;
1368
+ function _workspaceVersion(packageName) {
1369
+ const v = _workspaceVersions[packageName];
1370
+ if (v === void 0) {
1371
+ throw new Error(
1372
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1373
+ );
1374
+ }
1375
+ return v;
1376
+ }
1377
+
1242
1378
  // src/templates/extensions/base.ts
1243
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
1244
1379
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1245
1380
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1246
1381
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -1545,14 +1680,14 @@ var billing_bill_discount_calculation_default = {
1545
1680
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1546
1681
  };
1547
1682
 
1548
- // src/templates/extensions/billing.invoice_collection_setting.ts
1549
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1550
- var invoiceCollectionSettingTemplate = {
1683
+ // src/templates/extensions/billing.invoice_collection_options.ts
1684
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
1685
+ var invoiceCollectionOptionsTemplate = {
1551
1686
  hidden: true,
1552
1687
  methods: {
1553
- collection_override: { implementation_types: ["script"] }
1688
+ override_options: { implementation_types: ["script"] }
1554
1689
  },
1555
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
1690
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1556
1691
  generate: (params, context) => {
1557
1692
  const { id } = params;
1558
1693
  const { fs: fs3 } = context;
@@ -1580,15 +1715,15 @@ var invoiceCollectionSettingTemplate = {
1580
1715
  ...base.files
1581
1716
  ],
1582
1717
  methods: {
1583
- collection_override: {
1718
+ override_options: {
1584
1719
  implementation_type: "script"
1585
1720
  }
1586
1721
  }
1587
1722
  };
1588
1723
  }
1589
1724
  };
1590
- var billing_invoice_collection_setting_default = {
1591
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
1725
+ var billing_invoice_collection_options_default = {
1726
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1592
1727
  };
1593
1728
 
1594
1729
  // src/templates/extensions/billing.prorations.ts
@@ -1696,7 +1831,7 @@ var DEFAULT_TEMPLATES = {
1696
1831
  ...extend_workflows_custom_action_default,
1697
1832
  ...billing_customer_balance_application_default,
1698
1833
  ...billing_bill_discount_calculation_default,
1699
- ...billing_invoice_collection_setting_default,
1834
+ ...billing_invoice_collection_options_default,
1700
1835
  ...billing_prorations_default,
1701
1836
  ...billing_recurring_billing_item_handling_default
1702
1837
  };