vercel 58.9.0 → 58.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/chunks/{add-EN4KBTT6.js → add-5NFS6DS7.js} +2 -2
  2. package/dist/chunks/{add-ZVQJE6BF.js → add-NIBAFBPP.js} +6 -6
  3. package/dist/chunks/{add-HFK7NUGY.js → add-PJLLOYOB.js} +2 -2
  4. package/dist/chunks/{build-IDCBAC3R.js → build-MF4TD2RD.js} +2 -2
  5. package/dist/chunks/{chunk-NFZHW6HH.js → chunk-24TPLHEI.js} +2 -2
  6. package/dist/chunks/{chunk-BX4IGDGM.js → chunk-4IFEBYTL.js} +212 -95
  7. package/dist/chunks/{chunk-Q6OJHDZK.js → chunk-4RXXF7V7.js} +1 -1
  8. package/dist/chunks/{chunk-E3DRV4WI.js → chunk-4XO6B3JD.js} +1 -1
  9. package/dist/chunks/{chunk-YUISINFV.js → chunk-6BEMCJFX.js} +2 -2
  10. package/dist/chunks/{chunk-G2S2QKKF.js → chunk-6LBPHFMP.js} +2 -2
  11. package/dist/chunks/{chunk-766B6IIX.js → chunk-BEKBCDTM.js} +1 -1
  12. package/dist/chunks/{chunk-YTIUSEWE.js → chunk-DGDUIC5A.js} +1 -1
  13. package/dist/chunks/{chunk-QRRCK6VX.js → chunk-DJPFR2DG.js} +1 -1
  14. package/dist/chunks/{chunk-DDUZ2VME.js → chunk-GCSUBTKN.js} +8 -6
  15. package/dist/chunks/{chunk-PNSWZSLC.js → chunk-L7LKHLFB.js} +2 -2
  16. package/dist/chunks/{chunk-TIBP3CPZ.js → chunk-LIPSDQMJ.js} +1 -1
  17. package/dist/chunks/{chunk-F45WFNLZ.js → chunk-MAQ6U5X2.js} +1 -1
  18. package/dist/chunks/{chunk-KES53W3V.js → chunk-N6ZAAUNN.js} +4 -4
  19. package/dist/chunks/{chunk-DQXBNALU.js → chunk-NFIGIDOY.js} +1 -1
  20. package/dist/chunks/{chunk-CKIZU3CI.js → chunk-SHXS3ZJD.js} +1 -1
  21. package/dist/chunks/{chunk-2PPATWD6.js → chunk-U6FXU4WS.js} +1 -1
  22. package/dist/chunks/{chunk-FBG4AMAX.js → chunk-V3W6GV3A.js} +1 -1
  23. package/dist/chunks/{chunk-N22RS64U.js → chunk-VBAIEFLF.js} +2 -2
  24. package/dist/chunks/{chunk-U6CTW37A.js → chunk-VNNVJGKE.js} +1 -1
  25. package/dist/chunks/{chunk-7N26744Z.js → chunk-VX6VORWT.js} +1 -1
  26. package/dist/chunks/{chunk-7AB6QOKM.js → chunk-W24ZG3GV.js} +1 -1
  27. package/dist/chunks/{chunk-WWPV6Z24.js → chunk-YRV4A73W.js} +4 -4
  28. package/dist/chunks/{clear-W4AEVUND.js → clear-M3QWP3HM.js} +2 -2
  29. package/dist/chunks/{compile-vercel-config-Q45PSZDQ.js → compile-vercel-config-6DMGPMCK.js} +1 -1
  30. package/dist/chunks/{config-MZ3KLGOK.js → config-5D4R6677.js} +2 -2
  31. package/dist/chunks/{delete-NAZTL2IK.js → delete-CJG3FHU7.js} +2 -2
  32. package/dist/chunks/{delete-7NADCRED.js → delete-ZWUWQT5H.js} +2 -2
  33. package/dist/chunks/{disable-SB224IIS.js → disable-CJKTITTQ.js} +2 -2
  34. package/dist/chunks/{discard-MME6PI7B.js → discard-ABXIPZHK.js} +2 -2
  35. package/dist/chunks/{edit-HKQEFIOY.js → edit-VJ43TKOX.js} +2 -2
  36. package/dist/chunks/{edit-NW4YBUR6.js → edit-VNVPLLF7.js} +3 -3
  37. package/dist/chunks/{enable-QEL5CXVD.js → enable-L7ERJOO5.js} +2 -2
  38. package/dist/chunks/{export-XDOZTLG3.js → export-BDAKZGOD.js} +2 -2
  39. package/dist/chunks/{image-AJMRAAOW.js → image-MGZR4VEH.js} +3 -3
  40. package/dist/chunks/{import-builders-7UG32FQA.js → import-builders-RBYAQIPN.js} +2 -2
  41. package/dist/chunks/{inspect-4YTOMOOP.js → inspect-3V6PPUA3.js} +3 -3
  42. package/dist/chunks/{inspect-TW5DENBM.js → inspect-E6IHZHQI.js} +2 -2
  43. package/dist/chunks/{inspect-JPZFHGAF.js → inspect-IO5JFCCX.js} +2 -2
  44. package/dist/chunks/{inspect-T6HYEMLA.js → inspect-KQBV3ALQ.js} +2 -2
  45. package/dist/chunks/{inspect-DGBKWCS4.js → inspect-XDKWDIUB.js} +2 -2
  46. package/dist/chunks/{list-ESW6P765.js → list-FTWJF5YO.js} +2 -2
  47. package/dist/chunks/{list-T7LXP6VX.js → list-RQB5Q7IJ.js} +16 -5
  48. package/dist/chunks/{list-YQ4LADLW.js → list-S2ZEK7DX.js} +1 -1
  49. package/dist/chunks/{login-VJESL6WK.js → login-AVIFCN4G.js} +2 -2
  50. package/dist/chunks/{ls-Y46O3BCS.js → ls-44QDBZEW.js} +2 -2
  51. package/dist/chunks/{ls-2DYO6E4E.js → ls-BKZZIR53.js} +3 -3
  52. package/dist/chunks/{ls-4A6CGBPD.js → ls-FI4MV46I.js} +2 -2
  53. package/dist/chunks/{ls-5AQBMBOG.js → ls-JI2KIY4O.js} +2 -2
  54. package/dist/chunks/{ls-5I2W7LZQ.js → ls-ZG43UJTR.js} +2 -2
  55. package/dist/chunks/{open-SZDSII6L.js → open-FGSEFGJL.js} +2 -2
  56. package/dist/chunks/{permissions-HRR47E2L.js → permissions-BDINZ7RC.js} +4 -4
  57. package/dist/chunks/{publish-D2QWFUP4.js → publish-7FXAFWWN.js} +2 -2
  58. package/dist/chunks/{push-75R5ZZIW.js → push-3P3NKZEG.js} +2 -2
  59. package/dist/chunks/{query-LL2GMJWQ.js → query-7MQN4S3S.js} +1 -1
  60. package/dist/chunks/{reorder-GNCRV6CV.js → reorder-42YNZL7R.js} +2 -2
  61. package/dist/chunks/{reply-S3UUI6C6.js → reply-36KQN23N.js} +2 -2
  62. package/dist/chunks/{resolve-PCBDK47N.js → resolve-ESN7P6O3.js} +2 -2
  63. package/dist/chunks/{restore-SXI5SHGJ.js → restore-RCNRC3YJ.js} +2 -2
  64. package/dist/chunks/{rm-YK2EGEPB.js → rm-E2WEJZPW.js} +2 -2
  65. package/dist/chunks/{rm-ZFWVI6JE.js → rm-MMYOJPW4.js} +3 -3
  66. package/dist/chunks/{rm-BEIAUTSF.js → rm-ODFQSS2C.js} +2 -2
  67. package/dist/chunks/{rm-574XTDSM.js → rm-R77FI255.js} +2 -2
  68. package/dist/chunks/{rule-inspect-QDQUU3EO.js → rule-inspect-FDBIBPKM.js} +3 -3
  69. package/dist/chunks/{rules-FNA3NXZZ.js → rules-3GSC27DA.js} +6 -6
  70. package/dist/chunks/{schema-5CASPRP6.js → schema-QDU3FPNC.js} +1 -1
  71. package/dist/chunks/{tags-SRHDQUF6.js → tags-WZBKHB6D.js} +2 -2
  72. package/dist/chunks/{update-FSTNM3OX.js → update-KNN7C6KN.js} +6 -6
  73. package/dist/commands/build/index.js +9 -9
  74. package/dist/commands/deploy/index.js +9 -9
  75. package/dist/commands/dev/index.js +8 -8
  76. package/dist/commands/env/index.js +4 -4
  77. package/dist/commands/link/index.js +6 -6
  78. package/dist/commands/list/index.js +2 -2
  79. package/dist/commands-bulk.js +85 -67
  80. package/dist/index.js +64 -57
  81. package/dist/version.mjs +1 -1
  82. package/package.json +39 -39
@@ -9,7 +9,7 @@ import {
9
9
  handleVcrApiError,
10
10
  resolveVcrScope,
11
11
  validateVcrJsonOutput
12
- } from "./chunk-TIBP3CPZ.js";
12
+ } from "./chunk-LIPSDQMJ.js";
13
13
  import "./chunk-G75NFPIT.js";
14
14
  import {
15
15
  outputError
@@ -22,7 +22,7 @@ import "./chunk-B3JTF4CF.js";
22
22
  import "./chunk-A5KP5HAI.js";
23
23
  import "./chunk-J6LK45HT.js";
24
24
  import "./chunk-R6IGDGX3.js";
25
- import "./chunk-BX4IGDGM.js";
25
+ import "./chunk-4IFEBYTL.js";
26
26
  import "./chunk-ECCWJHC6.js";
27
27
  import {
28
28
  AGENT_REASON,
@@ -8,21 +8,21 @@ import {
8
8
  parseCustomAlertQueryBody,
9
9
  resolveCustomAlertProjectName,
10
10
  setMissingCustomAlertProjectScope
11
- } from "./chunk-G2S2QKKF.js";
11
+ } from "./chunk-6LBPHFMP.js";
12
12
  import {
13
13
  emitRulesArgParseError,
14
14
  handleRulesApiError,
15
15
  parseRulesFlagsAndScope,
16
16
  rulesCollectionPath
17
- } from "./chunk-QRRCK6VX.js";
17
+ } from "./chunk-DJPFR2DG.js";
18
18
  import {
19
19
  isCustomAlertRule
20
20
  } from "./chunk-TEQKKTJQ.js";
21
- import "./chunk-DQXBNALU.js";
21
+ import "./chunk-NFIGIDOY.js";
22
22
  import "./chunk-A3NYPUKZ.js";
23
23
  import "./chunk-P65EEFTR.js";
24
24
  import "./chunk-FGDKMNEN.js";
25
- import "./chunk-YUISINFV.js";
25
+ import "./chunk-6BEMCJFX.js";
26
26
  import "./chunk-V5P25P7F.js";
27
27
  import "./chunk-RQ7H43CJ.js";
28
28
  import {
@@ -31,9 +31,9 @@ import {
31
31
  import {
32
32
  rulesAddSubcommand
33
33
  } from "./chunk-UMA66MKW.js";
34
- import "./chunk-7AB6QOKM.js";
34
+ import "./chunk-W24ZG3GV.js";
35
35
  import "./chunk-KT4XXKJK.js";
36
- import "./chunk-BX4IGDGM.js";
36
+ import "./chunk-4IFEBYTL.js";
37
37
  import "./chunk-ECCWJHC6.js";
38
38
  import {
39
39
  AGENT_REASON,
@@ -17,7 +17,7 @@ import {
17
17
  emitVcrArgParseError,
18
18
  resolveVcrScope,
19
19
  validateVcrJsonOutput
20
- } from "./chunk-TIBP3CPZ.js";
20
+ } from "./chunk-LIPSDQMJ.js";
21
21
  import "./chunk-G75NFPIT.js";
22
22
  import {
23
23
  outputError
@@ -27,7 +27,7 @@ import {
27
27
  permissionsAddSubcommand
28
28
  } from "./chunk-J6LK45HT.js";
29
29
  import "./chunk-R6IGDGX3.js";
30
- import "./chunk-BX4IGDGM.js";
30
+ import "./chunk-4IFEBYTL.js";
31
31
  import "./chunk-ECCWJHC6.js";
32
32
  import {
33
33
  AGENT_REASON,
@@ -23,7 +23,7 @@ import {
23
23
  runEngine,
24
24
  splitPassthrough,
25
25
  validateVcrChoice
26
- } from "./chunk-TIBP3CPZ.js";
26
+ } from "./chunk-LIPSDQMJ.js";
27
27
  import "./chunk-G75NFPIT.js";
28
28
  import {
29
29
  outputError
@@ -36,7 +36,7 @@ import "./chunk-B3JTF4CF.js";
36
36
  import "./chunk-A5KP5HAI.js";
37
37
  import "./chunk-J6LK45HT.js";
38
38
  import "./chunk-R6IGDGX3.js";
39
- import "./chunk-BX4IGDGM.js";
39
+ import "./chunk-4IFEBYTL.js";
40
40
  import "./chunk-ECCWJHC6.js";
41
41
  import {
42
42
  AGENT_REASON,
@@ -31,10 +31,10 @@ import {
31
31
  import {
32
32
  buildCommand,
33
33
  pullCommand
34
- } from "./chunk-FBG4AMAX.js";
34
+ } from "./chunk-V3W6GV3A.js";
35
35
  import {
36
36
  envCommand
37
- } from "./chunk-BX4IGDGM.js";
37
+ } from "./chunk-4IFEBYTL.js";
38
38
  import {
39
39
  confirmOption,
40
40
  deploymentOption,
@@ -38164,7 +38164,7 @@ var require_package = __commonJS({
38164
38164
  "../client/package.json"(exports, module) {
38165
38165
  module.exports = {
38166
38166
  name: "@vercel/client",
38167
- version: "18.2.7",
38167
+ version: "18.2.8",
38168
38168
  main: "dist/index.js",
38169
38169
  typings: "dist/index.d.ts",
38170
38170
  homepage: "https://vercel.com",
@@ -38195,7 +38195,7 @@ var require_package = __commonJS({
38195
38195
  "@types/node": "20.11.0",
38196
38196
  "@types/recursive-readdir": "2.2.0",
38197
38197
  "@types/tar-fs": "1.16.1",
38198
- vitest: "2.0.1"
38198
+ vitest: "4.1.10"
38199
38199
  },
38200
38200
  dependencies: {
38201
38201
  "@vercel/build-utils": "workspace:*",
@@ -45812,9 +45812,9 @@ var require_out4 = __commonJS({
45812
45812
  }
45813
45813
  });
45814
45814
 
45815
- // ../../node_modules/.pnpm/@vercel+microfrontends@1.2.2_next@16.2.6_@opentelemetry+api@1.9.1_react-dom@18.3.1_reac_dafed8485844cbf4d92e1fbe0bf15d03/node_modules/@vercel/microfrontends/dist/microfrontends/utils.cjs
45815
+ // ../../node_modules/.pnpm/@vercel+microfrontends@1.2.2_next@16.2.6_@opentelemetry+api@1.9.1_react-dom@18.3.1_reac_29d9de4a2668e6f26ed52d105d4b310d/node_modules/@vercel/microfrontends/dist/microfrontends/utils.cjs
45816
45816
  var require_utils8 = __commonJS({
45817
- "../../node_modules/.pnpm/@vercel+microfrontends@1.2.2_next@16.2.6_@opentelemetry+api@1.9.1_react-dom@18.3.1_reac_dafed8485844cbf4d92e1fbe0bf15d03/node_modules/@vercel/microfrontends/dist/microfrontends/utils.cjs"(exports, module) {
45817
+ "../../node_modules/.pnpm/@vercel+microfrontends@1.2.2_next@16.2.6_@opentelemetry+api@1.9.1_react-dom@18.3.1_reac_29d9de4a2668e6f26ed52d105d4b310d/node_modules/@vercel/microfrontends/dist/microfrontends/utils.cjs"(exports, module) {
45818
45818
  "use strict";
45819
45819
  var __create = Object.create;
45820
45820
  var __defProp = Object.defineProperty;
@@ -56554,6 +56554,33 @@ function canParseURL(url) {
56554
56554
  return false;
56555
56555
  }
56556
56556
  }
56557
+ async function inspectTokenRequest(token) {
56558
+ return fetch2((await as()).introspection_endpoint, {
56559
+ method: "POST",
56560
+ headers: {
56561
+ "Content-Type": "application/x-www-form-urlencoded",
56562
+ "user-agent": userAgent
56563
+ },
56564
+ body: new URLSearchParams({ token })
56565
+ });
56566
+ }
56567
+ async function processInspectTokenResponse(response) {
56568
+ try {
56569
+ const token = await response.json();
56570
+ if (!token || typeof token !== "object" || !("active" in token)) {
56571
+ throw new IntrospectionError("Invalid token introspection response");
56572
+ }
56573
+ return [null, token];
56574
+ } catch (cause) {
56575
+ return [new IntrospectionError("Could not introspect token.", { cause })];
56576
+ }
56577
+ }
56578
+ var IntrospectionError = class extends Error {
56579
+ constructor() {
56580
+ super(...arguments);
56581
+ this.name = "IntrospectionError";
56582
+ }
56583
+ };
56557
56584
 
56558
56585
  // src/commands/login/future.ts
56559
56586
  async function performDeviceCodeFlow(client, options) {
@@ -57474,111 +57501,199 @@ function parseTarget({
57474
57501
 
57475
57502
  // src/util/get-scope.ts
57476
57503
  import { relative as relative2 } from "path";
57504
+
57505
+ // src/util/introspect-token.ts
57506
+ var VERCEL_API_ORIGIN = "https://api.vercel.com";
57507
+ async function introspectToken(client) {
57508
+ const token = client.authConfig.token;
57509
+ if (!token) {
57510
+ throw new Error("No token to introspect");
57511
+ }
57512
+ if (new URL(client.apiUrl).origin !== VERCEL_API_ORIGIN) {
57513
+ throw new Error(
57514
+ "Token introspection is unavailable for custom API origins"
57515
+ );
57516
+ }
57517
+ const [error, introspection] = await processInspectTokenResponse(
57518
+ await inspectTokenRequest(token)
57519
+ );
57520
+ if (error) {
57521
+ throw error;
57522
+ }
57523
+ return introspection;
57524
+ }
57525
+
57526
+ // src/util/app.ts
57527
+ function isAppPrincipalEnabled() {
57528
+ return !!process.env["APP_PRINCIPAL_ENABLED"];
57529
+ }
57530
+ function resolveAppFromToken(token) {
57531
+ if (!token.active || !token.client_id) {
57532
+ return null;
57533
+ }
57534
+ return {
57535
+ id: token.client_id,
57536
+ name: token.client_name
57537
+ };
57538
+ }
57539
+ async function resolveAppTokenScope(client, scope) {
57540
+ const token = await introspectToken(client).catch(() => null);
57541
+ const app = token ? resolveAppFromToken(token) : null;
57542
+ const team = token?.team;
57543
+ if (!app || !team) {
57544
+ return false;
57545
+ }
57546
+ if (team.id !== scope && team.slug !== scope) {
57547
+ return false;
57548
+ }
57549
+ client.config.currentTeam = team.id;
57550
+ return true;
57551
+ }
57552
+
57553
+ // src/util/get-scope.ts
57477
57554
  async function getScope(client, opts = {}) {
57478
- const user = await getUser(client);
57479
- let contextName = user.username || user.email;
57480
- let team = null;
57481
- const defaultTeamId = user.version === "northstar" ? user.defaultTeamId : void 0;
57482
- const currentTeamOrDefaultTeamId = client.config.currentTeam || defaultTeamId;
57555
+ const { user, app, token } = await getPrincipal(client);
57556
+ const defaultTeamId = user?.version === "northstar" ? user.defaultTeamId : void 0;
57557
+ const appTeamId = !user && app ? token?.team?.id : void 0;
57558
+ if (!user && app && opts.getTeam === false) {
57559
+ throw new Error(`App principal scope resolution requires a team lookup.`);
57560
+ }
57561
+ if (!user && app) {
57562
+ client.config.currentTeam = appTeamId;
57563
+ }
57483
57564
  if (!client.config.currentTeam && defaultTeamId) {
57484
57565
  client.config.currentTeam = defaultTeamId;
57485
57566
  }
57486
- if (currentTeamOrDefaultTeamId && opts.getTeam !== false) {
57487
- team = await getTeamById(client, currentTeamOrDefaultTeamId);
57488
- if (!team) {
57489
- throw new TeamDeleted();
57490
- }
57491
- contextName = team.slug;
57567
+ const teamId = client.config.currentTeam || defaultTeamId;
57568
+ const team = teamId && opts.getTeam !== false ? await getTeam(client, teamId) : null;
57569
+ const contextName = team?.slug || user?.username || user?.email;
57570
+ if (!contextName) {
57571
+ throw new Error(`Unable to determine context name`);
57492
57572
  }
57493
57573
  if (!opts.resolveLocalScope) {
57494
- return { contextName, team, user };
57574
+ return { contextName, team, user, app };
57495
57575
  }
57496
- const explicitScopeProvided = detectExplicitScope(client);
57497
- const globalTeamId = client.config.currentTeam;
57498
- const globalTeam = team;
57499
- const cwd = client.cwd;
57500
- let projectLink = null;
57501
- try {
57502
- projectLink = await getLinkFromDir(getVercelDirectory(cwd));
57503
- } catch (_error) {
57504
- projectLink = null;
57505
- }
57506
- let repoLink = null;
57507
- try {
57508
- repoLink = await getRepoLink(client, cwd);
57509
- } catch (_error) {
57510
- repoLink = null;
57576
+ return resolveLocalScopeContext(client, { user, app, team });
57577
+ }
57578
+ async function getPrincipal(client) {
57579
+ if (!isAppPrincipalEnabled()) {
57580
+ return { user: await getUser(client), app: null, token: null };
57511
57581
  }
57512
- let localOrgId;
57513
- if (projectLink) {
57514
- localOrgId = projectLink.orgId;
57515
- } else if (repoLink?.repoConfig) {
57516
- const repoConfig = repoLink.repoConfig;
57517
- const projects = findProjectsFromPath(
57518
- repoConfig.projects,
57519
- relative2(repoLink.rootPath, cwd)
57520
- );
57521
- if (projects.length === 1) {
57522
- localOrgId = projects[0].orgId ?? repoLink.repoConfig.orgId ?? void 0;
57523
- } else if (projects.length > 1) {
57524
- const orgIds = new Set(
57525
- projects.map((p) => p.orgId ?? repoConfig.orgId ?? "")
57526
- );
57527
- if (orgIds.size === 1) {
57528
- const [singleOrgId] = orgIds;
57529
- if (singleOrgId) {
57530
- localOrgId = singleOrgId;
57531
- }
57532
- }
57582
+ const [userResult, tokenResult] = await Promise.allSettled([
57583
+ getUser(client),
57584
+ introspectToken(client)
57585
+ ]);
57586
+ const token = tokenResult.status === "fulfilled" ? tokenResult.value : null;
57587
+ const app = token ? resolveAppFromToken(token) : null;
57588
+ if (userResult.status === "rejected") {
57589
+ const isAppToken = app && userResult.reason instanceof InvalidToken;
57590
+ if (!isAppToken) {
57591
+ throw userResult.reason;
57533
57592
  }
57534
57593
  }
57535
- const isCrossTeamRepo = detectCrossTeamRepo(repoLink?.repoConfig);
57594
+ const user = userResult.status === "fulfilled" ? userResult.value : null;
57595
+ return { user, app, token };
57596
+ }
57597
+ async function resolveLocalScopeContext(client, { user, app, team }) {
57598
+ const explicitScopeProvided = detectExplicitScope(client);
57599
+ const globalTeamId = client.config.currentTeam;
57600
+ const { localOrgId, linkedRepo, isCrossTeamRepo } = await findLocalLink(client);
57601
+ const isAppPrincipal = !user && Boolean(app);
57602
+ const effectiveLocalOrgId = isAppPrincipal ? void 0 : localOrgId;
57536
57603
  const scopeMismatch = Boolean(
57537
- localOrgId && globalTeamId && globalTeamId !== localOrgId
57604
+ effectiveLocalOrgId && globalTeamId && globalTeamId !== effectiveLocalOrgId
57538
57605
  );
57539
- let resolvedOrg;
57540
- let resolvedContextName = contextName;
57541
- let resolvedTeam = team;
57542
- let linkedRepoResult = null;
57543
- if (repoLink?.repoConfig) {
57544
- linkedRepoResult = {
57545
- repoConfig: repoLink.repoConfig,
57546
- rootPath: repoLink.rootPath
57547
- };
57548
- }
57549
- if (explicitScopeProvided) {
57550
- resolvedOrg = team ? { type: "team", id: team.id, slug: team.slug } : { type: "user", id: user.id, slug: user.username };
57551
- } else if (localOrgId) {
57552
- client.config.currentTeam = localOrgId.startsWith("team_") ? localOrgId : void 0;
57553
- const correctedTeam = client.config.currentTeam ? await getTeamById(client, client.config.currentTeam) : null;
57554
- const correctedUser = await getUser(client);
57555
- resolvedOrg = correctedTeam ? { type: "team", id: correctedTeam.id, slug: correctedTeam.slug } : {
57556
- type: "user",
57557
- id: correctedUser.id,
57558
- slug: correctedUser.username
57559
- };
57560
- resolvedContextName = correctedTeam ? correctedTeam.slug : correctedUser.username || correctedUser.email;
57561
- resolvedTeam = correctedTeam;
57562
- } else {
57563
- if (isCrossTeamRepo) {
57564
- output_manager_default.warn(
57565
- `This repository has projects across multiple teams. Use \`--scope\` to specify which team, or \`cd\` into a project directory.`
57566
- );
57567
- }
57568
- resolvedOrg = team ? { type: "team", id: team.id, slug: team.slug } : { type: "user", id: user.id, slug: user.username };
57606
+ if (!isAppPrincipal && !explicitScopeProvided && !effectiveLocalOrgId && isCrossTeamRepo) {
57607
+ output_manager_default.warn(
57608
+ `This repository has projects across multiple teams. Use \`--scope\` to specify which team, or \`cd\` into a project directory.`
57609
+ );
57569
57610
  }
57611
+ const resolvedTeam = !explicitScopeProvided && effectiveLocalOrgId ? await applyLocalOrg(client, effectiveLocalOrgId) : team;
57612
+ const { org, contextName } = resolveOrg(resolvedTeam, user);
57570
57613
  return {
57571
- org: resolvedOrg,
57572
- contextName: resolvedContextName,
57614
+ org,
57615
+ contextName,
57573
57616
  user,
57574
57617
  team: resolvedTeam,
57575
- globalTeam,
57576
- linkedRepo: linkedRepoResult,
57618
+ app,
57619
+ globalTeam: team,
57620
+ linkedRepo,
57577
57621
  isCrossTeamRepo,
57578
57622
  scopeMismatch,
57579
57623
  explicitScopeProvided
57580
57624
  };
57581
57625
  }
57626
+ async function applyLocalOrg(client, localOrgId) {
57627
+ client.config.currentTeam = localOrgId.startsWith("team_") ? localOrgId : void 0;
57628
+ return client.config.currentTeam ? await getTeamById(client, client.config.currentTeam) : null;
57629
+ }
57630
+ async function getTeam(client, teamId) {
57631
+ const team = await getTeamById(client, teamId);
57632
+ if (!team) {
57633
+ throw new TeamDeleted();
57634
+ }
57635
+ return team;
57636
+ }
57637
+ function resolveOrg(team, user) {
57638
+ if (team) {
57639
+ return {
57640
+ org: { type: "team", id: team.id, slug: team.slug },
57641
+ contextName: team.slug
57642
+ };
57643
+ }
57644
+ if (user) {
57645
+ return {
57646
+ org: { type: "user", id: user.id, slug: user.username },
57647
+ contextName: user.username || user.email
57648
+ };
57649
+ }
57650
+ throw new Error(
57651
+ `Unable to determine scope: no team or personal account is available for this token. Use \`--scope\` to specify a team.`
57652
+ );
57653
+ }
57654
+ async function findLocalLink(client) {
57655
+ const [projectLink, repoLink] = await Promise.all([
57656
+ findProjectLink(client),
57657
+ findRepoLink(client)
57658
+ ]);
57659
+ return {
57660
+ localOrgId: findLocalOrgId(client.cwd, projectLink, repoLink),
57661
+ linkedRepo: repoLink?.repoConfig ? { repoConfig: repoLink.repoConfig, rootPath: repoLink.rootPath } : null,
57662
+ isCrossTeamRepo: detectCrossTeamRepo(repoLink?.repoConfig)
57663
+ };
57664
+ }
57665
+ async function findProjectLink(client) {
57666
+ try {
57667
+ return await getLinkFromDir(getVercelDirectory(client.cwd));
57668
+ } catch (_error) {
57669
+ return null;
57670
+ }
57671
+ }
57672
+ async function findRepoLink(client) {
57673
+ try {
57674
+ return await getRepoLink(client, client.cwd);
57675
+ } catch (_error) {
57676
+ return null;
57677
+ }
57678
+ }
57679
+ function findLocalOrgId(cwd, projectLink, repoLink) {
57680
+ if (projectLink) {
57681
+ return projectLink.orgId;
57682
+ }
57683
+ if (repoLink?.repoConfig) {
57684
+ return findRepoOrgId(repoLink.repoConfig, relative2(repoLink.rootPath, cwd));
57685
+ }
57686
+ return void 0;
57687
+ }
57688
+ function findRepoOrgId(repoConfig, pathFromRepoRoot) {
57689
+ const projects = findProjectsFromPath(repoConfig.projects, pathFromRepoRoot);
57690
+ const orgIds = new Set(projects.map((p) => p.orgId ?? repoConfig.orgId ?? ""));
57691
+ if (orgIds.size !== 1) {
57692
+ return void 0;
57693
+ }
57694
+ const [orgId] = orgIds;
57695
+ return orgId || void 0;
57696
+ }
57582
57697
  function detectExplicitScope(client) {
57583
57698
  const argv = client.argv;
57584
57699
  for (const arg of argv) {
@@ -58837,7 +58952,7 @@ function createDetectEntrypoint(projectRoot) {
58837
58952
  };
58838
58953
  }
58839
58954
  async function loadBuilderDetectEntrypoint(name, projectRoot) {
58840
- const { importBuilders } = await import("./import-builders-7UG32FQA.js");
58955
+ const { importBuilders } = await import("./import-builders-RBYAQIPN.js");
58841
58956
  const builders = await importBuilders(/* @__PURE__ */ new Set([name]), projectRoot);
58842
58957
  const loaded = builders.get(name);
58843
58958
  if (!loaded) {
@@ -59847,6 +59962,14 @@ export {
59847
59962
  envCommand,
59848
59963
  param,
59849
59964
  getUser,
59965
+ ua_default,
59966
+ processTokenResponse,
59967
+ revocationRequest,
59968
+ processRevocationResponse,
59969
+ refreshTokenRequest,
59970
+ isOAuthError,
59971
+ isAppPrincipalEnabled,
59972
+ resolveAppTokenScope,
59850
59973
  getTeamById,
59851
59974
  getTeams,
59852
59975
  isBackspaceKey,
@@ -59865,13 +59988,7 @@ export {
59865
59988
  Separator,
59866
59989
  esm_default2,
59867
59990
  esm_default3,
59868
- ua_default,
59869
59991
  require_open,
59870
- processTokenResponse,
59871
- revocationRequest,
59872
- processRevocationResponse,
59873
- refreshTokenRequest,
59874
- isOAuthError,
59875
59992
  performDeviceCodeFlow,
59876
59993
  login,
59877
59994
  modify,
@@ -11,7 +11,7 @@ import {
11
11
  getLinkedProject,
12
12
  getProjectByNameOrId,
13
13
  getScope
14
- } from "./chunk-BX4IGDGM.js";
14
+ } from "./chunk-4IFEBYTL.js";
15
15
  import {
16
16
  printError
17
17
  } from "./chunk-KBEX5MYS.js";
@@ -9,7 +9,7 @@ import {
9
9
  require_dist as require_dist2,
10
10
  require_dist3,
11
11
  require_lib
12
- } from "./chunk-BX4IGDGM.js";
12
+ } from "./chunk-4IFEBYTL.js";
13
13
  import {
14
14
  output_manager_default,
15
15
  require_dist
@@ -11,7 +11,7 @@ import {
11
11
  PromptBackError,
12
12
  PromptCanceledError,
13
13
  getLocalPathConfig
14
- } from "./chunk-7AB6QOKM.js";
14
+ } from "./chunk-W24ZG3GV.js";
15
15
  import {
16
16
  DEFAULT_VERCEL_CONFIG_FILENAME,
17
17
  VERCEL_CONFIG_EXTENSIONS,
@@ -38,7 +38,7 @@ import {
38
38
  useKeypress,
39
39
  usePrefix,
40
40
  useState
41
- } from "./chunk-BX4IGDGM.js";
41
+ } from "./chunk-4IFEBYTL.js";
42
42
  import {
43
43
  require_load_json_file
44
44
  } from "./chunk-ECCWJHC6.js";
@@ -6,10 +6,10 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  isJSONObject
9
- } from "./chunk-YUISINFV.js";
9
+ } from "./chunk-6BEMCJFX.js";
10
10
  import {
11
11
  getProjectByNameOrId
12
- } from "./chunk-BX4IGDGM.js";
12
+ } from "./chunk-4IFEBYTL.js";
13
13
  import {
14
14
  AGENT_REASON,
15
15
  outputAgentError
@@ -8,7 +8,7 @@ import {
8
8
  VERCEL_DIR,
9
9
  VERCEL_DIR_PROJECT,
10
10
  require_lib
11
- } from "./chunk-BX4IGDGM.js";
11
+ } from "./chunk-4IFEBYTL.js";
12
12
  import {
13
13
  require_dist
14
14
  } from "./chunk-OX7KI3LF.js";
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  resolveProjectContext
9
- } from "./chunk-BX4IGDGM.js";
9
+ } from "./chunk-4IFEBYTL.js";
10
10
  import {
11
11
  AGENT_REASON,
12
12
  AGENT_STATUS,
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  resolveAlertsScope
9
- } from "./chunk-DQXBNALU.js";
9
+ } from "./chunk-NFIGIDOY.js";
10
10
  import {
11
11
  handleValidationError,
12
12
  outputError,
@@ -15,13 +15,13 @@ import {
15
15
  printIndications,
16
16
  require_dist as require_dist2,
17
17
  sleep
18
- } from "./chunk-YUISINFV.js";
18
+ } from "./chunk-6BEMCJFX.js";
19
19
  import {
20
20
  suggestNextCommands
21
21
  } from "./chunk-XBN2O34P.js";
22
22
  import {
23
23
  CommandTimeout
24
- } from "./chunk-NFZHW6HH.js";
24
+ } from "./chunk-24TPLHEI.js";
25
25
  import {
26
26
  showPluginTipIfNeeded
27
27
  } from "./chunk-HT2XWSAJ.js";
@@ -38,7 +38,7 @@ import {
38
38
  require_dist as require_dist3,
39
39
  require_pluralize,
40
40
  ua_default
41
- } from "./chunk-BX4IGDGM.js";
41
+ } from "./chunk-4IFEBYTL.js";
42
42
  import {
43
43
  require_ms
44
44
  } from "./chunk-GGP5R3FU.js";
@@ -2181,8 +2181,10 @@ async function performAddRequest(client, domainName) {
2181
2181
  return (0, import_async_retry4.default)(
2182
2182
  async () => {
2183
2183
  try {
2184
- const { domain } = await client.fetch("/v4/domains", {
2185
- body: { name: domainName },
2184
+ const { domain } = await client.fetch("/v7/domains", {
2185
+ // `zone` must be sent explicitly: the API only defaults it to `true`
2186
+ // on v4 and below, so omitting it here would stop creating DNS zones.
2187
+ body: { name: domainName, zone: true },
2186
2188
  method: "POST"
2187
2189
  });
2188
2190
  return domain;
@@ -2212,7 +2214,7 @@ async function getDomainByName(client, contextName, domainName, options = {}) {
2212
2214
  }
2213
2215
  try {
2214
2216
  const { domain } = await client.fetch(
2215
- `/v4/domains/${encodeURIComponent(domainName)}`,
2217
+ `/v5/domains/${encodeURIComponent(domainName)}`,
2216
2218
  { bailOn429: options.bailOn429 }
2217
2219
  );
2218
2220
  return domain;
@@ -8,7 +8,7 @@ import {
8
8
  getLocalPathConfig,
9
9
  isPromptBackError,
10
10
  isPromptCanceledError
11
- } from "./chunk-7AB6QOKM.js";
11
+ } from "./chunk-W24ZG3GV.js";
12
12
  import {
13
13
  table
14
14
  } from "./chunk-KT4XXKJK.js";
@@ -46,7 +46,7 @@ import {
46
46
  selectAndParseRemoteUrl,
47
47
  selectOrg,
48
48
  writeServicesConfig
49
- } from "./chunk-BX4IGDGM.js";
49
+ } from "./chunk-4IFEBYTL.js";
50
50
  import {
51
51
  printError
52
52
  } from "./chunk-KBEX5MYS.js";
@@ -20,7 +20,7 @@ import {
20
20
  getLinkedProject,
21
21
  getProjectByNameOrId,
22
22
  getScope
23
- } from "./chunk-BX4IGDGM.js";
23
+ } from "./chunk-4IFEBYTL.js";
24
24
  import {
25
25
  AGENT_REASON,
26
26
  buildCommandWithGlobalFlags,
@@ -8,7 +8,7 @@ import {
8
8
  formatCondition,
9
9
  formatTransform,
10
10
  isTargetTransform
11
- } from "./chunk-YTIUSEWE.js";
11
+ } from "./chunk-DGDUIC5A.js";
12
12
  import {
13
13
  output_manager_default
14
14
  } from "./chunk-OX7KI3LF.js";