vercel 58.4.4 → 58.5.1
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-P7WBQMBW.js → add-2KSAN7EK.js} +42 -7
- package/dist/chunks/{add-245XOFJO.js → add-HTKUQ3KF.js} +2 -2
- package/dist/chunks/{add-XH24V5VU.js → add-Y3ACMZQ3.js} +2 -2
- package/dist/chunks/{build-M7NJYJPE.js → build-SOTUMEPT.js} +2 -2
- package/dist/chunks/{chunk-MAHXF73X.js → chunk-3L2YLLHC.js} +1 -1
- package/dist/chunks/{chunk-M5NOLAJ4.js → chunk-4PZ2IIZI.js} +1 -1
- package/dist/chunks/{chunk-2LBVX2H3.js → chunk-4ZZI2JPE.js} +1 -1
- package/dist/chunks/{chunk-3QAUXPIR.js → chunk-7RTO3VPE.js} +82 -44
- package/dist/chunks/{chunk-XE5VSQ25.js → chunk-CVZWB2MA.js} +1 -1
- package/dist/chunks/{chunk-YCPUAG77.js → chunk-FQ4R66UG.js} +1 -1
- package/dist/chunks/{chunk-CPFNFVCL.js → chunk-GE5R7SYE.js} +1 -1
- package/dist/chunks/{chunk-SJYAUEZR.js → chunk-GKLT2ZGC.js} +3 -15
- package/dist/chunks/{chunk-NJUPUGOE.js → chunk-HT2XWSAJ.js} +1 -1
- package/dist/chunks/chunk-I2XE3GMB.js +21 -0
- package/dist/chunks/{chunk-4BUPRO5B.js → chunk-I5F5AE2Q.js} +1 -1
- package/dist/chunks/{chunk-IEDUCUDV.js → chunk-IKIPDMQT.js} +7 -5
- package/dist/chunks/{chunk-Y5GTPWXB.js → chunk-IRX26ZL5.js} +1 -1
- package/dist/chunks/{chunk-UE3JUVUZ.js → chunk-LTEFJ3VD.js} +2 -2
- package/dist/chunks/{chunk-4CCY5OPH.js → chunk-LXRK7KPA.js} +263 -192
- package/dist/chunks/{chunk-2FMPLU44.js → chunk-MEOBIY2L.js} +2 -2
- package/dist/chunks/chunk-MXLA3VQS.js +20 -0
- package/dist/chunks/{chunk-62MH5KPX.js → chunk-NXLNRLL7.js} +1 -1
- package/dist/chunks/{chunk-2WILSD7J.js → chunk-OQ6UFVGM.js} +1 -1
- package/dist/chunks/{chunk-ZGBBPJ6B.js → chunk-PGH6RJJF.js} +1 -1
- package/dist/chunks/{chunk-YDUINEII.js → chunk-QS5I33VI.js} +5 -3
- package/dist/chunks/{chunk-EBLH23AQ.js → chunk-TEQKKTJQ.js} +4 -7
- package/dist/chunks/{chunk-2MAPZXVV.js → chunk-TQE7DRGH.js} +5 -5
- package/dist/chunks/{chunk-4UYKSYKQ.js → chunk-UMA66MKW.js} +66 -2
- package/dist/chunks/{chunk-HSYF5SI3.js → chunk-YFQSZI5Q.js} +1 -1
- package/dist/chunks/{chunk-AQDWMAPM.js → chunk-Z3VYQ7JP.js} +7 -5
- package/dist/chunks/chunk-ZHDQMUK4.js +96 -0
- package/dist/chunks/{chunk-NJ6QXKQD.js → chunk-ZYCVYZSR.js} +1 -1
- package/dist/chunks/{clear-HWIKQ4NC.js → clear-GLMDDDUR.js} +2 -2
- package/dist/chunks/{compile-vercel-config-U5NRIMZ2.js → compile-vercel-config-7JTL7U5E.js} +1 -1
- package/dist/chunks/{constants-3FSSR6E7.js → constants-T6BULVX6.js} +1 -1
- package/dist/chunks/{delete-NVMGVD5Z.js → delete-HE6FCDYS.js} +2 -2
- package/dist/chunks/{delete-FZCOUFGN.js → delete-M3DCAYTX.js} +2 -2
- package/dist/chunks/{disable-ERM2BWEQ.js → disable-LHOHFHGU.js} +2 -2
- package/dist/chunks/{discard-KM5OLEN4.js → discard-D2SI77HA.js} +2 -2
- package/dist/chunks/{edit-TOSB2EMI.js → edit-PSUYL34C.js} +2 -2
- package/dist/chunks/{edit-HT3UTATZ.js → edit-XCJDQOZR.js} +3 -3
- package/dist/chunks/{enable-BQL6AOQV.js → enable-QXXBU3QH.js} +2 -2
- package/dist/chunks/{export-UOWQHOG3.js → export-CRCAJ72L.js} +2 -2
- package/dist/chunks/{image-F5SC6Q7Y.js → image-4YES44D3.js} +3 -3
- package/dist/chunks/{inspect-LGKOLH2O.js → inspect-CFJWOYWD.js} +3 -3
- package/dist/chunks/{inspect-GKJ6T5H4.js → inspect-FEW47KAZ.js} +2 -2
- package/dist/chunks/{inspect-PZJM2CWT.js → inspect-GYUTUSOP.js} +5 -5
- package/dist/chunks/{inspect-35FU5R62.js → inspect-JIGB2JK7.js} +2 -2
- package/dist/chunks/{inspect-5J5GSTOB.js → inspect-WUT7EW6R.js} +2 -2
- package/dist/chunks/{list-ITFJYYQ2.js → list-4N6HI5LH.js} +5 -5
- package/dist/chunks/{list-2IIE7CAP.js → list-W4ZLROFI.js} +3 -3
- package/dist/chunks/{list-KZETH3ZE.js → list-ZQOF2B2L.js} +1 -1
- package/dist/chunks/{login-BQPJCJEZ.js → login-FWYKZ642.js} +2 -2
- package/dist/chunks/{ls-UXUEP54B.js → ls-7YYHSZIR.js} +2 -2
- package/dist/chunks/{ls-ZZFLH7PK.js → ls-AV2WYGNW.js} +2 -2
- package/dist/chunks/{ls-DL2LA35C.js → ls-DD7RQ7KH.js} +2 -2
- package/dist/chunks/{ls-7GHDK4MD.js → ls-V7E37ERN.js} +6 -6
- package/dist/chunks/{ls-YSFWSM6J.js → ls-VOD4NK6A.js} +2 -2
- package/dist/chunks/{open-ADNJQN5E.js → open-YEJQVMYZ.js} +2 -2
- package/dist/chunks/{permissions-72SZCBIY.js → permissions-OJCRKNGQ.js} +4 -4
- package/dist/chunks/{publish-OOAGSEBM.js → publish-XDKQYIKH.js} +2 -2
- package/dist/chunks/{push-B6TZDXNF.js → push-Z2EQUVOV.js} +2 -2
- package/dist/chunks/{query-LZWS5TDH.js → query-KEICHLVN.js} +1 -1
- package/dist/chunks/{reorder-MRHFKPMK.js → reorder-Z6YCND2X.js} +2 -2
- package/dist/chunks/{reply-BKTJXO3B.js → reply-CIWFPTEK.js} +2 -2
- package/dist/chunks/{resolve-BKVGSGPN.js → resolve-BYDSKVYN.js} +2 -2
- package/dist/chunks/{restore-USR7SKWV.js → restore-2KP5DLEC.js} +2 -2
- package/dist/chunks/{rm-KUWPNZIS.js → rm-5Z75EGOZ.js} +2 -2
- package/dist/chunks/{rm-2UO6BT3A.js → rm-FRKS6Y2G.js} +4 -4
- package/dist/chunks/{rm-37MKKV3I.js → rm-RJOWQHQV.js} +2 -2
- package/dist/chunks/{rm-VY3OHKFH.js → rm-TNCPDKEX.js} +2 -2
- package/dist/chunks/{rule-inspect-JVDOOTWK.js → rule-inspect-NOSNKD63.js} +6 -13
- package/dist/chunks/{rules-NTBFZBIF.js → rules-THS42KX4.js} +9 -6
- package/dist/chunks/{schema-6EZ72OVH.js → schema-MDLX6ZDL.js} +1 -1
- package/dist/chunks/schema-R54OXIXC.js +426 -0
- package/dist/chunks/{tags-HNPC63QA.js → tags-NDPHPWME.js} +2 -2
- package/dist/chunks/{update-LUYWNZP3.js → update-YAN3MGMW.js} +36 -4
- package/dist/commands/build/index.js +60 -21
- package/dist/commands/deploy/index.js +21 -14
- package/dist/commands/dev/index.js +33 -9
- package/dist/commands/env/index.js +7 -7
- package/dist/commands/link/index.js +8 -8
- package/dist/commands/list/index.js +2 -2
- package/dist/commands-bulk.js +1183 -941
- package/dist/index.js +11 -10
- package/dist/version.mjs +1 -1
- package/package.json +47 -47
|
@@ -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-BUZRVER7.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 {
|
|
27
|
+
printError
|
|
28
|
+
} from "./chunk-KBEX5MYS.js";
|
|
29
|
+
import {
|
|
30
|
+
parseArguments
|
|
31
|
+
} from "./chunk-XLKFJPMT.js";
|
|
32
|
+
import {
|
|
33
|
+
getFlagsSpecification
|
|
34
|
+
} from "./chunk-SOFC4MLS.js";
|
|
35
|
+
import "./chunk-P4QNYOFB.js";
|
|
36
|
+
import {
|
|
37
|
+
output_manager_default
|
|
38
|
+
} from "./chunk-OX7KI3LF.js";
|
|
39
|
+
import "./chunk-GGP5R3FU.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
|
+
};
|
|
@@ -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-DD7RQ7KH.js")).default(client, args, telemetry);
|
|
56
56
|
case "inspect":
|
|
57
|
-
return (await import("./inspect-
|
|
57
|
+
return (await import("./inspect-WUT7EW6R.js")).default(client, args, telemetry);
|
|
58
58
|
default:
|
|
59
59
|
output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
|
|
60
60
|
return 1;
|
|
@@ -4,21 +4,29 @@ 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-ZHDQMUK4.js";
|
|
7
12
|
import {
|
|
8
13
|
emitRulesArgParseError,
|
|
9
14
|
handleRulesApiError,
|
|
10
15
|
parseRulesFlagsAndScope,
|
|
11
16
|
rulesItemPath
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-IRX26ZL5.js";
|
|
18
|
+
import "./chunk-QS5I33VI.js";
|
|
14
19
|
import "./chunk-BUZRVER7.js";
|
|
20
|
+
import "./chunk-GKLT2ZGC.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-GE5R7SYE.js";
|
|
29
|
+
import "./chunk-LXRK7KPA.js";
|
|
22
30
|
import "./chunk-ECCWJHC6.js";
|
|
23
31
|
import {
|
|
24
32
|
AGENT_REASON,
|
|
@@ -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
|
|
@@ -12,31 +12,31 @@ import {
|
|
|
12
12
|
isLambda,
|
|
13
13
|
staticFiles,
|
|
14
14
|
writeBuildResult
|
|
15
|
-
} from "../../chunks/chunk-
|
|
15
|
+
} from "../../chunks/chunk-PGH6RJJF.js";
|
|
16
16
|
import {
|
|
17
17
|
pullCommandLogic
|
|
18
|
-
} from "../../chunks/chunk-
|
|
18
|
+
} from "../../chunks/chunk-TQE7DRGH.js";
|
|
19
19
|
import {
|
|
20
20
|
require_semver
|
|
21
21
|
} from "../../chunks/chunk-IB5L4LKZ.js";
|
|
22
22
|
import {
|
|
23
23
|
pickOverrides,
|
|
24
24
|
readProjectSettings
|
|
25
|
-
} from "../../chunks/chunk-
|
|
25
|
+
} from "../../chunks/chunk-4PZ2IIZI.js";
|
|
26
26
|
import "../../chunks/chunk-R6IGDGX3.js";
|
|
27
|
-
import "../../chunks/chunk-
|
|
27
|
+
import "../../chunks/chunk-HT2XWSAJ.js";
|
|
28
28
|
import {
|
|
29
29
|
stamp_default
|
|
30
30
|
} from "../../chunks/chunk-64IF634X.js";
|
|
31
31
|
import "../../chunks/chunk-VXYGCOKL.js";
|
|
32
32
|
import {
|
|
33
33
|
ensureLink
|
|
34
|
-
} from "../../chunks/chunk-
|
|
35
|
-
import "../../chunks/chunk-
|
|
36
|
-
import "../../chunks/chunk-
|
|
34
|
+
} from "../../chunks/chunk-MEOBIY2L.js";
|
|
35
|
+
import "../../chunks/chunk-LTEFJ3VD.js";
|
|
36
|
+
import "../../chunks/chunk-GE5R7SYE.js";
|
|
37
37
|
import {
|
|
38
38
|
buildCommand
|
|
39
|
-
} from "../../chunks/chunk-
|
|
39
|
+
} from "../../chunks/chunk-FQ4R66UG.js";
|
|
40
40
|
import {
|
|
41
41
|
help
|
|
42
42
|
} from "../../chunks/chunk-ZX2FSPWV.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
resolveProjectCwd,
|
|
65
65
|
ua_default,
|
|
66
66
|
validateConfig
|
|
67
|
-
} from "../../chunks/chunk-
|
|
67
|
+
} from "../../chunks/chunk-LXRK7KPA.js";
|
|
68
68
|
import {
|
|
69
69
|
TelemetryClient
|
|
70
70
|
} from "../../chunks/chunk-ECCWJHC6.js";
|
|
@@ -319,11 +319,11 @@ async function detectFirstDeploymentFramework(options) {
|
|
|
319
319
|
...detected.detectedVersion && { version: detected.detectedVersion }
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
async function detectAllFrameworks(workPath) {
|
|
322
|
+
async function detectAllFrameworks(workPath, customFrameworkList) {
|
|
323
323
|
logDebug(`Framework cross-check: detecting frameworks at "${workPath}"`);
|
|
324
324
|
const frameworks = await (0, import_fs_detectors2.detectFrameworks)({
|
|
325
325
|
fs: new import_fs_detectors2.LocalFileSystemDetector(workPath),
|
|
326
|
-
frameworkList: import_frameworks.frameworkList
|
|
326
|
+
frameworkList: customFrameworkList ?? import_frameworks.frameworkList
|
|
327
327
|
});
|
|
328
328
|
const slugs = frameworks.map((f) => f.slug).filter((slug) => Boolean(slug));
|
|
329
329
|
logDebug(`Framework cross-check: detected [${slugs.join(", ") || "<none>"}]`);
|
|
@@ -3556,11 +3556,12 @@ async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
|
|
|
3556
3556
|
builderUse
|
|
3557
3557
|
} of packageManifests) {
|
|
3558
3558
|
const key = `${builderUse}:${workspace}`;
|
|
3559
|
+
const framework = service?.framework ?? buildConfig.framework ?? manifest.framework;
|
|
3559
3560
|
projectManifest[key] = {
|
|
3560
3561
|
...manifest,
|
|
3561
3562
|
workspace,
|
|
3562
3563
|
builder: builderUse,
|
|
3563
|
-
framework
|
|
3564
|
+
framework,
|
|
3564
3565
|
serviceName: service?.name,
|
|
3565
3566
|
serviceType: service && isExperimentalService(service) ? service.type : void 0,
|
|
3566
3567
|
routePrefix: service && isExperimentalService(service) ? service.routePrefix : void 0
|
|
@@ -3568,6 +3569,7 @@ async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
|
|
|
3568
3569
|
const { version: _version, ...manifestWithoutVersion } = manifest;
|
|
3569
3570
|
deployManifestBuilds[key] = {
|
|
3570
3571
|
...manifestWithoutVersion,
|
|
3572
|
+
framework,
|
|
3571
3573
|
root: workspace,
|
|
3572
3574
|
builder: builderUse
|
|
3573
3575
|
};
|
|
@@ -4318,6 +4320,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
|
|
|
4318
4320
|
}
|
|
4319
4321
|
const diagnostics = {};
|
|
4320
4322
|
const packageManifests = [];
|
|
4323
|
+
const apiDirFrameworkDetector = createApiDirFrameworkDetector();
|
|
4321
4324
|
const getHasDetectedServices = () => detectedResolvedServices !== void 0 && detectedResolvedServices.length > 0;
|
|
4322
4325
|
const synthesizedServiceCrons = [];
|
|
4323
4326
|
const serviceByBuilder = /* @__PURE__ */ new Map();
|
|
@@ -4383,6 +4386,10 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
|
|
|
4383
4386
|
}
|
|
4384
4387
|
const isFrontendBuilder = build.config && "framework" in build.config;
|
|
4385
4388
|
const builderFramework = build.config?.framework ?? projectSettings.framework;
|
|
4389
|
+
const apiDirFramework = isZeroConfig && !service && !isFrontendBuilder ? await apiDirFrameworkDetector.detect(
|
|
4390
|
+
build.use ?? "",
|
|
4391
|
+
buildWorkPath
|
|
4392
|
+
) : void 0;
|
|
4386
4393
|
let buildConfig;
|
|
4387
4394
|
if (isZeroConfig) {
|
|
4388
4395
|
if (service) {
|
|
@@ -4416,7 +4423,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
|
|
|
4416
4423
|
installCommand: projectSettings.installCommand ?? void 0,
|
|
4417
4424
|
devCommand: projectSettings.devCommand ?? void 0,
|
|
4418
4425
|
buildCommand: projectSettings.buildCommand ?? void 0,
|
|
4419
|
-
framework: projectSettings.framework,
|
|
4426
|
+
framework: isFrontendBuilder ? projectSettings.framework : void 0,
|
|
4420
4427
|
nodeVersion: projectSettings.nodeVersion,
|
|
4421
4428
|
bunVersion: localConfig.bunVersion ?? void 0
|
|
4422
4429
|
};
|
|
@@ -4545,14 +4552,22 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
|
|
|
4545
4552
|
);
|
|
4546
4553
|
} else {
|
|
4547
4554
|
const workspace = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace : ".";
|
|
4548
|
-
packageManifests.
|
|
4549
|
-
workspace
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4555
|
+
const alreadyPushed = packageManifests.some(
|
|
4556
|
+
(m) => m.builderUse === builderPkg.name && m.workspace === workspace
|
|
4557
|
+
);
|
|
4558
|
+
if (!alreadyPushed) {
|
|
4559
|
+
packageManifests.push({
|
|
4560
|
+
workspace,
|
|
4561
|
+
key: fullKey,
|
|
4562
|
+
buildConfig,
|
|
4563
|
+
manifest: {
|
|
4564
|
+
...packageManifest,
|
|
4565
|
+
framework: packageManifest.framework ?? apiDirFramework
|
|
4566
|
+
},
|
|
4567
|
+
service,
|
|
4568
|
+
builderUse: builderPkg.name
|
|
4569
|
+
});
|
|
4570
|
+
}
|
|
4556
4571
|
}
|
|
4557
4572
|
} catch (e) {
|
|
4558
4573
|
output_manager_default.debug(
|
|
@@ -5578,6 +5593,30 @@ async function writeFlagsJSON(buildResults, outputDir) {
|
|
|
5578
5593
|
await import_fs_extra3.default.writeJSON(flagsFilePath, flags, { spaces: 2 });
|
|
5579
5594
|
}
|
|
5580
5595
|
}
|
|
5596
|
+
function createApiDirFrameworkDetector() {
|
|
5597
|
+
const cache = /* @__PURE__ */ new Map();
|
|
5598
|
+
return {
|
|
5599
|
+
detect(builderUse, workPath) {
|
|
5600
|
+
const cacheKey = `${builderUse}:${workPath}`;
|
|
5601
|
+
let cached = cache.get(cacheKey);
|
|
5602
|
+
if (!cached) {
|
|
5603
|
+
cached = detectApiDirFramework(builderUse, workPath);
|
|
5604
|
+
cache.set(cacheKey, cached);
|
|
5605
|
+
}
|
|
5606
|
+
return cached;
|
|
5607
|
+
}
|
|
5608
|
+
};
|
|
5609
|
+
}
|
|
5610
|
+
async function detectApiDirFramework(builderUse, workPath) {
|
|
5611
|
+
const runtimeFrameworks = import_fs_detectors3.builderToFrameworks.get(builderUse) ?? [];
|
|
5612
|
+
if (runtimeFrameworks.length === 0)
|
|
5613
|
+
return void 0;
|
|
5614
|
+
const detectedSlugs = await detectAllFrameworks(
|
|
5615
|
+
workPath,
|
|
5616
|
+
runtimeFrameworks
|
|
5617
|
+
).catch(() => []);
|
|
5618
|
+
return detectedSlugs.length === 1 ? detectedSlugs[0] : void 0;
|
|
5619
|
+
}
|
|
5581
5620
|
async function writeBuildJson(buildsJson, outputDir) {
|
|
5582
5621
|
await import_fs_extra3.default.writeJSON(join5(outputDir, "builds.json"), buildsJson, { spaces: 2 });
|
|
5583
5622
|
}
|