@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
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 .",
|
|
@@ -1926,7 +2033,7 @@ declarations:
|
|
|
1926
2033
|
content: `#!/usr/bin/env tsx
|
|
1927
2034
|
/**
|
|
1928
2035
|
* Runs tests across the workspace:
|
|
1929
|
-
* - vitest for script extensions and custom objects (
|
|
2036
|
+
* - vitest for script extensions (extensions/*) and custom objects (custom-objects/)
|
|
1930
2037
|
* - jest for UI extensions (ui/)
|
|
1931
2038
|
*/
|
|
1932
2039
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -1936,6 +2043,8 @@ const hasExtensions =
|
|
|
1936
2043
|
existsSync('extensions') &&
|
|
1937
2044
|
readdirSync('extensions').some((name) => existsSync(\`extensions/\${name}/package.json\`));
|
|
1938
2045
|
|
|
2046
|
+
const hasCustomObjects = existsSync('custom-objects/package.json');
|
|
2047
|
+
|
|
1939
2048
|
const hasUI = existsSync('ui/package.json');
|
|
1940
2049
|
|
|
1941
2050
|
let exitCode = 0;
|
|
@@ -1948,7 +2057,7 @@ function run(cmd: string): void {
|
|
|
1948
2057
|
}
|
|
1949
2058
|
}
|
|
1950
2059
|
|
|
1951
|
-
if (hasExtensions) {
|
|
2060
|
+
if (hasExtensions || hasCustomObjects) {
|
|
1952
2061
|
run('vitest run');
|
|
1953
2062
|
}
|
|
1954
2063
|
|
|
@@ -2716,8 +2825,30 @@ var _ExtensionTemplateManager = class extends _TemplateManager {
|
|
|
2716
2825
|
}
|
|
2717
2826
|
};
|
|
2718
2827
|
|
|
2828
|
+
// src/workspace-versions.json
|
|
2829
|
+
var workspace_versions_default = {
|
|
2830
|
+
"@stripe/extensibility-custom-objects": "0.8.0",
|
|
2831
|
+
"@stripe/extensibility-custom-objects-tools": "0.42.1",
|
|
2832
|
+
"@stripe/extensibility-dev-tools": "0.25.1",
|
|
2833
|
+
"@stripe/extensibility-eslint-plugin": "0.17.1",
|
|
2834
|
+
"@stripe/extensibility-language-server": "0.3.4",
|
|
2835
|
+
"@stripe/extensibility-sdk": "0.27.1",
|
|
2836
|
+
"@stripe/extensibility-test-helpers": "0.2.7"
|
|
2837
|
+
};
|
|
2838
|
+
|
|
2839
|
+
// src/workspace-versions.ts
|
|
2840
|
+
var _workspaceVersions = workspace_versions_default;
|
|
2841
|
+
function _workspaceVersion(packageName) {
|
|
2842
|
+
const v = _workspaceVersions[packageName];
|
|
2843
|
+
if (v === void 0) {
|
|
2844
|
+
throw new Error(
|
|
2845
|
+
`Unknown workspace package "${packageName}". Check workspace-versions.json or run: tsx scripts/src/sync-workspace-versions.ts`
|
|
2846
|
+
);
|
|
2847
|
+
}
|
|
2848
|
+
return v;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2719
2851
|
// src/templates/extensions/base.ts
|
|
2720
|
-
import { _workspaceVersion } from "@stripe/extensibility-tool-utils";
|
|
2721
2852
|
var SDK_PACKAGE_NAME = "@stripe/extensibility-sdk";
|
|
2722
2853
|
var LANGUAGE_SERVER_PACKAGE_NAME = "@stripe/extensibility-language-server";
|
|
2723
2854
|
var LANGUAGE_SERVER_PACKAGE_VERSION = `^${_workspaceVersion(LANGUAGE_SERVER_PACKAGE_NAME)}`;
|
|
@@ -3022,14 +3153,14 @@ var billing_bill_discount_calculation_default = {
|
|
|
3022
3153
|
[EXTENSION_INTERFACE_ID5]: discountCalculationTemplate
|
|
3023
3154
|
};
|
|
3024
3155
|
|
|
3025
|
-
// src/templates/extensions/billing.
|
|
3026
|
-
var EXTENSION_INTERFACE_ID6 = "billing.
|
|
3027
|
-
var
|
|
3156
|
+
// src/templates/extensions/billing.invoice_collection_options.ts
|
|
3157
|
+
var EXTENSION_INTERFACE_ID6 = "billing.invoice_collection_options";
|
|
3158
|
+
var invoiceCollectionOptionsTemplate = {
|
|
3028
3159
|
hidden: true,
|
|
3029
3160
|
methods: {
|
|
3030
|
-
|
|
3161
|
+
override_options: { implementation_types: ["script"] }
|
|
3031
3162
|
},
|
|
3032
|
-
description: "Use Stripe Scripts to create custom invoice collection
|
|
3163
|
+
description: "Use Stripe Scripts to create custom invoice collection options that controls how your integration handles invoices generated from subscriptions.",
|
|
3033
3164
|
generate: (params, context) => {
|
|
3034
3165
|
const { id } = params;
|
|
3035
3166
|
const { fs: fs2 } = context;
|
|
@@ -3057,15 +3188,15 @@ var invoiceCollectionSettingTemplate = {
|
|
|
3057
3188
|
...base.files
|
|
3058
3189
|
],
|
|
3059
3190
|
methods: {
|
|
3060
|
-
|
|
3191
|
+
override_options: {
|
|
3061
3192
|
implementation_type: "script"
|
|
3062
3193
|
}
|
|
3063
3194
|
}
|
|
3064
3195
|
};
|
|
3065
3196
|
}
|
|
3066
3197
|
};
|
|
3067
|
-
var
|
|
3068
|
-
[EXTENSION_INTERFACE_ID6]:
|
|
3198
|
+
var billing_invoice_collection_options_default = {
|
|
3199
|
+
[EXTENSION_INTERFACE_ID6]: invoiceCollectionOptionsTemplate
|
|
3069
3200
|
};
|
|
3070
3201
|
|
|
3071
3202
|
// src/templates/extensions/billing.prorations.ts
|
|
@@ -3173,7 +3304,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
3173
3304
|
...extend_workflows_custom_action_default,
|
|
3174
3305
|
...billing_customer_balance_application_default,
|
|
3175
3306
|
...billing_bill_discount_calculation_default,
|
|
3176
|
-
...
|
|
3307
|
+
...billing_invoice_collection_options_default,
|
|
3177
3308
|
...billing_prorations_default,
|
|
3178
3309
|
...billing_recurring_billing_item_handling_default
|
|
3179
3310
|
};
|
|
@@ -3186,9 +3317,8 @@ var _templateManager = new _ExtensionTemplateManager(
|
|
|
3186
3317
|
);
|
|
3187
3318
|
|
|
3188
3319
|
// src/templates/root/index.ts
|
|
3189
|
-
import { _workspaceVersion as _workspaceVersion2 } from "@stripe/extensibility-tool-utils";
|
|
3190
3320
|
var EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME = "@stripe/extensibility-eslint-plugin";
|
|
3191
|
-
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${
|
|
3321
|
+
var EXTENSIBILITY_ESLINT_PLUGIN_VERSION = `^${_workspaceVersion(EXTENSIBILITY_ESLINT_PLUGIN_PACKAGE_NAME)}`;
|
|
3192
3322
|
var _rootWorkspaceTemplate = {
|
|
3193
3323
|
generate: (params, context) => {
|
|
3194
3324
|
const { fs: fs2 } = context;
|
|
@@ -3243,14 +3373,14 @@ var _rootWorkspaceTemplate = {
|
|
|
3243
3373
|
path: "custom-objects/package.json",
|
|
3244
3374
|
content: fs2.mustache(
|
|
3245
3375
|
{
|
|
3246
|
-
customObjectsVersion:
|
|
3376
|
+
customObjectsVersion: _workspaceVersion(
|
|
3247
3377
|
"@stripe/extensibility-custom-objects"
|
|
3248
3378
|
),
|
|
3249
|
-
sdkVersion:
|
|
3250
|
-
customObjectsToolsVersion:
|
|
3379
|
+
sdkVersion: _workspaceVersion("@stripe/extensibility-sdk"),
|
|
3380
|
+
customObjectsToolsVersion: _workspaceVersion(
|
|
3251
3381
|
"@stripe/extensibility-custom-objects-tools"
|
|
3252
3382
|
),
|
|
3253
|
-
testHelpersVersion:
|
|
3383
|
+
testHelpersVersion: _workspaceVersion("@stripe/extensibility-test-helpers")
|
|
3254
3384
|
},
|
|
3255
3385
|
"custom-objects",
|
|
3256
3386
|
"package.json.mustache"
|
|
@@ -3262,6 +3392,16 @@ var _rootWorkspaceTemplate = {
|
|
|
3262
3392
|
content: fs2.textFile("custom-objects/tsconfig.json"),
|
|
3263
3393
|
precious: true
|
|
3264
3394
|
},
|
|
3395
|
+
{
|
|
3396
|
+
path: "custom-objects/eslint.config.mts",
|
|
3397
|
+
content: fs2.textFile("custom-objects/eslint.config.mts"),
|
|
3398
|
+
precious: true
|
|
3399
|
+
},
|
|
3400
|
+
{
|
|
3401
|
+
path: "custom-objects/vitest.config.mts",
|
|
3402
|
+
content: fs2.textFile("custom-objects/vitest.config.mts"),
|
|
3403
|
+
precious: true
|
|
3404
|
+
},
|
|
3265
3405
|
{
|
|
3266
3406
|
path: "ui/package.json",
|
|
3267
3407
|
content: fs2.textFile("ui/package.json"),
|
|
@@ -3288,7 +3428,7 @@ var _rootWorkspaceTemplate = {
|
|
|
3288
3428
|
_devNpmDep("@types/node", "^20.19.0"),
|
|
3289
3429
|
_devNpmDep(
|
|
3290
3430
|
"@stripe/extensibility-dev-tools",
|
|
3291
|
-
`^${
|
|
3431
|
+
`^${_workspaceVersion("@stripe/extensibility-dev-tools")}`
|
|
3292
3432
|
),
|
|
3293
3433
|
_devNpmDep("concurrently", "^9.2.1"),
|
|
3294
3434
|
_devNpmDep("eslint", "^9.0.0"),
|
|
@@ -3486,9 +3626,9 @@ function resolveMode(options, projectRoot, packageDir) {
|
|
|
3486
3626
|
workspaceDir: () => packageDir ?? path4.join(projectRoot, "custom-objects"),
|
|
3487
3627
|
generate: async (svc) => {
|
|
3488
3628
|
const customObjectsWorkspaceDir = packageDir ?? path4.join(projectRoot, "custom-objects");
|
|
3489
|
-
const
|
|
3629
|
+
const workspaceScaffoldingExists = existsSync2(path4.join(customObjectsWorkspaceDir, "package.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "tsconfig.json")) && existsSync2(path4.join(customObjectsWorkspaceDir, "eslint.config.mts"));
|
|
3490
3630
|
const objectResult = await svc.generateCustomObject({ name: objectName });
|
|
3491
|
-
if (
|
|
3631
|
+
if (workspaceScaffoldingExists) {
|
|
3492
3632
|
return objectResult;
|
|
3493
3633
|
}
|
|
3494
3634
|
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": "0.25.1",
|
|
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": "0.42.1",
|
|
76
|
+
"@stripe/extensibility-tool-utils": "0.7.1"
|
|
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.6.
|
|
86
|
+
"@stripe/extensibility-jsonschema-tools": "0.6.8"
|
|
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
|
-
}
|