@usethrottle/cli 0.1.0

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/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @usethrottle/cli
2
+
3
+ Command-line tool for the Throttle multi-tenant payments platform.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @usethrottle/cli
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Connect a BigCommerce store
14
+
15
+ ```bash
16
+ throttle bc-connect
17
+ ```
18
+
19
+ You'll be prompted for:
20
+ 1. Your Throttle API key (sk_*) — get one at https://throttle-checkout.vercel.app/welcome
21
+ 2. Your BigCommerce store hash (the part of your store URL after `stores/`)
22
+ 3. Your BigCommerce API token (Settings → API accounts → Create V2/V3 API token; needs Modify scopes for Orders, Customers, Carts, Webhooks)
23
+
24
+ Or non-interactive:
25
+ ```bash
26
+ throttle bc-connect --api-key sk_xxx --store-hash abc123 --access-token tok_xxx
27
+ ```
28
+
29
+ ### Disconnect a store
30
+
31
+ ```bash
32
+ throttle bc-disconnect conn_xxx
33
+ ```
34
+
35
+ (Soft-delete; throttle hard-deletes after 90 days.)
36
+
37
+ ## Configuration
38
+
39
+ | Flag | Env var | Default |
40
+ |---|---|---|
41
+ | `--api` | `THROTTLE_API_URL` | `https://throttle-api-gff1.onrender.com` |
42
+ | `--api-key` | `THROTTLE_API_KEY` | (interactive prompt) |
package/dist/cli.js ADDED
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { Command } from "commander";
5
+
6
+ // src/commands/bc-connect.ts
7
+ import prompts from "prompts";
8
+ import pc from "picocolors";
9
+
10
+ // src/lib/throttle-api.ts
11
+ var ThrottleApiError = class extends Error {
12
+ constructor(code, message, statusCode) {
13
+ super(message);
14
+ this.code = code;
15
+ this.statusCode = statusCode;
16
+ this.name = "ThrottleApiError";
17
+ }
18
+ };
19
+ async function callThrottle(opts, path, init = {}) {
20
+ const url = `${opts.apiBaseUrl.replace(/\/$/, "")}${path}`;
21
+ const headers = {
22
+ "content-type": "application/json",
23
+ "x-api-key": opts.apiKey,
24
+ ...init.headers ?? {}
25
+ };
26
+ const res = await fetch(url, { ...init, headers });
27
+ const text = await res.text();
28
+ let body = {};
29
+ try {
30
+ body = text ? JSON.parse(text) : {};
31
+ } catch {
32
+ }
33
+ if (!res.ok) {
34
+ const code = body.error?.code ?? `http_${res.status}`;
35
+ const message = body.error?.message ?? `Request failed (${res.status}): ${text.slice(0, 120)}`;
36
+ throw new ThrottleApiError(code, message, res.status);
37
+ }
38
+ return body.data ?? body;
39
+ }
40
+
41
+ // src/commands/bc-connect.ts
42
+ async function bcConnect(options) {
43
+ const apiKey = options.apiKey ?? process.env.THROTTLE_API_KEY ?? await promptApiKey();
44
+ const storeHash = options.storeHash ?? await promptStoreHash();
45
+ const accessToken = options.accessToken ?? await promptAccessToken();
46
+ console.log();
47
+ console.log(pc.dim("Connecting..."));
48
+ try {
49
+ const result = await callThrottle(
50
+ { apiBaseUrl: options.apiBaseUrl, apiKey },
51
+ "/api/v1/bigcommerce/connect",
52
+ {
53
+ method: "POST",
54
+ body: JSON.stringify({ storeHash, accessToken })
55
+ }
56
+ );
57
+ console.log(pc.green("\u2713") + ` BigCommerce store ${pc.bold(storeHash)} connected`);
58
+ console.log(pc.dim(` Connection id: ${result.connectionId}`));
59
+ console.log(pc.dim(` Webhooks created: ${result.webhookRegistrations}`));
60
+ console.log(pc.dim(` Status: ${result.status}`));
61
+ console.log();
62
+ console.log(pc.dim("Next steps:"));
63
+ console.log(pc.dim(" \u2022 Test by placing a sandbox order \u2014 throttle should receive a webhook"));
64
+ console.log(pc.dim(" \u2022 Run `throttle bc-disconnect` if you ever need to remove this connection"));
65
+ } catch (err) {
66
+ if (err instanceof ThrottleApiError) {
67
+ console.error(pc.red("\u2717") + ` Failed (${err.code}): ${err.message}`);
68
+ if (err.code === "invalid_bc_credentials") {
69
+ console.error(
70
+ pc.dim(" Re-check your store hash and API token in your BigCommerce dashboard.")
71
+ );
72
+ console.error(
73
+ pc.dim(
74
+ " Store hash: settings \u2192 API accounts \u2192 store URL contains it (e.g. abc123 in stores/abc123/)"
75
+ )
76
+ );
77
+ console.error(
78
+ pc.dim(
79
+ " API token: settings \u2192 advanced settings \u2192 API accounts \u2192 create V2/V3 API token"
80
+ )
81
+ );
82
+ }
83
+ process.exitCode = 1;
84
+ return;
85
+ }
86
+ throw err;
87
+ }
88
+ }
89
+ async function promptApiKey() {
90
+ const res = await prompts(
91
+ {
92
+ type: "password",
93
+ name: "apiKey",
94
+ message: "Throttle API key (sk_...)",
95
+ validate: (v) => v.startsWith("sk_") && v.length > 20 ? true : "Must look like sk_\u2026 (paste from https://throttle-checkout.vercel.app/welcome)"
96
+ },
97
+ { onCancel: () => process.exit(1) }
98
+ );
99
+ return res.apiKey;
100
+ }
101
+ async function promptStoreHash() {
102
+ const res = await prompts(
103
+ {
104
+ type: "text",
105
+ name: "storeHash",
106
+ message: "BigCommerce store hash (e.g. abc123 from stores/abc123/...)",
107
+ validate: (v) => v.length >= 4 ? true : "Must be at least 4 characters"
108
+ },
109
+ { onCancel: () => process.exit(1) }
110
+ );
111
+ return res.storeHash.trim();
112
+ }
113
+ async function promptAccessToken() {
114
+ console.log(
115
+ pc.dim(
116
+ " Generate a token at: BigCommerce dashboard \u2192 Settings \u2192 API accounts \u2192 Create API account"
117
+ )
118
+ );
119
+ console.log(
120
+ pc.dim(
121
+ ' Required scopes: Orders, Customers, Carts, Webhooks (all "Modify"); Information & Products (Read-only)'
122
+ )
123
+ );
124
+ const res = await prompts(
125
+ {
126
+ type: "password",
127
+ name: "accessToken",
128
+ message: "BigCommerce API token",
129
+ validate: (v) => v.length >= 10 ? true : "Token looks too short \u2014 paste the full value"
130
+ },
131
+ { onCancel: () => process.exit(1) }
132
+ );
133
+ return res.accessToken;
134
+ }
135
+
136
+ // src/commands/bc-disconnect.ts
137
+ import prompts2 from "prompts";
138
+ import pc2 from "picocolors";
139
+ async function bcDisconnect(options) {
140
+ const apiKey = options.apiKey ?? process.env.THROTTLE_API_KEY ?? await promptApiKey2();
141
+ const connectionId = options.connectionId ?? await promptConnectionId();
142
+ if (!options.yes) {
143
+ const confirm = await prompts2(
144
+ {
145
+ type: "confirm",
146
+ name: "ok",
147
+ message: `Disconnect ${connectionId}? (will be hard-deleted in 90 days)`,
148
+ initial: false
149
+ },
150
+ { onCancel: () => process.exit(1) }
151
+ );
152
+ if (!confirm.ok) {
153
+ console.log(pc2.dim("Aborted."));
154
+ return;
155
+ }
156
+ }
157
+ try {
158
+ await callThrottle(
159
+ { apiBaseUrl: options.apiBaseUrl, apiKey },
160
+ `/api/v1/bigcommerce/connections/${encodeURIComponent(connectionId)}`,
161
+ { method: "DELETE" }
162
+ );
163
+ console.log(pc2.green("\u2713") + ` Disconnected ${connectionId}`);
164
+ } catch (err) {
165
+ if (err instanceof ThrottleApiError) {
166
+ console.error(pc2.red("\u2717") + ` Failed (${err.code}): ${err.message}`);
167
+ process.exitCode = 1;
168
+ return;
169
+ }
170
+ throw err;
171
+ }
172
+ }
173
+ async function promptApiKey2() {
174
+ const res = await prompts2(
175
+ { type: "password", name: "apiKey", message: "Throttle API key (sk_...)" },
176
+ { onCancel: () => process.exit(1) }
177
+ );
178
+ return res.apiKey;
179
+ }
180
+ async function promptConnectionId() {
181
+ const res = await prompts2(
182
+ { type: "text", name: "id", message: "Connection id (conn_...)" },
183
+ { onCancel: () => process.exit(1) }
184
+ );
185
+ return res.id.trim();
186
+ }
187
+
188
+ // src/index.ts
189
+ var DEFAULT_API_URL = "https://throttle-api-gff1.onrender.com";
190
+ var program = new Command();
191
+ program.name("throttle").description("Throttle command-line tool").version("0.1.0");
192
+ program.command("bc-connect").description("Connect a BigCommerce store to throttle").option("--api <url>", "Throttle API base URL", process.env.THROTTLE_API_URL ?? DEFAULT_API_URL).option("--api-key <sk_*>", "Throttle API key (else $THROTTLE_API_KEY else interactive prompt)").option("--store-hash <hash>", "BigCommerce store hash").option("--access-token <token>", "BigCommerce API token").action(async (opts) => {
193
+ await bcConnect({
194
+ apiBaseUrl: opts.api,
195
+ apiKey: opts.apiKey,
196
+ storeHash: opts.storeHash,
197
+ accessToken: opts.accessToken
198
+ });
199
+ });
200
+ program.command("bc-disconnect [connectionId]").description("Disconnect a BigCommerce store from throttle").option("--api <url>", "Throttle API base URL", process.env.THROTTLE_API_URL ?? DEFAULT_API_URL).option("--api-key <sk_*>", "Throttle API key (else $THROTTLE_API_KEY else interactive prompt)").option("-y, --yes", "Skip confirmation").action(async (connectionId, opts) => {
201
+ await bcDisconnect({
202
+ apiBaseUrl: opts.api,
203
+ apiKey: opts.apiKey,
204
+ connectionId,
205
+ yes: opts.yes
206
+ });
207
+ });
208
+ program.parseAsync().catch((err) => {
209
+ console.error(err);
210
+ process.exit(1);
211
+ });
212
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/bc-connect.ts","../src/lib/throttle-api.ts","../src/commands/bc-disconnect.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { bcConnect } from './commands/bc-connect.js';\nimport { bcDisconnect } from './commands/bc-disconnect.js';\n\nconst DEFAULT_API_URL = 'https://throttle-api-gff1.onrender.com';\n\nconst program = new Command();\n\nprogram.name('throttle').description('Throttle command-line tool').version('0.1.0');\n\nprogram\n .command('bc-connect')\n .description('Connect a BigCommerce store to throttle')\n .option('--api <url>', 'Throttle API base URL', process.env.THROTTLE_API_URL ?? DEFAULT_API_URL)\n .option('--api-key <sk_*>', 'Throttle API key (else $THROTTLE_API_KEY else interactive prompt)')\n .option('--store-hash <hash>', 'BigCommerce store hash')\n .option('--access-token <token>', 'BigCommerce API token')\n .action(async (opts) => {\n await bcConnect({\n apiBaseUrl: opts.api,\n apiKey: opts.apiKey,\n storeHash: opts.storeHash,\n accessToken: opts.accessToken,\n });\n });\n\nprogram\n .command('bc-disconnect [connectionId]')\n .description('Disconnect a BigCommerce store from throttle')\n .option('--api <url>', 'Throttle API base URL', process.env.THROTTLE_API_URL ?? DEFAULT_API_URL)\n .option('--api-key <sk_*>', 'Throttle API key (else $THROTTLE_API_KEY else interactive prompt)')\n .option('-y, --yes', 'Skip confirmation')\n .action(async (connectionId, opts) => {\n await bcDisconnect({\n apiBaseUrl: opts.api,\n apiKey: opts.apiKey,\n connectionId,\n yes: opts.yes,\n });\n });\n\nprogram.parseAsync().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n","import prompts from 'prompts';\nimport pc from 'picocolors';\nimport { callThrottle, ThrottleApiError } from '../lib/throttle-api.js';\n\nexport interface BcConnectOptions {\n apiBaseUrl: string;\n apiKey?: string;\n storeHash?: string;\n accessToken?: string;\n yes?: boolean;\n}\n\ninterface ConnectResponse {\n connectionId: string;\n storeHash: string;\n webhookRegistrations: number;\n status: string;\n}\n\nexport async function bcConnect(options: BcConnectOptions): Promise<void> {\n const apiKey = options.apiKey ?? process.env.THROTTLE_API_KEY ?? (await promptApiKey());\n const storeHash = options.storeHash ?? (await promptStoreHash());\n const accessToken = options.accessToken ?? (await promptAccessToken());\n\n console.log();\n console.log(pc.dim('Connecting...'));\n\n try {\n const result = await callThrottle<ConnectResponse>(\n { apiBaseUrl: options.apiBaseUrl, apiKey },\n '/api/v1/bigcommerce/connect',\n {\n method: 'POST',\n body: JSON.stringify({ storeHash, accessToken }),\n },\n );\n\n console.log(pc.green('✓') + ` BigCommerce store ${pc.bold(storeHash)} connected`);\n console.log(pc.dim(` Connection id: ${result.connectionId}`));\n console.log(pc.dim(` Webhooks created: ${result.webhookRegistrations}`));\n console.log(pc.dim(` Status: ${result.status}`));\n console.log();\n console.log(pc.dim('Next steps:'));\n console.log(pc.dim(' • Test by placing a sandbox order — throttle should receive a webhook'));\n console.log(pc.dim(' • Run `throttle bc-disconnect` if you ever need to remove this connection'));\n } catch (err) {\n if (err instanceof ThrottleApiError) {\n console.error(pc.red('✗') + ` Failed (${err.code}): ${err.message}`);\n if (err.code === 'invalid_bc_credentials') {\n console.error(\n pc.dim(' Re-check your store hash and API token in your BigCommerce dashboard.'),\n );\n console.error(\n pc.dim(\n ' Store hash: settings → API accounts → store URL contains it (e.g. abc123 in stores/abc123/)',\n ),\n );\n console.error(\n pc.dim(\n ' API token: settings → advanced settings → API accounts → create V2/V3 API token',\n ),\n );\n }\n process.exitCode = 1;\n return;\n }\n throw err;\n }\n}\n\nasync function promptApiKey(): Promise<string> {\n const res = await prompts(\n {\n type: 'password',\n name: 'apiKey',\n message: 'Throttle API key (sk_...)',\n validate: (v: string) =>\n v.startsWith('sk_') && v.length > 20\n ? true\n : 'Must look like sk_… (paste from https://throttle-checkout.vercel.app/welcome)',\n },\n { onCancel: () => process.exit(1) },\n );\n return res.apiKey;\n}\n\nasync function promptStoreHash(): Promise<string> {\n const res = await prompts(\n {\n type: 'text',\n name: 'storeHash',\n message: 'BigCommerce store hash (e.g. abc123 from stores/abc123/...)',\n validate: (v: string) => (v.length >= 4 ? true : 'Must be at least 4 characters'),\n },\n { onCancel: () => process.exit(1) },\n );\n return res.storeHash.trim();\n}\n\nasync function promptAccessToken(): Promise<string> {\n console.log(\n pc.dim(\n ' Generate a token at: BigCommerce dashboard → Settings → API accounts → Create API account',\n ),\n );\n console.log(\n pc.dim(\n ' Required scopes: Orders, Customers, Carts, Webhooks (all \"Modify\"); Information & Products (Read-only)',\n ),\n );\n const res = await prompts(\n {\n type: 'password',\n name: 'accessToken',\n message: 'BigCommerce API token',\n validate: (v: string) =>\n v.length >= 10 ? true : 'Token looks too short — paste the full value',\n },\n { onCancel: () => process.exit(1) },\n );\n return res.accessToken;\n}\n","export interface ThrottleApiOptions {\n apiBaseUrl: string;\n apiKey: string;\n}\n\nexport class ThrottleApiError extends Error {\n constructor(\n public code: string,\n message: string,\n public statusCode: number,\n ) {\n super(message);\n this.name = 'ThrottleApiError';\n }\n}\n\ninterface ApiResponse<T> {\n data?: T;\n error?: { code: string; message: string };\n}\n\nexport async function callThrottle<T>(\n opts: ThrottleApiOptions,\n path: string,\n init: RequestInit = {},\n): Promise<T> {\n const url = `${opts.apiBaseUrl.replace(/\\/$/, '')}${path}`;\n const headers = {\n 'content-type': 'application/json',\n 'x-api-key': opts.apiKey,\n ...(init.headers ?? {}),\n };\n const res = await fetch(url, { ...init, headers });\n const text = await res.text();\n let body: ApiResponse<T> = {};\n try {\n body = text ? (JSON.parse(text) as ApiResponse<T>) : {};\n } catch {\n // non-JSON response (HTML error page, gateway timeout text, etc.)\n }\n\n if (!res.ok) {\n const code = body.error?.code ?? `http_${res.status}`;\n const message =\n body.error?.message ?? `Request failed (${res.status}): ${text.slice(0, 120)}`;\n throw new ThrottleApiError(code, message, res.status);\n }\n\n return (body.data ?? body) as T;\n}\n","import prompts from 'prompts';\nimport pc from 'picocolors';\nimport { callThrottle, ThrottleApiError } from '../lib/throttle-api.js';\n\nexport interface BcDisconnectOptions {\n apiBaseUrl: string;\n apiKey?: string;\n connectionId?: string;\n yes?: boolean;\n}\n\nexport async function bcDisconnect(options: BcDisconnectOptions): Promise<void> {\n const apiKey = options.apiKey ?? process.env.THROTTLE_API_KEY ?? (await promptApiKey());\n const connectionId = options.connectionId ?? (await promptConnectionId());\n\n if (!options.yes) {\n const confirm = await prompts(\n {\n type: 'confirm',\n name: 'ok',\n message: `Disconnect ${connectionId}? (will be hard-deleted in 90 days)`,\n initial: false,\n },\n { onCancel: () => process.exit(1) },\n );\n if (!confirm.ok) {\n console.log(pc.dim('Aborted.'));\n return;\n }\n }\n\n try {\n await callThrottle(\n { apiBaseUrl: options.apiBaseUrl, apiKey },\n `/api/v1/bigcommerce/connections/${encodeURIComponent(connectionId)}`,\n { method: 'DELETE' },\n );\n console.log(pc.green('✓') + ` Disconnected ${connectionId}`);\n } catch (err) {\n if (err instanceof ThrottleApiError) {\n console.error(pc.red('✗') + ` Failed (${err.code}): ${err.message}`);\n process.exitCode = 1;\n return;\n }\n throw err;\n }\n}\n\nasync function promptApiKey(): Promise<string> {\n const res = await prompts(\n { type: 'password', name: 'apiKey', message: 'Throttle API key (sk_...)' },\n { onCancel: () => process.exit(1) },\n );\n return res.apiKey;\n}\n\nasync function promptConnectionId(): Promise<string> {\n const res = await prompts(\n { type: 'text', name: 'id', message: 'Connection id (conn_...)' },\n { onCancel: () => process.exit(1) },\n );\n return res.id.trim();\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,OAAO,aAAa;AACpB,OAAO,QAAQ;;;ACIR,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YACS,MACP,SACO,YACP;AACA,UAAM,OAAO;AAJN;AAEA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAOA,eAAsB,aACpB,MACA,MACA,OAAoB,CAAC,GACT;AACZ,QAAM,MAAM,GAAG,KAAK,WAAW,QAAQ,OAAO,EAAE,CAAC,GAAG,IAAI;AACxD,QAAM,UAAU;AAAA,IACd,gBAAgB;AAAA,IAChB,aAAa,KAAK;AAAA,IAClB,GAAI,KAAK,WAAW,CAAC;AAAA,EACvB;AACA,QAAM,MAAM,MAAM,MAAM,KAAK,EAAE,GAAG,MAAM,QAAQ,CAAC;AACjD,QAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,MAAI,OAAuB,CAAC;AAC5B,MAAI;AACF,WAAO,OAAQ,KAAK,MAAM,IAAI,IAAuB,CAAC;AAAA,EACxD,QAAQ;AAAA,EAER;AAEA,MAAI,CAAC,IAAI,IAAI;AACX,UAAM,OAAO,KAAK,OAAO,QAAQ,QAAQ,IAAI,MAAM;AACnD,UAAM,UACJ,KAAK,OAAO,WAAW,mBAAmB,IAAI,MAAM,MAAM,KAAK,MAAM,GAAG,GAAG,CAAC;AAC9E,UAAM,IAAI,iBAAiB,MAAM,SAAS,IAAI,MAAM;AAAA,EACtD;AAEA,SAAQ,KAAK,QAAQ;AACvB;;;AD9BA,eAAsB,UAAU,SAA0C;AACxE,QAAM,SAAS,QAAQ,UAAU,QAAQ,IAAI,oBAAqB,MAAM,aAAa;AACrF,QAAM,YA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oBAAoB,mEAAmE,EAC9F,OAAO,uBAAuB,wBAAwB,EACtD,OAAO,0BAA0B,uBAAuB,EACxD,OAAO,OAAO,SAAS;AACtB,QAAM,UAAU;AAAA,IACd,YAAY,KAAK;AAAA,IACjB,QAAQ,KAAK;AAAA,IACb,WAAW,KAAK;AAAA,IAChB,aAAa,KAAK;AAAA,EACpB,CAAC;AACH,CAAC;AAEH,QACG,QAAQ,8BAA8B,EACtC,YAAY,8CAA8C,EAC1D,OAAO,eAAe,yBAAyB,QAAQ,IAAI,oBAAoB,eAAe,EAC9F,OAAO,oBAAoB,mEAAmE,EAC9F,OAAO,aAAa,mBAAmB,EACvC,OAAO,OAAO,cAAc,SAAS;AACpC,QAAM,aAAa;AAAA,IACjB,YAAY,KAAK;AAAA,IACjB,QAAQ,KAAK;AAAA,IACb;AAAA,IACA,KAAK,KAAK;AAAA,EACZ,CAAC;AACH,CAAC;AAEH,QAAQ,WAAW,EAAE,MAAM,CAAC,QAAQ;AAClC,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["prompts","pc","promptApiKey","prompts","pc"]}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@usethrottle/cli",
3
+ "version": "0.1.0",
4
+ "description": "Throttle command-line tool — connect your BigCommerce store, manage your account",
5
+ "type": "module",
6
+ "bin": {
7
+ "throttle": "./dist/cli.js"
8
+ },
9
+ "files": ["dist", "README.md"],
10
+ "scripts": {
11
+ "build": "tsup",
12
+ "dev": "tsup --watch",
13
+ "test": "vitest run",
14
+ "test:watch": "vitest"
15
+ },
16
+ "dependencies": {
17
+ "commander": "^12.1.0",
18
+ "picocolors": "^1.1.0",
19
+ "prompts": "^2.4.2"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^20.0.0",
23
+ "@types/prompts": "^2.4.0",
24
+ "tsup": "^8.0.0",
25
+ "typescript": "^5.7.0",
26
+ "vitest": "^2.1.9"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "engines": {
32
+ "node": ">=20"
33
+ }
34
+ }