vercel 59.11.2 → 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 (173) hide show
  1. package/dist/chunks/{add-BKSHWTPX.js → add-OO3JGLZW.js} +23 -18
  2. package/dist/chunks/{add-HPLJZFM2.js → add-RTXDASSS.js} +23 -18
  3. package/dist/chunks/add-XGO6LHMD.js +221 -0
  4. package/dist/chunks/{build-V4ZLAJWB.js → build-JINV2UD4.js} +23 -18
  5. package/dist/chunks/{chunk-NGGLYKNU.js → chunk-26CU4Q3C.js} +3 -115
  6. package/dist/chunks/{chunk-QFAS4OVW.js → chunk-2JIX6UMI.js} +3 -84
  7. package/dist/chunks/chunk-2NIDTSQJ.js +305 -0
  8. package/dist/chunks/chunk-32XSMM3W.js +49 -0
  9. package/dist/chunks/chunk-332LMJLZ.js +16014 -0
  10. package/dist/chunks/{chunk-RO44KX6Y.js → chunk-3BB2HOO2.js} +12 -7
  11. package/dist/chunks/{chunk-HDBQPBL6.js → chunk-3F25W3GA.js} +13 -9
  12. package/dist/chunks/{chunk-AYLY3ZVL.js → chunk-3VM7HWF6.js} +2 -2
  13. package/dist/chunks/chunk-4IALDGB7.js +22 -0
  14. package/dist/chunks/{chunk-MTWHQEXI.js → chunk-4TUMNBEE.js} +7 -5
  15. package/dist/chunks/{chunk-5XECIWME.js → chunk-5NF5HOBJ.js} +5 -3
  16. package/dist/chunks/chunk-6E6KPBXY.js +43 -0
  17. package/dist/chunks/{chunk-ASBP32T6.js → chunk-7MRDIPJY.js} +1 -1
  18. package/dist/chunks/chunk-ABSZNJQO.js +522 -0
  19. package/dist/chunks/{chunk-7ST552E3.js → chunk-AKLTIZCU.js} +1 -1
  20. package/dist/chunks/{chunk-ONRLTUP2.js → chunk-AV747POV.js} +43 -36
  21. package/dist/chunks/chunk-B5XLQKHI.js +849 -0
  22. package/dist/chunks/{chunk-BMKU5KEL.js → chunk-CV5YC2EN.js} +1 -1
  23. package/dist/chunks/{chunk-TPATD2MM.js → chunk-CZ5QQRXD.js} +14 -6
  24. package/dist/chunks/{chunk-2EAIC3SH.js → chunk-E47NARDE.js} +8 -8
  25. package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
  26. package/dist/chunks/{chunk-QAT3CW4G.js → chunk-EFYMIIER.js} +2 -2
  27. package/dist/chunks/chunk-ELZ6WQQA.js +81 -0
  28. package/dist/chunks/{chunk-FKDO3CM4.js → chunk-EOLGLGXJ.js} +17 -13
  29. package/dist/chunks/chunk-FRVG4OW3.js +7438 -0
  30. package/dist/chunks/chunk-G5FBSUL4.js +822 -0
  31. package/dist/chunks/chunk-GDOUDU6O.js +74 -0
  32. package/dist/chunks/{chunk-OQ3C5VXZ.js → chunk-GVNCVKCI.js} +4 -2
  33. package/dist/chunks/chunk-HB4UKFDO.js +1295 -0
  34. package/dist/chunks/{chunk-FRAXI2WT.js → chunk-HD4DR3DA.js} +4 -3
  35. package/dist/chunks/{chunk-DWIC7MRV.js → chunk-HKHXKSXQ.js} +1 -1
  36. package/dist/chunks/{chunk-6JPVTPTU.js → chunk-HM24ZWQL.js} +4 -4
  37. package/dist/chunks/chunk-HR2MP4XF.js +324 -0
  38. package/dist/chunks/chunk-HRXRELD3.js +338 -0
  39. package/dist/chunks/{chunk-IJ4X426J.js → chunk-IIMSID24.js} +1 -1
  40. package/dist/chunks/{chunk-B4TXCKXE.js → chunk-JOXNBQ7W.js} +10 -8
  41. package/dist/chunks/{chunk-O75LSD3C.js → chunk-JSD4EZL3.js} +1 -1
  42. package/dist/chunks/{chunk-7AEEQOD4.js → chunk-K3RED3VO.js} +1 -1
  43. package/dist/chunks/chunk-KAF4WFF3.js +257 -0
  44. package/dist/chunks/{chunk-3T7WSWZH.js → chunk-KFWQ3EFH.js} +1 -1
  45. package/dist/chunks/{chunk-6CZZ3SH3.js → chunk-KNO327AW.js} +2 -2
  46. package/dist/chunks/{chunk-L3UXB2CW.js → chunk-KW7BS25T.js} +1 -1
  47. package/dist/chunks/{chunk-2NJJ2K5S.js → chunk-L6B6BRHH.js} +6 -6
  48. package/dist/chunks/{chunk-FZRBF25Y.js → chunk-LDV2R4P4.js} +4 -4
  49. package/dist/chunks/chunk-MADFAH3O.js +14059 -0
  50. package/dist/chunks/{chunk-OO3OF6MK.js → chunk-MDGPZHSM.js} +151 -26
  51. package/dist/chunks/{chunk-XRWOTCDO.js → chunk-ND5CF2H3.js} +1 -1
  52. package/dist/chunks/{chunk-6TBDHUXK.js → chunk-NDY3JDOU.js} +21 -15
  53. package/dist/chunks/{chunk-RKDCNQ4S.js → chunk-NW34PW6V.js} +3 -105
  54. package/dist/chunks/{chunk-C5HKWXRR.js → chunk-OAMU5QO6.js} +1 -1
  55. package/dist/chunks/{chunk-RSJBU3ON.js → chunk-OJHDGHOB.js} +35 -27
  56. package/dist/chunks/chunk-P7VSBDR4.js +827 -0
  57. package/dist/chunks/chunk-PEC3CQSK.js +90 -0
  58. package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
  59. package/dist/chunks/chunk-PNGVSHR3.js +40 -0
  60. package/dist/chunks/chunk-PP5GKSIX.js +137 -0
  61. package/dist/chunks/chunk-QB2UHSUB.js +58 -0
  62. package/dist/chunks/chunk-QIUK4Z7Q.js +79 -0
  63. package/dist/chunks/chunk-RN6V5ODW.js +114 -0
  64. package/dist/chunks/chunk-RNK3LXLR.js +1288 -0
  65. package/dist/chunks/chunk-RVBZ64EQ.js +52 -0
  66. package/dist/chunks/{chunk-WA2SJE5S.js → chunk-SWO66HE2.js} +4 -4
  67. package/dist/chunks/{chunk-NBW3BWOJ.js → chunk-TDGK45FB.js} +2 -2
  68. package/dist/chunks/{chunk-WNAKOXGK.js → chunk-TO7QZGYK.js} +1 -1
  69. package/dist/chunks/{chunk-QDV5LZ4Q.js → chunk-UA55I7M6.js} +12 -8
  70. package/dist/chunks/{chunk-FWKSJYDV.js → chunk-UG2WOB5L.js} +1 -1
  71. package/dist/chunks/chunk-UJPVHLL5.js +233 -0
  72. package/dist/chunks/chunk-V4RMJKQP.js +36 -0
  73. package/dist/chunks/chunk-VJSREJVM.js +875 -0
  74. package/dist/chunks/chunk-VUS2JQB2.js +121 -0
  75. package/dist/chunks/{chunk-4KVJ2M4J.js → chunk-WPBCUXMZ.js} +582 -37
  76. package/dist/chunks/chunk-WSZ5E4WH.js +92 -0
  77. package/dist/chunks/{chunk-Q5K5DEOK.js → chunk-WT2Y7FRD.js} +42 -28
  78. package/dist/chunks/chunk-WT6C2ALC.js +18188 -0
  79. package/dist/chunks/chunk-X6TGUHFD.js +59 -0
  80. package/dist/chunks/{chunk-ZSFEACZU.js → chunk-XFF5TGRA.js} +1 -1
  81. package/dist/chunks/chunk-XNIZGCN5.js +58 -0
  82. package/dist/chunks/chunk-XPJLPUKO.js +117 -0
  83. package/dist/chunks/{chunk-FXD67VN5.js → chunk-XUAWTW4W.js} +1 -1
  84. package/dist/chunks/chunk-YPMFZRTN.js +417 -0
  85. package/dist/chunks/chunk-YRESLJCW.js +1536 -0
  86. package/dist/chunks/{chunk-I526H4AS.js → chunk-YS76T533.js} +2 -2
  87. package/dist/chunks/{chunk-52QYYTM5.js → chunk-ZDU2NODC.js} +3 -127
  88. package/dist/chunks/chunk-ZW6HETRE.js +97 -0
  89. package/dist/chunks/{clear-IYGWCNXT.js → clear-GQTDYSKJ.js} +23 -18
  90. package/dist/chunks/{compile-vercel-config-NEEBZRUJ.js → compile-vercel-config-URVMKDVW.js} +8 -11
  91. package/dist/chunks/{config-6DS6BBR2.js → config-MSVQR5T6.js} +23 -18
  92. package/dist/chunks/{config-NTB5EMV4.js → config-OAXY4J6P.js} +23 -18
  93. package/dist/chunks/config-validator.mjs +1 -1
  94. package/dist/chunks/{delete-LSGID5FV.js → delete-57QO64HD.js} +19 -14
  95. package/dist/chunks/{delete-LLC2OGHA.js → delete-XN6ESD7C.js} +16 -12
  96. package/dist/chunks/detect-projects-ODNU4PK2.js +18 -0
  97. package/dist/chunks/detect-services-UPY4LTBZ.js +40 -0
  98. package/dist/chunks/{disable-H4EXEQK7.js → disable-BYI46V7B.js} +17 -13
  99. package/dist/chunks/{discard-FG6VKHWN.js → discard-IIQL44ZZ.js} +17 -13
  100. package/dist/chunks/{edit-BZJSGUHT.js → edit-BRNS3OR4.js} +19 -15
  101. package/dist/chunks/{edit-YE7D3CPJ.js → edit-JTW7XZH7.js} +17 -13
  102. package/dist/chunks/{enable-6ESD4QTE.js → enable-CH5FSQMR.js} +17 -13
  103. package/dist/chunks/{exec-XH4K34JM.js → exec-4IPHZ55G.js} +9 -5
  104. package/dist/chunks/{export-QWSJROLG.js → export-6WHQOWKM.js} +16 -13
  105. package/dist/chunks/{image-LTHQMKFG.js → image-ZSLYATWG.js} +11 -8
  106. package/dist/chunks/{import-builders-6O7ILGQJ.js → import-builders-FNMYJZGG.js} +18 -13
  107. package/dist/chunks/{inspect-2C4ZSNYC.js → inspect-4RDZSYWU.js} +27 -23
  108. package/dist/chunks/{inspect-N6SMHV3Z.js → inspect-7WQXZWET.js} +18 -14
  109. package/dist/chunks/{inspect-F7KCTHIL.js → inspect-CGXTNMMO.js} +19 -15
  110. package/dist/chunks/{inspect-ICKNCDMT.js → inspect-XJ7BYLZ5.js} +18 -14
  111. package/dist/chunks/{inspect-TWDPMXZ5.js → inspect-Z2MBTTB7.js} +18 -14
  112. package/dist/chunks/{list-NWTIJF3L.js → list-65LW6OTM.js} +20 -16
  113. package/dist/chunks/{list-DS7ZOUXA.js → list-7W3PHRB6.js} +25 -21
  114. package/dist/chunks/{list-IPGQVBJO.js → list-KS22Y57L.js} +16 -14
  115. package/dist/chunks/{login-F7A7ONKC.js → login-NXULVQZ2.js} +23 -18
  116. package/dist/chunks/{ls-2QW3ZSM6.js → ls-35EOVEIQ.js} +24 -18
  117. package/dist/chunks/{ls-XINES6PL.js → ls-5GKS5QRW.js} +24 -18
  118. package/dist/chunks/ls-ADYFYYIW.js +204 -0
  119. package/dist/chunks/{ls-D4TUDBIH.js → ls-DZYN3SNS.js} +24 -18
  120. package/dist/chunks/{ls-LSJEUPFX.js → ls-HVQOGBGV.js} +23 -16
  121. package/dist/chunks/{ls-NBDX3MKN.js → ls-I2PWG7YN.js} +24 -18
  122. package/dist/chunks/{open-VRQDWZAW.js → open-H34HXJHP.js} +18 -13
  123. package/dist/chunks/{permissions-6C5C7TEV.js → permissions-ZPPEPKVE.js} +14 -11
  124. package/dist/chunks/{publish-GVIZPNLN.js → publish-NRMKXHAU.js} +17 -13
  125. package/dist/chunks/pull-WUT3XTZX.js +45 -0
  126. package/dist/chunks/{push-EFZ5P5Z6.js → push-WFNCEA5J.js} +23 -18
  127. package/dist/chunks/{query-GBS2PIT4.js → query-2FQM3F7N.js} +23 -20
  128. package/dist/chunks/{reorder-TN65IFRL.js → reorder-GYCT7L3C.js} +17 -13
  129. package/dist/chunks/{reply-DYVEV3PY.js → reply-RFEXNYZ7.js} +17 -13
  130. package/dist/chunks/{resolve-JAWFBPUM.js → resolve-ZFGT7W6Z.js} +16 -12
  131. package/dist/chunks/resolve-deployment-framework-preset-NPE6RLV3.js +36 -0
  132. package/dist/chunks/{restore-TJVMHUBQ.js → restore-JAXPMYL5.js} +17 -13
  133. package/dist/chunks/rm-CLKQN5E4.js +162 -0
  134. package/dist/chunks/{rm-HQ5CYNJA.js → rm-JPV5V2SH.js} +23 -18
  135. package/dist/chunks/{rm-7XACNZ2U.js → rm-N7SGFQOA.js} +23 -18
  136. package/dist/chunks/{rm-REJVXALW.js → rm-UQJ4CZJH.js} +23 -18
  137. package/dist/chunks/{rm-CBPNMSRP.js → rm-ZUQ4U454.js} +24 -17
  138. package/dist/chunks/{routes-2OLIBRYX.js → routes-QVMBXOSX.js} +7 -3
  139. package/dist/chunks/rule-inspect-HI3YY7OY.js +123 -0
  140. package/dist/chunks/{rules-VGV4M4KY.js → rules-DA3Q64M4.js} +15 -12
  141. package/dist/chunks/{schema-GMTQOQCV.js → schema-R3C4CXJ6.js} +20 -18
  142. package/dist/chunks/schema-UYYFV3JB.js +381 -0
  143. package/dist/chunks/{set-Z5FO2FCC.js → set-TOJPGW4J.js} +21 -14
  144. package/dist/chunks/setup-and-link-DRYXQOH4.js +65 -0
  145. package/dist/chunks/{tags-SDRXWJ63.js → tags-TNLVFNVI.js} +10 -7
  146. package/dist/chunks/{types-JGANJ5EQ.js → types-4GAJ7XQQ.js} +9 -7
  147. package/dist/chunks/update-X6JB3NPI.js +224 -0
  148. package/dist/chunks/vlt-builder-importer-USCFHWPL.js +322 -0
  149. package/dist/commands/build/index.js +86 -49
  150. package/dist/commands/deploy/index.js +76 -67
  151. package/dist/commands/dev/index.js +98 -52
  152. package/dist/commands/env/index.js +68 -44
  153. package/dist/commands/link/index.js +49 -28
  154. package/dist/commands/list/index.js +33 -22
  155. package/dist/commands-bulk.js +8715 -3581
  156. package/dist/help.js +1 -1
  157. package/dist/index.js +74 -42
  158. package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +6 -0
  159. package/dist/version.mjs +1 -1
  160. package/package.json +52 -48
  161. package/dist/chunks/add-RBW7QITR.js +0 -219
  162. package/dist/chunks/chunk-26XDDLXM.js +0 -144
  163. package/dist/chunks/chunk-5GGUB4EO.js +0 -31
  164. package/dist/chunks/chunk-MXLA3VQS.js +0 -20
  165. package/dist/chunks/chunk-OTXE7MHI.js +0 -96
  166. package/dist/chunks/chunk-RSEAADCE.js +0 -138
  167. package/dist/chunks/chunk-WYU64FLP.js +0 -62123
  168. package/dist/chunks/chunk-XNFHNTS2.js +0 -2939
  169. package/dist/chunks/ls-RNGO257R.js +0 -193
  170. package/dist/chunks/rm-5B5VHWWN.js +0 -170
  171. package/dist/chunks/rule-inspect-ZSTDDFID.js +0 -281
  172. package/dist/chunks/schema-45SJNY5L.js +0 -427
  173. package/dist/chunks/update-JBQBC3IV.js +0 -233
@@ -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-XRWOTCDO.js";
16
- import {
17
- table
18
- } from "./chunk-RKDCNQ4S.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,31 +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/traces/scope-resolver.ts
9
- var MISSING_BOTH_MESSAGE = "No linked project found. Run `vercel link`, pass --cwd to a linked dir, or use --scope <team> and --project <name>.";
10
- function resolveScope({
11
- flags = {},
12
- linkedProject
13
- }) {
14
- const flagScope = flags.scope?.trim() || void 0;
15
- const flagProject = flags.project?.trim() || void 0;
16
- if (linkedProject.status === "linked") {
17
- return {
18
- teamId: flagScope ?? linkedProject.org.id,
19
- projectId: flagProject ?? linkedProject.project.id
20
- };
21
- }
22
- if (flagScope && flagProject) {
23
- return { teamId: flagScope, projectId: flagProject };
24
- }
25
- return { message: MISSING_BOTH_MESSAGE };
26
- }
27
-
28
- export {
29
- MISSING_BOTH_MESSAGE,
30
- resolveScope
31
- };
@@ -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,96 +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-Q5K5DEOK.js";
10
- import {
11
- getProjectByNameOrId
12
- } from "./chunk-WYU64FLP.js";
13
- import {
14
- AGENT_REASON,
15
- outputAgentError
16
- } from "./chunk-NGGLYKNU.js";
17
- import {
18
- ProjectNotFound,
19
- isAPIError
20
- } from "./chunk-BMKU5KEL.js";
21
- import {
22
- output_manager_default
23
- } from "./chunk-QFAS4OVW.js";
24
-
25
- // src/commands/alerts/rules/custom-alert-query.ts
26
- async function resolveCustomAlertProjectName(client, scope, projectId) {
27
- if (scope.projectId === projectId && scope.projectName) {
28
- return scope.projectName;
29
- }
30
- try {
31
- const project = await getProjectByNameOrId(client, projectId, scope.teamId);
32
- return project instanceof ProjectNotFound ? void 0 : project.name;
33
- } catch (error) {
34
- if (isAPIError(error)) {
35
- return void 0;
36
- }
37
- throw error;
38
- }
39
- }
40
- function parseCustomAlertQueryBody(client, body) {
41
- const customAlert = body.customAlert;
42
- if (!isJSONObject(customAlert)) {
43
- return void 0;
44
- }
45
- const queryJsonString = customAlert.queryJsonString;
46
- if (typeof queryJsonString !== "string") {
47
- return void 0;
48
- }
49
- let query;
50
- try {
51
- query = JSON.parse(queryJsonString);
52
- } catch {
53
- const message = "Invalid JSON in customAlert.queryJsonString.";
54
- outputAgentError(
55
- client,
56
- {
57
- status: "error",
58
- reason: AGENT_REASON.INVALID_ARGUMENTS,
59
- message,
60
- hint: "Provide queryJsonString as an escaped JSON string. Run `vercel alerts rules schema --type custom_alert` for examples."
61
- },
62
- 1
63
- );
64
- output_manager_default.error(message);
65
- return 1;
66
- }
67
- if (!isJSONObject(query)) {
68
- return void 0;
69
- }
70
- return { customAlert, query };
71
- }
72
- function setMissingCustomAlertProjectScope(parsedQuery, teamId, projectId, projectName) {
73
- const existingScope = parsedQuery.query.scope;
74
- if (existingScope !== void 0 && !isJSONObject(existingScope)) {
75
- return;
76
- }
77
- const projectScope = existingScope ?? {
78
- type: "project",
79
- ownerId: teamId,
80
- projectIds: [projectId]
81
- };
82
- if (!Object.hasOwn(projectScope, "projectId")) {
83
- projectScope.projectId = projectId;
84
- }
85
- if (projectName && !Object.hasOwn(projectScope, "projectName")) {
86
- projectScope.projectName = projectName;
87
- }
88
- parsedQuery.query.scope = projectScope;
89
- parsedQuery.customAlert.queryJsonString = JSON.stringify(parsedQuery.query);
90
- }
91
-
92
- export {
93
- resolveCustomAlertProjectName,
94
- parseCustomAlertQueryBody,
95
- setMissingCustomAlertProjectScope
96
- };
@@ -1,138 +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-RO44KX6Y.js";
10
- import {
11
- handleValidationError,
12
- outputError,
13
- validateAllProjectMutualExclusivity
14
- } from "./chunk-3T7WSWZH.js";
15
- import {
16
- AGENT_REASON,
17
- buildCommandWithGlobalFlags,
18
- outputAgentError
19
- } from "./chunk-NGGLYKNU.js";
20
-
21
- // src/commands/alerts/rules/parse-scope.ts
22
- async function parseRulesFlagsAndScope(client, flags, jsonOutput, command = "alerts rules ls") {
23
- const mutual = validateAllProjectMutualExclusivity(
24
- flags["--all"],
25
- flags["--project"]
26
- );
27
- if (!mutual.valid) {
28
- outputAgentError(
29
- client,
30
- {
31
- status: "error",
32
- reason: AGENT_REASON.INVALID_ARGUMENTS,
33
- message: mutual.message,
34
- next: [
35
- {
36
- command: buildCommandWithGlobalFlags(
37
- client.argv,
38
- "alerts rules --help"
39
- ),
40
- when: "Use either `--project` or `--all`, not both"
41
- }
42
- ]
43
- },
44
- 1
45
- );
46
- return handleValidationError(mutual, jsonOutput, client);
47
- }
48
- return resolveAlertsScope(client, {
49
- project: flags["--project"],
50
- all: flags["--all"],
51
- jsonOutput,
52
- command
53
- });
54
- }
55
-
56
- // src/commands/alerts/rules/util.ts
57
- function buildRulesQuery(scope) {
58
- const query = new URLSearchParams({ teamId: scope.teamId });
59
- if (scope.projectId) {
60
- query.set("projectId", scope.projectId);
61
- }
62
- return query;
63
- }
64
- function rulesCollectionPath(scope) {
65
- return `/alerts/v2/alert-rules?${buildRulesQuery(scope).toString()}`;
66
- }
67
- function rulesItemPath(scope, ruleId) {
68
- const query = new URLSearchParams({ teamId: scope.teamId });
69
- return `/alerts/v2/alert-rules/${encodeURIComponent(ruleId)}?${query.toString()}`;
70
- }
71
- function handleRulesApiError(client, err, jsonOutput) {
72
- 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}).`;
73
- 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;
74
- outputAgentError(
75
- client,
76
- {
77
- status: "error",
78
- reason,
79
- message,
80
- ...err.status === 401 || err.status === 403 ? {
81
- hint: "Confirm team scope with whoami; use --scope <team-slug> if the rule lives under another team.",
82
- next: [
83
- {
84
- command: buildCommandWithGlobalFlags(client.argv, "whoami"),
85
- when: "See current user and team"
86
- },
87
- {
88
- command: buildCommandWithGlobalFlags(
89
- client.argv,
90
- "alerts rules ls"
91
- ),
92
- when: "Retry listing rules after fixing scope or permissions"
93
- }
94
- ]
95
- } : {}
96
- },
97
- 1
98
- );
99
- return outputError(client, jsonOutput, err.code || "API_ERROR", message);
100
- }
101
- function emitRulesArgParseError(client, err, recoverWithProjectFlag) {
102
- const msg = err instanceof Error ? err.message : String(err);
103
- const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
104
- outputAgentError(
105
- client,
106
- {
107
- status: "error",
108
- reason: AGENT_REASON.INVALID_ARGUMENTS,
109
- message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
110
- next: projectFlagMissingArg ? [
111
- {
112
- command: buildCommandWithGlobalFlags(
113
- client.argv,
114
- recoverWithProjectFlag
115
- ),
116
- when: "Re-run with a project name or id (replace placeholder)"
117
- }
118
- ] : [
119
- {
120
- command: buildCommandWithGlobalFlags(
121
- client.argv,
122
- "alerts rules --help"
123
- ),
124
- when: "See valid `alerts rules` subcommands"
125
- }
126
- ]
127
- },
128
- 1
129
- );
130
- }
131
-
132
- export {
133
- parseRulesFlagsAndScope,
134
- rulesCollectionPath,
135
- rulesItemPath,
136
- handleRulesApiError,
137
- emitRulesArgParseError
138
- };