vercel 58.4.4 → 58.7.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.
- package/dist/chunks/{add-245XOFJO.js → add-I7X6NXYD.js} +4 -4
- package/dist/chunks/{add-P7WBQMBW.js → add-KMRFKOPJ.js} +44 -9
- package/dist/chunks/{add-XH24V5VU.js → add-USFLACJX.js} +4 -4
- package/dist/chunks/{build-M7NJYJPE.js → build-GNX3QE6Q.js} +4 -4
- package/dist/chunks/{chunk-WR7JTCGL.js → chunk-3BU2UCGV.js} +1 -1
- package/dist/chunks/{chunk-MAHXF73X.js → chunk-3L2YLLHC.js} +1 -1
- package/dist/chunks/{chunk-ZGBBPJ6B.js → chunk-4XKF7JOF.js} +92 -1377
- package/dist/chunks/{chunk-2LBVX2H3.js → chunk-5SZ6VX2H.js} +2 -2
- package/dist/chunks/{chunk-2MAPZXVV.js → chunk-62SBYAED.js} +5 -5
- package/dist/chunks/{chunk-UE3JUVUZ.js → chunk-74XVGG52.js} +2 -2
- package/dist/chunks/{chunk-2FMPLU44.js → chunk-7KUQ7BHI.js} +2 -2
- package/dist/chunks/{chunk-YDUINEII.js → chunk-7SXWLTXT.js} +6 -4
- package/dist/chunks/{chunk-M5NOLAJ4.js → chunk-BIGFTNW6.js} +1 -1
- package/dist/chunks/{chunk-YCPUAG77.js → chunk-CDYBV7YA.js} +1 -1
- package/dist/chunks/{chunk-4BUPRO5B.js → chunk-D6SC2UJH.js} +1 -1
- package/dist/chunks/{chunk-62MH5KPX.js → chunk-DHTB5D3E.js} +5 -5
- package/dist/chunks/{chunk-NJ6QXKQD.js → chunk-H3KETQAA.js} +1 -1
- package/dist/chunks/{chunk-NJUPUGOE.js → chunk-HT2XWSAJ.js} +1 -1
- package/dist/chunks/chunk-I2XE3GMB.js +21 -0
- package/dist/chunks/chunk-LC5BYUUP.js +1337 -0
- package/dist/chunks/{chunk-SJYAUEZR.js → chunk-MNZUPMZZ.js} +3 -15
- package/dist/chunks/chunk-MXLA3VQS.js +20 -0
- package/dist/chunks/{chunk-XE5VSQ25.js → chunk-NI4DNP3D.js} +1 -1
- package/dist/chunks/{chunk-Y5GTPWXB.js → chunk-NOMQUVGM.js} +2 -2
- package/dist/chunks/{chunk-AQDWMAPM.js → chunk-NYKWLQQM.js} +10 -8
- package/dist/chunks/{chunk-4CCY5OPH.js → chunk-NZ6GDMPB.js} +306 -217
- package/dist/chunks/chunk-TE5MIANG.js +96 -0
- package/dist/chunks/{chunk-EBLH23AQ.js → chunk-TEQKKTJQ.js} +4 -7
- package/dist/chunks/{chunk-2WILSD7J.js → chunk-TNTJXJSE.js} +1 -1
- package/dist/chunks/{chunk-IEDUCUDV.js → chunk-UAVZOOOL.js} +10 -8
- package/dist/chunks/{chunk-4UYKSYKQ.js → chunk-UMA66MKW.js} +66 -2
- package/dist/chunks/{chunk-CPFNFVCL.js → chunk-UME4MVFU.js} +1 -1
- package/dist/chunks/{chunk-HSYF5SI3.js → chunk-YR6M7ZIU.js} +1 -1
- package/dist/chunks/{chunk-3QAUXPIR.js → chunk-ZZZEJXHD.js} +172 -51
- package/dist/chunks/{clear-HWIKQ4NC.js → clear-ERVHWAHX.js} +4 -4
- package/dist/chunks/{compile-vercel-config-U5NRIMZ2.js → compile-vercel-config-PM5ID4CV.js} +2 -2
- package/dist/chunks/{constants-3FSSR6E7.js → constants-T6BULVX6.js} +1 -1
- package/dist/chunks/{delete-NVMGVD5Z.js → delete-GMVIUCQV.js} +3 -3
- package/dist/chunks/{delete-FZCOUFGN.js → delete-XB24AZGV.js} +4 -4
- package/dist/chunks/{disable-ERM2BWEQ.js → disable-JJZZQ4IZ.js} +3 -3
- package/dist/chunks/{discard-KM5OLEN4.js → discard-CGAS2MSK.js} +3 -3
- package/dist/chunks/{edit-HT3UTATZ.js → edit-RKUUUBQF.js} +4 -4
- package/dist/chunks/{edit-TOSB2EMI.js → edit-TFZDCJTL.js} +5 -5
- package/dist/chunks/{enable-BQL6AOQV.js → enable-UXRVQO6C.js} +3 -3
- package/dist/chunks/{export-UOWQHOG3.js → export-WQE3UU4V.js} +3 -3
- package/dist/chunks/{image-F5SC6Q7Y.js → image-HV7N6RTK.js} +3 -3
- package/dist/chunks/import-builders-IEVZ7KYP.js +28 -0
- package/dist/chunks/{inspect-PZJM2CWT.js → inspect-4BXZOMC2.js} +7 -7
- package/dist/chunks/{inspect-35FU5R62.js → inspect-DT2PX6LB.js} +4 -4
- package/dist/chunks/{inspect-5J5GSTOB.js → inspect-E3YSH5BV.js} +4 -4
- package/dist/chunks/{inspect-GKJ6T5H4.js → inspect-NADJYMSZ.js} +4 -4
- package/dist/chunks/{inspect-LGKOLH2O.js → inspect-VDQEM3E6.js} +5 -5
- package/dist/chunks/{list-KZETH3ZE.js → list-5PLKF2GL.js} +3 -3
- package/dist/chunks/{list-ITFJYYQ2.js → list-ARM4RM22.js} +9 -9
- package/dist/chunks/{list-2IIE7CAP.js → list-RVE2NAC5.js} +5 -5
- package/dist/chunks/{login-BQPJCJEZ.js → login-VHGNOKBB.js} +4 -4
- package/dist/chunks/{ls-7GHDK4MD.js → ls-4QRIPSBC.js} +13 -13
- package/dist/chunks/{ls-DL2LA35C.js → ls-IVVP4H24.js} +4 -4
- package/dist/chunks/{ls-UXUEP54B.js → ls-OTCUUI4L.js} +4 -4
- package/dist/chunks/{ls-YSFWSM6J.js → ls-QBKFZC52.js} +4 -4
- package/dist/chunks/{ls-ZZFLH7PK.js → ls-YME2AL47.js} +4 -4
- package/dist/chunks/{open-ADNJQN5E.js → open-KYVW2GTM.js} +4 -4
- package/dist/chunks/{permissions-72SZCBIY.js → permissions-BLHKOJDO.js} +4 -4
- package/dist/chunks/{publish-OOAGSEBM.js → publish-4BKTL25X.js} +3 -3
- package/dist/chunks/{push-B6TZDXNF.js → push-IJFWOWD7.js} +4 -4
- package/dist/chunks/{query-LZWS5TDH.js → query-VIV66DLZ.js} +3 -3
- package/dist/chunks/{reorder-MRHFKPMK.js → reorder-C44IJZNE.js} +3 -3
- package/dist/chunks/{reply-BKTJXO3B.js → reply-M6WBMKBN.js} +5 -5
- package/dist/chunks/{resolve-BKVGSGPN.js → resolve-44ICWDRT.js} +4 -4
- package/dist/chunks/{restore-USR7SKWV.js → restore-ACDVNSTC.js} +3 -3
- package/dist/chunks/{rm-2UO6BT3A.js → rm-K2FDC5CL.js} +6 -6
- package/dist/chunks/{rm-37MKKV3I.js → rm-P2ILGP4I.js} +4 -4
- package/dist/chunks/{rm-VY3OHKFH.js → rm-Q7VXI345.js} +4 -4
- package/dist/chunks/{rm-KUWPNZIS.js → rm-RO3R3MZT.js} +4 -4
- package/dist/chunks/{rule-inspect-JVDOOTWK.js → rule-inspect-JGKJXOUD.js} +13 -20
- package/dist/chunks/{rules-NTBFZBIF.js → rules-BRTF5HJP.js} +9 -6
- package/dist/chunks/schema-T7RNRNKT.js +426 -0
- package/dist/chunks/{schema-6EZ72OVH.js → schema-Z3L5ZOEE.js} +2 -2
- package/dist/chunks/{tags-HNPC63QA.js → tags-BPHVFK53.js} +2 -2
- package/dist/chunks/{update-LUYWNZP3.js → update-5KQU4HCK.js} +38 -6
- package/dist/commands/build/index.js +65 -24
- package/dist/commands/deploy/index.js +24 -17
- package/dist/commands/dev/index.js +41 -18
- package/dist/commands/env/index.js +89 -150
- package/dist/commands/link/index.js +9 -9
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +3183 -2199
- package/dist/index.js +12 -11
- package/dist/vc.js +11 -14
- package/dist/version.mjs +1 -1
- package/package.json +54 -48
- package/dist/chunks/{chunk-BUZRVER7.js → chunk-P65EEFTR.js} +3 -3
|
@@ -0,0 +1,426 @@
|
|
|
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-P65EEFTR.js";
|
|
16
|
+
import {
|
|
17
|
+
formatTable
|
|
18
|
+
} from "./chunk-JLWQWYKO.js";
|
|
19
|
+
import {
|
|
20
|
+
validateJsonOutput
|
|
21
|
+
} from "./chunk-XPKWKPWA.js";
|
|
22
|
+
import {
|
|
23
|
+
rulesSchemaSubcommand
|
|
24
|
+
} from "./chunk-UMA66MKW.js";
|
|
25
|
+
import "./chunk-KT4XXKJK.js";
|
|
26
|
+
import "./chunk-GGP5R3FU.js";
|
|
27
|
+
import {
|
|
28
|
+
printError
|
|
29
|
+
} from "./chunk-KBEX5MYS.js";
|
|
30
|
+
import {
|
|
31
|
+
parseArguments
|
|
32
|
+
} from "./chunk-XLKFJPMT.js";
|
|
33
|
+
import {
|
|
34
|
+
getFlagsSpecification
|
|
35
|
+
} from "./chunk-SOFC4MLS.js";
|
|
36
|
+
import "./chunk-P4QNYOFB.js";
|
|
37
|
+
import {
|
|
38
|
+
output_manager_default
|
|
39
|
+
} from "./chunk-OX7KI3LF.js";
|
|
40
|
+
import "./chunk-S7KYDPEM.js";
|
|
41
|
+
import "./chunk-TZ2YI2VH.js";
|
|
42
|
+
|
|
43
|
+
// src/commands/alerts/rules/schema.ts
|
|
44
|
+
var RULE_TYPES = [
|
|
45
|
+
{
|
|
46
|
+
type: "usage_anomaly",
|
|
47
|
+
description: "Built-in usage anomaly alerts"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "error_anomaly",
|
|
51
|
+
description: "Built-in error anomaly alerts"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "custom_alert",
|
|
55
|
+
description: "Custom Observability metric alerts"
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
var BUILT_IN_COMMON_FIELDS = [
|
|
59
|
+
field("name", "yes", "string", "Rule name"),
|
|
60
|
+
field("alertTypes", "yes", "array", "One or more alert type configs"),
|
|
61
|
+
field(
|
|
62
|
+
"projectId",
|
|
63
|
+
"no",
|
|
64
|
+
"string",
|
|
65
|
+
"OData project filter; omit for team-wide"
|
|
66
|
+
),
|
|
67
|
+
field(
|
|
68
|
+
"autosubscribeOwnersInKnock",
|
|
69
|
+
"no",
|
|
70
|
+
"boolean",
|
|
71
|
+
"Subscribe project owners"
|
|
72
|
+
)
|
|
73
|
+
];
|
|
74
|
+
var CUSTOM_ALERT_COMMON_FIELDS = [
|
|
75
|
+
field("name", "yes", "string", "Rule name"),
|
|
76
|
+
field(
|
|
77
|
+
"projectId",
|
|
78
|
+
"no",
|
|
79
|
+
"string",
|
|
80
|
+
"Defaults to --project or the linked project"
|
|
81
|
+
),
|
|
82
|
+
field("alertTypes", "yes", "array", "One or more alert type configs"),
|
|
83
|
+
field("customAlert", "yes", "object", "Custom alert definition"),
|
|
84
|
+
field(
|
|
85
|
+
"autosubscribeOwnersInKnock",
|
|
86
|
+
"no",
|
|
87
|
+
"boolean",
|
|
88
|
+
"Subscribe project owners"
|
|
89
|
+
)
|
|
90
|
+
];
|
|
91
|
+
var USAGE_METRICS = [
|
|
92
|
+
"fluid_cpu_duration",
|
|
93
|
+
"fluid_duration",
|
|
94
|
+
"fast_data_transfer",
|
|
95
|
+
"edge_requests",
|
|
96
|
+
"function_invocations"
|
|
97
|
+
];
|
|
98
|
+
var customQueryJson = {
|
|
99
|
+
event: "incomingRequest",
|
|
100
|
+
rollups: {
|
|
101
|
+
requests: {
|
|
102
|
+
measure: "count",
|
|
103
|
+
aggregation: "sum"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
groupBy: ["route"],
|
|
107
|
+
granularity: { minutes: 5 }
|
|
108
|
+
};
|
|
109
|
+
var ratioQueryJson = {
|
|
110
|
+
event: "incomingRequest",
|
|
111
|
+
rollups: {
|
|
112
|
+
numerator: {
|
|
113
|
+
measure: "count",
|
|
114
|
+
aggregation: "sum",
|
|
115
|
+
filter: "httpStatus ge 500"
|
|
116
|
+
},
|
|
117
|
+
denominator: {
|
|
118
|
+
measure: "count",
|
|
119
|
+
aggregation: "sum"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
granularity: { hours: 1 }
|
|
123
|
+
};
|
|
124
|
+
var SCHEMAS = {
|
|
125
|
+
usage_anomaly: {
|
|
126
|
+
type: "usage_anomaly",
|
|
127
|
+
description: "Built-in usage anomaly alerts",
|
|
128
|
+
fields: [
|
|
129
|
+
...BUILT_IN_COMMON_FIELDS,
|
|
130
|
+
field("alertTypes[].type", "yes", "string", "usage_anomaly"),
|
|
131
|
+
field(
|
|
132
|
+
"alertTypes[].filter",
|
|
133
|
+
"no",
|
|
134
|
+
"string",
|
|
135
|
+
"OData filter for this type"
|
|
136
|
+
)
|
|
137
|
+
],
|
|
138
|
+
alertTypeFilterValues: [["metric", USAGE_METRICS.join(", ")]],
|
|
139
|
+
examples: [
|
|
140
|
+
{
|
|
141
|
+
name: "Minimal",
|
|
142
|
+
body: {
|
|
143
|
+
name: "Usage anomalies",
|
|
144
|
+
alertTypes: [{ type: "usage_anomaly" }]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "Filtered to one metric",
|
|
149
|
+
body: {
|
|
150
|
+
name: "Edge request anomalies",
|
|
151
|
+
projectId: "projectId eq 'prj_123'",
|
|
152
|
+
alertTypes: [
|
|
153
|
+
{ type: "usage_anomaly", filter: "metric eq 'edge_requests'" }
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
error_anomaly: {
|
|
160
|
+
type: "error_anomaly",
|
|
161
|
+
description: "Built-in error anomaly alerts",
|
|
162
|
+
fields: [
|
|
163
|
+
...BUILT_IN_COMMON_FIELDS,
|
|
164
|
+
field("alertTypes[].type", "yes", "string", "error_anomaly"),
|
|
165
|
+
field(
|
|
166
|
+
"alertTypes[].filter",
|
|
167
|
+
"no",
|
|
168
|
+
"string",
|
|
169
|
+
"OData filter for this type"
|
|
170
|
+
)
|
|
171
|
+
],
|
|
172
|
+
alertTypeFilterValues: [
|
|
173
|
+
["statusGroup", "4xx, 5xx"],
|
|
174
|
+
["route", `route eq '/api/checkout', contains(route, '/api')`]
|
|
175
|
+
],
|
|
176
|
+
examples: [
|
|
177
|
+
{
|
|
178
|
+
name: "Minimal",
|
|
179
|
+
body: {
|
|
180
|
+
name: "Error anomalies",
|
|
181
|
+
alertTypes: [{ type: "error_anomaly" }]
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "Filtered to 5xx on one route",
|
|
186
|
+
body: {
|
|
187
|
+
name: "Checkout 5xx errors",
|
|
188
|
+
projectId: "projectId eq 'prj_123'",
|
|
189
|
+
alertTypes: [
|
|
190
|
+
{
|
|
191
|
+
type: "error_anomaly",
|
|
192
|
+
filter: "statusGroup eq '5xx' and route eq '/api/checkout'"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
custom_alert: {
|
|
200
|
+
type: "custom_alert",
|
|
201
|
+
description: "Custom Observability metric alerts",
|
|
202
|
+
fields: [
|
|
203
|
+
...CUSTOM_ALERT_COMMON_FIELDS,
|
|
204
|
+
field("alertTypes[].type", "yes", "string", "custom_alert")
|
|
205
|
+
],
|
|
206
|
+
customAlertFields: [
|
|
207
|
+
field(
|
|
208
|
+
"customAlert.queryJsonString",
|
|
209
|
+
"yes",
|
|
210
|
+
"string",
|
|
211
|
+
"Escaped query JSON"
|
|
212
|
+
),
|
|
213
|
+
field("customAlert.triggerType", "yes", "string", "threshold, anomaly"),
|
|
214
|
+
field("customAlert.triggerOperator", "yes", "string", "gt, gte, lt, lte"),
|
|
215
|
+
field(
|
|
216
|
+
"customAlert.triggerThreshold",
|
|
217
|
+
"yes",
|
|
218
|
+
"number",
|
|
219
|
+
"Threshold value or z-score"
|
|
220
|
+
),
|
|
221
|
+
field(
|
|
222
|
+
"customAlert.minThreshold",
|
|
223
|
+
"no",
|
|
224
|
+
"number",
|
|
225
|
+
"Minimum observed value"
|
|
226
|
+
),
|
|
227
|
+
field(
|
|
228
|
+
"customAlert.formula",
|
|
229
|
+
"no",
|
|
230
|
+
"object",
|
|
231
|
+
"Ratio formula; left and right reference rollup keys"
|
|
232
|
+
)
|
|
233
|
+
],
|
|
234
|
+
queryJsonFields: [
|
|
235
|
+
field("scope", "no", "object", "Project scope"),
|
|
236
|
+
field(
|
|
237
|
+
"event",
|
|
238
|
+
"yes",
|
|
239
|
+
"string",
|
|
240
|
+
"Alert query event name, for example incomingRequest"
|
|
241
|
+
),
|
|
242
|
+
field("rollups", "yes", "object", "Named measure aggregations"),
|
|
243
|
+
field("rollups.*.measure", "yes", "string", "Metric measure"),
|
|
244
|
+
field("rollups.*.aggregation", "yes", "string", "Metric aggregation"),
|
|
245
|
+
field("rollups.*.filter", "no", "string", "Rollup-level OData filter"),
|
|
246
|
+
field("groupBy", "no", "array", "At most one dimension"),
|
|
247
|
+
field("filter", "no", "string", "Top-level OData filter"),
|
|
248
|
+
field("granularity", "no", "object", "5m, 1h, or 1d; defaults to 5m")
|
|
249
|
+
],
|
|
250
|
+
queryJsonBeforeEscaping: customQueryJson,
|
|
251
|
+
help: CUSTOM_ALERT_EVENT_HELP,
|
|
252
|
+
examples: [
|
|
253
|
+
{
|
|
254
|
+
name: "Anomaly",
|
|
255
|
+
body: {
|
|
256
|
+
name: "Request volume anomaly",
|
|
257
|
+
alertTypes: [{ type: "custom_alert" }],
|
|
258
|
+
customAlert: {
|
|
259
|
+
queryJsonString: JSON.stringify(customQueryJson),
|
|
260
|
+
triggerType: "anomaly",
|
|
261
|
+
triggerOperator: "gt",
|
|
262
|
+
triggerThreshold: 3
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: "Threshold ratio",
|
|
268
|
+
body: {
|
|
269
|
+
name: "Checkout error rate",
|
|
270
|
+
alertTypes: [{ type: "custom_alert" }],
|
|
271
|
+
customAlert: {
|
|
272
|
+
queryJsonString: JSON.stringify(ratioQueryJson),
|
|
273
|
+
triggerType: "threshold",
|
|
274
|
+
triggerOperator: "gt",
|
|
275
|
+
triggerThreshold: 0.05,
|
|
276
|
+
formula: {
|
|
277
|
+
operator: "divide",
|
|
278
|
+
left: "numerator",
|
|
279
|
+
right: "denominator"
|
|
280
|
+
},
|
|
281
|
+
minThreshold: 20
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
async function schema(client, argv) {
|
|
289
|
+
let parsedArgs;
|
|
290
|
+
try {
|
|
291
|
+
parsedArgs = parseArguments(
|
|
292
|
+
argv,
|
|
293
|
+
getFlagsSpecification(rulesSchemaSubcommand.options)
|
|
294
|
+
);
|
|
295
|
+
} catch (err) {
|
|
296
|
+
printError(err);
|
|
297
|
+
return 1;
|
|
298
|
+
}
|
|
299
|
+
const formatResult = validateJsonOutput(parsedArgs.flags);
|
|
300
|
+
if (!formatResult.valid) {
|
|
301
|
+
output_manager_default.error(formatResult.error);
|
|
302
|
+
return 1;
|
|
303
|
+
}
|
|
304
|
+
const jsonOutput = formatResult.jsonOutput;
|
|
305
|
+
const ruleType = normalizeRuleType(parsedArgs.flags["--type"]);
|
|
306
|
+
if (!ruleType) {
|
|
307
|
+
if (parsedArgs.flags["--type"]) {
|
|
308
|
+
return outputError(
|
|
309
|
+
client,
|
|
310
|
+
jsonOutput,
|
|
311
|
+
"INVALID_ARGUMENTS",
|
|
312
|
+
`Invalid alert rule type "${String(parsedArgs.flags["--type"])}". Use usage_anomaly, error_anomaly, or custom_alert.`
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
if (jsonOutput) {
|
|
316
|
+
client.stdout.write(
|
|
317
|
+
`${JSON.stringify({ types: RULE_TYPES }, null, 2)}
|
|
318
|
+
`
|
|
319
|
+
);
|
|
320
|
+
} else {
|
|
321
|
+
output_manager_default.log("Alert rule schema");
|
|
322
|
+
output_manager_default.print(
|
|
323
|
+
`
|
|
324
|
+
${formatRows(
|
|
325
|
+
["Type", "Description"],
|
|
326
|
+
RULE_TYPES.map((type) => [type.type, type.description])
|
|
327
|
+
)}
|
|
328
|
+
|
|
329
|
+
Run \`vercel alerts rules schema --type <type>\` to see a rule body schema.
|
|
330
|
+
`
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
return 0;
|
|
334
|
+
}
|
|
335
|
+
printRuleSchema(client, SCHEMAS[ruleType], jsonOutput);
|
|
336
|
+
return 0;
|
|
337
|
+
}
|
|
338
|
+
function field(field2, required, type, notes) {
|
|
339
|
+
return { field: field2, required, type, notes };
|
|
340
|
+
}
|
|
341
|
+
function normalizeRuleType(value) {
|
|
342
|
+
if (typeof value !== "string") {
|
|
343
|
+
return void 0;
|
|
344
|
+
}
|
|
345
|
+
const normalized = value.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
346
|
+
return RULE_TYPES.some((type) => type.type === normalized) ? normalized : void 0;
|
|
347
|
+
}
|
|
348
|
+
function printRuleSchema(client, schema2, jsonOutput) {
|
|
349
|
+
if (jsonOutput) {
|
|
350
|
+
client.stdout.write(`${JSON.stringify({ schema: schema2 }, null, 2)}
|
|
351
|
+
`);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
output_manager_default.log(`Alert rule schema: ${schema2.type}`);
|
|
355
|
+
output_manager_default.print("\n");
|
|
356
|
+
printFieldSection("Fields", schema2.fields);
|
|
357
|
+
if (schema2.alertTypeFilterValues) {
|
|
358
|
+
output_manager_default.print("alertTypes[].filter values\n\n");
|
|
359
|
+
output_manager_default.print(
|
|
360
|
+
`${formatRows(
|
|
361
|
+
["Field", "Allowed values / examples"],
|
|
362
|
+
schema2.alertTypeFilterValues
|
|
363
|
+
)}
|
|
364
|
+
|
|
365
|
+
`
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
if (schema2.customAlertFields) {
|
|
369
|
+
printFieldSection("Custom alert fields", schema2.customAlertFields);
|
|
370
|
+
}
|
|
371
|
+
if (schema2.queryJsonFields) {
|
|
372
|
+
printFieldSection(
|
|
373
|
+
"customAlert.queryJsonString fields",
|
|
374
|
+
schema2.queryJsonFields
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
if (schema2.queryJsonBeforeEscaping) {
|
|
378
|
+
output_manager_default.print("customAlert.queryJsonString before escaping\n\n");
|
|
379
|
+
output_manager_default.print(
|
|
380
|
+
`${indent_default(JSON.stringify(schema2.queryJsonBeforeEscaping, null, 2), 2)}
|
|
381
|
+
|
|
382
|
+
`
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
if (schema2.help) {
|
|
386
|
+
output_manager_default.print("Custom alert metric discovery\n\n");
|
|
387
|
+
output_manager_default.print(`${indent_default(schema2.help.join("\n"), 2)}
|
|
388
|
+
|
|
389
|
+
`);
|
|
390
|
+
}
|
|
391
|
+
output_manager_default.print("Body examples\n\n");
|
|
392
|
+
for (const example of schema2.examples) {
|
|
393
|
+
output_manager_default.print(` ${example.name}
|
|
394
|
+
|
|
395
|
+
`);
|
|
396
|
+
output_manager_default.print(`${indent_default(JSON.stringify(example.body, null, 2), 4)}
|
|
397
|
+
|
|
398
|
+
`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function printFieldSection(title, fields) {
|
|
402
|
+
output_manager_default.print(`${title}
|
|
403
|
+
|
|
404
|
+
`);
|
|
405
|
+
output_manager_default.print(
|
|
406
|
+
`${formatRows(
|
|
407
|
+
["Field", "Required", "Type", "Values / notes"],
|
|
408
|
+
fields.map((field2) => [
|
|
409
|
+
field2.field,
|
|
410
|
+
field2.required,
|
|
411
|
+
field2.type,
|
|
412
|
+
field2.notes
|
|
413
|
+
])
|
|
414
|
+
)}
|
|
415
|
+
|
|
416
|
+
`
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
function formatRows(headers, rows) {
|
|
420
|
+
const alignment = headers.map(() => "l");
|
|
421
|
+
const tableRows = rows.map((row) => [...row]);
|
|
422
|
+
return formatTable(headers, alignment, [{ rows: tableRows }]).trim();
|
|
423
|
+
}
|
|
424
|
+
export {
|
|
425
|
+
schema as default
|
|
426
|
+
};
|
|
@@ -27,9 +27,10 @@ import "./chunk-KT4XXKJK.js";
|
|
|
27
27
|
import {
|
|
28
28
|
getScope,
|
|
29
29
|
require_pluralize
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-NZ6GDMPB.js";
|
|
31
31
|
import "./chunk-ECCWJHC6.js";
|
|
32
32
|
import "./chunk-TJJ562C5.js";
|
|
33
|
+
import "./chunk-GGP5R3FU.js";
|
|
33
34
|
import {
|
|
34
35
|
printError
|
|
35
36
|
} from "./chunk-KBEX5MYS.js";
|
|
@@ -44,7 +45,6 @@ import "./chunk-52QYYTM5.js";
|
|
|
44
45
|
import {
|
|
45
46
|
output_manager_default
|
|
46
47
|
} from "./chunk-OX7KI3LF.js";
|
|
47
|
-
import "./chunk-GGP5R3FU.js";
|
|
48
48
|
import "./chunk-S7KYDPEM.js";
|
|
49
49
|
import {
|
|
50
50
|
__toESM
|
|
@@ -52,9 +52,9 @@ async function tags(client, argv, telemetry) {
|
|
|
52
52
|
}
|
|
53
53
|
switch (subcommand) {
|
|
54
54
|
case "ls":
|
|
55
|
-
return (await import("./ls-
|
|
55
|
+
return (await import("./ls-IVVP4H24.js")).default(client, args, telemetry);
|
|
56
56
|
case "inspect":
|
|
57
|
-
return (await import("./inspect-
|
|
57
|
+
return (await import("./inspect-E3YSH5BV.js")).default(client, args, telemetry);
|
|
58
58
|
default:
|
|
59
59
|
output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
|
|
60
60
|
return 1;
|
|
@@ -4,27 +4,36 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
parseCustomAlertQueryBody,
|
|
9
|
+
resolveCustomAlertProjectName,
|
|
10
|
+
setMissingCustomAlertProjectScope
|
|
11
|
+
} from "./chunk-TE5MIANG.js";
|
|
7
12
|
import {
|
|
8
13
|
emitRulesArgParseError,
|
|
9
14
|
handleRulesApiError,
|
|
10
15
|
parseRulesFlagsAndScope,
|
|
11
16
|
rulesItemPath
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-NOMQUVGM.js";
|
|
18
|
+
import "./chunk-7SXWLTXT.js";
|
|
19
|
+
import "./chunk-P65EEFTR.js";
|
|
20
|
+
import "./chunk-MNZUPMZZ.js";
|
|
21
|
+
import "./chunk-V5P25P7F.js";
|
|
15
22
|
import {
|
|
16
23
|
validateJsonOutput
|
|
17
24
|
} from "./chunk-XPKWKPWA.js";
|
|
18
25
|
import {
|
|
19
26
|
rulesUpdateSubcommand
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-UMA66MKW.js";
|
|
28
|
+
import "./chunk-UME4MVFU.js";
|
|
29
|
+
import "./chunk-NZ6GDMPB.js";
|
|
22
30
|
import "./chunk-ECCWJHC6.js";
|
|
23
31
|
import {
|
|
24
32
|
AGENT_REASON,
|
|
25
33
|
buildCommandWithGlobalFlags,
|
|
26
34
|
outputAgentError
|
|
27
35
|
} from "./chunk-TJJ562C5.js";
|
|
36
|
+
import "./chunk-GGP5R3FU.js";
|
|
28
37
|
import {
|
|
29
38
|
printError
|
|
30
39
|
} from "./chunk-KBEX5MYS.js";
|
|
@@ -41,7 +50,6 @@ import "./chunk-52QYYTM5.js";
|
|
|
41
50
|
import {
|
|
42
51
|
output_manager_default
|
|
43
52
|
} from "./chunk-OX7KI3LF.js";
|
|
44
|
-
import "./chunk-GGP5R3FU.js";
|
|
45
53
|
import "./chunk-S7KYDPEM.js";
|
|
46
54
|
import "./chunk-TZ2YI2VH.js";
|
|
47
55
|
|
|
@@ -168,11 +176,35 @@ async function update(client, argv) {
|
|
|
168
176
|
output_manager_default.error("Invalid JSON in --body file.");
|
|
169
177
|
return 1;
|
|
170
178
|
}
|
|
179
|
+
const parsedCustomAlertQuery = parseCustomAlertQueryBody(client, body);
|
|
180
|
+
if (typeof parsedCustomAlertQuery === "number") {
|
|
181
|
+
return parsedCustomAlertQuery;
|
|
182
|
+
}
|
|
171
183
|
delete body.id;
|
|
172
184
|
delete body.teamId;
|
|
173
185
|
const path = rulesItemPath(scope, ruleId);
|
|
174
186
|
output_manager_default.spinner("Updating alert rule...");
|
|
175
187
|
try {
|
|
188
|
+
if (parsedCustomAlertQuery && !Object.hasOwn(parsedCustomAlertQuery.query, "scope")) {
|
|
189
|
+
let projectId = typeof body.projectId === "string" ? body.projectId : void 0;
|
|
190
|
+
if (!projectId) {
|
|
191
|
+
const rule = await client.fetch(path);
|
|
192
|
+
projectId = rule.projectId;
|
|
193
|
+
}
|
|
194
|
+
if (projectId) {
|
|
195
|
+
const projectName = await resolveCustomAlertProjectName(
|
|
196
|
+
client,
|
|
197
|
+
scope,
|
|
198
|
+
projectId
|
|
199
|
+
);
|
|
200
|
+
setMissingCustomAlertProjectScope(
|
|
201
|
+
parsedCustomAlertQuery,
|
|
202
|
+
scope.teamId,
|
|
203
|
+
projectId,
|
|
204
|
+
projectName
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
176
208
|
const updated = await client.fetch(path, {
|
|
177
209
|
method: "PATCH",
|
|
178
210
|
body
|