@prisma/cli-engine 0.5.0 → 0.6.0
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/index.d.ts +2 -2
- package/dist/index.js +170 -2
- package/dist/{report-CCIboNYr.d.ts → report-BWFp3piG.d.ts} +66 -3
- package/dist/testing.d.ts +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as SectionProvenance, A as Format, At as FlagSpec, B as Ui, Bt as SERVICE_TOKEN_ENV_VAR, C as defineSessionCommand, Ct as PackageManagerRunResult, D as OpenUrlRequest, Dt as ArgsSpec, E as OpenUrlOutcome, Et as Args, F as Span, Ft as ActiveCredential, G as ConfigSection, Gt as ManagementApiClient, H as Severity, Ht as StoredSessions, I as Status, It as Credential, J as ConfigSchema, K as SectionValidation, Kt as ManagementApiClientConfig, L as Text, Lt as CredentialIdentity, M as PRESENTED, Mt as flag, N as Presentations, Nt as positional, O as PromptSurface, Ot as Char, P as PresentedResult, Pt as ActiveAccessTokenOptions, Q as ResolvedSection, R as Tone, Rt as CredentialManager, S as defineServerCommand, St as PackageManagerRunRequest, T as CommandContext, Tt as PackageOperations, U as StreamEvent, Ut as CredentialRefreshResult, V as EngineEvent, Vt as Session, W as StreamMeta, Wt as CredentialRefresher, X as configSchema, Y as ConfigSchemaValue, Z as validateSectionWithSchema, _ as ServerCommandDefinition, _t as SpawnOptions, a as RedirectSpec, at as LoadedConfig, b as WorkflowStep, bt as exitWithChildStatus, c as CommandDefinition, ct as PRISMA_CONFIG_VERSION, d as CommandNeeds, dt as EngineCommandSnapshot, et as resolveSectionOverChain, f as CompletedEnvelope, ft as RunSummary, g as NeedsSpec, gt as SpawnChild, h as HelpSpec, ht as ExitWithChildStatusOptions, i as MountedTree, it as InputStream, j as Outcome, jt as PositionalSpec, k as Block, kt as CommandArgs, l as CommandHandler, lt as Runtime, m as Handler, mt as ChildStatusSettlement, n as CommandFamily, nt as Host, o as defineCommandFamily, ot as LoadedConfigFile, p as ErroredEnvelope, pt as ChildResult, q as defineConfigSection, qt as TokenStorage, r as CommandRedirect, rt as HostProcess, s as AnyCommand, st as OutputStream, t as TelemetryDeclaration, tt as resolveSectionPath, u as CommandHelp, ut as TelemetryPayload, v as SessionCommandDefinition, vt as SpawnRequest, w as BrowserWaitRequest, wt as PackageManagerRunner, x as defineCommand, xt as PackageManagerId, y as SpawnDeclarations, yt as SpawnedChild, z as TreeNode, zt as CredentialOrigin } from "./report-BWFp3piG.js";
|
|
2
2
|
import { n as CliStructuredError } from "./protocol-YjqPCCOG.js";
|
|
3
3
|
|
|
4
4
|
//#region src/active-access-token.d.ts
|
|
@@ -225,4 +225,4 @@ declare function claimedExpiresAt(token: string): Date | undefined;
|
|
|
225
225
|
*/
|
|
226
226
|
declare function claimedIdentity(token: string): CredentialIdentity | undefined;
|
|
227
227
|
//#endregion
|
|
228
|
-
export { type ActiveAccessTokenOptions, type ActiveCredential, type AnyCommand, type Args, type ArgsSpec, type Block, type BrowserWaitRequest, type Char, type ChildResult, type ChildStatusSettlement, type Cli, type CliRunHooks, type CommandArgs, type CommandContext, type CommandDefinition, type CommandFamily, type CommandHandler, type CommandHelp, type CommandNeeds, type CommandRedirect, type CompletedEnvelope, type ConfigSection, type Credential, type CredentialIdentity, type CredentialManager, type CredentialOrigin, type CredentialRefreshResult, type CredentialRefresher, type CredentialsRequiredReason, type EngineCommandSnapshot, type EngineEvent, EnvironmentCredentialManager, type ErroredEnvelope, type ExitWithChildStatusOptions, type FlagSpec, type Format, type Handler, type HelpSpec, type Host, type HostProcess, type InputStream, type LoadedConfig, type LoadedConfigFile, type ManagementApiClient, type ManagementApiClientConfig, type MountedTree, type NeedsSpec, type OpenUrlOutcome, type OpenUrlRequest, type Outcome, type OutputStream, PRESENTED, PRISMA_CONFIG_VERSION, type PackageManagerId, type PackageManagerRunRequest, type PackageManagerRunResult, type PackageManagerRunner, type PackageOperations, type PositionalSpec, type Presentations, type PresentedResult, type PromptSurface, type RedirectSpec, type ResolvedSection, type RunSummary, type Runtime, SERVICE_TOKEN_ENV_VAR, type SectionProvenance, type SectionValidation, type ServerCommandDefinition, type Session, type SessionCommandDefinition, type Severity, type Span, type SpawnChild, type SpawnDeclarations, type SpawnOptions, type SpawnRequest, type SpawnedChild, type Status, type StoredSessions, type StreamEvent, type StreamMeta, type TelemetryDeclaration, type TelemetryPayload, type TelemetryStatus, type TelemetryStatusReason, type Text, type TokenStorage, type Tone, type TreeNode, type Ui, type WorkflowStep, authServiceError, claimedExpiresAt, claimedIdentity, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup };
|
|
228
|
+
export { type ActiveAccessTokenOptions, type ActiveCredential, type AnyCommand, type Args, type ArgsSpec, type Block, type BrowserWaitRequest, type Char, type ChildResult, type ChildStatusSettlement, type Cli, type CliRunHooks, type CommandArgs, type CommandContext, type CommandDefinition, type CommandFamily, type CommandHandler, type CommandHelp, type CommandNeeds, type CommandRedirect, type CompletedEnvelope, type ConfigSchema, type ConfigSchemaValue, type ConfigSection, type Credential, type CredentialIdentity, type CredentialManager, type CredentialOrigin, type CredentialRefreshResult, type CredentialRefresher, type CredentialsRequiredReason, type EngineCommandSnapshot, type EngineEvent, EnvironmentCredentialManager, type ErroredEnvelope, type ExitWithChildStatusOptions, type FlagSpec, type Format, type Handler, type HelpSpec, type Host, type HostProcess, type InputStream, type LoadedConfig, type LoadedConfigFile, type ManagementApiClient, type ManagementApiClientConfig, type MountedTree, type NeedsSpec, type OpenUrlOutcome, type OpenUrlRequest, type Outcome, type OutputStream, PRESENTED, PRISMA_CONFIG_VERSION, type PackageManagerId, type PackageManagerRunRequest, type PackageManagerRunResult, type PackageManagerRunner, type PackageOperations, type PositionalSpec, type Presentations, type PresentedResult, type PromptSurface, type RedirectSpec, type ResolvedSection, type RunSummary, type Runtime, SERVICE_TOKEN_ENV_VAR, type SectionProvenance, type SectionValidation, type ServerCommandDefinition, type Session, type SessionCommandDefinition, type Severity, type Span, type SpawnChild, type SpawnDeclarations, type SpawnOptions, type SpawnRequest, type SpawnedChild, type Status, type StoredSessions, type StreamEvent, type StreamMeta, type TelemetryDeclaration, type TelemetryPayload, type TelemetryStatus, type TelemetryStatusReason, type Text, type TokenStorage, type Tone, type TreeNode, type Ui, type WorkflowStep, authServiceError, claimedExpiresAt, claimedIdentity, configSchema, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup, validateSectionWithSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { i as ok, r as notOk, t as CliStructuredError } from "./protocol-TtNVkeVS.js";
|
|
2
2
|
import { C as credentialWorkspaceId, D as credentialsRequiredError, E as credentialWorkspaceMismatchError, O as emptyServiceTokenError, S as claimedIdentity, T as credentialRejectedError, _ as detectCI, a as definePrismaConfig, b as readActiveAccessToken, c as PRISMA_CONFIG_VERSION, d as PRESENTED, f as readUserConfig, g as exitWithChildStatus, h as resolveGating, k as noSessionForWorkspaceError, l as SERVICE_TOKEN_ENV_VAR, m as writeUserConfig, n as resolveSectionOverChain, o as loadConfig, p as userConfigPath, r as resolveSectionPath, s as realpathOr, t as buildEngine, u as WORKSPACE_ID_ENV_VAR, v as flag, w as authServiceError, x as claimedExpiresAt, y as positional } from "./engine-DaES-DtJ.js";
|
|
3
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
|
+
import { scope, type } from "arktype";
|
|
3
5
|
//#region src/cli.ts
|
|
4
6
|
/**
|
|
5
7
|
* Shell-side construction. Group help is declared with the mount.
|
|
@@ -91,11 +93,177 @@ function defineServerCommand(def) {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
//#endregion
|
|
96
|
+
//#region src/config-schema.ts
|
|
97
|
+
/**
|
|
98
|
+
* The provenance of the section being validated, published for the
|
|
99
|
+
* duration of one synchronous schema run so the `path` keyword can
|
|
100
|
+
* resolve each value against the file that declared its top-level key.
|
|
101
|
+
*/
|
|
102
|
+
let current;
|
|
103
|
+
/** The file that declared the top-level key a value sits under, else the nearest file. */
|
|
104
|
+
function declaringFile(provenance, path) {
|
|
105
|
+
const top = path[0];
|
|
106
|
+
return (typeof top === "string" ? provenance.keys[top] : void 0) ?? provenance.files[0];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A `path` value reaches this morph in two situations. During a section
|
|
110
|
+
* validation `current` names the provenance and the value resolves
|
|
111
|
+
* against the file that declared its top-level key. Outside one, arktype
|
|
112
|
+
* is evaluating a literal default while the schema is defined; a relative
|
|
113
|
+
* literal would be stored already resolved against nothing, so it is
|
|
114
|
+
* refused with the thunk form, which arktype evaluates and morphs at
|
|
115
|
+
* application time instead.
|
|
116
|
+
*/
|
|
117
|
+
function resolvePathValue(value, path) {
|
|
118
|
+
if (isAbsolute(value)) return value;
|
|
119
|
+
if (current === void 0) throw new Error(`@prisma/cli-engine: the relative 'path' default '${value}' must be declared as a thunk, ["path", "=", () => "..."], so it resolves against the config file when the default is applied`);
|
|
120
|
+
const file = declaringFile(current.provenance, path);
|
|
121
|
+
return file === void 0 ? value : resolve(dirname(file), value);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Declares the shape of a config section once. Definitions are arktype
|
|
125
|
+
* definitions with one extra keyword, `path`, for a field holding a path
|
|
126
|
+
* relative to the config file. The declaration drives validation, the
|
|
127
|
+
* diagnostics that name the field and the file to fix, and path
|
|
128
|
+
* resolution; nothing else has to know which fields are paths.
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* const toySchema = configSchema({
|
|
132
|
+
* "out?": "path",
|
|
133
|
+
* "inputs?": "path[]",
|
|
134
|
+
* dir: ["path", "=", () => "./migrations"],
|
|
135
|
+
* greeting: "string = 'hello'",
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* A relative `path` default is declared as a thunk, as above: arktype
|
|
140
|
+
* evaluates a thunk when the default is applied, so it resolves against
|
|
141
|
+
* the config file like an authored value. A relative literal default is
|
|
142
|
+
* refused when the schema is defined.
|
|
143
|
+
*/
|
|
144
|
+
const configSchema = scope({
|
|
145
|
+
/**
|
|
146
|
+
* A string relative to the config file that wrote it. Validation turns it
|
|
147
|
+
* into an absolute path against that file's directory; an absolute value
|
|
148
|
+
* passes through unchanged.
|
|
149
|
+
*/
|
|
150
|
+
path: type("string").pipe((value, ctx) => resolvePathValue(value, ctx.path)) }).type;
|
|
151
|
+
function isPlainObject(value) {
|
|
152
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
153
|
+
const prototype = Object.getPrototypeOf(value);
|
|
154
|
+
return prototype === Object.prototype || prototype === null;
|
|
155
|
+
}
|
|
156
|
+
/** Plain objects and arrays copied; anything else, functions included, by reference. */
|
|
157
|
+
function copyPlainData(value) {
|
|
158
|
+
if (Array.isArray(value)) return value.map(copyPlainData);
|
|
159
|
+
if (isPlainObject(value)) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, copyPlainData(entry)]));
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
function fieldDiagnostic(name, error, provenance) {
|
|
163
|
+
const field = error.path.map(String).join(".");
|
|
164
|
+
const file = declaringFile(provenance, error.path);
|
|
165
|
+
return {
|
|
166
|
+
code: "CLI.CONFIG_FIELD_INVALID",
|
|
167
|
+
severity: "error",
|
|
168
|
+
summary: `In the '${name}' section, ${error.message}`,
|
|
169
|
+
nextActions: [{
|
|
170
|
+
kind: "edit-file",
|
|
171
|
+
label: file === void 0 ? `Correct ${field === "" ? name : `${name}.${field}`} in prisma.config.ts` : `Correct ${field === "" ? name : `${name}.${field}`} in ${file}`
|
|
172
|
+
}],
|
|
173
|
+
...file === void 0 ? {} : { where: { path: file } },
|
|
174
|
+
meta: {
|
|
175
|
+
section: name,
|
|
176
|
+
field
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Validates one section's resolved value against its schema. An absent
|
|
182
|
+
* section is validated as an empty object, so a schema whose fields are
|
|
183
|
+
* all optional accepts it and a required field is reported by name. A
|
|
184
|
+
* plain-object value comes back frozen and carrying `baseDir`, the
|
|
185
|
+
* directory of the nearest file declaring the section. Never throws for
|
|
186
|
+
* any input: arktype reports problems as errors, and a `path` value is
|
|
187
|
+
* only ever resolved here.
|
|
188
|
+
*/
|
|
189
|
+
function validateSectionWithSchema(name, schema, raw, provenance) {
|
|
190
|
+
if (isPlainObject(raw) && Object.hasOwn(raw, "baseDir")) return {
|
|
191
|
+
ok: false,
|
|
192
|
+
diagnostics: [reservedKeyDiagnostic(name, "baseDir", provenance)]
|
|
193
|
+
};
|
|
194
|
+
const previous = current;
|
|
195
|
+
current = {
|
|
196
|
+
name,
|
|
197
|
+
provenance
|
|
198
|
+
};
|
|
199
|
+
try {
|
|
200
|
+
const out = schema(raw === void 0 ? {} : copyPlainData(raw));
|
|
201
|
+
if (out instanceof type.errors) return {
|
|
202
|
+
ok: false,
|
|
203
|
+
diagnostics: [...out].map((error) => fieldDiagnostic(name, error, provenance))
|
|
204
|
+
};
|
|
205
|
+
const nearest = provenance.files[0];
|
|
206
|
+
return {
|
|
207
|
+
ok: true,
|
|
208
|
+
value: isPlainObject(out) && nearest !== void 0 ? Object.freeze({
|
|
209
|
+
...out,
|
|
210
|
+
baseDir: dirname(nearest)
|
|
211
|
+
}) : out,
|
|
212
|
+
diagnostics: []
|
|
213
|
+
};
|
|
214
|
+
} catch (cause) {
|
|
215
|
+
return {
|
|
216
|
+
ok: false,
|
|
217
|
+
diagnostics: [unreadableDiagnostic(name, cause, provenance)]
|
|
218
|
+
};
|
|
219
|
+
} finally {
|
|
220
|
+
current = previous;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function reservedKeyDiagnostic(name, key, provenance) {
|
|
224
|
+
const file = provenance.keys[key] ?? provenance.files[0];
|
|
225
|
+
return {
|
|
226
|
+
code: "CLI.CONFIG_FIELD_INVALID",
|
|
227
|
+
severity: "error",
|
|
228
|
+
summary: `In the '${name}' section, ${key} is reserved: the CLI records it when the section is loaded`,
|
|
229
|
+
nextActions: [{
|
|
230
|
+
kind: "edit-file",
|
|
231
|
+
label: `Remove ${name}.${key} from ${file ?? "prisma.config.ts"}`
|
|
232
|
+
}],
|
|
233
|
+
...file === void 0 ? {} : { where: { path: file } },
|
|
234
|
+
meta: {
|
|
235
|
+
section: name,
|
|
236
|
+
field: key
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function unreadableDiagnostic(name, cause, provenance) {
|
|
241
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
242
|
+
const file = provenance.files[0];
|
|
243
|
+
return {
|
|
244
|
+
code: "CLI.CONFIG_FIELD_INVALID",
|
|
245
|
+
severity: "error",
|
|
246
|
+
summary: `The '${name}' section could not be validated: ${message.split("\n", 1)[0].trim()}`,
|
|
247
|
+
nextActions: [{
|
|
248
|
+
kind: "edit-file",
|
|
249
|
+
label: `Export a plain configuration object for '${name}' in ${file ?? "prisma.config.ts"}`
|
|
250
|
+
}],
|
|
251
|
+
...file === void 0 ? {} : { where: { path: file } },
|
|
252
|
+
meta: {
|
|
253
|
+
section: name,
|
|
254
|
+
field: ""
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
94
259
|
//#region src/config-section.ts
|
|
95
260
|
function defineConfigSection(spec) {
|
|
261
|
+
const schema = spec.schema;
|
|
262
|
+
const validate = schema === void 0 ? spec.validate : (raw, provenance) => validateSectionWithSchema(spec.name, schema, raw, provenance);
|
|
263
|
+
if (validate === void 0) throw new Error(`@prisma/cli-engine: config section '${spec.name}' declares neither a schema nor a validate function`);
|
|
96
264
|
return Object.freeze({
|
|
97
265
|
name: spec.name,
|
|
98
|
-
validate
|
|
266
|
+
validate,
|
|
99
267
|
merge: spec.merge
|
|
100
268
|
});
|
|
101
269
|
}
|
|
@@ -379,4 +547,4 @@ Telemetry is on by default (opt-out); see ${options.docsUrl}\nfor what is collec
|
|
|
379
547
|
};
|
|
380
548
|
}
|
|
381
549
|
//#endregion
|
|
382
|
-
export { EnvironmentCredentialManager, PRESENTED, PRISMA_CONFIG_VERSION, SERVICE_TOKEN_ENV_VAR, authServiceError, claimedExpiresAt, claimedIdentity, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup };
|
|
550
|
+
export { EnvironmentCredentialManager, PRESENTED, PRISMA_CONFIG_VERSION, SERVICE_TOKEN_ENV_VAR, authServiceError, claimedExpiresAt, claimedIdentity, configSchema, createCli, credentialRejectedError, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, definePrismaConfig, defineServerCommand, defineSessionCommand, detectCI, emptyServiceTokenError, exitWithChildStatus, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, realpathOr, resolveSectionOverChain, resolveSectionPath, telemetryCommandGroup, validateSectionWithSchema };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { i as NextAction, n as CliStructuredError, r as Diagnostic, s as Result } from "./protocol-YjqPCCOG.js";
|
|
2
|
+
import * as _$arktype from "arktype";
|
|
3
|
+
import { Type } from "arktype";
|
|
2
4
|
import { ManagementApiClient, TokenStorage } from "@prisma/management-api-sdk";
|
|
3
5
|
|
|
4
6
|
//#region src/management-api.d.ts
|
|
@@ -794,6 +796,53 @@ declare function resolveSectionOverChain(section: ConfigSection<unknown>, files:
|
|
|
794
796
|
*/
|
|
795
797
|
declare function resolveSectionPath(provenance: SectionProvenance, key: string, path: string): string;
|
|
796
798
|
//#endregion
|
|
799
|
+
//#region src/config-schema.d.ts
|
|
800
|
+
declare const configScope: _$arktype.Scope<{
|
|
801
|
+
path: (In: string) => _$arktype.Out<string>;
|
|
802
|
+
}>;
|
|
803
|
+
/**
|
|
804
|
+
* Declares the shape of a config section once. Definitions are arktype
|
|
805
|
+
* definitions with one extra keyword, `path`, for a field holding a path
|
|
806
|
+
* relative to the config file. The declaration drives validation, the
|
|
807
|
+
* diagnostics that name the field and the file to fix, and path
|
|
808
|
+
* resolution; nothing else has to know which fields are paths.
|
|
809
|
+
*
|
|
810
|
+
* ```ts
|
|
811
|
+
* const toySchema = configSchema({
|
|
812
|
+
* "out?": "path",
|
|
813
|
+
* "inputs?": "path[]",
|
|
814
|
+
* dir: ["path", "=", () => "./migrations"],
|
|
815
|
+
* greeting: "string = 'hello'",
|
|
816
|
+
* });
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
* A relative `path` default is declared as a thunk, as above: arktype
|
|
820
|
+
* evaluates a thunk when the default is applied, so it resolves against
|
|
821
|
+
* the config file like an authored value. A relative literal default is
|
|
822
|
+
* refused when the schema is defined.
|
|
823
|
+
*/
|
|
824
|
+
declare const configSchema: typeof configScope.type;
|
|
825
|
+
type ConfigSchema<T = unknown> = Type<T, typeof configScope.t>;
|
|
826
|
+
/**
|
|
827
|
+
* The validated value a schema produces: its output type plus `baseDir`,
|
|
828
|
+
* the directory of the nearest file declaring the section, which the engine
|
|
829
|
+
* adds to a plain-object value. `baseDir` is reserved: a schema may not
|
|
830
|
+
* declare it and a config file may not write it.
|
|
831
|
+
*/
|
|
832
|
+
type ConfigSchemaValue<S extends ConfigSchema> = S["infer"] & {
|
|
833
|
+
readonly baseDir?: string;
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* Validates one section's resolved value against its schema. An absent
|
|
837
|
+
* section is validated as an empty object, so a schema whose fields are
|
|
838
|
+
* all optional accepts it and a required field is reported by name. A
|
|
839
|
+
* plain-object value comes back frozen and carrying `baseDir`, the
|
|
840
|
+
* directory of the nearest file declaring the section. Never throws for
|
|
841
|
+
* any input: arktype reports problems as errors, and a `path` value is
|
|
842
|
+
* only ever resolved here.
|
|
843
|
+
*/
|
|
844
|
+
declare function validateSectionWithSchema<S extends ConfigSchema>(name: string, schema: S, raw: unknown, provenance: SectionProvenance): SectionValidation<ConfigSchemaValue<S>>;
|
|
845
|
+
//#endregion
|
|
797
846
|
//#region src/config-section.d.ts
|
|
798
847
|
/**
|
|
799
848
|
* A command family's named slice of prisma.config.ts. The token couples
|
|
@@ -832,10 +881,24 @@ type SectionValidation<T> = {
|
|
|
832
881
|
readonly ok: false;
|
|
833
882
|
readonly diagnostics: readonly Diagnostic[];
|
|
834
883
|
};
|
|
884
|
+
type SectionValidator<T> = (raw: unknown | undefined, provenance: SectionProvenance) => SectionValidation<T>;
|
|
885
|
+
type SectionMerge = (parent: unknown, child: unknown) => unknown;
|
|
886
|
+
/**
|
|
887
|
+
* A section declared by its schema: validation, the diagnostics naming
|
|
888
|
+
* each bad field and the file to fix, and the resolution of every field
|
|
889
|
+
* declared `path` all derive from the one declaration (see configSchema).
|
|
890
|
+
* A section that needs logic a schema cannot express supplies `validate`
|
|
891
|
+
* instead; it then resolves its own path fields through resolveSectionPath.
|
|
892
|
+
*/
|
|
893
|
+
declare function defineConfigSection<S extends ConfigSchema>(spec: {
|
|
894
|
+
readonly name: string;
|
|
895
|
+
readonly schema: S;
|
|
896
|
+
readonly merge?: SectionMerge;
|
|
897
|
+
}): ConfigSection<ConfigSchemaValue<S>>;
|
|
835
898
|
declare function defineConfigSection<T>(spec: {
|
|
836
899
|
readonly name: string;
|
|
837
|
-
readonly validate:
|
|
838
|
-
readonly merge?:
|
|
900
|
+
readonly validate: SectionValidator<T>;
|
|
901
|
+
readonly merge?: SectionMerge;
|
|
839
902
|
}): ConfigSection<T>;
|
|
840
903
|
//#endregion
|
|
841
904
|
//#region src/events.d.ts
|
|
@@ -1640,4 +1703,4 @@ interface TelemetryDeclaration {
|
|
|
1640
1703
|
readonly docsUrl: string;
|
|
1641
1704
|
}
|
|
1642
1705
|
//#endregion
|
|
1643
|
-
export {
|
|
1706
|
+
export { SectionProvenance as $, Format as A, FlagSpec as At, Ui as B, SERVICE_TOKEN_ENV_VAR as Bt, defineSessionCommand as C, PackageManagerRunResult as Ct, OpenUrlRequest as D, ArgsSpec as Dt, OpenUrlOutcome as E, Args as Et, Span as F, ActiveCredential as Ft, ConfigSection as G, ManagementApiClient$1 as Gt, Severity as H, StoredSessions as Ht, Status as I, Credential as It, ConfigSchema as J, SectionValidation as K, ManagementApiClientConfig as Kt, Text as L, CredentialIdentity as Lt, PRESENTED as M, flag as Mt, Presentations as N, positional as Nt, PromptSurface as O, Char as Ot, PresentedResult as P, ActiveAccessTokenOptions as Pt, ResolvedSection as Q, Tone as R, CredentialManager as Rt, defineServerCommand as S, PackageManagerRunRequest as St, CommandContext as T, PackageOperations as Tt, StreamEvent as U, CredentialRefreshResult as Ut, EngineEvent as V, Session as Vt, StreamMeta as W, CredentialRefresher as Wt, configSchema as X, ConfigSchemaValue as Y, validateSectionWithSchema as Z, ServerCommandDefinition as _, SpawnOptions as _t, RedirectSpec as a, LoadedConfig as at, WorkflowStep as b, exitWithChildStatus as bt, CommandDefinition as c, PRISMA_CONFIG_VERSION as ct, CommandNeeds as d, EngineCommandSnapshot as dt, resolveSectionOverChain as et, CompletedEnvelope as f, RunSummary as ft, NeedsSpec as g, SpawnChild as gt, HelpSpec as h, ExitWithChildStatusOptions as ht, MountedTree as i, InputStream as it, Outcome as j, PositionalSpec as jt, Block as k, CommandArgs as kt, CommandHandler as l, Runtime as lt, Handler as m, ChildStatusSettlement as mt, CommandFamily as n, Host as nt, defineCommandFamily as o, LoadedConfigFile as ot, ErroredEnvelope as p, ChildResult as pt, defineConfigSection as q, TokenStorage$1 as qt, CommandRedirect as r, HostProcess as rt, AnyCommand as s, OutputStream as st, TelemetryDeclaration as t, resolveSectionPath as tt, CommandHelp as u, TelemetryPayload as ut, SessionCommandDefinition as v, SpawnRequest as vt, BrowserWaitRequest as w, PackageManagerRunner as wt, defineCommand as x, PackageManagerId as xt, SpawnDeclarations as y, SpawnedChild as yt, TreeNode as z, CredentialOrigin as zt };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ft as ActiveCredential, Gt as ManagementApiClient, Ht as StoredSessions, It as Credential, Kt as ManagementApiClientConfig, P as PresentedResult, Pt as ActiveAccessTokenOptions, Rt as CredentialManager, U as StreamEvent, V as EngineEvent, Vt as Session, Wt as CredentialRefresher, b as WorkflowStep, ft as RunSummary, gt as SpawnChild, i as MountedTree, lt as Runtime, n as CommandFamily, nt as Host, pt as ChildResult, qt as TokenStorage, t as TelemetryDeclaration, ut as TelemetryPayload, vt as SpawnRequest, wt as PackageManagerRunner, xt as PackageManagerId } from "./report-BWFp3piG.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The execution engine of the unified Prisma CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@clack/prompts": "1.5.0",
|
|
44
44
|
"@stricli/core": "1.3.0",
|
|
45
|
+
"arktype": "2.2.3",
|
|
45
46
|
"c12": "3.3.4",
|
|
46
47
|
"colorette": "^2.0.20",
|
|
47
48
|
"package-manager-detector": "1.8.0",
|
|
@@ -52,8 +53,8 @@
|
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@prisma/management-api-sdk": "1.69.0",
|
|
55
|
-
"@repo/cli-conformance": "8.0.0-rc.15-dev.
|
|
56
|
-
"@repo/tsconfig": "8.0.0-rc.15-dev.
|
|
56
|
+
"@repo/cli-conformance": "8.0.0-rc.15-dev.114",
|
|
57
|
+
"@repo/tsconfig": "8.0.0-rc.15-dev.114",
|
|
57
58
|
"@types/node": "^22.19.19",
|
|
58
59
|
"ci-info": "^4.3.1",
|
|
59
60
|
"tsdown": "^0.21.10",
|