@prisma/internals 6.6.0-integration-push-xmzqvqxpztks.11 → 6.6.0-integration-mcp.2
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/Generator.d.ts +5 -23
- package/dist/Generator.js +2 -4
- package/dist/{chunk-EPXBOIA5.js → chunk-2I3VYCA7.js} +5 -5
- package/dist/{chunk-2QTAK7KO.js → chunk-2LDG4PID.js} +5 -5
- package/dist/{chunk-JOIIWB3U.js → chunk-2LOGW45F.js} +68 -33
- package/dist/{chunk-KB5DKCI4.js → chunk-3GYXMWBM.js} +7 -7
- package/dist/{chunk-C36XBSRA.js → chunk-4KCLNFE4.js} +5 -5
- package/dist/{chunk-Y4ZCEXKJ.js → chunk-5CBAXTAF.js} +5 -5
- package/dist/chunk-72UZXEBG.js +28 -0
- package/dist/{chunk-2HN7FYKA.js → chunk-AP52B62F.js} +5 -5
- package/dist/{chunk-HG3YOAAE.js → chunk-AXD7KB4D.js} +5 -5
- package/dist/chunk-BWGDP6B5.js +4948 -0
- package/dist/chunk-DYV47NUW.js +796 -0
- package/dist/{chunk-BPDMLM32.js → chunk-DYVL6P7F.js} +13 -46
- package/dist/{chunk-DKSUHQGA.js → chunk-EKESIUIK.js} +7 -7
- package/dist/chunk-EUTJYQDW.js +46 -0
- package/dist/{chunk-3EGV6JCZ.js → chunk-FAPPXX7W.js} +8 -8
- package/dist/chunk-GHHABGYW.js +28 -0
- package/dist/{chunk-FJR5JRC2.js → chunk-GV244NDE.js} +7 -7
- package/dist/{chunk-D4VDA2TZ.js → chunk-IRWX4FCC.js} +6 -6
- package/dist/{chunk-IDINCQMN.js → chunk-IWTEX7EE.js} +9 -780
- package/dist/{chunk-NVNI2SRU.js → chunk-KNNTV7IN.js} +687 -213
- package/dist/{chunk-AO5ASZAS.js → chunk-LWBLVV7Y.js} +8 -8
- package/dist/{chunk-5AI4FIZ3.js → chunk-MEOOYUIZ.js} +10 -10
- package/dist/{chunk-TQFONRJP.js → chunk-MXAUURHG.js} +5 -5
- package/dist/chunk-OQ2NRV2Y.js +35 -0
- package/dist/{chunk-YNDF56XR.js → chunk-ORPBIAE5.js} +8 -8
- package/dist/{chunk-SHHALVIQ.js → chunk-OUQPIJFQ.js} +5 -5
- package/dist/chunk-PE6DXWOX.js +52 -0
- package/dist/{chunk-3BVB3DTJ.js → chunk-PING5S2U.js} +8 -8
- package/dist/{chunk-2R7JBGUP.js → chunk-PWGQKUJW.js} +200 -85
- package/dist/{chunk-CTAL72US.js → chunk-Q2IBLC6D.js} +5 -5
- package/dist/{chunk-XG33Y5QX.js → chunk-R45GQNKO.js} +200 -85
- package/dist/{chunk-MJIP3FY5.js → chunk-R4ZFFYJA.js} +238 -2502
- package/dist/{chunk-7UNYBZSU.js → chunk-RABVZXRU.js} +7 -7
- package/dist/{chunk-3DQANJMY.js → chunk-SAAMENIS.js} +7 -7
- package/dist/{chunk-57VS7LXW.js → chunk-SNSJWJTA.js} +5 -5
- package/dist/{chunk-YR5KNFKN.js → chunk-SUOMIRLO.js} +6 -6
- package/dist/{chunk-75BIJ5PX.js → chunk-UB2X7DGZ.js} +9 -9
- package/dist/{chunk-BWYO73FG.js → chunk-UFYFNNCN.js} +8 -8
- package/dist/{chunk-67I7CEQJ.js → chunk-URRVX2VQ.js} +6 -6
- package/dist/{chunk-FUC2LI24.js → chunk-VTJOX6HO.js} +5 -5
- package/dist/{chunk-EFNTOXMV.js → chunk-VYJSNZF3.js} +4 -3
- package/dist/{chunk-ETYWYJBX.js → chunk-WF5LZFJS.js} +12 -12
- package/dist/{chunk-7U7QD73Y.js → chunk-WOIJKMTZ.js} +8 -8
- package/dist/{chunk-D6EDE5WT.js → chunk-XMVJRTN5.js} +5 -5
- package/dist/{chunk-RSLFYIHN.js → chunk-XRBOJLES.js} +5 -4
- package/dist/cli/checkUnsupportedDataProxy.js +44 -37
- package/dist/cli/getSchema.js +47 -40
- package/dist/cli/hashes.js +44 -37
- package/dist/cli/schemaContext.js +44 -37
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +43 -36
- package/dist/engine-commands/getConfig.js +10 -10
- package/dist/engine-commands/getDmmf.js +7 -7
- package/dist/engine-commands/getEngineVersion.js +7 -6
- package/dist/engine-commands/getEnginesMetaInfo.js +9 -8
- package/dist/engine-commands/index.js +54 -47
- package/dist/engine-commands/lintSchema.js +8 -8
- package/dist/engine-commands/mergeSchemas.js +7 -7
- package/dist/engine-commands/validate.js +7 -7
- package/dist/errorReporting.js +6 -6
- package/dist/get-generators/generatorResolvers/generatorResolvers.d.ts +15 -0
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +139 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +6 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.js +26 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +9 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.js +26 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +8 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.js +29 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +6 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +139 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +1 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.js +26 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +20 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.js +26 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +7 -0
- package/dist/{resolvePkg.js → get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.js} +6 -6
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.d.ts +1 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.js +17 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +20 -0
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +140 -0
- package/dist/get-generators/getGenerators.d.ts +9 -18
- package/dist/get-generators/getGenerators.js +46 -39
- package/dist/get-generators/utils/getBinaryPathsByVersion.js +4 -3
- package/dist/getPackedPackage.js +5 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.js +87 -80
- package/dist/{multipart-parser-3AFJFP6K.js → multipart-parser-UV3WZSWW.js} +6 -6
- package/dist/resolveBinary.js +8 -7
- package/dist/schemaEngineCommands.js +10 -9
- package/dist/sendPanic.js +4 -4
- package/dist/utils/cloudflareD1.js +3 -3
- package/dist/utils/fs-functional.js +10 -10
- package/dist/utils/fs-utils.js +8 -8
- package/dist/utils/getEnvPaths.js +43 -36
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +5 -5
- package/dist/utils/loadEnvFile.js +43 -36
- package/dist/wasm.js +4 -4
- package/package.json +11 -10
- package/dist/resolvePkg.d.ts +0 -7
@@ -26,11 +26,14 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_R45GQNKO_exports = {};
|
30
|
+
__export(chunk_R45GQNKO_exports, {
|
31
|
+
checkTypeScriptVersion: () => checkTypeScriptVersion,
|
31
32
|
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
33
|
+
debug: () => debug4,
|
32
34
|
forbiddenCmdWithDataProxyFlagMessage: () => forbiddenCmdWithDataProxyFlagMessage,
|
33
35
|
formatSchema: () => formatSchema,
|
36
|
+
generatorResolvers: () => generatorResolvers,
|
34
37
|
getBinaryTargetForCurrentPlatform: () => import_get_platform2.getBinaryTargetForCurrentPlatform,
|
35
38
|
getCLIPathHash: () => getCLIPathHash,
|
36
39
|
getEnvPaths: () => getEnvPaths,
|
@@ -46,34 +49,41 @@ __export(chunk_XG33Y5QX_exports, {
|
|
46
49
|
loadEnvFile: () => loadEnvFile,
|
47
50
|
loadSchemaContext: () => loadSchemaContext,
|
48
51
|
printSchemaLoadedMessage: () => printSchemaLoadedMessage,
|
52
|
+
prismaClientResolver: () => prismaClientResolver,
|
49
53
|
processSchemaResult: () => processSchemaResult,
|
50
54
|
skipIndex: () => skipIndex
|
51
55
|
});
|
52
|
-
module.exports = __toCommonJS(
|
56
|
+
module.exports = __toCommonJS(chunk_R45GQNKO_exports);
|
57
|
+
var import_chunk_OQ2NRV2Y = require("./chunk-OQ2NRV2Y.js");
|
58
|
+
var import_chunk_GHHABGYW = require("./chunk-GHHABGYW.js");
|
59
|
+
var import_chunk_EUTJYQDW = require("./chunk-EUTJYQDW.js");
|
60
|
+
var import_chunk_PE6DXWOX = require("./chunk-PE6DXWOX.js");
|
61
|
+
var import_chunk_72UZXEBG = require("./chunk-72UZXEBG.js");
|
53
62
|
var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
|
54
|
-
var
|
63
|
+
var import_chunk_2I3VYCA7 = require("./chunk-2I3VYCA7.js");
|
55
64
|
var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
|
56
65
|
var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
|
57
66
|
var import_chunk_LRU47BGE = require("./chunk-LRU47BGE.js");
|
58
|
-
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
|
59
67
|
var import_chunk_UTJGRVMG = require("./chunk-UTJGRVMG.js");
|
60
|
-
var import_chunk_XLTQGAI2 = require("./chunk-XLTQGAI2.js");
|
61
68
|
var import_chunk_5V36RLCO = require("./chunk-5V36RLCO.js");
|
69
|
+
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
|
62
70
|
var import_chunk_AZV6HVKA = require("./chunk-AZV6HVKA.js");
|
71
|
+
var import_chunk_XLTQGAI2 = require("./chunk-XLTQGAI2.js");
|
63
72
|
var import_chunk_HAGJ64PM = require("./chunk-HAGJ64PM.js");
|
64
73
|
var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
|
65
|
-
var
|
66
|
-
var
|
67
|
-
var
|
68
|
-
var
|
69
|
-
var
|
74
|
+
var import_chunk_J77ZIDXB = require("./chunk-J77ZIDXB.js");
|
75
|
+
var import_chunk_5CBAXTAF = require("./chunk-5CBAXTAF.js");
|
76
|
+
var import_chunk_RABVZXRU = require("./chunk-RABVZXRU.js");
|
77
|
+
var import_chunk_UFYFNNCN = require("./chunk-UFYFNNCN.js");
|
78
|
+
var import_chunk_WOIJKMTZ = require("./chunk-WOIJKMTZ.js");
|
79
|
+
var import_chunk_4KCLNFE4 = require("./chunk-4KCLNFE4.js");
|
70
80
|
var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
|
71
81
|
var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
|
72
|
-
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
73
82
|
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
74
|
-
var
|
83
|
+
var import_chunk_DYVL6P7F = require("./chunk-DYVL6P7F.js");
|
75
84
|
var import_chunk_IOIAK7V7 = require("./chunk-IOIAK7V7.js");
|
76
|
-
var
|
85
|
+
var import_chunk_R4ZFFYJA = require("./chunk-R4ZFFYJA.js");
|
86
|
+
var import_chunk_URRVX2VQ = require("./chunk-URRVX2VQ.js");
|
77
87
|
var import_chunk_ZJWZK45Z = require("./chunk-ZJWZK45Z.js");
|
78
88
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
79
89
|
var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
|
@@ -91,20 +101,26 @@ var import_fetch_engine = require("@prisma/fetch-engine");
|
|
91
101
|
var import_get_platform = require("@prisma/get-platform");
|
92
102
|
var import_path3 = __toESM2(require("path"));
|
93
103
|
var import_debug4 = __toESM2(require("@prisma/debug"));
|
104
|
+
var import_fs2 = __toESM2(require("fs"));
|
105
|
+
var import_path4 = __toESM2(require("path"));
|
106
|
+
var import_debug5 = __toESM2(require("@prisma/debug"));
|
107
|
+
var import_fs3 = __toESM2(require("fs"));
|
108
|
+
var import_path5 = __toESM2(require("path"));
|
109
|
+
var import_debug6 = __toESM2(require("@prisma/debug"));
|
94
110
|
var import_node_path = __toESM2(require("node:path"));
|
95
111
|
var import_node_process = __toESM2(require("node:process"));
|
96
112
|
var import_node_path2 = __toESM2(require("node:path"));
|
97
113
|
var import_node_fs = __toESM2(require("node:fs"));
|
98
114
|
var import_node_url = require("node:url");
|
99
115
|
var import_node_fs2 = __toESM2(require("node:fs"));
|
100
|
-
var
|
101
|
-
var
|
116
|
+
var import_fs4 = __toESM2(require("fs"));
|
117
|
+
var import_path6 = __toESM2(require("path"));
|
102
118
|
var import_get_platform2 = require("@prisma/get-platform");
|
103
119
|
var debug = (0, import_debug2.default)("prisma:format");
|
104
120
|
async function formatSchema({ schemas }, inputFormattingOptions) {
|
105
121
|
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
106
122
|
handleFormatPanic(() => {
|
107
|
-
|
123
|
+
import_chunk_4KCLNFE4.prismaSchemaWasm.debug_panic();
|
108
124
|
});
|
109
125
|
}
|
110
126
|
const defaultFormattingOptions = {
|
@@ -121,10 +137,10 @@ async function formatSchema({ schemas }, inputFormattingOptions) {
|
|
121
137
|
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(() => {
|
122
138
|
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
|
123
139
|
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
124
|
-
const lintDiagnostics2 = (0,
|
140
|
+
const lintDiagnostics2 = (0, import_chunk_5CBAXTAF.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
125
141
|
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
126
142
|
});
|
127
|
-
const lintWarnings = (0,
|
143
|
+
const lintWarnings = (0, import_chunk_5CBAXTAF.getLintWarningsAsText)(lintDiagnostics);
|
128
144
|
if (lintWarnings && import_chunk_ZJWZK45Z.logger_exports.should.warn()) {
|
129
145
|
console.warn(lintWarnings);
|
130
146
|
}
|
@@ -151,7 +167,7 @@ function handleFormatPanic(tryCb) {
|
|
151
167
|
}
|
152
168
|
}
|
153
169
|
function formatWasm(schema, documentFormattingParams) {
|
154
|
-
const formattedSchema =
|
170
|
+
const formattedSchema = import_chunk_4KCLNFE4.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
155
171
|
return formattedSchema;
|
156
172
|
}
|
157
173
|
var readFile = (0, import_util.promisify)(import_fs.default.readFile);
|
@@ -195,7 +211,7 @@ async function readSchemaFromDirectory(schemaPath2) {
|
|
195
211
|
}
|
196
212
|
const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
|
197
213
|
debug2("Loading config");
|
198
|
-
const config = await (0,
|
214
|
+
const config = await (0, import_chunk_UFYFNNCN.getConfig)({
|
199
215
|
datamodel: files,
|
200
216
|
ignoreEnvVarErrors: true
|
201
217
|
});
|
@@ -287,7 +303,7 @@ function renderDefaultLookupError(error, cwd) {
|
|
287
303
|
return parts.join("\n");
|
288
304
|
}
|
289
305
|
async function getPrismaConfigFromPackageJson(cwd) {
|
290
|
-
const pkgJson = await (0,
|
306
|
+
const pkgJson = await (0, import_chunk_R4ZFFYJA.readPackageUp)({ cwd, normalize: false });
|
291
307
|
const prismaPropertyFromPkgJson = pkgJson?.packageJson?.prisma;
|
292
308
|
if (!pkgJson) {
|
293
309
|
return null;
|
@@ -346,11 +362,11 @@ async function getSchemaFromPackageJson(cwd) {
|
|
346
362
|
}
|
347
363
|
async function getDefaultSchema(cwd, failures = []) {
|
348
364
|
const lookupPaths = [import_path.default.join(cwd, "schema.prisma"), import_path.default.join(cwd, "prisma", "schema.prisma")];
|
349
|
-
for (const
|
350
|
-
debug2(`Checking existence of ${
|
351
|
-
const schema = await readSchemaFromSingleFile(
|
365
|
+
for (const path9 of lookupPaths) {
|
366
|
+
debug2(`Checking existence of ${path9}`);
|
367
|
+
const schema = await readSchemaFromSingleFile(path9);
|
352
368
|
if (!schema.ok) {
|
353
|
-
failures.push({ path:
|
369
|
+
failures.push({ path: path9, error: schema.error });
|
354
370
|
continue;
|
355
371
|
}
|
356
372
|
return schema;
|
@@ -405,7 +421,7 @@ async function processSchemaResult({
|
|
405
421
|
if (printLoadMessage) {
|
406
422
|
printSchemaLoadedMessage(loadedFromPathForLogMessages);
|
407
423
|
}
|
408
|
-
const configFromPsl = await (0,
|
424
|
+
const configFromPsl = await (0, import_chunk_UFYFNNCN.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
|
409
425
|
const primaryDatasource = configFromPsl.datasources.at(0);
|
410
426
|
const schemaRootDir = schemaResult.schemaRootDir || cwd;
|
411
427
|
return {
|
@@ -427,25 +443,117 @@ function primaryDatasourceDirectory(primaryDatasource) {
|
|
427
443
|
}
|
428
444
|
return null;
|
429
445
|
}
|
430
|
-
var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0,
|
431
|
-
var debug3 = (0,
|
432
|
-
async function
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
446
|
+
var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R4ZFFYJA.require_p_map)());
|
447
|
+
var debug3 = (0, import_debug5.default)("prisma:generator");
|
448
|
+
async function checkTypeScriptVersion() {
|
449
|
+
const minVersion = "4.1.0";
|
450
|
+
try {
|
451
|
+
const typescriptPath = await (0, import_chunk_URRVX2VQ.resolvePkg)("typescript", {
|
452
|
+
basedir: process.cwd()
|
453
|
+
});
|
454
|
+
debug3("typescriptPath", typescriptPath);
|
455
|
+
const typescriptPkg = typescriptPath && import_path5.default.join(typescriptPath, "package.json");
|
456
|
+
if (typescriptPkg && import_fs3.default.existsSync(typescriptPkg)) {
|
457
|
+
const pjson = (0, import_chunk_4VNS5WPM.__require)(typescriptPkg);
|
458
|
+
const currentVersion = pjson.version;
|
459
|
+
if ((0, import_chunk_EUTJYQDW.semverLt)(currentVersion, minVersion)) {
|
460
|
+
import_chunk_ZJWZK45Z.logger_exports.warn(
|
461
|
+
`Prisma detected that your ${(0, import_chunk_PG5FDKSF.bold)(
|
462
|
+
"TypeScript"
|
463
|
+
)} version ${currentVersion} is outdated. If you want to use Prisma Client with TypeScript please update it to version ${(0, import_chunk_PG5FDKSF.bold)(
|
464
|
+
minVersion
|
465
|
+
)} or ${(0, import_chunk_PG5FDKSF.bold)("newer")}. ${(0, import_chunk_PG5FDKSF.dim)(`TypeScript found in: ${(0, import_chunk_PG5FDKSF.bold)(typescriptPath)}`)}`
|
466
|
+
);
|
467
|
+
}
|
468
|
+
}
|
469
|
+
} catch (e) {
|
470
|
+
}
|
471
|
+
}
|
472
|
+
var debug4 = (0, import_debug4.default)("prisma:generator");
|
473
|
+
async function prismaClientResolver(baseDir, version3) {
|
474
|
+
let prismaClientDir = await (0, import_chunk_PE6DXWOX.findPrismaClientDir)(baseDir);
|
475
|
+
debug4("baseDir", baseDir);
|
476
|
+
await checkTypeScriptVersion();
|
477
|
+
if (!prismaClientDir && !process.env.PRISMA_GENERATE_SKIP_AUTOINSTALL) {
|
478
|
+
let projectRoot = (0, import_chunk_J77ZIDXB.longestCommonPathPrefix)(baseDir, process.cwd());
|
479
|
+
debug4("projectRoot", projectRoot);
|
480
|
+
const warningTag = `${(0, import_chunk_PG5FDKSF.bold)("Warning:")} ${(0, import_chunk_PG5FDKSF.dim)("[Prisma auto-install on generate]")}`;
|
481
|
+
if (projectRoot === void 0) {
|
482
|
+
console.warn(
|
483
|
+
(0, import_chunk_PG5FDKSF.yellow)(
|
484
|
+
`${warningTag} The Prisma schema directory ${(0, import_chunk_PG5FDKSF.bold)(baseDir)} and the current working directory ${(0, import_chunk_PG5FDKSF.bold)(
|
485
|
+
process.cwd()
|
486
|
+
)} have no common ancestor. The Prisma schema directory will be used as the project root.`
|
487
|
+
)
|
488
|
+
);
|
489
|
+
projectRoot = baseDir;
|
490
|
+
}
|
491
|
+
if (!import_fs2.default.existsSync(import_path4.default.join(projectRoot, "package.json"))) {
|
492
|
+
console.warn(
|
493
|
+
(0, import_chunk_PG5FDKSF.yellow)(
|
494
|
+
`${warningTag} Prisma could not find a ${(0, import_chunk_PG5FDKSF.bold)("package.json")} file in the inferred project root ${(0, import_chunk_PG5FDKSF.bold)(
|
495
|
+
projectRoot
|
496
|
+
)}. During the next step, when an auto-install of Prisma package(s) will be attempted, it will then be created by your package manager on the appropriate level if necessary.`
|
497
|
+
)
|
498
|
+
);
|
499
|
+
}
|
500
|
+
const prismaCliDir = await (0, import_chunk_URRVX2VQ.resolvePkg)("prisma", { basedir: baseDir });
|
501
|
+
if (process.platform === "win32" && await (0, import_chunk_GHHABGYW.isYarnUsed)(baseDir)) {
|
502
|
+
const hasCli = (s) => prismaCliDir !== void 0 ? s : "";
|
503
|
+
const missingCli = (s) => prismaCliDir === void 0 ? s : "";
|
504
|
+
throw new Error(
|
505
|
+
`Could not resolve ${missingCli(`${(0, import_chunk_PG5FDKSF.bold)("prisma")} and `)}${(0, import_chunk_PG5FDKSF.bold)(
|
506
|
+
"@prisma/client"
|
507
|
+
)} in the current project. Please install ${hasCli("it")}${missingCli("them")} with ${missingCli(
|
508
|
+
`${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)(`${await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "add", "prisma", "-D")}`))} and `
|
509
|
+
)}${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)(`${await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "add", "@prisma/client")}`))}, and rerun ${(0, import_chunk_PG5FDKSF.bold)(
|
510
|
+
await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "execute", "prisma generate")
|
511
|
+
)} \u{1F64F}.`
|
512
|
+
);
|
513
|
+
}
|
514
|
+
if (!prismaCliDir) {
|
515
|
+
await (0, import_chunk_OQ2NRV2Y.runPackageCmd)(projectRoot, "add", `prisma@${version3 ?? "latest"}`, "-D", "--silent");
|
516
|
+
}
|
517
|
+
await (0, import_chunk_OQ2NRV2Y.runPackageCmd)(projectRoot, "add", `@prisma/client@${version3 ?? "latest"}`, "--silent");
|
518
|
+
prismaClientDir = await (0, import_chunk_PE6DXWOX.findPrismaClientDir)(import_path4.default.join(".", baseDir));
|
519
|
+
if (!prismaClientDir) {
|
520
|
+
throw new Error(
|
521
|
+
`Could not resolve @prisma/client despite the installation that we just tried.
|
522
|
+
Please try to install it by hand with ${(0, import_chunk_PG5FDKSF.bold)(
|
523
|
+
(0, import_chunk_PG5FDKSF.green)(`${await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "add", "@prisma/client")}`)
|
524
|
+
)} and rerun ${(0, import_chunk_PG5FDKSF.bold)(await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "execute", "prisma generate"))} \u{1F64F}.`
|
525
|
+
);
|
526
|
+
}
|
527
|
+
console.info(
|
528
|
+
`
|
529
|
+
\u2714 Installed the ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)("@prisma/client"))} and ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)("prisma"))} packages in your project`
|
530
|
+
);
|
531
|
+
}
|
532
|
+
if (!prismaClientDir) {
|
533
|
+
throw new Error(
|
534
|
+
`Could not resolve @prisma/client.
|
535
|
+
Please try to install it with ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)("npm install @prisma/client"))} and rerun ${(0, import_chunk_PG5FDKSF.bold)(
|
536
|
+
await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "execute", "prisma generate")
|
537
|
+
)} \u{1F64F}.`
|
443
538
|
);
|
444
539
|
}
|
540
|
+
return {
|
541
|
+
outputPath: prismaClientDir,
|
542
|
+
generatorPath: import_path4.default.resolve(prismaClientDir, "generator-build/index.js"),
|
543
|
+
isNode: true
|
544
|
+
};
|
545
|
+
}
|
546
|
+
var generatorResolvers = {
|
547
|
+
"prisma-client-js": prismaClientResolver
|
548
|
+
};
|
549
|
+
var debug5 = (0, import_debug3.default)("prisma:getGenerators");
|
550
|
+
async function getGenerators(options) {
|
445
551
|
const {
|
446
552
|
schemaPath,
|
447
|
-
|
553
|
+
providerAliases: aliases,
|
554
|
+
// do you get the pun?
|
448
555
|
version,
|
556
|
+
cliVersion,
|
449
557
|
printDownloadProgress,
|
450
558
|
overrideGenerators,
|
451
559
|
skipDownload,
|
@@ -483,7 +591,7 @@ async function getGenerators(options) {
|
|
483
591
|
}
|
484
592
|
(0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
|
485
593
|
const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
|
486
|
-
const dmmf = await (0,
|
594
|
+
const dmmf = await (0, import_chunk_WOIJKMTZ.getDMMF)({
|
487
595
|
datamodel: schemaContext.schemaFiles,
|
488
596
|
previewFeatures
|
489
597
|
});
|
@@ -499,34 +607,41 @@ async function getGenerators(options) {
|
|
499
607
|
try {
|
500
608
|
const generators = await (0, import_p_map.default)(
|
501
609
|
generatorConfigs,
|
502
|
-
async (
|
503
|
-
|
504
|
-
|
505
|
-
const
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
610
|
+
async (generator, index) => {
|
611
|
+
let generatorPath = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
612
|
+
let paths;
|
613
|
+
const baseDir = import_path3.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
|
614
|
+
const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
615
|
+
if (aliases && aliases[providerValue]) {
|
616
|
+
generatorPath = aliases[providerValue].generatorPath;
|
617
|
+
paths = aliases[providerValue];
|
618
|
+
} else if (generatorResolvers[providerValue]) {
|
619
|
+
paths = await generatorResolvers[providerValue](baseDir, cliVersion);
|
620
|
+
generatorPath = paths.generatorPath;
|
621
|
+
}
|
622
|
+
const generatorInstance = new import_chunk_DYVL6P7F.Generator(generatorPath, generator, paths?.isNode);
|
513
623
|
await generatorInstance.init();
|
514
|
-
if (
|
515
|
-
|
516
|
-
value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(
|
624
|
+
if (generator.output) {
|
625
|
+
generator.output = {
|
626
|
+
value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.output)),
|
627
|
+
fromEnvVar: null
|
628
|
+
};
|
629
|
+
generator.isCustomOutput = true;
|
630
|
+
} else if (paths) {
|
631
|
+
generator.output = {
|
632
|
+
value: paths.outputPath,
|
517
633
|
fromEnvVar: null
|
518
634
|
};
|
519
|
-
generatorConfig.isCustomOutput = true;
|
520
635
|
} else {
|
521
|
-
if (!generatorInstance.manifest
|
636
|
+
if (!generatorInstance.manifest || !generatorInstance.manifest.defaultOutput) {
|
522
637
|
throw new Error(
|
523
|
-
`Can't resolve output dir for generator ${(0, import_chunk_PG5FDKSF.bold)(
|
524
|
-
|
638
|
+
`Can't resolve output dir for generator ${(0, import_chunk_PG5FDKSF.bold)(generator.name)} with provider ${(0, import_chunk_PG5FDKSF.bold)(
|
639
|
+
generator.provider.value
|
525
640
|
)}.
|
526
|
-
|
641
|
+
The generator needs to either define the \`defaultOutput\` path in the manifest or you need to define \`output\` in the datamodel.prisma file.`
|
527
642
|
);
|
528
643
|
}
|
529
|
-
|
644
|
+
generator.output = {
|
530
645
|
value: await (0, import_chunk_2B26F5N3.resolveOutput)({
|
531
646
|
defaultOutput: generatorInstance.manifest.defaultOutput,
|
532
647
|
baseDir
|
@@ -534,12 +649,12 @@ You need to define \`output\` in the generator block in the schema file.`
|
|
534
649
|
fromEnvVar: null
|
535
650
|
};
|
536
651
|
}
|
537
|
-
const datamodel = (0,
|
538
|
-
const envPaths = await getEnvPaths(schemaContext.schemaPath, { cwd:
|
652
|
+
const datamodel = (0, import_chunk_RABVZXRU.mergeSchemas)({ schemas: schemaContext.schemaFiles });
|
653
|
+
const envPaths = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
|
539
654
|
const options2 = {
|
540
655
|
datamodel,
|
541
656
|
datasources: schemaContext.datasources,
|
542
|
-
generator
|
657
|
+
generator,
|
543
658
|
dmmf,
|
544
659
|
otherGenerators: skipIndex(generatorConfigs, index),
|
545
660
|
schemaPath: schemaContext.schemaPath,
|
@@ -601,8 +716,8 @@ generator gen {
|
|
601
716
|
}
|
602
717
|
}
|
603
718
|
}
|
604
|
-
|
605
|
-
const binaryPathsByVersion = await (0,
|
719
|
+
debug5("neededVersions", JSON.stringify(neededVersions, null, 2));
|
720
|
+
const binaryPathsByVersion = await (0, import_chunk_2I3VYCA7.getBinaryPathsByVersion)({
|
606
721
|
neededVersions,
|
607
722
|
binaryTarget,
|
608
723
|
version,
|
@@ -615,17 +730,17 @@ generator gen {
|
|
615
730
|
const engineVersion = (0, import_chunk_X3P4J7WW.getEngineVersionForGenerator)(generator.manifest, version);
|
616
731
|
const binaryPaths = binaryPathsByVersion[engineVersion];
|
617
732
|
const generatorBinaryPaths = (0, import_chunk_5V36RLCO.pick)(binaryPaths, generator.manifest.requiresEngines);
|
618
|
-
|
733
|
+
debug5({ generatorBinaryPaths });
|
619
734
|
generator.setBinaryPaths(generatorBinaryPaths);
|
620
735
|
if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
|
621
|
-
const customDmmf = await (0,
|
736
|
+
const customDmmf = await (0, import_chunk_WOIJKMTZ.getDMMF)({
|
622
737
|
datamodel: schemaContext.schemaFiles,
|
623
738
|
previewFeatures
|
624
739
|
});
|
625
740
|
const options2 = { ...generator.options, dmmf: customDmmf };
|
626
|
-
|
627
|
-
|
628
|
-
|
741
|
+
debug5("generator.manifest.prettyName", generator.manifest.prettyName);
|
742
|
+
debug5("options", options2);
|
743
|
+
debug5("options.generator.binaryTargets", options2.generator.binaryTargets);
|
629
744
|
generator.setOptions(options2);
|
630
745
|
}
|
631
746
|
}
|
@@ -757,9 +872,9 @@ function locatePathSync(paths, {
|
|
757
872
|
}
|
758
873
|
}
|
759
874
|
}
|
760
|
-
function pathExistsSync(
|
875
|
+
function pathExistsSync(path9) {
|
761
876
|
try {
|
762
|
-
import_node_fs2.default.accessSync(
|
877
|
+
import_node_fs2.default.accessSync(path9);
|
763
878
|
return true;
|
764
879
|
} catch {
|
765
880
|
return false;
|
@@ -767,9 +882,9 @@ function pathExistsSync(path7) {
|
|
767
882
|
}
|
768
883
|
var findUpStop = Symbol("findUpStop");
|
769
884
|
function findUpMultipleSync(name, options2 = {}) {
|
770
|
-
let directory = import_node_path.default.resolve((0,
|
885
|
+
let directory = import_node_path.default.resolve((0, import_chunk_R4ZFFYJA.toPath)(options2.cwd) ?? "");
|
771
886
|
const { root } = import_node_path.default.parse(directory);
|
772
|
-
const stopAt = import_node_path.default.resolve(directory, (0,
|
887
|
+
const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_R4ZFFYJA.toPath)(options2.stopAt) ?? root);
|
773
888
|
const limit = options2.limit ?? Number.POSITIVE_INFINITY;
|
774
889
|
const paths = [name].flat();
|
775
890
|
const runMatcher = (locateOptions) => {
|
@@ -802,7 +917,7 @@ function findUpSync(name, options2 = {}) {
|
|
802
917
|
const matches = findUpMultipleSync(name, { ...options2, limit: 1 });
|
803
918
|
return matches[0];
|
804
919
|
}
|
805
|
-
var
|
920
|
+
var debug6 = (0, import_debug6.default)("prisma:loadEnv");
|
806
921
|
async function getEnvPaths(schemaPath2, opts = { cwd: process.cwd() }) {
|
807
922
|
const rootEnvPath = getProjectRootEnvPath({ cwd: opts.cwd }) ?? null;
|
808
923
|
const schemaEnvPathFromArgs = schemaPathToEnvPath(schemaPath2);
|
@@ -833,16 +948,16 @@ async function readSchemaPathFromPkgJson() {
|
|
833
948
|
}
|
834
949
|
function getProjectRootEnvPath(opts) {
|
835
950
|
const pkgJsonPath = findUpSync((dir) => {
|
836
|
-
const pkgPath =
|
951
|
+
const pkgPath = import_path6.default.join(dir, "package.json");
|
837
952
|
if (pathExistsSync(pkgPath)) {
|
838
953
|
try {
|
839
|
-
const pkg = JSON.parse(
|
954
|
+
const pkg = JSON.parse(import_fs4.default.readFileSync(pkgPath, "utf8"));
|
840
955
|
if (pkg["name"] !== ".prisma/client") {
|
841
|
-
|
956
|
+
debug6(`project root found at ${pkgPath}`);
|
842
957
|
return pkgPath;
|
843
958
|
}
|
844
959
|
} catch (e) {
|
845
|
-
|
960
|
+
debug6(`skipping package.json at ${pkgPath}`);
|
846
961
|
}
|
847
962
|
}
|
848
963
|
return void 0;
|
@@ -850,15 +965,15 @@ function getProjectRootEnvPath(opts) {
|
|
850
965
|
if (!pkgJsonPath) {
|
851
966
|
return null;
|
852
967
|
}
|
853
|
-
const candidate =
|
854
|
-
if (!
|
968
|
+
const candidate = import_path6.default.join(import_path6.default.dirname(pkgJsonPath), ".env");
|
969
|
+
if (!import_fs4.default.existsSync(candidate)) {
|
855
970
|
return null;
|
856
971
|
}
|
857
972
|
return candidate;
|
858
973
|
}
|
859
974
|
function schemaPathToEnvPath(schemaPath2) {
|
860
975
|
if (!schemaPath2) return null;
|
861
|
-
return
|
976
|
+
return import_path6.default.join(import_path6.default.dirname(schemaPath2), ".env");
|
862
977
|
}
|
863
978
|
async function loadEnvFile({
|
864
979
|
schemaPath: schemaPath2,
|
@@ -893,7 +1008,7 @@ function checkUnsupportedDataProxy({
|
|
893
1008
|
}
|
894
1009
|
}
|
895
1010
|
if (!schemaContext2?.primaryDatasource) return;
|
896
|
-
const url = (0,
|
1011
|
+
const url = (0, import_chunk_UFYFNNCN.resolveUrl)((0, import_chunk_UFYFNNCN.getEffectiveUrl)(schemaContext2.primaryDatasource));
|
897
1012
|
if (url?.startsWith("prisma://")) {
|
898
1013
|
throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
|
899
1014
|
}
|