vercel 51.2.0 → 51.3.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-3MIOUOZC.js +180 -0
- package/dist/chunks/{chunk-K4IC7LFB.js → chunk-2JQVASXJ.js} +13 -8
- package/dist/chunks/{chunk-Q6BEDVOU.js → chunk-4PQA6H63.js} +1 -1
- package/dist/chunks/{chunk-IS2HEMF4.js → chunk-4RBF6ZDU.js} +4 -2
- package/dist/chunks/{chunk-V23RAVWV.js → chunk-4VP55L4V.js} +211 -504
- package/dist/chunks/{chunk-TBW2XDGN.js → chunk-4WRHMYCG.js} +6 -6
- package/dist/chunks/chunk-4ZWTYJSP.js +139 -0
- package/dist/chunks/{chunk-7IDNCLTM.js → chunk-APGVHLAW.js} +2 -2
- package/dist/chunks/{chunk-UZIEJEMY.js → chunk-BAUYQ7AR.js} +1 -1
- package/dist/chunks/{chunk-BUBUVE23.js → chunk-BJQTGP42.js} +4 -2
- package/dist/chunks/{chunk-WOFF2NEI.js → chunk-BU3JMDDH.js} +3 -3
- package/dist/chunks/chunk-CGTXAXZ4.js +484 -0
- package/dist/chunks/{chunk-BQUQ5F7R.js → chunk-CRZM5WM2.js} +4 -2
- package/dist/chunks/{chunk-RQTDTSAX.js → chunk-CZXW3DJH.js} +2 -2
- package/dist/chunks/chunk-DVQ4SIWF.js +183 -0
- package/dist/chunks/{chunk-TWZWQGBN.js → chunk-E3NE4SKN.js} +3 -0
- package/dist/chunks/{chunk-A4NVECX5.js → chunk-ECRBC4HL.js} +4 -581
- package/dist/chunks/{chunk-65IHMJX4.js → chunk-FNFZO3WQ.js} +7 -5
- package/dist/chunks/{chunk-L2BKVTHL.js → chunk-G6RXZLQ2.js} +2 -2
- package/dist/chunks/{chunk-4YZKA4FN.js → chunk-GE6G37P4.js} +1 -1
- package/dist/chunks/{chunk-NELCIT4M.js → chunk-GLDQ23LD.js} +1 -1
- package/dist/chunks/{chunk-D7SZ3DXR.js → chunk-GYBFQLYR.js} +6 -4
- package/dist/chunks/{chunk-ZL5SYUAG.js → chunk-JEON5XEH.js} +44 -13
- package/dist/chunks/{chunk-Y5YCSB6X.js → chunk-LDXYSGPZ.js} +2 -2
- package/dist/chunks/{chunk-U5J73OA3.js → chunk-N45K6NXC.js} +1 -1
- package/dist/chunks/{chunk-YKKQGGLZ.js → chunk-NCQBQGI6.js} +2 -2
- package/dist/chunks/chunk-NE34PEHL.js +167 -0
- package/dist/chunks/{chunk-A5XRYFVO.js → chunk-OFUQPP26.js} +10 -6
- package/dist/chunks/{chunk-NYO5XRBQ.js → chunk-R2BVH5SQ.js} +1 -1
- package/dist/chunks/chunk-RFMC2QXQ.js +602 -0
- package/dist/chunks/{chunk-XHMU7WUB.js → chunk-RHXEHBO3.js} +8 -6
- package/dist/chunks/{chunk-5CRSHCRD.js → chunk-RRYVGOVK.js} +1 -1
- package/dist/chunks/{chunk-3PEFANXY.js → chunk-T7CL42FK.js} +5 -5
- package/dist/chunks/{chunk-WXNT7WJO.js → chunk-TAOVG4PS.js} +49 -4
- package/dist/chunks/{chunk-6DIXPIXB.js → chunk-UB325PS7.js} +1 -1
- package/dist/chunks/{chunk-2IAZZEVQ.js → chunk-UWKTUK3W.js} +4 -2
- package/dist/chunks/{chunk-VE7MY76H.js → chunk-VGWGLBUC.js} +4 -2
- package/dist/chunks/{chunk-F2ROYUW2.js → chunk-VMTOBGCO.js} +425 -28
- package/dist/chunks/{chunk-XMVSCINT.js → chunk-ZS5VKEZL.js} +5 -3
- package/dist/chunks/{compile-vercel-config-6FEECIZK.js → compile-vercel-config-A2SLMCWK.js} +4 -2
- package/dist/chunks/{delete-J2N2QXMP.js → delete-SEQBCYWT.js} +8 -6
- package/dist/chunks/{disable-QGYXQKAM.js → disable-GRM5DJGU.js} +8 -6
- package/dist/chunks/{discard-ZDGJB5US.js → discard-IVQWWSPI.js} +8 -6
- package/dist/chunks/{edit-RJWDA5KJ.js → edit-YTMZBT4Y.js} +9 -7
- package/dist/chunks/{enable-L33HPTXB.js → enable-SSU3MG6J.js} +8 -6
- package/dist/chunks/{export-Z5C4BJ2U.js → export-INCDZTYW.js} +8 -6
- package/dist/chunks/inspect-QMY2ZE6J.js +353 -0
- package/dist/chunks/{list-HXN64DKX.js → list-FF4VGSZ2.js} +115 -85
- package/dist/chunks/{list-4P2TW77C.js → list-MMIBPSB3.js} +10 -7
- package/dist/chunks/ls-TYEDISJD.js +114 -0
- package/dist/chunks/{publish-TLVHQB2H.js → publish-OJQCVDL5.js} +8 -6
- package/dist/chunks/{query-SDKQTWN2.js → query-LACPOOBL.js} +15 -12
- package/dist/chunks/{reorder-UHMUFYIW.js → reorder-TBFWHFQZ.js} +8 -6
- package/dist/chunks/{restore-762GO6HU.js → restore-5LUZRUME.js} +8 -6
- package/dist/chunks/rm-LDXY2G45.js +164 -0
- package/dist/chunks/rule-inspect-THIN6POX.js +142 -0
- package/dist/chunks/rules-4ZH7VTGC.js +83 -0
- package/dist/chunks/{schema-WBOIQRP4.js → schema-OK4OOI2N.js} +9 -7
- package/dist/chunks/{types-A4EAQ6F6.js → types-QNN5CDCB.js} +6 -4
- package/dist/chunks/update-EXPUPEH6.js +196 -0
- package/dist/commands/build/index.js +28 -24
- package/dist/commands/deploy/index.js +172 -33
- package/dist/commands/dev/index.js +21 -17
- package/dist/commands/env/index.js +32 -27
- package/dist/commands/link/index.js +21 -17
- package/dist/commands/list/index.js +14 -11
- package/dist/commands-bulk.js +4566 -1816
- package/dist/index.js +38 -24
- package/dist/version.mjs +1 -1
- package/package.json +18 -18
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
emitRulesArgParseError,
|
|
9
|
+
handleRulesApiError,
|
|
10
|
+
parseRulesFlagsAndScope,
|
|
11
|
+
rulesItemPath
|
|
12
|
+
} from "./chunk-4ZWTYJSP.js";
|
|
13
|
+
import "./chunk-NE34PEHL.js";
|
|
14
|
+
import "./chunk-HTOH3MSD.js";
|
|
15
|
+
import "./chunk-APGVHLAW.js";
|
|
16
|
+
import {
|
|
17
|
+
validateJsonOutput
|
|
18
|
+
} from "./chunk-XPKWKPWA.js";
|
|
19
|
+
import {
|
|
20
|
+
rulesRmSubcommand
|
|
21
|
+
} from "./chunk-DVQ4SIWF.js";
|
|
22
|
+
import {
|
|
23
|
+
AGENT_REASON
|
|
24
|
+
} from "./chunk-E3NE4SKN.js";
|
|
25
|
+
import "./chunk-4VP55L4V.js";
|
|
26
|
+
import "./chunk-U3WLEFHU.js";
|
|
27
|
+
import {
|
|
28
|
+
buildCommandWithGlobalFlags,
|
|
29
|
+
buildCommandWithYes,
|
|
30
|
+
outputAgentError
|
|
31
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
32
|
+
import "./chunk-CO5D46AG.js";
|
|
33
|
+
import {
|
|
34
|
+
getFlagsSpecification,
|
|
35
|
+
parseArguments,
|
|
36
|
+
printError
|
|
37
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
38
|
+
import {
|
|
39
|
+
isAPIError,
|
|
40
|
+
packageName
|
|
41
|
+
} from "./chunk-ECRBC4HL.js";
|
|
42
|
+
import {
|
|
43
|
+
output_manager_default
|
|
44
|
+
} from "./chunk-ZQKJVHXY.js";
|
|
45
|
+
import "./chunk-S7KYDPEM.js";
|
|
46
|
+
import "./chunk-TZ2YI2VH.js";
|
|
47
|
+
|
|
48
|
+
// src/commands/alerts/rules/rm.ts
|
|
49
|
+
async function rm(client, argv) {
|
|
50
|
+
let parsedArgs;
|
|
51
|
+
try {
|
|
52
|
+
parsedArgs = parseArguments(
|
|
53
|
+
argv,
|
|
54
|
+
getFlagsSpecification(rulesRmSubcommand.options)
|
|
55
|
+
);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
emitRulesArgParseError(
|
|
58
|
+
client,
|
|
59
|
+
e,
|
|
60
|
+
"alerts rules rm <ruleId> --project <name-or-id> --yes"
|
|
61
|
+
);
|
|
62
|
+
printError(e);
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
const ruleId = parsedArgs.args[0];
|
|
66
|
+
const fr = validateJsonOutput(parsedArgs.flags);
|
|
67
|
+
if (!fr.valid) {
|
|
68
|
+
outputAgentError(
|
|
69
|
+
client,
|
|
70
|
+
{
|
|
71
|
+
status: "error",
|
|
72
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
73
|
+
message: fr.error
|
|
74
|
+
},
|
|
75
|
+
1
|
|
76
|
+
);
|
|
77
|
+
output_manager_default.error(fr.error);
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
if (!ruleId) {
|
|
81
|
+
outputAgentError(
|
|
82
|
+
client,
|
|
83
|
+
{
|
|
84
|
+
status: "error",
|
|
85
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
86
|
+
message: `Missing rule id. Example: ${packageName} alerts rules rm <ruleId> --yes`,
|
|
87
|
+
next: [
|
|
88
|
+
{
|
|
89
|
+
command: buildCommandWithGlobalFlags(
|
|
90
|
+
client.argv,
|
|
91
|
+
"alerts rules rm <ruleId> --yes"
|
|
92
|
+
),
|
|
93
|
+
when: "Replace <ruleId> with an id from `alerts rules ls`"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
command: buildCommandWithGlobalFlags(
|
|
97
|
+
client.argv,
|
|
98
|
+
"alerts rules ls"
|
|
99
|
+
),
|
|
100
|
+
when: "List rule ids in the current scope"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
1
|
|
105
|
+
);
|
|
106
|
+
output_manager_default.error("Usage: `vercel alerts rules rm <ruleId>`");
|
|
107
|
+
return 1;
|
|
108
|
+
}
|
|
109
|
+
const skipConfirmation = Boolean(parsedArgs.flags["--yes"]);
|
|
110
|
+
const scope = await parseRulesFlagsAndScope(
|
|
111
|
+
client,
|
|
112
|
+
{
|
|
113
|
+
"--project": parsedArgs.flags["--project"],
|
|
114
|
+
"--all": parsedArgs.flags["--all"]
|
|
115
|
+
},
|
|
116
|
+
fr.jsonOutput
|
|
117
|
+
);
|
|
118
|
+
if (typeof scope === "number") {
|
|
119
|
+
return scope;
|
|
120
|
+
}
|
|
121
|
+
if (!skipConfirmation) {
|
|
122
|
+
outputAgentError(
|
|
123
|
+
client,
|
|
124
|
+
{
|
|
125
|
+
status: "error",
|
|
126
|
+
reason: AGENT_REASON.CONFIRMATION_REQUIRED,
|
|
127
|
+
message: "Removing an alert rule requires confirmation. Re-run with --yes.",
|
|
128
|
+
next: [{ command: buildCommandWithYes(client.argv) }]
|
|
129
|
+
},
|
|
130
|
+
1
|
|
131
|
+
);
|
|
132
|
+
if (!await client.input.confirm(
|
|
133
|
+
`Delete alert rule ${ruleId}? This cannot be undone.`,
|
|
134
|
+
false
|
|
135
|
+
)) {
|
|
136
|
+
output_manager_default.log("Canceled");
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const path = rulesItemPath(scope, ruleId);
|
|
141
|
+
output_manager_default.spinner("Deleting alert rule...");
|
|
142
|
+
try {
|
|
143
|
+
await client.fetch(path, { method: "DELETE" });
|
|
144
|
+
if (fr.jsonOutput) {
|
|
145
|
+
client.stdout.write(
|
|
146
|
+
`${JSON.stringify({ ok: true, ruleId, deleted: true }, null, 2)}
|
|
147
|
+
`
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
output_manager_default.success(`Deleted alert rule ${ruleId}`);
|
|
151
|
+
}
|
|
152
|
+
return 0;
|
|
153
|
+
} catch (err) {
|
|
154
|
+
if (isAPIError(err)) {
|
|
155
|
+
return handleRulesApiError(client, err, fr.jsonOutput);
|
|
156
|
+
}
|
|
157
|
+
throw err;
|
|
158
|
+
} finally {
|
|
159
|
+
output_manager_default.stopSpinner();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
rm as default
|
|
164
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
emitRulesArgParseError,
|
|
9
|
+
handleRulesApiError,
|
|
10
|
+
parseRulesFlagsAndScope,
|
|
11
|
+
rulesItemPath
|
|
12
|
+
} from "./chunk-4ZWTYJSP.js";
|
|
13
|
+
import "./chunk-NE34PEHL.js";
|
|
14
|
+
import "./chunk-HTOH3MSD.js";
|
|
15
|
+
import "./chunk-APGVHLAW.js";
|
|
16
|
+
import {
|
|
17
|
+
validateJsonOutput
|
|
18
|
+
} from "./chunk-XPKWKPWA.js";
|
|
19
|
+
import {
|
|
20
|
+
rulesInspectSubcommand
|
|
21
|
+
} from "./chunk-DVQ4SIWF.js";
|
|
22
|
+
import {
|
|
23
|
+
AGENT_REASON
|
|
24
|
+
} from "./chunk-E3NE4SKN.js";
|
|
25
|
+
import "./chunk-4VP55L4V.js";
|
|
26
|
+
import "./chunk-U3WLEFHU.js";
|
|
27
|
+
import {
|
|
28
|
+
buildCommandWithGlobalFlags,
|
|
29
|
+
outputAgentError
|
|
30
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
31
|
+
import "./chunk-CO5D46AG.js";
|
|
32
|
+
import {
|
|
33
|
+
getFlagsSpecification,
|
|
34
|
+
parseArguments,
|
|
35
|
+
printError
|
|
36
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
37
|
+
import {
|
|
38
|
+
isAPIError,
|
|
39
|
+
packageName
|
|
40
|
+
} from "./chunk-ECRBC4HL.js";
|
|
41
|
+
import {
|
|
42
|
+
output_manager_default
|
|
43
|
+
} from "./chunk-ZQKJVHXY.js";
|
|
44
|
+
import "./chunk-S7KYDPEM.js";
|
|
45
|
+
import "./chunk-TZ2YI2VH.js";
|
|
46
|
+
|
|
47
|
+
// src/commands/alerts/rules/rule-inspect.ts
|
|
48
|
+
async function ruleInspect(client, argv) {
|
|
49
|
+
let parsedArgs;
|
|
50
|
+
try {
|
|
51
|
+
parsedArgs = parseArguments(
|
|
52
|
+
argv,
|
|
53
|
+
getFlagsSpecification(rulesInspectSubcommand.options)
|
|
54
|
+
);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
emitRulesArgParseError(
|
|
57
|
+
client,
|
|
58
|
+
e,
|
|
59
|
+
"alerts rules inspect <ruleId> --project <name-or-id>"
|
|
60
|
+
);
|
|
61
|
+
printError(e);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
const ruleId = parsedArgs.args[0];
|
|
65
|
+
const fr = validateJsonOutput(parsedArgs.flags);
|
|
66
|
+
if (!fr.valid) {
|
|
67
|
+
outputAgentError(
|
|
68
|
+
client,
|
|
69
|
+
{
|
|
70
|
+
status: "error",
|
|
71
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
72
|
+
message: fr.error
|
|
73
|
+
},
|
|
74
|
+
1
|
|
75
|
+
);
|
|
76
|
+
output_manager_default.error(fr.error);
|
|
77
|
+
return 1;
|
|
78
|
+
}
|
|
79
|
+
if (!ruleId) {
|
|
80
|
+
outputAgentError(
|
|
81
|
+
client,
|
|
82
|
+
{
|
|
83
|
+
status: "error",
|
|
84
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
85
|
+
message: `Missing rule id. Example: ${packageName} alerts rules inspect <ruleId>`,
|
|
86
|
+
next: [
|
|
87
|
+
{
|
|
88
|
+
command: buildCommandWithGlobalFlags(
|
|
89
|
+
client.argv,
|
|
90
|
+
"alerts rules inspect <ruleId>"
|
|
91
|
+
),
|
|
92
|
+
when: "Replace <ruleId> with an id from `alerts rules ls`"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
command: buildCommandWithGlobalFlags(
|
|
96
|
+
client.argv,
|
|
97
|
+
"alerts rules ls"
|
|
98
|
+
),
|
|
99
|
+
when: "List rule ids in the current scope"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
1
|
|
104
|
+
);
|
|
105
|
+
output_manager_default.error("Usage: `vercel alerts rules inspect <ruleId>`");
|
|
106
|
+
return 1;
|
|
107
|
+
}
|
|
108
|
+
const scope = await parseRulesFlagsAndScope(
|
|
109
|
+
client,
|
|
110
|
+
{
|
|
111
|
+
"--project": parsedArgs.flags["--project"],
|
|
112
|
+
"--all": parsedArgs.flags["--all"]
|
|
113
|
+
},
|
|
114
|
+
fr.jsonOutput
|
|
115
|
+
);
|
|
116
|
+
if (typeof scope === "number") {
|
|
117
|
+
return scope;
|
|
118
|
+
}
|
|
119
|
+
const path = rulesItemPath(scope, ruleId);
|
|
120
|
+
output_manager_default.spinner("Fetching alert rule...");
|
|
121
|
+
try {
|
|
122
|
+
const rule = await client.fetch(path);
|
|
123
|
+
if (fr.jsonOutput) {
|
|
124
|
+
client.stdout.write(`${JSON.stringify({ rule }, null, 2)}
|
|
125
|
+
`);
|
|
126
|
+
} else {
|
|
127
|
+
client.stdout.write(`${JSON.stringify(rule, null, 2)}
|
|
128
|
+
`);
|
|
129
|
+
}
|
|
130
|
+
return 0;
|
|
131
|
+
} catch (err) {
|
|
132
|
+
if (isAPIError(err)) {
|
|
133
|
+
return handleRulesApiError(client, err, fr.jsonOutput);
|
|
134
|
+
}
|
|
135
|
+
throw err;
|
|
136
|
+
} finally {
|
|
137
|
+
output_manager_default.stopSpinner();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
ruleInspect as default
|
|
142
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
getSubcommand
|
|
9
|
+
} from "./chunk-YPQSDAEW.js";
|
|
10
|
+
import {
|
|
11
|
+
AGENT_REASON
|
|
12
|
+
} from "./chunk-E3NE4SKN.js";
|
|
13
|
+
import {
|
|
14
|
+
buildCommandWithGlobalFlags,
|
|
15
|
+
outputAgentError
|
|
16
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
17
|
+
import "./chunk-ECRBC4HL.js";
|
|
18
|
+
import {
|
|
19
|
+
output_manager_default
|
|
20
|
+
} from "./chunk-ZQKJVHXY.js";
|
|
21
|
+
import "./chunk-S7KYDPEM.js";
|
|
22
|
+
import "./chunk-TZ2YI2VH.js";
|
|
23
|
+
|
|
24
|
+
// src/commands/alerts/rules/index.ts
|
|
25
|
+
var RULES_CONFIG = {
|
|
26
|
+
ls: ["ls", "list"],
|
|
27
|
+
add: ["add", "create"],
|
|
28
|
+
inspect: ["inspect", "get"],
|
|
29
|
+
rm: ["rm", "remove", "delete"],
|
|
30
|
+
update: ["update", "patch"]
|
|
31
|
+
};
|
|
32
|
+
async function rules(client, argv) {
|
|
33
|
+
if (argv.length === 0) {
|
|
34
|
+
const lsFn = (await import("./ls-TYEDISJD.js")).default;
|
|
35
|
+
return lsFn(client, []);
|
|
36
|
+
}
|
|
37
|
+
const { subcommand, args, subcommandOriginal } = getSubcommand(
|
|
38
|
+
argv,
|
|
39
|
+
RULES_CONFIG
|
|
40
|
+
);
|
|
41
|
+
if (subcommand == null) {
|
|
42
|
+
outputAgentError(
|
|
43
|
+
client,
|
|
44
|
+
{
|
|
45
|
+
status: "error",
|
|
46
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
47
|
+
message: `Unknown "alerts rules" subcommand "${argv[0]}".`,
|
|
48
|
+
next: [
|
|
49
|
+
{
|
|
50
|
+
command: buildCommandWithGlobalFlags(
|
|
51
|
+
client.argv,
|
|
52
|
+
"alerts rules --help"
|
|
53
|
+
),
|
|
54
|
+
when: "Show valid rules subcommands"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
1
|
|
59
|
+
);
|
|
60
|
+
output_manager_default.error(
|
|
61
|
+
`Unknown "alerts rules" subcommand "${argv[0]}". Run \`vercel alerts rules --help\`.`
|
|
62
|
+
);
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
switch (subcommand) {
|
|
66
|
+
case "ls":
|
|
67
|
+
return (await import("./ls-TYEDISJD.js")).default(client, args);
|
|
68
|
+
case "add":
|
|
69
|
+
return (await import("./add-3MIOUOZC.js")).default(client, args);
|
|
70
|
+
case "inspect":
|
|
71
|
+
return (await import("./rule-inspect-THIN6POX.js")).default(client, args);
|
|
72
|
+
case "rm":
|
|
73
|
+
return (await import("./rm-LDXY2G45.js")).default(client, args);
|
|
74
|
+
case "update":
|
|
75
|
+
return (await import("./update-EXPUPEH6.js")).default(client, args);
|
|
76
|
+
default:
|
|
77
|
+
output_manager_default.error(`Unhandled rules subcommand: ${String(subcommandOriginal)}`);
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
rules as default
|
|
83
|
+
};
|
|
@@ -8,33 +8,35 @@ import {
|
|
|
8
8
|
fetchMetricDetailOrExit,
|
|
9
9
|
fetchMetricListOrExit,
|
|
10
10
|
formatErrorJson
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GLDQ23LD.js";
|
|
12
12
|
import {
|
|
13
13
|
indent_default
|
|
14
14
|
} from "./chunk-A3NYPUKZ.js";
|
|
15
15
|
import {
|
|
16
16
|
formatTable
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G6RXZLQ2.js";
|
|
18
18
|
import {
|
|
19
19
|
getScope
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-APGVHLAW.js";
|
|
21
21
|
import {
|
|
22
22
|
validateJsonOutput
|
|
23
23
|
} from "./chunk-XPKWKPWA.js";
|
|
24
24
|
import {
|
|
25
25
|
schemaSubcommand
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-4RBF6ZDU.js";
|
|
27
|
+
import "./chunk-GE6G37P4.js";
|
|
28
28
|
import {
|
|
29
29
|
require_pluralize
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4VP55L4V.js";
|
|
31
31
|
import "./chunk-U3WLEFHU.js";
|
|
32
|
+
import "./chunk-CGTXAXZ4.js";
|
|
32
33
|
import "./chunk-CO5D46AG.js";
|
|
33
34
|
import {
|
|
34
35
|
getFlagsSpecification,
|
|
35
36
|
parseArguments,
|
|
36
37
|
printError
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
39
|
+
import "./chunk-ECRBC4HL.js";
|
|
38
40
|
import {
|
|
39
41
|
output_manager_default
|
|
40
42
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -9,16 +9,18 @@ import {
|
|
|
9
9
|
} from "./chunk-XPKWKPWA.js";
|
|
10
10
|
import {
|
|
11
11
|
typesSubcommand
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UWKTUK3W.js";
|
|
13
13
|
import {
|
|
14
14
|
table
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GE6G37P4.js";
|
|
16
16
|
import {
|
|
17
17
|
getFlagsSpecification,
|
|
18
|
-
isAPIError,
|
|
19
18
|
parseArguments,
|
|
20
19
|
printError
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
21
|
+
import {
|
|
22
|
+
isAPIError
|
|
23
|
+
} from "./chunk-ECRBC4HL.js";
|
|
22
24
|
import {
|
|
23
25
|
output_manager_default
|
|
24
26
|
} from "./chunk-ZQKJVHXY.js";
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
emitRulesArgParseError,
|
|
9
|
+
handleRulesApiError,
|
|
10
|
+
parseRulesFlagsAndScope,
|
|
11
|
+
rulesItemPath
|
|
12
|
+
} from "./chunk-4ZWTYJSP.js";
|
|
13
|
+
import "./chunk-NE34PEHL.js";
|
|
14
|
+
import "./chunk-HTOH3MSD.js";
|
|
15
|
+
import "./chunk-APGVHLAW.js";
|
|
16
|
+
import {
|
|
17
|
+
validateJsonOutput
|
|
18
|
+
} from "./chunk-XPKWKPWA.js";
|
|
19
|
+
import {
|
|
20
|
+
rulesUpdateSubcommand
|
|
21
|
+
} from "./chunk-DVQ4SIWF.js";
|
|
22
|
+
import {
|
|
23
|
+
AGENT_REASON
|
|
24
|
+
} from "./chunk-E3NE4SKN.js";
|
|
25
|
+
import "./chunk-4VP55L4V.js";
|
|
26
|
+
import "./chunk-U3WLEFHU.js";
|
|
27
|
+
import {
|
|
28
|
+
buildCommandWithGlobalFlags,
|
|
29
|
+
outputAgentError
|
|
30
|
+
} from "./chunk-CGTXAXZ4.js";
|
|
31
|
+
import "./chunk-CO5D46AG.js";
|
|
32
|
+
import {
|
|
33
|
+
getFlagsSpecification,
|
|
34
|
+
parseArguments,
|
|
35
|
+
printError
|
|
36
|
+
} from "./chunk-RFMC2QXQ.js";
|
|
37
|
+
import {
|
|
38
|
+
isAPIError,
|
|
39
|
+
packageName
|
|
40
|
+
} from "./chunk-ECRBC4HL.js";
|
|
41
|
+
import {
|
|
42
|
+
output_manager_default
|
|
43
|
+
} from "./chunk-ZQKJVHXY.js";
|
|
44
|
+
import "./chunk-S7KYDPEM.js";
|
|
45
|
+
import "./chunk-TZ2YI2VH.js";
|
|
46
|
+
|
|
47
|
+
// src/commands/alerts/rules/update.ts
|
|
48
|
+
import { readFileSync } from "fs";
|
|
49
|
+
import { resolve } from "path";
|
|
50
|
+
async function update(client, argv) {
|
|
51
|
+
let parsedArgs;
|
|
52
|
+
try {
|
|
53
|
+
parsedArgs = parseArguments(
|
|
54
|
+
argv,
|
|
55
|
+
getFlagsSpecification(rulesUpdateSubcommand.options)
|
|
56
|
+
);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
emitRulesArgParseError(
|
|
59
|
+
client,
|
|
60
|
+
e,
|
|
61
|
+
"alerts rules update <ruleId> --project <name-or-id> --body <path>"
|
|
62
|
+
);
|
|
63
|
+
printError(e);
|
|
64
|
+
return 1;
|
|
65
|
+
}
|
|
66
|
+
const ruleId = parsedArgs.args[0];
|
|
67
|
+
const fr = validateJsonOutput(parsedArgs.flags);
|
|
68
|
+
if (!fr.valid) {
|
|
69
|
+
outputAgentError(
|
|
70
|
+
client,
|
|
71
|
+
{
|
|
72
|
+
status: "error",
|
|
73
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
74
|
+
message: fr.error
|
|
75
|
+
},
|
|
76
|
+
1
|
|
77
|
+
);
|
|
78
|
+
output_manager_default.error(fr.error);
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
if (!ruleId) {
|
|
82
|
+
outputAgentError(
|
|
83
|
+
client,
|
|
84
|
+
{
|
|
85
|
+
status: "error",
|
|
86
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
87
|
+
message: `Missing rule id. Example: ${packageName} alerts rules update <ruleId> --body <file>`,
|
|
88
|
+
next: [
|
|
89
|
+
{
|
|
90
|
+
command: buildCommandWithGlobalFlags(
|
|
91
|
+
client.argv,
|
|
92
|
+
"alerts rules update <ruleId> --body <file>"
|
|
93
|
+
),
|
|
94
|
+
when: "Replace <ruleId> and <file> with id and JSON patch path"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
1
|
|
99
|
+
);
|
|
100
|
+
output_manager_default.error("Usage: `vercel alerts rules update <ruleId> --body <PATH>`");
|
|
101
|
+
return 1;
|
|
102
|
+
}
|
|
103
|
+
const bodyPath = parsedArgs.flags["--body"];
|
|
104
|
+
if (!bodyPath) {
|
|
105
|
+
outputAgentError(
|
|
106
|
+
client,
|
|
107
|
+
{
|
|
108
|
+
status: "error",
|
|
109
|
+
reason: AGENT_REASON.MISSING_ARGUMENTS,
|
|
110
|
+
message: `Missing required flag --body. Example: ${packageName} alerts rules update ${ruleId} --body <file>`,
|
|
111
|
+
next: [
|
|
112
|
+
{
|
|
113
|
+
command: buildCommandWithGlobalFlags(
|
|
114
|
+
client.argv,
|
|
115
|
+
`alerts rules update ${ruleId} --body <file>`
|
|
116
|
+
),
|
|
117
|
+
when: "Replace <file> with a path to JSON patch payload"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
1
|
|
122
|
+
);
|
|
123
|
+
output_manager_default.error("Missing required flag: --body <PATH> (JSON patch payload).");
|
|
124
|
+
return 1;
|
|
125
|
+
}
|
|
126
|
+
const scope = await parseRulesFlagsAndScope(
|
|
127
|
+
client,
|
|
128
|
+
{
|
|
129
|
+
"--project": parsedArgs.flags["--project"],
|
|
130
|
+
"--all": parsedArgs.flags["--all"]
|
|
131
|
+
},
|
|
132
|
+
fr.jsonOutput
|
|
133
|
+
);
|
|
134
|
+
if (typeof scope === "number") {
|
|
135
|
+
return scope;
|
|
136
|
+
}
|
|
137
|
+
let raw;
|
|
138
|
+
try {
|
|
139
|
+
raw = readFileSync(resolve(client.cwd, bodyPath), "utf8");
|
|
140
|
+
} catch {
|
|
141
|
+
outputAgentError(
|
|
142
|
+
client,
|
|
143
|
+
{
|
|
144
|
+
status: "error",
|
|
145
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
146
|
+
message: `Could not read --body file: ${bodyPath}`
|
|
147
|
+
},
|
|
148
|
+
1
|
|
149
|
+
);
|
|
150
|
+
output_manager_default.error(`Could not read --body file: ${bodyPath}`);
|
|
151
|
+
return 1;
|
|
152
|
+
}
|
|
153
|
+
let body;
|
|
154
|
+
try {
|
|
155
|
+
body = JSON.parse(raw);
|
|
156
|
+
} catch {
|
|
157
|
+
outputAgentError(
|
|
158
|
+
client,
|
|
159
|
+
{
|
|
160
|
+
status: "error",
|
|
161
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
162
|
+
message: "Invalid JSON in --body file."
|
|
163
|
+
},
|
|
164
|
+
1
|
|
165
|
+
);
|
|
166
|
+
output_manager_default.error("Invalid JSON in --body file.");
|
|
167
|
+
return 1;
|
|
168
|
+
}
|
|
169
|
+
delete body.id;
|
|
170
|
+
delete body.teamId;
|
|
171
|
+
const path = rulesItemPath(scope, ruleId);
|
|
172
|
+
output_manager_default.spinner("Updating alert rule...");
|
|
173
|
+
try {
|
|
174
|
+
const updated = await client.fetch(path, {
|
|
175
|
+
method: "PATCH",
|
|
176
|
+
body
|
|
177
|
+
});
|
|
178
|
+
if (fr.jsonOutput) {
|
|
179
|
+
client.stdout.write(`${JSON.stringify({ rule: updated }, null, 2)}
|
|
180
|
+
`);
|
|
181
|
+
} else {
|
|
182
|
+
output_manager_default.success(`Updated alert rule ${ruleId}`);
|
|
183
|
+
}
|
|
184
|
+
return 0;
|
|
185
|
+
} catch (err) {
|
|
186
|
+
if (isAPIError(err)) {
|
|
187
|
+
return handleRulesApiError(client, err, fr.jsonOutput);
|
|
188
|
+
}
|
|
189
|
+
throw err;
|
|
190
|
+
} finally {
|
|
191
|
+
output_manager_default.stopSpinner();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
update as default
|
|
196
|
+
};
|