@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
@@ -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 .",
@@ -821,6 +928,10 @@ export default defineConfig([
821
928
 
822
929
  overrides:
823
930
  vite: ^6.0.0
931
+
932
+ allowBuilds:
933
+ core-js-pure: false
934
+ esbuild: false
824
935
  `
825
936
  },
826
937
  {
@@ -838,7 +949,7 @@ declarations:
838
949
  content: `#!/usr/bin/env tsx
839
950
  /**
840
951
  * Runs tests across the workspace:
841
- * - vitest for script extensions and custom objects (extensions/*)
952
+ * - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
842
953
  * - jest for UI extensions (ui/)
843
954
  */
844
955
  import { existsSync, readdirSync } from 'node:fs';
@@ -848,6 +959,8 @@ const hasExtensions =
848
959
  existsSync('extensions') &&
849
960
  readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
850
961
 
962
+ const hasCustomObjects = existsSync('custom-objects/package.json');
963
+
851
964
  const hasUI = existsSync('ui/package.json');
852
965
 
853
966
  let exitCode = 0;
@@ -860,7 +973,7 @@ function run(cmd: string): void {
860
973
  }
861
974
  }
862
975
 
863
- if (hasExtensions) {
976
+ if (hasExtensions || hasCustomObjects) {
864
977
  run('vitest run');
865
978
  }
866
979
 
@@ -1640,11 +1753,33 @@ function _devNpmDep(name, version) {
1640
1753
  return { type: "dev-npm", name, version };
1641
1754
  }
1642
1755
 
1756
+ // src/workspace-versions.json
1757
+ var workspace_versions_default = {
1758
+ "@stripe/extensibility-custom-objects": "1.0.0",
1759
+ "@stripe/extensibility-custom-objects-tools": "4.0.1",
1760
+ "@stripe/extensibility-dev-tools": "1.0.2",
1761
+ "@stripe/extensibility-eslint-plugin": "1.0.0",
1762
+ "@stripe/extensibility-language-server": "1.0.0",
1763
+ "@stripe/extensibility-sdk": "1.0.0",
1764
+ "@stripe/extensibility-test-helpers": "1.0.0"
1765
+ };
1766
+
1767
+ // src/workspace-versions.ts
1768
+ var _workspaceVersions = workspace_versions_default;
1769
+ function _workspaceVersion(packageName) {
1770
+ const v = _workspaceVersions[packageName];
1771
+ if (v === void 0) {
1772
+ throw new Error(
1773
+ `Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
1774
+ );
1775
+ }
1776
+ return v;
1777
+ }
1778
+
1643
1779
  // src/templates/extensions/base.ts
1644
- var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
1645
1780
  var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
1646
1781
  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)}`;
1782
+ var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
1648
1783
  function _createExtensionEslintConfigFile(params, context) {
1649
1784
  const { id, extensionInterfaceId } = params;
1650
1785
  const { fs: fs2 } = context;
@@ -1687,7 +1822,7 @@ function _createBaseOutput(params, context) {
1687
1822
  dependencies: {
1688
1823
  // Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
1689
1824
  // must match the version that generated the extension scaffolding.
1690
- runtime: [_npmDep(SDK_PACKAGE_NAME, (0, import_extensibility_tool_utils7._workspaceVersion)(SDK_PACKAGE_NAME))],
1825
+ runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
1691
1826
  dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
1692
1827
  },
1693
1828
  postGenerationHooks: [
@@ -1946,14 +2081,14 @@ var billing_bill_discount_calculation_default = {
1946
2081
  [EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
1947
2082
  };
1948
2083
 
1949
- // src/templates/extensions/billing.invoice_collection_setting.ts
1950
- var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_setting";
1951
- var invoiceCollectionSettingTemplate = {
2084
+ // src/templates/extensions/billing.invoice_collection_options.ts
2085
+ var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
2086
+ var invoiceCollectionOptionsTemplate = {
1952
2087
  hidden: true,
1953
2088
  methods: {
1954
- collection_override: { implementation_types: ["script"] }
2089
+ override_options: { implementation_types: ["script"] }
1955
2090
  },
1956
- description: "Use Stripe Scripts to create custom invoice collection logic that controls how your integration handles invoices generated from subscriptions.",
2091
+ description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
1957
2092
  generate: (params, context) => {
1958
2093
  const { id } = params;
1959
2094
  const { fs: fs2 } = context;
@@ -1981,15 +2116,15 @@ var invoiceCollectionSettingTemplate = {
1981
2116
  ...base.files
1982
2117
  ],
1983
2118
  methods: {
1984
- collection_override: {
2119
+ override_options: {
1985
2120
  implementation_type: "script"
1986
2121
  }
1987
2122
  }
1988
2123
  };
1989
2124
  }
1990
2125
  };
1991
- var billing_invoice_collection_setting_default = {
1992
- [EXTENSION_INTERFACE_ID6]: invoiceCollectionSettingTemplate
2126
+ var billing_invoice_collection_options_default = {
2127
+ [EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
1993
2128
  };
1994
2129
 
1995
2130
  // src/templates/extensions/billing.prorations.ts
@@ -2097,7 +2232,7 @@ var DEFAULT_TEMPLATES = {
2097
2232
  ...extend_workflows_custom_action_default,
2098
2233
  ...billing_customer_balance_application_default,
2099
2234
  ...billing_bill_discount_calculation_default,
2100
- ...billing_invoice_collection_setting_default,
2235
+ ...billing_invoice_collection_options_default,
2101
2236
  ...billing_prorations_default,
2102
2237
  ...billing_recurring_billing_item_handling_default
2103
2238
  };
@@ -2110,9 +2245,8 @@ var _templateManager = new _ExtensionTemplateManager(
2110
2245
  );
2111
2246
 
2112
2247
  // src/templates/root/index.ts
2113
- var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
2114
2248
  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)}`;
2249
+ var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
2116
2250
  var _rootWorkspaceTemplate = {
2117
2251
  generate: (params, context) => {
2118
2252
  const { fs: fs2 } = context;
@@ -2167,14 +2301,14 @@ var _rootWorkspaceTemplate = {
2167
2301
  path: "custom-objects/package.json",
2168
2302
  content: fs2.mustache(
2169
2303
  {
2170
- customObjectsVersion: (0, import_extensibility_tool_utils8._workspaceVersion)(
2304
+ customObjectsVersion: _workspaceVersion(
2171
2305
  "@stripe/extensibility-custom-objects"
2172
2306
  ),
2173
- sdkVersion: (0, import_extensibility_tool_utils8._workspaceVersion)("@stripe/extensibility-sdk"),
2174
- customObjectsToolsVersion: (0, import_extensibility_tool_utils8._workspaceVersion)(
2307
+ sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
2308
+ customObjectsToolsVersion: _workspaceVersion(
2175
2309
  "@stripe/extensibility-custom-objects-tools"
2176
2310
  ),
2177
- testHelpersVersion: (0, import_extensibility_tool_utils8._workspaceVersion)("@stripe/extensibility-test-helpers")
2311
+ testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
2178
2312
  },
2179
2313
  "custom-objects",
2180
2314
  "package.json.mustache"
@@ -2186,6 +2320,16 @@ var _rootWorkspaceTemplate = {
2186
2320
  content: fs2.textFile("custom-objects/tsconfig.json"),
2187
2321
  precious: true
2188
2322
  },
2323
+ {
2324
+ path: "custom-objects/eslint.config.mts",
2325
+ content: fs2.textFile("custom-objects/eslint.config.mts"),
2326
+ precious: true
2327
+ },
2328
+ {
2329
+ path: "custom-objects/vitest.config.mts",
2330
+ content: fs2.textFile("custom-objects/vitest.config.mts"),
2331
+ precious: true
2332
+ },
2189
2333
  {
2190
2334
  path: "ui/package.json",
2191
2335
  content: fs2.textFile("ui/package.json"),
@@ -2212,7 +2356,7 @@ var _rootWorkspaceTemplate = {
2212
2356
  _devNpmDep("@types/node", "^20.19.0"),
2213
2357
  _devNpmDep(
2214
2358
  "@stripe/extensibility-dev-tools",
2215
- `^${(0, import_extensibility_tool_utils8._workspaceVersion)("@stripe/extensibility-dev-tools")}`
2359
+ `^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
2216
2360
  ),
2217
2361
  _devNpmDep("concurrently", "^9.2.1"),
2218
2362
  _devNpmDep("eslint", "^9.0.0"),