@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
package/dist/workspace/index.js
CHANGED
|
@@ -1226,35 +1226,35 @@ export default class MyBalanceApp implements Billing.CustomerBalanceApplication<
|
|
|
1226
1226
|
`
|
|
1227
1227
|
},
|
|
1228
1228
|
{
|
|
1229
|
-
path: "extensions/billing.
|
|
1229
|
+
path: "extensions/billing.invoice_collection_options/index.test.ts",
|
|
1230
1230
|
content: `import { beforeEach, describe, it, expect } from 'vitest';
|
|
1231
1231
|
|
|
1232
|
-
import
|
|
1232
|
+
import MyInvoiceCollectionOptions from './index.js';
|
|
1233
1233
|
|
|
1234
|
-
describe('
|
|
1235
|
-
let instance:
|
|
1234
|
+
describe('MyInvoiceCollectionOptions', () => {
|
|
1235
|
+
let instance: MyInvoiceCollectionOptions;
|
|
1236
1236
|
|
|
1237
1237
|
beforeEach(() => {
|
|
1238
|
-
instance = new
|
|
1238
|
+
instance = new MyInvoiceCollectionOptions();
|
|
1239
1239
|
});
|
|
1240
1240
|
|
|
1241
1241
|
it('should be constructable', () => {
|
|
1242
|
-
expect(instance).toBeInstanceOf(
|
|
1242
|
+
expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
|
|
1243
1243
|
});
|
|
1244
1244
|
});
|
|
1245
1245
|
`
|
|
1246
1246
|
},
|
|
1247
1247
|
{
|
|
1248
|
-
path: "extensions/billing.
|
|
1248
|
+
path: "extensions/billing.invoice_collection_options/index.ts",
|
|
1249
1249
|
content: `import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
1250
1250
|
|
|
1251
1251
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1252
|
-
interface
|
|
1252
|
+
interface MyInvoiceCollectionOptionsConfig {}
|
|
1253
1253
|
|
|
1254
|
-
export default class
|
|
1255
|
-
|
|
1256
|
-
_request: Billing.
|
|
1257
|
-
_config:
|
|
1254
|
+
export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
|
|
1255
|
+
overrideOptions(
|
|
1256
|
+
_request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
|
|
1257
|
+
_config: MyInvoiceCollectionOptionsConfig,
|
|
1258
1258
|
_context: Context
|
|
1259
1259
|
) {
|
|
1260
1260
|
// TODO: implement your collection setting logic here
|
|
@@ -1726,6 +1726,99 @@ install-deps.log
|
|
|
1726
1726
|
|
|
1727
1727
|
# generated schemas
|
|
1728
1728
|
generated
|
|
1729
|
+
`
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
path: "root/custom-objects/eslint.config.mts",
|
|
1733
|
+
content: `import eslint from '@eslint/js';
|
|
1734
|
+
import { defineConfig } from 'eslint/config';
|
|
1735
|
+
import tseslint from 'typescript-eslint';
|
|
1736
|
+
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
1737
|
+
|
|
1738
|
+
import globals from 'globals';
|
|
1739
|
+
|
|
1740
|
+
import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
|
|
1741
|
+
import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
|
|
1742
|
+
|
|
1743
|
+
export default defineConfig([
|
|
1744
|
+
eslint.configs.recommended,
|
|
1745
|
+
...tseslint.configs.recommended,
|
|
1746
|
+
...stripeAppsConfig,
|
|
1747
|
+
...customObjectsConfig,
|
|
1748
|
+
|
|
1749
|
+
// Global ignores
|
|
1750
|
+
{
|
|
1751
|
+
ignores: ['dist', 'generated', 'node_modules'],
|
|
1752
|
+
},
|
|
1753
|
+
|
|
1754
|
+
// TypeScript source files (with type-checking)
|
|
1755
|
+
{
|
|
1756
|
+
name: 'sources',
|
|
1757
|
+
files: ['src/**/*.ts'],
|
|
1758
|
+
ignores: ['**/*.test.ts', '**/__tests__/**'],
|
|
1759
|
+
languageOptions: {
|
|
1760
|
+
globals: {
|
|
1761
|
+
...globals.node,
|
|
1762
|
+
},
|
|
1763
|
+
parserOptions: {
|
|
1764
|
+
projectService: true,
|
|
1765
|
+
tsconfigRootDir: import.meta.dirname,
|
|
1766
|
+
},
|
|
1767
|
+
},
|
|
1768
|
+
},
|
|
1769
|
+
|
|
1770
|
+
// Test files
|
|
1771
|
+
{
|
|
1772
|
+
name: 'tests',
|
|
1773
|
+
files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
|
|
1774
|
+
languageOptions: {
|
|
1775
|
+
globals: {
|
|
1776
|
+
...globals.node,
|
|
1777
|
+
},
|
|
1778
|
+
parserOptions: {
|
|
1779
|
+
projectService: true,
|
|
1780
|
+
tsconfigRootDir: import.meta.dirname,
|
|
1781
|
+
},
|
|
1782
|
+
},
|
|
1783
|
+
},
|
|
1784
|
+
|
|
1785
|
+
// Config files
|
|
1786
|
+
{
|
|
1787
|
+
name: 'ts-configs',
|
|
1788
|
+
files: ['*.config.m?ts', 'eslint.config.mts'],
|
|
1789
|
+
languageOptions: {
|
|
1790
|
+
globals: {
|
|
1791
|
+
...globals.node,
|
|
1792
|
+
},
|
|
1793
|
+
parserOptions: {
|
|
1794
|
+
projectService: false,
|
|
1795
|
+
},
|
|
1796
|
+
},
|
|
1797
|
+
rules: {
|
|
1798
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
1799
|
+
},
|
|
1800
|
+
},
|
|
1801
|
+
|
|
1802
|
+
// JavaScript/MJS files (scripts, configs) \u2014 no TS project, so only
|
|
1803
|
+
// disable the TS-parser-specific rule that doesn't apply without it.
|
|
1804
|
+
{
|
|
1805
|
+
name: 'js-configs',
|
|
1806
|
+
files: ['**/*.js', '**/*.mjs'],
|
|
1807
|
+
languageOptions: {
|
|
1808
|
+
globals: {
|
|
1809
|
+
...globals.node,
|
|
1810
|
+
},
|
|
1811
|
+
parserOptions: {
|
|
1812
|
+
projectService: false,
|
|
1813
|
+
},
|
|
1814
|
+
},
|
|
1815
|
+
rules: {
|
|
1816
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
1817
|
+
},
|
|
1818
|
+
},
|
|
1819
|
+
|
|
1820
|
+
eslintConfigPrettier,
|
|
1821
|
+
]);
|
|
1729
1822
|
`
|
|
1730
1823
|
},
|
|
1731
1824
|
{
|
|
@@ -1738,7 +1831,9 @@ generated
|
|
|
1738
1831
|
"private": true,
|
|
1739
1832
|
"scripts": {
|
|
1740
1833
|
"build": "test -d src && custom-objects-build --input src --output dist || true",
|
|
1834
|
+
"lint": "pnpm lint:types && pnpm lint:eslint",
|
|
1741
1835
|
"lint:types": "test ! -d src || tsc --noEmit",
|
|
1836
|
+
"lint:eslint": "eslint .",
|
|
1742
1837
|
"test": "vitest run"
|
|
1743
1838
|
},
|
|
1744
1839
|
"dependencies": {
|
|
@@ -1761,8 +1856,20 @@ generated
|
|
|
1761
1856
|
"moduleResolution": "bundler",
|
|
1762
1857
|
"types": ["vitest/globals"]
|
|
1763
1858
|
},
|
|
1859
|
+
"include": ["src/**/*.ts"],
|
|
1764
1860
|
"exclude": ["dist"]
|
|
1765
1861
|
}
|
|
1862
|
+
`
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
path: "root/custom-objects/vitest.config.mts",
|
|
1866
|
+
content: `import { defineConfig } from 'vitest/config';
|
|
1867
|
+
|
|
1868
|
+
export default defineConfig({
|
|
1869
|
+
test: {
|
|
1870
|
+
globals: true,
|
|
1871
|
+
},
|
|
1872
|
+
});
|
|
1766
1873
|
`
|
|
1767
1874
|
},
|
|
1768
1875
|
{
|
|
@@ -1880,7 +1987,7 @@ export default defineConfig([
|
|
|
1880
1987
|
"build": "pnpm -r --if-present build",
|
|
1881
1988
|
"lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
|
|
1882
1989
|
"lint:types": "pnpm -r --if-present lint:types",
|
|
1883
|
-
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
|
|
1990
|
+
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
|
|
1884
1991
|
"lint:format": "prettier --check .",
|
|
1885
1992
|
"fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
|
|
1886
1993
|
"fix:format": "prettier --write .",
|
|
@@ -1909,6 +2016,10 @@ export default defineConfig([
|
|
|
1909
2016
|
|
|
1910
2017
|
overrides:
|
|
1911
2018
|
vite: ^6.0.0
|
|
2019
|
+
|
|
2020
|
+
allowBuilds:
|
|
2021
|
+
core-js-pure: false
|
|
2022
|
+
esbuild: false
|
|
1912
2023
|
`
|
|
1913
2024
|
},
|
|
1914
2025
|
{
|
|
@@ -1926,7 +2037,7 @@ declarations:
|
|
|
1926
2037
|
content: `#!/usr/bin/env tsx
|
|
1927
2038
|
/**
|
|
1928
2039
|
* Runs tests across the workspace:
|
|
1929
|
-
* - vitest for script extensions and custom objects (
|
|
2040
|
+
* - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
|
|
1930
2041
|
* - jest for UI extensions (ui/)
|
|
1931
2042
|
*/
|
|
1932
2043
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -1936,6 +2047,8 @@ const hasExtensions =
|
|
|
1936
2047
|
existsSync('extensions') &&
|
|
1937
2048
|
readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
|
|
1938
2049
|
|
|
2050
|
+
const hasCustomObjects = existsSync('custom-objects/package.json');
|
|
2051
|
+
|
|
1939
2052
|
const hasUI = existsSync('ui/package.json');
|
|
1940
2053
|
|
|
1941
2054
|
let exitCode = 0;
|
|
@@ -1948,7 +2061,7 @@ function run(cmd: string): void {
|
|
|
1948
2061
|
}
|
|
1949
2062
|
}
|
|
1950
2063
|
|
|
1951
|
-
if (hasExtensions) {
|
|
2064
|
+
if (hasExtensions || hasCustomObjects) {
|
|
1952
2065
|
run('vitest run');
|
|
1953
2066
|
}
|
|
1954
2067
|
|
|
@@ -2716,8 +2829,30 @@ var _ExtensionTemplateManager = class extends _TemplateManager {
|
|
|
2716
2829
|
}
|
|
2717
2830
|
};
|
|
2718
2831
|
|
|
2832
|
+
// src/workspace-versions.json
|
|
2833
|
+
var workspace_versions_default = {
|
|
2834
|
+
"@stripe/extensibility-custom-objects": "1.0.0",
|
|
2835
|
+
"@stripe/extensibility-custom-objects-tools": "4.0.1",
|
|
2836
|
+
"@stripe/extensibility-dev-tools": "1.0.2",
|
|
2837
|
+
"@stripe/extensibility-eslint-plugin": "1.0.0",
|
|
2838
|
+
"@stripe/extensibility-language-server": "1.0.0",
|
|
2839
|
+
"@stripe/extensibility-sdk": "1.0.0",
|
|
2840
|
+
"@stripe/extensibility-test-helpers": "1.0.0"
|
|
2841
|
+
};
|
|
2842
|
+
|
|
2843
|
+
// src/workspace-versions.ts
|
|
2844
|
+
var _workspaceVersions = workspace_versions_default;
|
|
2845
|
+
function _workspaceVersion(packageName) {
|
|
2846
|
+
const v = _workspaceVersions[packageName];
|
|
2847
|
+
if (v === void 0) {
|
|
2848
|
+
throw new Error(
|
|
2849
|
+
`Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
|
|
2850
|
+
);
|
|
2851
|
+
}
|
|
2852
|
+
return v;
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2719
2855
|
// src/templates/extensions/base.ts
|
|
2720
|
-
import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
|
|
2721
2856
|
var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
|
|
2722
2857
|
var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
|
|
2723
2858
|
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
|
|
@@ -3022,14 +3157,14 @@ var billing_bill_discount_calculation_default = {
|
|
|
3022
3157
|
[EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
|
|
3023
3158
|
};
|
|
3024
3159
|
|
|
3025
|
-
// src/templates/extensions/billing.
|
|
3026
|
-
var EXTENSION_INTERFACE_ID6 = "billing.
|
|
3027
|
-
var
|
|
3160
|
+
// src/templates/extensions/billing.invoice_collection_options.ts
|
|
3161
|
+
var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
|
|
3162
|
+
var invoiceCollectionOptionsTemplate = {
|
|
3028
3163
|
hidden: true,
|
|
3029
3164
|
methods: {
|
|
3030
|
-
|
|
3165
|
+
override_options: { implementation_types: ["script"] }
|
|
3031
3166
|
},
|
|
3032
|
-
description: "Use Stripe Scripts to create custom invoice collection
|
|
3167
|
+
description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
|
|
3033
3168
|
generate: (params, context) => {
|
|
3034
3169
|
const { id } = params;
|
|
3035
3170
|
const { fs: fs2 } = context;
|
|
@@ -3057,15 +3192,15 @@ var invoiceCollectionSettingTemplate = {
|
|
|
3057
3192
|
...base.files
|
|
3058
3193
|
],
|
|
3059
3194
|
methods: {
|
|
3060
|
-
|
|
3195
|
+
override_options: {
|
|
3061
3196
|
implementation_type: "script"
|
|
3062
3197
|
}
|
|
3063
3198
|
}
|
|
3064
3199
|
};
|
|
3065
3200
|
}
|
|
3066
3201
|
};
|
|
3067
|
-
var
|
|
3068
|
-
[EXTENSION_INTERFACE_ID6]:
|
|
3202
|
+
var billing_invoice_collection_options_default = {
|
|
3203
|
+
[EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
|
|
3069
3204
|
};
|
|
3070
3205
|
|
|
3071
3206
|
// src/templates/extensions/billing.prorations.ts
|
|
@@ -3173,7 +3308,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
3173
3308
|
...extend_workflows_custom_action_default,
|
|
3174
3309
|
...billing_customer_balance_application_default,
|
|
3175
3310
|
...billing_bill_discount_calculation_default,
|
|
3176
|
-
...
|
|
3311
|
+
...billing_invoice_collection_options_default,
|
|
3177
3312
|
...billing_prorations_default,
|
|
3178
3313
|
...billing_recurring_billing_item_handling_default
|
|
3179
3314
|
};
|
|
@@ -3186,9 +3321,8 @@ var _templateManager = new _ExtensionTemplateManager(
|
|
|
3186
3321
|
);
|
|
3187
3322
|
|
|
3188
3323
|
// src/templates/root/index.ts
|
|
3189
|
-
import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
|
|
3190
3324
|
var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
|
|
3191
|
-
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${
|
|
3325
|
+
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
|
|
3192
3326
|
var _rootWorkspaceTemplate = {
|
|
3193
3327
|
generate: (params, context) => {
|
|
3194
3328
|
const { fs: fs2 } = context;
|
|
@@ -3243,14 +3377,14 @@ var _rootWorkspaceTemplate = {
|
|
|
3243
3377
|
path: "custom-objects/package.json",
|
|
3244
3378
|
content: fs2.mustache(
|
|
3245
3379
|
{
|
|
3246
|
-
customObjectsVersion:
|
|
3380
|
+
customObjectsVersion: _workspaceVersion(
|
|
3247
3381
|
"@stripe/extensibility-custom-objects"
|
|
3248
3382
|
),
|
|
3249
|
-
sdkVersion:
|
|
3250
|
-
customObjectsToolsVersion:
|
|
3383
|
+
sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
|
|
3384
|
+
customObjectsToolsVersion: _workspaceVersion(
|
|
3251
3385
|
"@stripe/extensibility-custom-objects-tools"
|
|
3252
3386
|
),
|
|
3253
|
-
testHelpersVersion:
|
|
3387
|
+
testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
|
|
3254
3388
|
},
|
|
3255
3389
|
"custom-objects",
|
|
3256
3390
|
"package.json.mustache"
|
|
@@ -3262,6 +3396,16 @@ var _rootWorkspaceTemplate = {
|
|
|
3262
3396
|
content: fs2.textFile("custom-objects/tsconfig.json"),
|
|
3263
3397
|
precious: true
|
|
3264
3398
|
},
|
|
3399
|
+
{
|
|
3400
|
+
path: "custom-objects/eslint.config.mts",
|
|
3401
|
+
content: fs2.textFile("custom-objects/eslint.config.mts"),
|
|
3402
|
+
precious: true
|
|
3403
|
+
},
|
|
3404
|
+
{
|
|
3405
|
+
path: "custom-objects/vitest.config.mts",
|
|
3406
|
+
content: fs2.textFile("custom-objects/vitest.config.mts"),
|
|
3407
|
+
precious: true
|
|
3408
|
+
},
|
|
3265
3409
|
{
|
|
3266
3410
|
path: "ui/package.json",
|
|
3267
3411
|
content: fs2.textFile("ui/package.json"),
|
|
@@ -3288,7 +3432,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3288
3432
|
_devNpmDep("@types/node", "^20.19.0"),
|
|
3289
3433
|
_devNpmDep(
|
|
3290
3434
|
"@stripe/extensibility-dev-tools",
|
|
3291
|
-
`^${
|
|
3435
|
+
`^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
|
|
3292
3436
|
),
|
|
3293
3437
|
_devNpmDep("concurrently", "^9.2.1"),
|
|
3294
3438
|
_devNpmDep("eslint", "^9.0.0"),
|
|
@@ -3486,9 +3630,9 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3486
3630
|
workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
|
|
3487
3631
|
generate: async (svc) => {
|
|
3488
3632
|
const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
|
|
3489
|
-
const
|
|
3633
|
+
const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
|
|
3490
3634
|
const objectResult = await svc.generateCustomObject({ name: objectName });
|
|
3491
|
-
if (
|
|
3635
|
+
if (workspaceScaffoldingExists) {
|
|
3492
3636
|
return objectResult;
|
|
3493
3637
|
}
|
|
3494
3638
|
const workspaceResult = await svc.generateCustomObjectsWorkspace({});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace package version manifest.
|
|
3
|
+
*
|
|
4
|
+
* Provides a lookup from workspace package name to its current published
|
|
5
|
+
* version. The backing JSON file is maintained by the sync script
|
|
6
|
+
* (`scripts/src/sync-workspace-versions.ts`) and updated by CI via the
|
|
7
|
+
* template-version-bump PR workflow.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
/** @internal */
|
|
12
|
+
export type _WorkspaceVersionMap = Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* All published workspace package versions.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const _workspaceVersions: _WorkspaceVersionMap;
|
|
18
|
+
/**
|
|
19
|
+
* Look up the current version for a workspace package.
|
|
20
|
+
*
|
|
21
|
+
* Throws if the package is not in the manifest -- this catches typos at
|
|
22
|
+
* build time rather than producing a silent `undefined`.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare function _workspaceVersion(packageName: string): string;
|
|
26
|
+
//# sourceMappingURL=workspace-versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-versions.d.ts","sourceRoot":"","sources":["../src/workspace-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,gBAAgB;AAChB,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,oBAA+B,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAS7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/extensibility-dev-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"yaml": "^2.8.3",
|
|
73
73
|
"yargs": "^17.7.2",
|
|
74
74
|
"zod": "^4.3.6",
|
|
75
|
-
"@stripe/extensibility-custom-objects-tools": "0.
|
|
76
|
-
"@stripe/extensibility-tool-utils": "0.
|
|
75
|
+
"@stripe/extensibility-custom-objects-tools": "4.0.1",
|
|
76
|
+
"@stripe/extensibility-tool-utils": "1.0.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@protobuf-ts/protoc": "^2.8.2",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@types/yargs": "^17.0.35",
|
|
84
84
|
"ts-proto": "^2.11.2",
|
|
85
85
|
"tsd": "^0.33.0",
|
|
86
|
-
"@stripe/extensibility-jsonschema-tools": "0.
|
|
86
|
+
"@stripe/extensibility-jsonschema-tools": "1.0.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"typescript": "^5.8.0"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { beforeEach, describe, it, expect } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import MyInvoiceCollectionOptions from './index.js';
|
|
4
|
+
|
|
5
|
+
describe('MyInvoiceCollectionOptions', () => {
|
|
6
|
+
let instance: MyInvoiceCollectionOptions;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
instance = new MyInvoiceCollectionOptions();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should be constructable', () => {
|
|
13
|
+
expect(instance).toBeInstanceOf(MyInvoiceCollectionOptions);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
4
|
+
interface MyInvoiceCollectionOptionsConfig {}
|
|
5
|
+
|
|
6
|
+
export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
|
|
7
|
+
overrideOptions(
|
|
8
|
+
_request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
|
|
9
|
+
_config: MyInvoiceCollectionOptionsConfig,
|
|
10
|
+
_context: Context
|
|
11
|
+
) {
|
|
12
|
+
// TODO: implement your collection setting logic here
|
|
13
|
+
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
|
5
|
+
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
|
|
8
|
+
import stripeAppsConfig from '@stripe/extensibility-eslint-plugin';
|
|
9
|
+
import customObjectsConfig from '@stripe/extensibility-eslint-plugin/custom-objects';
|
|
10
|
+
|
|
11
|
+
export default defineConfig([
|
|
12
|
+
eslint.configs.recommended,
|
|
13
|
+
...tseslint.configs.recommended,
|
|
14
|
+
...stripeAppsConfig,
|
|
15
|
+
...customObjectsConfig,
|
|
16
|
+
|
|
17
|
+
// Global ignores
|
|
18
|
+
{
|
|
19
|
+
ignores: ['dist', 'generated', 'node_modules'],
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
// TypeScript source files (with type-checking)
|
|
23
|
+
{
|
|
24
|
+
name: 'sources',
|
|
25
|
+
files: ['src/**/*.ts'],
|
|
26
|
+
ignores: ['**/*.test.ts', '**/__tests__/**'],
|
|
27
|
+
languageOptions: {
|
|
28
|
+
globals: {
|
|
29
|
+
...globals.node,
|
|
30
|
+
},
|
|
31
|
+
parserOptions: {
|
|
32
|
+
projectService: true,
|
|
33
|
+
tsconfigRootDir: import.meta.dirname,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Test files
|
|
39
|
+
{
|
|
40
|
+
name: 'tests',
|
|
41
|
+
files: ['src/**/*.test.ts', 'src/**/__tests__/**/*.ts'],
|
|
42
|
+
languageOptions: {
|
|
43
|
+
globals: {
|
|
44
|
+
...globals.node,
|
|
45
|
+
},
|
|
46
|
+
parserOptions: {
|
|
47
|
+
projectService: true,
|
|
48
|
+
tsconfigRootDir: import.meta.dirname,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// Config files
|
|
54
|
+
{
|
|
55
|
+
name: 'ts-configs',
|
|
56
|
+
files: ['*.config.m?ts', 'eslint.config.mts'],
|
|
57
|
+
languageOptions: {
|
|
58
|
+
globals: {
|
|
59
|
+
...globals.node,
|
|
60
|
+
},
|
|
61
|
+
parserOptions: {
|
|
62
|
+
projectService: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
rules: {
|
|
66
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// JavaScript/MJS files (scripts, configs) — no TS project, so only
|
|
71
|
+
// disable the TS-parser-specific rule that doesn't apply without it.
|
|
72
|
+
{
|
|
73
|
+
name: 'js-configs',
|
|
74
|
+
files: ['**/*.js', '**/*.mjs'],
|
|
75
|
+
languageOptions: {
|
|
76
|
+
globals: {
|
|
77
|
+
...globals.node,
|
|
78
|
+
},
|
|
79
|
+
parserOptions: {
|
|
80
|
+
projectService: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
rules: {
|
|
84
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
eslintConfigPrettier,
|
|
89
|
+
]);
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "test -d src && custom-objects-build --input src --output dist || true",
|
|
9
|
+
"lint": "pnpm lint:types && pnpm lint:eslint",
|
|
9
10
|
"lint:types": "test ! -d src || tsc --noEmit",
|
|
11
|
+
"lint:eslint": "eslint .",
|
|
10
12
|
"test": "vitest run"
|
|
11
13
|
},
|
|
12
14
|
"dependencies": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "pnpm -r --if-present build",
|
|
13
13
|
"lint": "pnpm lint:types && pnpm lint:eslint && pnpm lint:format",
|
|
14
14
|
"lint:types": "pnpm -r --if-present lint:types",
|
|
15
|
-
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint",
|
|
15
|
+
"lint:eslint": "eslint . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present lint:eslint && pnpm -r --filter './custom-objects' --if-present lint:eslint",
|
|
16
16
|
"lint:format": "prettier --check .",
|
|
17
17
|
"fix:lint": "eslint --fix . --ignore-pattern 'extensions/**' && pnpm -r --filter './extensions/*' --if-present fix:lint",
|
|
18
18
|
"fix:format": "prettier --write .",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
/**
|
|
3
3
|
* Runs tests across the workspace:
|
|
4
|
-
* - vitest for script extensions and custom objects (
|
|
4
|
+
* - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
|
|
5
5
|
* - jest for UI extensions (ui/)
|
|
6
6
|
*/
|
|
7
7
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -11,6 +11,8 @@ const hasExtensions =
|
|
|
11
11
|
existsSync('extensions') &&
|
|
12
12
|
readdirSync('extensions').some((name) => existsSync(`extensions/${name}/package.json`));
|
|
13
13
|
|
|
14
|
+
const hasCustomObjects = existsSync('custom-objects/package.json');
|
|
15
|
+
|
|
14
16
|
const hasUI = existsSync('ui/package.json');
|
|
15
17
|
|
|
16
18
|
let exitCode = 0;
|
|
@@ -23,7 +25,7 @@ function run(cmd: string): void {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
if (hasExtensions) {
|
|
28
|
+
if (hasExtensions || hasCustomObjects) {
|
|
27
29
|
run('vitest run');
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"billing.invoice_collection_setting.d.ts","sourceRoot":"","sources":["../../../src/templates/extensions/billing.invoice_collection_setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;;;;AAgDrD,wBAEE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import MyInvoiceCollectionSetting from './index.js';
|
|
4
|
-
|
|
5
|
-
describe('MyInvoiceCollectionSetting', () => {
|
|
6
|
-
let instance: MyInvoiceCollectionSetting;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
instance = new MyInvoiceCollectionSetting();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should be constructable', () => {
|
|
13
|
-
expect(instance).toBeInstanceOf(MyInvoiceCollectionSetting);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
4
|
-
interface MyInvoiceCollectionSettingConfig {}
|
|
5
|
-
|
|
6
|
-
export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
|
|
7
|
-
collectionOverride(
|
|
8
|
-
_request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
|
|
9
|
-
_config: MyInvoiceCollectionSettingConfig,
|
|
10
|
-
_context: Context
|
|
11
|
-
) {
|
|
12
|
-
// TODO: implement your collection setting logic here
|
|
13
|
-
|
|
14
|
-
return {};
|
|
15
|
-
}
|
|
16
|
-
}
|