@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
|
@@ -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 .",
|
|
@@ -871,6 +978,10 @@ export default defineConfig([
|
|
|
871
978
|
|
|
872
979
|
overrides:
|
|
873
980
|
vite: ^6.0.0
|
|
981
|
+
|
|
982
|
+
allowBuilds:
|
|
983
|
+
core-js-pure: false
|
|
984
|
+
esbuild: false
|
|
874
985
|
`
|
|
875
986
|
},
|
|
876
987
|
{
|
|
@@ -888,7 +999,7 @@ declarations:
|
|
|
888
999
|
content: `#!/usr/bin/env tsx
|
|
889
1000
|
/**
|
|
890
1001
|
* Runs tests across the workspace:
|
|
891
|
-
* - vitest for script extensions and custom objects (
|
|
1002
|
+
* - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
|
|
892
1003
|
* - jest for UI extensions (ui/)
|
|
893
1004
|
*/
|
|
894
1005
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -898,6 +1009,8 @@ const hasExtensions =
|
|
|
898
1009
|
existsSync('extensions') &&
|
|
899
1010
|
readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
|
|
900
1011
|
|
|
1012
|
+
const hasCustomObjects = existsSync('custom-objects/package.json');
|
|
1013
|
+
|
|
901
1014
|
const hasUI = existsSync('ui/package.json');
|
|
902
1015
|
|
|
903
1016
|
let exitCode = 0;
|
|
@@ -910,7 +1023,7 @@ function run(cmd: string): void {
|
|
|
910
1023
|
}
|
|
911
1024
|
}
|
|
912
1025
|
|
|
913
|
-
if (hasExtensions) {
|
|
1026
|
+
if (hasExtensions || hasCustomObjects) {
|
|
914
1027
|
run('vitest run');
|
|
915
1028
|
}
|
|
916
1029
|
|
|
@@ -1595,11 +1708,33 @@ var _DependencyManager = class {
|
|
|
1595
1708
|
}
|
|
1596
1709
|
};
|
|
1597
1710
|
|
|
1711
|
+
// src/workspace-versions.json
|
|
1712
|
+
var workspace_versions_default = {
|
|
1713
|
+
"@stripe/extensibility-custom-objects": "1.0.0",
|
|
1714
|
+
"@stripe/extensibility-custom-objects-tools": "4.0.1",
|
|
1715
|
+
"@stripe/extensibility-dev-tools": "1.0.2",
|
|
1716
|
+
"@stripe/extensibility-eslint-plugin": "1.0.0",
|
|
1717
|
+
"@stripe/extensibility-language-server": "1.0.0",
|
|
1718
|
+
"@stripe/extensibility-sdk": "1.0.0",
|
|
1719
|
+
"@stripe/extensibility-test-helpers": "1.0.0"
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
// src/workspace-versions.ts
|
|
1723
|
+
var _workspaceVersions = workspace_versions_default;
|
|
1724
|
+
function _workspaceVersion(packageName) {
|
|
1725
|
+
const v = _workspaceVersions[packageName];
|
|
1726
|
+
if (v === void 0) {
|
|
1727
|
+
throw new Error(
|
|
1728
|
+
`Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
|
|
1729
|
+
);
|
|
1730
|
+
}
|
|
1731
|
+
return v;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1598
1734
|
// src/templates/extensions/base.ts
|
|
1599
|
-
var import_extensibility_tool_utils4 = require("@stripe/extensibility-tool-utils");
|
|
1600
1735
|
var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
|
|
1601
1736
|
var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
|
|
1602
|
-
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${
|
|
1737
|
+
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
|
|
1603
1738
|
function _createExtensionEslintConfigFile(params, context) {
|
|
1604
1739
|
const { id, extensionInterfaceId } = params;
|
|
1605
1740
|
const { fs: fs2 } = context;
|
|
@@ -1642,7 +1777,7 @@ function _createBaseOutput(params, context) {
|
|
|
1642
1777
|
dependencies: {
|
|
1643
1778
|
// Exact pin (no caret) — the SDK is tightly coupled to dev-tools and
|
|
1644
1779
|
// must match the version that generated the extension scaffolding.
|
|
1645
|
-
runtime: [_npmDep(SDK_PACKAGE_NAME,
|
|
1780
|
+
runtime: [_npmDep(SDK_PACKAGE_NAME, _workspaceVersion(SDK_PACKAGE_NAME))],
|
|
1646
1781
|
dev: [_devNpmDep(LANGUAGE_SERVER_PACKAGE_NAME, LANGUAGE_SERVER_PACKAGE_VERSION)]
|
|
1647
1782
|
},
|
|
1648
1783
|
postGenerationHooks: [
|
|
@@ -1901,14 +2036,14 @@ var billing_bill_discount_calculation_default = {
|
|
|
1901
2036
|
[EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
|
|
1902
2037
|
};
|
|
1903
2038
|
|
|
1904
|
-
// src/templates/extensions/billing.
|
|
1905
|
-
var EXTENSION_INTERFACE_ID6 = "billing.
|
|
1906
|
-
var
|
|
2039
|
+
// src/templates/extensions/billing.invoice_collection_options.ts
|
|
2040
|
+
var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
|
|
2041
|
+
var invoiceCollectionOptionsTemplate = {
|
|
1907
2042
|
hidden: true,
|
|
1908
2043
|
methods: {
|
|
1909
|
-
|
|
2044
|
+
override_options: { implementation_types: ["script"] }
|
|
1910
2045
|
},
|
|
1911
|
-
description: "Use Stripe Scripts to create custom invoice collection
|
|
2046
|
+
description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
|
|
1912
2047
|
generate: (params, context) => {
|
|
1913
2048
|
const { id } = params;
|
|
1914
2049
|
const { fs: fs2 } = context;
|
|
@@ -1936,15 +2071,15 @@ var invoiceCollectionSettingTemplate = {
|
|
|
1936
2071
|
...base.files
|
|
1937
2072
|
],
|
|
1938
2073
|
methods: {
|
|
1939
|
-
|
|
2074
|
+
override_options: {
|
|
1940
2075
|
implementation_type: "script"
|
|
1941
2076
|
}
|
|
1942
2077
|
}
|
|
1943
2078
|
};
|
|
1944
2079
|
}
|
|
1945
2080
|
};
|
|
1946
|
-
var
|
|
1947
|
-
[EXTENSION_INTERFACE_ID6]:
|
|
2081
|
+
var billing_invoice_collection_options_default = {
|
|
2082
|
+
[EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
|
|
1948
2083
|
};
|
|
1949
2084
|
|
|
1950
2085
|
// src/templates/extensions/billing.prorations.ts
|
|
@@ -2052,7 +2187,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
2052
2187
|
...extend_workflows_custom_action_default,
|
|
2053
2188
|
...billing_customer_balance_application_default,
|
|
2054
2189
|
...billing_bill_discount_calculation_default,
|
|
2055
|
-
...
|
|
2190
|
+
...billing_invoice_collection_options_default,
|
|
2056
2191
|
...billing_prorations_default,
|
|
2057
2192
|
...billing_recurring_billing_item_handling_default
|
|
2058
2193
|
};
|
|
@@ -2071,10 +2206,10 @@ var import_node_fs2 = require("fs");
|
|
|
2071
2206
|
var import_promises5 = require("fs/promises");
|
|
2072
2207
|
var import_node_child_process2 = require("child_process");
|
|
2073
2208
|
var import_internal = require("@stripe/extensibility-custom-objects-tools/internal");
|
|
2074
|
-
var
|
|
2209
|
+
var import_extensibility_tool_utils9 = require("@stripe/extensibility-tool-utils");
|
|
2075
2210
|
|
|
2076
2211
|
// src/manifest/stripe-app-manifest.ts
|
|
2077
|
-
var
|
|
2212
|
+
var import_extensibility_tool_utils5 = require("@stripe/extensibility-tool-utils");
|
|
2078
2213
|
|
|
2079
2214
|
// src/manifest/manifest-v1.ts
|
|
2080
2215
|
var import_fs2 = require("fs");
|
|
@@ -2199,7 +2334,7 @@ var _ManifestV1 = class __ManifestV1 {
|
|
|
2199
2334
|
// src/manifest/manifest-v2.ts
|
|
2200
2335
|
var import_promises = require("fs/promises");
|
|
2201
2336
|
var yaml = __toESM(require("yaml"), 1);
|
|
2202
|
-
var
|
|
2337
|
+
var import_extensibility_tool_utils4 = require("@stripe/extensibility-tool-utils");
|
|
2203
2338
|
function isNonEmptyString(value) {
|
|
2204
2339
|
return typeof value === "string" && value.trim().length > 0;
|
|
2205
2340
|
}
|
|
@@ -2315,7 +2450,7 @@ var _ManifestV2 = class __ManifestV2 {
|
|
|
2315
2450
|
id: def.id,
|
|
2316
2451
|
type: def.specification.type,
|
|
2317
2452
|
path: def.specification.content,
|
|
2318
|
-
name: (0,
|
|
2453
|
+
name: (0, import_extensibility_tool_utils4._toPascalCase)(def.id)
|
|
2319
2454
|
}));
|
|
2320
2455
|
}
|
|
2321
2456
|
/**
|
|
@@ -2553,7 +2688,7 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2553
2688
|
return this.v1.hasCustomObject(entry);
|
|
2554
2689
|
}
|
|
2555
2690
|
if (this.v2) {
|
|
2556
|
-
return this.v2.hasCustomObject((0,
|
|
2691
|
+
return this.v2.hasCustomObject((0, import_extensibility_tool_utils5._toSnakeCase)(entry.className));
|
|
2557
2692
|
}
|
|
2558
2693
|
return false;
|
|
2559
2694
|
}
|
|
@@ -2572,7 +2707,7 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2572
2707
|
return this.v1.addCustomObject(entry);
|
|
2573
2708
|
}
|
|
2574
2709
|
if (this.v2) {
|
|
2575
|
-
return this.v2.addCustomObject((0,
|
|
2710
|
+
return this.v2.addCustomObject((0, import_extensibility_tool_utils5._toSnakeCase)(entry.className), entry.filePath);
|
|
2576
2711
|
}
|
|
2577
2712
|
return false;
|
|
2578
2713
|
}
|
|
@@ -2590,7 +2725,7 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2590
2725
|
return this.v1.removeCustomObject(entry);
|
|
2591
2726
|
}
|
|
2592
2727
|
if (this.v2) {
|
|
2593
|
-
return this.v2.removeCustomObject((0,
|
|
2728
|
+
return this.v2.removeCustomObject((0, import_extensibility_tool_utils5._toSnakeCase)(entry.className));
|
|
2594
2729
|
}
|
|
2595
2730
|
return false;
|
|
2596
2731
|
}
|
|
@@ -2641,13 +2776,13 @@ var _StripeAppManifest = class __StripeAppManifest {
|
|
|
2641
2776
|
};
|
|
2642
2777
|
|
|
2643
2778
|
// src/templates/simple-templates.ts
|
|
2644
|
-
var
|
|
2779
|
+
var import_extensibility_tool_utils6 = require("@stripe/extensibility-tool-utils");
|
|
2645
2780
|
|
|
2646
2781
|
// src/templates/file-writer.ts
|
|
2647
2782
|
var import_path = __toESM(require("path"), 1);
|
|
2648
2783
|
var import_promises3 = require("fs/promises");
|
|
2649
2784
|
var import_node_readline = require("readline");
|
|
2650
|
-
var
|
|
2785
|
+
var import_extensibility_tool_utils7 = require("@stripe/extensibility-tool-utils");
|
|
2651
2786
|
|
|
2652
2787
|
// src/templates/fs-utils.ts
|
|
2653
2788
|
var import_promises2 = require("fs/promises");
|
|
@@ -2670,7 +2805,7 @@ async function directoryExists(dirPath) {
|
|
|
2670
2805
|
}
|
|
2671
2806
|
|
|
2672
2807
|
// src/templates/file-writer.ts
|
|
2673
|
-
var logger = (0,
|
|
2808
|
+
var logger = (0, import_extensibility_tool_utils7._createLogger)({ name: "file-writer" });
|
|
2674
2809
|
async function _promptOverwrite(filePath) {
|
|
2675
2810
|
const prompt = `${filePath} exists. Overwrite [yNaq]? `;
|
|
2676
2811
|
if (!process.stdin.isTTY) {
|
|
@@ -3067,8 +3202,8 @@ function getTerminalSize() {
|
|
|
3067
3202
|
}
|
|
3068
3203
|
|
|
3069
3204
|
// src/templates/diff-viewer/diff-prompt.ts
|
|
3070
|
-
var
|
|
3071
|
-
var logger2 = (0,
|
|
3205
|
+
var import_extensibility_tool_utils8 = require("@stripe/extensibility-tool-utils");
|
|
3206
|
+
var logger2 = (0, import_extensibility_tool_utils8._createLogger)({ name: "diff-prompt" });
|
|
3072
3207
|
function isInteractiveTerminal() {
|
|
3073
3208
|
if (process.env["CI"] === "true" || process.env["CI"] === "1") {
|
|
3074
3209
|
return false;
|
|
@@ -3253,9 +3388,8 @@ async function toggleDiffContext(state, filePath, newContent, existingContent) {
|
|
|
3253
3388
|
}
|
|
3254
3389
|
|
|
3255
3390
|
// src/templates/root/index.ts
|
|
3256
|
-
var import_extensibility_tool_utils10 = require("@stripe/extensibility-tool-utils");
|
|
3257
3391
|
var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
|
|
3258
|
-
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${
|
|
3392
|
+
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
|
|
3259
3393
|
var _rootWorkspaceTemplate = {
|
|
3260
3394
|
generate: (params, context) => {
|
|
3261
3395
|
const { fs: fs2 } = context;
|
|
@@ -3310,14 +3444,14 @@ var _rootWorkspaceTemplate = {
|
|
|
3310
3444
|
path: "custom-objects/package.json",
|
|
3311
3445
|
content: fs2.mustache(
|
|
3312
3446
|
{
|
|
3313
|
-
customObjectsVersion:
|
|
3447
|
+
customObjectsVersion: _workspaceVersion(
|
|
3314
3448
|
"@stripe/extensibility-custom-objects"
|
|
3315
3449
|
),
|
|
3316
|
-
sdkVersion:
|
|
3317
|
-
customObjectsToolsVersion:
|
|
3450
|
+
sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
|
|
3451
|
+
customObjectsToolsVersion: _workspaceVersion(
|
|
3318
3452
|
"@stripe/extensibility-custom-objects-tools"
|
|
3319
3453
|
),
|
|
3320
|
-
testHelpersVersion:
|
|
3454
|
+
testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
|
|
3321
3455
|
},
|
|
3322
3456
|
"custom-objects",
|
|
3323
3457
|
"package.json.mustache"
|
|
@@ -3329,6 +3463,16 @@ var _rootWorkspaceTemplate = {
|
|
|
3329
3463
|
content: fs2.textFile("custom-objects/tsconfig.json"),
|
|
3330
3464
|
precious: true
|
|
3331
3465
|
},
|
|
3466
|
+
{
|
|
3467
|
+
path: "custom-objects/eslint.config.mts",
|
|
3468
|
+
content: fs2.textFile("custom-objects/eslint.config.mts"),
|
|
3469
|
+
precious: true
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
path: "custom-objects/vitest.config.mts",
|
|
3473
|
+
content: fs2.textFile("custom-objects/vitest.config.mts"),
|
|
3474
|
+
precious: true
|
|
3475
|
+
},
|
|
3332
3476
|
{
|
|
3333
3477
|
path: "ui/package.json",
|
|
3334
3478
|
content: fs2.textFile("ui/package.json"),
|
|
@@ -3355,7 +3499,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3355
3499
|
_devNpmDep("@types/node", "^20.19.0"),
|
|
3356
3500
|
_devNpmDep(
|
|
3357
3501
|
"@stripe/extensibility-dev-tools",
|
|
3358
|
-
`^${
|
|
3502
|
+
`^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
|
|
3359
3503
|
),
|
|
3360
3504
|
_devNpmDep("concurrently", "^9.2.1"),
|
|
3361
3505
|
_devNpmDep("eslint", "^9.0.0"),
|
|
@@ -3383,7 +3527,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3383
3527
|
};
|
|
3384
3528
|
}
|
|
3385
3529
|
};
|
|
3386
|
-
var _rootTemplateManager = new
|
|
3530
|
+
var _rootTemplateManager = new import_extensibility_tool_utils6._SingleTemplateManager(_rootWorkspaceTemplate, _fs.scope("root"));
|
|
3387
3531
|
|
|
3388
3532
|
// src/workspace/index.ts
|
|
3389
3533
|
var _regenWorkspaceOptionsSchema = import_zod.z.object({
|
|
@@ -3449,7 +3593,7 @@ async function _resolvePackageMetadata(providedId, providedName, packageDir) {
|
|
|
3449
3593
|
name ??= id;
|
|
3450
3594
|
return { id, name, version };
|
|
3451
3595
|
}
|
|
3452
|
-
function runPostGenerationHooks(hooks, workingDir, disabled = false, context = (0,
|
|
3596
|
+
function runPostGenerationHooks(hooks, workingDir, disabled = false, context = (0, import_extensibility_tool_utils9._createCliContext)()) {
|
|
3453
3597
|
if (!hooks || hooks.length === 0 || disabled) {
|
|
3454
3598
|
return Promise.resolve();
|
|
3455
3599
|
}
|
|
@@ -3553,9 +3697,9 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3553
3697
|
workspaceDir: () => packageDir ?? import_node_path3.default.join(projectRoot, "custom-objects"),
|
|
3554
3698
|
generate: async (svc) => {
|
|
3555
3699
|
const customObjectsWorkspaceDir = packageDir ?? import_node_path3.default.join(projectRoot, "custom-objects");
|
|
3556
|
-
const
|
|
3700
|
+
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
3701
|
const objectResult = await svc.generateCustomObject({ name: objectName });
|
|
3558
|
-
if (
|
|
3702
|
+
if (workspaceScaffoldingExists) {
|
|
3559
3703
|
return objectResult;
|
|
3560
3704
|
}
|
|
3561
3705
|
const workspaceResult = await svc.generateCustomObjectsWorkspace({});
|
|
@@ -3570,11 +3714,11 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3570
3714
|
finalize: async (_svc, _meta, root, _output, context) => {
|
|
3571
3715
|
context.ux.log("\nUpdating stripe-app.yaml...");
|
|
3572
3716
|
const manifestPath = import_node_path3.default.join(root, "stripe-app.yaml");
|
|
3573
|
-
const manifest = await (0,
|
|
3574
|
-
const apiName = (0,
|
|
3717
|
+
const manifest = await (0, import_extensibility_tool_utils9._openStripeAppManifest)(manifestPath);
|
|
3718
|
+
const apiName = (0, import_extensibility_tool_utils9._toSnakeCase)(objectName);
|
|
3575
3719
|
if (!manifest.hasCustomObject(apiName)) {
|
|
3576
3720
|
manifest.addCustomObject(apiName, `custom-objects/src/${apiName}.object.ts`);
|
|
3577
|
-
const tx = (0,
|
|
3721
|
+
const tx = (0, import_extensibility_tool_utils9._beginTransaction)();
|
|
3578
3722
|
tx.adopt(manifest);
|
|
3579
3723
|
const report = await tx.commit();
|
|
3580
3724
|
if (report.written.length > 0) {
|
|
@@ -3668,7 +3812,7 @@ var _defaultServices = {
|
|
|
3668
3812
|
};
|
|
3669
3813
|
},
|
|
3670
3814
|
generateCustomObjectsWorkspace: async (vars) => {
|
|
3671
|
-
const runner = new
|
|
3815
|
+
const runner = new import_extensibility_tool_utils9._GeneratorRunner(import_internal._customObjectsWorkspaceGenerator);
|
|
3672
3816
|
const plan = await runner.plan(vars, {
|
|
3673
3817
|
scope: "project",
|
|
3674
3818
|
projectRoot: process.cwd()
|
|
@@ -3682,7 +3826,7 @@ var _defaultServices = {
|
|
|
3682
3826
|
loadManifest: (manifestPath) => _StripeAppManifest.load(manifestPath),
|
|
3683
3827
|
runHooks: runPostGenerationHooks
|
|
3684
3828
|
};
|
|
3685
|
-
async function _regenAppProjectWorkspace(options, services = _defaultServices, context = (0,
|
|
3829
|
+
async function _regenAppProjectWorkspace(options, services = _defaultServices, context = (0, import_extensibility_tool_utils9._createCliContext)()) {
|
|
3686
3830
|
const isCustomObjectMode = options.templateId === "custom-object";
|
|
3687
3831
|
if (!isCustomObjectMode && !options.packageDir && !options.workspaceId) {
|
|
3688
3832
|
throw new Error("At least one of packageDir or workspaceId is required");
|
|
@@ -3803,7 +3947,7 @@ async function _regenAppProjectWorkspace(options, services = _defaultServices, c
|
|
|
3803
3947
|
}
|
|
3804
3948
|
|
|
3805
3949
|
// src/bin/rpc/handlers.ts
|
|
3806
|
-
var
|
|
3950
|
+
var import_extensibility_tool_utils10 = require("@stripe/extensibility-tool-utils");
|
|
3807
3951
|
function handleGetTemplateInfo() {
|
|
3808
3952
|
return Promise.resolve(_templateManager.getTemplateInfo().filter((t) => !t.hidden));
|
|
3809
3953
|
}
|
|
@@ -3817,7 +3961,7 @@ async function handleGenWorkspace(params) {
|
|
|
3817
3961
|
"At least one of packageDir or workspaceId is required"
|
|
3818
3962
|
);
|
|
3819
3963
|
}
|
|
3820
|
-
const ctx = (0,
|
|
3964
|
+
const ctx = (0, import_extensibility_tool_utils10._createCliContext)({ ux: new import_extensibility_tool_utils10._CliUx({ stdout: process.stderr }) });
|
|
3821
3965
|
await _regenAppProjectWorkspace(parsed.data, void 0, ctx);
|
|
3822
3966
|
return {};
|
|
3823
3967
|
}
|
|
@@ -3827,7 +3971,7 @@ var methods = /* @__PURE__ */ new Map([
|
|
|
3827
3971
|
]);
|
|
3828
3972
|
|
|
3829
3973
|
// src/bin/dev-tools-rpc.ts
|
|
3830
|
-
var logger3 = (0,
|
|
3974
|
+
var logger3 = (0, import_extensibility_tool_utils11._createLogger)({ name: "dev-tools-rpc" });
|
|
3831
3975
|
logger3.warn(
|
|
3832
3976
|
"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
3977
|
);
|