vercel 51.2.0 → 51.3.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-3MIOUOZC.js +180 -0
- package/dist/chunks/{chunk-K4IC7LFB.js → chunk-2JQVASXJ.js} +13 -8
- package/dist/chunks/{chunk-Q6BEDVOU.js → chunk-4PQA6H63.js} +1 -1
- package/dist/chunks/{chunk-IS2HEMF4.js → chunk-4RBF6ZDU.js} +4 -2
- package/dist/chunks/{chunk-V23RAVWV.js → chunk-4VP55L4V.js} +211 -504
- package/dist/chunks/{chunk-TBW2XDGN.js → chunk-4WRHMYCG.js} +6 -6
- package/dist/chunks/chunk-4ZWTYJSP.js +139 -0
- package/dist/chunks/{chunk-7IDNCLTM.js → chunk-APGVHLAW.js} +2 -2
- package/dist/chunks/{chunk-UZIEJEMY.js → chunk-BAUYQ7AR.js} +1 -1
- package/dist/chunks/{chunk-BUBUVE23.js → chunk-BJQTGP42.js} +4 -2
- package/dist/chunks/{chunk-WOFF2NEI.js → chunk-BU3JMDDH.js} +3 -3
- package/dist/chunks/chunk-CGTXAXZ4.js +484 -0
- package/dist/chunks/{chunk-BQUQ5F7R.js → chunk-CRZM5WM2.js} +4 -2
- package/dist/chunks/{chunk-RQTDTSAX.js → chunk-CZXW3DJH.js} +2 -2
- package/dist/chunks/chunk-DVQ4SIWF.js +183 -0
- package/dist/chunks/{chunk-TWZWQGBN.js → chunk-E3NE4SKN.js} +3 -0
- package/dist/chunks/{chunk-A4NVECX5.js → chunk-ECRBC4HL.js} +4 -581
- package/dist/chunks/{chunk-65IHMJX4.js → chunk-FNFZO3WQ.js} +7 -5
- package/dist/chunks/{chunk-L2BKVTHL.js → chunk-G6RXZLQ2.js} +2 -2
- package/dist/chunks/{chunk-4YZKA4FN.js → chunk-GE6G37P4.js} +1 -1
- package/dist/chunks/{chunk-NELCIT4M.js → chunk-GLDQ23LD.js} +1 -1
- package/dist/chunks/{chunk-D7SZ3DXR.js → chunk-GYBFQLYR.js} +6 -4
- package/dist/chunks/{chunk-ZL5SYUAG.js → chunk-JEON5XEH.js} +44 -13
- package/dist/chunks/{chunk-Y5YCSB6X.js → chunk-LDXYSGPZ.js} +2 -2
- package/dist/chunks/{chunk-U5J73OA3.js → chunk-N45K6NXC.js} +1 -1
- package/dist/chunks/{chunk-YKKQGGLZ.js → chunk-NCQBQGI6.js} +2 -2
- package/dist/chunks/chunk-NE34PEHL.js +167 -0
- package/dist/chunks/{chunk-A5XRYFVO.js → chunk-OFUQPP26.js} +10 -6
- package/dist/chunks/{chunk-NYO5XRBQ.js → chunk-R2BVH5SQ.js} +1 -1
- package/dist/chunks/chunk-RFMC2QXQ.js +602 -0
- package/dist/chunks/{chunk-XHMU7WUB.js → chunk-RHXEHBO3.js} +8 -6
- package/dist/chunks/{chunk-5CRSHCRD.js → chunk-RRYVGOVK.js} +1 -1
- package/dist/chunks/{chunk-3PEFANXY.js → chunk-T7CL42FK.js} +5 -5
- package/dist/chunks/{chunk-WXNT7WJO.js → chunk-TAOVG4PS.js} +49 -4
- package/dist/chunks/{chunk-6DIXPIXB.js → chunk-UB325PS7.js} +1 -1
- package/dist/chunks/{chunk-2IAZZEVQ.js → chunk-UWKTUK3W.js} +4 -2
- package/dist/chunks/{chunk-VE7MY76H.js → chunk-VGWGLBUC.js} +4 -2
- package/dist/chunks/{chunk-F2ROYUW2.js → chunk-VMTOBGCO.js} +425 -28
- package/dist/chunks/{chunk-XMVSCINT.js → chunk-ZS5VKEZL.js} +5 -3
- package/dist/chunks/{compile-vercel-config-6FEECIZK.js → compile-vercel-config-A2SLMCWK.js} +4 -2
- package/dist/chunks/{delete-J2N2QXMP.js → delete-SEQBCYWT.js} +8 -6
- package/dist/chunks/{disable-QGYXQKAM.js → disable-GRM5DJGU.js} +8 -6
- package/dist/chunks/{discard-ZDGJB5US.js → discard-IVQWWSPI.js} +8 -6
- package/dist/chunks/{edit-RJWDA5KJ.js → edit-YTMZBT4Y.js} +9 -7
- package/dist/chunks/{enable-L33HPTXB.js → enable-SSU3MG6J.js} +8 -6
- package/dist/chunks/{export-Z5C4BJ2U.js → export-INCDZTYW.js} +8 -6
- package/dist/chunks/inspect-QMY2ZE6J.js +353 -0
- package/dist/chunks/{list-HXN64DKX.js → list-FF4VGSZ2.js} +115 -85
- package/dist/chunks/{list-4P2TW77C.js → list-MMIBPSB3.js} +10 -7
- package/dist/chunks/ls-TYEDISJD.js +114 -0
- package/dist/chunks/{publish-TLVHQB2H.js → publish-OJQCVDL5.js} +8 -6
- package/dist/chunks/{query-SDKQTWN2.js → query-LACPOOBL.js} +15 -12
- package/dist/chunks/{reorder-UHMUFYIW.js → reorder-TBFWHFQZ.js} +8 -6
- package/dist/chunks/{restore-762GO6HU.js → restore-5LUZRUME.js} +8 -6
- package/dist/chunks/rm-LDXY2G45.js +164 -0
- package/dist/chunks/rule-inspect-THIN6POX.js +142 -0
- package/dist/chunks/rules-4ZH7VTGC.js +83 -0
- package/dist/chunks/{schema-WBOIQRP4.js → schema-OK4OOI2N.js} +9 -7
- package/dist/chunks/{types-A4EAQ6F6.js → types-QNN5CDCB.js} +6 -4
- package/dist/chunks/update-EXPUPEH6.js +196 -0
- package/dist/commands/build/index.js +28 -24
- package/dist/commands/deploy/index.js +172 -33
- package/dist/commands/dev/index.js +21 -17
- package/dist/commands/env/index.js +32 -27
- package/dist/commands/link/index.js +21 -17
- package/dist/commands/list/index.js +14 -11
- package/dist/commands-bulk.js +4566 -1816
- package/dist/index.js +38 -24
- package/dist/version.mjs +1 -1
- package/package.json +18 -18
|
@@ -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
|
+
resolveAlertsScope
|
|
9
|
+
} from "./chunk-NE34PEHL.js";
|
|
7
10
|
import {
|
|
8
11
|
handleValidationError,
|
|
9
12
|
normalizeRepeatableStringFilters,
|
|
@@ -13,33 +16,38 @@ import {
|
|
|
13
16
|
validateTimeBound,
|
|
14
17
|
validateTimeOrder
|
|
15
18
|
} from "./chunk-HTOH3MSD.js";
|
|
16
|
-
import
|
|
17
|
-
getScope
|
|
18
|
-
} from "./chunk-7IDNCLTM.js";
|
|
19
|
+
import "./chunk-APGVHLAW.js";
|
|
19
20
|
import {
|
|
20
21
|
validateJsonOutput
|
|
21
22
|
} from "./chunk-XPKWKPWA.js";
|
|
22
23
|
import {
|
|
23
24
|
alertsCommand
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TAOVG4PS.js";
|
|
26
|
+
import "./chunk-DVQ4SIWF.js";
|
|
25
27
|
import {
|
|
26
|
-
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
AGENT_REASON
|
|
29
|
+
} from "./chunk-E3NE4SKN.js";
|
|
28
30
|
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
table
|
|
32
|
+
} from "./chunk-GE6G37P4.js";
|
|
33
|
+
import "./chunk-4VP55L4V.js";
|
|
32
34
|
import "./chunk-U3WLEFHU.js";
|
|
35
|
+
import {
|
|
36
|
+
buildCommandWithGlobalFlags,
|
|
37
|
+
outputAgentError,
|
|
38
|
+
shouldEmitNonInteractiveCommandError
|
|
39
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
33
40
|
import {
|
|
34
41
|
require_ms
|
|
35
42
|
} from "./chunk-CO5D46AG.js";
|
|
36
43
|
import {
|
|
37
|
-
ProjectNotFound,
|
|
38
44
|
getFlagsSpecification,
|
|
39
|
-
isAPIError,
|
|
40
45
|
parseArguments,
|
|
41
46
|
printError
|
|
42
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
48
|
+
import {
|
|
49
|
+
isAPIError
|
|
50
|
+
} from "./chunk-ECRBC4HL.js";
|
|
43
51
|
import {
|
|
44
52
|
output_manager_default
|
|
45
53
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -55,6 +63,29 @@ var import_ms = __toESM(require_ms(), 1);
|
|
|
55
63
|
var import_chalk = __toESM(require_source(), 1);
|
|
56
64
|
function handleApiError(err, jsonOutput, client) {
|
|
57
65
|
const message = err.status === 401 || err.status === 403 ? "You do not have access to alerts in this scope. Pass --token <TOKEN> and --scope <team-slug> with Alerts read access." : err.status >= 500 ? `The alerts endpoint failed on the server (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.` : err.serverMessage || `API error (${err.status}).`;
|
|
66
|
+
const reason = err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : err.status === 404 ? AGENT_REASON.NOT_FOUND : err.status === 429 ? "rate_limited" : AGENT_REASON.API_ERROR;
|
|
67
|
+
outputAgentError(
|
|
68
|
+
client,
|
|
69
|
+
{
|
|
70
|
+
status: "error",
|
|
71
|
+
reason,
|
|
72
|
+
message,
|
|
73
|
+
...err.status === 401 || err.status === 403 ? {
|
|
74
|
+
hint: "Confirm team scope; use --scope <team-slug> if alerts belong to another team.",
|
|
75
|
+
next: [
|
|
76
|
+
{
|
|
77
|
+
command: buildCommandWithGlobalFlags(client.argv, "whoami"),
|
|
78
|
+
when: "See current user and team"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
command: buildCommandWithGlobalFlags(client.argv, "alerts"),
|
|
82
|
+
when: "Retry listing alerts after fixing scope or permissions"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
} : {}
|
|
86
|
+
},
|
|
87
|
+
1
|
|
88
|
+
);
|
|
58
89
|
return outputError(client, jsonOutput, err.code || "API_ERROR", message);
|
|
59
90
|
}
|
|
60
91
|
function getDefaultRange() {
|
|
@@ -62,70 +93,6 @@ function getDefaultRange() {
|
|
|
62
93
|
const from = new Date(to.getTime() - 24 * 60 * 60 * 1e3);
|
|
63
94
|
return { from: from.toISOString(), to: to.toISOString() };
|
|
64
95
|
}
|
|
65
|
-
async function resolveScope(client, opts) {
|
|
66
|
-
if (opts.all || opts.project) {
|
|
67
|
-
const { team } = await getScope(client);
|
|
68
|
-
if (!team) {
|
|
69
|
-
return outputError(
|
|
70
|
-
client,
|
|
71
|
-
opts.jsonOutput,
|
|
72
|
-
"NO_TEAM",
|
|
73
|
-
"No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory."
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
if (opts.all) {
|
|
77
|
-
return {
|
|
78
|
-
teamId: team.id
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
let projectResult;
|
|
82
|
-
try {
|
|
83
|
-
projectResult = await getProjectByNameOrId(
|
|
84
|
-
client,
|
|
85
|
-
opts.project,
|
|
86
|
-
team.id
|
|
87
|
-
);
|
|
88
|
-
} catch (err) {
|
|
89
|
-
if (isAPIError(err)) {
|
|
90
|
-
return outputError(
|
|
91
|
-
client,
|
|
92
|
-
opts.jsonOutput,
|
|
93
|
-
err.code || "API_ERROR",
|
|
94
|
-
err.serverMessage || (err.status === 403 ? `You do not have permission to access project "${opts.project}" in team "${team.slug}".` : `API error (${err.status}).`)
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
throw err;
|
|
98
|
-
}
|
|
99
|
-
if (projectResult instanceof ProjectNotFound) {
|
|
100
|
-
return outputError(
|
|
101
|
-
client,
|
|
102
|
-
opts.jsonOutput,
|
|
103
|
-
"PROJECT_NOT_FOUND",
|
|
104
|
-
`Project "${opts.project}" was not found in team "${team.slug}".`
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
teamId: team.id,
|
|
109
|
-
projectId: projectResult.id
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
const linkedProject = await getLinkedProject(client);
|
|
113
|
-
if (linkedProject.status === "error") {
|
|
114
|
-
return linkedProject.exitCode;
|
|
115
|
-
}
|
|
116
|
-
if (linkedProject.status === "not_linked") {
|
|
117
|
-
return outputError(
|
|
118
|
-
client,
|
|
119
|
-
opts.jsonOutput,
|
|
120
|
-
"NOT_LINKED",
|
|
121
|
-
"No linked project found. Run `vercel link` to link a project, or use --project <name> or --all."
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
teamId: linkedProject.org.id,
|
|
126
|
-
projectId: linkedProject.project.id
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
96
|
function getGroupTitle(group) {
|
|
130
97
|
return group.ai?.title || "Alert group";
|
|
131
98
|
}
|
|
@@ -191,18 +158,44 @@ function getResolvedAt(group) {
|
|
|
191
158
|
function getAlertsCount(group) {
|
|
192
159
|
return String(group.alerts?.length ?? 0);
|
|
193
160
|
}
|
|
161
|
+
function validationFailureForAgents(client, result, jsonOutput) {
|
|
162
|
+
if (shouldEmitNonInteractiveCommandError(client)) {
|
|
163
|
+
outputAgentError(
|
|
164
|
+
client,
|
|
165
|
+
{
|
|
166
|
+
status: "error",
|
|
167
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
168
|
+
message: result.message,
|
|
169
|
+
next: [
|
|
170
|
+
{
|
|
171
|
+
command: buildCommandWithGlobalFlags(client.argv, "alerts --help"),
|
|
172
|
+
when: "See valid `alerts` list flags and examples"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
1
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
return handleValidationError(result, jsonOutput, client);
|
|
180
|
+
}
|
|
194
181
|
function printGroups(groups) {
|
|
195
182
|
if (groups.length === 0) {
|
|
196
183
|
output_manager_default.log("No alerts found.");
|
|
197
184
|
return;
|
|
198
185
|
}
|
|
199
|
-
const headers = [
|
|
200
|
-
|
|
201
|
-
|
|
186
|
+
const headers = [
|
|
187
|
+
"Title",
|
|
188
|
+
"Group id",
|
|
189
|
+
"Started At",
|
|
190
|
+
"Type",
|
|
191
|
+
"Status",
|
|
192
|
+
"Alerts"
|
|
193
|
+
].map((h) => import_chalk.default.cyan(h));
|
|
202
194
|
const rows = [
|
|
203
195
|
headers,
|
|
204
196
|
...groups.map((group) => [
|
|
205
197
|
import_chalk.default.bold(getGroupTitle(group)),
|
|
198
|
+
import_chalk.default.dim(group.id || "-"),
|
|
206
199
|
getStartedAt(group),
|
|
207
200
|
group.type || "-",
|
|
208
201
|
getStatus(group),
|
|
@@ -252,6 +245,43 @@ function parseFlags(client) {
|
|
|
252
245
|
const parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
253
246
|
return parsedArgs.flags;
|
|
254
247
|
} catch (err) {
|
|
248
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
249
|
+
const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
|
|
250
|
+
if (shouldEmitNonInteractiveCommandError(client)) {
|
|
251
|
+
outputAgentError(
|
|
252
|
+
client,
|
|
253
|
+
{
|
|
254
|
+
status: "error",
|
|
255
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
256
|
+
message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
|
|
257
|
+
next: projectFlagMissingArg ? [
|
|
258
|
+
{
|
|
259
|
+
command: buildCommandWithGlobalFlags(
|
|
260
|
+
client.argv,
|
|
261
|
+
"alerts --project <name-or-id>"
|
|
262
|
+
),
|
|
263
|
+
when: "Re-run with a project name or id (replace placeholder)"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
command: buildCommandWithGlobalFlags(
|
|
267
|
+
client.argv,
|
|
268
|
+
"alerts --help"
|
|
269
|
+
),
|
|
270
|
+
when: "See all `alerts` flags and examples"
|
|
271
|
+
}
|
|
272
|
+
] : [
|
|
273
|
+
{
|
|
274
|
+
command: buildCommandWithGlobalFlags(
|
|
275
|
+
client.argv,
|
|
276
|
+
"alerts --help"
|
|
277
|
+
),
|
|
278
|
+
when: "See valid flags and examples"
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
1
|
|
283
|
+
);
|
|
284
|
+
}
|
|
255
285
|
printError(err);
|
|
256
286
|
return 1;
|
|
257
287
|
}
|
|
@@ -264,29 +294,29 @@ function resolveValidatedInputs(flags, client, jsonOutput) {
|
|
|
264
294
|
max: 100
|
|
265
295
|
});
|
|
266
296
|
if (!limitResult.valid) {
|
|
267
|
-
return
|
|
297
|
+
return validationFailureForAgents(client, limitResult, jsonOutput);
|
|
268
298
|
}
|
|
269
299
|
const mutualResult = validateAllProjectMutualExclusivity(
|
|
270
300
|
flags["--all"],
|
|
271
301
|
flags["--project"]
|
|
272
302
|
);
|
|
273
303
|
if (!mutualResult.valid) {
|
|
274
|
-
return
|
|
304
|
+
return validationFailureForAgents(client, mutualResult, jsonOutput);
|
|
275
305
|
}
|
|
276
306
|
const sinceResult = validateTimeBound(flags["--since"]);
|
|
277
307
|
if (!sinceResult.valid) {
|
|
278
|
-
return
|
|
308
|
+
return validationFailureForAgents(client, sinceResult, jsonOutput);
|
|
279
309
|
}
|
|
280
310
|
const untilResult = validateTimeBound(flags["--until"]);
|
|
281
311
|
if (!untilResult.valid) {
|
|
282
|
-
return
|
|
312
|
+
return validationFailureForAgents(client, untilResult, jsonOutput);
|
|
283
313
|
}
|
|
284
314
|
const timeOrderResult = validateTimeOrder(
|
|
285
315
|
sinceResult.value,
|
|
286
316
|
untilResult.value
|
|
287
317
|
);
|
|
288
318
|
if (!timeOrderResult.valid) {
|
|
289
|
-
return
|
|
319
|
+
return validationFailureForAgents(client, timeOrderResult, jsonOutput);
|
|
290
320
|
}
|
|
291
321
|
return {
|
|
292
322
|
limit: limitResult.value,
|
|
@@ -338,7 +368,7 @@ async function list(client, telemetry) {
|
|
|
338
368
|
if (typeof validatedInputs === "number") {
|
|
339
369
|
return validatedInputs;
|
|
340
370
|
}
|
|
341
|
-
const scope = await
|
|
371
|
+
const scope = await resolveAlertsScope(client, {
|
|
342
372
|
project: flags["--project"],
|
|
343
373
|
all: flags["--all"],
|
|
344
374
|
jsonOutput
|
|
@@ -18,27 +18,30 @@ import {
|
|
|
18
18
|
} from "./chunk-EOZFDJSY.js";
|
|
19
19
|
import {
|
|
20
20
|
getScope
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-APGVHLAW.js";
|
|
22
22
|
import {
|
|
23
23
|
validateJsonOutput
|
|
24
24
|
} from "./chunk-XPKWKPWA.js";
|
|
25
25
|
import {
|
|
26
26
|
activityCommand
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-UWKTUK3W.js";
|
|
28
28
|
import {
|
|
29
29
|
getLinkedProject,
|
|
30
30
|
getProjectByNameOrId
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-4VP55L4V.js";
|
|
32
32
|
import "./chunk-U3WLEFHU.js";
|
|
33
|
+
import "./chunk-CGTXAXZ4.js";
|
|
33
34
|
import "./chunk-CO5D46AG.js";
|
|
34
35
|
import {
|
|
35
|
-
ProjectNotFound,
|
|
36
|
-
getCommandName,
|
|
37
36
|
getFlagsSpecification,
|
|
38
|
-
isAPIError,
|
|
39
37
|
parseArguments,
|
|
40
38
|
printError
|
|
41
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
40
|
+
import {
|
|
41
|
+
ProjectNotFound,
|
|
42
|
+
getCommandName,
|
|
43
|
+
isAPIError
|
|
44
|
+
} from "./chunk-ECRBC4HL.js";
|
|
42
45
|
import {
|
|
43
46
|
output_manager_default
|
|
44
47
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
emitRulesArgParseError,
|
|
9
|
+
handleRulesApiError,
|
|
10
|
+
parseRulesFlagsAndScope,
|
|
11
|
+
rulesCollectionPath
|
|
12
|
+
} from "./chunk-4ZWTYJSP.js";
|
|
13
|
+
import "./chunk-NE34PEHL.js";
|
|
14
|
+
import "./chunk-HTOH3MSD.js";
|
|
15
|
+
import "./chunk-APGVHLAW.js";
|
|
16
|
+
import {
|
|
17
|
+
validateJsonOutput
|
|
18
|
+
} from "./chunk-XPKWKPWA.js";
|
|
19
|
+
import {
|
|
20
|
+
rulesLsSubcommand
|
|
21
|
+
} from "./chunk-DVQ4SIWF.js";
|
|
22
|
+
import {
|
|
23
|
+
AGENT_REASON
|
|
24
|
+
} from "./chunk-E3NE4SKN.js";
|
|
25
|
+
import "./chunk-4VP55L4V.js";
|
|
26
|
+
import "./chunk-U3WLEFHU.js";
|
|
27
|
+
import {
|
|
28
|
+
outputAgentError
|
|
29
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
30
|
+
import "./chunk-CO5D46AG.js";
|
|
31
|
+
import {
|
|
32
|
+
getFlagsSpecification,
|
|
33
|
+
parseArguments,
|
|
34
|
+
printError
|
|
35
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
36
|
+
import {
|
|
37
|
+
isAPIError
|
|
38
|
+
} from "./chunk-ECRBC4HL.js";
|
|
39
|
+
import {
|
|
40
|
+
output_manager_default
|
|
41
|
+
} from "./chunk-ZQKJVHXY.js";
|
|
42
|
+
import "./chunk-S7KYDPEM.js";
|
|
43
|
+
import "./chunk-TZ2YI2VH.js";
|
|
44
|
+
|
|
45
|
+
// src/commands/alerts/rules/ls.ts
|
|
46
|
+
async function ls(client, argv) {
|
|
47
|
+
let parsedArgs;
|
|
48
|
+
try {
|
|
49
|
+
parsedArgs = parseArguments(
|
|
50
|
+
argv,
|
|
51
|
+
getFlagsSpecification(rulesLsSubcommand.options)
|
|
52
|
+
);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
emitRulesArgParseError(client, e, "alerts rules ls --project <name-or-id>");
|
|
55
|
+
printError(e);
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
const fr = validateJsonOutput(parsedArgs.flags);
|
|
59
|
+
if (!fr.valid) {
|
|
60
|
+
outputAgentError(
|
|
61
|
+
client,
|
|
62
|
+
{
|
|
63
|
+
status: "error",
|
|
64
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
65
|
+
message: fr.error
|
|
66
|
+
},
|
|
67
|
+
1
|
|
68
|
+
);
|
|
69
|
+
output_manager_default.error(fr.error);
|
|
70
|
+
return 1;
|
|
71
|
+
}
|
|
72
|
+
const scope = await parseRulesFlagsAndScope(
|
|
73
|
+
client,
|
|
74
|
+
{
|
|
75
|
+
"--project": parsedArgs.flags["--project"],
|
|
76
|
+
"--all": parsedArgs.flags["--all"]
|
|
77
|
+
},
|
|
78
|
+
fr.jsonOutput
|
|
79
|
+
);
|
|
80
|
+
if (typeof scope === "number") {
|
|
81
|
+
return scope;
|
|
82
|
+
}
|
|
83
|
+
const path = rulesCollectionPath(scope);
|
|
84
|
+
output_manager_default.spinner("Fetching alert rules...");
|
|
85
|
+
try {
|
|
86
|
+
const rules = await client.fetch(path);
|
|
87
|
+
if (fr.jsonOutput) {
|
|
88
|
+
client.stdout.write(`${JSON.stringify({ rules }, null, 2)}
|
|
89
|
+
`);
|
|
90
|
+
} else if (rules.length === 0) {
|
|
91
|
+
output_manager_default.log("No alert rules found for this scope.");
|
|
92
|
+
} else {
|
|
93
|
+
for (const r of rules) {
|
|
94
|
+
const id = typeof r.id === "string" ? r.id : "";
|
|
95
|
+
const name = typeof r.name === "string" ? r.name : "";
|
|
96
|
+
const pid = typeof r.projectId === "string" ? r.projectId : "";
|
|
97
|
+
output_manager_default.log(
|
|
98
|
+
`${id} ${name}${pid ? ` project: ${pid}` : " (team-wide)"}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return 0;
|
|
103
|
+
} catch (err) {
|
|
104
|
+
if (isAPIError(err)) {
|
|
105
|
+
return handleRulesApiError(client, err, fr.jsonOutput);
|
|
106
|
+
}
|
|
107
|
+
throw err;
|
|
108
|
+
} finally {
|
|
109
|
+
output_manager_default.stopSpinner();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
ls as default
|
|
114
|
+
};
|
|
@@ -17,21 +17,23 @@ import {
|
|
|
17
17
|
parseSubcommandArgs,
|
|
18
18
|
printDiffSummary,
|
|
19
19
|
withGlobalFlags
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OFUQPP26.js";
|
|
21
21
|
import {
|
|
22
22
|
publishSubcommand
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-CRZM5WM2.js";
|
|
24
|
+
import "./chunk-E3NE4SKN.js";
|
|
25
|
+
import "./chunk-4VP55L4V.js";
|
|
26
|
+
import "./chunk-U3WLEFHU.js";
|
|
25
27
|
import {
|
|
26
28
|
outputAgentError
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-U3WLEFHU.js";
|
|
29
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
29
30
|
import {
|
|
30
31
|
stamp_default
|
|
31
32
|
} from "./chunk-CO5D46AG.js";
|
|
33
|
+
import "./chunk-RFMC2QXQ.js";
|
|
32
34
|
import {
|
|
33
35
|
getCommandName
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-ECRBC4HL.js";
|
|
35
37
|
import {
|
|
36
38
|
output_manager_default
|
|
37
39
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -4,10 +4,6 @@ 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
|
-
resolveTimeRange,
|
|
9
|
-
validateAllProjectMutualExclusivity
|
|
10
|
-
} from "./chunk-HTOH3MSD.js";
|
|
11
7
|
import {
|
|
12
8
|
fetchMetricDetailOrExit,
|
|
13
9
|
formatErrorJson,
|
|
@@ -15,37 +11,44 @@ import {
|
|
|
15
11
|
getDefaultAggregation,
|
|
16
12
|
getRollupColumnName,
|
|
17
13
|
handleApiError
|
|
18
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GLDQ23LD.js";
|
|
15
|
+
import {
|
|
16
|
+
resolveTimeRange,
|
|
17
|
+
validateAllProjectMutualExclusivity
|
|
18
|
+
} from "./chunk-HTOH3MSD.js";
|
|
19
19
|
import {
|
|
20
20
|
indent_default
|
|
21
21
|
} from "./chunk-A3NYPUKZ.js";
|
|
22
22
|
import {
|
|
23
23
|
getScope
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-APGVHLAW.js";
|
|
25
25
|
import {
|
|
26
26
|
validateJsonOutput
|
|
27
27
|
} from "./chunk-XPKWKPWA.js";
|
|
28
28
|
import {
|
|
29
29
|
metricsCommand
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4RBF6ZDU.js";
|
|
31
31
|
import {
|
|
32
32
|
table
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-GE6G37P4.js";
|
|
34
34
|
import {
|
|
35
35
|
getLinkedProject,
|
|
36
36
|
getProjectByNameOrId
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4VP55L4V.js";
|
|
38
38
|
import "./chunk-U3WLEFHU.js";
|
|
39
|
+
import "./chunk-CGTXAXZ4.js";
|
|
39
40
|
import {
|
|
40
41
|
require_ms
|
|
41
42
|
} from "./chunk-CO5D46AG.js";
|
|
42
43
|
import {
|
|
43
|
-
ProjectNotFound,
|
|
44
44
|
getFlagsSpecification,
|
|
45
|
-
isAPIError,
|
|
46
45
|
parseArguments,
|
|
47
46
|
printError
|
|
48
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
48
|
+
import {
|
|
49
|
+
ProjectNotFound,
|
|
50
|
+
isAPIError
|
|
51
|
+
} from "./chunk-ECRBC4HL.js";
|
|
49
52
|
import {
|
|
50
53
|
output_manager_default
|
|
51
54
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -16,21 +16,23 @@ import {
|
|
|
16
16
|
resolveRoute,
|
|
17
17
|
shellQuoteRouteIdentifierForSuggestion,
|
|
18
18
|
withGlobalFlags
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OFUQPP26.js";
|
|
20
20
|
import {
|
|
21
21
|
reorderSubcommand
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-CRZM5WM2.js";
|
|
23
|
+
import "./chunk-E3NE4SKN.js";
|
|
24
|
+
import "./chunk-4VP55L4V.js";
|
|
25
|
+
import "./chunk-U3WLEFHU.js";
|
|
24
26
|
import {
|
|
25
27
|
outputAgentError
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-U3WLEFHU.js";
|
|
28
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
28
29
|
import {
|
|
29
30
|
stamp_default
|
|
30
31
|
} from "./chunk-CO5D46AG.js";
|
|
32
|
+
import "./chunk-RFMC2QXQ.js";
|
|
31
33
|
import {
|
|
32
34
|
getCommandName
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ECRBC4HL.js";
|
|
34
36
|
import {
|
|
35
37
|
output_manager_default
|
|
36
38
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -19,21 +19,23 @@ import {
|
|
|
19
19
|
printDiffSummary,
|
|
20
20
|
validateRequiredArgs,
|
|
21
21
|
withGlobalFlags
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OFUQPP26.js";
|
|
23
23
|
import {
|
|
24
24
|
restoreSubcommand
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-CRZM5WM2.js";
|
|
26
|
+
import "./chunk-E3NE4SKN.js";
|
|
27
|
+
import "./chunk-4VP55L4V.js";
|
|
28
|
+
import "./chunk-U3WLEFHU.js";
|
|
27
29
|
import {
|
|
28
30
|
outputAgentError
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-U3WLEFHU.js";
|
|
31
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
31
32
|
import {
|
|
32
33
|
stamp_default
|
|
33
34
|
} from "./chunk-CO5D46AG.js";
|
|
35
|
+
import "./chunk-RFMC2QXQ.js";
|
|
34
36
|
import {
|
|
35
37
|
getCommandName
|
|
36
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ECRBC4HL.js";
|
|
37
39
|
import {
|
|
38
40
|
output_manager_default
|
|
39
41
|
} from "./chunk-ZQKJVHXY.js";
|