@prisma/cli 8.0.0-rc.15-dev.110 → 8.0.0-rc.15-dev.111

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 (2) hide show
  1. package/dist/cli.js +29 -11
  2. package/package.json +6 -6
package/dist/cli.js CHANGED
@@ -2413,6 +2413,7 @@ async function resolveAgentSetupTipCommand(ctx) {
2413
2413
  //#endregion
2414
2414
  //#region src/commands/auth/credential-card.ts
2415
2415
  const ENVIRONMENT_CREDENTIAL_NOTICE = `${SERVICE_TOKEN_ENV_VAR} supplies the credential in force; unset it to use your stored workspace sessions.`;
2416
+ const UNVERIFIED_CREDENTIAL_NOTICE = "Could not reach Prisma to confirm this sign-in. Showing what the local credential says.";
2416
2417
  /** The card rows for the active credential, or the signed-out row when
2417
2418
  * there is none. A credential nothing names — an environment token
2418
2419
  * whose claims carry no workspace — has no workspace row at all. */
@@ -2686,22 +2687,31 @@ const SIGN_IN = {
2686
2687
  * nothing else bounds a request: a host that accepts the connection
2687
2688
  * and never answers would otherwise hold the command for minutes. */
2688
2689
  const ENRICHMENT_TIMEOUT_MS = 3e3;
2689
- /** Best-effort online enrichment: whoami works offline, so any failure
2690
- * leaves the identity as whatever the credential's own claims said. */
2690
+ /** Best-effort online enrichment: whoami works offline, so a transient
2691
+ * failure leaves the identity as the credential's own claims said.
2692
+ * CLI.CREDENTIALS_REQUIRED means signed out; AUTH.SERVICE_TOKEN_REJECTED
2693
+ * is rethrown because signing in cannot fix an environment token. */
2691
2694
  async function fetchedIdentity(api, signal) {
2692
2695
  const bounded = AbortSignal.any([signal, AbortSignal.timeout(ENRICHMENT_TIMEOUT_MS)]);
2693
2696
  try {
2694
2697
  const { data } = await api.GET("/v1/me", { signal: bounded });
2695
- const user = data?.data?.user;
2696
- if (!user) return;
2698
+ if (data === void 0) return { kind: "inconclusive" };
2699
+ const user = data.data?.user;
2697
2700
  return {
2698
- userId: user.id ?? void 0,
2699
- email: user.email ?? void 0,
2700
- name: user.name ?? void 0
2701
+ kind: "confirmed",
2702
+ identity: user ? {
2703
+ userId: user.id ?? void 0,
2704
+ email: user.email ?? void 0,
2705
+ name: user.name ?? void 0
2706
+ } : void 0
2701
2707
  };
2702
- } catch {
2708
+ } catch (cause) {
2703
2709
  signal.throwIfAborted();
2704
- return;
2710
+ if (CliStructuredError.is(cause)) {
2711
+ if (cause.code === "CLI.CREDENTIALS_REQUIRED") return { kind: "signed-out" };
2712
+ if (cause.code === "AUTH.SERVICE_TOKEN_REJECTED") throw cause;
2713
+ }
2714
+ return { kind: "inconclusive" };
2705
2715
  }
2706
2716
  }
2707
2717
  /**
@@ -2742,6 +2752,11 @@ function presentationsFor(spec, result) {
2742
2752
  kind: "summary",
2743
2753
  status: "info",
2744
2754
  text: ENVIRONMENT_CREDENTIAL_NOTICE
2755
+ }] : [],
2756
+ ...result.authenticated && !result.verified ? [{
2757
+ kind: "summary",
2758
+ status: "info",
2759
+ text: UNVERIFIED_CREDENTIAL_NOTICE
2745
2760
  }] : []
2746
2761
  ],
2747
2762
  stdout: () => rows.map((row) => `${row.label}: ${row.value}`),
@@ -2755,10 +2770,13 @@ const authWhoamiCommand = defineCommand({
2755
2770
  examples: ["auth whoami", "auth whoami --json"]
2756
2771
  },
2757
2772
  handler: async (_args, ctx) => {
2758
- const credential = await ctx.activeCredential();
2759
- const identity = credential === null ? null : mergedIdentity(credential.identity, await fetchedIdentity(ctx.api, ctx.signal));
2773
+ const active = await ctx.activeCredential();
2774
+ const lookup = active === null ? void 0 : await fetchedIdentity(ctx.api, ctx.signal);
2775
+ const credential = lookup?.kind === "signed-out" ? null : active;
2776
+ const identity = credential === null ? null : mergedIdentity(credential.identity, lookup?.kind === "confirmed" ? lookup.identity : void 0);
2760
2777
  const result = {
2761
2778
  authenticated: credential !== null,
2779
+ verified: credential !== null && lookup?.kind === "confirmed",
2762
2780
  workspace: credential === null || credential.workspaceId === void 0 ? null : {
2763
2781
  id: credential.workspaceId,
2764
2782
  name: credential.workspaceName ?? null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "8.0.0-rc.15-dev.110",
3
+ "version": "8.0.0-rc.15-dev.111",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@manypkg/tools": "^2.1.2",
43
43
  "@prisma/cli-engine": "0.5.0",
44
- "@prisma/composer-cli": "0.21.0-dev.1",
44
+ "@prisma/composer-cli": "0.21.0-dev.2",
45
45
  "@prisma/compute-sdk": "0.42.0",
46
46
  "@prisma/management-api-sdk": "1.69.0",
47
47
  "@prisma/orm-toolchain": "8.0.0-rc.11-dev.37",
@@ -53,11 +53,11 @@
53
53
  "open": "^11.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@prisma/composer": "0.21.0-dev.1",
56
+ "@prisma/composer": "0.21.0-dev.2",
57
57
  "@prisma/credentials-store": "^7.8.0",
58
- "@repo/cli-conformance": "8.0.0-rc.15-dev.110",
59
- "@repo/cli-telemetry": "8.0.0-rc.15-dev.110",
60
- "@repo/tsconfig": "8.0.0-rc.15-dev.110",
58
+ "@repo/cli-conformance": "8.0.0-rc.15-dev.111",
59
+ "@repo/cli-telemetry": "8.0.0-rc.15-dev.111",
60
+ "@repo/tsconfig": "8.0.0-rc.15-dev.111",
61
61
  "@types/node": "^22.19.19",
62
62
  "@types/cross-spawn": "^6.0.6",
63
63
  "tsdown": "^0.21.10",