@stripe/extensibility-dev-tools 0.24.3 → 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 (61) hide show
  1. package/dist/bin/build-custom-object-definitions.cjs +165 -34
  2. package/dist/bin/build-custom-object-definitions.js +156 -25
  3. package/dist/bin/create-upload-image.cjs +164 -33
  4. package/dist/bin/create-upload-image.js +156 -25
  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/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 +192 -52
  37. package/dist/index.js +174 -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 +174 -34
  41. package/dist/templates/index.js +172 -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 +183 -43
  45. package/dist/workspace/index.d.ts.map +1 -1
  46. package/dist/workspace/index.js +174 -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/tools/test.mts +4 -2
  58. package/dist/templates/extensions/billing.invoice_collection_setting.d.ts +0 -6
  59. package/dist/templates/extensions/billing.invoice_collection_setting.d.ts.map +0 -1
  60. package/templates/extensions/billing.invoice_collection_setting/index.test.ts +0 -15
  61. 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 .",
@@ -1088,7 +1195,7 @@ declarations:
1088
1195
  content: `#!/usr/bin/env tsx
1089
1196
  /**
1090
1197
  * Runs tests across the workspace:
1091
- * - vitest for script extensions and custom objects (extensions/*)
1198
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1092
1199
  * - jest for UI extensions (ui/)
1093
1200
  */
1094
1201
  import { existsSync, readdirSync } from 'node:fs';
@@ -1098,6 +1205,8 @@ const hasExtensions =
1098
1205
  existsSync('extensions') &&
1099
1206
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1100
1207
 
1208
+ const hasCustomObjects = existsSync('custom-objects/package.json');
1209
+
1101
1210
  const hasUI = existsSync('ui/package.json');
1102
1211
 
1103
1212
  let exitCode = 0;
@@ -1110,7 +1219,7 @@ function run(cmd: string): void {
1110
1219
  }
1111
1220
  }
1112
1221
 
1113
- if (hasExtensions) {
1222
+ if (hasExtensions || hasCustomObjects) {
1114
1223
  run('vitest run');
1115
1224
  }
1116
1225
 
@@ -1262,11 +1371,33 @@ function _devNpmDep(name, version) {
1262
1371
  return { type: "dev-npm", name, version };
1263
1372
  }
1264
1373
 
1374
+ // src/workspace-versions.json
1375
+ var workspace_versions_default = {
1376
+ "@stripe/extensibility-custom-objects": "0.8.0",
1377
+ "@stripe/extensibility-custom-objects-tools": "0.42.1",
1378
+ "@stripe/extensibility-dev-tools": "0.25.1",
1379
+ "@stripe/extensibility-eslint-plugin": "0.17.1",
1380
+ "@stripe/extensibility-language-server": "0.3.4",
1381
+ "@stripe/extensibility-sdk": "0.27.1",
1382
+ "@stripe/extensibility-test-helpers": "0.2.7"
1383
+ };
1384
+
1385
+ // src/workspace-versions.ts
1386
+ var _workspaceVersions = workspace_versions_default;
1387
+ function _workspaceVersion(packageName) {
1388
+ const v = _workspaceVersions[packageName];
1389
+ if (v === void 0) {
1390
+ throw new Error(
1391
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1392
+ );
1393
+ }
1394
+ return v;
1395
+ }
1396
+
1265
1397
  // src/templates/extensions/base.ts
1266
- var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
1267
1398
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1268
1399
  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)}`;
1400
+ var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1270
1401
  function _createExtensionEslintConfigFile(params, context) {
1271
1402
  const { id, extensionInterfaceId } = params;
1272
1403
  const { fs: fs3 } = context;
@@ -1309,7 +1440,7 @@ function _createBaseOutput(params, context) {
1309
1440
  dependencies: {
1310
1441
  // Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
1311
1442
  // must match the version that generated the extension scaffolding.
1312
- runtime: [_npmDep(SDK_PACKAGE_NAME, (0, import_extensibility_tool_utils6._workspaceVersion)(SDK_PACKAGE_NAME))],
1443
+ runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
1313
1444
  dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
1314
1445
  },
1315
1446
  postGenerationHooks: [
@@ -1568,14 +1699,14 @@ var billing_bill_discount_calculation_default = {
1568
1699
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1569
1700
  };
1570
1701
 
1571
- // src/templates/extensions/billing.invoice_collection_setting.ts
1572
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1573
- var invoiceCollectionSettingTemplate = {
1702
+ // src/templates/extensions/billing.invoice_collection_options.ts
1703
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
1704
+ var invoiceCollectionOptionsTemplate = {
1574
1705
  hidden: true,
1575
1706
  methods: {
1576
- collection_override: { implementation_types: ["script"] }
1707
+ override_options: { implementation_types: ["script"] }
1577
1708
  },
1578
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
1709
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1579
1710
  generate: (params, context) => {
1580
1711
  const { id } = params;
1581
1712
  const { fs: fs3 } = context;
@@ -1603,15 +1734,15 @@ var invoiceCollectionSettingTemplate = {
1603
1734
  ...base.files
1604
1735
  ],
1605
1736
  methods: {
1606
- collection_override: {
1737
+ override_options: {
1607
1738
  implementation_type: "script"
1608
1739
  }
1609
1740
  }
1610
1741
  };
1611
1742
  }
1612
1743
  };
1613
- var billing_invoice_collection_setting_default = {
1614
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
1744
+ var billing_invoice_collection_options_default = {
1745
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1615
1746
  };
1616
1747
 
1617
1748
  // src/templates/extensions/billing.prorations.ts
@@ -1719,7 +1850,7 @@ var DEFAULT_TEMPLATES = {
1719
1850
  ...extend_workflows_custom_action_default,
1720
1851
  ...billing_customer_balance_application_default,
1721
1852
  ...billing_bill_discount_calculation_default,
1722
- ...billing_invoice_collection_setting_default,
1853
+ ...billing_invoice_collection_options_default,
1723
1854
  ...billing_prorations_default,
1724
1855
  ...billing_recurring_billing_item_handling_default
1725
1856
  };
@@ -1945,9 +2076,9 @@ function toDefaultValue(value, dataType) {
1945
2076
  }
1946
2077
 
1947
2078
  // src/custom-objects/build-definitions.ts
1948
- var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
2079
+ var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
1949
2080
  async function analyzeAndInjectManifest(options) {
1950
- const context = options.context ?? (0, import_extensibility_tool_utils7._createCliContext)();
2081
+ const context = options.context ?? (0, import_extensibility_tool_utils6._createCliContext)();
1951
2082
  const manifestPath = options.manifestPath ?? "stripe-app.yaml";
1952
2083
  const projectRoot = options.projectRoot ?? path2.dirname(path2.resolve(manifestPath));
1953
2084
  const resolvedManifestPath = path2.resolve(manifestPath);
@@ -2032,7 +2163,7 @@ async function analyzeAndInjectManifest(options) {
2032
2163
  };
2033
2164
  }
2034
2165
  async function writeCustomObjectArtifacts(options, state) {
2035
- const context = options.context ?? (0, import_extensibility_tool_utils7._createCliContext)();
2166
+ const context = options.context ?? (0, import_extensibility_tool_utils6._createCliContext)();
2036
2167
  const targetPath = path2.resolve(options.targetPath);
2037
2168
  const { packageBuild, customObjects, coVersion, coDependencies, projectRoot } = state;
2038
2169
  for (const obj of customObjects) {
@@ -2122,10 +2253,10 @@ function readPackageDependencies(packageJsonPath) {
2122
2253
  }
2123
2254
 
2124
2255
  // 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" });
2256
+ var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
2257
+ var logger = (0, import_extensibility_tool_utils7._createLogger)({ name: "build-definitions" });
2127
2258
  async function main() {
2128
- const ctx = (0, import_extensibility_tool_utils9._createCliContext)();
2259
+ const ctx = (0, import_extensibility_tool_utils8._createCliContext)();
2129
2260
  const [targetPath, manifestPath] = process.argv.slice(2);
2130
2261
  if (!targetPath) {
2131
2262
  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 .",
@@ -1065,7 +1172,7 @@ declarations:
1065
1172
  content: `#!/usr/bin/env tsx
1066
1173
  /**
1067
1174
  * Runs tests across the workspace:
1068
- * - vitest for script extensions and custom objects (extensions/*)
1175
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1069
1176
  * - jest for UI extensions (ui/)
1070
1177
  */
1071
1178
  import { existsSync, readdirSync } from 'node:fs';
@@ -1075,6 +1182,8 @@ const hasExtensions =
1075
1182
  existsSync('extensions') &&
1076
1183
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1077
1184
 
1185
+ const hasCustomObjects = existsSync('custom-objects/package.json');
1186
+
1078
1187
  const hasUI = existsSync('ui/package.json');
1079
1188
 
1080
1189
  let exitCode = 0;
@@ -1087,7 +1196,7 @@ function run(cmd: string): void {
1087
1196
  }
1088
1197
  }
1089
1198
 
1090
- if (hasExtensions) {
1199
+ if (hasExtensions || hasCustomObjects) {
1091
1200
  run('vitest run');
1092
1201
  }
1093
1202
 
@@ -1239,8 +1348,30 @@ function _devNpmDep(name, version) {
1239
1348
  return { type: "dev-npm", name, version };
1240
1349
  }
1241
1350
 
1351
+ // src/workspace-versions.json
1352
+ var workspace_versions_default = {
1353
+ "@stripe/extensibility-custom-objects": "0.8.0",
1354
+ "@stripe/extensibility-custom-objects-tools": "0.42.1",
1355
+ "@stripe/extensibility-dev-tools": "0.25.1",
1356
+ "@stripe/extensibility-eslint-plugin": "0.17.1",
1357
+ "@stripe/extensibility-language-server": "0.3.4",
1358
+ "@stripe/extensibility-sdk": "0.27.1",
1359
+ "@stripe/extensibility-test-helpers": "0.2.7"
1360
+ };
1361
+
1362
+ // src/workspace-versions.ts
1363
+ var _workspaceVersions = workspace_versions_default;
1364
+ function _workspaceVersion(packageName) {
1365
+ const v = _workspaceVersions[packageName];
1366
+ if (v === void 0) {
1367
+ throw new Error(
1368
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1369
+ );
1370
+ }
1371
+ return v;
1372
+ }
1373
+
1242
1374
  // src/templates/extensions/base.ts
1243
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
1244
1375
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1245
1376
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1246
1377
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -1545,14 +1676,14 @@ var billing_bill_discount_calculation_default = {
1545
1676
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1546
1677
  };
1547
1678
 
1548
- // src/templates/extensions/billing.invoice_collection_setting.ts
1549
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1550
- var invoiceCollectionSettingTemplate = {
1679
+ // src/templates/extensions/billing.invoice_collection_options.ts
1680
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
1681
+ var invoiceCollectionOptionsTemplate = {
1551
1682
  hidden: true,
1552
1683
  methods: {
1553
- collection_override: { implementation_types: ["script"] }
1684
+ override_options: { implementation_types: ["script"] }
1554
1685
  },
1555
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
1686
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1556
1687
  generate: (params, context) => {
1557
1688
  const { id } = params;
1558
1689
  const { fs: fs3 } = context;
@@ -1580,15 +1711,15 @@ var invoiceCollectionSettingTemplate = {
1580
1711
  ...base.files
1581
1712
  ],
1582
1713
  methods: {
1583
- collection_override: {
1714
+ override_options: {
1584
1715
  implementation_type: "script"
1585
1716
  }
1586
1717
  }
1587
1718
  };
1588
1719
  }
1589
1720
  };
1590
- var billing_invoice_collection_setting_default = {
1591
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
1721
+ var billing_invoice_collection_options_default = {
1722
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1592
1723
  };
1593
1724
 
1594
1725
  // src/templates/extensions/billing.prorations.ts
@@ -1696,7 +1827,7 @@ var DEFAULT_TEMPLATES = {
1696
1827
  ...extend_workflows_custom_action_default,
1697
1828
  ...billing_customer_balance_application_default,
1698
1829
  ...billing_bill_discount_calculation_default,
1699
- ...billing_invoice_collection_setting_default,
1830
+ ...billing_invoice_collection_options_default,
1700
1831
  ...billing_prorations_default,
1701
1832
  ...billing_recurring_billing_item_handling_default
1702
1833
  };