vercel 54.18.7 → 54.19.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/dist/chunks/add-WB6SXGXX.js +134 -0
- package/dist/chunks/chunk-4QVAYRYH.js +71 -0
- package/dist/chunks/chunk-AUECDTMX.js +128 -0
- package/dist/chunks/{chunk-JREEV2EL.js → chunk-FM24W7ET.js} +1 -1
- package/dist/chunks/chunk-I3HGCZ4E.js +72 -0
- package/dist/chunks/chunk-KXGWAWRV.js +148 -0
- package/dist/chunks/{chunk-XQQXV6ZZ.js → chunk-LFODAB54.js} +1 -0
- package/dist/chunks/chunk-RY3AVR6E.js +111 -0
- package/dist/chunks/{chunk-DXL7EPOQ.js → chunk-SQYJEUZD.js} +1 -1
- package/dist/chunks/chunk-VGIMO3ZK.js +17 -0
- package/dist/chunks/{chunk-AXFSALI3.js → chunk-WFXGLPSI.js} +5 -1
- package/dist/chunks/chunk-ZVDYGXRA.js +363 -0
- package/dist/chunks/{chunk-VTE7W5ZP.js → chunk-ZZIAWRCX.js} +0 -8
- package/dist/chunks/image-R4JG4NX4.js +73 -0
- package/dist/chunks/inspect-57BITHYZ.js +136 -0
- package/dist/chunks/inspect-RTJALSXC.js +167 -0
- package/dist/chunks/inspect-VXODLWNM.js +163 -0
- package/dist/chunks/ls-D7NWJACX.js +165 -0
- package/dist/chunks/ls-JPWOOVMW.js +214 -0
- package/dist/chunks/ls-ZDMXBOJF.js +201 -0
- package/dist/chunks/rm-OSIDD4VR.js +137 -0
- package/dist/chunks/rm-ZJQ5DOAW.js +137 -0
- package/dist/chunks/tags-HHNNZLC6.js +67 -0
- package/dist/commands/build/index.js +5 -1
- package/dist/commands/deploy/index.js +5 -2
- package/dist/commands/env/index.js +8 -3
- package/dist/commands/link/index.js +4 -1
- package/dist/commands-bulk.js +929 -695
- package/dist/help.js +1 -1
- package/dist/index.js +16 -3
- package/dist/version.mjs +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
|
|
8
|
+
// src/util/get-invalid-subcommand.ts
|
|
9
|
+
function getInvalidSubcommand(config) {
|
|
10
|
+
return `Please specify a valid subcommand: ${Object.keys(config).join(
|
|
11
|
+
" | "
|
|
12
|
+
)}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
getInvalidSubcommand
|
|
17
|
+
};
|
|
@@ -4,6 +4,9 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
vcrCommand
|
|
9
|
+
} from "./chunk-KXGWAWRV.js";
|
|
7
10
|
import {
|
|
8
11
|
metricsCommand
|
|
9
12
|
} from "./chunk-MAJWH2PD.js";
|
|
@@ -5512,7 +5515,7 @@ var integrationResourceCommand = {
|
|
|
5512
5515
|
// src/commands/integration/command.ts
|
|
5513
5516
|
var addSubcommand7 = {
|
|
5514
5517
|
name: "add",
|
|
5515
|
-
aliases: [],
|
|
5518
|
+
aliases: ["install"],
|
|
5516
5519
|
description: "Installs a marketplace integration",
|
|
5517
5520
|
arguments: [
|
|
5518
5521
|
{
|
|
@@ -9478,6 +9481,7 @@ var commandsStructs = [
|
|
|
9478
9481
|
upgradeCommand,
|
|
9479
9482
|
webhooksCommand,
|
|
9480
9483
|
usageCommand,
|
|
9484
|
+
vcrCommand,
|
|
9481
9485
|
whoamiCommand,
|
|
9482
9486
|
// added because we don't have a full help command
|
|
9483
9487
|
{ name: "help", aliases: [] }
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
outputError
|
|
9
|
+
} from "./chunk-E2ENQE2W.js";
|
|
10
|
+
import {
|
|
11
|
+
validateJsonOutput
|
|
12
|
+
} from "./chunk-XPKWKPWA.js";
|
|
13
|
+
import {
|
|
14
|
+
AGENT_REASON
|
|
15
|
+
} from "./chunk-QH7WYDEP.js";
|
|
16
|
+
import {
|
|
17
|
+
getScope
|
|
18
|
+
} from "./chunk-P726GMBL.js";
|
|
19
|
+
import {
|
|
20
|
+
getLinkedProject,
|
|
21
|
+
getProjectByNameOrId
|
|
22
|
+
} from "./chunk-RB7WQKNC.js";
|
|
23
|
+
import {
|
|
24
|
+
buildCommandWithGlobalFlags,
|
|
25
|
+
outputAgentError
|
|
26
|
+
} from "./chunk-IZOHLD5D.js";
|
|
27
|
+
import {
|
|
28
|
+
ProjectNotFound,
|
|
29
|
+
isAPIError,
|
|
30
|
+
packageName
|
|
31
|
+
} from "./chunk-P6AK7SVK.js";
|
|
32
|
+
import {
|
|
33
|
+
output_manager_default
|
|
34
|
+
} from "./chunk-OX7KI3LF.js";
|
|
35
|
+
|
|
36
|
+
// src/commands/vcr/utils/resolve-vcr-scope.ts
|
|
37
|
+
function emitVcrScopeError(client, jsonOutput, code, message, agent) {
|
|
38
|
+
outputAgentError(
|
|
39
|
+
client,
|
|
40
|
+
{
|
|
41
|
+
status: "error",
|
|
42
|
+
reason: agent.reason,
|
|
43
|
+
message,
|
|
44
|
+
hint: agent.hint,
|
|
45
|
+
next: agent.next
|
|
46
|
+
},
|
|
47
|
+
1
|
|
48
|
+
);
|
|
49
|
+
return outputError(client, jsonOutput, code, message);
|
|
50
|
+
}
|
|
51
|
+
async function resolveVcrScope(client, opts) {
|
|
52
|
+
if (opts.project) {
|
|
53
|
+
const { team } = await getScope(client);
|
|
54
|
+
if (!team) {
|
|
55
|
+
const msg = "No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory.";
|
|
56
|
+
return emitVcrScopeError(client, opts.jsonOutput, "NO_TEAM", msg, {
|
|
57
|
+
reason: AGENT_REASON.MISSING_SCOPE,
|
|
58
|
+
hint: "Select a team scope before using --project with vcr.",
|
|
59
|
+
next: [
|
|
60
|
+
{
|
|
61
|
+
command: buildCommandWithGlobalFlags(client.argv, "whoami"),
|
|
62
|
+
when: "See current user and team"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
|
|
66
|
+
when: "Switch to a team that owns the project"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
let projectResult;
|
|
72
|
+
try {
|
|
73
|
+
projectResult = await getProjectByNameOrId(client, opts.project, team.id);
|
|
74
|
+
} catch (err) {
|
|
75
|
+
if (isAPIError(err)) {
|
|
76
|
+
const msg = err.serverMessage || (err.status === 403 ? `You do not have permission to access project "${opts.project}" in team "${team.slug}".` : `API error (${err.status}).`);
|
|
77
|
+
const reason = err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : AGENT_REASON.API_ERROR;
|
|
78
|
+
return emitVcrScopeError(
|
|
79
|
+
client,
|
|
80
|
+
opts.jsonOutput,
|
|
81
|
+
err.code || "API_ERROR",
|
|
82
|
+
msg,
|
|
83
|
+
{
|
|
84
|
+
reason,
|
|
85
|
+
next: [
|
|
86
|
+
{
|
|
87
|
+
command: buildCommandWithGlobalFlags(
|
|
88
|
+
client.argv,
|
|
89
|
+
"vcr ls --project <name_or_id>"
|
|
90
|
+
),
|
|
91
|
+
when: "Retry with a project you can access (replace <name_or_id>)"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
99
|
+
if (projectResult instanceof ProjectNotFound) {
|
|
100
|
+
const msg = `Project "${opts.project}" was not found in team "${team.slug}".`;
|
|
101
|
+
return emitVcrScopeError(
|
|
102
|
+
client,
|
|
103
|
+
opts.jsonOutput,
|
|
104
|
+
"PROJECT_NOT_FOUND",
|
|
105
|
+
msg,
|
|
106
|
+
{
|
|
107
|
+
reason: AGENT_REASON.NOT_FOUND,
|
|
108
|
+
next: [
|
|
109
|
+
{
|
|
110
|
+
command: buildCommandWithGlobalFlags(client.argv, "project ls"),
|
|
111
|
+
when: "List projects in the current team to pick a name"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
teamId: team.id,
|
|
119
|
+
teamSlug: team.slug,
|
|
120
|
+
projectId: projectResult.id,
|
|
121
|
+
projectName: projectResult.name
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const linkedProject = await getLinkedProject(client);
|
|
125
|
+
if (linkedProject.status === "error") {
|
|
126
|
+
return linkedProject.exitCode;
|
|
127
|
+
}
|
|
128
|
+
if (linkedProject.status === "not_linked") {
|
|
129
|
+
const msg = "No linked project found. Run `vercel link` to link a project, or pass --project <name>.";
|
|
130
|
+
return emitVcrScopeError(client, opts.jsonOutput, "NOT_LINKED", msg, {
|
|
131
|
+
reason: AGENT_REASON.NOT_LINKED,
|
|
132
|
+
hint: "Agents should pass --project when no .vercel link exists in --cwd.",
|
|
133
|
+
next: [
|
|
134
|
+
{
|
|
135
|
+
command: buildCommandWithGlobalFlags(client.argv, "link"),
|
|
136
|
+
when: "Link this directory to a Vercel project"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
command: buildCommandWithGlobalFlags(
|
|
140
|
+
client.argv,
|
|
141
|
+
"vcr ls --project <name_or_id>"
|
|
142
|
+
),
|
|
143
|
+
when: "List repositories for a project without linking (replace <name_or_id>)"
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
teamId: linkedProject.org.id,
|
|
150
|
+
teamSlug: linkedProject.org.slug,
|
|
151
|
+
projectId: linkedProject.project.id,
|
|
152
|
+
projectName: linkedProject.project.name
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/commands/vcr/utils/validators.ts
|
|
157
|
+
function validateVcrJsonOutput(client, flags) {
|
|
158
|
+
const fr = validateJsonOutput(flags);
|
|
159
|
+
if (!fr.valid) {
|
|
160
|
+
outputAgentError(
|
|
161
|
+
client,
|
|
162
|
+
{
|
|
163
|
+
status: "error",
|
|
164
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
165
|
+
message: fr.error
|
|
166
|
+
},
|
|
167
|
+
1
|
|
168
|
+
);
|
|
169
|
+
output_manager_default.error(fr.error);
|
|
170
|
+
return 1;
|
|
171
|
+
}
|
|
172
|
+
return { jsonOutput: fr.jsonOutput };
|
|
173
|
+
}
|
|
174
|
+
function validateVcrChoice(client, flag, value, choices, jsonOutput) {
|
|
175
|
+
if (value === void 0 || choices.includes(value)) {
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
const message = `Invalid value for ${flag}: "${value}". Must be one of: ${choices.join(", ")}.`;
|
|
179
|
+
outputAgentError(
|
|
180
|
+
client,
|
|
181
|
+
{
|
|
182
|
+
status: "error",
|
|
183
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
184
|
+
message
|
|
185
|
+
},
|
|
186
|
+
1
|
|
187
|
+
);
|
|
188
|
+
return outputError(client, jsonOutput, "INVALID_ARGUMENTS", message);
|
|
189
|
+
}
|
|
190
|
+
function requireVcrRepository(client, repository, jsonOutput, usage) {
|
|
191
|
+
if (repository) {
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
outputAgentError(
|
|
195
|
+
client,
|
|
196
|
+
{
|
|
197
|
+
status: "error",
|
|
198
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
199
|
+
message: `Missing repository. Example: ${packageName} ${usage}`,
|
|
200
|
+
next: [
|
|
201
|
+
{
|
|
202
|
+
command: buildCommandWithGlobalFlags(client.argv, "vcr ls"),
|
|
203
|
+
when: "List repositories to pick a name or id"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
1
|
|
208
|
+
);
|
|
209
|
+
return outputError(
|
|
210
|
+
client,
|
|
211
|
+
jsonOutput,
|
|
212
|
+
"MISSING_ARGUMENTS",
|
|
213
|
+
`Usage: \`vercel ${usage}\``
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function requireVcrRepositoryAndTag(client, repository, tag, jsonOutput, usage) {
|
|
217
|
+
if (repository && tag) {
|
|
218
|
+
return void 0;
|
|
219
|
+
}
|
|
220
|
+
outputAgentError(
|
|
221
|
+
client,
|
|
222
|
+
{
|
|
223
|
+
status: "error",
|
|
224
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
225
|
+
message: `Missing arguments. Example: ${packageName} ${usage}`,
|
|
226
|
+
next: [
|
|
227
|
+
{
|
|
228
|
+
command: buildCommandWithGlobalFlags(
|
|
229
|
+
client.argv,
|
|
230
|
+
"vcr tag ls <repository>"
|
|
231
|
+
),
|
|
232
|
+
when: "List tags to pick a tag (replace <repository>)"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
1
|
|
237
|
+
);
|
|
238
|
+
return outputError(
|
|
239
|
+
client,
|
|
240
|
+
jsonOutput,
|
|
241
|
+
"MISSING_ARGUMENTS",
|
|
242
|
+
`Usage: \`vercel ${usage}\``
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
function requireVcrRepositoryAndImageId(client, repository, imageId, jsonOutput, usage) {
|
|
246
|
+
if (repository && imageId) {
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
249
|
+
outputAgentError(
|
|
250
|
+
client,
|
|
251
|
+
{
|
|
252
|
+
status: "error",
|
|
253
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
254
|
+
message: `Missing arguments. Example: ${packageName} ${usage}`,
|
|
255
|
+
next: [
|
|
256
|
+
{
|
|
257
|
+
command: buildCommandWithGlobalFlags(
|
|
258
|
+
client.argv,
|
|
259
|
+
"vcr image ls <repository>"
|
|
260
|
+
),
|
|
261
|
+
when: "List images to pick an image id (replace <repository>)"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
1
|
|
266
|
+
);
|
|
267
|
+
return outputError(
|
|
268
|
+
client,
|
|
269
|
+
jsonOutput,
|
|
270
|
+
"MISSING_ARGUMENTS",
|
|
271
|
+
`Usage: \`vercel ${usage}\``
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// src/commands/vcr/utils/errors.ts
|
|
276
|
+
var NOT_AUTHORIZED_MESSAGE = "You do not have access to the container registry in this scope. Ensure your role can manage the project, or pass --token and --scope.";
|
|
277
|
+
var NOT_AUTHORIZED_HINT = "Confirm team scope with whoami; use --scope <team-slug> if the repository lives under another team.";
|
|
278
|
+
var genericMessage = (err) => err.serverMessage || `API error (${err.status}).`;
|
|
279
|
+
var STATUS_INFO = {
|
|
280
|
+
401: {
|
|
281
|
+
reason: "not_authorized",
|
|
282
|
+
message: () => NOT_AUTHORIZED_MESSAGE,
|
|
283
|
+
hint: NOT_AUTHORIZED_HINT,
|
|
284
|
+
suggestWhoami: true
|
|
285
|
+
},
|
|
286
|
+
403: {
|
|
287
|
+
reason: "forbidden",
|
|
288
|
+
message: () => NOT_AUTHORIZED_MESSAGE,
|
|
289
|
+
hint: NOT_AUTHORIZED_HINT,
|
|
290
|
+
suggestWhoami: true
|
|
291
|
+
},
|
|
292
|
+
404: { reason: AGENT_REASON.NOT_FOUND, message: genericMessage },
|
|
293
|
+
409: { reason: "conflict", message: genericMessage },
|
|
294
|
+
429: { reason: "rate_limited", message: genericMessage }
|
|
295
|
+
};
|
|
296
|
+
function resolveStatusInfo(err) {
|
|
297
|
+
if (STATUS_INFO[err.status]) {
|
|
298
|
+
return STATUS_INFO[err.status];
|
|
299
|
+
}
|
|
300
|
+
if (err.status >= 500) {
|
|
301
|
+
return {
|
|
302
|
+
reason: AGENT_REASON.API_ERROR,
|
|
303
|
+
message: () => `The container registry endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.`
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return { reason: AGENT_REASON.API_ERROR, message: genericMessage };
|
|
307
|
+
}
|
|
308
|
+
function handleVcrApiError(client, err, jsonOutput, opts = {}) {
|
|
309
|
+
const info = resolveStatusInfo(err);
|
|
310
|
+
const message = info.message(err);
|
|
311
|
+
const next = [];
|
|
312
|
+
if (info.suggestWhoami) {
|
|
313
|
+
next.push({
|
|
314
|
+
command: buildCommandWithGlobalFlags(client.argv, "whoami"),
|
|
315
|
+
when: "See current user and team"
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (opts.retry) {
|
|
319
|
+
next.push(opts.retry);
|
|
320
|
+
}
|
|
321
|
+
outputAgentError(
|
|
322
|
+
client,
|
|
323
|
+
{
|
|
324
|
+
status: "error",
|
|
325
|
+
reason: info.reason,
|
|
326
|
+
message,
|
|
327
|
+
...info.hint ? { hint: info.hint } : {},
|
|
328
|
+
...next.length > 0 ? { next } : {}
|
|
329
|
+
},
|
|
330
|
+
1
|
|
331
|
+
);
|
|
332
|
+
return outputError(client, jsonOutput, err.code || "API_ERROR", message);
|
|
333
|
+
}
|
|
334
|
+
function emitVcrArgParseError(client, err, recoverTemplate) {
|
|
335
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
336
|
+
const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
|
|
337
|
+
outputAgentError(
|
|
338
|
+
client,
|
|
339
|
+
{
|
|
340
|
+
status: "error",
|
|
341
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
342
|
+
message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
|
|
343
|
+
next: [
|
|
344
|
+
{
|
|
345
|
+
command: buildCommandWithGlobalFlags(client.argv, recoverTemplate),
|
|
346
|
+
when: projectFlagMissingArg ? "Re-run with a project name or id (replace placeholder)" : "See valid usage"
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
1
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export {
|
|
355
|
+
resolveVcrScope,
|
|
356
|
+
validateVcrJsonOutput,
|
|
357
|
+
validateVcrChoice,
|
|
358
|
+
requireVcrRepository,
|
|
359
|
+
requireVcrRepositoryAndTag,
|
|
360
|
+
requireVcrRepositoryAndImageId,
|
|
361
|
+
handleVcrApiError,
|
|
362
|
+
emitVcrArgParseError
|
|
363
|
+
};
|
|
@@ -240,13 +240,6 @@ var require_dist2 = __commonJS({
|
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
// src/util/get-invalid-subcommand.ts
|
|
244
|
-
function getInvalidSubcommand(config) {
|
|
245
|
-
return `Please specify a valid subcommand: ${Object.keys(config).join(
|
|
246
|
-
" | "
|
|
247
|
-
)}`;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
243
|
// src/util/input/read-standard-input.ts
|
|
251
244
|
async function readStandardInput(stdin) {
|
|
252
245
|
return new Promise((resolve) => {
|
|
@@ -290,7 +283,6 @@ function ellipsis(str, length) {
|
|
|
290
283
|
}
|
|
291
284
|
|
|
292
285
|
export {
|
|
293
|
-
getInvalidSubcommand,
|
|
294
286
|
readStandardInput,
|
|
295
287
|
getCustomEnvironments,
|
|
296
288
|
pickCustomEnvironment,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
getInvalidSubcommand
|
|
9
|
+
} from "./chunk-VGIMO3ZK.js";
|
|
10
|
+
import {
|
|
11
|
+
getSubcommand
|
|
12
|
+
} from "./chunk-YPQSDAEW.js";
|
|
13
|
+
import {
|
|
14
|
+
AGENT_REASON
|
|
15
|
+
} from "./chunk-QH7WYDEP.js";
|
|
16
|
+
import {
|
|
17
|
+
buildCommandWithGlobalFlags,
|
|
18
|
+
outputAgentError
|
|
19
|
+
} from "./chunk-IZOHLD5D.js";
|
|
20
|
+
import "./chunk-P6AK7SVK.js";
|
|
21
|
+
import "./chunk-P4QNYOFB.js";
|
|
22
|
+
import {
|
|
23
|
+
output_manager_default
|
|
24
|
+
} from "./chunk-OX7KI3LF.js";
|
|
25
|
+
import "./chunk-S7KYDPEM.js";
|
|
26
|
+
import "./chunk-TZ2YI2VH.js";
|
|
27
|
+
|
|
28
|
+
// src/commands/vcr/image/index.ts
|
|
29
|
+
var IMAGE_CONFIG = {
|
|
30
|
+
ls: ["ls", "list"],
|
|
31
|
+
inspect: ["inspect", "get"],
|
|
32
|
+
rm: ["rm", "remove", "delete"]
|
|
33
|
+
};
|
|
34
|
+
async function image(client, argv, telemetry) {
|
|
35
|
+
const { subcommand, args } = getSubcommand(argv, IMAGE_CONFIG);
|
|
36
|
+
if (subcommand == null) {
|
|
37
|
+
const message = argv.length === 0 ? getInvalidSubcommand(IMAGE_CONFIG) : `Unknown "vcr image" subcommand "${argv[0]}".`;
|
|
38
|
+
outputAgentError(
|
|
39
|
+
client,
|
|
40
|
+
{
|
|
41
|
+
status: "error",
|
|
42
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
43
|
+
message,
|
|
44
|
+
next: [
|
|
45
|
+
{
|
|
46
|
+
command: buildCommandWithGlobalFlags(
|
|
47
|
+
client.argv,
|
|
48
|
+
"vcr image --help"
|
|
49
|
+
),
|
|
50
|
+
when: "Show valid image subcommands"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
1
|
|
55
|
+
);
|
|
56
|
+
output_manager_default.error(`${message} Run \`vercel vcr image --help\`.`);
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
switch (subcommand) {
|
|
60
|
+
case "ls":
|
|
61
|
+
return (await import("./ls-ZDMXBOJF.js")).default(client, args, telemetry);
|
|
62
|
+
case "inspect":
|
|
63
|
+
return (await import("./inspect-RTJALSXC.js")).default(client, args, telemetry);
|
|
64
|
+
case "rm":
|
|
65
|
+
return (await import("./rm-ZJQ5DOAW.js")).default(client, args, telemetry);
|
|
66
|
+
default:
|
|
67
|
+
output_manager_default.error(`Unhandled image subcommand: ${subcommand}`);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
image as default
|
|
73
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
formatRelativeTime
|
|
9
|
+
} from "./chunk-I3HGCZ4E.js";
|
|
10
|
+
import {
|
|
11
|
+
repositoryPath
|
|
12
|
+
} from "./chunk-4QVAYRYH.js";
|
|
13
|
+
import {
|
|
14
|
+
emitVcrArgParseError,
|
|
15
|
+
handleVcrApiError,
|
|
16
|
+
requireVcrRepository,
|
|
17
|
+
resolveVcrScope,
|
|
18
|
+
validateVcrJsonOutput
|
|
19
|
+
} from "./chunk-ZVDYGXRA.js";
|
|
20
|
+
import "./chunk-E2ENQE2W.js";
|
|
21
|
+
import "./chunk-XPKWKPWA.js";
|
|
22
|
+
import {
|
|
23
|
+
inspectSubcommand
|
|
24
|
+
} from "./chunk-KXGWAWRV.js";
|
|
25
|
+
import "./chunk-RY3AVR6E.js";
|
|
26
|
+
import "./chunk-AUECDTMX.js";
|
|
27
|
+
import "./chunk-QH7WYDEP.js";
|
|
28
|
+
import "./chunk-P726GMBL.js";
|
|
29
|
+
import "./chunk-RB7WQKNC.js";
|
|
30
|
+
import "./chunk-IZOHLD5D.js";
|
|
31
|
+
import "./chunk-ECCWJHC6.js";
|
|
32
|
+
import {
|
|
33
|
+
getFlagsSpecification,
|
|
34
|
+
parseArguments,
|
|
35
|
+
printError
|
|
36
|
+
} from "./chunk-EJ6GQI6F.js";
|
|
37
|
+
import {
|
|
38
|
+
isAPIError
|
|
39
|
+
} from "./chunk-P6AK7SVK.js";
|
|
40
|
+
import "./chunk-P4QNYOFB.js";
|
|
41
|
+
import "./chunk-2RVK3DDN.js";
|
|
42
|
+
import {
|
|
43
|
+
output_manager_default
|
|
44
|
+
} from "./chunk-OX7KI3LF.js";
|
|
45
|
+
import "./chunk-GGP5R3FU.js";
|
|
46
|
+
import {
|
|
47
|
+
require_source
|
|
48
|
+
} from "./chunk-S7KYDPEM.js";
|
|
49
|
+
import {
|
|
50
|
+
__toESM
|
|
51
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
52
|
+
|
|
53
|
+
// src/commands/vcr/inspect.ts
|
|
54
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
55
|
+
function printRepository(repository) {
|
|
56
|
+
output_manager_default.print("\n");
|
|
57
|
+
output_manager_default.print(` ${import_chalk.default.cyan("Name")} ${repository.name}
|
|
58
|
+
`);
|
|
59
|
+
output_manager_default.print(` ${import_chalk.default.cyan("ID")} ${repository.id}
|
|
60
|
+
`);
|
|
61
|
+
output_manager_default.print(` ${import_chalk.default.cyan("Project ID")} ${repository.projectId}
|
|
62
|
+
`);
|
|
63
|
+
output_manager_default.print(
|
|
64
|
+
` ${import_chalk.default.cyan("Created")} ${formatRelativeTime(repository.createdAt)}
|
|
65
|
+
`
|
|
66
|
+
);
|
|
67
|
+
output_manager_default.print(
|
|
68
|
+
` ${import_chalk.default.cyan("Updated")} ${formatRelativeTime(repository.updatedAt)}
|
|
69
|
+
`
|
|
70
|
+
);
|
|
71
|
+
output_manager_default.print("\n");
|
|
72
|
+
}
|
|
73
|
+
async function inspect(client, argv, telemetry) {
|
|
74
|
+
let parsedArgs;
|
|
75
|
+
try {
|
|
76
|
+
parsedArgs = parseArguments(
|
|
77
|
+
argv,
|
|
78
|
+
getFlagsSpecification(inspectSubcommand.options)
|
|
79
|
+
);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
emitVcrArgParseError(
|
|
82
|
+
client,
|
|
83
|
+
err,
|
|
84
|
+
"vcr inspect <repository> --project <name-or-id>"
|
|
85
|
+
);
|
|
86
|
+
printError(err);
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
const fr = validateVcrJsonOutput(client, parsedArgs.flags);
|
|
90
|
+
if (typeof fr === "number") {
|
|
91
|
+
return fr;
|
|
92
|
+
}
|
|
93
|
+
const repository = parsedArgs.args[0];
|
|
94
|
+
const project = parsedArgs.flags["--project"];
|
|
95
|
+
telemetry.trackCliOptionProject(project);
|
|
96
|
+
telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
|
|
97
|
+
const missingRepository = requireVcrRepository(
|
|
98
|
+
client,
|
|
99
|
+
repository,
|
|
100
|
+
fr.jsonOutput,
|
|
101
|
+
"vcr inspect <repository>"
|
|
102
|
+
);
|
|
103
|
+
if (typeof missingRepository === "number") {
|
|
104
|
+
return missingRepository;
|
|
105
|
+
}
|
|
106
|
+
const scope = await resolveVcrScope(client, {
|
|
107
|
+
project,
|
|
108
|
+
jsonOutput: fr.jsonOutput
|
|
109
|
+
});
|
|
110
|
+
if (typeof scope === "number") {
|
|
111
|
+
return scope;
|
|
112
|
+
}
|
|
113
|
+
const path = repositoryPath(scope, repository);
|
|
114
|
+
output_manager_default.spinner("Fetching repository...");
|
|
115
|
+
try {
|
|
116
|
+
const result = await client.fetch(path);
|
|
117
|
+
if (fr.jsonOutput) {
|
|
118
|
+
client.stdout.write(`${JSON.stringify(result.repository, null, 2)}
|
|
119
|
+
`);
|
|
120
|
+
} else {
|
|
121
|
+
output_manager_default.log(`${import_chalk.default.bold("Repository")} ${import_chalk.default.cyan(repository)}`);
|
|
122
|
+
printRepository(result.repository);
|
|
123
|
+
}
|
|
124
|
+
return 0;
|
|
125
|
+
} catch (err) {
|
|
126
|
+
if (isAPIError(err)) {
|
|
127
|
+
return handleVcrApiError(client, err, fr.jsonOutput);
|
|
128
|
+
}
|
|
129
|
+
throw err;
|
|
130
|
+
} finally {
|
|
131
|
+
output_manager_default.stopSpinner();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
inspect as default
|
|
136
|
+
};
|