@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
@@ -138,35 +138,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
138
138
  `
139
139
  },
140
140
  {
141
- path: "extensions/billing.invoice_collection_setting/index.test.ts",
141
+ path: "extensions/billing.invoice_collection_options/index.test.ts",
142
142
  content: `import { beforeEach, describe, it, expect } from 'vitest';
143
143
 
144
- import MyInvoiceCollectionSetting from './index.js';
144
+ import MyInvoiceCollectionOptions from './index.js';
145
145
 
146
- describe('MyInvoiceCollectionSetting', () => {
147
- let instance: MyInvoiceCollectionSetting;
146
+ describe('MyInvoiceCollectionOptions', () => {
147
+ let instance: MyInvoiceCollectionOptions;
148
148
 
149
149
  beforeEach(() => {
150
- instance = new MyInvoiceCollectionSetting();
150
+ instance = new MyInvoiceCollectionOptions();
151
151
  });
152
152
 
153
153
  it('should be constructable', () => {
154
- expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
154
+ expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
155
155
  });
156
156
  });
157
157
  `
158
158
  },
159
159
  {
160
- path: "extensions/billing.invoice_collection_setting/index.ts",
160
+ path: "extensions/billing.invoice_collection_options/index.ts",
161
161
  content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
162
162
 
163
163
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
164
- interface MyInvoiceCollectionSettingConfig {}
164
+ interface MyInvoiceCollectionOptionsConfig {}
165
165
 
166
- export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
167
- collectionOverride(
168
- _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
169
- _config: MyInvoiceCollectionSettingConfig,
166
+ export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
167
+ overrideOptions(
168
+ _request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
169
+ _config: MyInvoiceCollectionOptionsConfig,
170
170
  _context: Context
171
171
  ) {
172
172
  // TODO: implement your collection setting logic here
@@ -638,6 +638,99 @@ install-deps.log
638
638
 
639
639
  # generated schemas
640
640
  generated
641
+ `
642
+ },
643
+ {
644
+ path: "root/custom-objects/eslint.config.mts",
645
+ content: `import eslint from '@eslint/js';
646
+ import { defineConfig } from 'eslint/config';
647
+ import tseslint from 'typescript-eslint';
648
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
649
+
650
+ import globals from 'globals';
651
+
652
+ import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
653
+ import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
654
+
655
+ export default defineConfig([
656
+ eslint.configs.recommended,
657
+ ...tseslint.configs.recommended,
658
+ ...stripeAppsConfig,
659
+ ...customObjectsConfig,
660
+
661
+ // Global ignores
662
+ {
663
+ ignores: ['dist', 'generated', 'node_modules'],
664
+ },
665
+
666
+ // TypeScript source files (with type-checking)
667
+ {
668
+ name: 'sources',
669
+ files: ['src/**/*.ts'],
670
+ ignores: ['**/*.test.ts', '**/__tests__/**'],
671
+ languageOptions: {
672
+ globals: {
673
+ ...globals.node,
674
+ },
675
+ parserOptions: {
676
+ projectService: true,
677
+ tsconfigRootDir: import.meta.dirname,
678
+ },
679
+ },
680
+ },
681
+
682
+ // Test files
683
+ {
684
+ name: 'tests',
685
+ files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
686
+ languageOptions: {
687
+ globals: {
688
+ ...globals.node,
689
+ },
690
+ parserOptions: {
691
+ projectService: true,
692
+ tsconfigRootDir: import.meta.dirname,
693
+ },
694
+ },
695
+ },
696
+
697
+ // Config files
698
+ {
699
+ name: 'ts-configs',
700
+ files: ['*.config.m?ts', 'eslint.config.mts'],
701
+ languageOptions: {
702
+ globals: {
703
+ ...globals.node,
704
+ },
705
+ parserOptions: {
706
+ projectService: false,
707
+ },
708
+ },
709
+ rules: {
710
+ '@typescript-eslint/no-unused-vars': 'off',
711
+ },
712
+ },
713
+
714
+ // JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
715
+ // disable the TS-parser-specific rule that doesn't apply without it.
716
+ {
717
+ name: 'js-configs',
718
+ files: ['**/*.js', '**/*.mjs'],
719
+ languageOptions: {
720
+ globals: {
721
+ ...globals.node,
722
+ },
723
+ parserOptions: {
724
+ projectService: false,
725
+ },
726
+ },
727
+ rules: {
728
+ '@typescript-eslint/no-require-imports': 'off',
729
+ },
730
+ },
731
+
732
+ eslintConfigPrettier,
733
+ ]);
641
734
  `
642
735
  },
643
736
  {
@@ -650,7 +743,9 @@ generated
650
743
  "private": true,
651
744
  "scripts": {
652
745
  "build": "test -d src && custom-objects-build --input src --output dist || true",
746
+ "lint": "pnpm lint:types && pnpm lint:eslint",
653
747
  "lint:types": "test ! -d src || tsc --noEmit",
748
+ "lint:eslint": "eslint .",
654
749
  "test": "vitest run"
655
750
  },
656
751
  "dependencies": {
@@ -673,8 +768,20 @@ generated
673
768
  "moduleResolution": "bundler",
674
769
  "types": ["vitest/globals"]
675
770
  },
771
+ "include": ["src/**/*.ts"],
676
772
  "exclude": ["dist"]
677
773
  }
774
+ `
775
+ },
776
+ {
777
+ path: "root/custom-objects/vitest.config.mts",
778
+ content: `import { defineConfig } from 'vitest/config';
779
+
780
+ export default defineConfig({
781
+ test: {
782
+ globals: true,
783
+ },
784
+ });
678
785
  `
679
786
  },
680
787
  {
@@ -792,7 +899,7 @@ export default defineConfig([
792
899
  "build": "pnpm -r --if-present build",
793
900
  "lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
794
901
  "lint:types": "pnpm -r --if-present lint:types",
795
- "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
902
+ "lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
796
903
  "lint:format": "prettier --check .",
797
904
  "fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
798
905
  "fix:format": "prettier --write .",
@@ -838,7 +945,7 @@ declarations:
838
945
  content: `#!/usr/bin/env tsx
839
946
  /**
840
947
  * Runs tests across the workspace:
841
- * - vitest for script extensions and custom objects (extensions/*)
948
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
842
949
  * - jest for UI extensions (ui/)
843
950
  */
844
951
  import { existsSync, readdirSync } from 'node:fs';
@@ -848,6 +955,8 @@ const hasExtensions =
848
955
  existsSync('extensions') &&
849
956
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
850
957
 
958
+ const hasCustomObjects = existsSync('custom-objects/package.json');
959
+
851
960
  const hasUI = existsSync('ui/package.json');
852
961
 
853
962
  let exitCode = 0;
@@ -860,7 +969,7 @@ function run(cmd: string): void {
860
969
  }
861
970
  }
862
971
 
863
- if (hasExtensions) {
972
+ if (hasExtensions || hasCustomObjects) {
864
973
  run('vitest run');
865
974
  }
866
975
 
@@ -1640,11 +1749,33 @@ function _devNpmDep(name, version) {
1640
1749
  return { type: "dev-npm", name, version };
1641
1750
  }
1642
1751
 
1752
+ // src/workspace-versions.json
1753
+ var workspace_versions_default = {
1754
+ "@stripe/extensibility-custom-objects": "0.8.0",
1755
+ "@stripe/extensibility-custom-objects-tools": "0.42.1",
1756
+ "@stripe/extensibility-dev-tools": "0.25.1",
1757
+ "@stripe/extensibility-eslint-plugin": "0.17.1",
1758
+ "@stripe/extensibility-language-server": "0.3.4",
1759
+ "@stripe/extensibility-sdk": "0.27.1",
1760
+ "@stripe/extensibility-test-helpers": "0.2.7"
1761
+ };
1762
+
1763
+ // src/workspace-versions.ts
1764
+ var _workspaceVersions = workspace_versions_default;
1765
+ function _workspaceVersion(packageName) {
1766
+ const v = _workspaceVersions[packageName];
1767
+ if (v === void 0) {
1768
+ throw new Error(
1769
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1770
+ );
1771
+ }
1772
+ return v;
1773
+ }
1774
+
1643
1775
  // src/templates/extensions/base.ts
1644
- var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
1645
1776
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1646
1777
  var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
1647
- var LANGUAGE_SERVER_PACKAGE_VERSION = `^${(0, import_extensibility_tool_utils7._workspaceVersion)(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1778
+ var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1648
1779
  function _createExtensionEslintConfigFile(params, context) {
1649
1780
  const { id, extensionInterfaceId } = params;
1650
1781
  const { fs: fs2 } = context;
@@ -1687,7 +1818,7 @@ function _createBaseOutput(params, context) {
1687
1818
  dependencies: {
1688
1819
  // Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
1689
1820
  // must match the version that generated the extension scaffolding.
1690
- runtime: [_npmDep(SDK_PACKAGE_NAME, (0, import_extensibility_tool_utils7._workspaceVersion)(SDK_PACKAGE_NAME))],
1821
+ runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
1691
1822
  dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
1692
1823
  },
1693
1824
  postGenerationHooks: [
@@ -1946,14 +2077,14 @@ var billing_bill_discount_calculation_default = {
1946
2077
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1947
2078
  };
1948
2079
 
1949
- // src/templates/extensions/billing.invoice_collection_setting.ts
1950
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1951
- var invoiceCollectionSettingTemplate = {
2080
+ // src/templates/extensions/billing.invoice_collection_options.ts
2081
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
2082
+ var invoiceCollectionOptionsTemplate = {
1952
2083
  hidden: true,
1953
2084
  methods: {
1954
- collection_override: { implementation_types: ["script"] }
2085
+ override_options: { implementation_types: ["script"] }
1955
2086
  },
1956
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
2087
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1957
2088
  generate: (params, context) => {
1958
2089
  const { id } = params;
1959
2090
  const { fs: fs2 } = context;
@@ -1981,15 +2112,15 @@ var invoiceCollectionSettingTemplate = {
1981
2112
  ...base.files
1982
2113
  ],
1983
2114
  methods: {
1984
- collection_override: {
2115
+ override_options: {
1985
2116
  implementation_type: "script"
1986
2117
  }
1987
2118
  }
1988
2119
  };
1989
2120
  }
1990
2121
  };
1991
- var billing_invoice_collection_setting_default = {
1992
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
2122
+ var billing_invoice_collection_options_default = {
2123
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1993
2124
  };
1994
2125
 
1995
2126
  // src/templates/extensions/billing.prorations.ts
@@ -2097,7 +2228,7 @@ var DEFAULT_TEMPLATES = {
2097
2228
  ...extend_workflows_custom_action_default,
2098
2229
  ...billing_customer_balance_application_default,
2099
2230
  ...billing_bill_discount_calculation_default,
2100
- ...billing_invoice_collection_setting_default,
2231
+ ...billing_invoice_collection_options_default,
2101
2232
  ...billing_prorations_default,
2102
2233
  ...billing_recurring_billing_item_handling_default
2103
2234
  };
@@ -2110,9 +2241,8 @@ var _templateManager = new _ExtensionTemplateManager(
2110
2241
  );
2111
2242
 
2112
2243
  // src/templates/root/index.ts
2113
- var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
2114
2244
  var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
2115
- var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${(0, import_extensibility_tool_utils8._workspaceVersion)(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2245
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2116
2246
  var _rootWorkspaceTemplate = {
2117
2247
  generate: (params, context) => {
2118
2248
  const { fs: fs2 } = context;
@@ -2167,14 +2297,14 @@ var _rootWorkspaceTemplate = {
2167
2297
  path: "custom-objects/package.json",
2168
2298
  content: fs2.mustache(
2169
2299
  {
2170
- customObjectsVersion: (0, import_extensibility_tool_utils8._workspaceVersion)(
2300
+ customObjectsVersion: _workspaceVersion(
2171
2301
  "@stripe/extensibility-custom-objects"
2172
2302
  ),
2173
- sdkVersion: (0, import_extensibility_tool_utils8._workspaceVersion)("@stripe/extensibility-sdk"),
2174
- customObjectsToolsVersion: (0, import_extensibility_tool_utils8._workspaceVersion)(
2303
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
2304
+ customObjectsToolsVersion: _workspaceVersion(
2175
2305
  "@stripe/extensibility-custom-objects-tools"
2176
2306
  ),
2177
- testHelpersVersion: (0, import_extensibility_tool_utils8._workspaceVersion)("@stripe/extensibility-test-helpers")
2307
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
2178
2308
  },
2179
2309
  "custom-objects",
2180
2310
  "package.json.mustache"
@@ -2186,6 +2316,16 @@ var _rootWorkspaceTemplate = {
2186
2316
  content: fs2.textFile("custom-objects/tsconfig.json"),
2187
2317
  precious: true
2188
2318
  },
2319
+ {
2320
+ path: "custom-objects/eslint.config.mts",
2321
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
2322
+ precious: true
2323
+ },
2324
+ {
2325
+ path: "custom-objects/vitest.config.mts",
2326
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
2327
+ precious: true
2328
+ },
2189
2329
  {
2190
2330
  path: "ui/package.json",
2191
2331
  content: fs2.textFile("ui/package.json"),
@@ -2212,7 +2352,7 @@ var _rootWorkspaceTemplate = {
2212
2352
  _devNpmDep("@types/node", "^20.19.0"),
2213
2353
  _devNpmDep(
2214
2354
  "@stripe/extensibility-dev-tools",
2215
- `^${(0, import_extensibility_tool_utils8._workspaceVersion)("@stripe/extensibility-dev-tools")}`
2355
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
2216
2356
  ),
2217
2357
  _devNpmDep("concurrently", "^9.2.1"),
2218
2358
  _devNpmDep("eslint", "^9.0.0"),