vercel 56.4.1 → 57.0.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.
Files changed (94) hide show
  1. package/dist/chunks/{add-L3Z6PL54.js → add-7M577U56.js} +7 -6
  2. package/dist/chunks/{add-RFEJCIBM.js → add-YRZTDNXX.js} +3 -3
  3. package/dist/chunks/{chunk-V5P25P7F.js → chunk-2473DUBR.js} +4 -11
  4. package/dist/chunks/{chunk-5EXIJBLL.js → chunk-2EDWKVNP.js} +8 -8
  5. package/dist/chunks/{chunk-YS6EDZHB.js → chunk-2MJROFVC.js} +5 -1
  6. package/dist/chunks/{chunk-OOD67FAL.js → chunk-3242RXCN.js} +1 -1
  7. package/dist/chunks/chunk-3PGXYIKC.js +147 -0
  8. package/dist/chunks/{chunk-CHZBEMLF.js → chunk-4PGF367U.js} +47 -210
  9. package/dist/chunks/{chunk-GKVAAY2A.js → chunk-555WJSO5.js} +1 -1
  10. package/dist/chunks/chunk-5AJPMLDV.js +28 -0
  11. package/dist/chunks/{chunk-IHQ7DPQI.js → chunk-A2TYQBX2.js} +117 -3
  12. package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
  13. package/dist/chunks/{chunk-W346YNDN.js → chunk-DWMH5M4Q.js} +4 -1
  14. package/dist/chunks/chunk-E336ZXPP.js +43 -0
  15. package/dist/chunks/chunk-F5PQWDOC.js +245 -0
  16. package/dist/chunks/{chunk-Y7TVKRRJ.js → chunk-F7X55TOY.js} +15 -839
  17. package/dist/chunks/chunk-FGDKMNEN.js +21 -0
  18. package/dist/chunks/chunk-FHEMFAHB.js +320 -0
  19. package/dist/chunks/{chunk-NLRIKNPX.js → chunk-GP5VCTEU.js} +1 -1
  20. package/dist/chunks/chunk-GZLPFESR.js +48 -0
  21. package/dist/chunks/{chunk-HZKJMZEQ.js → chunk-HD7B425F.js} +2 -2
  22. package/dist/chunks/{chunk-J6KTUJHV.js → chunk-IOAZNR6Z.js} +1 -1
  23. package/dist/chunks/{chunk-STJJ3DFO.js → chunk-KCF6S3XF.js} +16 -1
  24. package/dist/chunks/chunk-LMHT3QR3.js +247 -0
  25. package/dist/chunks/{chunk-A4XB42AB.js → chunk-MAHINYBW.js} +4 -3
  26. package/dist/chunks/{chunk-DXFSBJTA.js → chunk-MIFDRYTN.js} +1 -1
  27. package/dist/chunks/{chunk-VLTQJKP6.js → chunk-NH43BFJ3.js} +1 -1
  28. package/dist/chunks/{chunk-Z7NPYIZ6.js → chunk-NM43FFV6.js} +0 -8
  29. package/dist/chunks/{chunk-MQRHJEBS.js → chunk-NRNMT43R.js} +3 -3
  30. package/dist/chunks/chunk-OF2GNB42.js +53 -0
  31. package/dist/chunks/chunk-PRWJUY5U.js +848 -0
  32. package/dist/chunks/{chunk-F5OMERHI.js → chunk-QZD5DKUR.js} +10 -23
  33. package/dist/chunks/{chunk-4M3ZQCYN.js → chunk-RAFH25WW.js} +8 -1
  34. package/dist/chunks/{chunk-43B3LNUF.js → chunk-RYO6FJFB.js} +1 -1
  35. package/dist/chunks/{chunk-XFGY3JAX.js → chunk-T4NODP6Y.js} +11 -18
  36. package/dist/chunks/{chunk-GLAHGVBS.js → chunk-TBR2Q37Y.js} +2038 -1786
  37. package/dist/chunks/chunk-V4RMJKQP.js +36 -0
  38. package/dist/chunks/chunk-WR7JTCGL.js +104 -0
  39. package/dist/chunks/{chunk-6RTK6BWX.js → chunk-YA3WQFLY.js} +1 -1
  40. package/dist/chunks/{chunk-UHGAPG7O.js → chunk-YOZCJHLZ.js} +4 -4
  41. package/dist/chunks/{compile-vercel-config-J2X5OV6K.js → compile-vercel-config-3OHO3TJA.js} +2 -2
  42. package/dist/chunks/config-validator.mjs +1 -0
  43. package/dist/chunks/delete-3DZOCWCC.js +150 -0
  44. package/dist/chunks/{delete-57A44RN7.js → delete-VOSJLNEA.js} +3 -3
  45. package/dist/chunks/{disable-DNZ52MEO.js → disable-LQDEVRQF.js} +3 -3
  46. package/dist/chunks/{discard-HACSIZ74.js → discard-RGV4JKXQ.js} +3 -3
  47. package/dist/chunks/{edit-HJ47TQU3.js → edit-SFIEOQ24.js} +4 -4
  48. package/dist/chunks/edit-UPZPI54L.js +153 -0
  49. package/dist/chunks/{enable-BVLRVRYM.js → enable-6UVH35WC.js} +3 -3
  50. package/dist/chunks/{export-7MJFGMG7.js → export-6CEG3CK7.js} +3 -3
  51. package/dist/chunks/{image-4UMD7UZP.js → image-CQRCD2OE.js} +3 -3
  52. package/dist/chunks/inspect-4ZAH3RFT.js +205 -0
  53. package/dist/chunks/inspect-EXQBIAFF.js +587 -0
  54. package/dist/chunks/{inspect-WBHUZC3R.js → inspect-K5ZMQG7X.js} +3 -3
  55. package/dist/chunks/{inspect-4JD2QN67.js → inspect-UM3LDRPV.js} +3 -3
  56. package/dist/chunks/{inspect-XX3OXSHC.js → inspect-ZFRY3X3H.js} +3 -3
  57. package/dist/chunks/{list-AM6K2JCW.js → list-4DRVM7Q4.js} +42 -55
  58. package/dist/chunks/{list-5H57NTM4.js → list-FJCBOCCA.js} +2 -2
  59. package/dist/chunks/list-KCUHD4OA.js +360 -0
  60. package/dist/chunks/{login-YO34E4V5.js → login-DFGYNU3K.js} +3 -3
  61. package/dist/chunks/{ls-44NPIO2N.js → ls-34NCZKBE.js} +3 -3
  62. package/dist/chunks/{ls-P7ZLBWW2.js → ls-4QHHVXXD.js} +3 -3
  63. package/dist/chunks/{ls-YDUYTLXW.js → ls-CG6A7UXF.js} +3 -3
  64. package/dist/chunks/ls-RHEQ6YQB.js +188 -0
  65. package/dist/chunks/open-E3XADEMX.js +106 -0
  66. package/dist/chunks/{publish-RXFUYSW3.js → publish-Z3AQRUCS.js} +3 -3
  67. package/dist/chunks/{query-ILJJL3BZ.js → query-3EV66DO3.js} +9 -9
  68. package/dist/chunks/{reorder-GBCOPZT4.js → reorder-VA5E5ZJT.js} +3 -3
  69. package/dist/chunks/reply-SNSCNKAW.js +167 -0
  70. package/dist/chunks/resolve-6ZX4RTXX.js +228 -0
  71. package/dist/chunks/{restore-YK5DGGRX.js → restore-NEHI5B5P.js} +3 -3
  72. package/dist/chunks/{rm-O474MI5C.js → rm-22B22E47.js} +3 -3
  73. package/dist/chunks/{rm-LK6P7XTA.js → rm-E5ZVLAKO.js} +3 -3
  74. package/dist/chunks/{rm-FRZMXB2W.js → rm-FR6KE744.js} +7 -6
  75. package/dist/chunks/rule-inspect-DMP2CKJQ.js +283 -0
  76. package/dist/chunks/{rules-MZ2MP6KJ.js → rules-EYGXEI2Z.js} +7 -7
  77. package/dist/chunks/{schema-FR6CCQIZ.js → schema-2IIWOBSQ.js} +7 -5
  78. package/dist/chunks/{tags-AKRTKFRV.js → tags-ZDVYRHAY.js} +2 -2
  79. package/dist/chunks/{update-W3CWQB2F.js → update-QH4DQMZV.js} +7 -6
  80. package/dist/commands/build/index.js +45 -13
  81. package/dist/commands/deploy/index.js +38 -27
  82. package/dist/commands/dev/index.js +13 -16
  83. package/dist/commands/env/index.js +13 -11
  84. package/dist/commands/link/index.js +10 -9
  85. package/dist/commands/list/index.js +5 -5
  86. package/dist/commands-bulk.js +2981 -2179
  87. package/dist/index.js +31 -21
  88. package/dist/vc.js +54 -18
  89. package/dist/version.mjs +1 -1
  90. package/package.json +35 -35
  91. package/dist/chunks/chunk-F32B76CK.js +0 -86
  92. package/dist/chunks/inspect-5YZP7IWI.js +0 -351
  93. package/dist/chunks/ls-MB74DIQV.js +0 -113
  94. package/dist/chunks/rule-inspect-YEZGYINZ.js +0 -141
@@ -0,0 +1,228 @@
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
+ parseThreadArg
9
+ } from "./chunk-E336ZXPP.js";
10
+ import {
11
+ addMessage,
12
+ handleCommentsParseError,
13
+ resolveCommentsScope,
14
+ threadNotFoundMessage,
15
+ toApiErrorParts,
16
+ updateThread
17
+ } from "./chunk-LMHT3QR3.js";
18
+ import {
19
+ canPrompt
20
+ } from "./chunk-2473DUBR.js";
21
+ import {
22
+ outputError
23
+ } from "./chunk-BUZRVER7.js";
24
+ import {
25
+ validateJsonOutput
26
+ } from "./chunk-XPKWKPWA.js";
27
+ import {
28
+ reopenSubcommand,
29
+ resolveSubcommand
30
+ } from "./chunk-FHEMFAHB.js";
31
+ import "./chunk-TBR2Q37Y.js";
32
+ import "./chunk-ECCWJHC6.js";
33
+ import "./chunk-UDWRZXIT.js";
34
+ import {
35
+ parseArguments
36
+ } from "./chunk-SZXT3PDQ.js";
37
+ import {
38
+ getFlagsSpecification,
39
+ isAPIError
40
+ } from "./chunk-KSSNLCL4.js";
41
+ import "./chunk-P4QNYOFB.js";
42
+ import "./chunk-52QYYTM5.js";
43
+ import {
44
+ output_manager_default
45
+ } from "./chunk-OX7KI3LF.js";
46
+ import "./chunk-GGP5R3FU.js";
47
+ import {
48
+ require_source
49
+ } from "./chunk-S7KYDPEM.js";
50
+ import {
51
+ __toESM
52
+ } from "./chunk-TZ2YI2VH.js";
53
+
54
+ // src/commands/comments/resolve.ts
55
+ var import_chalk = __toESM(require_source(), 1);
56
+ async function resolveThreads(client, telemetry, resolved) {
57
+ const subcommand = resolved ? resolveSubcommand : reopenSubcommand;
58
+ const verb = resolved ? "resolve" : "reopen";
59
+ const pastVerb = resolved ? "resolved" : "reopened";
60
+ let parsedArgs;
61
+ const flagsSpecification = getFlagsSpecification(subcommand.options);
62
+ try {
63
+ parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
64
+ } catch (err) {
65
+ return handleCommentsParseError(err, subcommand.name);
66
+ }
67
+ const formatResult = validateJsonOutput(parsedArgs.flags);
68
+ if (!formatResult.valid) {
69
+ output_manager_default.error(formatResult.error);
70
+ return 1;
71
+ }
72
+ const jsonOutput = formatResult.jsonOutput;
73
+ const closingMessage = resolved ? parsedArgs.flags["--message"] : void 0;
74
+ const yes = Boolean(parsedArgs.flags["--yes"]);
75
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
76
+ telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]);
77
+ if (resolved) {
78
+ telemetry.trackCliOptionMessage(closingMessage);
79
+ }
80
+ const threadInputs = parsedArgs.args.slice(2);
81
+ telemetry.trackCliArgumentThread(threadInputs[0]);
82
+ if (threadInputs.length === 0) {
83
+ return outputError(
84
+ client,
85
+ jsonOutput,
86
+ "MISSING_THREAD",
87
+ `Pass at least one thread ID or URL: \`vercel comments ${verb} <thread>\`.`
88
+ );
89
+ }
90
+ const threadIds = [];
91
+ let urlTeamSlug;
92
+ for (const input of threadInputs) {
93
+ const ref = parseThreadArg(input);
94
+ if (!ref) {
95
+ return outputError(
96
+ client,
97
+ jsonOutput,
98
+ "INVALID_THREAD",
99
+ `Could not extract a thread ID from "${input}".`
100
+ );
101
+ }
102
+ if (ref.teamSlug) {
103
+ if (urlTeamSlug && urlTeamSlug !== ref.teamSlug) {
104
+ return outputError(
105
+ client,
106
+ jsonOutput,
107
+ "MIXED_TEAMS",
108
+ `The URLs belong to different teams (${urlTeamSlug}, ${ref.teamSlug}). Run once per team.`
109
+ );
110
+ }
111
+ urlTeamSlug = ref.teamSlug;
112
+ }
113
+ threadIds.push(ref.id);
114
+ }
115
+ if (closingMessage !== void 0 && threadIds.length > 1) {
116
+ return outputError(
117
+ client,
118
+ jsonOutput,
119
+ "MESSAGE_WITH_MULTIPLE_THREADS",
120
+ "Cannot use -m with multiple threads. Resolve one thread with a closing message, or resolve multiple threads without -m."
121
+ );
122
+ }
123
+ const scope = await resolveCommentsScope(client, {
124
+ project: parsedArgs.flags["--project"],
125
+ requireProject: false,
126
+ jsonOutput,
127
+ urlTeamSlug
128
+ });
129
+ if (typeof scope === "number") {
130
+ return scope;
131
+ }
132
+ if (threadIds.length > 1 && !yes) {
133
+ if (!canPrompt(client) || jsonOutput) {
134
+ return outputError(
135
+ client,
136
+ jsonOutput,
137
+ "CONFIRMATION_REQUIRED",
138
+ `Pass --yes to ${verb} ${threadIds.length} comments non-interactively.`
139
+ );
140
+ }
141
+ const confirmed = await client.input.confirm(
142
+ `${import_chalk.default.bold(String(threadIds.length))} comments will be ${pastVerb} in team ${scope.teamSlug ?? scope.teamId}. Continue?`,
143
+ false
144
+ );
145
+ if (!confirmed) {
146
+ output_manager_default.log("Canceled.");
147
+ return 0;
148
+ }
149
+ }
150
+ telemetry.trackCliOptionProject(
151
+ parsedArgs.flags["--project"]
152
+ );
153
+ if (threadIds.length === 1) {
154
+ const threadId = threadIds[0];
155
+ let replied = false;
156
+ try {
157
+ if (closingMessage !== void 0) {
158
+ await addMessage(client, scope.teamId, threadId, {
159
+ markdown: closingMessage
160
+ });
161
+ replied = true;
162
+ }
163
+ const thread = await updateThread(
164
+ client,
165
+ scope.teamId,
166
+ threadId,
167
+ resolved
168
+ );
169
+ if (jsonOutput) {
170
+ client.stdout.write(
171
+ `${JSON.stringify({ thread, replied }, null, 2)}
172
+ `
173
+ );
174
+ return 0;
175
+ }
176
+ output_manager_default.print(
177
+ `${import_chalk.default.green("\u2713")} ${threadId} ${pastVerb}${replied ? " (with closing reply)" : ""}
178
+ `
179
+ );
180
+ return 0;
181
+ } catch (err) {
182
+ if (isAPIError(err)) {
183
+ const { code, message } = toApiErrorParts(err);
184
+ const friendly = err.status === 404 ? threadNotFoundMessage(threadId, scope) : message;
185
+ return outputError(
186
+ client,
187
+ jsonOutput,
188
+ code,
189
+ replied ? `Replied, but ${verb} failed: ${friendly} Run \`vercel comments resolve ${threadId}\` (without -m) to finish without duplicating the reply.` : friendly
190
+ );
191
+ }
192
+ throw err;
193
+ }
194
+ }
195
+ const results = [];
196
+ for (const threadId of threadIds) {
197
+ try {
198
+ await updateThread(client, scope.teamId, threadId, resolved);
199
+ results.push({ id: threadId, ok: true });
200
+ } catch (err) {
201
+ if (isAPIError(err)) {
202
+ const { message } = toApiErrorParts(err);
203
+ results.push({ id: threadId, ok: false, error: message });
204
+ } else {
205
+ throw err;
206
+ }
207
+ }
208
+ }
209
+ const failed = results.filter((result) => !result.ok);
210
+ if (jsonOutput) {
211
+ client.stdout.write(`${JSON.stringify({ results }, null, 2)}
212
+ `);
213
+ return failed.length > 0 ? 1 : 0;
214
+ }
215
+ for (const result of results) {
216
+ if (result.ok) {
217
+ output_manager_default.print(`${import_chalk.default.green("\u2713")} ${result.id} ${pastVerb}
218
+ `);
219
+ } else {
220
+ output_manager_default.print(`${import_chalk.default.yellow("!")} ${result.id} ${result.error}
221
+ `);
222
+ }
223
+ }
224
+ return failed.length > 0 ? 1 : 0;
225
+ }
226
+ export {
227
+ resolveThreads as default
228
+ };
@@ -19,7 +19,7 @@ import {
19
19
  requireProjectContext,
20
20
  validateRequiredArguments,
21
21
  withGlobalFlags
22
- } from "./chunk-GKVAAY2A.js";
22
+ } from "./chunk-555WJSO5.js";
23
23
  import {
24
24
  restoreSubcommand
25
25
  } from "./chunk-VZSZBD4V.js";
@@ -27,11 +27,11 @@ import {
27
27
  stamp_default
28
28
  } from "./chunk-64IF634X.js";
29
29
  import "./chunk-VXYGCOKL.js";
30
- import "./chunk-GLAHGVBS.js";
30
+ import "./chunk-TBR2Q37Y.js";
31
+ import "./chunk-ECCWJHC6.js";
31
32
  import {
32
33
  outputAgentError
33
34
  } from "./chunk-UDWRZXIT.js";
34
- import "./chunk-ECCWJHC6.js";
35
35
  import "./chunk-SZXT3PDQ.js";
36
36
  import "./chunk-KSSNLCL4.js";
37
37
  import "./chunk-P4QNYOFB.js";
@@ -13,19 +13,19 @@ import {
13
13
  requireVcrRepositoryAndImageId,
14
14
  resolveVcrScope,
15
15
  validateVcrJsonOutput
16
- } from "./chunk-NLRIKNPX.js";
16
+ } from "./chunk-GP5VCTEU.js";
17
17
  import "./chunk-BUZRVER7.js";
18
18
  import "./chunk-XPKWKPWA.js";
19
19
  import {
20
20
  imageRmSubcommand
21
21
  } from "./chunk-FYQPTH5C.js";
22
- import "./chunk-GLAHGVBS.js";
22
+ import "./chunk-TBR2Q37Y.js";
23
+ import "./chunk-ECCWJHC6.js";
23
24
  import {
24
25
  AGENT_REASON,
25
26
  buildCommandWithYes,
26
27
  outputAgentError
27
28
  } from "./chunk-UDWRZXIT.js";
28
- import "./chunk-ECCWJHC6.js";
29
29
  import {
30
30
  parseArguments,
31
31
  printError
@@ -13,7 +13,7 @@ import {
13
13
  requireVcrRepository,
14
14
  resolveVcrScope,
15
15
  validateVcrJsonOutput
16
- } from "./chunk-NLRIKNPX.js";
16
+ } from "./chunk-GP5VCTEU.js";
17
17
  import "./chunk-BUZRVER7.js";
18
18
  import "./chunk-XPKWKPWA.js";
19
19
  import {
@@ -21,13 +21,13 @@ import {
21
21
  } from "./chunk-3VS4DTAU.js";
22
22
  import "./chunk-GIL3VAUR.js";
23
23
  import "./chunk-FYQPTH5C.js";
24
- import "./chunk-GLAHGVBS.js";
24
+ import "./chunk-TBR2Q37Y.js";
25
+ import "./chunk-ECCWJHC6.js";
25
26
  import {
26
27
  AGENT_REASON,
27
28
  buildCommandWithYes,
28
29
  outputAgentError
29
30
  } from "./chunk-UDWRZXIT.js";
30
- import "./chunk-ECCWJHC6.js";
31
31
  import {
32
32
  parseArguments,
33
33
  printError
@@ -9,23 +9,23 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-A4XB42AB.js";
13
- import "./chunk-XFGY3JAX.js";
12
+ } from "./chunk-MAHINYBW.js";
13
+ import "./chunk-T4NODP6Y.js";
14
14
  import "./chunk-BUZRVER7.js";
15
15
  import {
16
16
  validateJsonOutput
17
17
  } from "./chunk-XPKWKPWA.js";
18
18
  import {
19
19
  rulesRmSubcommand
20
- } from "./chunk-STJJ3DFO.js";
21
- import "./chunk-GLAHGVBS.js";
20
+ } from "./chunk-KCF6S3XF.js";
21
+ import "./chunk-TBR2Q37Y.js";
22
+ import "./chunk-ECCWJHC6.js";
22
23
  import {
23
24
  AGENT_REASON,
24
25
  buildCommandWithGlobalFlags,
25
26
  buildCommandWithYes,
26
27
  outputAgentError
27
28
  } from "./chunk-UDWRZXIT.js";
28
- import "./chunk-ECCWJHC6.js";
29
29
  import {
30
30
  parseArguments,
31
31
  printError
@@ -112,7 +112,8 @@ async function rm(client, argv) {
112
112
  "--project": parsedArgs.flags["--project"],
113
113
  "--all": parsedArgs.flags["--all"]
114
114
  },
115
- fr.jsonOutput
115
+ fr.jsonOutput,
116
+ `alerts rules rm ${ruleId}`
116
117
  );
117
118
  if (typeof scope === "number") {
118
119
  return scope;
@@ -0,0 +1,283 @@
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
+ formatCustomAlertMetric,
9
+ formatCustomAlertTrigger,
10
+ formatRuleScope,
11
+ humanizeReference,
12
+ isCustomAlertRule,
13
+ parseCustomAlertQuery,
14
+ renderAlertTable
15
+ } from "./chunk-3PGXYIKC.js";
16
+ import {
17
+ emitRulesArgParseError,
18
+ handleRulesApiError,
19
+ parseRulesFlagsAndScope,
20
+ rulesItemPath
21
+ } from "./chunk-MAHINYBW.js";
22
+ import "./chunk-T4NODP6Y.js";
23
+ import {
24
+ formatDate
25
+ } from "./chunk-GZLPFESR.js";
26
+ import {
27
+ formatGranularity
28
+ } from "./chunk-5AJPMLDV.js";
29
+ import "./chunk-A3NYPUKZ.js";
30
+ import "./chunk-BUZRVER7.js";
31
+ import "./chunk-FGDKMNEN.js";
32
+ import "./chunk-PRWJUY5U.js";
33
+ import {
34
+ truncateMiddle
35
+ } from "./chunk-OF2GNB42.js";
36
+ import {
37
+ validateJsonOutput
38
+ } from "./chunk-XPKWKPWA.js";
39
+ import {
40
+ rulesInspectSubcommand
41
+ } from "./chunk-KCF6S3XF.js";
42
+ import "./chunk-NZRWTCRM.js";
43
+ import "./chunk-TBR2Q37Y.js";
44
+ import "./chunk-ECCWJHC6.js";
45
+ import {
46
+ AGENT_REASON,
47
+ buildCommandWithGlobalFlags,
48
+ outputAgentError
49
+ } from "./chunk-UDWRZXIT.js";
50
+ import {
51
+ parseArguments,
52
+ printError
53
+ } from "./chunk-SZXT3PDQ.js";
54
+ import {
55
+ getFlagsSpecification,
56
+ isAPIError,
57
+ packageName
58
+ } from "./chunk-KSSNLCL4.js";
59
+ import "./chunk-P4QNYOFB.js";
60
+ import "./chunk-52QYYTM5.js";
61
+ import {
62
+ output_manager_default
63
+ } from "./chunk-OX7KI3LF.js";
64
+ import "./chunk-GGP5R3FU.js";
65
+ import {
66
+ require_source
67
+ } from "./chunk-S7KYDPEM.js";
68
+ import {
69
+ __toESM
70
+ } from "./chunk-TZ2YI2VH.js";
71
+
72
+ // src/commands/alerts/rules/rule-inspect.ts
73
+ var import_chalk = __toESM(require_source(), 1);
74
+ function formatBoolean(value) {
75
+ if (value === void 0) {
76
+ return "-";
77
+ }
78
+ return value ? "yes" : "no";
79
+ }
80
+ function getAlertTypeRows(rule) {
81
+ const types = rule.alertTypes?.map((alertType) => alertType.type) ?? (rule.customAlert ? ["custom_alert"] : []);
82
+ if (types.length === 0) {
83
+ return [];
84
+ }
85
+ const uniqueTypes = [...new Set(types)];
86
+ return [
87
+ [
88
+ uniqueTypes.length === 1 ? "Type" : "Types",
89
+ uniqueTypes.map((value) => humanizeReference(value)).join(", ")
90
+ ]
91
+ ];
92
+ }
93
+ function getNotificationRows(rule) {
94
+ const rows = [];
95
+ if (rule.autosubscribeOwnersInKnock !== void 0) {
96
+ rows.push([
97
+ "Auto-subscribe owners",
98
+ formatBoolean(rule.autosubscribeOwnersInKnock)
99
+ ]);
100
+ }
101
+ if (rule.autosubscribeProjectAdminsInKnock !== void 0) {
102
+ rows.push([
103
+ "Auto-subscribe project admins",
104
+ formatBoolean(rule.autosubscribeProjectAdminsInKnock)
105
+ ]);
106
+ }
107
+ const slackChannels = /* @__PURE__ */ new Set();
108
+ const webhooks = /* @__PURE__ */ new Set();
109
+ for (const notification of rule.notifications ?? []) {
110
+ for (const channel of notification.slack ?? []) {
111
+ slackChannels.add(channel);
112
+ }
113
+ for (const webhook of notification.webhooks ?? []) {
114
+ webhooks.add(webhook);
115
+ }
116
+ }
117
+ if (slackChannels.size > 0) {
118
+ rows.push(["Slack", [...slackChannels].join(", ")]);
119
+ }
120
+ if (webhooks.size > 0) {
121
+ rows.push(["Webhooks", [...webhooks].join(", ")]);
122
+ }
123
+ return rows;
124
+ }
125
+ function getCustomAlertRows(customAlert) {
126
+ const query = parseCustomAlertQuery(customAlert.queryJsonString);
127
+ const granularity = formatGranularity(query.granularity);
128
+ const groupBy = query.groupBy ?? [];
129
+ const rows = [
130
+ ["Title", customAlert.title || "-"],
131
+ ["Metric", formatCustomAlertMetric(customAlert) || "-"],
132
+ ["Trigger", formatCustomAlertTrigger(customAlert) || "-"],
133
+ ...typeof customAlert.minThreshold === "number" ? [["Minimum", String(customAlert.minThreshold)]] : [],
134
+ ...query.event ? [["Event", humanizeReference(query.event)]] : [],
135
+ ...groupBy.length > 0 ? [
136
+ [
137
+ "Group By",
138
+ groupBy.map((value) => humanizeReference(value)).join(", ")
139
+ ]
140
+ ] : [],
141
+ ...granularity ? [["Granularity", granularity]] : [],
142
+ ...customAlert.createdAt ? [["Created At", formatDate(customAlert.createdAt)]] : []
143
+ ];
144
+ return rows.map(([label, value]) => [label, truncateMiddle(value, 96)]);
145
+ }
146
+ function printRule(rule, ruleId) {
147
+ const summaryRows = [
148
+ ["Name", rule.name || "-"],
149
+ ...rule.action === "exclude" ? [["Action", rule.action]] : [],
150
+ ["Scope", formatRuleScope(rule.projectId)],
151
+ ...getAlertTypeRows(rule),
152
+ ...rule.sensitivityLevel !== void 0 ? [["Sensitivity", String(rule.sensitivityLevel)]] : [],
153
+ ...rule.isDefault !== void 0 ? [["Default", formatBoolean(rule.isDefault)]] : [],
154
+ ...rule.owner ? [["Owner", rule.owner]] : [],
155
+ ...rule.teamId ? [["Team id", rule.teamId]] : [],
156
+ ...rule.lastEditedByUserId ? [["Last Edited By", rule.lastEditedByUserId]] : [],
157
+ ...rule.odataFilters ? [["OData Filters", rule.odataFilters]] : []
158
+ ];
159
+ const sections = [
160
+ "",
161
+ `${import_chalk.default.bold("Alert rule")} ${import_chalk.default.cyan(rule.id || ruleId)}`,
162
+ renderAlertTable(summaryRows, 3)
163
+ ];
164
+ const notificationRows = getNotificationRows(rule);
165
+ if (notificationRows.length > 0) {
166
+ sections.push(
167
+ "",
168
+ import_chalk.default.cyan("Notifications"),
169
+ renderAlertTable(notificationRows, 3)
170
+ );
171
+ }
172
+ if (rule.customAlert) {
173
+ sections.push(
174
+ "",
175
+ import_chalk.default.cyan("Custom Alert"),
176
+ renderAlertTable(getCustomAlertRows(rule.customAlert), 3)
177
+ );
178
+ } else if (isCustomAlertRule(rule)) {
179
+ sections.push(
180
+ "",
181
+ import_chalk.default.cyan("Custom Alert"),
182
+ " No custom alert definition returned."
183
+ );
184
+ }
185
+ output_manager_default.print(`${sections.join("\n")}
186
+ `);
187
+ }
188
+ async function ruleInspect(client, argv) {
189
+ let parsedArgs;
190
+ try {
191
+ parsedArgs = parseArguments(
192
+ argv,
193
+ getFlagsSpecification(rulesInspectSubcommand.options)
194
+ );
195
+ } catch (e) {
196
+ emitRulesArgParseError(
197
+ client,
198
+ e,
199
+ "alerts rules inspect <ruleId> --project <name-or-id>"
200
+ );
201
+ printError(e);
202
+ return 1;
203
+ }
204
+ const ruleId = parsedArgs.args[0];
205
+ const fr = validateJsonOutput(parsedArgs.flags);
206
+ if (!fr.valid) {
207
+ outputAgentError(
208
+ client,
209
+ {
210
+ status: "error",
211
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
212
+ message: fr.error
213
+ },
214
+ 1
215
+ );
216
+ output_manager_default.error(fr.error);
217
+ return 1;
218
+ }
219
+ if (!ruleId) {
220
+ outputAgentError(
221
+ client,
222
+ {
223
+ status: "error",
224
+ reason: AGENT_REASON.MISSING_ARGUMENTS,
225
+ message: `Missing rule id. Example: ${packageName} alerts rules inspect <ruleId>`,
226
+ next: [
227
+ {
228
+ command: buildCommandWithGlobalFlags(
229
+ client.argv,
230
+ "alerts rules inspect <ruleId>"
231
+ ),
232
+ when: "Replace <ruleId> with an id from `alerts rules ls`"
233
+ },
234
+ {
235
+ command: buildCommandWithGlobalFlags(
236
+ client.argv,
237
+ "alerts rules ls"
238
+ ),
239
+ when: "List rule ids in the current scope"
240
+ }
241
+ ]
242
+ },
243
+ 1
244
+ );
245
+ output_manager_default.error("Usage: `vercel alerts rules inspect <ruleId>`");
246
+ return 1;
247
+ }
248
+ const scope = await parseRulesFlagsAndScope(
249
+ client,
250
+ {
251
+ "--project": parsedArgs.flags["--project"],
252
+ "--all": parsedArgs.flags["--all"]
253
+ },
254
+ fr.jsonOutput,
255
+ `alerts rules inspect ${ruleId}`
256
+ );
257
+ if (typeof scope === "number") {
258
+ return scope;
259
+ }
260
+ const path = rulesItemPath(scope, ruleId);
261
+ output_manager_default.spinner("Fetching alert rule...");
262
+ try {
263
+ const rule = await client.fetch(path);
264
+ output_manager_default.stopSpinner();
265
+ if (fr.jsonOutput) {
266
+ client.stdout.write(`${JSON.stringify({ rule }, null, 2)}
267
+ `);
268
+ } else {
269
+ printRule(rule, ruleId);
270
+ }
271
+ return 0;
272
+ } catch (err) {
273
+ if (isAPIError(err)) {
274
+ return handleRulesApiError(client, err, fr.jsonOutput);
275
+ }
276
+ throw err;
277
+ } finally {
278
+ output_manager_default.stopSpinner();
279
+ }
280
+ }
281
+ export {
282
+ ruleInspect as default
283
+ };
@@ -29,8 +29,8 @@ var RULES_CONFIG = {
29
29
  update: ["update", "patch"]
30
30
  };
31
31
  async function rules(client, argv) {
32
- if (argv.length === 0 || argv[0].startsWith("-")) {
33
- const lsFn = (await import("./ls-MB74DIQV.js")).default;
32
+ if (argv.length === 0 || argv[0]?.startsWith("-")) {
33
+ const lsFn = (await import("./ls-RHEQ6YQB.js")).default;
34
34
  return lsFn(client, argv);
35
35
  }
36
36
  const { subcommand, args, subcommandOriginal } = getSubcommand(
@@ -63,15 +63,15 @@ async function rules(client, argv) {
63
63
  }
64
64
  switch (subcommand) {
65
65
  case "ls":
66
- return (await import("./ls-MB74DIQV.js")).default(client, args);
66
+ return (await import("./ls-RHEQ6YQB.js")).default(client, args);
67
67
  case "add":
68
- return (await import("./add-L3Z6PL54.js")).default(client, args);
68
+ return (await import("./add-7M577U56.js")).default(client, args);
69
69
  case "inspect":
70
- return (await import("./rule-inspect-YEZGYINZ.js")).default(client, args);
70
+ return (await import("./rule-inspect-DMP2CKJQ.js")).default(client, args);
71
71
  case "rm":
72
- return (await import("./rm-FRZMXB2W.js")).default(client, args);
72
+ return (await import("./rm-FR6KE744.js")).default(client, args);
73
73
  case "update":
74
- return (await import("./update-W3CWQB2F.js")).default(client, args);
74
+ return (await import("./update-QH4DQMZV.js")).default(client, args);
75
75
  default:
76
76
  output_manager_default.error(`Unhandled rules subcommand: ${String(subcommandOriginal)}`);
77
77
  return 1;
@@ -7,11 +7,13 @@ const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  fetchMetricDetailOrExit,
9
9
  fetchMetricListOrExit
10
- } from "./chunk-6RTK6BWX.js";
10
+ } from "./chunk-YA3WQFLY.js";
11
+ import {
12
+ formatErrorJson
13
+ } from "./chunk-NM43FFV6.js";
11
14
  import {
12
- formatErrorJson,
13
15
  indent_default
14
- } from "./chunk-Z7NPYIZ6.js";
16
+ } from "./chunk-A3NYPUKZ.js";
15
17
  import {
16
18
  formatTable
17
19
  } from "./chunk-ZVLPUREX.js";
@@ -25,9 +27,9 @@ import "./chunk-NZRWTCRM.js";
25
27
  import {
26
28
  getScope,
27
29
  require_pluralize
28
- } from "./chunk-GLAHGVBS.js";
29
- import "./chunk-UDWRZXIT.js";
30
+ } from "./chunk-TBR2Q37Y.js";
30
31
  import "./chunk-ECCWJHC6.js";
32
+ import "./chunk-UDWRZXIT.js";
31
33
  import {
32
34
  parseArguments,
33
35
  printError
@@ -52,9 +52,9 @@ async function tags(client, argv, telemetry) {
52
52
  }
53
53
  switch (subcommand) {
54
54
  case "ls":
55
- return (await import("./ls-YDUYTLXW.js")).default(client, args, telemetry);
55
+ return (await import("./ls-CG6A7UXF.js")).default(client, args, telemetry);
56
56
  case "inspect":
57
- return (await import("./inspect-4JD2QN67.js")).default(client, args, telemetry);
57
+ return (await import("./inspect-UM3LDRPV.js")).default(client, args, telemetry);
58
58
  default:
59
59
  output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
60
60
  return 1;