@depup/vercel 50.44.0-depup.0 → 58.4.4-depup.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.
Files changed (152) hide show
  1. package/README.md +11 -10
  2. package/changes.json +24 -20
  3. package/dist/chunks/add-245XOFJO.js +136 -0
  4. package/dist/chunks/add-P7WBQMBW.js +182 -0
  5. package/dist/chunks/add-XH24V5VU.js +187 -0
  6. package/dist/chunks/build-M7NJYJPE.js +243 -0
  7. package/dist/chunks/{chunk-Y4JJYHUG.js → chunk-2473DUBR.js} +4 -5
  8. package/dist/chunks/{chunk-65IHMJX4.js → chunk-2FMPLU44.js} +33 -8
  9. package/dist/chunks/chunk-2LBVX2H3.js +247 -0
  10. package/dist/chunks/{chunk-TBW2XDGN.js → chunk-2MAPZXVV.js} +30 -16
  11. package/dist/chunks/{chunk-C5YP6KFI.js → chunk-2SFMOCWR.js} +28 -9
  12. package/dist/chunks/chunk-2WILSD7J.js +245 -0
  13. package/dist/chunks/{chunk-2IAZZEVQ.js → chunk-3KNPVXJ3.js} +10 -10
  14. package/dist/chunks/{chunk-YYWNQQSE.js → chunk-3QAUXPIR.js} +6406 -2229
  15. package/dist/chunks/chunk-3ZE5CFVM.js +346 -0
  16. package/dist/chunks/{chunk-A5XRYFVO.js → chunk-4BUPRO5B.js} +111 -75
  17. package/dist/chunks/{chunk-V23RAVWV.js → chunk-4CCY5OPH.js} +17822 -15543
  18. package/dist/chunks/chunk-4LDQIDRM.js +326 -0
  19. package/dist/chunks/{chunk-ELUNQCFN.js → chunk-4N7XLXM2.js} +15 -3
  20. package/dist/chunks/chunk-4UYKSYKQ.js +198 -0
  21. package/dist/chunks/chunk-52QYYTM5.js +228 -0
  22. package/dist/chunks/chunk-5AJPMLDV.js +28 -0
  23. package/dist/chunks/chunk-62MH5KPX.js +562 -0
  24. package/dist/chunks/chunk-64IF634X.js +18 -0
  25. package/dist/chunks/{chunk-BUBUVE23.js → chunk-7QVJTI5H.js} +4 -2
  26. package/dist/chunks/chunk-A5KP5HAI.js +128 -0
  27. package/dist/chunks/chunk-AQDWMAPM.js +3211 -0
  28. package/dist/chunks/chunk-AW5YINX6.js +272 -0
  29. package/dist/chunks/chunk-B3JTF4CF.js +111 -0
  30. package/dist/chunks/chunk-BEQV3X2L.js +86 -0
  31. package/dist/chunks/{chunk-HTOH3MSD.js → chunk-BUZRVER7.js} +5 -4
  32. package/dist/chunks/{chunk-D7SZ3DXR.js → chunk-CPFNFVCL.js} +43 -16
  33. package/dist/chunks/{chunk-IS2HEMF4.js → chunk-CSJBZKC5.js} +71 -43
  34. package/dist/chunks/chunk-E336ZXPP.js +43 -0
  35. package/dist/chunks/chunk-EBLH23AQ.js +147 -0
  36. package/dist/chunks/{chunk-U3WLEFHU.js → chunk-ECCWJHC6.js} +60 -14
  37. package/dist/chunks/chunk-FGDKMNEN.js +21 -0
  38. package/dist/chunks/chunk-G75NFPIT.js +105 -0
  39. package/dist/chunks/{chunk-NELCIT4M.js → chunk-GFG6QDIE.js} +6 -83
  40. package/dist/chunks/{chunk-CO5D46AG.js → chunk-GGP5R3FU.js} +18 -38
  41. package/dist/chunks/chunk-GZLPFESR.js +48 -0
  42. package/dist/chunks/{chunk-5CRSHCRD.js → chunk-HSYF5SI3.js} +207 -32
  43. package/dist/chunks/{chunk-WYWXLDX4.js → chunk-IEDUCUDV.js} +268 -3351
  44. package/dist/chunks/chunk-J6LK45HT.js +163 -0
  45. package/dist/chunks/{chunk-L2BKVTHL.js → chunk-JLWQWYKO.js} +2 -2
  46. package/dist/chunks/chunk-KBEX5MYS.js +208 -0
  47. package/dist/chunks/{chunk-4YZKA4FN.js → chunk-KT4XXKJK.js} +1 -1
  48. package/dist/chunks/{chunk-BQUQ5F7R.js → chunk-M22O6CYY.js} +23 -10
  49. package/dist/chunks/{chunk-6DIXPIXB.js → chunk-M5NOLAJ4.js} +2 -2
  50. package/dist/chunks/{chunk-WXNT7WJO.js → chunk-MAHXF73X.js} +55 -10
  51. package/dist/chunks/chunk-NJ6QXKQD.js +220 -0
  52. package/dist/chunks/chunk-NJUPUGOE.js +593 -0
  53. package/dist/chunks/chunk-NM43FFV6.js +108 -0
  54. package/dist/chunks/{chunk-VE7MY76H.js → chunk-O5GNPPTU.js} +6 -2
  55. package/dist/chunks/{chunk-ZQKJVHXY.js → chunk-OX7KI3LF.js} +18 -5
  56. package/dist/chunks/{chunk-JJXA2DQW.js → chunk-P2QZZ6MR.js} +1 -1
  57. package/dist/chunks/chunk-P4QNYOFB.js +96 -0
  58. package/dist/chunks/chunk-PRWJUY5U.js +848 -0
  59. package/dist/chunks/{chunk-UZIEJEMY.js → chunk-R6IGDGX3.js} +5 -5
  60. package/dist/chunks/chunk-RBIFXFZX.js +52 -0
  61. package/dist/chunks/chunk-RQ7H43CJ.js +53 -0
  62. package/dist/chunks/{chunk-K4IC7LFB.js → chunk-SJYAUEZR.js} +353 -892
  63. package/dist/chunks/{chunk-A4NVECX5.js → chunk-SOFC4MLS.js} +146 -446
  64. package/dist/chunks/chunk-TJJ562C5.js +661 -0
  65. package/dist/chunks/{chunk-XHMU7WUB.js → chunk-UE3JUVUZ.js} +697 -330
  66. package/dist/chunks/chunk-VGIMO3ZK.js +17 -0
  67. package/dist/chunks/chunk-VXYGCOKL.js +28 -0
  68. package/dist/chunks/chunk-WGGABYO5.js +31 -0
  69. package/dist/chunks/chunk-WR7JTCGL.js +104 -0
  70. package/dist/chunks/{chunk-LOS7HHU3.js → chunk-XBN2O34P.js} +1 -1
  71. package/dist/chunks/{chunk-RQTDTSAX.js → chunk-XE5VSQ25.js} +3 -3
  72. package/dist/chunks/{query-SDKQTWN2.js → chunk-XIG4GH62.js} +134 -356
  73. package/dist/chunks/chunk-XLKFJPMT.js +150 -0
  74. package/dist/chunks/chunk-Y5GTPWXB.js +138 -0
  75. package/dist/chunks/{chunk-XMVSCINT.js → chunk-YCPUAG77.js} +7 -4
  76. package/dist/chunks/chunk-YDUINEII.js +156 -0
  77. package/dist/chunks/{chunk-WOFF2NEI.js → chunk-ZGBBPJ6B.js} +337 -62
  78. package/dist/chunks/{chunk-Y5YCSB6X.js → chunk-ZX2FSPWV.js} +7 -4
  79. package/dist/chunks/cjs-DV4RM7XU.js +20743 -0
  80. package/dist/chunks/clear-HWIKQ4NC.js +132 -0
  81. package/dist/chunks/{compile-vercel-config-6FEECIZK.js → compile-vercel-config-U5NRIMZ2.js} +10 -5
  82. package/dist/chunks/config-validator.mjs +1 -0
  83. package/dist/chunks/constants-3FSSR6E7.js +13 -0
  84. package/dist/chunks/delete-FZCOUFGN.js +151 -0
  85. package/dist/chunks/{delete-J2N2QXMP.js → delete-NVMGVD5Z.js} +24 -17
  86. package/dist/chunks/{disable-QGYXQKAM.js → disable-ERM2BWEQ.js} +23 -15
  87. package/dist/chunks/{discard-ZDGJB5US.js → discard-KM5OLEN4.js} +22 -14
  88. package/dist/chunks/{edit-RJWDA5KJ.js → edit-HT3UTATZ.js} +30 -24
  89. package/dist/chunks/edit-TOSB2EMI.js +154 -0
  90. package/dist/chunks/{enable-L33HPTXB.js → enable-BQL6AOQV.js} +23 -15
  91. package/dist/chunks/exec-CNBOV577.js +1287 -0
  92. package/dist/chunks/{export-Z5C4BJ2U.js → export-UOWQHOG3.js} +24 -17
  93. package/dist/chunks/fetch-proxy-R3JZNXBZ.js +99 -0
  94. package/dist/chunks/image-F5SC6Q7Y.js +71 -0
  95. package/dist/chunks/inspect-35FU5R62.js +137 -0
  96. package/dist/chunks/inspect-5J5GSTOB.js +163 -0
  97. package/dist/chunks/inspect-GKJ6T5H4.js +167 -0
  98. package/dist/chunks/inspect-LGKOLH2O.js +206 -0
  99. package/dist/chunks/inspect-PZJM2CWT.js +589 -0
  100. package/dist/chunks/list-2IIE7CAP.js +361 -0
  101. package/dist/chunks/{list-HXN64DKX.js → list-ITFJYYQ2.js} +155 -137
  102. package/dist/chunks/{list-4P2TW77C.js → list-KZETH3ZE.js} +19 -14
  103. package/dist/chunks/login-BQPJCJEZ.js +215 -0
  104. package/dist/chunks/ls-7GHDK4MD.js +190 -0
  105. package/dist/chunks/ls-DL2LA35C.js +213 -0
  106. package/dist/chunks/ls-UXUEP54B.js +200 -0
  107. package/dist/chunks/ls-YSFWSM6J.js +178 -0
  108. package/dist/chunks/ls-ZZFLH7PK.js +165 -0
  109. package/dist/chunks/open-ADNJQN5E.js +107 -0
  110. package/dist/chunks/permissions-72SZCBIY.js +95 -0
  111. package/dist/chunks/{chunk-Q6BEDVOU.js → pkg-56KRLZ5K.js} +3 -9
  112. package/dist/chunks/{publish-TLVHQB2H.js → publish-OOAGSEBM.js} +22 -14
  113. package/dist/chunks/push-B6TZDXNF.js +183 -0
  114. package/dist/chunks/query-LZWS5TDH.js +393 -0
  115. package/dist/chunks/{reorder-UHMUFYIW.js → reorder-MRHFKPMK.js} +26 -18
  116. package/dist/chunks/reply-BKTJXO3B.js +168 -0
  117. package/dist/chunks/resolve-BKVGSGPN.js +229 -0
  118. package/dist/chunks/{restore-762GO6HU.js → restore-USR7SKWV.js} +28 -20
  119. package/dist/chunks/rm-2UO6BT3A.js +166 -0
  120. package/dist/chunks/rm-37MKKV3I.js +186 -0
  121. package/dist/chunks/rm-KUWPNZIS.js +139 -0
  122. package/dist/chunks/rm-VY3OHKFH.js +138 -0
  123. package/dist/chunks/{routes-OFD6HJOW.js → routes-JP2CNQ5J.js} +3 -3
  124. package/dist/chunks/rule-inspect-JVDOOTWK.js +285 -0
  125. package/dist/chunks/rules-NTBFZBIF.js +82 -0
  126. package/dist/chunks/{schema-WBOIQRP4.js → schema-6EZ72OVH.js} +70 -33
  127. package/dist/chunks/{stamp-ENIXDCRO.js → stamp-AA7R3MZS.js} +3 -1
  128. package/dist/chunks/tags-HNPC63QA.js +65 -0
  129. package/dist/chunks/{types-A4EAQ6F6.js → types-QTOA2BTQ.js} +12 -7
  130. package/dist/chunks/update-LUYWNZP3.js +198 -0
  131. package/dist/commands/build/index.js +4505 -657
  132. package/dist/commands/deploy/index.js +386 -157
  133. package/dist/commands/dev/builder-worker.cjs +9 -2
  134. package/dist/commands/dev/index.js +2081 -611
  135. package/dist/commands/dev/next-dev-websocket-shim-preload.cjs +210 -0
  136. package/dist/commands/env/index.js +927 -172
  137. package/dist/commands/link/index.js +94 -55
  138. package/dist/commands/list/index.js +59 -28
  139. package/dist/commands-bulk.js +46384 -19361
  140. package/dist/fetch-dist-tags.cjs +60 -0
  141. package/dist/get-latest-worker.cjs +6 -56
  142. package/dist/help.js +1 -1
  143. package/dist/index.js +735 -22711
  144. package/dist/vc.js +94 -1
  145. package/dist/version.mjs +1 -1
  146. package/package.json +103 -73
  147. package/dist/chunks/chunk-7IDNCLTM.js +0 -152
  148. package/dist/chunks/chunk-K6HUDI7B.js +0 -310
  149. package/dist/chunks/chunk-NYO5XRBQ.js +0 -247
  150. package/dist/chunks/chunk-TWZWQGBN.js +0 -77
  151. package/dist/chunks/chunk-U5J73OA3.js +0 -86
  152. package/dist/chunks/chunk-YKKQGGLZ.js +0 -91
package/README.md CHANGED
@@ -13,25 +13,26 @@ npm install @depup/vercel
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [vercel](https://www.npmjs.com/package/vercel) @ 50.44.0 |
17
- | Processed | 2026-04-11 |
16
+ | Original | [vercel](https://www.npmjs.com/package/vercel) @ 58.4.4 |
17
+ | Processed | 2026-08-02 |
18
18
  | Smoke test | failed |
19
- | Deps updated | 10 |
19
+ | Deps updated | 11 |
20
20
 
21
21
  ## Dependency Changes
22
22
 
23
23
  | Dependency | From | To |
24
24
  |------------|------|-----|
25
- | @vercel/blob | 2.3.0 | ^2.3.3 |
25
+ | @vercel/blob | 2.4.0 | ^2.6.1 |
26
26
  | @vercel/fun | 1.3.0 | ^1.3.1 |
27
+ | @vercel/prepare-flags-definitions | 0.3.0 | ^0.4.0 |
27
28
  | chokidar | 4.0.0 | ^5.0.0 |
28
- | esbuild | 0.27.0 | ^0.28.0 |
29
- | form-data | ^4.0.0 | ^4.0.5 |
30
- | jose | 5.9.6 | ^6.2.2 |
29
+ | esbuild | 0.27.0 | ^0.28.1 |
30
+ | jose | 5.9.6 | ^6.2.7 |
31
31
  | luxon | ^3.4.0 | ^3.7.2 |
32
- | proxy-agent | 6.4.0 | ^8.0.1 |
33
- | sandbox | 2.5.6 | ^2.5.9 |
34
- | smol-toml | 1.5.2 | ^1.6.1 |
32
+ | sandbox | 3.4.0 | ^3.5.5 |
33
+ | smol-toml | 1.5.2 | ^1.7.1 |
34
+ | undici | 5.29.0 | ^8.9.0 |
35
+ | zod | 4.1.11 | ^4.4.3 |
35
36
 
36
37
  ---
37
38
 
package/changes.json CHANGED
@@ -1,46 +1,50 @@
1
1
  {
2
2
  "bumped": {
3
3
  "@vercel/blob": {
4
- "from": "2.3.0",
5
- "to": "^2.3.3"
4
+ "from": "2.4.0",
5
+ "to": "^2.6.1"
6
6
  },
7
7
  "@vercel/fun": {
8
8
  "from": "1.3.0",
9
9
  "to": "^1.3.1"
10
10
  },
11
+ "@vercel/prepare-flags-definitions": {
12
+ "from": "0.3.0",
13
+ "to": "^0.4.0"
14
+ },
11
15
  "chokidar": {
12
16
  "from": "4.0.0",
13
17
  "to": "^5.0.0"
14
18
  },
15
- "smol-toml": {
16
- "from": "1.5.2",
17
- "to": "^1.6.1"
18
- },
19
19
  "esbuild": {
20
20
  "from": "0.27.0",
21
- "to": "^0.28.0"
22
- },
23
- "form-data": {
24
- "from": "^4.0.0",
25
- "to": "^4.0.5"
21
+ "to": "^0.28.1"
26
22
  },
27
23
  "jose": {
28
24
  "from": "5.9.6",
29
- "to": "^6.2.2"
25
+ "to": "^6.2.7"
30
26
  },
31
27
  "luxon": {
32
28
  "from": "^3.4.0",
33
29
  "to": "^3.7.2"
34
30
  },
35
- "proxy-agent": {
36
- "from": "6.4.0",
37
- "to": "^8.0.1"
38
- },
39
31
  "sandbox": {
40
- "from": "2.5.6",
41
- "to": "^2.5.9"
32
+ "from": "3.4.0",
33
+ "to": "^3.5.5"
34
+ },
35
+ "smol-toml": {
36
+ "from": "1.5.2",
37
+ "to": "^1.7.1"
38
+ },
39
+ "undici": {
40
+ "from": "5.29.0",
41
+ "to": "^8.9.0"
42
+ },
43
+ "zod": {
44
+ "from": "4.1.11",
45
+ "to": "^4.4.3"
42
46
  }
43
47
  },
44
- "timestamp": "2026-04-11T04:42:51.698Z",
45
- "totalUpdated": 10
48
+ "timestamp": "2026-08-02T00:58:10.382Z",
49
+ "totalUpdated": 11
46
50
  }
@@ -0,0 +1,136 @@
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
+ emitVcrArgParseError,
9
+ handleVcrApiError,
10
+ resolveVcrScope,
11
+ validateVcrJsonOutput
12
+ } from "./chunk-62MH5KPX.js";
13
+ import "./chunk-G75NFPIT.js";
14
+ import {
15
+ outputError
16
+ } from "./chunk-BUZRVER7.js";
17
+ import "./chunk-XPKWKPWA.js";
18
+ import {
19
+ addSubcommand
20
+ } from "./chunk-AW5YINX6.js";
21
+ import "./chunk-A5KP5HAI.js";
22
+ import "./chunk-J6LK45HT.js";
23
+ import "./chunk-B3JTF4CF.js";
24
+ import "./chunk-R6IGDGX3.js";
25
+ import "./chunk-4CCY5OPH.js";
26
+ import "./chunk-ECCWJHC6.js";
27
+ import {
28
+ AGENT_REASON,
29
+ buildCommandWithGlobalFlags,
30
+ outputAgentError
31
+ } from "./chunk-TJJ562C5.js";
32
+ import {
33
+ printError
34
+ } from "./chunk-KBEX5MYS.js";
35
+ import {
36
+ parseArguments
37
+ } from "./chunk-XLKFJPMT.js";
38
+ import {
39
+ getFlagsSpecification,
40
+ isAPIError,
41
+ packageName
42
+ } from "./chunk-SOFC4MLS.js";
43
+ import "./chunk-P4QNYOFB.js";
44
+ import "./chunk-52QYYTM5.js";
45
+ import {
46
+ output_manager_default
47
+ } from "./chunk-OX7KI3LF.js";
48
+ import "./chunk-GGP5R3FU.js";
49
+ import "./chunk-S7KYDPEM.js";
50
+ import "./chunk-TZ2YI2VH.js";
51
+
52
+ // src/commands/vcr/add.ts
53
+ async function add(client, argv, telemetry) {
54
+ let parsedArgs;
55
+ try {
56
+ parsedArgs = parseArguments(
57
+ argv,
58
+ getFlagsSpecification(addSubcommand.options)
59
+ );
60
+ } catch (err) {
61
+ emitVcrArgParseError(client, err, "vcr add <name> --project <name-or-id>");
62
+ printError(err);
63
+ return 1;
64
+ }
65
+ const fr = validateVcrJsonOutput(client, parsedArgs.flags);
66
+ if (typeof fr === "number") {
67
+ return fr;
68
+ }
69
+ const name = parsedArgs.args[0];
70
+ const project = parsedArgs.flags["--project"];
71
+ telemetry.trackCliOptionProject(project);
72
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
73
+ if (!name) {
74
+ outputAgentError(
75
+ client,
76
+ {
77
+ status: "error",
78
+ reason: AGENT_REASON.MISSING_ARGUMENTS,
79
+ message: `Missing repository name. Example: ${packageName} vcr add <name>`,
80
+ next: [
81
+ {
82
+ command: buildCommandWithGlobalFlags(client.argv, "vcr add <name>"),
83
+ when: "Replace <name> with the repository name to create"
84
+ }
85
+ ]
86
+ },
87
+ 1
88
+ );
89
+ return outputError(
90
+ client,
91
+ fr.jsonOutput,
92
+ "MISSING_ARGUMENTS",
93
+ "Usage: `vercel vcr add <name>`"
94
+ );
95
+ }
96
+ const scope = await resolveVcrScope(client, {
97
+ project,
98
+ jsonOutput: fr.jsonOutput
99
+ });
100
+ if (typeof scope === "number") {
101
+ return scope;
102
+ }
103
+ const path = `/v1/vcr/repository?teamId=${encodeURIComponent(scope.teamId)}`;
104
+ output_manager_default.spinner("Creating repository...");
105
+ try {
106
+ const created = await client.fetch(
107
+ path,
108
+ {
109
+ method: "POST",
110
+ body: { projectId: scope.projectId, name }
111
+ }
112
+ );
113
+ if (fr.jsonOutput) {
114
+ client.stdout.write(`${JSON.stringify(created, null, 2)}
115
+ `);
116
+ } else {
117
+ output_manager_default.success(`Created repository ${created.repository?.name ?? name}`);
118
+ }
119
+ return 0;
120
+ } catch (err) {
121
+ if (isAPIError(err)) {
122
+ return handleVcrApiError(client, err, fr.jsonOutput, {
123
+ retry: {
124
+ command: buildCommandWithGlobalFlags(client.argv, "vcr ls"),
125
+ when: "List existing repositories (a name conflict means it already exists)"
126
+ }
127
+ });
128
+ }
129
+ throw err;
130
+ } finally {
131
+ output_manager_default.stopSpinner();
132
+ }
133
+ }
134
+ export {
135
+ add as default
136
+ };
@@ -0,0 +1,182 @@
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
+ rulesCollectionPath
12
+ } from "./chunk-Y5GTPWXB.js";
13
+ import "./chunk-YDUINEII.js";
14
+ import "./chunk-BUZRVER7.js";
15
+ import {
16
+ validateJsonOutput
17
+ } from "./chunk-XPKWKPWA.js";
18
+ import {
19
+ rulesAddSubcommand
20
+ } from "./chunk-4UYKSYKQ.js";
21
+ import "./chunk-4CCY5OPH.js";
22
+ import "./chunk-ECCWJHC6.js";
23
+ import {
24
+ AGENT_REASON,
25
+ buildCommandWithGlobalFlags,
26
+ outputAgentError
27
+ } from "./chunk-TJJ562C5.js";
28
+ import {
29
+ printError
30
+ } from "./chunk-KBEX5MYS.js";
31
+ import {
32
+ parseArguments
33
+ } from "./chunk-XLKFJPMT.js";
34
+ import {
35
+ getFlagsSpecification,
36
+ isAPIError,
37
+ packageName
38
+ } from "./chunk-SOFC4MLS.js";
39
+ import "./chunk-P4QNYOFB.js";
40
+ import "./chunk-52QYYTM5.js";
41
+ import {
42
+ output_manager_default
43
+ } from "./chunk-OX7KI3LF.js";
44
+ import "./chunk-GGP5R3FU.js";
45
+ import "./chunk-S7KYDPEM.js";
46
+ import "./chunk-TZ2YI2VH.js";
47
+
48
+ // src/commands/alerts/rules/add.ts
49
+ import { readFileSync } from "fs";
50
+ import { resolve } from "path";
51
+ async function add(client, argv) {
52
+ let parsedArgs;
53
+ try {
54
+ parsedArgs = parseArguments(
55
+ argv,
56
+ getFlagsSpecification(rulesAddSubcommand.options)
57
+ );
58
+ } catch (e) {
59
+ emitRulesArgParseError(
60
+ client,
61
+ e,
62
+ "alerts rules add --project <name-or-id> --body <path>"
63
+ );
64
+ printError(e);
65
+ return 1;
66
+ }
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
+ const bodyPath = parsedArgs.flags["--body"];
82
+ if (!bodyPath) {
83
+ outputAgentError(
84
+ client,
85
+ {
86
+ status: "error",
87
+ reason: AGENT_REASON.MISSING_ARGUMENTS,
88
+ message: `Missing required flag --body. Example: ${packageName} alerts rules add --body <file>`,
89
+ hint: "Provide a JSON file describing the new rule (id and teamId are assigned by the API).",
90
+ next: [
91
+ {
92
+ command: buildCommandWithGlobalFlags(
93
+ client.argv,
94
+ "alerts rules add --body <file>"
95
+ ),
96
+ when: "Replace <file> with a path to rule JSON"
97
+ }
98
+ ]
99
+ },
100
+ 1
101
+ );
102
+ output_manager_default.error(
103
+ "Missing required flag: --body <PATH> (JSON file for the new rule)."
104
+ );
105
+ return 1;
106
+ }
107
+ const scope = await parseRulesFlagsAndScope(
108
+ client,
109
+ {
110
+ "--project": parsedArgs.flags["--project"],
111
+ "--all": parsedArgs.flags["--all"]
112
+ },
113
+ fr.jsonOutput,
114
+ "alerts rules add"
115
+ );
116
+ if (typeof scope === "number") {
117
+ return scope;
118
+ }
119
+ let raw;
120
+ try {
121
+ raw = readFileSync(resolve(client.cwd, bodyPath), "utf8");
122
+ } catch {
123
+ outputAgentError(
124
+ client,
125
+ {
126
+ status: "error",
127
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
128
+ message: `Could not read --body file: ${bodyPath}`
129
+ },
130
+ 1
131
+ );
132
+ output_manager_default.error(`Could not read --body file: ${bodyPath}`);
133
+ return 1;
134
+ }
135
+ let body;
136
+ try {
137
+ body = JSON.parse(raw);
138
+ } catch {
139
+ outputAgentError(
140
+ client,
141
+ {
142
+ status: "error",
143
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
144
+ message: "Invalid JSON in --body file."
145
+ },
146
+ 1
147
+ );
148
+ output_manager_default.error("Invalid JSON in --body file.");
149
+ return 1;
150
+ }
151
+ delete body.id;
152
+ delete body.teamId;
153
+ if (scope.projectId !== void 0 && body.projectId === void 0) {
154
+ body.projectId = scope.projectId;
155
+ }
156
+ const path = rulesCollectionPath(scope);
157
+ output_manager_default.spinner("Creating alert rule...");
158
+ try {
159
+ const created = await client.fetch(path, {
160
+ method: "POST",
161
+ body
162
+ });
163
+ if (fr.jsonOutput) {
164
+ client.stdout.write(`${JSON.stringify({ rule: created }, null, 2)}
165
+ `);
166
+ } else {
167
+ const id = created?.id;
168
+ output_manager_default.success(`Created alert rule ${typeof id === "string" ? id : ""}`);
169
+ }
170
+ return 0;
171
+ } catch (err) {
172
+ if (isAPIError(err)) {
173
+ return handleRulesApiError(client, err, fr.jsonOutput);
174
+ }
175
+ throw err;
176
+ } finally {
177
+ output_manager_default.stopSpinner();
178
+ }
179
+ }
180
+ export {
181
+ add as default
182
+ };
@@ -0,0 +1,187 @@
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
+ MAX_CONCURRENT_REQUESTS,
9
+ parseTeamRefs,
10
+ require_async_sema,
11
+ teamRefBody
12
+ } from "./chunk-3ZE5CFVM.js";
13
+ import {
14
+ repositoryPermissionsPath
15
+ } from "./chunk-BEQV3X2L.js";
16
+ import {
17
+ emitVcrArgParseError,
18
+ resolveVcrScope,
19
+ validateVcrJsonOutput
20
+ } from "./chunk-62MH5KPX.js";
21
+ import "./chunk-G75NFPIT.js";
22
+ import {
23
+ outputError
24
+ } from "./chunk-BUZRVER7.js";
25
+ import "./chunk-XPKWKPWA.js";
26
+ import {
27
+ permissionsAddSubcommand
28
+ } from "./chunk-J6LK45HT.js";
29
+ import "./chunk-R6IGDGX3.js";
30
+ import "./chunk-4CCY5OPH.js";
31
+ import "./chunk-ECCWJHC6.js";
32
+ import {
33
+ AGENT_REASON,
34
+ buildCommandWithGlobalFlags,
35
+ outputAgentError
36
+ } from "./chunk-TJJ562C5.js";
37
+ import {
38
+ printError
39
+ } from "./chunk-KBEX5MYS.js";
40
+ import {
41
+ parseArguments
42
+ } from "./chunk-XLKFJPMT.js";
43
+ import {
44
+ getFlagsSpecification,
45
+ isAPIError,
46
+ packageName
47
+ } from "./chunk-SOFC4MLS.js";
48
+ import "./chunk-P4QNYOFB.js";
49
+ import "./chunk-52QYYTM5.js";
50
+ import {
51
+ output_manager_default
52
+ } from "./chunk-OX7KI3LF.js";
53
+ import "./chunk-GGP5R3FU.js";
54
+ import "./chunk-S7KYDPEM.js";
55
+ import {
56
+ __toESM
57
+ } from "./chunk-TZ2YI2VH.js";
58
+
59
+ // src/commands/vcr/permissions/add.ts
60
+ var import_async_sema = __toESM(require_async_sema(), 1);
61
+ var USAGE = "vcr permissions <repository> add <team>[,<team>...]";
62
+ async function add(client, argv, telemetry) {
63
+ let parsedArgs;
64
+ try {
65
+ parsedArgs = parseArguments(
66
+ argv,
67
+ getFlagsSpecification(permissionsAddSubcommand.options)
68
+ );
69
+ } catch (err) {
70
+ emitVcrArgParseError(client, err, USAGE);
71
+ printError(err);
72
+ return 1;
73
+ }
74
+ const fr = validateVcrJsonOutput(client, parsedArgs.flags);
75
+ if (typeof fr === "number") {
76
+ return fr;
77
+ }
78
+ const repository = parsedArgs.args[0];
79
+ const teamRefs = parseTeamRefs(parsedArgs.args.slice(2));
80
+ const project = parsedArgs.flags["--project"];
81
+ telemetry.trackCliOptionProject(project);
82
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
83
+ if (teamRefs.length === 0) {
84
+ outputAgentError(
85
+ client,
86
+ {
87
+ status: "error",
88
+ reason: AGENT_REASON.MISSING_ARGUMENTS,
89
+ message: `Missing team. Example: ${packageName} vcr permissions ${repository} add team_1a2b3c4d`,
90
+ next: [
91
+ {
92
+ command: buildCommandWithGlobalFlags(client.argv, USAGE),
93
+ when: "Replace <team> with a team id or slug (comma-separate multiple teams)"
94
+ }
95
+ ]
96
+ },
97
+ 1
98
+ );
99
+ return outputError(
100
+ client,
101
+ fr.jsonOutput,
102
+ "MISSING_ARGUMENTS",
103
+ `Usage: \`vercel ${USAGE}\``
104
+ );
105
+ }
106
+ const scope = await resolveVcrScope(client, {
107
+ project,
108
+ jsonOutput: fr.jsonOutput
109
+ });
110
+ if (typeof scope === "number") {
111
+ return scope;
112
+ }
113
+ const path = repositoryPermissionsPath(scope, repository);
114
+ const added = [];
115
+ const failed = [];
116
+ output_manager_default.spinner(
117
+ `Sharing ${repository} with ${teamRefs.length === 1 ? teamRefs[0] : `${teamRefs.length} teams`}...`
118
+ );
119
+ const sema = new import_async_sema.default(MAX_CONCURRENT_REQUESTS);
120
+ let results;
121
+ try {
122
+ results = await Promise.all(
123
+ teamRefs.map(async (team) => {
124
+ await sema.acquire();
125
+ try {
126
+ const result = await client.fetch(path, {
127
+ method: "POST",
128
+ body: teamRefBody(team)
129
+ });
130
+ return { ok: true, team, permission: result.permission };
131
+ } catch (err) {
132
+ if (!isAPIError(err)) {
133
+ throw err;
134
+ }
135
+ const message = err.serverMessage || `API error (${err.status}).`;
136
+ return {
137
+ ok: false,
138
+ team,
139
+ failure: { team, code: err.code || "API_ERROR", message }
140
+ };
141
+ } finally {
142
+ sema.release();
143
+ }
144
+ })
145
+ );
146
+ } finally {
147
+ output_manager_default.stopSpinner();
148
+ }
149
+ for (const result of results) {
150
+ if (result.ok) {
151
+ added.push(result.permission);
152
+ if (!fr.jsonOutput) {
153
+ output_manager_default.success(
154
+ `Shared ${repository} with ${result.permission?.teamSlug ?? result.team}`
155
+ );
156
+ }
157
+ } else {
158
+ failed.push(result.failure);
159
+ if (!fr.jsonOutput) {
160
+ output_manager_default.error(
161
+ `Failed to share ${repository} with ${result.team}: ${result.failure.message}`
162
+ );
163
+ }
164
+ }
165
+ }
166
+ if (failed.length > 0) {
167
+ outputAgentError(
168
+ client,
169
+ {
170
+ status: "error",
171
+ reason: AGENT_REASON.API_ERROR,
172
+ message: `Failed to share ${repository} with ${failed.map((f) => `${f.team} (${f.message})`).join(", ")}`
173
+ },
174
+ 1
175
+ );
176
+ }
177
+ if (fr.jsonOutput) {
178
+ client.stdout.write(
179
+ `${JSON.stringify({ permissions: added, failed }, null, 2)}
180
+ `
181
+ );
182
+ }
183
+ return failed.length > 0 ? 1 : 0;
184
+ }
185
+ export {
186
+ add as default
187
+ };