vercel 58.8.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 (83) hide show
  1. package/dist/chunks/{add-RVZD257F.js → add-5NFS6DS7.js} +2 -2
  2. package/dist/chunks/{add-OJLNBYCB.js → add-NIBAFBPP.js} +6 -6
  3. package/dist/chunks/{add-GEI53S56.js → add-PJLLOYOB.js} +2 -2
  4. package/dist/chunks/{build-KAOW7IJ6.js → build-MF4TD2RD.js} +2 -2
  5. package/dist/chunks/{chunk-IFNTK75I.js → chunk-24TPLHEI.js} +9 -2
  6. package/dist/chunks/{chunk-IOBULT7M.js → chunk-4IFEBYTL.js} +216 -100
  7. package/dist/chunks/{chunk-N7C5X53Q.js → chunk-4RXXF7V7.js} +1 -1
  8. package/dist/chunks/{chunk-XTIQ7DV7.js → chunk-4XO6B3JD.js} +1 -1
  9. package/dist/chunks/{chunk-HJEZQCMB.js → chunk-6BEMCJFX.js} +2 -2
  10. package/dist/chunks/{chunk-7ZEPVL6J.js → chunk-6LBPHFMP.js} +2 -2
  11. package/dist/chunks/{chunk-55JM5YCD.js → chunk-BEKBCDTM.js} +1 -1
  12. package/dist/chunks/{chunk-4BQZVTJ2.js → chunk-DGDUIC5A.js} +1 -1
  13. package/dist/chunks/{chunk-FWZGQKRP.js → chunk-DJPFR2DG.js} +1 -1
  14. package/dist/chunks/{chunk-KPDA6YEP.js → chunk-GCSUBTKN.js} +8 -6
  15. package/dist/chunks/{chunk-ASSWFLX7.js → chunk-L7LKHLFB.js} +2 -2
  16. package/dist/chunks/{chunk-V3FYICX7.js → chunk-LIPSDQMJ.js} +1 -1
  17. package/dist/chunks/{chunk-AX2PTUXP.js → chunk-MAQ6U5X2.js} +1 -1
  18. package/dist/chunks/{chunk-YRYC7WDR.js → chunk-N6ZAAUNN.js} +4 -4
  19. package/dist/chunks/{chunk-SPQSJERL.js → chunk-NFIGIDOY.js} +1 -1
  20. package/dist/chunks/{chunk-LCZDGAXC.js → chunk-SHXS3ZJD.js} +1 -1
  21. package/dist/chunks/{chunk-4IVGF3OR.js → chunk-U6FXU4WS.js} +1 -1
  22. package/dist/chunks/{chunk-AF7S35K3.js → chunk-V3W6GV3A.js} +1 -1
  23. package/dist/chunks/{chunk-53LZ5BMD.js → chunk-VBAIEFLF.js} +2 -2
  24. package/dist/chunks/{chunk-EMD7HCIW.js → chunk-VNNVJGKE.js} +1 -1
  25. package/dist/chunks/{chunk-JFJGWMAL.js → chunk-VX6VORWT.js} +1 -1
  26. package/dist/chunks/{chunk-N2A6HWBD.js → chunk-W24ZG3GV.js} +1 -1
  27. package/dist/chunks/chunk-YRV4A73W.js +2910 -0
  28. package/dist/chunks/{clear-DWPIGPO2.js → clear-M3QWP3HM.js} +2 -2
  29. package/dist/chunks/{compile-vercel-config-FSU42P2X.js → compile-vercel-config-6DMGPMCK.js} +1 -1
  30. package/dist/chunks/{config-V42N5SNP.js → config-5D4R6677.js} +2 -2
  31. package/dist/chunks/{delete-5KRNKCYI.js → delete-CJG3FHU7.js} +2 -2
  32. package/dist/chunks/{delete-EQ5NJWPR.js → delete-ZWUWQT5H.js} +2 -2
  33. package/dist/chunks/{disable-KO6WDHRC.js → disable-CJKTITTQ.js} +2 -2
  34. package/dist/chunks/{discard-E7PLPNUL.js → discard-ABXIPZHK.js} +2 -2
  35. package/dist/chunks/{edit-OIXKTSXJ.js → edit-VJ43TKOX.js} +2 -2
  36. package/dist/chunks/{edit-55TQT6RK.js → edit-VNVPLLF7.js} +3 -3
  37. package/dist/chunks/{enable-UOEAVAUU.js → enable-L7ERJOO5.js} +2 -2
  38. package/dist/chunks/{export-X2XFUNPV.js → export-BDAKZGOD.js} +2 -2
  39. package/dist/chunks/{image-JAAMXTIA.js → image-MGZR4VEH.js} +3 -3
  40. package/dist/chunks/{import-builders-YDOLGBXS.js → import-builders-RBYAQIPN.js} +2 -2
  41. package/dist/chunks/{inspect-EYUJ32YM.js → inspect-3V6PPUA3.js} +3 -3
  42. package/dist/chunks/{inspect-W4AH3EKN.js → inspect-E6IHZHQI.js} +2 -2
  43. package/dist/chunks/{inspect-SQXG4BFZ.js → inspect-IO5JFCCX.js} +2 -2
  44. package/dist/chunks/{inspect-IP6EMMGZ.js → inspect-KQBV3ALQ.js} +2 -2
  45. package/dist/chunks/{inspect-S52AEYAQ.js → inspect-XDKWDIUB.js} +2 -2
  46. package/dist/chunks/{list-ZFHW4YYW.js → list-FTWJF5YO.js} +2 -2
  47. package/dist/chunks/{list-W2HMCZT7.js → list-RQB5Q7IJ.js} +16 -5
  48. package/dist/chunks/{list-KODWTHC2.js → list-S2ZEK7DX.js} +1 -1
  49. package/dist/chunks/{login-QA4765QP.js → login-AVIFCN4G.js} +2 -2
  50. package/dist/chunks/{ls-A3RJWHNR.js → ls-44QDBZEW.js} +2 -2
  51. package/dist/chunks/{ls-GZ5K57Y6.js → ls-BKZZIR53.js} +3 -3
  52. package/dist/chunks/{ls-GHFI6RDD.js → ls-FI4MV46I.js} +2 -2
  53. package/dist/chunks/{ls-GLFSM2NL.js → ls-JI2KIY4O.js} +2 -2
  54. package/dist/chunks/{ls-ESCK2JMH.js → ls-ZG43UJTR.js} +2 -2
  55. package/dist/chunks/{open-EE7WS2UB.js → open-FGSEFGJL.js} +2 -2
  56. package/dist/chunks/{permissions-L7NPGX2M.js → permissions-BDINZ7RC.js} +4 -4
  57. package/dist/chunks/{publish-7BIMCBQ6.js → publish-7FXAFWWN.js} +2 -2
  58. package/dist/chunks/{push-IKPIV52M.js → push-3P3NKZEG.js} +2 -2
  59. package/dist/chunks/{query-DFRPIOZM.js → query-7MQN4S3S.js} +1 -1
  60. package/dist/chunks/{reorder-GA5FVDKD.js → reorder-42YNZL7R.js} +2 -2
  61. package/dist/chunks/{reply-C3375THE.js → reply-36KQN23N.js} +2 -2
  62. package/dist/chunks/{resolve-MBWHKHSW.js → resolve-ESN7P6O3.js} +2 -2
  63. package/dist/chunks/{restore-WGSD5LXC.js → restore-RCNRC3YJ.js} +2 -2
  64. package/dist/chunks/{rm-KOUNSG5Y.js → rm-E2WEJZPW.js} +2 -2
  65. package/dist/chunks/{rm-XITL2VK4.js → rm-MMYOJPW4.js} +3 -3
  66. package/dist/chunks/{rm-PXBJERO4.js → rm-ODFQSS2C.js} +2 -2
  67. package/dist/chunks/{rm-UEFME3MH.js → rm-R77FI255.js} +2 -2
  68. package/dist/chunks/{rule-inspect-7MJ6F3H6.js → rule-inspect-FDBIBPKM.js} +3 -3
  69. package/dist/chunks/{rules-YBSW4TND.js → rules-3GSC27DA.js} +6 -6
  70. package/dist/chunks/{schema-JP4Z36AT.js → schema-QDU3FPNC.js} +1 -1
  71. package/dist/chunks/{tags-XEZOWSS3.js → tags-WZBKHB6D.js} +2 -2
  72. package/dist/chunks/{update-236TLBCO.js → update-KNN7C6KN.js} +6 -6
  73. package/dist/commands/build/index.js +16 -2718
  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 +1712 -745
  80. package/dist/index.js +64 -57
  81. package/dist/version.mjs +1 -1
  82. package/package.json +46 -46
  83. package/dist/chunks/chunk-ZGXTMIJX.js +0 -206
@@ -9,7 +9,7 @@ import {
9
9
  handleVcrApiError,
10
10
  resolveVcrScope,
11
11
  validateVcrJsonOutput
12
- } from "./chunk-V3FYICX7.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-IOBULT7M.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-7ZEPVL6J.js";
11
+ } from "./chunk-6LBPHFMP.js";
12
12
  import {
13
13
  emitRulesArgParseError,
14
14
  handleRulesApiError,
15
15
  parseRulesFlagsAndScope,
16
16
  rulesCollectionPath
17
- } from "./chunk-FWZGQKRP.js";
17
+ } from "./chunk-DJPFR2DG.js";
18
18
  import {
19
19
  isCustomAlertRule
20
20
  } from "./chunk-TEQKKTJQ.js";
21
- import "./chunk-SPQSJERL.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-HJEZQCMB.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-N2A6HWBD.js";
34
+ import "./chunk-W24ZG3GV.js";
35
35
  import "./chunk-KT4XXKJK.js";
36
- import "./chunk-IOBULT7M.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-V3FYICX7.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-IOBULT7M.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-V3FYICX7.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-IOBULT7M.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-AF7S35K3.js";
34
+ } from "./chunk-V3W6GV3A.js";
35
35
  import {
36
36
  envCommand
37
- } from "./chunk-IOBULT7M.js";
37
+ } from "./chunk-4IFEBYTL.js";
38
38
  import {
39
39
  confirmOption,
40
40
  deploymentOption,
@@ -1081,6 +1081,13 @@ var setupSubcommand = {
1081
1081
  deprecated: false,
1082
1082
  description: "Do not write .bak backups of changed files"
1083
1083
  },
1084
+ {
1085
+ name: "no-session-migration",
1086
+ shorthand: null,
1087
+ type: Boolean,
1088
+ deprecated: false,
1089
+ description: "Do not copy existing Codex Desktop sessions for use with the Vercel AI Gateway provider."
1090
+ },
1084
1091
  {
1085
1092
  name: "no-keychain",
1086
1093
  shorthand: null,
@@ -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.6",
38167
+ version: "18.2.8",
38168
38168
  main: "dist/index.js",
38169
38169
  typings: "dist/index.d.ts",
38170
38170
  homepage: "https://vercel.com",
@@ -38179,11 +38179,10 @@ var require_package = __commonJS({
38179
38179
  },
38180
38180
  scripts: {
38181
38181
  build: "node ../../utils/build.mjs",
38182
- test: "vitest run --config ../../vitest.config.mts",
38183
- "vitest-run": "vitest -c ./vitest.config.mts",
38184
- "vitest-unit": "pnpm vitest-run --run tests/unit.",
38185
- "vitest-e2e": "glob --absolute 'tests/integration-*.test.ts'",
38186
- "type-check": "tsc --noEmit"
38182
+ test: "vitest run --config ./vitest.config.mts",
38183
+ "test-e2e": "vitest run --config ./vitest.config.mts tests/integration-",
38184
+ "type-check": "tsc --noEmit",
38185
+ "test-unit": "vitest run --config ./vitest.config.mts tests/unit."
38187
38186
  },
38188
38187
  engines: {
38189
38188
  node: ">= 20"
@@ -38196,7 +38195,7 @@ var require_package = __commonJS({
38196
38195
  "@types/node": "20.11.0",
38197
38196
  "@types/recursive-readdir": "2.2.0",
38198
38197
  "@types/tar-fs": "1.16.1",
38199
- vitest: "2.0.1"
38198
+ vitest: "4.1.10"
38200
38199
  },
38201
38200
  dependencies: {
38202
38201
  "@vercel/build-utils": "workspace:*",
@@ -45813,9 +45812,9 @@ var require_out4 = __commonJS({
45813
45812
  }
45814
45813
  });
45815
45814
 
45816
- // ../../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
45817
45816
  var require_utils8 = __commonJS({
45818
- "../../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) {
45819
45818
  "use strict";
45820
45819
  var __create = Object.create;
45821
45820
  var __defProp = Object.defineProperty;
@@ -56555,6 +56554,33 @@ function canParseURL(url) {
56555
56554
  return false;
56556
56555
  }
56557
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
+ };
56558
56584
 
56559
56585
  // src/commands/login/future.ts
56560
56586
  async function performDeviceCodeFlow(client, options) {
@@ -57475,111 +57501,199 @@ function parseTarget({
57475
57501
 
57476
57502
  // src/util/get-scope.ts
57477
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
57478
57554
  async function getScope(client, opts = {}) {
57479
- const user = await getUser(client);
57480
- let contextName = user.username || user.email;
57481
- let team = null;
57482
- const defaultTeamId = user.version === "northstar" ? user.defaultTeamId : void 0;
57483
- 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
+ }
57484
57564
  if (!client.config.currentTeam && defaultTeamId) {
57485
57565
  client.config.currentTeam = defaultTeamId;
57486
57566
  }
57487
- if (currentTeamOrDefaultTeamId && opts.getTeam !== false) {
57488
- team = await getTeamById(client, currentTeamOrDefaultTeamId);
57489
- if (!team) {
57490
- throw new TeamDeleted();
57491
- }
57492
- 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`);
57493
57572
  }
57494
57573
  if (!opts.resolveLocalScope) {
57495
- return { contextName, team, user };
57574
+ return { contextName, team, user, app };
57496
57575
  }
57497
- const explicitScopeProvided = detectExplicitScope(client);
57498
- const globalTeamId = client.config.currentTeam;
57499
- const globalTeam = team;
57500
- const cwd = client.cwd;
57501
- let projectLink = null;
57502
- try {
57503
- projectLink = await getLinkFromDir(getVercelDirectory(cwd));
57504
- } catch (_error) {
57505
- projectLink = null;
57506
- }
57507
- let repoLink = null;
57508
- try {
57509
- repoLink = await getRepoLink(client, cwd);
57510
- } catch (_error) {
57511
- 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 };
57512
57581
  }
57513
- let localOrgId;
57514
- if (projectLink) {
57515
- localOrgId = projectLink.orgId;
57516
- } else if (repoLink?.repoConfig) {
57517
- const repoConfig = repoLink.repoConfig;
57518
- const projects = findProjectsFromPath(
57519
- repoConfig.projects,
57520
- relative2(repoLink.rootPath, cwd)
57521
- );
57522
- if (projects.length === 1) {
57523
- localOrgId = projects[0].orgId ?? repoLink.repoConfig.orgId ?? void 0;
57524
- } else if (projects.length > 1) {
57525
- const orgIds = new Set(
57526
- projects.map((p) => p.orgId ?? repoConfig.orgId ?? "")
57527
- );
57528
- if (orgIds.size === 1) {
57529
- const [singleOrgId] = orgIds;
57530
- if (singleOrgId) {
57531
- localOrgId = singleOrgId;
57532
- }
57533
- }
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;
57534
57592
  }
57535
57593
  }
57536
- 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;
57537
57603
  const scopeMismatch = Boolean(
57538
- localOrgId && globalTeamId && globalTeamId !== localOrgId
57604
+ effectiveLocalOrgId && globalTeamId && globalTeamId !== effectiveLocalOrgId
57539
57605
  );
57540
- let resolvedOrg;
57541
- let resolvedContextName = contextName;
57542
- let resolvedTeam = team;
57543
- let linkedRepoResult = null;
57544
- if (repoLink?.repoConfig) {
57545
- linkedRepoResult = {
57546
- repoConfig: repoLink.repoConfig,
57547
- rootPath: repoLink.rootPath
57548
- };
57549
- }
57550
- if (explicitScopeProvided) {
57551
- resolvedOrg = team ? { type: "team", id: team.id, slug: team.slug } : { type: "user", id: user.id, slug: user.username };
57552
- } else if (localOrgId) {
57553
- client.config.currentTeam = localOrgId.startsWith("team_") ? localOrgId : void 0;
57554
- const correctedTeam = client.config.currentTeam ? await getTeamById(client, client.config.currentTeam) : null;
57555
- const correctedUser = await getUser(client);
57556
- resolvedOrg = correctedTeam ? { type: "team", id: correctedTeam.id, slug: correctedTeam.slug } : {
57557
- type: "user",
57558
- id: correctedUser.id,
57559
- slug: correctedUser.username
57560
- };
57561
- resolvedContextName = correctedTeam ? correctedTeam.slug : correctedUser.username || correctedUser.email;
57562
- resolvedTeam = correctedTeam;
57563
- } else {
57564
- if (isCrossTeamRepo) {
57565
- output_manager_default.warn(
57566
- `This repository has projects across multiple teams. Use \`--scope\` to specify which team, or \`cd\` into a project directory.`
57567
- );
57568
- }
57569
- 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
+ );
57570
57610
  }
57611
+ const resolvedTeam = !explicitScopeProvided && effectiveLocalOrgId ? await applyLocalOrg(client, effectiveLocalOrgId) : team;
57612
+ const { org, contextName } = resolveOrg(resolvedTeam, user);
57571
57613
  return {
57572
- org: resolvedOrg,
57573
- contextName: resolvedContextName,
57614
+ org,
57615
+ contextName,
57574
57616
  user,
57575
57617
  team: resolvedTeam,
57576
- globalTeam,
57577
- linkedRepo: linkedRepoResult,
57618
+ app,
57619
+ globalTeam: team,
57620
+ linkedRepo,
57578
57621
  isCrossTeamRepo,
57579
57622
  scopeMismatch,
57580
57623
  explicitScopeProvided
57581
57624
  };
57582
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
+ }
57583
57697
  function detectExplicitScope(client) {
57584
57698
  const argv = client.argv;
57585
57699
  for (const arg of argv) {
@@ -58838,7 +58952,7 @@ function createDetectEntrypoint(projectRoot) {
58838
58952
  };
58839
58953
  }
58840
58954
  async function loadBuilderDetectEntrypoint(name, projectRoot) {
58841
- const { importBuilders } = await import("./import-builders-YDOLGBXS.js");
58955
+ const { importBuilders } = await import("./import-builders-RBYAQIPN.js");
58842
58956
  const builders = await importBuilders(/* @__PURE__ */ new Set([name]), projectRoot);
58843
58957
  const loaded = builders.get(name);
58844
58958
  if (!loaded) {
@@ -59848,6 +59962,14 @@ export {
59848
59962
  envCommand,
59849
59963
  param,
59850
59964
  getUser,
59965
+ ua_default,
59966
+ processTokenResponse,
59967
+ revocationRequest,
59968
+ processRevocationResponse,
59969
+ refreshTokenRequest,
59970
+ isOAuthError,
59971
+ isAppPrincipalEnabled,
59972
+ resolveAppTokenScope,
59851
59973
  getTeamById,
59852
59974
  getTeams,
59853
59975
  isBackspaceKey,
@@ -59866,13 +59988,7 @@ export {
59866
59988
  Separator,
59867
59989
  esm_default2,
59868
59990
  esm_default3,
59869
- ua_default,
59870
59991
  require_open,
59871
- processTokenResponse,
59872
- revocationRequest,
59873
- processRevocationResponse,
59874
- refreshTokenRequest,
59875
- isOAuthError,
59876
59992
  performDeviceCodeFlow,
59877
59993
  login,
59878
59994
  modify,
@@ -11,7 +11,7 @@ import {
11
11
  getLinkedProject,
12
12
  getProjectByNameOrId,
13
13
  getScope
14
- } from "./chunk-IOBULT7M.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-IOBULT7M.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-N2A6HWBD.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-IOBULT7M.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-HJEZQCMB.js";
9
+ } from "./chunk-6BEMCJFX.js";
10
10
  import {
11
11
  getProjectByNameOrId
12
- } from "./chunk-IOBULT7M.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-IOBULT7M.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-IOBULT7M.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-SPQSJERL.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-HJEZQCMB.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-IFNTK75I.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-IOBULT7M.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-N2A6HWBD.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-IOBULT7M.js";
49
+ } from "./chunk-4IFEBYTL.js";
50
50
  import {
51
51
  printError
52
52
  } from "./chunk-KBEX5MYS.js";