@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
@@ -28,7 +28,7 @@ var import_node_child_process2 = require("child_process");
28
28
  var fs3 = __toESM(require("fs"), 1);
29
29
  var os2 = __toESM(require("os"), 1);
30
30
  var path3 = __toESM(require("path"), 1);
31
- var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
31
+ var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
32
32
 
33
33
  // src/custom-objects/build-definitions.ts
34
34
  var fs2 = __toESM(require("fs"), 1);
@@ -392,35 +392,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
392
392
  `
393
393
  },
394
394
  {
395
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
395
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
396
396
  content: `import { beforeEach, describe, it, expect } from 'vitest';
397
397
 
398
- import MyInvoiceCollectionSetting from './index.js';
398
+ import MyInvoiceCollectionOptions from './index.js';
399
399
 
400
- describe('MyInvoiceCollectionSetting', () => {
401
- let instance: MyInvoiceCollectionSetting;
400
+ describe('MyInvoiceCollectionOptions', () => {
401
+ let instance: MyInvoiceCollectionOptions;
402
402
 
403
403
  beforeEach(() => {
404
- instance = new MyInvoiceCollectionSetting();
404
+ instance = new MyInvoiceCollectionOptions();
405
405
  });
406
406
 
407
407
  it('should be constructable', () => {
408
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
408
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
409
409
  });
410
410
  });
411
411
  `
412
412
  },
413
413
  {
414
- path: "extensions/billing.invoice_collection_setting/index.ts",
414
+ path: "extensions/billing.invoice_collection_options/index.ts",
415
415
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
416
416
 
417
417
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
418
- interface MyInvoiceCollectionSettingConfig {}
418
+ interface MyInvoiceCollectionOptionsConfig {}
419
419
 
420
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
421
- collectionOverride(
422
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
423
- _config: MyInvoiceCollectionSettingConfig,
420
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
421
+ overrideOptions(
422
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
423
+ _config: MyInvoiceCollectionOptionsConfig,
424
424
  _context: Context
425
425
  ) {
426
426
  // TODO: implement your collection setting logic here
@@ -892,6 +892,99 @@ install-deps.log
892
892
 
893
893
  # generated schemas
894
894
  generated
895
+ `
896
+ },
897
+ {
898
+ path: "root/custom-objects/eslint.config.mts",
899
+ content: `import eslint from '@eslint/js';
900
+ import { defineConfig } from 'eslint/config';
901
+ import tseslint from 'typescript-eslint';
902
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
903
+
904
+ import globals from 'globals';
905
+
906
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
907
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
908
+
909
+ export default defineConfig([
910
+ eslint.configs.recommended,
911
+ ...tseslint.configs.recommended,
912
+ ...stripeAppsConfig,
913
+ ...customObjectsConfig,
914
+
915
+ // Global ignores
916
+ {
917
+ ignores: ['dist', 'generated', 'node_modules'],
918
+ },
919
+
920
+ // TypeScript source files (with type-checking)
921
+ {
922
+ name: 'sources',
923
+ files: ['src/**/*.ts'],
924
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
925
+ languageOptions: {
926
+ globals: {
927
+ ...globals.node,
928
+ },
929
+ parserOptions: {
930
+ projectService: true,
931
+ tsconfigRootDir: import.meta.dirname,
932
+ },
933
+ },
934
+ },
935
+
936
+ // Test files
937
+ {
938
+ name: 'tests',
939
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
940
+ languageOptions: {
941
+ globals: {
942
+ ...globals.node,
943
+ },
944
+ parserOptions: {
945
+ projectService: true,
946
+ tsconfigRootDir: import.meta.dirname,
947
+ },
948
+ },
949
+ },
950
+
951
+ // Config files
952
+ {
953
+ name: 'ts-configs',
954
+ files: ['*.config.m?ts', 'eslint.config.mts'],
955
+ languageOptions: {
956
+ globals: {
957
+ ...globals.node,
958
+ },
959
+ parserOptions: {
960
+ projectService: false,
961
+ },
962
+ },
963
+ rules: {
964
+ '@typescript-eslint/no-unused-vars': 'off',
965
+ },
966
+ },
967
+
968
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
969
+ // disable the TS-parser-specific rule that doesn't apply without it.
970
+ {
971
+ name: 'js-configs',
972
+ files: ['**/*.js', '**/*.mjs'],
973
+ languageOptions: {
974
+ globals: {
975
+ ...globals.node,
976
+ },
977
+ parserOptions: {
978
+ projectService: false,
979
+ },
980
+ },
981
+ rules: {
982
+ '@typescript-eslint/no-require-imports': 'off',
983
+ },
984
+ },
985
+
986
+ eslintConfigPrettier,
987
+ ]);
895
988
  `
896
989
  },
897
990
  {
@@ -904,7 +997,9 @@ generated
904
997
  "private": true,
905
998
  "scripts": {
906
999
  "build": "test -d src && custom-objects-build --input src --output dist || true",
1000
+ "lint": "pnpm lint:types && pnpm lint:eslint",
907
1001
  "lint:types": "test ! -d src || tsc --noEmit",
1002
+ "lint:eslint": "eslint .",
908
1003
  "test": "vitest run"
909
1004
  },
910
1005
  "dependencies": {
@@ -927,8 +1022,20 @@ generated
927
1022
  "moduleResolution": "bundler",
928
1023
  "types": ["vitest/globals"]
929
1024
  },
1025
+ "include": ["src/**/*.ts"],
930
1026
  "exclude": ["dist"]
931
1027
  }
1028
+ `
1029
+ },
1030
+ {
1031
+ path: "root/custom-objects/vitest.config.mts",
1032
+ content: `import { defineConfig } from 'vitest/config';
1033
+
1034
+ export default defineConfig({
1035
+ test: {
1036
+ globals: true,
1037
+ },
1038
+ });
932
1039
  `
933
1040
  },
934
1041
  {
@@ -1046,7 +1153,7 @@ export default defineConfig([
1046
1153
  "build": "pnpm -r --if-present build",
1047
1154
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
1048
1155
  "lint:types": "pnpm -r --if-present lint:types",
1049
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
1156
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
1050
1157
  "lint:format": "prettier --check .",
1051
1158
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
1052
1159
  "fix:format": "prettier --write .",
@@ -1075,6 +1182,10 @@ export default defineConfig([
1075
1182
 
1076
1183
  overrides:
1077
1184
  vite: ^6.0.0
1185
+
1186
+ allowBuilds:
1187
+ core-js-pure: false
1188
+ esbuild: false
1078
1189
  `
1079
1190
  },
1080
1191
  {
@@ -1092,7 +1203,7 @@ declarations:
1092
1203
  content: `#!/usr/bin/env tsx
1093
1204
  /**
1094
1205
  * Runs tests across the workspace:
1095
- * - vitest for script extensions and custom objects (extensions/*)
1206
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1096
1207
  * - jest for UI extensions (ui/)
1097
1208
  */
1098
1209
  import { existsSync, readdirSync } from 'node:fs';
@@ -1102,6 +1213,8 @@ const hasExtensions =
1102
1213
  existsSync('extensions') &&
1103
1214
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1104
1215
 
1216
+ const hasCustomObjects = existsSync('custom-objects/package.json');
1217
+
1105
1218
  const hasUI = existsSync('ui/package.json');
1106
1219
 
1107
1220
  let exitCode = 0;
@@ -1114,7 +1227,7 @@ function run(cmd: string): void {
1114
1227
  }
1115
1228
  }
1116
1229
 
1117
- if (hasExtensions) {
1230
+ if (hasExtensions || hasCustomObjects) {
1118
1231
  run('vitest run');
1119
1232
  }
1120
1233
 
@@ -1266,11 +1379,33 @@ function _devNpmDep(name, version) {
1266
1379
  return { type: "dev-npm", name, version };
1267
1380
  }
1268
1381
 
1382
+ // src/workspace-versions.json
1383
+ var workspace_versions_default = {
1384
+ "@stripe/extensibility-custom-objects": "1.0.0",
1385
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
1386
+ "@stripe/extensibility-dev-tools": "1.0.2",
1387
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
1388
+ "@stripe/extensibility-language-server": "1.0.0",
1389
+ "@stripe/extensibility-sdk": "1.0.0",
1390
+ "@stripe/extensibility-test-helpers": "1.0.0"
1391
+ };
1392
+
1393
+ // src/workspace-versions.ts
1394
+ var _workspaceVersions = workspace_versions_default;
1395
+ function _workspaceVersion(packageName) {
1396
+ const v = _workspaceVersions[packageName];
1397
+ if (v === void 0) {
1398
+ throw new Error(
1399
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1400
+ );
1401
+ }
1402
+ return v;
1403
+ }
1404
+
1269
1405
  // src/templates/extensions/base.ts
1270
- var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
1271
1406
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1272
1407
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1273
- var LANGUAGE_SERVER_PACKAGE_VERSION = `^${(0, import_extensibility_tool_utils6._workspaceVersion)(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1408
+ var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1274
1409
  function _createExtensionEslintConfigFile(params, context) {
1275
1410
  const { id, extensionInterfaceId } = params;
1276
1411
  const { fs: fs4 } = context;
@@ -1313,7 +1448,7 @@ function _createBaseOutput(params, context) {
1313
1448
  dependencies: {
1314
1449
  // Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
1315
1450
  // must match the version that generated the extension scaffolding.
1316
- runtime: [_npmDep(SDK_PACKAGE_NAME, (0, import_extensibility_tool_utils6._workspaceVersion)(SDK_PACKAGE_NAME))],
1451
+ runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
1317
1452
  dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
1318
1453
  },
1319
1454
  postGenerationHooks: [
@@ -1572,14 +1707,14 @@ var billing_bill_discount_calculation_default = {
1572
1707
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1573
1708
  };
1574
1709
 
1575
- // src/templates/extensions/billing.invoice_collection_setting.ts
1576
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1577
- var invoiceCollectionSettingTemplate = {
1710
+ // src/templates/extensions/billing.invoice_collection_options.ts
1711
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
1712
+ var invoiceCollectionOptionsTemplate = {
1578
1713
  hidden: true,
1579
1714
  methods: {
1580
- collection_override: { implementation_types: ["script"] }
1715
+ override_options: { implementation_types: ["script"] }
1581
1716
  },
1582
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
1717
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1583
1718
  generate: (params, context) => {
1584
1719
  const { id } = params;
1585
1720
  const { fs: fs4 } = context;
@@ -1607,15 +1742,15 @@ var invoiceCollectionSettingTemplate = {
1607
1742
  ...base.files
1608
1743
  ],
1609
1744
  methods: {
1610
- collection_override: {
1745
+ override_options: {
1611
1746
  implementation_type: "script"
1612
1747
  }
1613
1748
  }
1614
1749
  };
1615
1750
  }
1616
1751
  };
1617
- var billing_invoice_collection_setting_default = {
1618
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
1752
+ var billing_invoice_collection_options_default = {
1753
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1619
1754
  };
1620
1755
 
1621
1756
  // src/templates/extensions/billing.prorations.ts
@@ -1723,7 +1858,7 @@ var DEFAULT_TEMPLATES = {
1723
1858
  ...extend_workflows_custom_action_default,
1724
1859
  ...billing_customer_balance_application_default,
1725
1860
  ...billing_bill_discount_calculation_default,
1726
- ...billing_invoice_collection_setting_default,
1861
+ ...billing_invoice_collection_options_default,
1727
1862
  ...billing_prorations_default,
1728
1863
  ...billing_recurring_billing_item_handling_default
1729
1864
  };
@@ -1949,9 +2084,9 @@ function toDefaultValue(value, dataType) {
1949
2084
  }
1950
2085
 
1951
2086
  // src/custom-objects/build-definitions.ts
1952
- var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
2087
+ var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
1953
2088
  async function analyzeAndInjectManifest(options) {
1954
- const context = options.context ?? (0, import_extensibility_tool_utils7._createCliContext)();
2089
+ const context = options.context ?? (0, import_extensibility_tool_utils6._createCliContext)();
1955
2090
  const manifestPath = options.manifestPath ?? "stripe-app.yaml";
1956
2091
  const projectRoot = options.projectRoot ?? path2.dirname(path2.resolve(manifestPath));
1957
2092
  const resolvedManifestPath = path2.resolve(manifestPath);
@@ -2036,7 +2171,7 @@ async function analyzeAndInjectManifest(options) {
2036
2171
  };
2037
2172
  }
2038
2173
  async function writeCustomObjectArtifacts(options, state) {
2039
- const context = options.context ?? (0, import_extensibility_tool_utils7._createCliContext)();
2174
+ const context = options.context ?? (0, import_extensibility_tool_utils6._createCliContext)();
2040
2175
  const targetPath = path2.resolve(options.targetPath);
2041
2176
  const { packageBuild, customObjects, coVersion, coDependencies, projectRoot } = state;
2042
2177
  for (const obj of customObjects) {
@@ -2112,9 +2247,9 @@ function readPackageDependencies(packageJsonPath) {
2112
2247
  }
2113
2248
 
2114
2249
  // src/bin/create-upload-image.ts
2115
- var logger = (0, import_extensibility_tool_utils8._createLogger)({ name: "create-upload-image" });
2250
+ var logger = (0, import_extensibility_tool_utils7._createLogger)({ name: "create-upload-image" });
2116
2251
  async function main() {
2117
- const ctx = (0, import_extensibility_tool_utils8._createCliContext)();
2252
+ const ctx = (0, import_extensibility_tool_utils7._createCliContext)();
2118
2253
  const targetPath = process.argv[2];
2119
2254
  if (!targetPath) {
2120
2255
  ctx.ux.error("Usage: create-upload-image <target-path>");
@@ -369,35 +369,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
369
369
  `
370
370
  },
371
371
  {
372
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
372
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
373
373
  content: `import { beforeEach, describe, it, expect } from 'vitest';
374
374
 
375
- import MyInvoiceCollectionSetting from './index.js';
375
+ import MyInvoiceCollectionOptions from './index.js';
376
376
 
377
- describe('MyInvoiceCollectionSetting', () => {
378
- let instance: MyInvoiceCollectionSetting;
377
+ describe('MyInvoiceCollectionOptions', () => {
378
+ let instance: MyInvoiceCollectionOptions;
379
379
 
380
380
  beforeEach(() => {
381
- instance = new MyInvoiceCollectionSetting();
381
+ instance = new MyInvoiceCollectionOptions();
382
382
  });
383
383
 
384
384
  it('should be constructable', () => {
385
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
385
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
386
386
  });
387
387
  });
388
388
  `
389
389
  },
390
390
  {
391
- path: "extensions/billing.invoice_collection_setting/index.ts",
391
+ path: "extensions/billing.invoice_collection_options/index.ts",
392
392
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
393
393
 
394
394
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
395
- interface MyInvoiceCollectionSettingConfig {}
395
+ interface MyInvoiceCollectionOptionsConfig {}
396
396
 
397
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
398
- collectionOverride(
399
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
400
- _config: MyInvoiceCollectionSettingConfig,
397
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
398
+ overrideOptions(
399
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
400
+ _config: MyInvoiceCollectionOptionsConfig,
401
401
  _context: Context
402
402
  ) {
403
403
  // TODO: implement your collection setting logic here
@@ -869,6 +869,99 @@ install-deps.log
869
869
 
870
870
  # generated schemas
871
871
  generated
872
+ `
873
+ },
874
+ {
875
+ path: "root/custom-objects/eslint.config.mts",
876
+ content: `import eslint from '@eslint/js';
877
+ import { defineConfig } from 'eslint/config';
878
+ import tseslint from 'typescript-eslint';
879
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
880
+
881
+ import globals from 'globals';
882
+
883
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
884
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
885
+
886
+ export default defineConfig([
887
+ eslint.configs.recommended,
888
+ ...tseslint.configs.recommended,
889
+ ...stripeAppsConfig,
890
+ ...customObjectsConfig,
891
+
892
+ // Global ignores
893
+ {
894
+ ignores: ['dist', 'generated', 'node_modules'],
895
+ },
896
+
897
+ // TypeScript source files (with type-checking)
898
+ {
899
+ name: 'sources',
900
+ files: ['src/**/*.ts'],
901
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
902
+ languageOptions: {
903
+ globals: {
904
+ ...globals.node,
905
+ },
906
+ parserOptions: {
907
+ projectService: true,
908
+ tsconfigRootDir: import.meta.dirname,
909
+ },
910
+ },
911
+ },
912
+
913
+ // Test files
914
+ {
915
+ name: 'tests',
916
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
917
+ languageOptions: {
918
+ globals: {
919
+ ...globals.node,
920
+ },
921
+ parserOptions: {
922
+ projectService: true,
923
+ tsconfigRootDir: import.meta.dirname,
924
+ },
925
+ },
926
+ },
927
+
928
+ // Config files
929
+ {
930
+ name: 'ts-configs',
931
+ files: ['*.config.m?ts', 'eslint.config.mts'],
932
+ languageOptions: {
933
+ globals: {
934
+ ...globals.node,
935
+ },
936
+ parserOptions: {
937
+ projectService: false,
938
+ },
939
+ },
940
+ rules: {
941
+ '@typescript-eslint/no-unused-vars': 'off',
942
+ },
943
+ },
944
+
945
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
946
+ // disable the TS-parser-specific rule that doesn't apply without it.
947
+ {
948
+ name: 'js-configs',
949
+ files: ['**/*.js', '**/*.mjs'],
950
+ languageOptions: {
951
+ globals: {
952
+ ...globals.node,
953
+ },
954
+ parserOptions: {
955
+ projectService: false,
956
+ },
957
+ },
958
+ rules: {
959
+ '@typescript-eslint/no-require-imports': 'off',
960
+ },
961
+ },
962
+
963
+ eslintConfigPrettier,
964
+ ]);
872
965
  `
873
966
  },
874
967
  {
@@ -881,7 +974,9 @@ generated
881
974
  "private": true,
882
975
  "scripts": {
883
976
  "build": "test -d src && custom-objects-build --input src --output dist || true",
977
+ "lint": "pnpm lint:types && pnpm lint:eslint",
884
978
  "lint:types": "test ! -d src || tsc --noEmit",
979
+ "lint:eslint": "eslint .",
885
980
  "test": "vitest run"
886
981
  },
887
982
  "dependencies": {
@@ -904,8 +999,20 @@ generated
904
999
  "moduleResolution": "bundler",
905
1000
  "types": ["vitest/globals"]
906
1001
  },
1002
+ "include": ["src/**/*.ts"],
907
1003
  "exclude": ["dist"]
908
1004
  }
1005
+ `
1006
+ },
1007
+ {
1008
+ path: "root/custom-objects/vitest.config.mts",
1009
+ content: `import { defineConfig } from 'vitest/config';
1010
+
1011
+ export default defineConfig({
1012
+ test: {
1013
+ globals: true,
1014
+ },
1015
+ });
909
1016
  `
910
1017
  },
911
1018
  {
@@ -1023,7 +1130,7 @@ export default defineConfig([
1023
1130
  "build": "pnpm -r --if-present build",
1024
1131
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
1025
1132
  "lint:types": "pnpm -r --if-present lint:types",
1026
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
1133
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
1027
1134
  "lint:format": "prettier --check .",
1028
1135
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
1029
1136
  "fix:format": "prettier --write .",
@@ -1052,6 +1159,10 @@ export default defineConfig([
1052
1159
 
1053
1160
  overrides:
1054
1161
  vite: ^6.0.0
1162
+
1163
+ allowBuilds:
1164
+ core-js-pure: false
1165
+ esbuild: false
1055
1166
  `
1056
1167
  },
1057
1168
  {
@@ -1069,7 +1180,7 @@ declarations:
1069
1180
  content: `#!/usr/bin/env tsx
1070
1181
  /**
1071
1182
  * Runs tests across the workspace:
1072
- * - vitest for script extensions and custom objects (extensions/*)
1183
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1073
1184
  * - jest for UI extensions (ui/)
1074
1185
  */
1075
1186
  import { existsSync, readdirSync } from 'node:fs';
@@ -1079,6 +1190,8 @@ const hasExtensions =
1079
1190
  existsSync('extensions') &&
1080
1191
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1081
1192
 
1193
+ const hasCustomObjects = existsSync('custom-objects/package.json');
1194
+
1082
1195
  const hasUI = existsSync('ui/package.json');
1083
1196
 
1084
1197
  let exitCode = 0;
@@ -1091,7 +1204,7 @@ function run(cmd: string): void {
1091
1204
  }
1092
1205
  }
1093
1206
 
1094
- if (hasExtensions) {
1207
+ if (hasExtensions || hasCustomObjects) {
1095
1208
  run('vitest run');
1096
1209
  }
1097
1210
 
@@ -1243,8 +1356,30 @@ function _devNpmDep(name, version) {
1243
1356
  return { type: "dev-npm", name, version };
1244
1357
  }
1245
1358
 
1359
+ // src/workspace-versions.json
1360
+ var workspace_versions_default = {
1361
+ "@stripe/extensibility-custom-objects": "1.0.0",
1362
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
1363
+ "@stripe/extensibility-dev-tools": "1.0.2",
1364
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
1365
+ "@stripe/extensibility-language-server": "1.0.0",
1366
+ "@stripe/extensibility-sdk": "1.0.0",
1367
+ "@stripe/extensibility-test-helpers": "1.0.0"
1368
+ };
1369
+
1370
+ // src/workspace-versions.ts
1371
+ var _workspaceVersions = workspace_versions_default;
1372
+ function _workspaceVersion(packageName) {
1373
+ const v = _workspaceVersions[packageName];
1374
+ if (v === void 0) {
1375
+ throw new Error(
1376
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1377
+ );
1378
+ }
1379
+ return v;
1380
+ }
1381
+
1246
1382
  // src/templates/extensions/base.ts
1247
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
1248
1383
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1249
1384
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1250
1385
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -1549,14 +1684,14 @@ var billing_bill_discount_calculation_default = {
1549
1684
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1550
1685
  };
1551
1686
 
1552
- // src/templates/extensions/billing.invoice_collection_setting.ts
1553
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1554
- var invoiceCollectionSettingTemplate = {
1687
+ // src/templates/extensions/billing.invoice_collection_options.ts
1688
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
1689
+ var invoiceCollectionOptionsTemplate = {
1555
1690
  hidden: true,
1556
1691
  methods: {
1557
- collection_override: { implementation_types: ["script"] }
1692
+ override_options: { implementation_types: ["script"] }
1558
1693
  },
1559
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
1694
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1560
1695
  generate: (params, context) => {
1561
1696
  const { id } = params;
1562
1697
  const { fs: fs4 } = context;
@@ -1584,15 +1719,15 @@ var invoiceCollectionSettingTemplate = {
1584
1719
  ...base.files
1585
1720
  ],
1586
1721
  methods: {
1587
- collection_override: {
1722
+ override_options: {
1588
1723
  implementation_type: "script"
1589
1724
  }
1590
1725
  }
1591
1726
  };
1592
1727
  }
1593
1728
  };
1594
- var billing_invoice_collection_setting_default = {
1595
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
1729
+ var billing_invoice_collection_options_default = {
1730
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1596
1731
  };
1597
1732
 
1598
1733
  // src/templates/extensions/billing.prorations.ts
@@ -1700,7 +1835,7 @@ var DEFAULT_TEMPLATES = {
1700
1835
  ...extend_workflows_custom_action_default,
1701
1836
  ...billing_customer_balance_application_default,
1702
1837
  ...billing_bill_discount_calculation_default,
1703
- ...billing_invoice_collection_setting_default,
1838
+ ...billing_invoice_collection_options_default,
1704
1839
  ...billing_prorations_default,
1705
1840
  ...billing_recurring_billing_item_handling_default
1706
1841
  };