vercel 59.11.7 → 59.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-KSJQYR5C.js → add-OO3JGLZW.js} +3 -3
- package/dist/chunks/{add-WU2QYHYL.js → add-RTXDASSS.js} +3 -3
- package/dist/chunks/add-XGO6LHMD.js +221 -0
- package/dist/chunks/{build-F3J6FLPD.js → build-JINV2UD4.js} +3 -3
- package/dist/chunks/chunk-2NIDTSQJ.js +305 -0
- package/dist/chunks/{chunk-SHFNEZVI.js → chunk-32XSMM3W.js} +1 -1
- package/dist/chunks/{chunk-N4QHMXOO.js → chunk-3BB2HOO2.js} +3 -2
- package/dist/chunks/{chunk-DSTNNQVV.js → chunk-3F25W3GA.js} +3 -3
- package/dist/chunks/{chunk-OIH6FP5Y.js → chunk-4TUMNBEE.js} +2 -2
- package/dist/chunks/{chunk-4IVSM24H.js → chunk-ABSZNJQO.js} +1 -1
- package/dist/chunks/{chunk-CNDPIHY5.js → chunk-AV747POV.js} +24 -19
- package/dist/chunks/{chunk-QHS645AZ.js → chunk-CZ5QQRXD.js} +3 -3
- package/dist/chunks/{chunk-FL4JLNT2.js → chunk-E47NARDE.js} +2 -2
- package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
- package/dist/chunks/{chunk-PJXMXMCO.js → chunk-ELZ6WQQA.js} +2 -2
- package/dist/chunks/{chunk-FVNJTRCE.js → chunk-EOLGLGXJ.js} +2 -2
- package/dist/chunks/chunk-GDOUDU6O.js +74 -0
- 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-HR2MP4XF.js +324 -0
- package/dist/chunks/{chunk-EZQDYIVB.js → chunk-JOXNBQ7W.js} +1 -1
- package/dist/chunks/{chunk-DBYHS3CK.js → chunk-KAF4WFF3.js} +2 -2
- package/dist/chunks/{chunk-VYC45Q4Z.js → chunk-KNO327AW.js} +1 -1
- package/dist/chunks/{chunk-XD4DCYMX.js → chunk-L6B6BRHH.js} +2 -2
- package/dist/chunks/{chunk-X7DBBZQD.js → chunk-LDV2R4P4.js} +1 -1
- package/dist/chunks/{chunk-2TSBB22D.js → chunk-MADFAH3O.js} +2 -2
- package/dist/chunks/{chunk-TGNEG57M.js → chunk-MDGPZHSM.js} +110 -14
- package/dist/chunks/{chunk-XIFATBH5.js → chunk-NDY3JDOU.js} +4 -4
- package/dist/chunks/{chunk-NSOYO6JQ.js → chunk-OJHDGHOB.js} +6 -6
- package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
- package/dist/chunks/{chunk-C762AAVU.js → chunk-PP5GKSIX.js} +4 -4
- package/dist/chunks/{chunk-Z7JWYFOY.js → chunk-QB2UHSUB.js} +1 -1
- package/dist/chunks/chunk-QIUK4Z7Q.js +79 -0
- package/dist/chunks/{chunk-GHKJAK5V.js → chunk-RNK3LXLR.js} +4 -4
- package/dist/chunks/{chunk-CEDN47PH.js → chunk-SWO66HE2.js} +1 -1
- package/dist/chunks/{chunk-EPOLDWRA.js → chunk-TDGK45FB.js} +1 -1
- package/dist/chunks/{chunk-PFM75KY3.js → chunk-UA55I7M6.js} +3 -3
- package/dist/chunks/{chunk-VT3Z7HF6.js → chunk-UJPVHLL5.js} +4 -4
- package/dist/chunks/{chunk-UARGTFCT.js → chunk-VJSREJVM.js} +1 -1
- package/dist/chunks/{chunk-WL6QYSGD.js → chunk-WPBCUXMZ.js} +506 -22
- package/dist/chunks/{chunk-A5JZS6ZN.js → chunk-WSZ5E4WH.js} +1 -1
- package/dist/chunks/{chunk-GUU4Z2AQ.js → chunk-WT2Y7FRD.js} +6 -6
- package/dist/chunks/{chunk-G3PXSXIB.js → chunk-WT6C2ALC.js} +3 -3
- package/dist/chunks/{chunk-7KROIXQM.js → chunk-X6TGUHFD.js} +3 -3
- package/dist/chunks/{chunk-QOPTXV4G.js → chunk-YPMFZRTN.js} +1 -1
- package/dist/chunks/{chunk-FVT74RZ5.js → chunk-YRESLJCW.js} +11 -11
- package/dist/chunks/{clear-XUQO4ZTK.js → clear-GQTDYSKJ.js} +3 -3
- package/dist/chunks/{compile-vercel-config-D3ARNHTN.js → compile-vercel-config-URVMKDVW.js} +2 -2
- package/dist/chunks/{config-37OAE7QJ.js → config-MSVQR5T6.js} +7 -7
- package/dist/chunks/{config-MEDLXUVM.js → config-OAXY4J6P.js} +3 -3
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{delete-VSWDZ2SW.js → delete-57QO64HD.js} +5 -5
- package/dist/chunks/{delete-3N3YZZOF.js → delete-XN6ESD7C.js} +5 -5
- package/dist/chunks/{detect-services-TESZCQWG.js → detect-services-UPY4LTBZ.js} +6 -6
- package/dist/chunks/{disable-A4FLFMC7.js → disable-BYI46V7B.js} +5 -5
- package/dist/chunks/{discard-CHGFULBZ.js → discard-IIQL44ZZ.js} +5 -5
- package/dist/chunks/{edit-MHSYAPDR.js → edit-BRNS3OR4.js} +6 -6
- package/dist/chunks/{edit-JZ63AJYQ.js → edit-JTW7XZH7.js} +5 -5
- package/dist/chunks/{enable-KD46SEC5.js → enable-CH5FSQMR.js} +5 -5
- package/dist/chunks/{export-42QZLBSN.js → export-6WHQOWKM.js} +5 -5
- package/dist/chunks/{image-GP4H73A2.js → image-ZSLYATWG.js} +3 -3
- package/dist/chunks/{import-builders-6TBLMPL2.js → import-builders-FNMYJZGG.js} +4 -4
- package/dist/chunks/{inspect-5FMWMY3C.js → inspect-4RDZSYWU.js} +10 -10
- package/dist/chunks/{inspect-MUVK6MMT.js → inspect-7WQXZWET.js} +3 -3
- package/dist/chunks/{inspect-Q3DWW7MC.js → inspect-CGXTNMMO.js} +9 -9
- package/dist/chunks/{inspect-RNTSYM6O.js → inspect-XJ7BYLZ5.js} +3 -3
- package/dist/chunks/{inspect-QFXAOUL4.js → inspect-Z2MBTTB7.js} +3 -3
- package/dist/chunks/{list-IHHIPXEC.js → list-65LW6OTM.js} +6 -6
- package/dist/chunks/{list-XHD5DLEX.js → list-7W3PHRB6.js} +7 -7
- package/dist/chunks/{list-JRNWLSO5.js → list-KS22Y57L.js} +2 -2
- package/dist/chunks/{login-PCT6KFWY.js → login-NXULVQZ2.js} +3 -3
- package/dist/chunks/{ls-TGHCCARZ.js → ls-35EOVEIQ.js} +4 -4
- package/dist/chunks/{ls-PQZ2RIDX.js → ls-5GKS5QRW.js} +4 -4
- package/dist/chunks/ls-ADYFYYIW.js +204 -0
- package/dist/chunks/{ls-SVOHC3XW.js → ls-DZYN3SNS.js} +4 -4
- package/dist/chunks/{ls-VRIH5WA3.js → ls-HVQOGBGV.js} +7 -7
- package/dist/chunks/{ls-GPEHEFCF.js → ls-I2PWG7YN.js} +4 -4
- package/dist/chunks/{open-E7DEKYDU.js → open-H34HXJHP.js} +5 -5
- package/dist/chunks/{permissions-JKOONWVL.js → permissions-ZPPEPKVE.js} +4 -4
- package/dist/chunks/{publish-EDDELDE5.js → publish-NRMKXHAU.js} +5 -5
- package/dist/chunks/{pull-646WEVDE.js → pull-WUT3XTZX.js} +7 -7
- package/dist/chunks/{push-LTNW5OVD.js → push-WFNCEA5J.js} +3 -3
- package/dist/chunks/{query-LU4N6KPO.js → query-2FQM3F7N.js} +7 -7
- package/dist/chunks/{reorder-22PKJMZP.js → reorder-GYCT7L3C.js} +5 -5
- package/dist/chunks/{reply-SF2EZMVZ.js → reply-RFEXNYZ7.js} +5 -5
- package/dist/chunks/{resolve-ZCZGXTOT.js → resolve-ZFGT7W6Z.js} +5 -5
- package/dist/chunks/{restore-VJAWZXB4.js → restore-JAXPMYL5.js} +5 -5
- package/dist/chunks/rm-CLKQN5E4.js +162 -0
- package/dist/chunks/{rm-WNPGTUBH.js → rm-JPV5V2SH.js} +3 -3
- package/dist/chunks/{rm-KN2QFCKO.js → rm-N7SGFQOA.js} +3 -3
- package/dist/chunks/{rm-KVEAJPRE.js → rm-UQJ4CZJH.js} +3 -3
- package/dist/chunks/{rm-OSZ5FZUM.js → rm-ZUQ4U454.js} +7 -7
- package/dist/chunks/rule-inspect-HI3YY7OY.js +123 -0
- package/dist/chunks/{rules-65LKAQ35.js → rules-DA3Q64M4.js} +7 -7
- package/dist/chunks/{schema-NXCW4M75.js → schema-R3C4CXJ6.js} +6 -6
- package/dist/chunks/schema-UYYFV3JB.js +381 -0
- package/dist/chunks/{set-FYJVKMPV.js → set-TOJPGW4J.js} +7 -7
- package/dist/chunks/{setup-and-link-KXPZE32P.js → setup-and-link-DRYXQOH4.js} +16 -16
- package/dist/chunks/{tags-ANIRP5E3.js → tags-TNLVFNVI.js} +2 -2
- package/dist/chunks/update-X6JB3NPI.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 +8273 -3511
- 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
|
@@ -0,0 +1,324 @@
|
|
|
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
|
+
emitAlertsScopeError,
|
|
9
|
+
resolveAlertsScope
|
|
10
|
+
} from "./chunk-3BB2HOO2.js";
|
|
11
|
+
import {
|
|
12
|
+
handleValidationError,
|
|
13
|
+
validateAllProjectMutualExclusivity
|
|
14
|
+
} from "./chunk-KFWQ3EFH.js";
|
|
15
|
+
import {
|
|
16
|
+
isJSONObject
|
|
17
|
+
} from "./chunk-WT2Y7FRD.js";
|
|
18
|
+
import {
|
|
19
|
+
AGENT_REASON
|
|
20
|
+
} from "./chunk-VUS2JQB2.js";
|
|
21
|
+
import {
|
|
22
|
+
getScope
|
|
23
|
+
} from "./chunk-ABSZNJQO.js";
|
|
24
|
+
import {
|
|
25
|
+
getProjectByNameOrId
|
|
26
|
+
} from "./chunk-MADFAH3O.js";
|
|
27
|
+
import {
|
|
28
|
+
buildCommandWithGlobalFlags,
|
|
29
|
+
outputAgentError
|
|
30
|
+
} from "./chunk-26CU4Q3C.js";
|
|
31
|
+
import {
|
|
32
|
+
ProjectNotFound,
|
|
33
|
+
isAPIError
|
|
34
|
+
} from "./chunk-CV5YC2EN.js";
|
|
35
|
+
import {
|
|
36
|
+
output_manager_default
|
|
37
|
+
} from "./chunk-2JIX6UMI.js";
|
|
38
|
+
|
|
39
|
+
// src/commands/alerts/rules/parse-scope.ts
|
|
40
|
+
async function resolveRulesTeam(client, jsonOutput) {
|
|
41
|
+
const { team } = await getScope(client, { resolveLocalScope: true });
|
|
42
|
+
if (team) {
|
|
43
|
+
return { teamId: team.id };
|
|
44
|
+
}
|
|
45
|
+
const message = "No team context found. Run `vercel switch` to select a team, use `--scope <team>`, or link a team project.";
|
|
46
|
+
return emitAlertsScopeError(client, jsonOutput, "NO_TEAM", message, {
|
|
47
|
+
reason: AGENT_REASON.MISSING_SCOPE,
|
|
48
|
+
hint: "Alert rules belong to a team. Select the team before retrying.",
|
|
49
|
+
next: [
|
|
50
|
+
{
|
|
51
|
+
command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
|
|
52
|
+
when: "Select a team"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
command: buildCommandWithGlobalFlags(client.argv, "whoami"),
|
|
56
|
+
when: "Inspect the current scope"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function resolveRulesProject(client, projectNameOrId, jsonOutput, command) {
|
|
62
|
+
const teamScope = await resolveRulesTeam(client, jsonOutput);
|
|
63
|
+
if (typeof teamScope === "number") {
|
|
64
|
+
return teamScope;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const project = await getProjectByNameOrId(
|
|
68
|
+
client,
|
|
69
|
+
projectNameOrId,
|
|
70
|
+
teamScope.teamId
|
|
71
|
+
);
|
|
72
|
+
if (project instanceof ProjectNotFound) {
|
|
73
|
+
return emitAlertsScopeError(
|
|
74
|
+
client,
|
|
75
|
+
jsonOutput,
|
|
76
|
+
"PROJECT_NOT_FOUND",
|
|
77
|
+
`Project "${projectNameOrId}" was not found in the selected team.`,
|
|
78
|
+
{
|
|
79
|
+
reason: AGENT_REASON.NOT_FOUND,
|
|
80
|
+
next: [
|
|
81
|
+
{
|
|
82
|
+
command: buildCommandWithGlobalFlags(
|
|
83
|
+
client.argv,
|
|
84
|
+
`${command} --project <name_or_id>`
|
|
85
|
+
),
|
|
86
|
+
when: "Retry with a valid project"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
...teamScope,
|
|
94
|
+
projectId: project.id,
|
|
95
|
+
projectName: project.name
|
|
96
|
+
};
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (!isAPIError(error)) {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
return emitAlertsScopeError(
|
|
102
|
+
client,
|
|
103
|
+
jsonOutput,
|
|
104
|
+
error.code || "API_ERROR",
|
|
105
|
+
error.serverMessage || `API error (${error.status}).`,
|
|
106
|
+
{
|
|
107
|
+
reason: error.status === 401 ? "not_authorized" : error.status === 403 ? "forbidden" : AGENT_REASON.API_ERROR
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function parseRulesFlagsAndScope(client, flags, jsonOutput, command = "alerts rules ls") {
|
|
113
|
+
const mutual = validateAllProjectMutualExclusivity(
|
|
114
|
+
flags["--all"],
|
|
115
|
+
flags["--project"]
|
|
116
|
+
);
|
|
117
|
+
if (!mutual.valid) {
|
|
118
|
+
outputAgentError(
|
|
119
|
+
client,
|
|
120
|
+
{
|
|
121
|
+
status: "error",
|
|
122
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
123
|
+
message: mutual.message,
|
|
124
|
+
next: [
|
|
125
|
+
{
|
|
126
|
+
command: buildCommandWithGlobalFlags(
|
|
127
|
+
client.argv,
|
|
128
|
+
"alerts rules --help"
|
|
129
|
+
),
|
|
130
|
+
when: "Use either `--project` or `--all`, not both"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
1
|
|
135
|
+
);
|
|
136
|
+
return handleValidationError(mutual, jsonOutput, client);
|
|
137
|
+
}
|
|
138
|
+
if (flags["--all"]) {
|
|
139
|
+
return resolveRulesTeam(client, jsonOutput);
|
|
140
|
+
}
|
|
141
|
+
if (flags["--project"]) {
|
|
142
|
+
return resolveRulesProject(client, flags["--project"], jsonOutput, command);
|
|
143
|
+
}
|
|
144
|
+
const linkedScope = await resolveAlertsScope(client, {
|
|
145
|
+
jsonOutput,
|
|
146
|
+
command
|
|
147
|
+
});
|
|
148
|
+
if (typeof linkedScope === "number")
|
|
149
|
+
return linkedScope;
|
|
150
|
+
const teamScope = await resolveRulesTeam(client, jsonOutput);
|
|
151
|
+
if (typeof teamScope === "number")
|
|
152
|
+
return teamScope;
|
|
153
|
+
return linkedScope.teamId === teamScope.teamId ? linkedScope : teamScope;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/commands/alerts/rules/util.ts
|
|
157
|
+
import { readFileSync } from "fs";
|
|
158
|
+
import { resolve } from "path";
|
|
159
|
+
function rulesCollectionPath(teamId, options = {}) {
|
|
160
|
+
const query = new URLSearchParams({ teamId });
|
|
161
|
+
if (options.limit !== void 0)
|
|
162
|
+
query.set("limit", String(options.limit));
|
|
163
|
+
if (options.cursor)
|
|
164
|
+
query.set("cursor", options.cursor);
|
|
165
|
+
if (options.projectId)
|
|
166
|
+
query.set("projectId", options.projectId);
|
|
167
|
+
if (options.type)
|
|
168
|
+
query.set("type", options.type);
|
|
169
|
+
return `/alerts/v3/alert-rules?${query.toString()}`;
|
|
170
|
+
}
|
|
171
|
+
function rulesItemPath(teamId, ruleId) {
|
|
172
|
+
const query = new URLSearchParams({ teamId });
|
|
173
|
+
return `/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}?${query.toString()}`;
|
|
174
|
+
}
|
|
175
|
+
function rulesSchemaPath(teamId, type) {
|
|
176
|
+
const query = new URLSearchParams({ teamId });
|
|
177
|
+
if (type)
|
|
178
|
+
query.set("type", type);
|
|
179
|
+
return `/alerts/v3/alert-rules/schema?${query.toString()}`;
|
|
180
|
+
}
|
|
181
|
+
async function fetchRule(client, scope, ruleId) {
|
|
182
|
+
const response = await client.fetch(
|
|
183
|
+
rulesItemPath(scope.teamId, ruleId)
|
|
184
|
+
);
|
|
185
|
+
return response.rule;
|
|
186
|
+
}
|
|
187
|
+
function getIssues(error) {
|
|
188
|
+
if (!Array.isArray(error.issues))
|
|
189
|
+
return [];
|
|
190
|
+
return error.issues.filter(
|
|
191
|
+
(issue) => isJSONObject(issue) && typeof issue.path === "string" && typeof issue.message === "string"
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
function outputRulesError(client, jsonOutput, code, message, options = {}) {
|
|
195
|
+
const issues = options.issues ?? [];
|
|
196
|
+
const issueSummary = issues.slice(0, 5).map((issue) => `${issue.path || "body"}: ${issue.message}`).join("; ");
|
|
197
|
+
outputAgentError(
|
|
198
|
+
client,
|
|
199
|
+
{
|
|
200
|
+
status: "error",
|
|
201
|
+
reason: options.reason ?? AGENT_REASON.INVALID_ARGUMENTS,
|
|
202
|
+
message,
|
|
203
|
+
hint: options.hint ?? (issueSummary || void 0)
|
|
204
|
+
},
|
|
205
|
+
1
|
|
206
|
+
);
|
|
207
|
+
if (jsonOutput) {
|
|
208
|
+
client.stdout.write(
|
|
209
|
+
`${JSON.stringify(
|
|
210
|
+
{ error: { code, message, ...issues.length ? { issues } : {} } },
|
|
211
|
+
null,
|
|
212
|
+
2
|
|
213
|
+
)}
|
|
214
|
+
`
|
|
215
|
+
);
|
|
216
|
+
} else {
|
|
217
|
+
output_manager_default.fatal(
|
|
218
|
+
[
|
|
219
|
+
message,
|
|
220
|
+
...issues.map((issue) => ` ${issue.path}: ${issue.message}`)
|
|
221
|
+
].join("\n")
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
return 1;
|
|
225
|
+
}
|
|
226
|
+
function handleRulesApiError(client, err, jsonOutput) {
|
|
227
|
+
const message = err.status === 401 ? "You do not have access to alert rules in this team. Ensure your role can manage Alert Rules, or pass --token and --scope." : err.status === 403 ? err.serverMessage || "You do not have permission to manage alert rules in this team." : err.status >= 500 ? `The alert rules endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.` : err.serverMessage || `API error (${err.status}).`;
|
|
228
|
+
return outputRulesError(
|
|
229
|
+
client,
|
|
230
|
+
jsonOutput,
|
|
231
|
+
err.code || "API_ERROR",
|
|
232
|
+
message,
|
|
233
|
+
{
|
|
234
|
+
reason: err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : err.status === 404 ? AGENT_REASON.NOT_FOUND : err.status === 429 ? "rate_limited" : AGENT_REASON.API_ERROR,
|
|
235
|
+
issues: getIssues(err),
|
|
236
|
+
hint: err.status === 401 || err.status === 403 ? "Confirm the team with `vercel whoami`; use --scope <team-slug> if the rule belongs to another team." : void 0
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
var LEGACY_BODY_FIELDS = ["alertTypes", "customAlert", "queryJsonString"];
|
|
241
|
+
function readRuleBody(client, bodyPath, jsonOutput) {
|
|
242
|
+
let raw;
|
|
243
|
+
try {
|
|
244
|
+
raw = readFileSync(resolve(client.cwd, bodyPath), "utf8");
|
|
245
|
+
} catch {
|
|
246
|
+
return outputRulesError(
|
|
247
|
+
client,
|
|
248
|
+
jsonOutput,
|
|
249
|
+
"INVALID_ARGUMENTS",
|
|
250
|
+
`Could not read --body file: ${bodyPath}`
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
let parsed;
|
|
254
|
+
try {
|
|
255
|
+
parsed = JSON.parse(raw);
|
|
256
|
+
} catch {
|
|
257
|
+
return outputRulesError(
|
|
258
|
+
client,
|
|
259
|
+
jsonOutput,
|
|
260
|
+
"INVALID_ARGUMENTS",
|
|
261
|
+
"Invalid JSON in --body file."
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
if (!isJSONObject(parsed)) {
|
|
265
|
+
return outputRulesError(
|
|
266
|
+
client,
|
|
267
|
+
jsonOutput,
|
|
268
|
+
"INVALID_ARGUMENTS",
|
|
269
|
+
"The --body file must contain a JSON object."
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
if (LEGACY_BODY_FIELDS.some((field) => Object.hasOwn(parsed, field))) {
|
|
273
|
+
return outputRulesError(
|
|
274
|
+
client,
|
|
275
|
+
jsonOutput,
|
|
276
|
+
"LEGACY_ALERT_RULE_BODY",
|
|
277
|
+
"This body uses the previous alert-rules shape. Rewrite it using the built-in or custom schema.",
|
|
278
|
+
{
|
|
279
|
+
hint: "Run `vercel alerts rules schema --type built-in` or `vercel alerts rules schema --type custom` for examples."
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
return parsed;
|
|
284
|
+
}
|
|
285
|
+
function getBodyType(body) {
|
|
286
|
+
return body.type === "built-in" || body.type === "custom" ? body.type : void 0;
|
|
287
|
+
}
|
|
288
|
+
function emitRulesArgParseError(client, err, recoverWithProjectFlag) {
|
|
289
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
290
|
+
const projectFlagMissingArg = message.includes("--project") && message.includes("requires argument");
|
|
291
|
+
outputAgentError(
|
|
292
|
+
client,
|
|
293
|
+
{
|
|
294
|
+
status: "error",
|
|
295
|
+
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
296
|
+
message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : message,
|
|
297
|
+
next: [
|
|
298
|
+
{
|
|
299
|
+
command: buildCommandWithGlobalFlags(
|
|
300
|
+
client.argv,
|
|
301
|
+
projectFlagMissingArg ? recoverWithProjectFlag : "alerts rules --help"
|
|
302
|
+
),
|
|
303
|
+
when: projectFlagMissingArg ? "Retry with a project name or id" : "See valid `alerts rules` subcommands"
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
1
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export {
|
|
312
|
+
resolveRulesTeam,
|
|
313
|
+
resolveRulesProject,
|
|
314
|
+
parseRulesFlagsAndScope,
|
|
315
|
+
rulesCollectionPath,
|
|
316
|
+
rulesItemPath,
|
|
317
|
+
rulesSchemaPath,
|
|
318
|
+
fetchRule,
|
|
319
|
+
outputRulesError,
|
|
320
|
+
handleRulesApiError,
|
|
321
|
+
readRuleBody,
|
|
322
|
+
getBodyType,
|
|
323
|
+
emitRulesArgParseError
|
|
324
|
+
};
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isOAuthError,
|
|
14
14
|
processDeviceAuthorizationResponse,
|
|
15
15
|
processTokenResponse
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ABSZNJQO.js";
|
|
17
17
|
import {
|
|
18
18
|
printError
|
|
19
19
|
} from "./chunk-3VM7HWF6.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
getTeams,
|
|
22
22
|
getUser,
|
|
23
23
|
humanizePath
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-MADFAH3O.js";
|
|
25
25
|
import {
|
|
26
26
|
getCommandName
|
|
27
27
|
} from "./chunk-Q2DGFCO7.js";
|
|
@@ -7,7 +7,7 @@ const __dirname = __dirname_(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
login,
|
|
9
9
|
require_ci_info
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E47NARDE.js";
|
|
11
11
|
import {
|
|
12
12
|
getGlobalPathConfig
|
|
13
13
|
} from "./chunk-AINIBIP4.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
humanizePath,
|
|
19
19
|
param
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MADFAH3O.js";
|
|
21
21
|
import {
|
|
22
22
|
getCommandName
|
|
23
23
|
} from "./chunk-Q2DGFCO7.js";
|
|
@@ -13476,7 +13476,7 @@ async function resolveProjectCwd(cwd) {
|
|
|
13476
13476
|
const projectRoot = await findProjectRoot(cwd);
|
|
13477
13477
|
if (!projectRoot || projectRoot === cwd)
|
|
13478
13478
|
return cwd;
|
|
13479
|
-
const { isExperimentalServicesEnabled, tryDetectServices } = await import("./detect-services-
|
|
13479
|
+
const { isExperimentalServicesEnabled, tryDetectServices } = await import("./detect-services-UPY4LTBZ.js");
|
|
13480
13480
|
const isServicesEnabled = await isExperimentalServicesEnabled(projectRoot);
|
|
13481
13481
|
if (!isServicesEnabled) {
|
|
13482
13482
|
return cwd;
|
|
@@ -13946,7 +13946,7 @@ async function linkFolderToProject(client, path, projectLink, projectName, orgSl
|
|
|
13946
13946
|
try {
|
|
13947
13947
|
client.cwd = path;
|
|
13948
13948
|
const args = autoConfirm ? ["--yes"] : [];
|
|
13949
|
-
const { default: pull } = await import("./pull-
|
|
13949
|
+
const { default: pull } = await import("./pull-WUT3XTZX.js");
|
|
13950
13950
|
const exitCode = await pull(client, args, "vercel-cli:link");
|
|
13951
13951
|
if (exitCode !== 0) {
|
|
13952
13952
|
output_manager_default.error(
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from "./chunk-IB5L4LKZ.js";
|
|
14
14
|
import {
|
|
15
15
|
readJSONFile
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-32XSMM3W.js";
|
|
17
17
|
import {
|
|
18
18
|
VERCEL_CONFIG_EXTENSIONS
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YPMFZRTN.js";
|
|
20
20
|
import {
|
|
21
21
|
require_execa
|
|
22
22
|
} from "./chunk-5NF5HOBJ.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
VERCEL_DIR,
|
|
28
28
|
require_lib,
|
|
29
29
|
require_pluralize
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MADFAH3O.js";
|
|
31
31
|
import {
|
|
32
32
|
CantParseJSONFile,
|
|
33
33
|
code
|
|
@@ -639,7 +639,7 @@ var require_osenv = __commonJS({
|
|
|
639
639
|
var require_npa = __commonJS({
|
|
640
640
|
"../../node_modules/.pnpm/npm-package-arg@6.1.0/node_modules/npm-package-arg/npa.js"(exports, module) {
|
|
641
641
|
"use strict";
|
|
642
|
-
module.exports =
|
|
642
|
+
module.exports = npa2;
|
|
643
643
|
module.exports.resolve = resolve;
|
|
644
644
|
module.exports.Result = Result;
|
|
645
645
|
var url;
|
|
@@ -652,16 +652,16 @@ var require_npa = __commonJS({
|
|
|
652
652
|
var hasSlashes = isWindows ? /\\|[/]/ : /[/]/;
|
|
653
653
|
var isURL = /^(?:git[+])?[a-z]+:/i;
|
|
654
654
|
var isFilename = /[.](?:tgz|tar.gz|tar)$/i;
|
|
655
|
-
function
|
|
655
|
+
function npa2(arg, where) {
|
|
656
656
|
let name;
|
|
657
657
|
let spec;
|
|
658
658
|
if (typeof arg === "object") {
|
|
659
659
|
if (arg instanceof Result && (!where || where === arg.where)) {
|
|
660
660
|
return arg;
|
|
661
661
|
} else if (arg.name && arg.rawSpec) {
|
|
662
|
-
return
|
|
662
|
+
return npa2.resolve(arg.name, arg.rawSpec, where || arg.where);
|
|
663
663
|
} else {
|
|
664
|
-
return
|
|
664
|
+
return npa2(arg.raw, where || arg.where);
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
667
|
const nameEndsAt = arg[0] === "@" ? arg.slice(1).indexOf("@") + 1 : arg.indexOf("@");
|
|
@@ -873,7 +873,7 @@ var require_npa = __commonJS({
|
|
|
873
873
|
return res;
|
|
874
874
|
}
|
|
875
875
|
function fromAlias(res, where) {
|
|
876
|
-
const subSpec =
|
|
876
|
+
const subSpec = npa2(res.rawSpec.substr(4), where);
|
|
877
877
|
if (subSpec.type === "alias") {
|
|
878
878
|
throw new Error("nested aliases not supported");
|
|
879
879
|
}
|
|
@@ -949,7 +949,7 @@ var require_import_builders = __commonJS({
|
|
|
949
949
|
getBuildersDir: () => getBuildersDir2
|
|
950
950
|
});
|
|
951
951
|
module.exports = __toCommonJS(import_builders_exports);
|
|
952
|
-
var
|
|
952
|
+
var import_npm_package_arg2 = __toESM2(require_npa());
|
|
953
953
|
var import_semver = require_semver();
|
|
954
954
|
var import_path = __require("path");
|
|
955
955
|
var import_fs_extra = require_lib();
|
|
@@ -970,7 +970,7 @@ var require_import_builders = __commonJS({
|
|
|
970
970
|
function pinBuilderSpecs(specs, pins) {
|
|
971
971
|
const pinnedSpecs = /* @__PURE__ */ new Map();
|
|
972
972
|
for (const spec of specs) {
|
|
973
|
-
const parsed = (0,
|
|
973
|
+
const parsed = (0, import_npm_package_arg2.default)(spec);
|
|
974
974
|
if (parsed.name && isBareSpec(parsed)) {
|
|
975
975
|
const version2 = pins.get(parsed.name);
|
|
976
976
|
if (version2) {
|
|
@@ -1083,7 +1083,7 @@ var require_import_builders = __commonJS({
|
|
|
1083
1083
|
const installReasons = /* @__PURE__ */ new Map();
|
|
1084
1084
|
for (const spec of builderSpecs) {
|
|
1085
1085
|
const resolvedSpec = resolvedSpecs?.get(spec) || spec;
|
|
1086
|
-
const parsed = (0,
|
|
1086
|
+
const parsed = (0, import_npm_package_arg2.default)(resolvedSpec);
|
|
1087
1087
|
const { name } = parsed;
|
|
1088
1088
|
if (!name) {
|
|
1089
1089
|
buildersToAdd.add(spec);
|
|
@@ -1384,7 +1384,7 @@ var require_install_builders = __commonJS({
|
|
|
1384
1384
|
var import_url = __require("url");
|
|
1385
1385
|
var import_pluralize = __toESM2(require_pluralize());
|
|
1386
1386
|
var import_path = __require("path");
|
|
1387
|
-
var
|
|
1387
|
+
var import_npm_package_arg2 = __toESM2(require_npa());
|
|
1388
1388
|
var import_semver = require_semver();
|
|
1389
1389
|
var import_fs_extra = require_lib();
|
|
1390
1390
|
var import_error_utils = require_dist();
|
|
@@ -1395,7 +1395,7 @@ var require_install_builders = __commonJS({
|
|
|
1395
1395
|
return `@vercel/build-utils@${buildUtilsVersion}`;
|
|
1396
1396
|
}
|
|
1397
1397
|
try {
|
|
1398
|
-
if ((0,
|
|
1398
|
+
if ((0, import_npm_package_arg2.default)(buildUtilsVersion).type === "remote") {
|
|
1399
1399
|
return `@vercel/build-utils@${buildUtilsVersion}`;
|
|
1400
1400
|
}
|
|
1401
1401
|
} catch {
|
|
@@ -1594,8 +1594,74 @@ var installBuilders = (0, import_install_builders.createInstallBuilders)({
|
|
|
1594
1594
|
|
|
1595
1595
|
// src/builders/import-builders.ts
|
|
1596
1596
|
import { createRequire } from "module";
|
|
1597
|
+
|
|
1598
|
+
// src/builders/vlt-builder-graph.ts
|
|
1599
|
+
import { brotliDecompress } from "zlib";
|
|
1600
|
+
import { promisify } from "util";
|
|
1601
|
+
import { readFile } from "fs/promises";
|
|
1602
|
+
import { join } from "path";
|
|
1603
|
+
var decompress = promisify(brotliDecompress);
|
|
1604
|
+
var embeddedGraphs;
|
|
1605
|
+
function defaultGraphPaths() {
|
|
1606
|
+
return [
|
|
1607
|
+
join(__dirname, "builder-graph.json.br"),
|
|
1608
|
+
join(__dirname, "..", "builders", "builder-graph.json.br")
|
|
1609
|
+
];
|
|
1610
|
+
}
|
|
1611
|
+
async function readDefaultGraph() {
|
|
1612
|
+
let lastError;
|
|
1613
|
+
for (const path of defaultGraphPaths()) {
|
|
1614
|
+
try {
|
|
1615
|
+
return await readFile(path);
|
|
1616
|
+
} catch (error) {
|
|
1617
|
+
lastError = error;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
throw lastError;
|
|
1621
|
+
}
|
|
1622
|
+
function loadEmbeddedBuilderGraphs(readGraph = readDefaultGraph) {
|
|
1623
|
+
embeddedGraphs ??= (async () => {
|
|
1624
|
+
try {
|
|
1625
|
+
const compressed = await readGraph();
|
|
1626
|
+
const graphs = JSON.parse(
|
|
1627
|
+
(await decompress(new Uint8Array(compressed))).toString("utf8")
|
|
1628
|
+
);
|
|
1629
|
+
if (graphs.schemaVersion !== 1 || !graphs.builders || typeof graphs.builders !== "object") {
|
|
1630
|
+
throw new Error("invalid schema");
|
|
1631
|
+
}
|
|
1632
|
+
return graphs;
|
|
1633
|
+
} catch (error) {
|
|
1634
|
+
embeddedGraphs = void 0;
|
|
1635
|
+
throw new Error("Could not load the embedded vlt Builder graphs.", {
|
|
1636
|
+
cause: error
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
})();
|
|
1640
|
+
return embeddedGraphs;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
// src/builders/vlt-builder-routing.ts
|
|
1644
|
+
var import_npm_package_arg = __toESM(require_npa(), 1);
|
|
1645
|
+
function isManagedSpec(spec, managedNames) {
|
|
1646
|
+
const parsed = (0, import_npm_package_arg.default)(spec);
|
|
1647
|
+
return !!parsed.name && managedNames.has(parsed.name) && parsed.type === "tag" && (parsed.rawSpec === "" || parsed.rawSpec === "latest");
|
|
1648
|
+
}
|
|
1649
|
+
function partitionBuilderSpecs(specs, managedNames) {
|
|
1650
|
+
const managed = /* @__PURE__ */ new Map();
|
|
1651
|
+
const legacy = /* @__PURE__ */ new Set();
|
|
1652
|
+
for (const spec of specs) {
|
|
1653
|
+
if (isManagedSpec(spec, managedNames)) {
|
|
1654
|
+
managed.set(spec, (0, import_npm_package_arg.default)(spec).name);
|
|
1655
|
+
} else {
|
|
1656
|
+
legacy.add(spec);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
return { managed, legacy };
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
// src/builders/import-builders.ts
|
|
1597
1663
|
var require_ = createRequire(__filename);
|
|
1598
|
-
var
|
|
1664
|
+
var legacyImportBuilders = (0, import_import_builders.createImportBuilders)({
|
|
1599
1665
|
builderPins: pkg_default.builders ?? {},
|
|
1600
1666
|
debug: (message) => output_manager_default.debug(message),
|
|
1601
1667
|
installBuilders,
|
|
@@ -1604,6 +1670,36 @@ var importBuilders = (0, import_import_builders.createImportBuilders)({
|
|
|
1604
1670
|
staticBuilder: static_builder_exports,
|
|
1605
1671
|
vercelDir: VERCEL_DIR
|
|
1606
1672
|
});
|
|
1673
|
+
var managedBuilderNames = new Set(Object.keys(pkg_default.builders ?? {}));
|
|
1674
|
+
async function importBuilders(builderSpecs, cwd, span) {
|
|
1675
|
+
if (!isNativeBinaryInstall() || process.env.VERCEL_EXPERIMENTAL_VLT_BUILDERS !== "1") {
|
|
1676
|
+
return legacyImportBuilders(builderSpecs, cwd, span);
|
|
1677
|
+
}
|
|
1678
|
+
const { managed, legacy } = partitionBuilderSpecs(
|
|
1679
|
+
builderSpecs,
|
|
1680
|
+
managedBuilderNames
|
|
1681
|
+
);
|
|
1682
|
+
output_manager_default.debug(
|
|
1683
|
+
`Builder import routing: vlt=[${[...managed].map(([spec]) => spec).join(", ")}], legacy=[${[...legacy].join(", ")}]`
|
|
1684
|
+
);
|
|
1685
|
+
if (managed.size === 0) {
|
|
1686
|
+
return legacyImportBuilders(legacy, cwd, span);
|
|
1687
|
+
}
|
|
1688
|
+
const [{ createVltBuilderImporter }, graphs] = await Promise.all([
|
|
1689
|
+
import("./vlt-builder-importer-USCFHWPL.js"),
|
|
1690
|
+
loadEmbeddedBuilderGraphs()
|
|
1691
|
+
]);
|
|
1692
|
+
const vltImportBuilders = createVltBuilderImporter({
|
|
1693
|
+
loadGraphs: async () => graphs,
|
|
1694
|
+
require: require_,
|
|
1695
|
+
debug: (message) => output_manager_default.debug(message)
|
|
1696
|
+
});
|
|
1697
|
+
const [vltBuilders, legacyBuilders] = await Promise.all([
|
|
1698
|
+
vltImportBuilders(managed),
|
|
1699
|
+
legacy.size ? legacyImportBuilders(legacy, cwd, span) : Promise.resolve(/* @__PURE__ */ new Map())
|
|
1700
|
+
]);
|
|
1701
|
+
return new Map([...vltBuilders, ...legacyBuilders]);
|
|
1702
|
+
}
|
|
1607
1703
|
|
|
1608
1704
|
export {
|
|
1609
1705
|
require_npa,
|
|
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
writeProjectSettings
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TDGK45FB.js";
|
|
10
10
|
import {
|
|
11
11
|
autoInstallVercelPlugin
|
|
12
12
|
} from "./chunk-K3RED3VO.js";
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
} from "./chunk-64IF634X.js";
|
|
16
16
|
import {
|
|
17
17
|
envPullCommandLogic
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RNK3LXLR.js";
|
|
19
19
|
import {
|
|
20
20
|
ensureLink
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PP5GKSIX.js";
|
|
22
22
|
import {
|
|
23
23
|
pullCommand
|
|
24
24
|
} from "./chunk-UG2WOB5L.js";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
VERCEL_DIR,
|
|
42
42
|
VERCEL_DIR_PROJECT,
|
|
43
43
|
humanizePath
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-MADFAH3O.js";
|
|
45
45
|
import {
|
|
46
46
|
getFlagsSpecification
|
|
47
47
|
} from "./chunk-Q2DGFCO7.js";
|