@prisma/cli 3.0.0-dev.139.1 → 3.0.0-dev.140.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.
- package/dist/controllers/app-env.js +1 -1
- package/dist/controllers/app.js +5 -5
- package/dist/controllers/auth.js +1 -1
- package/dist/controllers/branch.js +1 -1
- package/dist/controllers/bucket.js +1 -1
- package/dist/controllers/build.js +1 -1
- package/dist/controllers/database.js +1 -1
- package/dist/controllers/project.js +3 -3
- package/dist/lib/auth/auth-ops.js +15 -2
- package/dist/lib/auth/login.js +1 -1
- package/dist/shell/command-runner.js +2 -1
- package/dist/shell/update-check.js +1 -1
- package/package.json +4 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CliError, authRequiredError, usageError, workspaceRequiredError } from "../shell/errors.js";
|
|
2
|
+
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
2
3
|
import { formatScopeLabel, parseKeyValuePositional, resolveEnvScope } from "../lib/app/env-config.js";
|
|
3
4
|
import { readEnvFileAssignments } from "../lib/app/env-file.js";
|
|
4
5
|
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
5
|
-
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
6
6
|
import { readLocalGitBranch } from "../lib/git/local-branch.js";
|
|
7
7
|
import { requireAuthenticatedAuthState } from "./auth.js";
|
|
8
8
|
import { listRealWorkspaceProjects } from "./project.js";
|
package/dist/controllers/app.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { formatCommandArgument } from "../shell/command-arguments.js";
|
|
2
2
|
import { CliError, authRequiredError, featureUnavailableError, usageError, workspaceRequiredError } from "../shell/errors.js";
|
|
3
3
|
import { renderCommandHeader } from "../shell/ui.js";
|
|
4
|
-
import { canPrompt } from "../shell/runtime.js";
|
|
5
|
-
import { writeJsonEvent } from "../shell/output.js";
|
|
6
4
|
import { SERVICE_TOKEN_ENV_VAR, getApiBaseUrl } from "../lib/auth/client.js";
|
|
7
5
|
import { FileTokenStorage } from "../adapters/token-storage.js";
|
|
6
|
+
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
7
|
+
import { readAuthState } from "../lib/auth/auth-ops.js";
|
|
8
|
+
import { canPrompt } from "../shell/runtime.js";
|
|
9
|
+
import { writeJsonEvent } from "../shell/output.js";
|
|
8
10
|
import { PRISMA_APP_CONFIG_FILENAME, detectLegacyBuildSettings, resolveConfiguredAppBuildSettings, resolveInferredAppBuildSettings } from "../lib/app/build-settings.js";
|
|
9
11
|
import { APP_BUILD_TYPES, APP_BUILD_TYPE_LABELS, RESOLVED_APP_BUILD_TYPES, executeAppBuild } from "../lib/app/build.js";
|
|
10
12
|
import { envVarNames, parseEnvInputs } from "../lib/app/env-vars.js";
|
|
@@ -23,8 +25,6 @@ import { formatDomainFailureFix } from "../lib/app/domain-guidance.js";
|
|
|
23
25
|
import { DEFAULT_LOCAL_DEV_PORT, runLocalApp } from "../lib/app/local-dev.js";
|
|
24
26
|
import { enforceProductionDeployGate } from "../lib/app/production-deploy-gate.js";
|
|
25
27
|
import { resolveReadBranch } from "../lib/app/read-branch.js";
|
|
26
|
-
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
27
|
-
import { readAuthState } from "../lib/auth/auth-ops.js";
|
|
28
28
|
import { readLocalGitBranch } from "../lib/git/local-branch.js";
|
|
29
29
|
import { promptForProjectSetupChoice } from "../lib/project/interactive-setup.js";
|
|
30
30
|
import { maybePromptForAgentSetup } from "./agent-setup.js";
|
|
@@ -34,9 +34,9 @@ import { listRealWorkspaceProjects } from "./project.js";
|
|
|
34
34
|
import path from "node:path";
|
|
35
35
|
import { access } from "node:fs/promises";
|
|
36
36
|
import { COMPUTE_REGIONS, ENTRYPOINT_BUILD_TYPES, FRAMEWORKS, LOCAL_DEV_BUILD_TYPES, frameworkByKey, frameworkFromAlias, isConfigBackedBuildType } from "@prisma/compute-sdk/config";
|
|
37
|
+
import open from "open";
|
|
37
38
|
import { detectComputeAppFromDirectory } from "@prisma/compute-sdk/config/directory";
|
|
38
39
|
import { Result, matchError } from "better-result";
|
|
39
|
-
import open from "open";
|
|
40
40
|
//#region src/controllers/app.ts
|
|
41
41
|
const FRAMEWORK_DEFAULT_HTTP_PORT = 3e3;
|
|
42
42
|
const PRISMA_PROJECT_ID_ENV_VAR = "PRISMA_PROJECT_ID";
|
package/dist/controllers/auth.js
CHANGED
|
@@ -2,10 +2,10 @@ import { resolvePrismaCliPackageCommand } from "../lib/agent/cli-command.js";
|
|
|
2
2
|
import { PRISMA_AGENT_INSTALL_ARGS } from "../lib/agent/constants.js";
|
|
3
3
|
import { isLikelyProjectDirectory, readPrismaAgentSetupStatus, resolvePrismaAgentSetupCwd, shouldOfferPrismaAgentSetup } from "../lib/agent/setup-status.js";
|
|
4
4
|
import { authRequiredError, usageError, workspaceAmbiguousError, workspaceNotAuthenticatedError, workspaceSwitchUnavailableError } from "../shell/errors.js";
|
|
5
|
-
import { canPrompt } from "../shell/runtime.js";
|
|
6
5
|
import { CLIENT_ID, SERVICE_TOKEN_ENV_VAR, getApiBaseUrl } from "../lib/auth/client.js";
|
|
7
6
|
import { FileTokenStorage, WorkspaceSelectionError } from "../adapters/token-storage.js";
|
|
8
7
|
import { performLogin, performLogout, readAuthState } from "../lib/auth/auth-ops.js";
|
|
8
|
+
import { canPrompt } from "../shell/runtime.js";
|
|
9
9
|
import { createAuthUseCases } from "../use-cases/auth.js";
|
|
10
10
|
import { createCliUseCaseGateways } from "../use-cases/create-cli-gateways.js";
|
|
11
11
|
import { createSelectPromptPort } from "./select-prompt-port.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliError, authRequiredError, workspaceRequiredError } from "../shell/errors.js";
|
|
2
|
-
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
3
2
|
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
3
|
+
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
4
4
|
import { createCliUseCaseGateways } from "../use-cases/create-cli-gateways.js";
|
|
5
5
|
import { requireAuthenticatedAuthState } from "./auth.js";
|
|
6
6
|
import { listRealWorkspaceProjects } from "./project.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliError, authRequiredError, workspaceRequiredError } from "../shell/errors.js";
|
|
2
|
-
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
3
2
|
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
3
|
+
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
4
4
|
import { requireAuthenticatedAuthState } from "./auth.js";
|
|
5
5
|
import { listFixtureWorkspaceProjects, listRealWorkspaceProjects } from "./project.js";
|
|
6
6
|
import { createManagementBucketProvider, normalizeBucket, normalizeKey } from "../lib/bucket/provider.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliError, authRequiredError } from "../shell/errors.js";
|
|
2
|
-
import { writeJsonEvent } from "../shell/output.js";
|
|
3
2
|
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
3
|
+
import { writeJsonEvent } from "../shell/output.js";
|
|
4
4
|
//#region src/controllers/build.ts
|
|
5
5
|
async function runBuildLogs(context, buildId, options = {}) {
|
|
6
6
|
const client = await requireComputeAuth(context.runtime.env, context.runtime.signal);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolvePrismaCliPackageCommandFormatterSync } from "../lib/agent/cli-command.js";
|
|
2
2
|
import { CliError, authRequiredError, usageError, workspaceRequiredError } from "../shell/errors.js";
|
|
3
|
-
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
4
3
|
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
4
|
+
import { projectResolutionErrorToCliError, resolveProjectTarget } from "../lib/project/resolution.js";
|
|
5
5
|
import { requireAuthenticatedAuthState } from "./auth.js";
|
|
6
6
|
import { listFixtureWorkspaceProjects, listRealWorkspaceProjects } from "./project.js";
|
|
7
7
|
import { createManagementDatabaseProvider, normalizeConnection, normalizeDatabase } from "../lib/database/provider.js";
|
|
@@ -2,14 +2,14 @@ import { resolvePrismaCliPackageCommandFormatterSync } from "../lib/agent/cli-co
|
|
|
2
2
|
import { formatCommandArgument } from "../shell/command-arguments.js";
|
|
3
3
|
import { CliError, authRequiredError, featureUnavailableError, usageError, workspaceAmbiguousError, workspaceNotAuthenticatedError, workspaceRequiredError } from "../shell/errors.js";
|
|
4
4
|
import { renderSummaryLine } from "../shell/ui.js";
|
|
5
|
-
import { canPrompt } from "../shell/runtime.js";
|
|
6
5
|
import { SERVICE_TOKEN_ENV_VAR } from "../lib/auth/client.js";
|
|
7
6
|
import { WorkspaceSelectionError } from "../adapters/token-storage.js";
|
|
7
|
+
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
8
|
+
import { canPrompt } from "../shell/runtime.js";
|
|
8
9
|
import { createAppProvider } from "../lib/app/app-provider.js";
|
|
9
10
|
import { LOCAL_RESOLUTION_PIN_RELATIVE_PATH, readLocalResolutionPin, writeLocalResolutionPin } from "../lib/project/local-pin.js";
|
|
10
11
|
import { buildProjectSetupNextActions, inferTargetName, inspectProjectBinding, projectResolutionErrorToCliError, resolveProjectTarget, sortProjects } from "../lib/project/resolution.js";
|
|
11
12
|
import { bindProjectToDirectory, isValidProjectSetupName, projectCreateFailedError, projectDirectoryBindingErrorToCliError, projectSetupNameRequiredError, resolveProjectForSetup, toProjectSummary } from "../lib/project/setup.js";
|
|
12
|
-
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
13
13
|
import { promptForProjectSetupChoice } from "../lib/project/interactive-setup.js";
|
|
14
14
|
import { createCliUseCaseGateways } from "../use-cases/create-cli-gateways.js";
|
|
15
15
|
import { requireAuthenticatedAuthState } from "./auth.js";
|
|
@@ -19,8 +19,8 @@ import { createManagementProjectProvider, projectRemoveBlockedError, projectRena
|
|
|
19
19
|
import { createProjectUseCases } from "../use-cases/project.js";
|
|
20
20
|
import path from "node:path";
|
|
21
21
|
import { unlink } from "node:fs/promises";
|
|
22
|
-
import { matchError } from "better-result";
|
|
23
22
|
import open from "open";
|
|
23
|
+
import { matchError } from "better-result";
|
|
24
24
|
//#region src/controllers/project.ts
|
|
25
25
|
const GITHUB_INSTALL_POLL_INTERVAL_MS = 2e3;
|
|
26
26
|
const GITHUB_INSTALL_POLL_TIMEOUT_MS = 12e4;
|
|
@@ -4,6 +4,19 @@ import { requireComputeAuth } from "./guard.js";
|
|
|
4
4
|
import { login } from "./login.js";
|
|
5
5
|
//#region src/lib/auth/auth-ops.ts
|
|
6
6
|
const WORKSPACE_SUB_PREFIX = "workspace:";
|
|
7
|
+
/** Thrown when PRISMA_SERVICE_TOKEN is set to an empty/blank value. */
|
|
8
|
+
var EmptyServiceTokenError = class extends Error {
|
|
9
|
+
code = "EMPTY_SERVICE_TOKEN";
|
|
10
|
+
constructor() {
|
|
11
|
+
super(`${SERVICE_TOKEN_ENV_VAR} is set but empty. Provide a valid token or unset the variable.`);
|
|
12
|
+
this.name = "EmptyServiceTokenError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/** Matches by the code discriminator, not instanceof, so the check
|
|
16
|
+
* survives duplicate module instances. */
|
|
17
|
+
function isEmptyServiceTokenError(error) {
|
|
18
|
+
return typeof error === "object" && error !== null && error.code === "EMPTY_SERVICE_TOKEN";
|
|
19
|
+
}
|
|
7
20
|
function decodeJwtPayload(token) {
|
|
8
21
|
try {
|
|
9
22
|
const payload = token.split(".")[1];
|
|
@@ -35,7 +48,7 @@ async function readAuthState(env, signal) {
|
|
|
35
48
|
const rawServiceToken = env[SERVICE_TOKEN_ENV_VAR];
|
|
36
49
|
if (rawServiceToken !== void 0) {
|
|
37
50
|
const serviceToken = rawServiceToken.trim();
|
|
38
|
-
if (serviceToken.length === 0) throw new
|
|
51
|
+
if (serviceToken.length === 0) throw new EmptyServiceTokenError();
|
|
39
52
|
return readServiceTokenAuthState(serviceToken, env, signal);
|
|
40
53
|
}
|
|
41
54
|
const tokenStorage = new FileTokenStorage(env, signal);
|
|
@@ -155,4 +168,4 @@ async function performLogout(env, signal) {
|
|
|
155
168
|
await new FileTokenStorage(env, signal).clearTokens();
|
|
156
169
|
}
|
|
157
170
|
//#endregion
|
|
158
|
-
export { performLogin, performLogout, readAuthState };
|
|
171
|
+
export { isEmptyServiceTokenError, performLogin, performLogout, readAuthState };
|
package/dist/lib/auth/login.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getApiBaseUrl } from "./client.js";
|
|
2
2
|
import { FileTokenStorage } from "../../adapters/token-storage.js";
|
|
3
3
|
import { AuthError, createManagementApiSdk } from "@prisma/management-api-sdk";
|
|
4
|
-
import open from "open";
|
|
5
4
|
import events from "node:events";
|
|
6
5
|
import http from "node:http";
|
|
7
6
|
import readline from "node:readline/promises";
|
|
7
|
+
import open from "open";
|
|
8
8
|
//#region src/lib/auth/login.ts
|
|
9
9
|
var AuthError$1 = class extends Error {
|
|
10
10
|
constructor(message) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CliError, authConfigInvalidError, authRequiredError, commandCanceledError } from "./errors.js";
|
|
2
2
|
import { getCommandDescriptor } from "./command-meta.js";
|
|
3
3
|
import { renderSummaryLine } from "./ui.js";
|
|
4
|
+
import { isEmptyServiceTokenError } from "../lib/auth/auth-ops.js";
|
|
4
5
|
import { resolveGlobalFlags } from "./global-flags.js";
|
|
5
6
|
import { createCommandContext } from "./runtime.js";
|
|
6
7
|
import { collectCommandDiagnostics } from "../lib/diagnostics.js";
|
|
@@ -12,7 +13,7 @@ function toCliError(error, runtime) {
|
|
|
12
13
|
if (isCancellationError(error) || runtime.signal.aborted) return commandCanceledError();
|
|
13
14
|
if (error instanceof CliError) return error;
|
|
14
15
|
if (error instanceof AuthError) return authRequiredError(["prisma-cli auth login"], { debug: error.message });
|
|
15
|
-
if (error
|
|
16
|
+
if (isEmptyServiceTokenError(error)) return authConfigInvalidError(error.message);
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
19
|
function isCancellationError(error) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getCliName, getCliVersion } from "../lib/version.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
4
|
-
import { spawn } from "node:child_process";
|
|
5
4
|
import { randomUUID } from "node:crypto";
|
|
6
5
|
import os from "node:os";
|
|
6
|
+
import { spawn } from "node:child_process";
|
|
7
7
|
//#region src/shell/update-check.ts
|
|
8
8
|
const UPDATE_CHECK_FILE_NAME = "update-check.json";
|
|
9
9
|
const FALLBACK_INSTALL_DOCS_URL = "https://www.prisma.io/docs/orm/tools/prisma-cli";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.140.1",
|
|
4
4
|
"description": "Command-line interface for the Prisma Developer Platform.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsdown",
|
|
42
42
|
"prepack": "pnpm run build",
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
43
44
|
"test": "vitest run"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
@@ -59,6 +60,8 @@
|
|
|
59
60
|
"wrap-ansi": "^10.0.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
63
|
+
"@prisma/cli-engine": "workspace:*",
|
|
64
|
+
"@repo/tsconfig": "workspace:*",
|
|
62
65
|
"@types/node": "^22.19.19",
|
|
63
66
|
"tsdown": "^0.21.10",
|
|
64
67
|
"tsx": "^4.22.4",
|