vercel 59.11.7 → 59.13.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-WU2QYHYL.js → add-7OX6PBFD.js} +3 -3
- package/dist/chunks/add-7RYUFBZ3.js +221 -0
- package/dist/chunks/{add-KSJQYR5C.js → add-FX5WWUXU.js} +3 -3
- package/dist/chunks/{build-F3J6FLPD.js → build-Q3TR46K4.js} +3 -3
- package/dist/chunks/{chunk-N4QHMXOO.js → chunk-2GXA4NGG.js} +3 -2
- package/dist/chunks/{chunk-CNDPIHY5.js → chunk-2QFYCMKN.js} +24 -19
- package/dist/chunks/{chunk-7KROIXQM.js → chunk-3FIEWWMM.js} +3 -3
- package/dist/chunks/{chunk-OIH6FP5Y.js → chunk-4TUMNBEE.js} +2 -2
- package/dist/chunks/{chunk-FVT74RZ5.js → chunk-5JDX6XOS.js} +11 -11
- package/dist/chunks/{chunk-WL6QYSGD.js → chunk-5ORMFNXL.js} +586 -41
- package/dist/chunks/{chunk-C762AAVU.js → chunk-66LPM47Z.js} +4 -4
- package/dist/chunks/{chunk-4IVSM24H.js → chunk-76CB3CF2.js} +1 -1
- package/dist/chunks/{chunk-2TSBB22D.js → chunk-7F5RNOTP.js} +2 -2
- package/dist/chunks/{chunk-UARGTFCT.js → chunk-7NRNFV77.js} +1 -1
- package/dist/chunks/chunk-DQ23J2KG.js +305 -0
- package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
- package/dist/chunks/{chunk-Z7JWYFOY.js → chunk-EEV2LKFC.js} +1 -1
- package/dist/chunks/{chunk-DSTNNQVV.js → chunk-EIBH6FCR.js} +3 -3
- package/dist/chunks/chunk-F4S6Q4OY.js +79 -0
- package/dist/chunks/chunk-GDOUDU6O.js +74 -0
- package/dist/chunks/{chunk-DBYHS3CK.js → chunk-GQRG7VFK.js} +2 -2
- package/dist/chunks/{chunk-GCVXKRR5.js → chunk-HD4DR3DA.js} +1 -0
- package/dist/chunks/{chunk-DWIC7MRV.js → chunk-HKHXKSXQ.js} +1 -1
- package/dist/chunks/{chunk-ZBEECGFD.js → chunk-HM24ZWQL.js} +1 -1
- package/dist/chunks/{chunk-GHKJAK5V.js → chunk-IK6PC2JA.js} +4 -4
- package/dist/chunks/{chunk-A5JZS6ZN.js → chunk-IUC3TR3S.js} +1 -1
- package/dist/chunks/{chunk-VYC45Q4Z.js → chunk-JIK2FUMT.js} +1 -1
- package/dist/chunks/{chunk-TGNEG57M.js → chunk-KU2WCB6G.js} +110 -14
- package/dist/chunks/{chunk-FVNJTRCE.js → chunk-KXTXGYG7.js} +2 -2
- package/dist/chunks/{chunk-QOPTXV4G.js → chunk-L4H3DP65.js} +1 -1
- package/dist/chunks/{chunk-FL4JLNT2.js → chunk-LE5V7G2U.js} +2 -2
- package/dist/chunks/chunk-LVCCV2YJ.js +324 -0
- package/dist/chunks/{chunk-SHFNEZVI.js → chunk-MUGF3SGQ.js} +1 -1
- package/dist/chunks/{chunk-G3PXSXIB.js → chunk-N6HP5BLI.js} +5 -3
- package/dist/chunks/{chunk-EZQDYIVB.js → chunk-NSGRICJ2.js} +1 -1
- package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
- package/dist/chunks/{chunk-X7DBBZQD.js → chunk-QRFRS2JH.js} +1 -1
- package/dist/chunks/{chunk-PFM75KY3.js → chunk-QSJ6Q5QP.js} +3 -3
- package/dist/chunks/{chunk-XD4DCYMX.js → chunk-S3HYE6ZE.js} +2 -2
- package/dist/chunks/{chunk-QHS645AZ.js → chunk-SPRQ4IBQ.js} +3 -3
- package/dist/chunks/{chunk-NSOYO6JQ.js → chunk-T3NB7VQG.js} +6 -6
- package/dist/chunks/{chunk-PJXMXMCO.js → chunk-TLPHZ7M4.js} +2 -2
- package/dist/chunks/{chunk-EPOLDWRA.js → chunk-TOXZAP5I.js} +1 -1
- package/dist/chunks/{chunk-XIFATBH5.js → chunk-U4ZLWJQD.js} +4 -4
- package/dist/chunks/{chunk-CEDN47PH.js → chunk-UXKNSAP2.js} +1 -1
- package/dist/chunks/{chunk-GUU4Z2AQ.js → chunk-XEVKGAVI.js} +6 -6
- package/dist/chunks/{chunk-VT3Z7HF6.js → chunk-Z6YZMXVN.js} +4 -4
- package/dist/chunks/{clear-XUQO4ZTK.js → clear-GIAFWC5X.js} +3 -3
- package/dist/chunks/{compile-vercel-config-D3ARNHTN.js → compile-vercel-config-QJGEQKK4.js} +2 -2
- package/dist/chunks/{config-MEDLXUVM.js → config-AOA2HS4R.js} +3 -3
- package/dist/chunks/{config-37OAE7QJ.js → config-HYBSW733.js} +7 -7
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{delete-VSWDZ2SW.js → delete-BBFI75A2.js} +5 -5
- package/dist/chunks/{delete-3N3YZZOF.js → delete-DJ7RI2NX.js} +5 -5
- package/dist/chunks/{detect-services-TESZCQWG.js → detect-services-Q2DVXVMH.js} +6 -6
- package/dist/chunks/{disable-A4FLFMC7.js → disable-P7X2V5LS.js} +5 -5
- package/dist/chunks/{discard-CHGFULBZ.js → discard-JNQBH4XU.js} +5 -5
- package/dist/chunks/{edit-JZ63AJYQ.js → edit-AXQEMBQC.js} +5 -5
- package/dist/chunks/{edit-MHSYAPDR.js → edit-BO3GXEKA.js} +6 -6
- package/dist/chunks/{enable-KD46SEC5.js → enable-NC4BN7EQ.js} +5 -5
- package/dist/chunks/{export-42QZLBSN.js → export-HQ42UNYD.js} +5 -5
- package/dist/chunks/{image-GP4H73A2.js → image-UM4FQYOA.js} +3 -3
- package/dist/chunks/{import-builders-6TBLMPL2.js → import-builders-F6SWNCHK.js} +4 -4
- package/dist/chunks/{inspect-MUVK6MMT.js → inspect-EXEA57MP.js} +3 -3
- package/dist/chunks/{inspect-5FMWMY3C.js → inspect-H3M3XJNB.js} +10 -10
- package/dist/chunks/{inspect-QFXAOUL4.js → inspect-MTNQOLNM.js} +3 -3
- package/dist/chunks/{inspect-RNTSYM6O.js → inspect-PYFF2K4X.js} +3 -3
- package/dist/chunks/{inspect-Q3DWW7MC.js → inspect-XF324IQ2.js} +9 -9
- package/dist/chunks/{list-JRNWLSO5.js → list-4JHZJUBS.js} +2 -2
- package/dist/chunks/{list-IHHIPXEC.js → list-YEN54SGY.js} +6 -6
- package/dist/chunks/{list-XHD5DLEX.js → list-ZKD2O4D2.js} +7 -7
- package/dist/chunks/{login-PCT6KFWY.js → login-56KGZQI2.js} +3 -3
- package/dist/chunks/{ls-SVOHC3XW.js → ls-ELYVF6EU.js} +4 -4
- package/dist/chunks/{ls-PQZ2RIDX.js → ls-HZEMZY2R.js} +4 -4
- package/dist/chunks/{ls-TGHCCARZ.js → ls-IJW74NG3.js} +4 -4
- package/dist/chunks/{ls-GPEHEFCF.js → ls-OAGYLILX.js} +4 -4
- package/dist/chunks/{ls-VRIH5WA3.js → ls-QNTHMTIH.js} +7 -7
- package/dist/chunks/ls-WW5UFH5B.js +204 -0
- package/dist/chunks/{open-E7DEKYDU.js → open-D2E5TEKN.js} +5 -5
- package/dist/chunks/{permissions-JKOONWVL.js → permissions-CFUXWXSK.js} +4 -4
- package/dist/chunks/{publish-EDDELDE5.js → publish-BP4IUYNM.js} +5 -5
- package/dist/chunks/{pull-646WEVDE.js → pull-DL72B6RW.js} +7 -7
- package/dist/chunks/{push-LTNW5OVD.js → push-6YCS4YQW.js} +3 -3
- package/dist/chunks/{query-LU4N6KPO.js → query-7N3YB4LE.js} +7 -7
- package/dist/chunks/{reorder-22PKJMZP.js → reorder-YJN36TPT.js} +5 -5
- package/dist/chunks/{reply-SF2EZMVZ.js → reply-3U3O7LNG.js} +5 -5
- package/dist/chunks/{resolve-ZCZGXTOT.js → resolve-TT75WCWT.js} +5 -5
- package/dist/chunks/{restore-VJAWZXB4.js → restore-6UF6W23A.js} +5 -5
- package/dist/chunks/rm-3QIDFPVA.js +162 -0
- package/dist/chunks/{rm-WNPGTUBH.js → rm-6MJ7ZPXQ.js} +3 -3
- package/dist/chunks/{rm-KVEAJPRE.js → rm-JZRS2NBH.js} +3 -3
- package/dist/chunks/{rm-OSZ5FZUM.js → rm-KI4W2HYP.js} +7 -7
- package/dist/chunks/{rm-KN2QFCKO.js → rm-QCQXVB54.js} +3 -3
- package/dist/chunks/rule-inspect-PX73J52Q.js +123 -0
- package/dist/chunks/{rules-65LKAQ35.js → rules-Q334NBUC.js} +7 -7
- package/dist/chunks/schema-GRTOHAZO.js +381 -0
- package/dist/chunks/{schema-NXCW4M75.js → schema-YV3XYL3A.js} +6 -6
- package/dist/chunks/{set-FYJVKMPV.js → set-J3AQKL6V.js} +7 -7
- package/dist/chunks/{setup-and-link-KXPZE32P.js → setup-and-link-R5N7WJ46.js} +16 -16
- package/dist/chunks/{tags-ANIRP5E3.js → tags-2VLJ4VIH.js} +2 -2
- package/dist/chunks/update-VMS45VF2.js +224 -0
- package/dist/chunks/vlt-builder-importer-USCFHWPL.js +322 -0
- package/dist/commands/build/index.js +19 -19
- package/dist/commands/deploy/index.js +19 -19
- package/dist/commands/dev/index.js +25 -25
- package/dist/commands/env/index.js +12 -12
- package/dist/commands/link/index.js +12 -12
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +11343 -4386
- package/dist/help.js +1 -1
- package/dist/index.js +28 -18
- package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +6 -0
- package/dist/version.mjs +1 -1
- package/package.json +52 -48
- package/dist/chunks/add-PERLOALD.js +0 -233
- package/dist/chunks/chunk-5GGUB4EO.js +0 -31
- package/dist/chunks/chunk-ARU7VBKR.js +0 -144
- package/dist/chunks/chunk-KEKR7OCB.js +0 -140
- package/dist/chunks/chunk-MXLA3VQS.js +0 -20
- package/dist/chunks/chunk-QKX7WKIN.js +0 -98
- package/dist/chunks/ls-PF7F4PP4.js +0 -197
- package/dist/chunks/rm-W722Q2AO.js +0 -173
- package/dist/chunks/rule-inspect-25Z6SNX3.js +0 -285
- package/dist/chunks/schema-7D6IGJEJ.js +0 -429
- 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
|
-
};
|