vercel 59.11.2 → 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-BKSHWTPX.js → add-OO3JGLZW.js} +23 -18
- package/dist/chunks/{add-HPLJZFM2.js → add-RTXDASSS.js} +23 -18
- package/dist/chunks/add-XGO6LHMD.js +221 -0
- package/dist/chunks/{build-V4ZLAJWB.js → build-JINV2UD4.js} +23 -18
- package/dist/chunks/{chunk-NGGLYKNU.js → chunk-26CU4Q3C.js} +3 -115
- package/dist/chunks/{chunk-QFAS4OVW.js → chunk-2JIX6UMI.js} +3 -84
- package/dist/chunks/chunk-2NIDTSQJ.js +305 -0
- package/dist/chunks/chunk-32XSMM3W.js +49 -0
- package/dist/chunks/chunk-332LMJLZ.js +16014 -0
- package/dist/chunks/{chunk-RO44KX6Y.js → chunk-3BB2HOO2.js} +12 -7
- package/dist/chunks/{chunk-HDBQPBL6.js → chunk-3F25W3GA.js} +13 -9
- package/dist/chunks/{chunk-AYLY3ZVL.js → chunk-3VM7HWF6.js} +2 -2
- package/dist/chunks/chunk-4IALDGB7.js +22 -0
- package/dist/chunks/{chunk-MTWHQEXI.js → chunk-4TUMNBEE.js} +7 -5
- package/dist/chunks/{chunk-5XECIWME.js → chunk-5NF5HOBJ.js} +5 -3
- package/dist/chunks/chunk-6E6KPBXY.js +43 -0
- package/dist/chunks/{chunk-ASBP32T6.js → chunk-7MRDIPJY.js} +1 -1
- package/dist/chunks/chunk-ABSZNJQO.js +522 -0
- package/dist/chunks/{chunk-7ST552E3.js → chunk-AKLTIZCU.js} +1 -1
- package/dist/chunks/{chunk-ONRLTUP2.js → chunk-AV747POV.js} +43 -36
- package/dist/chunks/chunk-B5XLQKHI.js +849 -0
- package/dist/chunks/{chunk-BMKU5KEL.js → chunk-CV5YC2EN.js} +1 -1
- package/dist/chunks/{chunk-TPATD2MM.js → chunk-CZ5QQRXD.js} +14 -6
- package/dist/chunks/{chunk-2EAIC3SH.js → chunk-E47NARDE.js} +8 -8
- package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
- package/dist/chunks/{chunk-QAT3CW4G.js → chunk-EFYMIIER.js} +2 -2
- package/dist/chunks/chunk-ELZ6WQQA.js +81 -0
- package/dist/chunks/{chunk-FKDO3CM4.js → chunk-EOLGLGXJ.js} +17 -13
- package/dist/chunks/chunk-FRVG4OW3.js +7438 -0
- package/dist/chunks/chunk-G5FBSUL4.js +822 -0
- package/dist/chunks/chunk-GDOUDU6O.js +74 -0
- package/dist/chunks/{chunk-OQ3C5VXZ.js → chunk-GVNCVKCI.js} +4 -2
- package/dist/chunks/chunk-HB4UKFDO.js +1295 -0
- package/dist/chunks/{chunk-FRAXI2WT.js → chunk-HD4DR3DA.js} +4 -3
- package/dist/chunks/{chunk-DWIC7MRV.js → chunk-HKHXKSXQ.js} +1 -1
- package/dist/chunks/{chunk-6JPVTPTU.js → chunk-HM24ZWQL.js} +4 -4
- package/dist/chunks/chunk-HR2MP4XF.js +324 -0
- package/dist/chunks/chunk-HRXRELD3.js +338 -0
- package/dist/chunks/{chunk-IJ4X426J.js → chunk-IIMSID24.js} +1 -1
- package/dist/chunks/{chunk-B4TXCKXE.js → chunk-JOXNBQ7W.js} +10 -8
- package/dist/chunks/{chunk-O75LSD3C.js → chunk-JSD4EZL3.js} +1 -1
- package/dist/chunks/{chunk-7AEEQOD4.js → chunk-K3RED3VO.js} +1 -1
- package/dist/chunks/chunk-KAF4WFF3.js +257 -0
- package/dist/chunks/{chunk-3T7WSWZH.js → chunk-KFWQ3EFH.js} +1 -1
- package/dist/chunks/{chunk-6CZZ3SH3.js → chunk-KNO327AW.js} +2 -2
- package/dist/chunks/{chunk-L3UXB2CW.js → chunk-KW7BS25T.js} +1 -1
- package/dist/chunks/{chunk-2NJJ2K5S.js → chunk-L6B6BRHH.js} +6 -6
- package/dist/chunks/{chunk-FZRBF25Y.js → chunk-LDV2R4P4.js} +4 -4
- package/dist/chunks/chunk-MADFAH3O.js +14059 -0
- package/dist/chunks/{chunk-OO3OF6MK.js → chunk-MDGPZHSM.js} +151 -26
- package/dist/chunks/{chunk-XRWOTCDO.js → chunk-ND5CF2H3.js} +1 -1
- package/dist/chunks/{chunk-6TBDHUXK.js → chunk-NDY3JDOU.js} +21 -15
- package/dist/chunks/{chunk-RKDCNQ4S.js → chunk-NW34PW6V.js} +3 -105
- package/dist/chunks/{chunk-C5HKWXRR.js → chunk-OAMU5QO6.js} +1 -1
- package/dist/chunks/{chunk-RSJBU3ON.js → chunk-OJHDGHOB.js} +35 -27
- package/dist/chunks/chunk-P7VSBDR4.js +827 -0
- package/dist/chunks/chunk-PEC3CQSK.js +90 -0
- package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
- package/dist/chunks/chunk-PNGVSHR3.js +40 -0
- package/dist/chunks/chunk-PP5GKSIX.js +137 -0
- package/dist/chunks/chunk-QB2UHSUB.js +58 -0
- package/dist/chunks/chunk-QIUK4Z7Q.js +79 -0
- package/dist/chunks/chunk-RN6V5ODW.js +114 -0
- package/dist/chunks/chunk-RNK3LXLR.js +1288 -0
- package/dist/chunks/chunk-RVBZ64EQ.js +52 -0
- package/dist/chunks/{chunk-WA2SJE5S.js → chunk-SWO66HE2.js} +4 -4
- package/dist/chunks/{chunk-NBW3BWOJ.js → chunk-TDGK45FB.js} +2 -2
- package/dist/chunks/{chunk-WNAKOXGK.js → chunk-TO7QZGYK.js} +1 -1
- package/dist/chunks/{chunk-QDV5LZ4Q.js → chunk-UA55I7M6.js} +12 -8
- package/dist/chunks/{chunk-FWKSJYDV.js → chunk-UG2WOB5L.js} +1 -1
- package/dist/chunks/chunk-UJPVHLL5.js +233 -0
- package/dist/chunks/chunk-V4RMJKQP.js +36 -0
- package/dist/chunks/chunk-VJSREJVM.js +875 -0
- package/dist/chunks/chunk-VUS2JQB2.js +121 -0
- package/dist/chunks/{chunk-4KVJ2M4J.js → chunk-WPBCUXMZ.js} +582 -37
- package/dist/chunks/chunk-WSZ5E4WH.js +92 -0
- package/dist/chunks/{chunk-Q5K5DEOK.js → chunk-WT2Y7FRD.js} +42 -28
- package/dist/chunks/chunk-WT6C2ALC.js +18188 -0
- package/dist/chunks/chunk-X6TGUHFD.js +59 -0
- package/dist/chunks/{chunk-ZSFEACZU.js → chunk-XFF5TGRA.js} +1 -1
- package/dist/chunks/chunk-XNIZGCN5.js +58 -0
- package/dist/chunks/chunk-XPJLPUKO.js +117 -0
- package/dist/chunks/{chunk-FXD67VN5.js → chunk-XUAWTW4W.js} +1 -1
- package/dist/chunks/chunk-YPMFZRTN.js +417 -0
- package/dist/chunks/chunk-YRESLJCW.js +1536 -0
- package/dist/chunks/{chunk-I526H4AS.js → chunk-YS76T533.js} +2 -2
- package/dist/chunks/{chunk-52QYYTM5.js → chunk-ZDU2NODC.js} +3 -127
- package/dist/chunks/chunk-ZW6HETRE.js +97 -0
- package/dist/chunks/{clear-IYGWCNXT.js → clear-GQTDYSKJ.js} +23 -18
- package/dist/chunks/{compile-vercel-config-NEEBZRUJ.js → compile-vercel-config-URVMKDVW.js} +8 -11
- package/dist/chunks/{config-6DS6BBR2.js → config-MSVQR5T6.js} +23 -18
- package/dist/chunks/{config-NTB5EMV4.js → config-OAXY4J6P.js} +23 -18
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{delete-LSGID5FV.js → delete-57QO64HD.js} +19 -14
- package/dist/chunks/{delete-LLC2OGHA.js → delete-XN6ESD7C.js} +16 -12
- package/dist/chunks/detect-projects-ODNU4PK2.js +18 -0
- package/dist/chunks/detect-services-UPY4LTBZ.js +40 -0
- package/dist/chunks/{disable-H4EXEQK7.js → disable-BYI46V7B.js} +17 -13
- package/dist/chunks/{discard-FG6VKHWN.js → discard-IIQL44ZZ.js} +17 -13
- package/dist/chunks/{edit-BZJSGUHT.js → edit-BRNS3OR4.js} +19 -15
- package/dist/chunks/{edit-YE7D3CPJ.js → edit-JTW7XZH7.js} +17 -13
- package/dist/chunks/{enable-6ESD4QTE.js → enable-CH5FSQMR.js} +17 -13
- package/dist/chunks/{exec-XH4K34JM.js → exec-4IPHZ55G.js} +9 -5
- package/dist/chunks/{export-QWSJROLG.js → export-6WHQOWKM.js} +16 -13
- package/dist/chunks/{image-LTHQMKFG.js → image-ZSLYATWG.js} +11 -8
- package/dist/chunks/{import-builders-6O7ILGQJ.js → import-builders-FNMYJZGG.js} +18 -13
- package/dist/chunks/{inspect-2C4ZSNYC.js → inspect-4RDZSYWU.js} +27 -23
- package/dist/chunks/{inspect-N6SMHV3Z.js → inspect-7WQXZWET.js} +18 -14
- package/dist/chunks/{inspect-F7KCTHIL.js → inspect-CGXTNMMO.js} +19 -15
- package/dist/chunks/{inspect-ICKNCDMT.js → inspect-XJ7BYLZ5.js} +18 -14
- package/dist/chunks/{inspect-TWDPMXZ5.js → inspect-Z2MBTTB7.js} +18 -14
- package/dist/chunks/{list-NWTIJF3L.js → list-65LW6OTM.js} +20 -16
- package/dist/chunks/{list-DS7ZOUXA.js → list-7W3PHRB6.js} +25 -21
- package/dist/chunks/{list-IPGQVBJO.js → list-KS22Y57L.js} +16 -14
- package/dist/chunks/{login-F7A7ONKC.js → login-NXULVQZ2.js} +23 -18
- package/dist/chunks/{ls-2QW3ZSM6.js → ls-35EOVEIQ.js} +24 -18
- package/dist/chunks/{ls-XINES6PL.js → ls-5GKS5QRW.js} +24 -18
- package/dist/chunks/ls-ADYFYYIW.js +204 -0
- package/dist/chunks/{ls-D4TUDBIH.js → ls-DZYN3SNS.js} +24 -18
- package/dist/chunks/{ls-LSJEUPFX.js → ls-HVQOGBGV.js} +23 -16
- package/dist/chunks/{ls-NBDX3MKN.js → ls-I2PWG7YN.js} +24 -18
- package/dist/chunks/{open-VRQDWZAW.js → open-H34HXJHP.js} +18 -13
- package/dist/chunks/{permissions-6C5C7TEV.js → permissions-ZPPEPKVE.js} +14 -11
- package/dist/chunks/{publish-GVIZPNLN.js → publish-NRMKXHAU.js} +17 -13
- package/dist/chunks/pull-WUT3XTZX.js +45 -0
- package/dist/chunks/{push-EFZ5P5Z6.js → push-WFNCEA5J.js} +23 -18
- package/dist/chunks/{query-GBS2PIT4.js → query-2FQM3F7N.js} +23 -20
- package/dist/chunks/{reorder-TN65IFRL.js → reorder-GYCT7L3C.js} +17 -13
- package/dist/chunks/{reply-DYVEV3PY.js → reply-RFEXNYZ7.js} +17 -13
- package/dist/chunks/{resolve-JAWFBPUM.js → resolve-ZFGT7W6Z.js} +16 -12
- package/dist/chunks/resolve-deployment-framework-preset-NPE6RLV3.js +36 -0
- package/dist/chunks/{restore-TJVMHUBQ.js → restore-JAXPMYL5.js} +17 -13
- package/dist/chunks/rm-CLKQN5E4.js +162 -0
- package/dist/chunks/{rm-HQ5CYNJA.js → rm-JPV5V2SH.js} +23 -18
- package/dist/chunks/{rm-7XACNZ2U.js → rm-N7SGFQOA.js} +23 -18
- package/dist/chunks/{rm-REJVXALW.js → rm-UQJ4CZJH.js} +23 -18
- package/dist/chunks/{rm-CBPNMSRP.js → rm-ZUQ4U454.js} +24 -17
- package/dist/chunks/{routes-2OLIBRYX.js → routes-QVMBXOSX.js} +7 -3
- package/dist/chunks/rule-inspect-HI3YY7OY.js +123 -0
- package/dist/chunks/{rules-VGV4M4KY.js → rules-DA3Q64M4.js} +15 -12
- package/dist/chunks/{schema-GMTQOQCV.js → schema-R3C4CXJ6.js} +20 -18
- package/dist/chunks/schema-UYYFV3JB.js +381 -0
- package/dist/chunks/{set-Z5FO2FCC.js → set-TOJPGW4J.js} +21 -14
- package/dist/chunks/setup-and-link-DRYXQOH4.js +65 -0
- package/dist/chunks/{tags-SDRXWJ63.js → tags-TNLVFNVI.js} +10 -7
- package/dist/chunks/{types-JGANJ5EQ.js → types-4GAJ7XQQ.js} +9 -7
- package/dist/chunks/update-X6JB3NPI.js +224 -0
- package/dist/chunks/vlt-builder-importer-USCFHWPL.js +322 -0
- package/dist/commands/build/index.js +86 -49
- package/dist/commands/deploy/index.js +76 -67
- package/dist/commands/dev/index.js +98 -52
- package/dist/commands/env/index.js +68 -44
- package/dist/commands/link/index.js +49 -28
- package/dist/commands/list/index.js +33 -22
- package/dist/commands-bulk.js +8715 -3581
- package/dist/help.js +1 -1
- package/dist/index.js +74 -42
- 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-RBW7QITR.js +0 -219
- package/dist/chunks/chunk-26XDDLXM.js +0 -144
- package/dist/chunks/chunk-5GGUB4EO.js +0 -31
- package/dist/chunks/chunk-MXLA3VQS.js +0 -20
- package/dist/chunks/chunk-OTXE7MHI.js +0 -96
- package/dist/chunks/chunk-RSEAADCE.js +0 -138
- package/dist/chunks/chunk-WYU64FLP.js +0 -62123
- package/dist/chunks/chunk-XNFHNTS2.js +0 -2939
- package/dist/chunks/ls-RNGO257R.js +0 -193
- package/dist/chunks/rm-5B5VHWWN.js +0 -170
- package/dist/chunks/rule-inspect-ZSTDDFID.js +0 -281
- package/dist/chunks/schema-45SJNY5L.js +0 -427
- package/dist/chunks/update-JBQBC3IV.js +0 -233
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
printRuleMutationReceipt
|
|
9
|
+
} from "./chunk-2NIDTSQJ.js";
|
|
10
|
+
import "./chunk-GDOUDU6O.js";
|
|
11
|
+
import {
|
|
12
|
+
emitRulesArgParseError,
|
|
13
|
+
fetchRule,
|
|
14
|
+
handleRulesApiError,
|
|
15
|
+
outputRulesError,
|
|
16
|
+
readRuleBody,
|
|
17
|
+
resolveRulesProject,
|
|
18
|
+
resolveRulesTeam,
|
|
19
|
+
rulesItemPath
|
|
20
|
+
} from "./chunk-HR2MP4XF.js";
|
|
21
|
+
import "./chunk-3BB2HOO2.js";
|
|
22
|
+
import "./chunk-GZLPFESR.js";
|
|
23
|
+
import "./chunk-A3NYPUKZ.js";
|
|
24
|
+
import "./chunk-KFWQ3EFH.js";
|
|
25
|
+
import "./chunk-FGDKMNEN.js";
|
|
26
|
+
import "./chunk-PRWJUY5U.js";
|
|
27
|
+
import "./chunk-WT2Y7FRD.js";
|
|
28
|
+
import "./chunk-AINIBIP4.js";
|
|
29
|
+
import "./chunk-QB2UHSUB.js";
|
|
30
|
+
import "./chunk-ND5CF2H3.js";
|
|
31
|
+
import {
|
|
32
|
+
validateJsonOutput
|
|
33
|
+
} from "./chunk-KXDWXXJH.js";
|
|
34
|
+
import "./chunk-V4RMJKQP.js";
|
|
35
|
+
import {
|
|
36
|
+
rulesUpdateSubcommand
|
|
37
|
+
} from "./chunk-EDMW7SBH.js";
|
|
38
|
+
import "./chunk-WT6C2ALC.js";
|
|
39
|
+
import "./chunk-P7VSBDR4.js";
|
|
40
|
+
import "./chunk-YPMFZRTN.js";
|
|
41
|
+
import "./chunk-ZDU2NODC.js";
|
|
42
|
+
import "./chunk-PEC3CQSK.js";
|
|
43
|
+
import "./chunk-GGP5R3FU.js";
|
|
44
|
+
import "./chunk-VUS2JQB2.js";
|
|
45
|
+
import "./chunk-KAF4WFF3.js";
|
|
46
|
+
import "./chunk-HRXRELD3.js";
|
|
47
|
+
import "./chunk-B5XLQKHI.js";
|
|
48
|
+
import "./chunk-ABSZNJQO.js";
|
|
49
|
+
import "./chunk-XNIZGCN5.js";
|
|
50
|
+
import "./chunk-NW34PW6V.js";
|
|
51
|
+
import {
|
|
52
|
+
printError
|
|
53
|
+
} from "./chunk-3VM7HWF6.js";
|
|
54
|
+
import {
|
|
55
|
+
parseArguments
|
|
56
|
+
} from "./chunk-57RHXXXG.js";
|
|
57
|
+
import "./chunk-MADFAH3O.js";
|
|
58
|
+
import "./chunk-G5FBSUL4.js";
|
|
59
|
+
import "./chunk-26CU4Q3C.js";
|
|
60
|
+
import "./chunk-XPJLPUKO.js";
|
|
61
|
+
import {
|
|
62
|
+
isAPIError
|
|
63
|
+
} from "./chunk-CV5YC2EN.js";
|
|
64
|
+
import {
|
|
65
|
+
getFlagsSpecification,
|
|
66
|
+
packageName
|
|
67
|
+
} from "./chunk-Q2DGFCO7.js";
|
|
68
|
+
import {
|
|
69
|
+
output_manager_default
|
|
70
|
+
} from "./chunk-2JIX6UMI.js";
|
|
71
|
+
import "./chunk-P4QNYOFB.js";
|
|
72
|
+
import "./chunk-ZW6HETRE.js";
|
|
73
|
+
import "./chunk-S7KYDPEM.js";
|
|
74
|
+
import "./chunk-TZ2YI2VH.js";
|
|
75
|
+
|
|
76
|
+
// src/commands/alerts/rules/update.ts
|
|
77
|
+
function sameScope(left, right) {
|
|
78
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
79
|
+
}
|
|
80
|
+
function scopeForRule(client, type, scope, flags, jsonOutput) {
|
|
81
|
+
if (flags["--project"]) {
|
|
82
|
+
return type === "custom" ? { type: "project", projectId: scope.projectId } : { type: "include", projectIds: [scope.projectId] };
|
|
83
|
+
}
|
|
84
|
+
if (type === "custom") {
|
|
85
|
+
return outputRulesError(
|
|
86
|
+
client,
|
|
87
|
+
jsonOutput,
|
|
88
|
+
"INVALID_SCOPE",
|
|
89
|
+
"Custom alert rules must target one project. Use --project <name-or-id>."
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return { type: "all" };
|
|
93
|
+
}
|
|
94
|
+
async function resolveUpdateScope(client, flags, jsonOutput, ruleId) {
|
|
95
|
+
if (flags["--project"] && flags["--all"]) {
|
|
96
|
+
return outputRulesError(
|
|
97
|
+
client,
|
|
98
|
+
jsonOutput,
|
|
99
|
+
"MUTUAL_EXCLUSIVITY",
|
|
100
|
+
"Cannot specify both --all and --project. Use one or the other."
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return flags["--project"] ? resolveRulesProject(
|
|
104
|
+
client,
|
|
105
|
+
flags["--project"],
|
|
106
|
+
jsonOutput,
|
|
107
|
+
`alerts rules update ${ruleId}`
|
|
108
|
+
) : resolveRulesTeam(client, jsonOutput);
|
|
109
|
+
}
|
|
110
|
+
function writeRuleResult(client, jsonOutput, action, rule) {
|
|
111
|
+
if (jsonOutput) {
|
|
112
|
+
client.stdout.write(`${JSON.stringify({ rule }, null, 2)}
|
|
113
|
+
`);
|
|
114
|
+
} else {
|
|
115
|
+
printRuleMutationReceipt(action, rule, client.argv);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function update(client, argv) {
|
|
119
|
+
let parsedArgs;
|
|
120
|
+
try {
|
|
121
|
+
parsedArgs = parseArguments(
|
|
122
|
+
argv,
|
|
123
|
+
getFlagsSpecification(rulesUpdateSubcommand.options)
|
|
124
|
+
);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
emitRulesArgParseError(
|
|
127
|
+
client,
|
|
128
|
+
error,
|
|
129
|
+
"alerts rules update <rule-id> --project <name-or-id>"
|
|
130
|
+
);
|
|
131
|
+
printError(error);
|
|
132
|
+
return 1;
|
|
133
|
+
}
|
|
134
|
+
const flags = parsedArgs.flags;
|
|
135
|
+
const format = validateJsonOutput(flags);
|
|
136
|
+
if (!format.valid) {
|
|
137
|
+
return outputRulesError(client, false, "INVALID_ARGUMENTS", format.error);
|
|
138
|
+
}
|
|
139
|
+
const ruleId = parsedArgs.args[0];
|
|
140
|
+
if (!ruleId) {
|
|
141
|
+
return outputRulesError(
|
|
142
|
+
client,
|
|
143
|
+
format.jsonOutput,
|
|
144
|
+
"MISSING_ARGUMENTS",
|
|
145
|
+
`Missing rule ID. Example: ${packageName} alerts rules update <rule-id> --body <file>`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
const hasScopeFlag = Boolean(flags["--project"] || flags["--all"]);
|
|
149
|
+
if (!flags["--body"] && !hasScopeFlag) {
|
|
150
|
+
return outputRulesError(
|
|
151
|
+
client,
|
|
152
|
+
format.jsonOutput,
|
|
153
|
+
"MISSING_ARGUMENTS",
|
|
154
|
+
"Provide --body <PATH>, --project <name-or-id>, or --all."
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
const body = flags["--body"] ? readRuleBody(client, flags["--body"], format.jsonOutput) : {};
|
|
158
|
+
if (typeof body === "number")
|
|
159
|
+
return body;
|
|
160
|
+
if (Object.hasOwn(body, "type") && body.type !== "built-in" && body.type !== "custom") {
|
|
161
|
+
return outputRulesError(
|
|
162
|
+
client,
|
|
163
|
+
format.jsonOutput,
|
|
164
|
+
"INVALID_RULE_TYPE",
|
|
165
|
+
"When provided, update body type must be built-in or custom."
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
if (hasScopeFlag && Object.hasOwn(body, "ruleScope")) {
|
|
169
|
+
return outputRulesError(
|
|
170
|
+
client,
|
|
171
|
+
format.jsonOutput,
|
|
172
|
+
"SCOPE_CONFLICT",
|
|
173
|
+
"Specify rule scope either in the body or with --project/--all, not both."
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
const scope = await resolveUpdateScope(
|
|
177
|
+
client,
|
|
178
|
+
flags,
|
|
179
|
+
format.jsonOutput,
|
|
180
|
+
ruleId
|
|
181
|
+
);
|
|
182
|
+
if (typeof scope === "number")
|
|
183
|
+
return scope;
|
|
184
|
+
try {
|
|
185
|
+
let existing;
|
|
186
|
+
if (hasScopeFlag) {
|
|
187
|
+
output_manager_default.spinner("Fetching alert rule\u2026");
|
|
188
|
+
existing = await fetchRule(client, scope, ruleId);
|
|
189
|
+
const desiredScope = scopeForRule(
|
|
190
|
+
client,
|
|
191
|
+
existing.type,
|
|
192
|
+
scope,
|
|
193
|
+
flags,
|
|
194
|
+
format.jsonOutput
|
|
195
|
+
);
|
|
196
|
+
if (typeof desiredScope === "number")
|
|
197
|
+
return desiredScope;
|
|
198
|
+
if (!sameScope(existing.ruleScope, desiredScope)) {
|
|
199
|
+
body.ruleScope = desiredScope;
|
|
200
|
+
} else if (Object.keys(body).length === 0) {
|
|
201
|
+
output_manager_default.stopSpinner();
|
|
202
|
+
writeRuleResult(client, format.jsonOutput, "Unchanged", existing);
|
|
203
|
+
return 0;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
output_manager_default.spinner("Updating alert rule\u2026");
|
|
207
|
+
const response = await client.fetch(
|
|
208
|
+
rulesItemPath(scope.teamId, ruleId),
|
|
209
|
+
{ method: "PATCH", body }
|
|
210
|
+
);
|
|
211
|
+
writeRuleResult(client, format.jsonOutput, "Updated", response.rule);
|
|
212
|
+
return 0;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (isAPIError(error)) {
|
|
215
|
+
return handleRulesApiError(client, error, format.jsonOutput);
|
|
216
|
+
}
|
|
217
|
+
throw error;
|
|
218
|
+
} finally {
|
|
219
|
+
output_manager_default.stopSpinner();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
update as default
|
|
224
|
+
};
|
|
@@ -0,0 +1,322 @@
|
|
|
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 "./chunk-TZ2YI2VH.js";
|
|
8
|
+
|
|
9
|
+
// src/builders/vlt-builder-importer.ts
|
|
10
|
+
import { createHash, randomBytes } from "crypto";
|
|
11
|
+
import {
|
|
12
|
+
link,
|
|
13
|
+
lstat,
|
|
14
|
+
mkdir,
|
|
15
|
+
open,
|
|
16
|
+
readFile,
|
|
17
|
+
rename,
|
|
18
|
+
rm,
|
|
19
|
+
unlink,
|
|
20
|
+
writeFile
|
|
21
|
+
} from "fs/promises";
|
|
22
|
+
import { join } from "path";
|
|
23
|
+
import { install } from "@vltpkg/graph";
|
|
24
|
+
import { PackageInfoClient } from "@vltpkg/package-info";
|
|
25
|
+
import { PackageJson } from "@vltpkg/package-json";
|
|
26
|
+
import { getCachePath } from "@vercel/cli-config";
|
|
27
|
+
import { PathScurry } from "path-scurry";
|
|
28
|
+
var LOCK_RETRY_MS = 50;
|
|
29
|
+
var LOCK_WAIT_MS = 5 * 60 * 1e3;
|
|
30
|
+
var LOCK_EMPTY_GRACE_MS = 1e3;
|
|
31
|
+
var TARBALL_FETCH_TIMEOUT_MS = 2 * 60 * 1e3;
|
|
32
|
+
var activeInstallations = /* @__PURE__ */ new Map();
|
|
33
|
+
function compareKeys(a, b) {
|
|
34
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
35
|
+
}
|
|
36
|
+
function canonicalize(value) {
|
|
37
|
+
if (Array.isArray(value))
|
|
38
|
+
return value.map(canonicalize);
|
|
39
|
+
if (value && typeof value === "object") {
|
|
40
|
+
return Object.fromEntries(
|
|
41
|
+
Object.entries(value).sort(([a], [b]) => compareKeys(a, b)).map(([key, child]) => [key, canonicalize(child)])
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function validateGraph(graph) {
|
|
47
|
+
const { hash, ...contents } = graph;
|
|
48
|
+
const actual = createHash("sha256").update(JSON.stringify(canonicalize(contents))).digest("hex");
|
|
49
|
+
if (actual !== hash) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`The embedded vlt Builder graph for ${graph.name} is invalid.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function wait(ms) {
|
|
56
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
57
|
+
}
|
|
58
|
+
function hasErrorCode(error, code) {
|
|
59
|
+
return error instanceof Error && "code" in error && error.code === code;
|
|
60
|
+
}
|
|
61
|
+
function isProcessAlive(pid) {
|
|
62
|
+
try {
|
|
63
|
+
process.kill(pid, 0);
|
|
64
|
+
return true;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
return hasErrorCode(error, "EPERM");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function isLockHolderAlive(path) {
|
|
70
|
+
try {
|
|
71
|
+
const pid = Number.parseInt((await readFile(path, "utf8")).trim(), 10);
|
|
72
|
+
return Number.isInteger(pid) && pid > 0 && isProcessAlive(pid);
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function tryStealStaleLock(path, emptyGraceMs) {
|
|
78
|
+
let first;
|
|
79
|
+
try {
|
|
80
|
+
first = await lstat(path);
|
|
81
|
+
} catch {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
if (first.size === 0 && Date.now() - first.mtimeMs < emptyGraceMs) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (await isLockHolderAlive(path))
|
|
88
|
+
return false;
|
|
89
|
+
let second;
|
|
90
|
+
try {
|
|
91
|
+
second = await lstat(path);
|
|
92
|
+
} catch {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
if (second.dev !== first.dev || second.ino !== first.ino || second.mtimeMs !== first.mtimeMs || second.size !== first.size) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
await unlink(path);
|
|
100
|
+
return true;
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function acquireLock(path, {
|
|
106
|
+
waitMs = LOCK_WAIT_MS,
|
|
107
|
+
emptyGraceMs = LOCK_EMPTY_GRACE_MS
|
|
108
|
+
} = {}) {
|
|
109
|
+
await mkdir(join(path, ".."), { recursive: true });
|
|
110
|
+
const startedAt = Date.now();
|
|
111
|
+
while (true) {
|
|
112
|
+
const tmp = `${path}.${process.pid}-${randomBytes(6).toString("hex")}`;
|
|
113
|
+
await writeFile(tmp, `${process.pid}
|
|
114
|
+
`, { flag: "wx" });
|
|
115
|
+
try {
|
|
116
|
+
await link(tmp, path);
|
|
117
|
+
await unlink(tmp).catch(() => void 0);
|
|
118
|
+
return await open(path, "r");
|
|
119
|
+
} catch (error) {
|
|
120
|
+
await unlink(tmp).catch(() => void 0);
|
|
121
|
+
if (!hasErrorCode(error, "EEXIST"))
|
|
122
|
+
throw error;
|
|
123
|
+
if (await tryStealStaleLock(path, emptyGraceMs))
|
|
124
|
+
continue;
|
|
125
|
+
if (Date.now() - startedAt > waitMs) {
|
|
126
|
+
throw new Error(`Timed out waiting for vlt Builder lock "${path}".`);
|
|
127
|
+
}
|
|
128
|
+
await wait(LOCK_RETRY_MS);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function installationComplete(root, graph) {
|
|
133
|
+
try {
|
|
134
|
+
return (await readFile(join(root, ".vercel-builder-graph"), "utf8")).trim() === graph.hash;
|
|
135
|
+
} catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
var EmbeddedPackageInfoClient = class extends PackageInfoClient {
|
|
140
|
+
constructor(options, fetchTimeoutMs = TARBALL_FETCH_TIMEOUT_MS) {
|
|
141
|
+
super(options);
|
|
142
|
+
this.fetchTimeoutMs = fetchTimeoutMs;
|
|
143
|
+
}
|
|
144
|
+
async extract(...args) {
|
|
145
|
+
const [rawSpec, target, rawOptions = {}] = args;
|
|
146
|
+
const spec = rawSpec;
|
|
147
|
+
const options = rawOptions;
|
|
148
|
+
if (spec.final?.type === "remote" && options.resolved) {
|
|
149
|
+
if (!options.integrity) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`Missing integrity for remote Builder dependency ${options.resolved}`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
let response;
|
|
155
|
+
try {
|
|
156
|
+
response = await fetch(options.resolved, {
|
|
157
|
+
signal: AbortSignal.timeout(this.fetchTimeoutMs)
|
|
158
|
+
});
|
|
159
|
+
} catch (error) {
|
|
160
|
+
const aborted = error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
|
|
161
|
+
if (aborted) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
`Timed out downloading remote Builder dependency ${options.resolved}`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
if (!response.ok) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
`Could not download remote Builder dependency ${options.resolved}: ${response.status}`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
174
|
+
const integrity = `sha512-${createHash("sha512").update(new Uint8Array(bytes)).digest("base64")}`;
|
|
175
|
+
if (options.integrity !== integrity) {
|
|
176
|
+
throw new Error(
|
|
177
|
+
`Integrity check failed for remote Builder dependency ${options.resolved}`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
const prototype = PackageInfoClient.prototype;
|
|
181
|
+
await (await prototype.getTarPool.call(this)).unpack(
|
|
182
|
+
new Uint8Array(bytes),
|
|
183
|
+
target
|
|
184
|
+
);
|
|
185
|
+
return { resolved: options.resolved, integrity, spec: rawSpec };
|
|
186
|
+
}
|
|
187
|
+
return super.extract(...args);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
async function reifyGraph(root, graph, packageInfoFactory) {
|
|
191
|
+
const packageJson = new PackageJson();
|
|
192
|
+
const packageInfo = packageInfoFactory({
|
|
193
|
+
...graph.lockfile.options,
|
|
194
|
+
projectRoot: root,
|
|
195
|
+
packageJson
|
|
196
|
+
});
|
|
197
|
+
await install({
|
|
198
|
+
...graph.lockfile.options,
|
|
199
|
+
projectRoot: root,
|
|
200
|
+
packageJson,
|
|
201
|
+
packageInfo,
|
|
202
|
+
scurry: new PathScurry(root),
|
|
203
|
+
allowScripts: ":not(*)",
|
|
204
|
+
frozenLockfile: true,
|
|
205
|
+
cleanInstall: true
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
async function ensureGraph(graph, cacheRoot, packageInfoFactory) {
|
|
209
|
+
validateGraph(graph);
|
|
210
|
+
const root = join(cacheRoot, graph.hash);
|
|
211
|
+
const active = activeInstallations.get(root);
|
|
212
|
+
if (active)
|
|
213
|
+
return active;
|
|
214
|
+
const installation = (async () => {
|
|
215
|
+
if (await installationComplete(root, graph))
|
|
216
|
+
return root;
|
|
217
|
+
const lockPath = join(cacheRoot, "locks", `${graph.hash}.lock`);
|
|
218
|
+
const lock = await acquireLock(lockPath);
|
|
219
|
+
let temporaryRoot;
|
|
220
|
+
try {
|
|
221
|
+
if (await installationComplete(root, graph))
|
|
222
|
+
return root;
|
|
223
|
+
await rm(root, { recursive: true, force: true });
|
|
224
|
+
temporaryRoot = process.platform === "win32" ? root : join(
|
|
225
|
+
cacheRoot,
|
|
226
|
+
"tmp",
|
|
227
|
+
`${graph.hash}-${process.pid}-${randomBytes(6).toString("hex")}`
|
|
228
|
+
);
|
|
229
|
+
await mkdir(temporaryRoot, { recursive: true });
|
|
230
|
+
await writeFile(
|
|
231
|
+
join(temporaryRoot, "package.json"),
|
|
232
|
+
`${JSON.stringify(graph.manifest, null, 2)}
|
|
233
|
+
`
|
|
234
|
+
);
|
|
235
|
+
await writeFile(
|
|
236
|
+
join(temporaryRoot, "vlt-lock.json"),
|
|
237
|
+
`${JSON.stringify(graph.lockfile, null, 2)}
|
|
238
|
+
`
|
|
239
|
+
);
|
|
240
|
+
await reifyGraph(temporaryRoot, graph, packageInfoFactory);
|
|
241
|
+
await writeFile(
|
|
242
|
+
join(temporaryRoot, ".vercel-builder-graph"),
|
|
243
|
+
`${graph.hash}
|
|
244
|
+
`
|
|
245
|
+
);
|
|
246
|
+
if (temporaryRoot !== root) {
|
|
247
|
+
await mkdir(join(root, ".."), { recursive: true });
|
|
248
|
+
await rename(temporaryRoot, root);
|
|
249
|
+
}
|
|
250
|
+
temporaryRoot = void 0;
|
|
251
|
+
return root;
|
|
252
|
+
} finally {
|
|
253
|
+
await lock.close();
|
|
254
|
+
await unlink(lockPath).catch(() => void 0);
|
|
255
|
+
if (temporaryRoot)
|
|
256
|
+
await rm(temporaryRoot, { recursive: true, force: true });
|
|
257
|
+
}
|
|
258
|
+
})();
|
|
259
|
+
activeInstallations.set(root, installation);
|
|
260
|
+
const clearInstallation = () => {
|
|
261
|
+
if (activeInstallations.get(root) === installation) {
|
|
262
|
+
activeInstallations.delete(root);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
void installation.then(clearInstallation, clearInstallation);
|
|
266
|
+
return installation;
|
|
267
|
+
}
|
|
268
|
+
function createVltBuilderImporter({
|
|
269
|
+
graphs,
|
|
270
|
+
loadGraphs = async () => graphs,
|
|
271
|
+
require: require2,
|
|
272
|
+
cacheRoot = join(getCachePath(), "builders-vlt"),
|
|
273
|
+
packageInfoFactory = (options) => new EmbeddedPackageInfoClient(options),
|
|
274
|
+
debug = () => void 0
|
|
275
|
+
}) {
|
|
276
|
+
return async function importVltBuilders(specs) {
|
|
277
|
+
if (specs.size === 0)
|
|
278
|
+
return /* @__PURE__ */ new Map();
|
|
279
|
+
const loadedGraphs = await loadGraphs();
|
|
280
|
+
if (loadedGraphs.schemaVersion !== 1) {
|
|
281
|
+
throw new Error("The embedded vlt Builder graph index is invalid.");
|
|
282
|
+
}
|
|
283
|
+
const builders = /* @__PURE__ */ new Map();
|
|
284
|
+
await Promise.all(
|
|
285
|
+
[...specs].map(async ([spec, name]) => {
|
|
286
|
+
const graph = loadedGraphs.builders[name];
|
|
287
|
+
if (!graph)
|
|
288
|
+
throw new Error(`No pinned vlt graph exists for ${name}.`);
|
|
289
|
+
const root = await ensureGraph(graph, cacheRoot, packageInfoFactory);
|
|
290
|
+
const pkgPath = require2.resolve(`${name}/package.json`, {
|
|
291
|
+
paths: [root]
|
|
292
|
+
});
|
|
293
|
+
const pkg = JSON.parse(
|
|
294
|
+
await readFile(pkgPath, "utf8")
|
|
295
|
+
);
|
|
296
|
+
if (pkg.name !== name || pkg.version !== graph.version) {
|
|
297
|
+
throw new Error(
|
|
298
|
+
`The vlt Builder graph materialized ${String(pkg.name)}@${String(
|
|
299
|
+
pkg.version
|
|
300
|
+
)} instead of ${name}@${graph.version}.`
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
const path = require2.resolve(name, { paths: [root] });
|
|
304
|
+
debug(`Resolved ${name}@${graph.version} with vlt from ${root}`);
|
|
305
|
+
builders.set(spec, {
|
|
306
|
+
path,
|
|
307
|
+
pkgPath,
|
|
308
|
+
pkg: { ...pkg, name },
|
|
309
|
+
builder: require2(path),
|
|
310
|
+
dynamicallyInstalled: true
|
|
311
|
+
});
|
|
312
|
+
})
|
|
313
|
+
);
|
|
314
|
+
return builders;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
export {
|
|
318
|
+
EmbeddedPackageInfoClient,
|
|
319
|
+
TARBALL_FETCH_TIMEOUT_MS,
|
|
320
|
+
acquireLock,
|
|
321
|
+
createVltBuilderImporter
|
|
322
|
+
};
|