sandbox 2.5.9 → 2.5.10

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.
@@ -15,7 +15,7 @@ import childProcess, { execFile } from "node:child_process";
15
15
  import fs, { constants, writeFile } from "node:fs/promises";
16
16
  import fs$1, { createWriteStream } from "node:fs";
17
17
  import * as Auth from "@vercel/sandbox/dist/auth/index.js";
18
- import { OAuth, getAuth, pollForToken, updateAuthConfig } from "@vercel/sandbox/dist/auth/index.js";
18
+ import { OAuth, getAuth, inferScope, pollForToken, updateAuthConfig } from "@vercel/sandbox/dist/auth/index.js";
19
19
  import { EOL } from "os";
20
20
  import { z } from "zod/v4";
21
21
  import { z as z$1 } from "zod";
@@ -7017,7 +7017,15 @@ const login = import_cjs$19.command({
7017
7017
  if (error) {
7018
7018
  spinner.fail(`${source_default.red("error:")} ${error.message}`);
7019
7019
  process.exitCode = 1;
7020
- } else spinner.succeed(`${source_default.cyan("Congratulations!")} You are now signed in.`);
7020
+ } else {
7021
+ spinner.succeed(`${source_default.cyan("Congratulations!")} You are now signed in.`);
7022
+ const auth = getAuth();
7023
+ if (auth?.token) try {
7024
+ const { teamId, teamSlug, projectId, projectSlug } = await inferScope({ token: auth.token });
7025
+ process.stderr.write(source_default.dim(" │ ") + "team: " + source_default.cyan(teamSlug ?? teamId) + "\n");
7026
+ process.stderr.write(source_default.dim(" ╰ ") + "project: " + source_default.cyan(projectSlug ?? projectId) + "\n");
7027
+ } catch {}
7028
+ }
7021
7029
  } catch (_) {
7022
7030
  _usingCtx$1.e = _;
7023
7031
  } finally {
@@ -7252,7 +7260,7 @@ function readProjectConfiguration(cwd) {
7252
7260
  //#endregion
7253
7261
  //#region src/util/infer-scope.ts
7254
7262
  const debug$3 = createDebugger("sandbox:scope");
7255
- async function inferScope({ token: token$1, team: team$1 }) {
7263
+ async function inferScope$1({ token: token$1, team: team$1 }) {
7256
7264
  const jwt = z.jwt().safeParse(token$1);
7257
7265
  if (jwt.success) {
7258
7266
  debug$3("trying to infer scope from OIDC JWT");
@@ -7300,15 +7308,15 @@ async function inferFromJwt(jwt) {
7300
7308
  };
7301
7309
  }
7302
7310
  async function inferFromToken(token$1, requestedTeam) {
7303
- const { teamId, projectId } = await Auth.inferScope({
7311
+ const { teamId, teamSlug, projectId, projectSlug } = await Auth.inferScope({
7304
7312
  token: token$1,
7305
7313
  teamId: requestedTeam
7306
7314
  });
7307
7315
  return {
7308
7316
  owner: teamId,
7309
7317
  project: projectId,
7310
- ownerSlug: teamId,
7311
- projectSlug: projectId
7318
+ ownerSlug: teamSlug ?? teamId,
7319
+ projectSlug: projectSlug ?? projectId
7312
7320
  };
7313
7321
  }
7314
7322
 
@@ -7379,7 +7387,7 @@ const scope = {
7379
7387
  let projectSlug;
7380
7388
  let teamSlug;
7381
7389
  if (typeof projectId.value === "undefined" || typeof teamId.value === "undefined") try {
7382
- const scope$1 = await inferScope({
7390
+ const scope$1 = await inferScope$1({
7383
7391
  token: t.value,
7384
7392
  team: teamId.value
7385
7393
  });
@@ -7425,7 +7433,7 @@ const scope = {
7425
7433
 
7426
7434
  //#endregion
7427
7435
  //#region package.json
7428
- var version = "2.5.9";
7436
+ var version = "2.5.10";
7429
7437
 
7430
7438
  //#endregion
7431
7439
  //#region src/error.ts
@@ -14692,4 +14700,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
14692
14700
 
14693
14701
  //#endregion
14694
14702
  export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
14695
- //# sourceMappingURL=app-C_F_gdzS.mjs.map
14703
+ //# sourceMappingURL=app-BaAm8oB8.mjs.map