vercel 59.11.7 → 59.12.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 (125) hide show
  1. package/dist/chunks/{add-KSJQYR5C.js → add-OO3JGLZW.js} +3 -3
  2. package/dist/chunks/{add-WU2QYHYL.js → add-RTXDASSS.js} +3 -3
  3. package/dist/chunks/add-XGO6LHMD.js +221 -0
  4. package/dist/chunks/{build-F3J6FLPD.js → build-JINV2UD4.js} +3 -3
  5. package/dist/chunks/chunk-2NIDTSQJ.js +305 -0
  6. package/dist/chunks/{chunk-SHFNEZVI.js → chunk-32XSMM3W.js} +1 -1
  7. package/dist/chunks/{chunk-N4QHMXOO.js → chunk-3BB2HOO2.js} +3 -2
  8. package/dist/chunks/{chunk-DSTNNQVV.js → chunk-3F25W3GA.js} +3 -3
  9. package/dist/chunks/{chunk-OIH6FP5Y.js → chunk-4TUMNBEE.js} +2 -2
  10. package/dist/chunks/{chunk-4IVSM24H.js → chunk-ABSZNJQO.js} +1 -1
  11. package/dist/chunks/{chunk-CNDPIHY5.js → chunk-AV747POV.js} +24 -19
  12. package/dist/chunks/{chunk-QHS645AZ.js → chunk-CZ5QQRXD.js} +3 -3
  13. package/dist/chunks/{chunk-FL4JLNT2.js → chunk-E47NARDE.js} +2 -2
  14. package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
  15. package/dist/chunks/{chunk-PJXMXMCO.js → chunk-ELZ6WQQA.js} +2 -2
  16. package/dist/chunks/{chunk-FVNJTRCE.js → chunk-EOLGLGXJ.js} +2 -2
  17. package/dist/chunks/chunk-GDOUDU6O.js +74 -0
  18. package/dist/chunks/{chunk-GCVXKRR5.js → chunk-HD4DR3DA.js} +1 -0
  19. package/dist/chunks/{chunk-DWIC7MRV.js → chunk-HKHXKSXQ.js} +1 -1
  20. package/dist/chunks/{chunk-ZBEECGFD.js → chunk-HM24ZWQL.js} +1 -1
  21. package/dist/chunks/chunk-HR2MP4XF.js +324 -0
  22. package/dist/chunks/{chunk-EZQDYIVB.js → chunk-JOXNBQ7W.js} +1 -1
  23. package/dist/chunks/{chunk-DBYHS3CK.js → chunk-KAF4WFF3.js} +2 -2
  24. package/dist/chunks/{chunk-VYC45Q4Z.js → chunk-KNO327AW.js} +1 -1
  25. package/dist/chunks/{chunk-XD4DCYMX.js → chunk-L6B6BRHH.js} +2 -2
  26. package/dist/chunks/{chunk-X7DBBZQD.js → chunk-LDV2R4P4.js} +1 -1
  27. package/dist/chunks/{chunk-2TSBB22D.js → chunk-MADFAH3O.js} +2 -2
  28. package/dist/chunks/{chunk-TGNEG57M.js → chunk-MDGPZHSM.js} +110 -14
  29. package/dist/chunks/{chunk-XIFATBH5.js → chunk-NDY3JDOU.js} +4 -4
  30. package/dist/chunks/{chunk-NSOYO6JQ.js → chunk-OJHDGHOB.js} +6 -6
  31. package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
  32. package/dist/chunks/{chunk-C762AAVU.js → chunk-PP5GKSIX.js} +4 -4
  33. package/dist/chunks/{chunk-Z7JWYFOY.js → chunk-QB2UHSUB.js} +1 -1
  34. package/dist/chunks/chunk-QIUK4Z7Q.js +79 -0
  35. package/dist/chunks/{chunk-GHKJAK5V.js → chunk-RNK3LXLR.js} +4 -4
  36. package/dist/chunks/{chunk-CEDN47PH.js → chunk-SWO66HE2.js} +1 -1
  37. package/dist/chunks/{chunk-EPOLDWRA.js → chunk-TDGK45FB.js} +1 -1
  38. package/dist/chunks/{chunk-PFM75KY3.js → chunk-UA55I7M6.js} +3 -3
  39. package/dist/chunks/{chunk-VT3Z7HF6.js → chunk-UJPVHLL5.js} +4 -4
  40. package/dist/chunks/{chunk-UARGTFCT.js → chunk-VJSREJVM.js} +1 -1
  41. package/dist/chunks/{chunk-WL6QYSGD.js → chunk-WPBCUXMZ.js} +506 -22
  42. package/dist/chunks/{chunk-A5JZS6ZN.js → chunk-WSZ5E4WH.js} +1 -1
  43. package/dist/chunks/{chunk-GUU4Z2AQ.js → chunk-WT2Y7FRD.js} +6 -6
  44. package/dist/chunks/{chunk-G3PXSXIB.js → chunk-WT6C2ALC.js} +3 -3
  45. package/dist/chunks/{chunk-7KROIXQM.js → chunk-X6TGUHFD.js} +3 -3
  46. package/dist/chunks/{chunk-QOPTXV4G.js → chunk-YPMFZRTN.js} +1 -1
  47. package/dist/chunks/{chunk-FVT74RZ5.js → chunk-YRESLJCW.js} +11 -11
  48. package/dist/chunks/{clear-XUQO4ZTK.js → clear-GQTDYSKJ.js} +3 -3
  49. package/dist/chunks/{compile-vercel-config-D3ARNHTN.js → compile-vercel-config-URVMKDVW.js} +2 -2
  50. package/dist/chunks/{config-37OAE7QJ.js → config-MSVQR5T6.js} +7 -7
  51. package/dist/chunks/{config-MEDLXUVM.js → config-OAXY4J6P.js} +3 -3
  52. package/dist/chunks/config-validator.mjs +1 -1
  53. package/dist/chunks/{delete-VSWDZ2SW.js → delete-57QO64HD.js} +5 -5
  54. package/dist/chunks/{delete-3N3YZZOF.js → delete-XN6ESD7C.js} +5 -5
  55. package/dist/chunks/{detect-services-TESZCQWG.js → detect-services-UPY4LTBZ.js} +6 -6
  56. package/dist/chunks/{disable-A4FLFMC7.js → disable-BYI46V7B.js} +5 -5
  57. package/dist/chunks/{discard-CHGFULBZ.js → discard-IIQL44ZZ.js} +5 -5
  58. package/dist/chunks/{edit-MHSYAPDR.js → edit-BRNS3OR4.js} +6 -6
  59. package/dist/chunks/{edit-JZ63AJYQ.js → edit-JTW7XZH7.js} +5 -5
  60. package/dist/chunks/{enable-KD46SEC5.js → enable-CH5FSQMR.js} +5 -5
  61. package/dist/chunks/{export-42QZLBSN.js → export-6WHQOWKM.js} +5 -5
  62. package/dist/chunks/{image-GP4H73A2.js → image-ZSLYATWG.js} +3 -3
  63. package/dist/chunks/{import-builders-6TBLMPL2.js → import-builders-FNMYJZGG.js} +4 -4
  64. package/dist/chunks/{inspect-5FMWMY3C.js → inspect-4RDZSYWU.js} +10 -10
  65. package/dist/chunks/{inspect-MUVK6MMT.js → inspect-7WQXZWET.js} +3 -3
  66. package/dist/chunks/{inspect-Q3DWW7MC.js → inspect-CGXTNMMO.js} +9 -9
  67. package/dist/chunks/{inspect-RNTSYM6O.js → inspect-XJ7BYLZ5.js} +3 -3
  68. package/dist/chunks/{inspect-QFXAOUL4.js → inspect-Z2MBTTB7.js} +3 -3
  69. package/dist/chunks/{list-IHHIPXEC.js → list-65LW6OTM.js} +6 -6
  70. package/dist/chunks/{list-XHD5DLEX.js → list-7W3PHRB6.js} +7 -7
  71. package/dist/chunks/{list-JRNWLSO5.js → list-KS22Y57L.js} +2 -2
  72. package/dist/chunks/{login-PCT6KFWY.js → login-NXULVQZ2.js} +3 -3
  73. package/dist/chunks/{ls-TGHCCARZ.js → ls-35EOVEIQ.js} +4 -4
  74. package/dist/chunks/{ls-PQZ2RIDX.js → ls-5GKS5QRW.js} +4 -4
  75. package/dist/chunks/ls-ADYFYYIW.js +204 -0
  76. package/dist/chunks/{ls-SVOHC3XW.js → ls-DZYN3SNS.js} +4 -4
  77. package/dist/chunks/{ls-VRIH5WA3.js → ls-HVQOGBGV.js} +7 -7
  78. package/dist/chunks/{ls-GPEHEFCF.js → ls-I2PWG7YN.js} +4 -4
  79. package/dist/chunks/{open-E7DEKYDU.js → open-H34HXJHP.js} +5 -5
  80. package/dist/chunks/{permissions-JKOONWVL.js → permissions-ZPPEPKVE.js} +4 -4
  81. package/dist/chunks/{publish-EDDELDE5.js → publish-NRMKXHAU.js} +5 -5
  82. package/dist/chunks/{pull-646WEVDE.js → pull-WUT3XTZX.js} +7 -7
  83. package/dist/chunks/{push-LTNW5OVD.js → push-WFNCEA5J.js} +3 -3
  84. package/dist/chunks/{query-LU4N6KPO.js → query-2FQM3F7N.js} +7 -7
  85. package/dist/chunks/{reorder-22PKJMZP.js → reorder-GYCT7L3C.js} +5 -5
  86. package/dist/chunks/{reply-SF2EZMVZ.js → reply-RFEXNYZ7.js} +5 -5
  87. package/dist/chunks/{resolve-ZCZGXTOT.js → resolve-ZFGT7W6Z.js} +5 -5
  88. package/dist/chunks/{restore-VJAWZXB4.js → restore-JAXPMYL5.js} +5 -5
  89. package/dist/chunks/rm-CLKQN5E4.js +162 -0
  90. package/dist/chunks/{rm-WNPGTUBH.js → rm-JPV5V2SH.js} +3 -3
  91. package/dist/chunks/{rm-KN2QFCKO.js → rm-N7SGFQOA.js} +3 -3
  92. package/dist/chunks/{rm-KVEAJPRE.js → rm-UQJ4CZJH.js} +3 -3
  93. package/dist/chunks/{rm-OSZ5FZUM.js → rm-ZUQ4U454.js} +7 -7
  94. package/dist/chunks/rule-inspect-HI3YY7OY.js +123 -0
  95. package/dist/chunks/{rules-65LKAQ35.js → rules-DA3Q64M4.js} +7 -7
  96. package/dist/chunks/{schema-NXCW4M75.js → schema-R3C4CXJ6.js} +6 -6
  97. package/dist/chunks/schema-UYYFV3JB.js +381 -0
  98. package/dist/chunks/{set-FYJVKMPV.js → set-TOJPGW4J.js} +7 -7
  99. package/dist/chunks/{setup-and-link-KXPZE32P.js → setup-and-link-DRYXQOH4.js} +16 -16
  100. package/dist/chunks/{tags-ANIRP5E3.js → tags-TNLVFNVI.js} +2 -2
  101. package/dist/chunks/update-X6JB3NPI.js +224 -0
  102. package/dist/chunks/vlt-builder-importer-USCFHWPL.js +322 -0
  103. package/dist/commands/build/index.js +19 -19
  104. package/dist/commands/deploy/index.js +19 -19
  105. package/dist/commands/dev/index.js +25 -25
  106. package/dist/commands/env/index.js +12 -12
  107. package/dist/commands/link/index.js +12 -12
  108. package/dist/commands/list/index.js +5 -5
  109. package/dist/commands-bulk.js +8273 -3511
  110. package/dist/help.js +1 -1
  111. package/dist/index.js +28 -18
  112. package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +6 -0
  113. package/dist/version.mjs +1 -1
  114. package/package.json +52 -48
  115. package/dist/chunks/add-PERLOALD.js +0 -233
  116. package/dist/chunks/chunk-5GGUB4EO.js +0 -31
  117. package/dist/chunks/chunk-ARU7VBKR.js +0 -144
  118. package/dist/chunks/chunk-KEKR7OCB.js +0 -140
  119. package/dist/chunks/chunk-MXLA3VQS.js +0 -20
  120. package/dist/chunks/chunk-QKX7WKIN.js +0 -98
  121. package/dist/chunks/ls-PF7F4PP4.js +0 -197
  122. package/dist/chunks/rm-W722Q2AO.js +0 -173
  123. package/dist/chunks/rule-inspect-25Z6SNX3.js +0 -285
  124. package/dist/chunks/schema-7D6IGJEJ.js +0 -429
  125. package/dist/chunks/update-UT6CTKVG.js +0 -246
@@ -1,144 +0,0 @@
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
- indent_default
9
- } from "./chunk-A3NYPUKZ.js";
10
- import {
11
- humanizeIdentifier
12
- } from "./chunk-FGDKMNEN.js";
13
- import {
14
- truncateMiddle
15
- } from "./chunk-ND5CF2H3.js";
16
- import {
17
- table
18
- } from "./chunk-NW34PW6V.js";
19
-
20
- // src/commands/alerts/format.ts
21
- function renderAlertTable(rows, hsep = 3) {
22
- return indent_default(
23
- table(rows, { hsep }).split("\n").map((line) => line.trimEnd()).join("\n"),
24
- 2
25
- );
26
- }
27
- function normalizeTimestamp(value) {
28
- if (value === void 0 || !Number.isFinite(value)) {
29
- return void 0;
30
- }
31
- return Math.abs(value) < 1e12 ? value * 1e3 : value;
32
- }
33
- function getPrimaryAlert(group) {
34
- return group.alerts?.[0];
35
- }
36
- function getGroupTitle(group) {
37
- return group.ai?.title || group.title || getPrimaryAlert(group)?.title || "Alert group";
38
- }
39
- function getGroupType(group) {
40
- return group.type || getPrimaryAlert(group)?.type || "-";
41
- }
42
- function getGroupStartedAt(group) {
43
- const primaryAlert = getPrimaryAlert(group);
44
- return normalizeTimestamp(
45
- group.recordedStartedAt ?? primaryAlert?.recordedStartedAt ?? primaryAlert?.startedAt
46
- );
47
- }
48
- function formatTriggerOperator(value) {
49
- switch (value) {
50
- case "gt":
51
- return ">";
52
- case "gte":
53
- return ">=";
54
- case "lt":
55
- return "<";
56
- case "lte":
57
- return "<=";
58
- default:
59
- return void 0;
60
- }
61
- }
62
- function humanizeReference(value, opts = {}) {
63
- return value.split("/").map((part) => {
64
- const label = humanizeIdentifier(part);
65
- return opts.case === "title" ? label : label.toLowerCase();
66
- }).join(" / ");
67
- }
68
- function formatRuleScope(rule, {
69
- projectIdMaxLength = 48,
70
- filterMaxLength = 80
71
- } = {}) {
72
- const { projectId } = rule;
73
- if (!projectId) {
74
- return "team-wide";
75
- }
76
- if (isCustomAlertRule(rule)) {
77
- return `project: ${truncateMiddle(projectId, projectIdMaxLength)}`;
78
- }
79
- return truncateMiddle(projectId, filterMaxLength);
80
- }
81
- function isCustomAlertRule(rule) {
82
- return Boolean(rule.customAlert) || Boolean(
83
- rule.alertTypes?.some((alertType) => alertType.type === "custom_alert")
84
- );
85
- }
86
- function formatCustomAlertTrigger(customAlert) {
87
- const operator = formatTriggerOperator(customAlert.triggerOperator);
88
- const threshold = typeof customAlert.triggerThreshold === "number" ? String(customAlert.triggerThreshold) : void 0;
89
- const trigger = customAlert.triggerType === "anomaly" ? `z-score ${[operator, threshold].filter(Boolean).join(" ")}` : ["threshold", operator, threshold].filter(Boolean).join(" ");
90
- return trigger || void 0;
91
- }
92
- function parseCustomAlertQuery(value) {
93
- if (!value) {
94
- return {};
95
- }
96
- try {
97
- return JSON.parse(value);
98
- } catch {
99
- return {};
100
- }
101
- }
102
- function formatFormula(formula) {
103
- if (!formula?.left || !formula.right) {
104
- return void 0;
105
- }
106
- switch (formula.operator) {
107
- case "divide":
108
- return `${humanizeReference(formula.left)} / ${humanizeReference(
109
- formula.right
110
- )}`;
111
- default:
112
- return void 0;
113
- }
114
- }
115
- function formatCustomAlertMetric(customAlert) {
116
- const formula = formatFormula(customAlert.formula);
117
- if (formula) {
118
- return formula;
119
- }
120
- const query = parseCustomAlertQuery(customAlert.queryJsonString);
121
- const firstRollup = Object.values(query.rollups ?? {})[0];
122
- const parts = [query.event, firstRollup?.aggregation, firstRollup?.measure];
123
- const base = parts.flatMap((part) => part ? [humanizeReference(part)] : []).join(" ");
124
- const groupBy = query.groupBy ?? [];
125
- if (base && groupBy.length > 0) {
126
- return `${base} by ${groupBy.map((value) => humanizeReference(value)).join(", ")}`;
127
- }
128
- return base || void 0;
129
- }
130
-
131
- export {
132
- renderAlertTable,
133
- normalizeTimestamp,
134
- getGroupTitle,
135
- getGroupType,
136
- getGroupStartedAt,
137
- formatTriggerOperator,
138
- humanizeReference,
139
- formatRuleScope,
140
- isCustomAlertRule,
141
- formatCustomAlertTrigger,
142
- parseCustomAlertQuery,
143
- formatCustomAlertMetric
144
- };
@@ -1,140 +0,0 @@
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
- resolveAlertsScope
9
- } from "./chunk-N4QHMXOO.js";
10
- import {
11
- handleValidationError,
12
- outputError,
13
- validateAllProjectMutualExclusivity
14
- } from "./chunk-KFWQ3EFH.js";
15
- import {
16
- AGENT_REASON
17
- } from "./chunk-VUS2JQB2.js";
18
- import {
19
- buildCommandWithGlobalFlags,
20
- outputAgentError
21
- } from "./chunk-26CU4Q3C.js";
22
-
23
- // src/commands/alerts/rules/parse-scope.ts
24
- async function parseRulesFlagsAndScope(client, flags, jsonOutput, command = "alerts rules ls") {
25
- const mutual = validateAllProjectMutualExclusivity(
26
- flags["--all"],
27
- flags["--project"]
28
- );
29
- if (!mutual.valid) {
30
- outputAgentError(
31
- client,
32
- {
33
- status: "error",
34
- reason: AGENT_REASON.INVALID_ARGUMENTS,
35
- message: mutual.message,
36
- next: [
37
- {
38
- command: buildCommandWithGlobalFlags(
39
- client.argv,
40
- "alerts rules --help"
41
- ),
42
- when: "Use either `--project` or `--all`, not both"
43
- }
44
- ]
45
- },
46
- 1
47
- );
48
- return handleValidationError(mutual, jsonOutput, client);
49
- }
50
- return resolveAlertsScope(client, {
51
- project: flags["--project"],
52
- all: flags["--all"],
53
- jsonOutput,
54
- command
55
- });
56
- }
57
-
58
- // src/commands/alerts/rules/util.ts
59
- function buildRulesQuery(scope) {
60
- const query = new URLSearchParams({ teamId: scope.teamId });
61
- if (scope.projectId) {
62
- query.set("projectId", scope.projectId);
63
- }
64
- return query;
65
- }
66
- function rulesCollectionPath(scope) {
67
- return `/alerts/v2/alert-rules?${buildRulesQuery(scope).toString()}`;
68
- }
69
- function rulesItemPath(scope, ruleId) {
70
- const query = new URLSearchParams({ teamId: scope.teamId });
71
- return `/alerts/v2/alert-rules/${encodeURIComponent(ruleId)}?${query.toString()}`;
72
- }
73
- function handleRulesApiError(client, err, jsonOutput) {
74
- const message = err.status === 401 || err.status === 403 ? "You do not have access to alert rules in this scope. Ensure your role can manage Alert Rules, or pass --token and --scope." : err.status >= 500 ? `The alert rules endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.` : err.serverMessage || `API error (${err.status}).`;
75
- 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;
76
- outputAgentError(
77
- client,
78
- {
79
- status: "error",
80
- reason,
81
- message,
82
- ...err.status === 401 || err.status === 403 ? {
83
- hint: "Confirm team scope with whoami; use --scope <team-slug> if the rule lives under another team.",
84
- next: [
85
- {
86
- command: buildCommandWithGlobalFlags(client.argv, "whoami"),
87
- when: "See current user and team"
88
- },
89
- {
90
- command: buildCommandWithGlobalFlags(
91
- client.argv,
92
- "alerts rules ls"
93
- ),
94
- when: "Retry listing rules after fixing scope or permissions"
95
- }
96
- ]
97
- } : {}
98
- },
99
- 1
100
- );
101
- return outputError(client, jsonOutput, err.code || "API_ERROR", message);
102
- }
103
- function emitRulesArgParseError(client, err, recoverWithProjectFlag) {
104
- const msg = err instanceof Error ? err.message : String(err);
105
- const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
106
- outputAgentError(
107
- client,
108
- {
109
- status: "error",
110
- reason: AGENT_REASON.INVALID_ARGUMENTS,
111
- message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
112
- next: projectFlagMissingArg ? [
113
- {
114
- command: buildCommandWithGlobalFlags(
115
- client.argv,
116
- recoverWithProjectFlag
117
- ),
118
- when: "Re-run with a project name or id (replace placeholder)"
119
- }
120
- ] : [
121
- {
122
- command: buildCommandWithGlobalFlags(
123
- client.argv,
124
- "alerts rules --help"
125
- ),
126
- when: "See valid `alerts rules` subcommands"
127
- }
128
- ]
129
- },
130
- 1
131
- );
132
- }
133
-
134
- export {
135
- parseRulesFlagsAndScope,
136
- rulesCollectionPath,
137
- rulesItemPath,
138
- handleRulesApiError,
139
- emitRulesArgParseError
140
- };
@@ -1,20 +0,0 @@
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/commands/alerts/rules/schema-help.ts
9
- var CUSTOM_ALERT_EVENT_HELP = [
10
- "Run `vercel metrics schema <metric-or-prefix>` to discover available metrics, aggregations, and dimensions. Metric IDs use the `vercel.` namespace, for example `vercel.request.count`.",
11
- "Custom alert queries use query-engine event and measure names instead of the public metric ID.",
12
- '`vercel.request.count` maps to `event: "incomingRequest"` and `measure: "count"`.',
13
- '`vercel.function_invocation.count` maps to `event: "serverlessFunctionInvocation"` and `measure: "count"`.',
14
- '`vercel.external_api_request.count` maps to `event: "outgoingRequest"` and `measure: "count"`.',
15
- '`vercel.sandbox.cpu_total_time_ms` maps to `event: "sandboxUsage"` and `measure: "cpuTotalTimeMs"`.'
16
- ];
17
-
18
- export {
19
- CUSTOM_ALERT_EVENT_HELP
20
- };
@@ -1,98 +0,0 @@
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
- isJSONObject
9
- } from "./chunk-GUU4Z2AQ.js";
10
- import {
11
- AGENT_REASON
12
- } from "./chunk-VUS2JQB2.js";
13
- import {
14
- getProjectByNameOrId
15
- } from "./chunk-2TSBB22D.js";
16
- import {
17
- outputAgentError
18
- } from "./chunk-26CU4Q3C.js";
19
- import {
20
- ProjectNotFound,
21
- isAPIError
22
- } from "./chunk-CV5YC2EN.js";
23
- import {
24
- output_manager_default
25
- } from "./chunk-2JIX6UMI.js";
26
-
27
- // src/commands/alerts/rules/custom-alert-query.ts
28
- async function resolveCustomAlertProjectName(client, scope, projectId) {
29
- if (scope.projectId === projectId && scope.projectName) {
30
- return scope.projectName;
31
- }
32
- try {
33
- const project = await getProjectByNameOrId(client, projectId, scope.teamId);
34
- return project instanceof ProjectNotFound ? void 0 : project.name;
35
- } catch (error) {
36
- if (isAPIError(error)) {
37
- return void 0;
38
- }
39
- throw error;
40
- }
41
- }
42
- function parseCustomAlertQueryBody(client, body) {
43
- const customAlert = body.customAlert;
44
- if (!isJSONObject(customAlert)) {
45
- return void 0;
46
- }
47
- const queryJsonString = customAlert.queryJsonString;
48
- if (typeof queryJsonString !== "string") {
49
- return void 0;
50
- }
51
- let query;
52
- try {
53
- query = JSON.parse(queryJsonString);
54
- } catch {
55
- const message = "Invalid JSON in customAlert.queryJsonString.";
56
- outputAgentError(
57
- client,
58
- {
59
- status: "error",
60
- reason: AGENT_REASON.INVALID_ARGUMENTS,
61
- message,
62
- hint: "Provide queryJsonString as an escaped JSON string. Run `vercel alerts rules schema --type custom_alert` for examples."
63
- },
64
- 1
65
- );
66
- output_manager_default.error(message);
67
- return 1;
68
- }
69
- if (!isJSONObject(query)) {
70
- return void 0;
71
- }
72
- return { customAlert, query };
73
- }
74
- function setMissingCustomAlertProjectScope(parsedQuery, teamId, projectId, projectName) {
75
- const existingScope = parsedQuery.query.scope;
76
- if (existingScope !== void 0 && !isJSONObject(existingScope)) {
77
- return;
78
- }
79
- const projectScope = existingScope ?? {
80
- type: "project",
81
- ownerId: teamId,
82
- projectIds: [projectId]
83
- };
84
- if (!Object.hasOwn(projectScope, "projectId")) {
85
- projectScope.projectId = projectId;
86
- }
87
- if (projectName && !Object.hasOwn(projectScope, "projectName")) {
88
- projectScope.projectName = projectName;
89
- }
90
- parsedQuery.query.scope = projectScope;
91
- parsedQuery.customAlert.queryJsonString = JSON.stringify(parsedQuery.query);
92
- }
93
-
94
- export {
95
- resolveCustomAlertProjectName,
96
- parseCustomAlertQueryBody,
97
- setMissingCustomAlertProjectScope
98
- };
@@ -1,197 +0,0 @@
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
- isCustomAlertRule,
12
- parseCustomAlertQuery,
13
- renderAlertTable
14
- } from "./chunk-ARU7VBKR.js";
15
- import {
16
- emitRulesArgParseError,
17
- handleRulesApiError,
18
- parseRulesFlagsAndScope,
19
- rulesCollectionPath
20
- } from "./chunk-KEKR7OCB.js";
21
- import "./chunk-N4QHMXOO.js";
22
- import {
23
- formatGranularity
24
- } from "./chunk-5AJPMLDV.js";
25
- import "./chunk-A3NYPUKZ.js";
26
- import {
27
- normalizeRepeatableStringFilters
28
- } from "./chunk-KFWQ3EFH.js";
29
- import "./chunk-FGDKMNEN.js";
30
- import {
31
- truncateEnd
32
- } from "./chunk-ND5CF2H3.js";
33
- import {
34
- validateJsonOutput
35
- } from "./chunk-KXDWXXJH.js";
36
- import {
37
- rulesLsSubcommand
38
- } from "./chunk-XM3LOQIX.js";
39
- import "./chunk-GGP5R3FU.js";
40
- import {
41
- AGENT_REASON
42
- } from "./chunk-VUS2JQB2.js";
43
- import "./chunk-NW34PW6V.js";
44
- import "./chunk-4IVSM24H.js";
45
- import "./chunk-XNIZGCN5.js";
46
- import {
47
- printError
48
- } from "./chunk-3VM7HWF6.js";
49
- import {
50
- parseArguments
51
- } from "./chunk-57RHXXXG.js";
52
- import "./chunk-2TSBB22D.js";
53
- import "./chunk-G5FBSUL4.js";
54
- import {
55
- outputAgentError
56
- } from "./chunk-26CU4Q3C.js";
57
- import "./chunk-XPJLPUKO.js";
58
- import {
59
- isAPIError
60
- } from "./chunk-CV5YC2EN.js";
61
- import {
62
- getFlagsSpecification
63
- } from "./chunk-Q2DGFCO7.js";
64
- import {
65
- output_manager_default
66
- } from "./chunk-2JIX6UMI.js";
67
- import "./chunk-P4QNYOFB.js";
68
- import "./chunk-ZW6HETRE.js";
69
- import {
70
- require_source
71
- } from "./chunk-S7KYDPEM.js";
72
- import {
73
- __toESM
74
- } from "./chunk-TZ2YI2VH.js";
75
-
76
- // src/commands/alerts/rules/ls.ts
77
- var import_chalk = __toESM(require_source(), 1);
78
- function getCustomAlertRuleDetails(rule) {
79
- const customAlert = rule.customAlert;
80
- if (!isCustomAlertRule(rule) || !customAlert) {
81
- return "";
82
- }
83
- const metric = formatCustomAlertMetric(customAlert);
84
- const trigger = formatCustomAlertTrigger(customAlert);
85
- const min = typeof customAlert.minThreshold === "number" ? `min ${customAlert.minThreshold}` : void 0;
86
- const granularity = formatGranularity(
87
- parseCustomAlertQuery(customAlert.queryJsonString).granularity
88
- );
89
- const interval = granularity ? `every ${granularity}` : void 0;
90
- return [metric, trigger, min, interval].filter(Boolean).join("; ");
91
- }
92
- function ruleMatchesTypes(rule, types) {
93
- if (types.length === 0) {
94
- return true;
95
- }
96
- return rule.alertTypes?.some((alertType) => types.includes(alertType.type)) || types.includes("custom_alert") && isCustomAlertRule(rule);
97
- }
98
- function getRuleScope(rule) {
99
- return formatRuleScope(rule, {
100
- projectIdMaxLength: 24,
101
- filterMaxLength: 24
102
- });
103
- }
104
- function printRules(rules) {
105
- const showDetails = rules.some((rule) => getCustomAlertRuleDetails(rule));
106
- const headers = [
107
- "Name",
108
- "Rule id",
109
- "Scope",
110
- ...showDetails ? ["Details"] : []
111
- ].map((h) => import_chalk.default.cyan(h));
112
- const rows = [
113
- headers,
114
- ...rules.map((rule) => {
115
- const row = [
116
- import_chalk.default.bold(truncateEnd(rule.name || "-", 44)),
117
- import_chalk.default.dim(rule.id || "-"),
118
- getRuleScope(rule)
119
- ];
120
- if (showDetails) {
121
- row.push(truncateEnd(getCustomAlertRuleDetails(rule) || "-", 72));
122
- }
123
- return row;
124
- })
125
- ];
126
- output_manager_default.print(`
127
- ${renderAlertTable(rows, 2)}
128
- `);
129
- }
130
- async function ls(client, argv) {
131
- let parsedArgs;
132
- try {
133
- parsedArgs = parseArguments(
134
- argv,
135
- getFlagsSpecification(rulesLsSubcommand.options)
136
- );
137
- } catch (e) {
138
- emitRulesArgParseError(client, e, "alerts rules ls --project <name-or-id>");
139
- printError(e);
140
- return 1;
141
- }
142
- const flags = parsedArgs.flags;
143
- const fr = validateJsonOutput(flags);
144
- if (!fr.valid) {
145
- outputAgentError(
146
- client,
147
- {
148
- status: "error",
149
- reason: AGENT_REASON.INVALID_ARGUMENTS,
150
- message: fr.error
151
- },
152
- 1
153
- );
154
- output_manager_default.error(fr.error);
155
- return 1;
156
- }
157
- const scope = await parseRulesFlagsAndScope(
158
- client,
159
- {
160
- "--project": flags["--project"],
161
- "--all": flags["--all"]
162
- },
163
- fr.jsonOutput,
164
- "alerts rules ls"
165
- );
166
- if (typeof scope === "number") {
167
- return scope;
168
- }
169
- const path = rulesCollectionPath(scope);
170
- output_manager_default.spinner("Fetching alert rules...");
171
- try {
172
- const rules = await client.fetch(path);
173
- const types = normalizeRepeatableStringFilters(flags["--type"]);
174
- const filteredRules = rules.filter((rule) => ruleMatchesTypes(rule, types));
175
- if (fr.jsonOutput) {
176
- client.stdout.write(
177
- `${JSON.stringify({ rules: filteredRules }, null, 2)}
178
- `
179
- );
180
- } else if (filteredRules.length === 0) {
181
- output_manager_default.log("No alert rules found for this scope.");
182
- } else {
183
- printRules(filteredRules);
184
- }
185
- return 0;
186
- } catch (err) {
187
- if (isAPIError(err)) {
188
- return handleRulesApiError(client, err, fr.jsonOutput);
189
- }
190
- throw err;
191
- } finally {
192
- output_manager_default.stopSpinner();
193
- }
194
- }
195
- export {
196
- ls as default
197
- };