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,193 +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
- emitRulesArgParseError,
9
- handleRulesApiError,
10
- parseRulesFlagsAndScope,
11
- rulesCollectionPath
12
- } from "./chunk-RSEAADCE.js";
13
- import {
14
- formatCustomAlertMetric,
15
- formatCustomAlertTrigger,
16
- formatRuleScope,
17
- isCustomAlertRule,
18
- parseCustomAlertQuery,
19
- renderAlertTable
20
- } from "./chunk-26XDDLXM.js";
21
- import "./chunk-RO44KX6Y.js";
22
- import {
23
- formatGranularity
24
- } from "./chunk-5AJPMLDV.js";
25
- import "./chunk-A3NYPUKZ.js";
26
- import {
27
- normalizeRepeatableStringFilters
28
- } from "./chunk-3T7WSWZH.js";
29
- import "./chunk-FGDKMNEN.js";
30
- import {
31
- truncateEnd
32
- } from "./chunk-XRWOTCDO.js";
33
- import {
34
- validateJsonOutput
35
- } from "./chunk-KXDWXXJH.js";
36
- import {
37
- rulesLsSubcommand
38
- } from "./chunk-XM3LOQIX.js";
39
- import "./chunk-WYU64FLP.js";
40
- import "./chunk-FXD67VN5.js";
41
- import "./chunk-XNFHNTS2.js";
42
- import {
43
- AGENT_REASON,
44
- outputAgentError
45
- } from "./chunk-NGGLYKNU.js";
46
- import "./chunk-GGP5R3FU.js";
47
- import {
48
- printError
49
- } from "./chunk-AYLY3ZVL.js";
50
- import {
51
- parseArguments
52
- } from "./chunk-57RHXXXG.js";
53
- import "./chunk-RKDCNQ4S.js";
54
- import {
55
- isAPIError
56
- } from "./chunk-BMKU5KEL.js";
57
- import {
58
- getFlagsSpecification
59
- } from "./chunk-Q2DGFCO7.js";
60
- import "./chunk-P4QNYOFB.js";
61
- import "./chunk-52QYYTM5.js";
62
- import {
63
- output_manager_default
64
- } from "./chunk-QFAS4OVW.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/ls.ts
73
- var import_chalk = __toESM(require_source(), 1);
74
- function getCustomAlertRuleDetails(rule) {
75
- const customAlert = rule.customAlert;
76
- if (!isCustomAlertRule(rule) || !customAlert) {
77
- return "";
78
- }
79
- const metric = formatCustomAlertMetric(customAlert);
80
- const trigger = formatCustomAlertTrigger(customAlert);
81
- const min = typeof customAlert.minThreshold === "number" ? `min ${customAlert.minThreshold}` : void 0;
82
- const granularity = formatGranularity(
83
- parseCustomAlertQuery(customAlert.queryJsonString).granularity
84
- );
85
- const interval = granularity ? `every ${granularity}` : void 0;
86
- return [metric, trigger, min, interval].filter(Boolean).join("; ");
87
- }
88
- function ruleMatchesTypes(rule, types) {
89
- if (types.length === 0) {
90
- return true;
91
- }
92
- return rule.alertTypes?.some((alertType) => types.includes(alertType.type)) || types.includes("custom_alert") && isCustomAlertRule(rule);
93
- }
94
- function getRuleScope(rule) {
95
- return formatRuleScope(rule, {
96
- projectIdMaxLength: 24,
97
- filterMaxLength: 24
98
- });
99
- }
100
- function printRules(rules) {
101
- const showDetails = rules.some((rule) => getCustomAlertRuleDetails(rule));
102
- const headers = [
103
- "Name",
104
- "Rule id",
105
- "Scope",
106
- ...showDetails ? ["Details"] : []
107
- ].map((h) => import_chalk.default.cyan(h));
108
- const rows = [
109
- headers,
110
- ...rules.map((rule) => {
111
- const row = [
112
- import_chalk.default.bold(truncateEnd(rule.name || "-", 44)),
113
- import_chalk.default.dim(rule.id || "-"),
114
- getRuleScope(rule)
115
- ];
116
- if (showDetails) {
117
- row.push(truncateEnd(getCustomAlertRuleDetails(rule) || "-", 72));
118
- }
119
- return row;
120
- })
121
- ];
122
- output_manager_default.print(`
123
- ${renderAlertTable(rows, 2)}
124
- `);
125
- }
126
- async function ls(client, argv) {
127
- let parsedArgs;
128
- try {
129
- parsedArgs = parseArguments(
130
- argv,
131
- getFlagsSpecification(rulesLsSubcommand.options)
132
- );
133
- } catch (e) {
134
- emitRulesArgParseError(client, e, "alerts rules ls --project <name-or-id>");
135
- printError(e);
136
- return 1;
137
- }
138
- const flags = parsedArgs.flags;
139
- const fr = validateJsonOutput(flags);
140
- if (!fr.valid) {
141
- outputAgentError(
142
- client,
143
- {
144
- status: "error",
145
- reason: AGENT_REASON.INVALID_ARGUMENTS,
146
- message: fr.error
147
- },
148
- 1
149
- );
150
- output_manager_default.error(fr.error);
151
- return 1;
152
- }
153
- const scope = await parseRulesFlagsAndScope(
154
- client,
155
- {
156
- "--project": flags["--project"],
157
- "--all": flags["--all"]
158
- },
159
- fr.jsonOutput,
160
- "alerts rules ls"
161
- );
162
- if (typeof scope === "number") {
163
- return scope;
164
- }
165
- const path = rulesCollectionPath(scope);
166
- output_manager_default.spinner("Fetching alert rules...");
167
- try {
168
- const rules = await client.fetch(path);
169
- const types = normalizeRepeatableStringFilters(flags["--type"]);
170
- const filteredRules = rules.filter((rule) => ruleMatchesTypes(rule, types));
171
- if (fr.jsonOutput) {
172
- client.stdout.write(
173
- `${JSON.stringify({ rules: filteredRules }, null, 2)}
174
- `
175
- );
176
- } else if (filteredRules.length === 0) {
177
- output_manager_default.log("No alert rules found for this scope.");
178
- } else {
179
- printRules(filteredRules);
180
- }
181
- return 0;
182
- } catch (err) {
183
- if (isAPIError(err)) {
184
- return handleRulesApiError(client, err, fr.jsonOutput);
185
- }
186
- throw err;
187
- } finally {
188
- output_manager_default.stopSpinner();
189
- }
190
- }
191
- export {
192
- ls as default
193
- };
@@ -1,170 +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
- emitRulesArgParseError,
9
- handleRulesApiError,
10
- parseRulesFlagsAndScope,
11
- rulesItemPath
12
- } from "./chunk-RSEAADCE.js";
13
- import "./chunk-RO44KX6Y.js";
14
- import "./chunk-3T7WSWZH.js";
15
- import {
16
- validateJsonOutput
17
- } from "./chunk-KXDWXXJH.js";
18
- import {
19
- rulesRmSubcommand
20
- } from "./chunk-XM3LOQIX.js";
21
- import "./chunk-WYU64FLP.js";
22
- import "./chunk-FXD67VN5.js";
23
- import "./chunk-XNFHNTS2.js";
24
- import {
25
- AGENT_REASON,
26
- buildCommandWithGlobalFlags,
27
- buildCommandWithYes,
28
- outputAgentError
29
- } from "./chunk-NGGLYKNU.js";
30
- import "./chunk-GGP5R3FU.js";
31
- import {
32
- printError
33
- } from "./chunk-AYLY3ZVL.js";
34
- import {
35
- parseArguments
36
- } from "./chunk-57RHXXXG.js";
37
- import "./chunk-RKDCNQ4S.js";
38
- import {
39
- isAPIError
40
- } from "./chunk-BMKU5KEL.js";
41
- import {
42
- getFlagsSpecification,
43
- packageName
44
- } from "./chunk-Q2DGFCO7.js";
45
- import "./chunk-P4QNYOFB.js";
46
- import "./chunk-52QYYTM5.js";
47
- import {
48
- output_manager_default
49
- } from "./chunk-QFAS4OVW.js";
50
- import "./chunk-S7KYDPEM.js";
51
- import "./chunk-TZ2YI2VH.js";
52
-
53
- // src/commands/alerts/rules/rm.ts
54
- async function rm(client, argv) {
55
- let parsedArgs;
56
- try {
57
- parsedArgs = parseArguments(
58
- argv,
59
- getFlagsSpecification(rulesRmSubcommand.options)
60
- );
61
- } catch (e) {
62
- emitRulesArgParseError(
63
- client,
64
- e,
65
- "alerts rules rm <ruleId> --project <name-or-id> --yes"
66
- );
67
- printError(e);
68
- return 1;
69
- }
70
- const ruleId = parsedArgs.args[0];
71
- const fr = validateJsonOutput(parsedArgs.flags);
72
- if (!fr.valid) {
73
- outputAgentError(
74
- client,
75
- {
76
- status: "error",
77
- reason: AGENT_REASON.INVALID_ARGUMENTS,
78
- message: fr.error
79
- },
80
- 1
81
- );
82
- output_manager_default.error(fr.error);
83
- return 1;
84
- }
85
- if (!ruleId) {
86
- outputAgentError(
87
- client,
88
- {
89
- status: "error",
90
- reason: AGENT_REASON.MISSING_ARGUMENTS,
91
- message: `Missing rule id. Example: ${packageName} alerts rules rm <ruleId> --yes`,
92
- next: [
93
- {
94
- command: buildCommandWithGlobalFlags(
95
- client.argv,
96
- "alerts rules rm <ruleId> --yes"
97
- ),
98
- when: "Replace <ruleId> with an id from `alerts rules ls`"
99
- },
100
- {
101
- command: buildCommandWithGlobalFlags(
102
- client.argv,
103
- "alerts rules ls"
104
- ),
105
- when: "List rule ids in the current scope"
106
- }
107
- ]
108
- },
109
- 1
110
- );
111
- output_manager_default.error("Usage: `vercel alerts rules rm <ruleId>`");
112
- return 1;
113
- }
114
- const skipConfirmation = Boolean(parsedArgs.flags["--yes"]);
115
- const scope = await parseRulesFlagsAndScope(
116
- client,
117
- {
118
- "--project": parsedArgs.flags["--project"],
119
- "--all": parsedArgs.flags["--all"]
120
- },
121
- fr.jsonOutput,
122
- `alerts rules rm ${ruleId}`
123
- );
124
- if (typeof scope === "number") {
125
- return scope;
126
- }
127
- if (!skipConfirmation) {
128
- outputAgentError(
129
- client,
130
- {
131
- status: "error",
132
- reason: AGENT_REASON.CONFIRMATION_REQUIRED,
133
- message: "Removing an alert rule requires confirmation. Re-run with --yes.",
134
- next: [{ command: buildCommandWithYes(client.argv) }]
135
- },
136
- 1
137
- );
138
- if (!await client.input.confirm(
139
- `Delete alert rule ${ruleId}? This cannot be undone.`,
140
- false
141
- )) {
142
- output_manager_default.log("Canceled");
143
- return 0;
144
- }
145
- }
146
- const path = rulesItemPath(scope, ruleId);
147
- output_manager_default.spinner("Deleting alert rule...");
148
- try {
149
- await client.fetch(path, { method: "DELETE" });
150
- if (fr.jsonOutput) {
151
- client.stdout.write(
152
- `${JSON.stringify({ ok: true, ruleId, deleted: true }, null, 2)}
153
- `
154
- );
155
- } else {
156
- output_manager_default.success(`Deleted alert rule ${ruleId}`);
157
- }
158
- return 0;
159
- } catch (err) {
160
- if (isAPIError(err)) {
161
- return handleRulesApiError(client, err, fr.jsonOutput);
162
- }
163
- throw err;
164
- } finally {
165
- output_manager_default.stopSpinner();
166
- }
167
- }
168
- export {
169
- rm as default
170
- };
@@ -1,281 +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
- emitRulesArgParseError,
9
- handleRulesApiError,
10
- parseRulesFlagsAndScope,
11
- rulesItemPath
12
- } from "./chunk-RSEAADCE.js";
13
- import {
14
- formatCustomAlertMetric,
15
- formatCustomAlertTrigger,
16
- formatRuleScope,
17
- humanizeReference,
18
- isCustomAlertRule,
19
- parseCustomAlertQuery,
20
- renderAlertTable
21
- } from "./chunk-26XDDLXM.js";
22
- import "./chunk-RO44KX6Y.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-3T7WSWZH.js";
31
- import "./chunk-FGDKMNEN.js";
32
- import "./chunk-PRWJUY5U.js";
33
- import {
34
- truncateMiddle
35
- } from "./chunk-XRWOTCDO.js";
36
- import {
37
- validateJsonOutput
38
- } from "./chunk-KXDWXXJH.js";
39
- import {
40
- rulesInspectSubcommand
41
- } from "./chunk-XM3LOQIX.js";
42
- import "./chunk-WYU64FLP.js";
43
- import "./chunk-FXD67VN5.js";
44
- import "./chunk-XNFHNTS2.js";
45
- import {
46
- AGENT_REASON,
47
- buildCommandWithGlobalFlags,
48
- outputAgentError
49
- } from "./chunk-NGGLYKNU.js";
50
- import "./chunk-GGP5R3FU.js";
51
- import {
52
- printError
53
- } from "./chunk-AYLY3ZVL.js";
54
- import {
55
- parseArguments
56
- } from "./chunk-57RHXXXG.js";
57
- import "./chunk-RKDCNQ4S.js";
58
- import {
59
- isAPIError
60
- } from "./chunk-BMKU5KEL.js";
61
- import {
62
- getFlagsSpecification,
63
- packageName
64
- } from "./chunk-Q2DGFCO7.js";
65
- import "./chunk-P4QNYOFB.js";
66
- import "./chunk-52QYYTM5.js";
67
- import {
68
- output_manager_default
69
- } from "./chunk-QFAS4OVW.js";
70
- import {
71
- require_source
72
- } from "./chunk-S7KYDPEM.js";
73
- import {
74
- __toESM
75
- } from "./chunk-TZ2YI2VH.js";
76
-
77
- // src/commands/alerts/rules/rule-inspect.ts
78
- var import_chalk = __toESM(require_source(), 1);
79
- function formatBoolean(value) {
80
- if (value === void 0) {
81
- return "-";
82
- }
83
- return value ? "yes" : "no";
84
- }
85
- function getAlertTypeRows(rule) {
86
- const types = rule.alertTypes?.map((alertType) => alertType.type) ?? (rule.customAlert ? ["custom_alert"] : []);
87
- if (types.length === 0) {
88
- return [];
89
- }
90
- const uniqueTypes = [...new Set(types)];
91
- return [
92
- [
93
- uniqueTypes.length === 1 ? "Type" : "Types",
94
- uniqueTypes.map((value) => humanizeReference(value)).join(", ")
95
- ]
96
- ];
97
- }
98
- function getNotificationRows(rule) {
99
- const rows = [];
100
- if (rule.autosubscribeOwnersInKnock !== void 0) {
101
- rows.push([
102
- "Auto-subscribe owners",
103
- formatBoolean(rule.autosubscribeOwnersInKnock)
104
- ]);
105
- }
106
- const slackChannels = /* @__PURE__ */ new Set();
107
- const webhooks = /* @__PURE__ */ new Set();
108
- for (const notification of rule.notifications ?? []) {
109
- for (const channel of notification.slack ?? []) {
110
- slackChannels.add(channel);
111
- }
112
- for (const webhook of notification.webhooks ?? []) {
113
- webhooks.add(webhook);
114
- }
115
- }
116
- if (slackChannels.size > 0) {
117
- rows.push(["Slack", [...slackChannels].join(", ")]);
118
- }
119
- if (webhooks.size > 0) {
120
- rows.push(["Webhooks", [...webhooks].join(", ")]);
121
- }
122
- return rows;
123
- }
124
- function getCustomAlertRows(customAlert) {
125
- const query = parseCustomAlertQuery(customAlert.queryJsonString);
126
- const granularity = formatGranularity(query.granularity);
127
- const groupBy = query.groupBy ?? [];
128
- const rows = [
129
- ["Title", customAlert.title || "-"],
130
- ["Metric", formatCustomAlertMetric(customAlert) || "-"],
131
- ["Trigger", formatCustomAlertTrigger(customAlert) || "-"],
132
- ...typeof customAlert.minThreshold === "number" ? [["Minimum", String(customAlert.minThreshold)]] : [],
133
- ...query.event ? [["Event", humanizeReference(query.event)]] : [],
134
- ...groupBy.length > 0 ? [
135
- [
136
- "Group By",
137
- groupBy.map((value) => humanizeReference(value)).join(", ")
138
- ]
139
- ] : [],
140
- ...granularity ? [["Granularity", granularity]] : [],
141
- ...customAlert.createdAt ? [["Created At", formatDate(customAlert.createdAt)]] : []
142
- ];
143
- return rows.map(([label, value]) => [label, truncateMiddle(value, 96)]);
144
- }
145
- function printRule(rule, ruleId) {
146
- const summaryRows = [
147
- ["Name", rule.name || "-"],
148
- ...rule.action === "exclude" ? [["Action", rule.action]] : [],
149
- ["Scope", formatRuleScope(rule)],
150
- ...getAlertTypeRows(rule),
151
- ...rule.isDefault !== void 0 ? [["Default", formatBoolean(rule.isDefault)]] : [],
152
- ...rule.owner ? [["Owner", rule.owner]] : [],
153
- ...rule.teamId ? [["Team id", rule.teamId]] : [],
154
- ...rule.lastEditedByUserId ? [["Last Edited By", rule.lastEditedByUserId]] : [],
155
- ...rule.odataFilters ? [["OData Filters", rule.odataFilters]] : []
156
- ];
157
- const sections = [
158
- "",
159
- `${import_chalk.default.bold("Alert rule")} ${import_chalk.default.cyan(rule.id || ruleId)}`,
160
- renderAlertTable(summaryRows, 3)
161
- ];
162
- const notificationRows = getNotificationRows(rule);
163
- if (notificationRows.length > 0) {
164
- sections.push(
165
- "",
166
- import_chalk.default.cyan("Notifications"),
167
- renderAlertTable(notificationRows, 3)
168
- );
169
- }
170
- if (rule.customAlert) {
171
- sections.push(
172
- "",
173
- import_chalk.default.cyan("Custom Alert"),
174
- renderAlertTable(getCustomAlertRows(rule.customAlert), 3)
175
- );
176
- } else if (isCustomAlertRule(rule)) {
177
- sections.push(
178
- "",
179
- import_chalk.default.cyan("Custom Alert"),
180
- " No custom alert definition returned."
181
- );
182
- }
183
- output_manager_default.print(`${sections.join("\n")}
184
- `);
185
- }
186
- async function ruleInspect(client, argv) {
187
- let parsedArgs;
188
- try {
189
- parsedArgs = parseArguments(
190
- argv,
191
- getFlagsSpecification(rulesInspectSubcommand.options)
192
- );
193
- } catch (e) {
194
- emitRulesArgParseError(
195
- client,
196
- e,
197
- "alerts rules inspect <ruleId> --project <name-or-id>"
198
- );
199
- printError(e);
200
- return 1;
201
- }
202
- const ruleId = parsedArgs.args[0];
203
- const fr = validateJsonOutput(parsedArgs.flags);
204
- if (!fr.valid) {
205
- outputAgentError(
206
- client,
207
- {
208
- status: "error",
209
- reason: AGENT_REASON.INVALID_ARGUMENTS,
210
- message: fr.error
211
- },
212
- 1
213
- );
214
- output_manager_default.error(fr.error);
215
- return 1;
216
- }
217
- if (!ruleId) {
218
- outputAgentError(
219
- client,
220
- {
221
- status: "error",
222
- reason: AGENT_REASON.MISSING_ARGUMENTS,
223
- message: `Missing rule id. Example: ${packageName} alerts rules inspect <ruleId>`,
224
- next: [
225
- {
226
- command: buildCommandWithGlobalFlags(
227
- client.argv,
228
- "alerts rules inspect <ruleId>"
229
- ),
230
- when: "Replace <ruleId> with an id from `alerts rules ls`"
231
- },
232
- {
233
- command: buildCommandWithGlobalFlags(
234
- client.argv,
235
- "alerts rules ls"
236
- ),
237
- when: "List rule ids in the current scope"
238
- }
239
- ]
240
- },
241
- 1
242
- );
243
- output_manager_default.error("Usage: `vercel alerts rules inspect <ruleId>`");
244
- return 1;
245
- }
246
- const scope = await parseRulesFlagsAndScope(
247
- client,
248
- {
249
- "--project": parsedArgs.flags["--project"],
250
- "--all": parsedArgs.flags["--all"]
251
- },
252
- fr.jsonOutput,
253
- `alerts rules inspect ${ruleId}`
254
- );
255
- if (typeof scope === "number") {
256
- return scope;
257
- }
258
- const path = rulesItemPath(scope, ruleId);
259
- output_manager_default.spinner("Fetching alert rule...");
260
- try {
261
- const rule = await client.fetch(path);
262
- output_manager_default.stopSpinner();
263
- if (fr.jsonOutput) {
264
- client.stdout.write(`${JSON.stringify({ rule }, null, 2)}
265
- `);
266
- } else {
267
- printRule(rule, ruleId);
268
- }
269
- return 0;
270
- } catch (err) {
271
- if (isAPIError(err)) {
272
- return handleRulesApiError(client, err, fr.jsonOutput);
273
- }
274
- throw err;
275
- } finally {
276
- output_manager_default.stopSpinner();
277
- }
278
- }
279
- export {
280
- ruleInspect as default
281
- };