@prisma/cli-engine 0.10.1 → 0.10.3
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/README.md
CHANGED
|
@@ -66,7 +66,7 @@ Each occurrence of `--<verb>` takes exactly `arity` values, in argv order across
|
|
|
66
66
|
The engine answers the question in this order:
|
|
67
67
|
|
|
68
68
|
1. A verb flag whose first value names the subject: the value is the subject, or starts with `<subject>:`. `--delete Legacy` and `--rename Legacy:Archive` both name `Legacy`. Within one batch, a value equal to a subject answers that subject first, and any other value goes to the longest subject it names, so `--delete A:B` answers the question about `A:B`, not the one about `A`. Ask questions whose subjects are prefixes of one another in one batch. A value `validate` rejects fails the run with `CLI.PROMPT_INVALID`.
|
|
69
|
-
2. With no such value, a non-interactive run, or one under `--yes`, fails with `CLI.CONSENT_REQUIRED`.
|
|
69
|
+
2. With no such value, a non-interactive run, or one under `--yes`, fails with `CLI.CONSENT_REQUIRED`. Its next actions give one flag to pass per verb, safe to paste into a shell: a value with anything but plain characters is single-quoted, and a value starting with `-` is written `--<verb>=<value>`, and its `meta` carries `subject`, `verbs` and `unanswered`.
|
|
70
70
|
3. Otherwise the user is asked, and answers `<verb> <text>`, or `<verb>` alone to mean the subject. A verb with an arity above 1 takes its values from the text, separated by whitespace, and `text` is them joined by one space, as for a flag. A rejected answer is asked again on a terminal; with scripted or piped input it fails with `CLI.PROMPT_INVALID`.
|
|
71
71
|
|
|
72
72
|
`ctx.prompt.statements([...])` asks several questions at once and returns the answers in order. Flags answer what they can, a refusal lists every question still unanswered, and an interactive run asks the rest one after another.
|
|
@@ -4120,14 +4120,11 @@ function answerFromFlags(state, question, fits) {
|
|
|
4120
4120
|
/** Why a refusal could not be answered from the command line: the
|
|
4121
4121
|
* statement values that name none of the batch's subjects, and any
|
|
4122
4122
|
* `--confirm` value, which answers no statement. */
|
|
4123
|
-
function strayFlagLines(state, subjects
|
|
4124
|
-
return [...state.statementValues.filter((value) => !value.consumed && longestSubjectNamed(value.values[0], subjects) === void 0).map((value) => `${flagForm(value.verb, value.values)}
|
|
4123
|
+
function strayFlagLines(state, subjects) {
|
|
4124
|
+
return [...state.statementValues.filter((value) => !value.consumed && longestSubjectNamed(value.values[0], subjects) === void 0).map((value) => `${flagForm(value.verb, value.values)} answers no question; the questions are about ${subjects.join(", ")}.`), ...state.confirmValues.map((token) => `${flagForm("confirm", [token])} answers no consent in this run; a statement flag is what answers these questions.`)];
|
|
4125
4125
|
}
|
|
4126
4126
|
function statementUnavailable(unanswered, subjects, state) {
|
|
4127
|
-
const
|
|
4128
|
-
const [only, ...others] = unanswered;
|
|
4129
|
-
const alone = others.length === 0;
|
|
4130
|
-
const summary = alone ? only.question : `${unanswered.length} choices are needed, and ${situation}.`;
|
|
4127
|
+
const summary = consentMissing(state);
|
|
4131
4128
|
const listed = unanswered.map(({ subject, verbs }) => ({
|
|
4132
4129
|
subject,
|
|
4133
4130
|
verbs
|
|
@@ -4137,7 +4134,7 @@ function statementUnavailable(unanswered, subjects, state) {
|
|
|
4137
4134
|
values
|
|
4138
4135
|
}));
|
|
4139
4136
|
return new CliStructuredError("CLI.CONSENT_REQUIRED", summary, {
|
|
4140
|
-
why: [...
|
|
4137
|
+
why: [...unanswered.map((question) => question.question), ...strayFlagLines(state, subjects)].join("\n"),
|
|
4141
4138
|
nextActions: unanswered.flatMap((question) => question.verbs.map((verb) => ({
|
|
4142
4139
|
kind: "user-choice",
|
|
4143
4140
|
label: `Run the command again with ${flagForm(verb, [question.forms?.[verb] ?? question.subject])}`
|
|
@@ -4283,13 +4280,19 @@ function answerWithoutAsking(question, fallback, state) {
|
|
|
4283
4280
|
if (fallback === void 0) throw promptUnanswerable(question, state);
|
|
4284
4281
|
return fallback;
|
|
4285
4282
|
}
|
|
4283
|
+
function consentMissing(state) {
|
|
4284
|
+
return state.yes ? "This command requires explicit consent, and --yes does not give it." : "This command requires explicit consent, but it was not provided.";
|
|
4285
|
+
}
|
|
4286
4286
|
function consentUnavailable(question, state, token) {
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4287
|
+
if (token === void 0) return new CliStructuredError("CLI.CONSENT_REQUIRED", consentMissing(state), {
|
|
4288
|
+
why: question,
|
|
4289
|
+
nextActions: [{
|
|
4290
|
+
kind: "user-choice",
|
|
4291
|
+
label: "Run the command interactively. Consent can only be granted outside an interactive terminal when the command declares a consent token."
|
|
4292
|
+
}]
|
|
4293
|
+
});
|
|
4294
|
+
return new CliStructuredError("CLI.CONSENT_REQUIRED", consentMissing(state), {
|
|
4295
|
+
why: question,
|
|
4293
4296
|
nextActions: [{
|
|
4294
4297
|
kind: "user-choice",
|
|
4295
4298
|
label: `Run the command interactively and type ${token}, or pass --confirm ${token}.`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SectionValidation, $t as ManagementApiClient, A as StatementAnswer, At as PackageManagerRunRequest, B as PresentedResult, Bt as flag, C as defineServerCommand, Ct as ExitWithChildStatusOptions, D as OpenUrlOutcome, Dt as SpawnedChild, E as CommandContext, Et as SpawnRequest, F as Block, Ft as ArgsSpec, G as TreeNode, Gt as CredentialIdentity, H as Status, Ht as ActiveAccessTokenOptions, I as Format, It as Char, J as EngineEvent, Jt as SERVICE_TOKEN_ENV_VAR, K as Ui, Kt as CredentialManager, L as Outcome, Lt as CommandArgs, M as StatementQuestion, Mt as PackageManagerRunner, N as StatementSurface, Nt as PackageOperations, O as OpenUrlRequest, Ot as exitWithChildStatus, P as StatementsOptions, Pt as Args, Q as ConfigSection, Qt as CredentialRefresher, R as PRESENTED, Rt as FlagSpec, S as defineCommand, St as ChildStatusSettlement, T as BrowserWaitRequest, Tt as SpawnOptions, U as Text, Ut as ActiveCredential, V as Span, Vt as positional, W as Tone, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Y as Severity, Yt as Session, Z as StreamMeta, Zt as CredentialRefreshResult, _ as ServerCommandDefinition, _t as Runtime, a as RedirectSpec, at as validateSectionWithSchema, b as StatementSpec, bt as RunSummary, c as CommandDefinition, ct as resolveSectionOverChain, d as CommandNeeds, dt as HostProcess, en as ManagementApiClientConfig, et as defineConfigSection, f as CompletedEnvelope, ft as InputStream, g as NeedsSpec, gt as PRISMA_CONFIG_VERSION, h as HelpSpec, ht as OutputStream, i as MountedTree, it as reference, j as StatementOptions, jt as PackageManagerRunResult, k as PromptSurface, kt as PackageManagerId, l as CommandHandler, lt as resolveSectionPath, m as Handler, mt as LoadedConfigFile, n as CommandFamily, nt as ConfigSchemaValue, o as defineCommandFamily, ot as ResolvedSection, p as ErroredEnvelope, pt as LoadedConfig, q as noDataLines, qt as CredentialOrigin, r as CommandRedirect, rt as configSchema, s as AnyCommand, st as SectionProvenance, t as TelemetryDeclaration, tn as TokenStorage, tt as ConfigSchema, u as CommandHelp, ut as Host, v as SessionCommandDefinition, vt as TelemetryPayload, w as defineSessionCommand, wt as SpawnChild, x as WorkflowStep, xt as ChildResult, y as SpawnDeclarations, yt as EngineCommandSnapshot, z as Presentations, zt as PositionalSpec } from "./report-
|
|
1
|
+
import { $ as SectionValidation, $t as ManagementApiClient, A as StatementAnswer, At as PackageManagerRunRequest, B as PresentedResult, Bt as flag, C as defineServerCommand, Ct as ExitWithChildStatusOptions, D as OpenUrlOutcome, Dt as SpawnedChild, E as CommandContext, Et as SpawnRequest, F as Block, Ft as ArgsSpec, G as TreeNode, Gt as CredentialIdentity, H as Status, Ht as ActiveAccessTokenOptions, I as Format, It as Char, J as EngineEvent, Jt as SERVICE_TOKEN_ENV_VAR, K as Ui, Kt as CredentialManager, L as Outcome, Lt as CommandArgs, M as StatementQuestion, Mt as PackageManagerRunner, N as StatementSurface, Nt as PackageOperations, O as OpenUrlRequest, Ot as exitWithChildStatus, P as StatementsOptions, Pt as Args, Q as ConfigSection, Qt as CredentialRefresher, R as PRESENTED, Rt as FlagSpec, S as defineCommand, St as ChildStatusSettlement, T as BrowserWaitRequest, Tt as SpawnOptions, U as Text, Ut as ActiveCredential, V as Span, Vt as positional, W as Tone, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Y as Severity, Yt as Session, Z as StreamMeta, Zt as CredentialRefreshResult, _ as ServerCommandDefinition, _t as Runtime, a as RedirectSpec, at as validateSectionWithSchema, b as StatementSpec, bt as RunSummary, c as CommandDefinition, ct as resolveSectionOverChain, d as CommandNeeds, dt as HostProcess, en as ManagementApiClientConfig, et as defineConfigSection, f as CompletedEnvelope, ft as InputStream, g as NeedsSpec, gt as PRISMA_CONFIG_VERSION, h as HelpSpec, ht as OutputStream, i as MountedTree, it as reference, j as StatementOptions, jt as PackageManagerRunResult, k as PromptSurface, kt as PackageManagerId, l as CommandHandler, lt as resolveSectionPath, m as Handler, mt as LoadedConfigFile, n as CommandFamily, nt as ConfigSchemaValue, o as defineCommandFamily, ot as ResolvedSection, p as ErroredEnvelope, pt as LoadedConfig, q as noDataLines, qt as CredentialOrigin, r as CommandRedirect, rt as configSchema, s as AnyCommand, st as SectionProvenance, t as TelemetryDeclaration, tn as TokenStorage, tt as ConfigSchema, u as CommandHelp, ut as Host, v as SessionCommandDefinition, vt as TelemetryPayload, w as defineSessionCommand, wt as SpawnChild, x as WorkflowStep, xt as ChildResult, y as SpawnDeclarations, yt as EngineCommandSnapshot, z as Presentations, zt as PositionalSpec } from "./report-JfFs29QS.js";
|
|
2
2
|
import { n as CliStructuredError } from "./protocol-YjqPCCOG.js";
|
|
3
3
|
|
|
4
4
|
//#region src/active-access-token.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as ok, r as notOk, t as CliStructuredError } from "./protocol-TtNVkeVS.js";
|
|
2
|
-
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, E as credentialRejectedError, O as credentialsRequiredError, S as claimedExpiresAt, T as authServiceError, _ as exitWithChildStatus, a as definePrismaConfig, b as positional, c as PRISMA_CONFIG_VERSION, d as PRESENTED, f as noDataLines, g as resolveGating, h as writeUserConfig, k as emptyServiceTokenError, l as SERVICE_TOKEN_ENV_VAR, m as userConfigPath, n as resolveSectionOverChain, o as loadConfig, p as readUserConfig, r as resolveSectionPath, s as realpathOr, t as buildEngine, u as WORKSPACE_ID_ENV_VAR, v as detectCI, w as credentialWorkspaceId, x as readActiveAccessToken, y as flag } from "./engine-
|
|
2
|
+
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, E as credentialRejectedError, O as credentialsRequiredError, S as claimedExpiresAt, T as authServiceError, _ as exitWithChildStatus, a as definePrismaConfig, b as positional, c as PRISMA_CONFIG_VERSION, d as PRESENTED, f as noDataLines, g as resolveGating, h as writeUserConfig, k as emptyServiceTokenError, l as SERVICE_TOKEN_ENV_VAR, m as userConfigPath, n as resolveSectionOverChain, o as loadConfig, p as readUserConfig, r as resolveSectionPath, s as realpathOr, t as buildEngine, u as WORKSPACE_ID_ENV_VAR, v as detectCI, w as credentialWorkspaceId, x as readActiveAccessToken, y as flag } from "./engine-B_zpKAJ3.js";
|
|
3
3
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
4
|
import { scope, type } from "arktype";
|
|
5
5
|
//#region src/cli.ts
|
|
@@ -1358,8 +1358,6 @@ interface StatementOptions<V extends string> {
|
|
|
1358
1358
|
readonly validate: (verb: V, text: string) => string | undefined;
|
|
1359
1359
|
}
|
|
1360
1360
|
interface StatementQuestion<V extends string> extends StatementOptions<V> {
|
|
1361
|
-
/** Shown as the prompt, and as the first line of the error when it is
|
|
1362
|
-
* the only question nobody can answer. Name what it is about. */
|
|
1363
1361
|
readonly question: string;
|
|
1364
1362
|
}
|
|
1365
1363
|
interface StatementAnswer<V extends string> {
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as ManagementApiClient, B as PresentedResult, Et as SpawnRequest, Ht as ActiveAccessTokenOptions, J as EngineEvent, Kt as CredentialManager, Mt as PackageManagerRunner, Qt as CredentialRefresher, Ut as ActiveCredential, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Yt as Session, _t as Runtime, bt as RunSummary, en as ManagementApiClientConfig, i as MountedTree, kt as PackageManagerId, n as CommandFamily, t as TelemetryDeclaration, tn as TokenStorage, ut as Host, vt as TelemetryPayload, wt as SpawnChild, x as WorkflowStep, xt as ChildResult } from "./report-
|
|
1
|
+
import { $t as ManagementApiClient, B as PresentedResult, Et as SpawnRequest, Ht as ActiveAccessTokenOptions, J as EngineEvent, Kt as CredentialManager, Mt as PackageManagerRunner, Qt as CredentialRefresher, Ut as ActiveCredential, Wt as Credential, X as StreamEvent, Xt as StoredSessions, Yt as Session, _t as Runtime, bt as RunSummary, en as ManagementApiClientConfig, i as MountedTree, kt as PackageManagerId, n as CommandFamily, t as TelemetryDeclaration, tn as TokenStorage, ut as Host, vt as TelemetryPayload, wt as SpawnChild, x as WorkflowStep, xt as ChildResult } from "./report-JfFs29QS.js";
|
|
2
2
|
|
|
3
3
|
//#region src/in-memory-credential-manager.d.ts
|
|
4
4
|
/** A stored session with its credential material — what the manager
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, O as credentialsRequiredError, S as claimedExpiresAt, t as buildEngine, w as credentialWorkspaceId, x as readActiveAccessToken } from "./engine-
|
|
1
|
+
import { A as noSessionForWorkspaceError, C as claimedIdentity, D as credentialWorkspaceMismatchError, O as credentialsRequiredError, S as claimedExpiresAt, t as buildEngine, w as credentialWorkspaceId, x as readActiveAccessToken } from "./engine-B_zpKAJ3.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
//#region src/in-memory-credential-manager.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli-engine",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "The execution engine of the unified Prisma CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@prisma/management-api-sdk": "1.80.0",
|
|
56
|
-
"@repo/cli-conformance": "8.0.0-rc.34-dev.
|
|
57
|
-
"@repo/tsconfig": "8.0.0-rc.34-dev.
|
|
56
|
+
"@repo/cli-conformance": "8.0.0-rc.34-dev.193",
|
|
57
|
+
"@repo/tsconfig": "8.0.0-rc.34-dev.193",
|
|
58
58
|
"@types/node": "^22.19.19",
|
|
59
59
|
"ci-info": "^4.3.1",
|
|
60
60
|
"tsdown": "^0.21.10",
|