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,429 +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
- CUSTOM_ALERT_EVENT_HELP
9
- } from "./chunk-MXLA3VQS.js";
10
- import {
11
- indent_default
12
- } from "./chunk-A3NYPUKZ.js";
13
- import {
14
- outputError
15
- } from "./chunk-KFWQ3EFH.js";
16
- import {
17
- formatTable
18
- } from "./chunk-GVNCVKCI.js";
19
- import {
20
- validateJsonOutput
21
- } from "./chunk-KXDWXXJH.js";
22
- import {
23
- rulesSchemaSubcommand
24
- } from "./chunk-XM3LOQIX.js";
25
- import "./chunk-GGP5R3FU.js";
26
- import "./chunk-NW34PW6V.js";
27
- import {
28
- printError
29
- } from "./chunk-3VM7HWF6.js";
30
- import {
31
- parseArguments
32
- } from "./chunk-57RHXXXG.js";
33
- import "./chunk-XPJLPUKO.js";
34
- import "./chunk-CV5YC2EN.js";
35
- import {
36
- getFlagsSpecification
37
- } from "./chunk-Q2DGFCO7.js";
38
- import {
39
- output_manager_default
40
- } from "./chunk-2JIX6UMI.js";
41
- import "./chunk-P4QNYOFB.js";
42
- import "./chunk-ZW6HETRE.js";
43
- import "./chunk-S7KYDPEM.js";
44
- import "./chunk-TZ2YI2VH.js";
45
-
46
- // src/commands/alerts/rules/schema.ts
47
- var RULE_TYPES = [
48
- {
49
- type: "usage_anomaly",
50
- description: "Built-in usage anomaly alerts"
51
- },
52
- {
53
- type: "error_anomaly",
54
- description: "Built-in error anomaly alerts"
55
- },
56
- {
57
- type: "custom_alert",
58
- description: "Custom Observability metric alerts"
59
- }
60
- ];
61
- var BUILT_IN_COMMON_FIELDS = [
62
- field("name", "yes", "string", "Rule name"),
63
- field("alertTypes", "yes", "array", "One or more alert type configs"),
64
- field(
65
- "projectId",
66
- "no",
67
- "string",
68
- "OData project filter; omit for team-wide"
69
- ),
70
- field(
71
- "autosubscribeOwnersInKnock",
72
- "no",
73
- "boolean",
74
- "Subscribe project owners"
75
- )
76
- ];
77
- var CUSTOM_ALERT_COMMON_FIELDS = [
78
- field("name", "yes", "string", "Rule name"),
79
- field(
80
- "projectId",
81
- "no",
82
- "string",
83
- "Defaults to --project or the linked project"
84
- ),
85
- field("alertTypes", "yes", "array", "One or more alert type configs"),
86
- field("customAlert", "yes", "object", "Custom alert definition"),
87
- field(
88
- "autosubscribeOwnersInKnock",
89
- "no",
90
- "boolean",
91
- "Subscribe project owners"
92
- )
93
- ];
94
- var USAGE_METRICS = [
95
- "fluid_cpu_duration",
96
- "fluid_duration",
97
- "fast_data_transfer",
98
- "edge_requests",
99
- "function_invocations"
100
- ];
101
- var customQueryJson = {
102
- event: "incomingRequest",
103
- rollups: {
104
- requests: {
105
- measure: "count",
106
- aggregation: "sum"
107
- }
108
- },
109
- groupBy: ["route"],
110
- granularity: { minutes: 5 }
111
- };
112
- var ratioQueryJson = {
113
- event: "incomingRequest",
114
- rollups: {
115
- numerator: {
116
- measure: "count",
117
- aggregation: "sum",
118
- filter: "httpStatus ge 500"
119
- },
120
- denominator: {
121
- measure: "count",
122
- aggregation: "sum"
123
- }
124
- },
125
- granularity: { hours: 1 }
126
- };
127
- var SCHEMAS = {
128
- usage_anomaly: {
129
- type: "usage_anomaly",
130
- description: "Built-in usage anomaly alerts",
131
- fields: [
132
- ...BUILT_IN_COMMON_FIELDS,
133
- field("alertTypes[].type", "yes", "string", "usage_anomaly"),
134
- field(
135
- "alertTypes[].filter",
136
- "no",
137
- "string",
138
- "OData filter for this type"
139
- )
140
- ],
141
- alertTypeFilterValues: [["metric", USAGE_METRICS.join(", ")]],
142
- examples: [
143
- {
144
- name: "Minimal",
145
- body: {
146
- name: "Usage anomalies",
147
- alertTypes: [{ type: "usage_anomaly" }]
148
- }
149
- },
150
- {
151
- name: "Filtered to one metric",
152
- body: {
153
- name: "Edge request anomalies",
154
- projectId: "projectId eq 'prj_123'",
155
- alertTypes: [
156
- { type: "usage_anomaly", filter: "metric eq 'edge_requests'" }
157
- ]
158
- }
159
- }
160
- ]
161
- },
162
- error_anomaly: {
163
- type: "error_anomaly",
164
- description: "Built-in error anomaly alerts",
165
- fields: [
166
- ...BUILT_IN_COMMON_FIELDS,
167
- field("alertTypes[].type", "yes", "string", "error_anomaly"),
168
- field(
169
- "alertTypes[].filter",
170
- "no",
171
- "string",
172
- "OData filter for this type"
173
- )
174
- ],
175
- alertTypeFilterValues: [
176
- ["statusGroup", "4xx, 5xx"],
177
- ["route", `route eq '/api/checkout', contains(route, '/api')`]
178
- ],
179
- examples: [
180
- {
181
- name: "Minimal",
182
- body: {
183
- name: "Error anomalies",
184
- alertTypes: [{ type: "error_anomaly" }]
185
- }
186
- },
187
- {
188
- name: "Filtered to 5xx on one route",
189
- body: {
190
- name: "Checkout 5xx errors",
191
- projectId: "projectId eq 'prj_123'",
192
- alertTypes: [
193
- {
194
- type: "error_anomaly",
195
- filter: "statusGroup eq '5xx' and route eq '/api/checkout'"
196
- }
197
- ]
198
- }
199
- }
200
- ]
201
- },
202
- custom_alert: {
203
- type: "custom_alert",
204
- description: "Custom Observability metric alerts",
205
- fields: [
206
- ...CUSTOM_ALERT_COMMON_FIELDS,
207
- field("alertTypes[].type", "yes", "string", "custom_alert")
208
- ],
209
- customAlertFields: [
210
- field(
211
- "customAlert.queryJsonString",
212
- "yes",
213
- "string",
214
- "Escaped query JSON"
215
- ),
216
- field("customAlert.triggerType", "yes", "string", "threshold, anomaly"),
217
- field("customAlert.triggerOperator", "yes", "string", "gt, gte, lt, lte"),
218
- field(
219
- "customAlert.triggerThreshold",
220
- "yes",
221
- "number",
222
- "Threshold value or z-score"
223
- ),
224
- field(
225
- "customAlert.minThreshold",
226
- "no",
227
- "number",
228
- "Minimum observed value"
229
- ),
230
- field(
231
- "customAlert.formula",
232
- "no",
233
- "object",
234
- "Ratio formula; left and right reference rollup keys"
235
- )
236
- ],
237
- queryJsonFields: [
238
- field("scope", "no", "object", "Project scope"),
239
- field(
240
- "event",
241
- "yes",
242
- "string",
243
- "Alert query event name, for example incomingRequest"
244
- ),
245
- field("rollups", "yes", "object", "Named measure aggregations"),
246
- field("rollups.*.measure", "yes", "string", "Metric measure"),
247
- field("rollups.*.aggregation", "yes", "string", "Metric aggregation"),
248
- field("rollups.*.filter", "no", "string", "Rollup-level OData filter"),
249
- field("groupBy", "no", "array", "At most one dimension"),
250
- field("filter", "no", "string", "Top-level OData filter"),
251
- field("granularity", "no", "object", "5m, 1h, or 1d; defaults to 5m")
252
- ],
253
- queryJsonBeforeEscaping: customQueryJson,
254
- help: CUSTOM_ALERT_EVENT_HELP,
255
- examples: [
256
- {
257
- name: "Anomaly",
258
- body: {
259
- name: "Request volume anomaly",
260
- alertTypes: [{ type: "custom_alert" }],
261
- customAlert: {
262
- queryJsonString: JSON.stringify(customQueryJson),
263
- triggerType: "anomaly",
264
- triggerOperator: "gt",
265
- triggerThreshold: 3
266
- }
267
- }
268
- },
269
- {
270
- name: "Threshold ratio",
271
- body: {
272
- name: "Checkout error rate",
273
- alertTypes: [{ type: "custom_alert" }],
274
- customAlert: {
275
- queryJsonString: JSON.stringify(ratioQueryJson),
276
- triggerType: "threshold",
277
- triggerOperator: "gt",
278
- triggerThreshold: 0.05,
279
- formula: {
280
- operator: "divide",
281
- left: "numerator",
282
- right: "denominator"
283
- },
284
- minThreshold: 20
285
- }
286
- }
287
- }
288
- ]
289
- }
290
- };
291
- async function schema(client, argv) {
292
- let parsedArgs;
293
- try {
294
- parsedArgs = parseArguments(
295
- argv,
296
- getFlagsSpecification(rulesSchemaSubcommand.options)
297
- );
298
- } catch (err) {
299
- printError(err);
300
- return 1;
301
- }
302
- const formatResult = validateJsonOutput(parsedArgs.flags);
303
- if (!formatResult.valid) {
304
- output_manager_default.error(formatResult.error);
305
- return 1;
306
- }
307
- const jsonOutput = formatResult.jsonOutput;
308
- const ruleType = normalizeRuleType(parsedArgs.flags["--type"]);
309
- if (!ruleType) {
310
- if (parsedArgs.flags["--type"]) {
311
- return outputError(
312
- client,
313
- jsonOutput,
314
- "INVALID_ARGUMENTS",
315
- `Invalid alert rule type "${String(parsedArgs.flags["--type"])}". Use usage_anomaly, error_anomaly, or custom_alert.`
316
- );
317
- }
318
- if (jsonOutput) {
319
- client.stdout.write(
320
- `${JSON.stringify({ types: RULE_TYPES }, null, 2)}
321
- `
322
- );
323
- } else {
324
- output_manager_default.log("Alert rule schema");
325
- output_manager_default.print(
326
- `
327
- ${formatRows(
328
- ["Type", "Description"],
329
- RULE_TYPES.map((type) => [type.type, type.description])
330
- )}
331
-
332
- Run \`vercel alerts rules schema --type <type>\` to see a rule body schema.
333
- `
334
- );
335
- }
336
- return 0;
337
- }
338
- printRuleSchema(client, SCHEMAS[ruleType], jsonOutput);
339
- return 0;
340
- }
341
- function field(field2, required, type, notes) {
342
- return { field: field2, required, type, notes };
343
- }
344
- function normalizeRuleType(value) {
345
- if (typeof value !== "string") {
346
- return void 0;
347
- }
348
- const normalized = value.trim().toLowerCase().replace(/[-\s]+/g, "_");
349
- return RULE_TYPES.some((type) => type.type === normalized) ? normalized : void 0;
350
- }
351
- function printRuleSchema(client, schema2, jsonOutput) {
352
- if (jsonOutput) {
353
- client.stdout.write(`${JSON.stringify({ schema: schema2 }, null, 2)}
354
- `);
355
- return;
356
- }
357
- output_manager_default.log(`Alert rule schema: ${schema2.type}`);
358
- output_manager_default.print("\n");
359
- printFieldSection("Fields", schema2.fields);
360
- if (schema2.alertTypeFilterValues) {
361
- output_manager_default.print("alertTypes[].filter values\n\n");
362
- output_manager_default.print(
363
- `${formatRows(
364
- ["Field", "Allowed values / examples"],
365
- schema2.alertTypeFilterValues
366
- )}
367
-
368
- `
369
- );
370
- }
371
- if (schema2.customAlertFields) {
372
- printFieldSection("Custom alert fields", schema2.customAlertFields);
373
- }
374
- if (schema2.queryJsonFields) {
375
- printFieldSection(
376
- "customAlert.queryJsonString fields",
377
- schema2.queryJsonFields
378
- );
379
- }
380
- if (schema2.queryJsonBeforeEscaping) {
381
- output_manager_default.print("customAlert.queryJsonString before escaping\n\n");
382
- output_manager_default.print(
383
- `${indent_default(JSON.stringify(schema2.queryJsonBeforeEscaping, null, 2), 2)}
384
-
385
- `
386
- );
387
- }
388
- if (schema2.help) {
389
- output_manager_default.print("Custom alert metric discovery\n\n");
390
- output_manager_default.print(`${indent_default(schema2.help.join("\n"), 2)}
391
-
392
- `);
393
- }
394
- output_manager_default.print("Body examples\n\n");
395
- for (const example of schema2.examples) {
396
- output_manager_default.print(` ${example.name}
397
-
398
- `);
399
- output_manager_default.print(`${indent_default(JSON.stringify(example.body, null, 2), 4)}
400
-
401
- `);
402
- }
403
- }
404
- function printFieldSection(title, fields) {
405
- output_manager_default.print(`${title}
406
-
407
- `);
408
- output_manager_default.print(
409
- `${formatRows(
410
- ["Field", "Required", "Type", "Values / notes"],
411
- fields.map((field2) => [
412
- field2.field,
413
- field2.required,
414
- field2.type,
415
- field2.notes
416
- ])
417
- )}
418
-
419
- `
420
- );
421
- }
422
- function formatRows(headers, rows) {
423
- const alignment = headers.map(() => "l");
424
- const tableRows = rows.map((row) => [...row]);
425
- return formatTable(headers, alignment, [{ rows: tableRows }]).trim();
426
- }
427
- export {
428
- schema as default
429
- };
@@ -1,246 +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
- parseCustomAlertQueryBody,
9
- resolveCustomAlertProjectName,
10
- setMissingCustomAlertProjectScope
11
- } from "./chunk-QKX7WKIN.js";
12
- import {
13
- emitRulesArgParseError,
14
- handleRulesApiError,
15
- parseRulesFlagsAndScope,
16
- rulesItemPath
17
- } from "./chunk-KEKR7OCB.js";
18
- import "./chunk-N4QHMXOO.js";
19
- import "./chunk-KFWQ3EFH.js";
20
- import "./chunk-GUU4Z2AQ.js";
21
- import "./chunk-AINIBIP4.js";
22
- import "./chunk-Z7JWYFOY.js";
23
- import {
24
- validateJsonOutput
25
- } from "./chunk-KXDWXXJH.js";
26
- import "./chunk-V4RMJKQP.js";
27
- import {
28
- rulesUpdateSubcommand
29
- } from "./chunk-XM3LOQIX.js";
30
- import "./chunk-G3PXSXIB.js";
31
- import "./chunk-P7VSBDR4.js";
32
- import "./chunk-QOPTXV4G.js";
33
- import "./chunk-ZDU2NODC.js";
34
- import "./chunk-PEC3CQSK.js";
35
- import "./chunk-GGP5R3FU.js";
36
- import {
37
- AGENT_REASON
38
- } from "./chunk-VUS2JQB2.js";
39
- import "./chunk-DBYHS3CK.js";
40
- import "./chunk-HRXRELD3.js";
41
- import "./chunk-B5XLQKHI.js";
42
- import "./chunk-4IVSM24H.js";
43
- import "./chunk-XNIZGCN5.js";
44
- import {
45
- printError
46
- } from "./chunk-3VM7HWF6.js";
47
- import {
48
- parseArguments
49
- } from "./chunk-57RHXXXG.js";
50
- import "./chunk-2TSBB22D.js";
51
- import "./chunk-G5FBSUL4.js";
52
- import {
53
- buildCommandWithGlobalFlags,
54
- outputAgentError
55
- } from "./chunk-26CU4Q3C.js";
56
- import "./chunk-XPJLPUKO.js";
57
- import {
58
- isAPIError
59
- } from "./chunk-CV5YC2EN.js";
60
- import {
61
- getFlagsSpecification,
62
- packageName
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 "./chunk-S7KYDPEM.js";
70
- import "./chunk-TZ2YI2VH.js";
71
-
72
- // src/commands/alerts/rules/update.ts
73
- import { readFileSync } from "fs";
74
- import { resolve } from "path";
75
- async function update(client, argv) {
76
- let parsedArgs;
77
- try {
78
- parsedArgs = parseArguments(
79
- argv,
80
- getFlagsSpecification(rulesUpdateSubcommand.options)
81
- );
82
- } catch (e) {
83
- emitRulesArgParseError(
84
- client,
85
- e,
86
- "alerts rules update <ruleId> --project <name-or-id> --body <path>"
87
- );
88
- printError(e);
89
- return 1;
90
- }
91
- const ruleId = parsedArgs.args[0];
92
- const fr = validateJsonOutput(parsedArgs.flags);
93
- if (!fr.valid) {
94
- outputAgentError(
95
- client,
96
- {
97
- status: "error",
98
- reason: AGENT_REASON.INVALID_ARGUMENTS,
99
- message: fr.error
100
- },
101
- 1
102
- );
103
- output_manager_default.error(fr.error);
104
- return 1;
105
- }
106
- if (!ruleId) {
107
- outputAgentError(
108
- client,
109
- {
110
- status: "error",
111
- reason: AGENT_REASON.MISSING_ARGUMENTS,
112
- message: `Missing rule id. Example: ${packageName} alerts rules update <ruleId> --body <file>`,
113
- next: [
114
- {
115
- command: buildCommandWithGlobalFlags(
116
- client.argv,
117
- "alerts rules update <ruleId> --body <file>"
118
- ),
119
- when: "Replace <ruleId> and <file> with id and JSON patch path"
120
- }
121
- ]
122
- },
123
- 1
124
- );
125
- output_manager_default.error("Usage: `vercel alerts rules update <ruleId> --body <PATH>`");
126
- return 1;
127
- }
128
- const bodyPath = parsedArgs.flags["--body"];
129
- if (!bodyPath) {
130
- outputAgentError(
131
- client,
132
- {
133
- status: "error",
134
- reason: AGENT_REASON.MISSING_ARGUMENTS,
135
- message: `Missing required flag --body. Example: ${packageName} alerts rules update ${ruleId} --body <file>`,
136
- next: [
137
- {
138
- command: buildCommandWithGlobalFlags(
139
- client.argv,
140
- `alerts rules update ${ruleId} --body <file>`
141
- ),
142
- when: "Replace <file> with a path to JSON patch payload"
143
- }
144
- ]
145
- },
146
- 1
147
- );
148
- output_manager_default.error("Missing required flag: --body <PATH> (JSON patch payload).");
149
- return 1;
150
- }
151
- const scope = await parseRulesFlagsAndScope(
152
- client,
153
- {
154
- "--project": parsedArgs.flags["--project"],
155
- "--all": parsedArgs.flags["--all"]
156
- },
157
- fr.jsonOutput,
158
- `alerts rules update ${ruleId}`
159
- );
160
- if (typeof scope === "number") {
161
- return scope;
162
- }
163
- let raw;
164
- try {
165
- raw = readFileSync(resolve(client.cwd, bodyPath), "utf8");
166
- } catch {
167
- outputAgentError(
168
- client,
169
- {
170
- status: "error",
171
- reason: AGENT_REASON.INVALID_ARGUMENTS,
172
- message: `Could not read --body file: ${bodyPath}`
173
- },
174
- 1
175
- );
176
- output_manager_default.error(`Could not read --body file: ${bodyPath}`);
177
- return 1;
178
- }
179
- let body;
180
- try {
181
- body = JSON.parse(raw);
182
- } catch {
183
- outputAgentError(
184
- client,
185
- {
186
- status: "error",
187
- reason: AGENT_REASON.INVALID_ARGUMENTS,
188
- message: "Invalid JSON in --body file."
189
- },
190
- 1
191
- );
192
- output_manager_default.error("Invalid JSON in --body file.");
193
- return 1;
194
- }
195
- const parsedCustomAlertQuery = parseCustomAlertQueryBody(client, body);
196
- if (typeof parsedCustomAlertQuery === "number") {
197
- return parsedCustomAlertQuery;
198
- }
199
- delete body.id;
200
- delete body.teamId;
201
- const path = rulesItemPath(scope, ruleId);
202
- output_manager_default.spinner("Updating alert rule...");
203
- try {
204
- if (parsedCustomAlertQuery && !Object.hasOwn(parsedCustomAlertQuery.query, "scope")) {
205
- let projectId = typeof body.projectId === "string" ? body.projectId : void 0;
206
- if (!projectId) {
207
- const rule = await client.fetch(path);
208
- projectId = rule.projectId;
209
- }
210
- if (projectId) {
211
- const projectName = await resolveCustomAlertProjectName(
212
- client,
213
- scope,
214
- projectId
215
- );
216
- setMissingCustomAlertProjectScope(
217
- parsedCustomAlertQuery,
218
- scope.teamId,
219
- projectId,
220
- projectName
221
- );
222
- }
223
- }
224
- const updated = await client.fetch(path, {
225
- method: "PATCH",
226
- body
227
- });
228
- if (fr.jsonOutput) {
229
- client.stdout.write(`${JSON.stringify({ rule: updated }, null, 2)}
230
- `);
231
- } else {
232
- output_manager_default.success(`Updated alert rule ${ruleId}`);
233
- }
234
- return 0;
235
- } catch (err) {
236
- if (isAPIError(err)) {
237
- return handleRulesApiError(client, err, fr.jsonOutput);
238
- }
239
- throw err;
240
- } finally {
241
- output_manager_default.stopSpinner();
242
- }
243
- }
244
- export {
245
- update as default
246
- };