@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
@@ -1237,35 +1237,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
1237
1237
  `
1238
1238
  },
1239
1239
  {
1240
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
1240
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
1241
1241
  content: `import { beforeEach, describe, it, expect } from 'vitest';
1242
1242
 
1243
- import MyInvoiceCollectionSetting from './index.js';
1243
+ import MyInvoiceCollectionOptions from './index.js';
1244
1244
 
1245
- describe('MyInvoiceCollectionSetting', () => {
1246
- let instance: MyInvoiceCollectionSetting;
1245
+ describe('MyInvoiceCollectionOptions', () => {
1246
+ let instance: MyInvoiceCollectionOptions;
1247
1247
 
1248
1248
  beforeEach(() => {
1249
- instance = new MyInvoiceCollectionSetting();
1249
+ instance = new MyInvoiceCollectionOptions();
1250
1250
  });
1251
1251
 
1252
1252
  it('should be constructable', () => {
1253
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
1253
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
1254
1254
  });
1255
1255
  });
1256
1256
  `
1257
1257
  },
1258
1258
  {
1259
- path: "extensions/billing.invoice_collection_setting/index.ts",
1259
+ path: "extensions/billing.invoice_collection_options/index.ts",
1260
1260
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
1261
1261
 
1262
1262
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1263
- interface MyInvoiceCollectionSettingConfig {}
1263
+ interface MyInvoiceCollectionOptionsConfig {}
1264
1264
 
1265
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
1266
- collectionOverride(
1267
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
1268
- _config: MyInvoiceCollectionSettingConfig,
1265
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
1266
+ overrideOptions(
1267
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
1268
+ _config: MyInvoiceCollectionOptionsConfig,
1269
1269
  _context: Context
1270
1270
  ) {
1271
1271
  // TODO: implement your collection setting logic here
@@ -1737,6 +1737,99 @@ install-deps.log
1737
1737
 
1738
1738
  # generated schemas
1739
1739
  generated
1740
+ `
1741
+ },
1742
+ {
1743
+ path: "root/custom-objects/eslint.config.mts",
1744
+ content: `import eslint from '@eslint/js';
1745
+ import { defineConfig } from 'eslint/config';
1746
+ import tseslint from 'typescript-eslint';
1747
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
1748
+
1749
+ import globals from 'globals';
1750
+
1751
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
1752
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
1753
+
1754
+ export default defineConfig([
1755
+ eslint.configs.recommended,
1756
+ ...tseslint.configs.recommended,
1757
+ ...stripeAppsConfig,
1758
+ ...customObjectsConfig,
1759
+
1760
+ // Global ignores
1761
+ {
1762
+ ignores: ['dist', 'generated', 'node_modules'],
1763
+ },
1764
+
1765
+ // TypeScript source files (with type-checking)
1766
+ {
1767
+ name: 'sources',
1768
+ files: ['src/**/*.ts'],
1769
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
1770
+ languageOptions: {
1771
+ globals: {
1772
+ ...globals.node,
1773
+ },
1774
+ parserOptions: {
1775
+ projectService: true,
1776
+ tsconfigRootDir: import.meta.dirname,
1777
+ },
1778
+ },
1779
+ },
1780
+
1781
+ // Test files
1782
+ {
1783
+ name: 'tests',
1784
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
1785
+ languageOptions: {
1786
+ globals: {
1787
+ ...globals.node,
1788
+ },
1789
+ parserOptions: {
1790
+ projectService: true,
1791
+ tsconfigRootDir: import.meta.dirname,
1792
+ },
1793
+ },
1794
+ },
1795
+
1796
+ // Config files
1797
+ {
1798
+ name: 'ts-configs',
1799
+ files: ['*.config.m?ts', 'eslint.config.mts'],
1800
+ languageOptions: {
1801
+ globals: {
1802
+ ...globals.node,
1803
+ },
1804
+ parserOptions: {
1805
+ projectService: false,
1806
+ },
1807
+ },
1808
+ rules: {
1809
+ '@typescript-eslint/no-unused-vars': 'off',
1810
+ },
1811
+ },
1812
+
1813
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
1814
+ // disable the TS-parser-specific rule that doesn't apply without it.
1815
+ {
1816
+ name: 'js-configs',
1817
+ files: ['**/*.js', '**/*.mjs'],
1818
+ languageOptions: {
1819
+ globals: {
1820
+ ...globals.node,
1821
+ },
1822
+ parserOptions: {
1823
+ projectService: false,
1824
+ },
1825
+ },
1826
+ rules: {
1827
+ '@typescript-eslint/no-require-imports': 'off',
1828
+ },
1829
+ },
1830
+
1831
+ eslintConfigPrettier,
1832
+ ]);
1740
1833
  `
1741
1834
  },
1742
1835
  {
@@ -1749,7 +1842,9 @@ generated
1749
1842
  "private": true,
1750
1843
  "scripts": {
1751
1844
  "build": "test -d src && custom-objects-build --input src --output dist || true",
1845
+ "lint": "pnpm lint:types && pnpm lint:eslint",
1752
1846
  "lint:types": "test ! -d src || tsc --noEmit",
1847
+ "lint:eslint": "eslint .",
1753
1848
  "test": "vitest run"
1754
1849
  },
1755
1850
  "dependencies": {
@@ -1772,8 +1867,20 @@ generated
1772
1867
  "moduleResolution": "bundler",
1773
1868
  "types": ["vitest/globals"]
1774
1869
  },
1870
+ "include": ["src/**/*.ts"],
1775
1871
  "exclude": ["dist"]
1776
1872
  }
1873
+ `
1874
+ },
1875
+ {
1876
+ path: "root/custom-objects/vitest.config.mts",
1877
+ content: `import { defineConfig } from 'vitest/config';
1878
+
1879
+ export default defineConfig({
1880
+ test: {
1881
+ globals: true,
1882
+ },
1883
+ });
1777
1884
  `
1778
1885
  },
1779
1886
  {
@@ -1891,7 +1998,7 @@ export default defineConfig([
1891
1998
  "build": "pnpm -r --if-present build",
1892
1999
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
1893
2000
  "lint:types": "pnpm -r --if-present lint:types",
1894
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
2001
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
1895
2002
  "lint:format": "prettier --check .",
1896
2003
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
1897
2004
  "fix:format": "prettier --write .",
@@ -1920,6 +2027,10 @@ export default defineConfig([
1920
2027
 
1921
2028
  overrides:
1922
2029
  vite: ^6.0.0
2030
+
2031
+ allowBuilds:
2032
+ core-js-pure: false
2033
+ esbuild: false
1923
2034
  `
1924
2035
  },
1925
2036
  {
@@ -1937,7 +2048,7 @@ declarations:
1937
2048
  content: `#!/usr/bin/env tsx
1938
2049
  /**
1939
2050
  * Runs tests across the workspace:
1940
- * - vitest for script extensions and custom objects (extensions/*)
2051
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
1941
2052
  * - jest for UI extensions (ui/)
1942
2053
  */
1943
2054
  import { existsSync, readdirSync } from 'node:fs';
@@ -1947,6 +2058,8 @@ const hasExtensions =
1947
2058
  existsSync('extensions') &&
1948
2059
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
1949
2060
 
2061
+ const hasCustomObjects = existsSync('custom-objects/package.json');
2062
+
1950
2063
  const hasUI = existsSync('ui/package.json');
1951
2064
 
1952
2065
  let exitCode = 0;
@@ -1959,7 +2072,7 @@ function run(cmd: string): void {
1959
2072
  }
1960
2073
  }
1961
2074
 
1962
- if (hasExtensions) {
2075
+ if (hasExtensions || hasCustomObjects) {
1963
2076
  run('vitest run');
1964
2077
  }
1965
2078
 
@@ -2727,8 +2840,30 @@ var _ExtensionTemplateManager = class extends _TemplateManager {
2727
2840
  }
2728
2841
  };
2729
2842
 
2843
+ // src/workspace-versions.json
2844
+ var workspace_versions_default = {
2845
+ "@stripe/extensibility-custom-objects": "1.0.0",
2846
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
2847
+ "@stripe/extensibility-dev-tools": "1.0.2",
2848
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
2849
+ "@stripe/extensibility-language-server": "1.0.0",
2850
+ "@stripe/extensibility-sdk": "1.0.0",
2851
+ "@stripe/extensibility-test-helpers": "1.0.0"
2852
+ };
2853
+
2854
+ // src/workspace-versions.ts
2855
+ var _workspaceVersions = workspace_versions_default;
2856
+ function _workspaceVersion(packageName) {
2857
+ const v = _workspaceVersions[packageName];
2858
+ if (v === void 0) {
2859
+ throw new Error(
2860
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
2861
+ );
2862
+ }
2863
+ return v;
2864
+ }
2865
+
2730
2866
  // src/templates/extensions/base.ts
2731
- import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
2732
2867
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
2733
2868
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
2734
2869
  var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
@@ -3033,14 +3168,14 @@ var billing_bill_discount_calculation_default = {
3033
3168
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
3034
3169
  };
3035
3170
 
3036
- // src/templates/extensions/billing.invoice_collection_setting.ts
3037
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
3038
- var invoiceCollectionSettingTemplate = {
3171
+ // src/templates/extensions/billing.invoice_collection_options.ts
3172
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
3173
+ var invoiceCollectionOptionsTemplate = {
3039
3174
  hidden: true,
3040
3175
  methods: {
3041
- collection_override: { implementation_types: ["script"] }
3176
+ override_options: { implementation_types: ["script"] }
3042
3177
  },
3043
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
3178
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
3044
3179
  generate: (params, context) => {
3045
3180
  const { id } = params;
3046
3181
  const { fs: fs2 } = context;
@@ -3068,15 +3203,15 @@ var invoiceCollectionSettingTemplate = {
3068
3203
  ...base.files
3069
3204
  ],
3070
3205
  methods: {
3071
- collection_override: {
3206
+ override_options: {
3072
3207
  implementation_type: "script"
3073
3208
  }
3074
3209
  }
3075
3210
  };
3076
3211
  }
3077
3212
  };
3078
- var billing_invoice_collection_setting_default = {
3079
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
3213
+ var billing_invoice_collection_options_default = {
3214
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
3080
3215
  };
3081
3216
 
3082
3217
  // src/templates/extensions/billing.prorations.ts
@@ -3184,7 +3319,7 @@ var DEFAULT_TEMPLATES = {
3184
3319
  ...extend_workflows_custom_action_default,
3185
3320
  ...billing_customer_balance_application_default,
3186
3321
  ...billing_bill_discount_calculation_default,
3187
- ...billing_invoice_collection_setting_default,
3322
+ ...billing_invoice_collection_options_default,
3188
3323
  ...billing_prorations_default,
3189
3324
  ...billing_recurring_billing_item_handling_default
3190
3325
  };
@@ -3197,9 +3332,8 @@ var _templateManager = new _ExtensionTemplateManager(
3197
3332
  );
3198
3333
 
3199
3334
  // src/templates/root/index.ts
3200
- import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
3201
3335
  var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
3202
- var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion2(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
3336
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
3203
3337
  var _rootWorkspaceTemplate = {
3204
3338
  generate: (params, context) => {
3205
3339
  const { fs: fs2 } = context;
@@ -3254,14 +3388,14 @@ var _rootWorkspaceTemplate = {
3254
3388
  path: "custom-objects/package.json",
3255
3389
  content: fs2.mustache(
3256
3390
  {
3257
- customObjectsVersion: _workspaceVersion2(
3391
+ customObjectsVersion: _workspaceVersion(
3258
3392
  "@stripe/extensibility-custom-objects"
3259
3393
  ),
3260
- sdkVersion: _workspaceVersion2("@stripe/extensibility-sdk"),
3261
- customObjectsToolsVersion: _workspaceVersion2(
3394
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
3395
+ customObjectsToolsVersion: _workspaceVersion(
3262
3396
  "@stripe/extensibility-custom-objects-tools"
3263
3397
  ),
3264
- testHelpersVersion: _workspaceVersion2("@stripe/extensibility-test-helpers")
3398
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
3265
3399
  },
3266
3400
  "custom-objects",
3267
3401
  "package.json.mustache"
@@ -3273,6 +3407,16 @@ var _rootWorkspaceTemplate = {
3273
3407
  content: fs2.textFile("custom-objects/tsconfig.json"),
3274
3408
  precious: true
3275
3409
  },
3410
+ {
3411
+ path: "custom-objects/eslint.config.mts",
3412
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
3413
+ precious: true
3414
+ },
3415
+ {
3416
+ path: "custom-objects/vitest.config.mts",
3417
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
3418
+ precious: true
3419
+ },
3276
3420
  {
3277
3421
  path: "ui/package.json",
3278
3422
  content: fs2.textFile("ui/package.json"),
@@ -3299,7 +3443,7 @@ var _rootWorkspaceTemplate = {
3299
3443
  _devNpmDep("@types/node", "^20.19.0"),
3300
3444
  _devNpmDep(
3301
3445
  "@stripe/extensibility-dev-tools",
3302
- `^${_workspaceVersion2("@stripe/extensibility-dev-tools")}`
3446
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
3303
3447
  ),
3304
3448
  _devNpmDep("concurrently", "^9.2.1"),
3305
3449
  _devNpmDep("eslint", "^9.0.0"),
@@ -3497,9 +3641,9 @@ function resolveMode(options, projectRoot, packageDir) {
3497
3641
  workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
3498
3642
  generate: async (svc) => {
3499
3643
  const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
3500
- const workspaceExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json"));
3644
+ const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
3501
3645
  const objectResult = await svc.generateCustomObject({ name: objectName });
3502
- if (workspaceExists) {
3646
+ if (workspaceScaffoldingExists) {
3503
3647
  return objectResult;
3504
3648
  }
3505
3649
  const workspaceResult = await svc.generateCustomObjectsWorkspace({});