@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.
- package/dist/bin/build-custom-object-definitions.cjs +169 -34
- package/dist/bin/build-custom-object-definitions.js +160 -25
- package/dist/bin/create-upload-image.cjs +168 -33
- package/dist/bin/create-upload-image.js +160 -25
- package/dist/bin/dev-tools-rpc.cjs +203 -59
- package/dist/bin/dev-tools-rpc.js +178 -34
- package/dist/bin/gen-workspace.cjs +191 -47
- package/dist/bin/gen-workspace.js +178 -34
- package/dist/bin/template-info.cjs +165 -30
- package/dist/bin/template-info.js +160 -25
- package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts +32 -0
- package/dist/custom-objects/generated/proto/custom_objects/pub/api/app_api/object_definitions_app_service.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/google/protobuf/descriptor.pb.d.ts +2 -2
- package/dist/custom-objects/generated/proto/google/protobuf/wrappers.pb.d.ts +168 -0
- package/dist/custom-objects/generated/proto/google/protobuf/wrappers.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts +4 -4
- package/dist/custom-objects/generated/proto/proto/extensions.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/proto/model/common/common_model.pb.d.ts +1553 -0
- package/dist/custom-objects/generated/proto/vendor/proto/model/common/common_model.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/proto/model/common/kronos_model.pb.d.ts +1372 -0
- package/dist/custom-objects/generated/proto/vendor/proto/model/common/kronos_model.pb.d.ts.map +1 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts +2 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/api_group_enum.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts +2 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/extension_interface.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts +14 -2
- package/dist/custom-objects/generated/proto/vendor/publicapi/feature_enum.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts +6 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/http_error_status.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts +74 -0
- package/dist/custom-objects/generated/proto/vendor/publicapi/rollout_configs.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts +10 -3
- package/dist/custom-objects/generated/proto/vendor/publicapi/v2ext.pb.d.ts.map +1 -1
- package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts +1 -0
- package/dist/custom-objects/generated/proto/vendor/vext/privacy_unified_annotations.pb.d.ts.map +1 -1
- package/dist/index.cjs +196 -52
- package/dist/index.js +178 -34
- package/dist/templates/extensions/billing.invoice_collection_options.d.ts +6 -0
- package/dist/templates/extensions/billing.invoice_collection_options.d.ts.map +1 -0
- package/dist/templates/index.cjs +178 -34
- package/dist/templates/index.js +176 -32
- package/dist/templates/root/index.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/workspace/index.cjs +187 -43
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +178 -34
- package/dist/workspace-versions.d.ts +26 -0
- package/dist/workspace-versions.d.ts.map +1 -0
- package/package.json +4 -4
- package/templates/extensions/billing.invoice_collection_options/index.test.ts +15 -0
- package/templates/extensions/billing.invoice_collection_options/index.ts +16 -0
- package/templates/root/custom-objects/eslint.config.mts +89 -0
- package/templates/root/custom-objects/package.json.mustache +2 -0
- package/templates/root/custom-objects/tsconfig.json +1 -0
- package/templates/root/custom-objects/vitest.config.mts +7 -0
- package/templates/root/package.json.mustache +1 -1
- package/templates/root/pnpm-workspace.yaml +4 -0
- package/templates/root/tools/test.mts +4 -2
- package/dist/templates/extensions/billing.invoice_collection_setting.d.ts +0 -6
- package/dist/templates/extensions/billing.invoice_collection_setting.d.ts.map +0 -1
- package/templates/extensions/billing.invoice_collection_setting/index.test.ts +0 -15
- package/templates/extensions/billing.invoice_collection_setting/index.ts +0 -16
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/bin/gen-workspace.ts
|
|
27
27
|
var import_yargs = __toESM(require("yargs"), 1);
|
|
28
28
|
var import_helpers = require("yargs/helpers");
|
|
29
|
-
var
|
|
29
|
+
var import_extensibility_tool_utils10 = require("@stripe/extensibility-tool-utils");
|
|
30
30
|
|
|
31
31
|
// src/workspace/index.ts
|
|
32
32
|
var import_zod = require("zod");
|
|
@@ -586,7 +586,7 @@ var _DependencyManager = class {
|
|
|
586
586
|
|
|
587
587
|
// src/workspace/index.ts
|
|
588
588
|
var import_internal = require("@stripe/extensibility-custom-objects-tools/internal");
|
|
589
|
-
var
|
|
589
|
+
var import_extensibility_tool_utils9 = require("@stripe/extensibility-tool-utils");
|
|
590
590
|
|
|
591
591
|
// src/manifest/stripe-app-manifest.ts
|
|
592
592
|
var import_extensibility_tool_utils3 = require("@stripe/extensibility-tool-utils");
|
|
@@ -1247,35 +1247,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
|
|
|
1247
1247
|
`
|
|
1248
1248
|
},
|
|
1249
1249
|
{
|
|
1250
|
-
path: "extensions/billing.
|
|
1250
|
+
path: "extensions/billing.invoice_collection_options/index.test.ts",
|
|
1251
1251
|
content: `import { beforeEach, describe, it, expect } from 'vitest';
|
|
1252
1252
|
|
|
1253
|
-
import
|
|
1253
|
+
import MyInvoiceCollectionOptions from './index.js';
|
|
1254
1254
|
|
|
1255
|
-
describe('
|
|
1256
|
-
let instance:
|
|
1255
|
+
describe('MyInvoiceCollectionOptions', () => {
|
|
1256
|
+
let instance: MyInvoiceCollectionOptions;
|
|
1257
1257
|
|
|
1258
1258
|
beforeEach(() => {
|
|
1259
|
-
instance = new
|
|
1259
|
+
instance = new MyInvoiceCollectionOptions();
|
|
1260
1260
|
});
|
|
1261
1261
|
|
|
1262
1262
|
it('should be constructable', () => {
|
|
1263
|
-
expect(instance).toBeInstanceOf(
|
|
1263
|
+
expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
|
|
1264
1264
|
});
|
|
1265
1265
|
});
|
|
1266
1266
|
`
|
|
1267
1267
|
},
|
|
1268
1268
|
{
|
|
1269
|
-
path: "extensions/billing.
|
|
1269
|
+
path: "extensions/billing.invoice_collection_options/index.ts",
|
|
1270
1270
|
content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
1271
1271
|
|
|
1272
1272
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1273
|
-
interface
|
|
1273
|
+
interface MyInvoiceCollectionOptionsConfig {}
|
|
1274
1274
|
|
|
1275
|
-
export default class
|
|
1276
|
-
|
|
1277
|
-
_request: Billing.
|
|
1278
|
-
_config:
|
|
1275
|
+
export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
|
|
1276
|
+
overrideOptions(
|
|
1277
|
+
_request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
|
|
1278
|
+
_config: MyInvoiceCollectionOptionsConfig,
|
|
1279
1279
|
_context: Context
|
|
1280
1280
|
) {
|
|
1281
1281
|
// TODO: implement your collection setting logic here
|
|
@@ -1747,6 +1747,99 @@ install-deps.log
|
|
|
1747
1747
|
|
|
1748
1748
|
# generated schemas
|
|
1749
1749
|
generated
|
|
1750
|
+
`
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
path: "root/custom-objects/eslint.config.mts",
|
|
1754
|
+
content: `import eslint from '@eslint/js';
|
|
1755
|
+
import { defineConfig } from 'eslint/config';
|
|
1756
|
+
import tseslint from 'typescript-eslint';
|
|
1757
|
+
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
1758
|
+
|
|
1759
|
+
import globals from 'globals';
|
|
1760
|
+
|
|
1761
|
+
import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
|
|
1762
|
+
import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
|
|
1763
|
+
|
|
1764
|
+
export default defineConfig([
|
|
1765
|
+
eslint.configs.recommended,
|
|
1766
|
+
...tseslint.configs.recommended,
|
|
1767
|
+
...stripeAppsConfig,
|
|
1768
|
+
...customObjectsConfig,
|
|
1769
|
+
|
|
1770
|
+
// Global ignores
|
|
1771
|
+
{
|
|
1772
|
+
ignores: ['dist', 'generated', 'node_modules'],
|
|
1773
|
+
},
|
|
1774
|
+
|
|
1775
|
+
// TypeScript source files (with type-checking)
|
|
1776
|
+
{
|
|
1777
|
+
name: 'sources',
|
|
1778
|
+
files: ['src/**/*.ts'],
|
|
1779
|
+
ignores: ['**/*.test.ts', '**/__tests__/**'],
|
|
1780
|
+
languageOptions: {
|
|
1781
|
+
globals: {
|
|
1782
|
+
...globals.node,
|
|
1783
|
+
},
|
|
1784
|
+
parserOptions: {
|
|
1785
|
+
projectService: true,
|
|
1786
|
+
tsconfigRootDir: import.meta.dirname,
|
|
1787
|
+
},
|
|
1788
|
+
},
|
|
1789
|
+
},
|
|
1790
|
+
|
|
1791
|
+
// Test files
|
|
1792
|
+
{
|
|
1793
|
+
name: 'tests',
|
|
1794
|
+
files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
|
|
1795
|
+
languageOptions: {
|
|
1796
|
+
globals: {
|
|
1797
|
+
...globals.node,
|
|
1798
|
+
},
|
|
1799
|
+
parserOptions: {
|
|
1800
|
+
projectService: true,
|
|
1801
|
+
tsconfigRootDir: import.meta.dirname,
|
|
1802
|
+
},
|
|
1803
|
+
},
|
|
1804
|
+
},
|
|
1805
|
+
|
|
1806
|
+
// Config files
|
|
1807
|
+
{
|
|
1808
|
+
name: 'ts-configs',
|
|
1809
|
+
files: ['*.config.m?ts', 'eslint.config.mts'],
|
|
1810
|
+
languageOptions: {
|
|
1811
|
+
globals: {
|
|
1812
|
+
...globals.node,
|
|
1813
|
+
},
|
|
1814
|
+
parserOptions: {
|
|
1815
|
+
projectService: false,
|
|
1816
|
+
},
|
|
1817
|
+
},
|
|
1818
|
+
rules: {
|
|
1819
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
1820
|
+
},
|
|
1821
|
+
},
|
|
1822
|
+
|
|
1823
|
+
// JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
|
|
1824
|
+
// disable the TS-parser-specific rule that doesn't apply without it.
|
|
1825
|
+
{
|
|
1826
|
+
name: 'js-configs',
|
|
1827
|
+
files: ['**/*.js', '**/*.mjs'],
|
|
1828
|
+
languageOptions: {
|
|
1829
|
+
globals: {
|
|
1830
|
+
...globals.node,
|
|
1831
|
+
},
|
|
1832
|
+
parserOptions: {
|
|
1833
|
+
projectService: false,
|
|
1834
|
+
},
|
|
1835
|
+
},
|
|
1836
|
+
rules: {
|
|
1837
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
1838
|
+
},
|
|
1839
|
+
},
|
|
1840
|
+
|
|
1841
|
+
eslintConfigPrettier,
|
|
1842
|
+
]);
|
|
1750
1843
|
`
|
|
1751
1844
|
},
|
|
1752
1845
|
{
|
|
@@ -1759,7 +1852,9 @@ generated
|
|
|
1759
1852
|
"private": true,
|
|
1760
1853
|
"scripts": {
|
|
1761
1854
|
"build": "test -d src && custom-objects-build --input src --output dist || true",
|
|
1855
|
+
"lint": "pnpm lint:types && pnpm lint:eslint",
|
|
1762
1856
|
"lint:types": "test ! -d src || tsc --noEmit",
|
|
1857
|
+
"lint:eslint": "eslint .",
|
|
1763
1858
|
"test": "vitest run"
|
|
1764
1859
|
},
|
|
1765
1860
|
"dependencies": {
|
|
@@ -1782,8 +1877,20 @@ generated
|
|
|
1782
1877
|
"moduleResolution": "bundler",
|
|
1783
1878
|
"types": ["vitest/globals"]
|
|
1784
1879
|
},
|
|
1880
|
+
"include": ["src/**/*.ts"],
|
|
1785
1881
|
"exclude": ["dist"]
|
|
1786
1882
|
}
|
|
1883
|
+
`
|
|
1884
|
+
},
|
|
1885
|
+
{
|
|
1886
|
+
path: "root/custom-objects/vitest.config.mts",
|
|
1887
|
+
content: `import { defineConfig } from 'vitest/config';
|
|
1888
|
+
|
|
1889
|
+
export default defineConfig({
|
|
1890
|
+
test: {
|
|
1891
|
+
globals: true,
|
|
1892
|
+
},
|
|
1893
|
+
});
|
|
1787
1894
|
`
|
|
1788
1895
|
},
|
|
1789
1896
|
{
|
|
@@ -1901,7 +2008,7 @@ export default defineConfig([
|
|
|
1901
2008
|
"build": "pnpm -r --if-present build",
|
|
1902
2009
|
"lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
|
|
1903
2010
|
"lint:types": "pnpm -r --if-present lint:types",
|
|
1904
|
-
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
|
|
2011
|
+
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
|
|
1905
2012
|
"lint:format": "prettier --check .",
|
|
1906
2013
|
"fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
|
|
1907
2014
|
"fix:format": "prettier --write .",
|
|
@@ -1930,6 +2037,10 @@ export default defineConfig([
|
|
|
1930
2037
|
|
|
1931
2038
|
overrides:
|
|
1932
2039
|
vite: ^6.0.0
|
|
2040
|
+
|
|
2041
|
+
allowBuilds:
|
|
2042
|
+
core-js-pure: false
|
|
2043
|
+
esbuild: false
|
|
1933
2044
|
`
|
|
1934
2045
|
},
|
|
1935
2046
|
{
|
|
@@ -1947,7 +2058,7 @@ declarations:
|
|
|
1947
2058
|
content: `#!/usr/bin/env tsx
|
|
1948
2059
|
/**
|
|
1949
2060
|
* Runs tests across the workspace:
|
|
1950
|
-
* - vitest for script extensions and custom objects (
|
|
2061
|
+
* - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
|
|
1951
2062
|
* - jest for UI extensions (ui/)
|
|
1952
2063
|
*/
|
|
1953
2064
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -1957,6 +2068,8 @@ const hasExtensions =
|
|
|
1957
2068
|
existsSync('extensions') &&
|
|
1958
2069
|
readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
|
|
1959
2070
|
|
|
2071
|
+
const hasCustomObjects = existsSync('custom-objects/package.json');
|
|
2072
|
+
|
|
1960
2073
|
const hasUI = existsSync('ui/package.json');
|
|
1961
2074
|
|
|
1962
2075
|
let exitCode = 0;
|
|
@@ -1969,7 +2082,7 @@ function run(cmd: string): void {
|
|
|
1969
2082
|
}
|
|
1970
2083
|
}
|
|
1971
2084
|
|
|
1972
|
-
if (hasExtensions) {
|
|
2085
|
+
if (hasExtensions || hasCustomObjects) {
|
|
1973
2086
|
run('vitest run');
|
|
1974
2087
|
}
|
|
1975
2088
|
|
|
@@ -2733,11 +2846,33 @@ var _ExtensionTemplateManager = class extends import_extensibility_tool_utils4._
|
|
|
2733
2846
|
}
|
|
2734
2847
|
};
|
|
2735
2848
|
|
|
2849
|
+
// src/workspace-versions.json
|
|
2850
|
+
var workspace_versions_default = {
|
|
2851
|
+
"@stripe/extensibility-custom-objects": "1.0.0",
|
|
2852
|
+
"@stripe/extensibility-custom-objects-tools": "4.0.1",
|
|
2853
|
+
"@stripe/extensibility-dev-tools": "1.0.2",
|
|
2854
|
+
"@stripe/extensibility-eslint-plugin": "1.0.0",
|
|
2855
|
+
"@stripe/extensibility-language-server": "1.0.0",
|
|
2856
|
+
"@stripe/extensibility-sdk": "1.0.0",
|
|
2857
|
+
"@stripe/extensibility-test-helpers": "1.0.0"
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
// src/workspace-versions.ts
|
|
2861
|
+
var _workspaceVersions = workspace_versions_default;
|
|
2862
|
+
function _workspaceVersion(packageName) {
|
|
2863
|
+
const v = _workspaceVersions[packageName];
|
|
2864
|
+
if (v === void 0) {
|
|
2865
|
+
throw new Error(
|
|
2866
|
+
`Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
|
|
2867
|
+
);
|
|
2868
|
+
}
|
|
2869
|
+
return v;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2736
2872
|
// src/templates/extensions/base.ts
|
|
2737
|
-
var import_extensibility_tool_utils9 = require("@stripe/extensibility-tool-utils");
|
|
2738
2873
|
var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
|
|
2739
2874
|
var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
|
|
2740
|
-
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${
|
|
2875
|
+
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
|
|
2741
2876
|
function _createExtensionEslintConfigFile(params, context) {
|
|
2742
2877
|
const { id, extensionInterfaceId } = params;
|
|
2743
2878
|
const { fs: fs2 } = context;
|
|
@@ -2780,7 +2915,7 @@ function _createBaseOutput(params, context) {
|
|
|
2780
2915
|
dependencies: {
|
|
2781
2916
|
// Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
|
|
2782
2917
|
// must match the version that generated the extension scaffolding.
|
|
2783
|
-
runtime: [_npmDep(SDK_PACKAGE_NAME,
|
|
2918
|
+
runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
|
|
2784
2919
|
dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
|
|
2785
2920
|
},
|
|
2786
2921
|
postGenerationHooks: [
|
|
@@ -3039,14 +3174,14 @@ var billing_bill_discount_calculation_default = {
|
|
|
3039
3174
|
[EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
|
|
3040
3175
|
};
|
|
3041
3176
|
|
|
3042
|
-
// src/templates/extensions/billing.
|
|
3043
|
-
var EXTENSION_INTERFACE_ID6 = "billing.
|
|
3044
|
-
var
|
|
3177
|
+
// src/templates/extensions/billing.invoice_collection_options.ts
|
|
3178
|
+
var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
|
|
3179
|
+
var invoiceCollectionOptionsTemplate = {
|
|
3045
3180
|
hidden: true,
|
|
3046
3181
|
methods: {
|
|
3047
|
-
|
|
3182
|
+
override_options: { implementation_types: ["script"] }
|
|
3048
3183
|
},
|
|
3049
|
-
description: "Use Stripe Scripts to create custom invoice collection
|
|
3184
|
+
description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
|
|
3050
3185
|
generate: (params, context) => {
|
|
3051
3186
|
const { id } = params;
|
|
3052
3187
|
const { fs: fs2 } = context;
|
|
@@ -3074,15 +3209,15 @@ var invoiceCollectionSettingTemplate = {
|
|
|
3074
3209
|
...base.files
|
|
3075
3210
|
],
|
|
3076
3211
|
methods: {
|
|
3077
|
-
|
|
3212
|
+
override_options: {
|
|
3078
3213
|
implementation_type: "script"
|
|
3079
3214
|
}
|
|
3080
3215
|
}
|
|
3081
3216
|
};
|
|
3082
3217
|
}
|
|
3083
3218
|
};
|
|
3084
|
-
var
|
|
3085
|
-
[EXTENSION_INTERFACE_ID6]:
|
|
3219
|
+
var billing_invoice_collection_options_default = {
|
|
3220
|
+
[EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
|
|
3086
3221
|
};
|
|
3087
3222
|
|
|
3088
3223
|
// src/templates/extensions/billing.prorations.ts
|
|
@@ -3190,7 +3325,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
3190
3325
|
...extend_workflows_custom_action_default,
|
|
3191
3326
|
...billing_customer_balance_application_default,
|
|
3192
3327
|
...billing_bill_discount_calculation_default,
|
|
3193
|
-
...
|
|
3328
|
+
...billing_invoice_collection_options_default,
|
|
3194
3329
|
...billing_prorations_default,
|
|
3195
3330
|
...billing_recurring_billing_item_handling_default
|
|
3196
3331
|
};
|
|
@@ -3203,9 +3338,8 @@ var _templateManager = new _ExtensionTemplateManager(
|
|
|
3203
3338
|
);
|
|
3204
3339
|
|
|
3205
3340
|
// src/templates/root/index.ts
|
|
3206
|
-
var import_extensibility_tool_utils10 = require("@stripe/extensibility-tool-utils");
|
|
3207
3341
|
var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
|
|
3208
|
-
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${
|
|
3342
|
+
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
|
|
3209
3343
|
var _rootWorkspaceTemplate = {
|
|
3210
3344
|
generate: (params, context) => {
|
|
3211
3345
|
const { fs: fs2 } = context;
|
|
@@ -3260,14 +3394,14 @@ var _rootWorkspaceTemplate = {
|
|
|
3260
3394
|
path: "custom-objects/package.json",
|
|
3261
3395
|
content: fs2.mustache(
|
|
3262
3396
|
{
|
|
3263
|
-
customObjectsVersion:
|
|
3397
|
+
customObjectsVersion: _workspaceVersion(
|
|
3264
3398
|
"@stripe/extensibility-custom-objects"
|
|
3265
3399
|
),
|
|
3266
|
-
sdkVersion:
|
|
3267
|
-
customObjectsToolsVersion:
|
|
3400
|
+
sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
|
|
3401
|
+
customObjectsToolsVersion: _workspaceVersion(
|
|
3268
3402
|
"@stripe/extensibility-custom-objects-tools"
|
|
3269
3403
|
),
|
|
3270
|
-
testHelpersVersion:
|
|
3404
|
+
testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
|
|
3271
3405
|
},
|
|
3272
3406
|
"custom-objects",
|
|
3273
3407
|
"package.json.mustache"
|
|
@@ -3279,6 +3413,16 @@ var _rootWorkspaceTemplate = {
|
|
|
3279
3413
|
content: fs2.textFile("custom-objects/tsconfig.json"),
|
|
3280
3414
|
precious: true
|
|
3281
3415
|
},
|
|
3416
|
+
{
|
|
3417
|
+
path: "custom-objects/eslint.config.mts",
|
|
3418
|
+
content: fs2.textFile("custom-objects/eslint.config.mts"),
|
|
3419
|
+
precious: true
|
|
3420
|
+
},
|
|
3421
|
+
{
|
|
3422
|
+
path: "custom-objects/vitest.config.mts",
|
|
3423
|
+
content: fs2.textFile("custom-objects/vitest.config.mts"),
|
|
3424
|
+
precious: true
|
|
3425
|
+
},
|
|
3282
3426
|
{
|
|
3283
3427
|
path: "ui/package.json",
|
|
3284
3428
|
content: fs2.textFile("ui/package.json"),
|
|
@@ -3305,7 +3449,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3305
3449
|
_devNpmDep("@types/node", "^20.19.0"),
|
|
3306
3450
|
_devNpmDep(
|
|
3307
3451
|
"@stripe/extensibility-dev-tools",
|
|
3308
|
-
`^${
|
|
3452
|
+
`^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
|
|
3309
3453
|
),
|
|
3310
3454
|
_devNpmDep("concurrently", "^9.2.1"),
|
|
3311
3455
|
_devNpmDep("eslint", "^9.0.0"),
|
|
@@ -3399,7 +3543,7 @@ async function _resolvePackageMetadata(providedId, providedName, packageDir) {
|
|
|
3399
3543
|
name ??= id;
|
|
3400
3544
|
return { id, name, version };
|
|
3401
3545
|
}
|
|
3402
|
-
function runPostGenerationHooks(hooks, workingDir, disabled = false, context = (0,
|
|
3546
|
+
function runPostGenerationHooks(hooks, workingDir, disabled = false, context = (0, import_extensibility_tool_utils9._createCliContext)()) {
|
|
3403
3547
|
if (!hooks || hooks.length === 0 || disabled) {
|
|
3404
3548
|
return Promise.resolve();
|
|
3405
3549
|
}
|
|
@@ -3503,9 +3647,9 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3503
3647
|
workspaceDir: () => packageDir ?? import_node_path3.default.join(projectRoot, "custom-objects"),
|
|
3504
3648
|
generate: async (svc) => {
|
|
3505
3649
|
const customObjectsWorkspaceDir = packageDir ?? import_node_path3.default.join(projectRoot, "custom-objects");
|
|
3506
|
-
const
|
|
3650
|
+
const workspaceScaffoldingExists = (0, import_node_fs2.existsSync)(import_node_path3.default.join(customObjectsWorkspaceDir, "package.json")) && (0, import_node_fs2.existsSync)(import_node_path3.default.join(customObjectsWorkspaceDir, "tsconfig.json")) && (0, import_node_fs2.existsSync)(import_node_path3.default.join(customObjectsWorkspaceDir, "eslint.config.mts"));
|
|
3507
3651
|
const objectResult = await svc.generateCustomObject({ name: objectName });
|
|
3508
|
-
if (
|
|
3652
|
+
if (workspaceScaffoldingExists) {
|
|
3509
3653
|
return objectResult;
|
|
3510
3654
|
}
|
|
3511
3655
|
const workspaceResult = await svc.generateCustomObjectsWorkspace({});
|
|
@@ -3520,11 +3664,11 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3520
3664
|
finalize: async (_svc, _meta, root, _output, context) => {
|
|
3521
3665
|
context.ux.log("\nUpdating stripe-app.yaml...");
|
|
3522
3666
|
const manifestPath = import_node_path3.default.join(root, "stripe-app.yaml");
|
|
3523
|
-
const manifest = await (0,
|
|
3524
|
-
const apiName = (0,
|
|
3667
|
+
const manifest = await (0, import_extensibility_tool_utils9._openStripeAppManifest)(manifestPath);
|
|
3668
|
+
const apiName = (0, import_extensibility_tool_utils9._toSnakeCase)(objectName);
|
|
3525
3669
|
if (!manifest.hasCustomObject(apiName)) {
|
|
3526
3670
|
manifest.addCustomObject(apiName, `custom-objects/src/${apiName}.object.ts`);
|
|
3527
|
-
const tx = (0,
|
|
3671
|
+
const tx = (0, import_extensibility_tool_utils9._beginTransaction)();
|
|
3528
3672
|
tx.adopt(manifest);
|
|
3529
3673
|
const report = await tx.commit();
|
|
3530
3674
|
if (report.written.length > 0) {
|
|
@@ -3618,7 +3762,7 @@ var _defaultServices = {
|
|
|
3618
3762
|
};
|
|
3619
3763
|
},
|
|
3620
3764
|
generateCustomObjectsWorkspace: async (vars) => {
|
|
3621
|
-
const runner = new
|
|
3765
|
+
const runner = new import_extensibility_tool_utils9._GeneratorRunner(import_internal._customObjectsWorkspaceGenerator);
|
|
3622
3766
|
const plan = await runner.plan(vars, {
|
|
3623
3767
|
scope: "project",
|
|
3624
3768
|
projectRoot: process.cwd()
|
|
@@ -3632,7 +3776,7 @@ var _defaultServices = {
|
|
|
3632
3776
|
loadManifest: (manifestPath) => _StripeAppManifest.load(manifestPath),
|
|
3633
3777
|
runHooks: runPostGenerationHooks
|
|
3634
3778
|
};
|
|
3635
|
-
async function _regenAppProjectWorkspace(options, services = _defaultServices, context = (0,
|
|
3779
|
+
async function _regenAppProjectWorkspace(options, services = _defaultServices, context = (0, import_extensibility_tool_utils9._createCliContext)()) {
|
|
3636
3780
|
const isCustomObjectMode = options.templateId === "custom-object";
|
|
3637
3781
|
if (!isCustomObjectMode && !options.packageDir && !options.workspaceId) {
|
|
3638
3782
|
throw new Error("At least one of packageDir or workspaceId is required");
|
|
@@ -3753,7 +3897,7 @@ async function _regenAppProjectWorkspace(options, services = _defaultServices, c
|
|
|
3753
3897
|
}
|
|
3754
3898
|
|
|
3755
3899
|
// src/bin/gen-workspace.ts
|
|
3756
|
-
var logger3 = (0,
|
|
3900
|
+
var logger3 = (0, import_extensibility_tool_utils10._createLogger)({ name: "gen-workspace" });
|
|
3757
3901
|
async function main() {
|
|
3758
3902
|
await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).usage("Regenerate extension or root workspace files from templates").help().version(false).command(
|
|
3759
3903
|
"$0",
|
|
@@ -3816,7 +3960,7 @@ async function main() {
|
|
|
3816
3960
|
"Generate a new custom object definition and test"
|
|
3817
3961
|
),
|
|
3818
3962
|
async (args) => {
|
|
3819
|
-
const ctx = (0,
|
|
3963
|
+
const ctx = (0, import_extensibility_tool_utils10._createCliContext)();
|
|
3820
3964
|
const {
|
|
3821
3965
|
root,
|
|
3822
3966
|
templateId,
|
|
@@ -3848,7 +3992,7 @@ async function main() {
|
|
|
3848
3992
|
void 0,
|
|
3849
3993
|
ctx
|
|
3850
3994
|
);
|
|
3851
|
-
(0,
|
|
3995
|
+
(0, import_extensibility_tool_utils10._writeJsonOutput)(outputPath, { success: true });
|
|
3852
3996
|
}
|
|
3853
3997
|
).parse();
|
|
3854
3998
|
}
|