@stripe/extensibility-dev-tools 0.24.2 → 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.
- package/dist/bin/build-custom-object-definitions.cjs +203 -46
- package/dist/bin/build-custom-object-definitions.js +194 -37
- package/dist/bin/create-upload-image.cjs +206 -46
- package/dist/bin/create-upload-image.js +201 -41
- package/dist/bin/dev-tools-rpc.cjs +199 -59
- package/dist/bin/dev-tools-rpc.js +174 -34
- package/dist/bin/gen-workspace.cjs +187 -47
- package/dist/bin/gen-workspace.js +174 -34
- package/dist/bin/template-info.cjs +161 -30
- package/dist/bin/template-info.js +156 -25
- package/dist/custom-objects/build-definitions.d.ts.map +1 -1
- 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 +192 -52
- package/dist/index.js +174 -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 +174 -34
- package/dist/templates/index.js +172 -32
- package/dist/templates/root/index.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/workspace/index.cjs +183 -43
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +174 -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/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
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/bin/dev-tools-rpc.ts
|
|
27
|
-
var
|
|
27
|
+
var import_extensibility_tool_utils11 = require("@stripe/extensibility-tool-utils");
|
|
28
28
|
|
|
29
29
|
// src/bin/rpc/types.ts
|
|
30
30
|
var RpcInvalidParamsError = class extends Error {
|
|
@@ -188,35 +188,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
|
|
|
188
188
|
`
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
path: "extensions/billing.
|
|
191
|
+
path: "extensions/billing.invoice_collection_options/index.test.ts",
|
|
192
192
|
content: `import { beforeEach, describe, it, expect } from 'vitest';
|
|
193
193
|
|
|
194
|
-
import
|
|
194
|
+
import MyInvoiceCollectionOptions from './index.js';
|
|
195
195
|
|
|
196
|
-
describe('
|
|
197
|
-
let instance:
|
|
196
|
+
describe('MyInvoiceCollectionOptions', () => {
|
|
197
|
+
let instance: MyInvoiceCollectionOptions;
|
|
198
198
|
|
|
199
199
|
beforeEach(() => {
|
|
200
|
-
instance = new
|
|
200
|
+
instance = new MyInvoiceCollectionOptions();
|
|
201
201
|
});
|
|
202
202
|
|
|
203
203
|
it('should be constructable', () => {
|
|
204
|
-
expect(instance).toBeInstanceOf(
|
|
204
|
+
expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
|
|
205
205
|
});
|
|
206
206
|
});
|
|
207
207
|
`
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
|
-
path: "extensions/billing.
|
|
210
|
+
path: "extensions/billing.invoice_collection_options/index.ts",
|
|
211
211
|
content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
212
212
|
|
|
213
213
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
214
|
-
interface
|
|
214
|
+
interface MyInvoiceCollectionOptionsConfig {}
|
|
215
215
|
|
|
216
|
-
export default class
|
|
217
|
-
|
|
218
|
-
_request: Billing.
|
|
219
|
-
_config:
|
|
216
|
+
export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
|
|
217
|
+
overrideOptions(
|
|
218
|
+
_request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
|
|
219
|
+
_config: MyInvoiceCollectionOptionsConfig,
|
|
220
220
|
_context: Context
|
|
221
221
|
) {
|
|
222
222
|
// TODO: implement your collection setting logic here
|
|
@@ -688,6 +688,99 @@ install-deps.log
|
|
|
688
688
|
|
|
689
689
|
# generated schemas
|
|
690
690
|
generated
|
|
691
|
+
`
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
path: "root/custom-objects/eslint.config.mts",
|
|
695
|
+
content: `import eslint from '@eslint/js';
|
|
696
|
+
import { defineConfig } from 'eslint/config';
|
|
697
|
+
import tseslint from 'typescript-eslint';
|
|
698
|
+
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
699
|
+
|
|
700
|
+
import globals from 'globals';
|
|
701
|
+
|
|
702
|
+
import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
|
|
703
|
+
import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
|
|
704
|
+
|
|
705
|
+
export default defineConfig([
|
|
706
|
+
eslint.configs.recommended,
|
|
707
|
+
...tseslint.configs.recommended,
|
|
708
|
+
...stripeAppsConfig,
|
|
709
|
+
...customObjectsConfig,
|
|
710
|
+
|
|
711
|
+
// Global ignores
|
|
712
|
+
{
|
|
713
|
+
ignores: ['dist', 'generated', 'node_modules'],
|
|
714
|
+
},
|
|
715
|
+
|
|
716
|
+
// TypeScript source files (with type-checking)
|
|
717
|
+
{
|
|
718
|
+
name: 'sources',
|
|
719
|
+
files: ['src/**/*.ts'],
|
|
720
|
+
ignores: ['**/*.test.ts', '**/__tests__/**'],
|
|
721
|
+
languageOptions: {
|
|
722
|
+
globals: {
|
|
723
|
+
...globals.node,
|
|
724
|
+
},
|
|
725
|
+
parserOptions: {
|
|
726
|
+
projectService: true,
|
|
727
|
+
tsconfigRootDir: import.meta.dirname,
|
|
728
|
+
},
|
|
729
|
+
},
|
|
730
|
+
},
|
|
731
|
+
|
|
732
|
+
// Test files
|
|
733
|
+
{
|
|
734
|
+
name: 'tests',
|
|
735
|
+
files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
|
|
736
|
+
languageOptions: {
|
|
737
|
+
globals: {
|
|
738
|
+
...globals.node,
|
|
739
|
+
},
|
|
740
|
+
parserOptions: {
|
|
741
|
+
projectService: true,
|
|
742
|
+
tsconfigRootDir: import.meta.dirname,
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
},
|
|
746
|
+
|
|
747
|
+
// Config files
|
|
748
|
+
{
|
|
749
|
+
name: 'ts-configs',
|
|
750
|
+
files: ['*.config.m?ts', 'eslint.config.mts'],
|
|
751
|
+
languageOptions: {
|
|
752
|
+
globals: {
|
|
753
|
+
...globals.node,
|
|
754
|
+
},
|
|
755
|
+
parserOptions: {
|
|
756
|
+
projectService: false,
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
rules: {
|
|
760
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
761
|
+
},
|
|
762
|
+
},
|
|
763
|
+
|
|
764
|
+
// JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
|
|
765
|
+
// disable the TS-parser-specific rule that doesn't apply without it.
|
|
766
|
+
{
|
|
767
|
+
name: 'js-configs',
|
|
768
|
+
files: ['**/*.js', '**/*.mjs'],
|
|
769
|
+
languageOptions: {
|
|
770
|
+
globals: {
|
|
771
|
+
...globals.node,
|
|
772
|
+
},
|
|
773
|
+
parserOptions: {
|
|
774
|
+
projectService: false,
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
rules: {
|
|
778
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
779
|
+
},
|
|
780
|
+
},
|
|
781
|
+
|
|
782
|
+
eslintConfigPrettier,
|
|
783
|
+
]);
|
|
691
784
|
`
|
|
692
785
|
},
|
|
693
786
|
{
|
|
@@ -700,7 +793,9 @@ generated
|
|
|
700
793
|
"private": true,
|
|
701
794
|
"scripts": {
|
|
702
795
|
"build": "test -d src && custom-objects-build --input src --output dist || true",
|
|
796
|
+
"lint": "pnpm lint:types && pnpm lint:eslint",
|
|
703
797
|
"lint:types": "test ! -d src || tsc --noEmit",
|
|
798
|
+
"lint:eslint": "eslint .",
|
|
704
799
|
"test": "vitest run"
|
|
705
800
|
},
|
|
706
801
|
"dependencies": {
|
|
@@ -723,8 +818,20 @@ generated
|
|
|
723
818
|
"moduleResolution": "bundler",
|
|
724
819
|
"types": ["vitest/globals"]
|
|
725
820
|
},
|
|
821
|
+
"include": ["src/**/*.ts"],
|
|
726
822
|
"exclude": ["dist"]
|
|
727
823
|
}
|
|
824
|
+
`
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
path: "root/custom-objects/vitest.config.mts",
|
|
828
|
+
content: `import { defineConfig } from 'vitest/config';
|
|
829
|
+
|
|
830
|
+
export default defineConfig({
|
|
831
|
+
test: {
|
|
832
|
+
globals: true,
|
|
833
|
+
},
|
|
834
|
+
});
|
|
728
835
|
`
|
|
729
836
|
},
|
|
730
837
|
{
|
|
@@ -842,7 +949,7 @@ export default defineConfig([
|
|
|
842
949
|
"build": "pnpm -r --if-present build",
|
|
843
950
|
"lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
|
|
844
951
|
"lint:types": "pnpm -r --if-present lint:types",
|
|
845
|
-
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
|
|
952
|
+
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
|
|
846
953
|
"lint:format": "prettier --check .",
|
|
847
954
|
"fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
|
|
848
955
|
"fix:format": "prettier --write .",
|
|
@@ -888,7 +995,7 @@ declarations:
|
|
|
888
995
|
content: `#!/usr/bin/env tsx
|
|
889
996
|
/**
|
|
890
997
|
* Runs tests across the workspace:
|
|
891
|
-
* - vitest for script extensions and custom objects (
|
|
998
|
+
* - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
|
|
892
999
|
* - jest for UI extensions (ui/)
|
|
893
1000
|
*/
|
|
894
1001
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -898,6 +1005,8 @@ const hasExtensions =
|
|
|
898
1005
|
existsSync('extensions') &&
|
|
899
1006
|
readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
|
|
900
1007
|
|
|
1008
|
+
const hasCustomObjects = existsSync('custom-objects/package.json');
|
|
1009
|
+
|
|
901
1010
|
const hasUI = existsSync('ui/package.json');
|
|
902
1011
|
|
|
903
1012
|
let exitCode = 0;
|
|
@@ -910,7 +1019,7 @@ function run(cmd: string): void {
|
|
|
910
1019
|
}
|
|
911
1020
|
}
|
|
912
1021
|
|
|
913
|
-
if (hasExtensions) {
|
|
1022
|
+
if (hasExtensions || hasCustomObjects) {
|
|
914
1023
|
run('vitest run');
|
|
915
1024
|
}
|
|
916
1025
|
|
|
@@ -1595,11 +1704,33 @@ var _DependencyManager = class {
|
|
|
1595
1704
|
}
|
|
1596
1705
|
};
|
|
1597
1706
|
|
|
1707
|
+
// src/workspace-versions.json
|
|
1708
|
+
var workspace_versions_default = {
|
|
1709
|
+
"@stripe/extensibility-custom-objects": "0.8.0",
|
|
1710
|
+
"@stripe/extensibility-custom-objects-tools": "0.42.1",
|
|
1711
|
+
"@stripe/extensibility-dev-tools": "0.25.1",
|
|
1712
|
+
"@stripe/extensibility-eslint-plugin": "0.17.1",
|
|
1713
|
+
"@stripe/extensibility-language-server": "0.3.4",
|
|
1714
|
+
"@stripe/extensibility-sdk": "0.27.1",
|
|
1715
|
+
"@stripe/extensibility-test-helpers": "0.2.7"
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1718
|
+
// src/workspace-versions.ts
|
|
1719
|
+
var _workspaceVersions = workspace_versions_default;
|
|
1720
|
+
function _workspaceVersion(packageName) {
|
|
1721
|
+
const v = _workspaceVersions[packageName];
|
|
1722
|
+
if (v === void 0) {
|
|
1723
|
+
throw new Error(
|
|
1724
|
+
`Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
return v;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1598
1730
|
// src/templates/extensions/base.ts
|
|
1599
|
-
var import_extensibility_tool_utils4 = require("@stripe/extensibility-tool-utils");
|
|
1600
1731
|
var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
|
|
1601
1732
|
var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
|
|
1602
|
-
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${
|
|
1733
|
+
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
|
|
1603
1734
|
function _createExtensionEslintConfigFile(params, context) {
|
|
1604
1735
|
const { id, extensionInterfaceId } = params;
|
|
1605
1736
|
const { fs: fs2 } = context;
|
|
@@ -1642,7 +1773,7 @@ function _createBaseOutput(params, context) {
|
|
|
1642
1773
|
dependencies: {
|
|
1643
1774
|
// Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
|
|
1644
1775
|
// must match the version that generated the extension scaffolding.
|
|
1645
|
-
runtime: [_npmDep(SDK_PACKAGE_NAME,
|
|
1776
|
+
runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
|
|
1646
1777
|
dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
|
|
1647
1778
|
},
|
|
1648
1779
|
postGenerationHooks: [
|
|
@@ -1901,14 +2032,14 @@ var billing_bill_discount_calculation_default = {
|
|
|
1901
2032
|
[EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
|
|
1902
2033
|
};
|
|
1903
2034
|
|
|
1904
|
-
// src/templates/extensions/billing.
|
|
1905
|
-
var EXTENSION_INTERFACE_ID6 = "billing.
|
|
1906
|
-
var
|
|
2035
|
+
// src/templates/extensions/billing.invoice_collection_options.ts
|
|
2036
|
+
var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
|
|
2037
|
+
var invoiceCollectionOptionsTemplate = {
|
|
1907
2038
|
hidden: true,
|
|
1908
2039
|
methods: {
|
|
1909
|
-
|
|
2040
|
+
override_options: { implementation_types: ["script"] }
|
|
1910
2041
|
},
|
|
1911
|
-
description: "Use Stripe Scripts to create custom invoice collection
|
|
2042
|
+
description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
|
|
1912
2043
|
generate: (params, context) => {
|
|
1913
2044
|
const { id } = params;
|
|
1914
2045
|
const { fs: fs2 } = context;
|
|
@@ -1936,15 +2067,15 @@ var invoiceCollectionSettingTemplate = {
|
|
|
1936
2067
|
...base.files
|
|
1937
2068
|
],
|
|
1938
2069
|
methods: {
|
|
1939
|
-
|
|
2070
|
+
override_options: {
|
|
1940
2071
|
implementation_type: "script"
|
|
1941
2072
|
}
|
|
1942
2073
|
}
|
|
1943
2074
|
};
|
|
1944
2075
|
}
|
|
1945
2076
|
};
|
|
1946
|
-
var
|
|
1947
|
-
[EXTENSION_INTERFACE_ID6]:
|
|
2077
|
+
var billing_invoice_collection_options_default = {
|
|
2078
|
+
[EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
|
|
1948
2079
|
};
|
|
1949
2080
|
|
|
1950
2081
|
// src/templates/extensions/billing.prorations.ts
|
|
@@ -2052,7 +2183,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
2052
2183
|
...extend_workflows_custom_action_default,
|
|
2053
2184
|
...billing_customer_balance_application_default,
|
|
2054
2185
|
...billing_bill_discount_calculation_default,
|
|
2055
|
-
...
|
|
2186
|
+
...billing_invoice_collection_options_default,
|
|
2056
2187
|
...billing_prorations_default,
|
|
2057
2188
|
...billing_recurring_billing_item_handling_default
|
|
2058
2189
|
};
|
|
@@ -2071,10 +2202,10 @@ var import_node_fs2 = require("fs");
|
|
|
2071
2202
|
var import_promises5 = require("fs/promises");
|
|
2072
2203
|
var import_node_child_process2 = require("child_process");
|
|
2073
2204
|
var import_internal = require("@stripe/extensibility-custom-objects-tools/internal");
|
|
2074
|
-
var
|
|
2205
|
+
var import_extensibility_tool_utils9 = require("@stripe/extensibility-tool-utils");
|
|
2075
2206
|
|
|
2076
2207
|
// src/manifest/stripe-app-manifest.ts
|
|
2077
|
-
var
|
|
2208
|
+
var import_extensibility_tool_utils5 = require("@stripe/extensibility-tool-utils");
|
|
2078
2209
|
|
|
2079
2210
|
// src/manifest/manifest-v1.ts
|
|
2080
2211
|
var import_fs2 = require("fs");
|
|
@@ -2199,7 +2330,7 @@ var _ManifestV1 = class __ManifestV1 {
|
|
|
2199
2330
|
// src/manifest/manifest-v2.ts
|
|
2200
2331
|
var import_promises = require("fs/promises");
|
|
2201
2332
|
var yaml = __toESM(require("yaml"), 1);
|
|
2202
|
-
var
|
|
2333
|
+
var import_extensibility_tool_utils4 = require("@stripe/extensibility-tool-utils");
|
|
2203
2334
|
function isNonEmptyString(value) {
|
|
2204
2335
|
return typeof value === "string" && value.trim().length > 0;
|
|
2205
2336
|
}
|
|
@@ -2315,7 +2446,7 @@ var _ManifestV2 = class __ManifestV2 {
|
|
|
2315
2446
|
id: def.id,
|
|
2316
2447
|
type: def.specification.type,
|
|
2317
2448
|
path: def.specification.content,
|
|
2318
|
-
name: (0,
|
|
2449
|
+
name: (0, import_extensibility_tool_utils4._toPascalCase)(def.id)
|
|
2319
2450
|
}));
|
|
2320
2451
|
}
|
|
2321
2452
|
/**
|
|
@@ -2553,7 +2684,7 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2553
2684
|
return this.v1.hasCustomObject(entry);
|
|
2554
2685
|
}
|
|
2555
2686
|
if (this.v2) {
|
|
2556
|
-
return this.v2.hasCustomObject((0,
|
|
2687
|
+
return this.v2.hasCustomObject((0, import_extensibility_tool_utils5._toSnakeCase)(entry.className));
|
|
2557
2688
|
}
|
|
2558
2689
|
return false;
|
|
2559
2690
|
}
|
|
@@ -2572,7 +2703,7 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2572
2703
|
return this.v1.addCustomObject(entry);
|
|
2573
2704
|
}
|
|
2574
2705
|
if (this.v2) {
|
|
2575
|
-
return this.v2.addCustomObject((0,
|
|
2706
|
+
return this.v2.addCustomObject((0, import_extensibility_tool_utils5._toSnakeCase)(entry.className), entry.filePath);
|
|
2576
2707
|
}
|
|
2577
2708
|
return false;
|
|
2578
2709
|
}
|
|
@@ -2590,7 +2721,7 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2590
2721
|
return this.v1.removeCustomObject(entry);
|
|
2591
2722
|
}
|
|
2592
2723
|
if (this.v2) {
|
|
2593
|
-
return this.v2.removeCustomObject((0,
|
|
2724
|
+
return this.v2.removeCustomObject((0, import_extensibility_tool_utils5._toSnakeCase)(entry.className));
|
|
2594
2725
|
}
|
|
2595
2726
|
return false;
|
|
2596
2727
|
}
|
|
@@ -2641,13 +2772,13 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2641
2772
|
};
|
|
2642
2773
|
|
|
2643
2774
|
// src/templates/simple-templates.ts
|
|
2644
|
-
var
|
|
2775
|
+
var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
|
|
2645
2776
|
|
|
2646
2777
|
// src/templates/file-writer.ts
|
|
2647
2778
|
var import_path = __toESM(require("path"), 1);
|
|
2648
2779
|
var import_promises3 = require("fs/promises");
|
|
2649
2780
|
var import_node_readline = require("readline");
|
|
2650
|
-
var
|
|
2781
|
+
var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
|
|
2651
2782
|
|
|
2652
2783
|
// src/templates/fs-utils.ts
|
|
2653
2784
|
var import_promises2 = require("fs/promises");
|
|
@@ -2670,7 +2801,7 @@ async function directoryExists(dirPath) {
|
|
|
2670
2801
|
}
|
|
2671
2802
|
|
|
2672
2803
|
// src/templates/file-writer.ts
|
|
2673
|
-
var logger = (0,
|
|
2804
|
+
var logger = (0, import_extensibility_tool_utils7._createLogger)({ name: "file-writer" });
|
|
2674
2805
|
async function _promptOverwrite(filePath) {
|
|
2675
2806
|
const prompt = `${filePath} exists. Overwrite [yNaq]? `;
|
|
2676
2807
|
if (!process.stdin.isTTY) {
|
|
@@ -3067,8 +3198,8 @@ function getTerminalSize() {
|
|
|
3067
3198
|
}
|
|
3068
3199
|
|
|
3069
3200
|
// src/templates/diff-viewer/diff-prompt.ts
|
|
3070
|
-
var
|
|
3071
|
-
var logger2 = (0,
|
|
3201
|
+
var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
|
|
3202
|
+
var logger2 = (0, import_extensibility_tool_utils8._createLogger)({ name: "diff-prompt" });
|
|
3072
3203
|
function isInteractiveTerminal() {
|
|
3073
3204
|
if (process.env["CI"] === "true" || process.env["CI"] === "1") {
|
|
3074
3205
|
return false;
|
|
@@ -3253,9 +3384,8 @@ async function toggleDiffContext(state, filePath, newContent, existingContent) {
|
|
|
3253
3384
|
}
|
|
3254
3385
|
|
|
3255
3386
|
// src/templates/root/index.ts
|
|
3256
|
-
var import_extensibility_tool_utils10 = require("@stripe/extensibility-tool-utils");
|
|
3257
3387
|
var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
|
|
3258
|
-
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${
|
|
3388
|
+
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
|
|
3259
3389
|
var _rootWorkspaceTemplate = {
|
|
3260
3390
|
generate: (params, context) => {
|
|
3261
3391
|
const { fs: fs2 } = context;
|
|
@@ -3310,14 +3440,14 @@ var _rootWorkspaceTemplate = {
|
|
|
3310
3440
|
path: "custom-objects/package.json",
|
|
3311
3441
|
content: fs2.mustache(
|
|
3312
3442
|
{
|
|
3313
|
-
customObjectsVersion:
|
|
3443
|
+
customObjectsVersion: _workspaceVersion(
|
|
3314
3444
|
"@stripe/extensibility-custom-objects"
|
|
3315
3445
|
),
|
|
3316
|
-
sdkVersion:
|
|
3317
|
-
customObjectsToolsVersion:
|
|
3446
|
+
sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
|
|
3447
|
+
customObjectsToolsVersion: _workspaceVersion(
|
|
3318
3448
|
"@stripe/extensibility-custom-objects-tools"
|
|
3319
3449
|
),
|
|
3320
|
-
testHelpersVersion:
|
|
3450
|
+
testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
|
|
3321
3451
|
},
|
|
3322
3452
|
"custom-objects",
|
|
3323
3453
|
"package.json.mustache"
|
|
@@ -3329,6 +3459,16 @@ var _rootWorkspaceTemplate = {
|
|
|
3329
3459
|
content: fs2.textFile("custom-objects/tsconfig.json"),
|
|
3330
3460
|
precious: true
|
|
3331
3461
|
},
|
|
3462
|
+
{
|
|
3463
|
+
path: "custom-objects/eslint.config.mts",
|
|
3464
|
+
content: fs2.textFile("custom-objects/eslint.config.mts"),
|
|
3465
|
+
precious: true
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
path: "custom-objects/vitest.config.mts",
|
|
3469
|
+
content: fs2.textFile("custom-objects/vitest.config.mts"),
|
|
3470
|
+
precious: true
|
|
3471
|
+
},
|
|
3332
3472
|
{
|
|
3333
3473
|
path: "ui/package.json",
|
|
3334
3474
|
content: fs2.textFile("ui/package.json"),
|
|
@@ -3355,7 +3495,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3355
3495
|
_devNpmDep("@types/node", "^20.19.0"),
|
|
3356
3496
|
_devNpmDep(
|
|
3357
3497
|
"@stripe/extensibility-dev-tools",
|
|
3358
|
-
`^${
|
|
3498
|
+
`^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
|
|
3359
3499
|
),
|
|
3360
3500
|
_devNpmDep("concurrently", "^9.2.1"),
|
|
3361
3501
|
_devNpmDep("eslint", "^9.0.0"),
|
|
@@ -3383,7 +3523,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3383
3523
|
};
|
|
3384
3524
|
}
|
|
3385
3525
|
};
|
|
3386
|
-
var _rootTemplateManager = new
|
|
3526
|
+
var _rootTemplateManager = new import_extensibility_tool_utils6._SingleTemplateManager(_rootWorkspaceTemplate, _fs.scope("root"));
|
|
3387
3527
|
|
|
3388
3528
|
// src/workspace/index.ts
|
|
3389
3529
|
var _regenWorkspaceOptionsSchema = import_zod.z.object({
|
|
@@ -3449,7 +3589,7 @@ async function _resolvePackageMetadata(providedId, providedName, packageDir) {
|
|
|
3449
3589
|
name ??= id;
|
|
3450
3590
|
return { id, name, version };
|
|
3451
3591
|
}
|
|
3452
|
-
function runPostGenerationHooks(hooks, workingDir, disabled = false, context = (0,
|
|
3592
|
+
function runPostGenerationHooks(hooks, workingDir, disabled = false, context = (0, import_extensibility_tool_utils9._createCliContext)()) {
|
|
3453
3593
|
if (!hooks || hooks.length === 0 || disabled) {
|
|
3454
3594
|
return Promise.resolve();
|
|
3455
3595
|
}
|
|
@@ -3553,9 +3693,9 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3553
3693
|
workspaceDir: () => packageDir ?? import_node_path3.default.join(projectRoot, "custom-objects"),
|
|
3554
3694
|
generate: async (svc) => {
|
|
3555
3695
|
const customObjectsWorkspaceDir = packageDir ?? import_node_path3.default.join(projectRoot, "custom-objects");
|
|
3556
|
-
const
|
|
3696
|
+
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"));
|
|
3557
3697
|
const objectResult = await svc.generateCustomObject({ name: objectName });
|
|
3558
|
-
if (
|
|
3698
|
+
if (workspaceScaffoldingExists) {
|
|
3559
3699
|
return objectResult;
|
|
3560
3700
|
}
|
|
3561
3701
|
const workspaceResult = await svc.generateCustomObjectsWorkspace({});
|
|
@@ -3570,11 +3710,11 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3570
3710
|
finalize: async (_svc, _meta, root, _output, context) => {
|
|
3571
3711
|
context.ux.log("\nUpdating stripe-app.yaml...");
|
|
3572
3712
|
const manifestPath = import_node_path3.default.join(root, "stripe-app.yaml");
|
|
3573
|
-
const manifest = await (0,
|
|
3574
|
-
const apiName = (0,
|
|
3713
|
+
const manifest = await (0, import_extensibility_tool_utils9._openStripeAppManifest)(manifestPath);
|
|
3714
|
+
const apiName = (0, import_extensibility_tool_utils9._toSnakeCase)(objectName);
|
|
3575
3715
|
if (!manifest.hasCustomObject(apiName)) {
|
|
3576
3716
|
manifest.addCustomObject(apiName, `custom-objects/src/${apiName}.object.ts`);
|
|
3577
|
-
const tx = (0,
|
|
3717
|
+
const tx = (0, import_extensibility_tool_utils9._beginTransaction)();
|
|
3578
3718
|
tx.adopt(manifest);
|
|
3579
3719
|
const report = await tx.commit();
|
|
3580
3720
|
if (report.written.length > 0) {
|
|
@@ -3668,7 +3808,7 @@ var _defaultServices = {
|
|
|
3668
3808
|
};
|
|
3669
3809
|
},
|
|
3670
3810
|
generateCustomObjectsWorkspace: async (vars) => {
|
|
3671
|
-
const runner = new
|
|
3811
|
+
const runner = new import_extensibility_tool_utils9._GeneratorRunner(import_internal._customObjectsWorkspaceGenerator);
|
|
3672
3812
|
const plan = await runner.plan(vars, {
|
|
3673
3813
|
scope: "project",
|
|
3674
3814
|
projectRoot: process.cwd()
|
|
@@ -3682,7 +3822,7 @@ var _defaultServices = {
|
|
|
3682
3822
|
loadManifest: (manifestPath) => _StripeAppManifest.load(manifestPath),
|
|
3683
3823
|
runHooks: runPostGenerationHooks
|
|
3684
3824
|
};
|
|
3685
|
-
async function _regenAppProjectWorkspace(options, services = _defaultServices, context = (0,
|
|
3825
|
+
async function _regenAppProjectWorkspace(options, services = _defaultServices, context = (0, import_extensibility_tool_utils9._createCliContext)()) {
|
|
3686
3826
|
const isCustomObjectMode = options.templateId === "custom-object";
|
|
3687
3827
|
if (!isCustomObjectMode && !options.packageDir && !options.workspaceId) {
|
|
3688
3828
|
throw new Error("At least one of packageDir or workspaceId is required");
|
|
@@ -3803,7 +3943,7 @@ async function _regenAppProjectWorkspace(options, services = _defaultServices, c
|
|
|
3803
3943
|
}
|
|
3804
3944
|
|
|
3805
3945
|
// src/bin/rpc/handlers.ts
|
|
3806
|
-
var
|
|
3946
|
+
var import_extensibility_tool_utils10 = require("@stripe/extensibility-tool-utils");
|
|
3807
3947
|
function handleGetTemplateInfo() {
|
|
3808
3948
|
return Promise.resolve(_templateManager.getTemplateInfo().filter((t) => !t.hidden));
|
|
3809
3949
|
}
|
|
@@ -3817,7 +3957,7 @@ async function handleGenWorkspace(params) {
|
|
|
3817
3957
|
"At least one of packageDir or workspaceId is required"
|
|
3818
3958
|
);
|
|
3819
3959
|
}
|
|
3820
|
-
const ctx = (0,
|
|
3960
|
+
const ctx = (0, import_extensibility_tool_utils10._createCliContext)({ ux: new import_extensibility_tool_utils10._CliUx({ stdout: process.stderr }) });
|
|
3821
3961
|
await _regenAppProjectWorkspace(parsed.data, void 0, ctx);
|
|
3822
3962
|
return {};
|
|
3823
3963
|
}
|
|
@@ -3827,7 +3967,7 @@ var methods = /* @__PURE__ */ new Map([
|
|
|
3827
3967
|
]);
|
|
3828
3968
|
|
|
3829
3969
|
// src/bin/dev-tools-rpc.ts
|
|
3830
|
-
var logger3 = (0,
|
|
3970
|
+
var logger3 = (0, import_extensibility_tool_utils11._createLogger)({ name: "dev-tools-rpc" });
|
|
3831
3971
|
logger3.warn(
|
|
3832
3972
|
"dev-tools-rpc is deprecated and will be removed in a future release. Upgrade @stripe/stripe-cli-generate-plugin to use the new CLI tools."
|
|
3833
3973
|
);
|