@prisma/internals 6.1.0-dev.1 → 6.1.0-dev.11
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/chunk-2DXAGCPS.js +177 -0
- package/dist/{chunk-AV3YRAF7.js → chunk-2PP7BHKH.js} +5 -5
- package/dist/chunk-5XRQ7ONW.js +122 -0
- package/dist/{chunk-SBSURDHK.js → chunk-ARAZIXTI.js} +8 -8
- package/dist/{chunk-KFFXIB4M.js → chunk-EPKZPJC5.js} +8 -35
- package/dist/{chunk-VCUPZJX2.js → chunk-GNMI6KU5.js} +7 -7
- package/dist/{chunk-R3WQECNL.js → chunk-GZ3W4XBV.js} +5 -5
- package/dist/{chunk-Z7ROEU4E.js → chunk-JIAYIGQW.js} +5 -5
- package/dist/{chunk-3PBQDKPK.js → chunk-LATZTP6I.js} +5 -5
- package/dist/{chunk-QDOMMF5G.js → chunk-MDOYAOLV.js} +19 -19
- package/dist/{chunk-YNPUNJMZ.js → chunk-NM5GRZUZ.js} +8 -8
- package/dist/{chunk-WVGKD3KM.js → chunk-NYIQRUZG.js} +5 -5
- package/dist/{chunk-CCGCZ6T3.js → chunk-OFTYL4FA.js} +8 -8
- package/dist/{chunk-BNRRMKGX.js → chunk-PC46MJ4M.js} +8 -8
- package/dist/{chunk-GUD2WGWW.js → chunk-PDG6GFQR.js} +5 -5
- package/dist/{chunk-5RRTA2GZ.js → chunk-PWZWCXZX.js} +24 -795
- package/dist/chunk-QIVUAERL.js +2202 -0
- package/dist/chunk-QJZIYUVB.js +110 -0
- package/dist/{chunk-KNBPQSE7.js → chunk-RFYKY4ZX.js} +7 -7
- package/dist/{chunk-UFZF4RUO.js → chunk-RROXH3J7.js} +8 -35
- package/dist/{chunk-UQJVO3AP.js → chunk-SHCCLLD3.js} +5 -5
- package/dist/{chunk-HRCVABJC.js → chunk-SM6BW5WS.js} +5 -5
- package/dist/{chunk-MIOYH7IR.js → chunk-T2RTHBYQ.js} +4 -4
- package/dist/chunk-TFSZCVKC.js +166 -0
- package/dist/chunk-V2VWODV3.js +54 -0
- package/dist/{chunk-YARHADMO.js → chunk-Y673TJNF.js} +5 -5
- package/dist/cli/checkUnsupportedDataProxy.js +12 -12
- package/dist/cli/getSchema.js +17 -17
- package/dist/cli/hashes.js +12 -12
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +11 -11
- package/dist/engine-commands/getConfig.js +10 -10
- package/dist/engine-commands/getDmmf.js +7 -7
- package/dist/engine-commands/index.js +20 -20
- 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/get-generators/generatorResolvers/generatorResolvers.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +12 -12
- package/dist/get-generators/getGenerators.js +14 -14
- package/dist/index.js +39 -39
- package/dist/sendPanic.js +11 -11
- package/dist/utils/getEnvPaths.js +11 -11
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +11 -11
- package/dist/utils/loadEnvFile.js +11 -11
- package/dist/wasm.js +4 -4
- package/package.json +8 -8
@@ -0,0 +1,110 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var chunk_QJZIYUVB_exports = {};
|
30
|
+
__export(chunk_QJZIYUVB_exports, {
|
31
|
+
BinaryType: () => import_fetch_engine.BinaryType,
|
32
|
+
engineEnvVarMap: () => import_fetch_engine.engineEnvVarMap,
|
33
|
+
maybeCopyToTmp: () => maybeCopyToTmp,
|
34
|
+
resolveBinary: () => resolveBinary,
|
35
|
+
safeResolveBinary: () => safeResolveBinary
|
36
|
+
});
|
37
|
+
module.exports = __toCommonJS(chunk_QJZIYUVB_exports);
|
38
|
+
var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
|
39
|
+
var import_chunk_QIVUAERL = require("./chunk-QIVUAERL.js");
|
40
|
+
var import_chunk_TWSLDIFL = require("./chunk-TWSLDIFL.js");
|
41
|
+
var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
|
42
|
+
var import_chunk_TZCE3PWZ = require("./chunk-TZCE3PWZ.js");
|
43
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
44
|
+
var import_engines = require("@prisma/engines");
|
45
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
46
|
+
var import_get_platform = require("@prisma/get-platform");
|
47
|
+
var import_fs = __toESM2(require("fs"));
|
48
|
+
var import_path = __toESM2(require("path"));
|
49
|
+
var import_fs_extra = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_QIVUAERL.require_lib)());
|
50
|
+
var import_temp_dir = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_TZCE3PWZ.require_temp_dir)());
|
51
|
+
async function getBinaryName(name) {
|
52
|
+
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
53
|
+
const extension = binaryTarget === "windows" ? ".exe" : "";
|
54
|
+
if (name === import_fetch_engine.BinaryType.QueryEngineLibrary) {
|
55
|
+
return (0, import_get_platform.getNodeAPIName)(binaryTarget, "fs");
|
56
|
+
}
|
57
|
+
return `${name}-${binaryTarget}${extension}`;
|
58
|
+
}
|
59
|
+
async function resolveBinary(name, proposedPath) {
|
60
|
+
if (proposedPath && !proposedPath.match(import_chunk_M3GBKLGE.vercelPkgPathRegex) && import_fs.default.existsSync(proposedPath)) {
|
61
|
+
return proposedPath;
|
62
|
+
}
|
63
|
+
const pathFromEnvVar = (0, import_fetch_engine.getBinaryEnvVarPath)(name);
|
64
|
+
if (pathFromEnvVar !== null) {
|
65
|
+
return pathFromEnvVar.path;
|
66
|
+
}
|
67
|
+
const binaryName = await getBinaryName(name);
|
68
|
+
const prismaPath = import_path.default.join((0, import_engines.getEnginesPath)(), binaryName);
|
69
|
+
if (import_fs.default.existsSync(prismaPath)) {
|
70
|
+
return maybeCopyToTmp(prismaPath);
|
71
|
+
}
|
72
|
+
const prismaPath2 = import_path.default.join(__dirname, "..", binaryName);
|
73
|
+
if (import_fs.default.existsSync(prismaPath2)) {
|
74
|
+
return maybeCopyToTmp(prismaPath2);
|
75
|
+
}
|
76
|
+
const prismaPath3 = import_path.default.join(__dirname, "../..", binaryName);
|
77
|
+
if (import_fs.default.existsSync(prismaPath3)) {
|
78
|
+
return maybeCopyToTmp(prismaPath3);
|
79
|
+
}
|
80
|
+
const prismaPath4 = import_path.default.join(__dirname, "../runtime", binaryName);
|
81
|
+
if (import_fs.default.existsSync(prismaPath4)) {
|
82
|
+
return maybeCopyToTmp(prismaPath4);
|
83
|
+
}
|
84
|
+
throw new Error(
|
85
|
+
`Could not find ${name} binary. Searched in:
|
86
|
+
- ${prismaPath}
|
87
|
+
- ${prismaPath2}
|
88
|
+
- ${prismaPath3}
|
89
|
+
- ${prismaPath4}`
|
90
|
+
);
|
91
|
+
}
|
92
|
+
function safeResolveBinary(name, proposedPath) {
|
93
|
+
return (0, import_chunk_7MD6344A.tryCatch2)(
|
94
|
+
() => resolveBinary(name, proposedPath),
|
95
|
+
(error) => error
|
96
|
+
);
|
97
|
+
}
|
98
|
+
async function maybeCopyToTmp(file) {
|
99
|
+
const dir = eval("__dirname");
|
100
|
+
if (dir.match(import_chunk_M3GBKLGE.vercelPkgPathRegex)) {
|
101
|
+
const targetDir = import_path.default.join(import_temp_dir.default, "prisma-binaries");
|
102
|
+
await (0, import_fs_extra.ensureDir)(targetDir);
|
103
|
+
const target = import_path.default.join(targetDir, import_path.default.basename(file));
|
104
|
+
const data = await import_fs.default.promises.readFile(file);
|
105
|
+
await import_fs.default.promises.writeFile(target, data);
|
106
|
+
(0, import_chunk_TWSLDIFL.chmodPlusX)(target);
|
107
|
+
return target;
|
108
|
+
}
|
109
|
+
return file;
|
110
|
+
}
|
@@ -26,19 +26,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_RFYKY4ZX_exports = {};
|
30
|
+
__export(chunk_RFYKY4ZX_exports, {
|
31
31
|
MergeSchemasError: () => MergeSchemasError,
|
32
32
|
mergeSchemas: () => mergeSchemas
|
33
33
|
});
|
34
|
-
module.exports = __toCommonJS(
|
34
|
+
module.exports = __toCommonJS(chunk_RFYKY4ZX_exports);
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
36
36
|
var import_chunk_I4467NNA = require("./chunk-I4467NNA.js");
|
37
37
|
var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
|
38
|
-
var
|
38
|
+
var import_chunk_LATZTP6I = require("./chunk-LATZTP6I.js");
|
39
39
|
var import_chunk_PFLLVWZX = require("./chunk-PFLLVWZX.js");
|
40
40
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
41
|
-
var
|
41
|
+
var import_chunk_SM6BW5WS = require("./chunk-SM6BW5WS.js");
|
42
42
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
43
43
|
var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
|
44
44
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
@@ -60,7 +60,7 @@ ${detailsHeader} ${message}`;
|
|
60
60
|
}).exhaustive();
|
61
61
|
const errorMessageWithContext = `${constructedErrorMessage}
|
62
62
|
[Context: mergeSchemas]`;
|
63
|
-
super((0,
|
63
|
+
super((0, import_chunk_LATZTP6I.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
64
64
|
this.name = "MergeSchemasError";
|
65
65
|
}
|
66
66
|
};
|
@@ -73,7 +73,7 @@ function mergeSchemas(options) {
|
|
73
73
|
const params = JSON.stringify({
|
74
74
|
schema: options.schemas
|
75
75
|
});
|
76
|
-
return
|
76
|
+
return import_chunk_SM6BW5WS.prismaSchemaWasm.merge_schemas(params);
|
77
77
|
},
|
78
78
|
(e) => ({
|
79
79
|
type: "wasm-error",
|
@@ -26,18 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_RROXH3J7_exports = {};
|
30
|
+
__export(chunk_RROXH3J7_exports, {
|
31
31
|
GetDmmfError: () => GetDmmfError,
|
32
32
|
getDMMF: () => getDMMF
|
33
33
|
});
|
34
|
-
module.exports = __toCommonJS(
|
34
|
+
module.exports = __toCommonJS(chunk_RROXH3J7_exports);
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
36
36
|
var import_chunk_I4467NNA = require("./chunk-I4467NNA.js");
|
37
|
-
var
|
37
|
+
var import_chunk_SHCCLLD3 = require("./chunk-SHCCLLD3.js");
|
38
38
|
var import_chunk_PFLLVWZX = require("./chunk-PFLLVWZX.js");
|
39
39
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
40
|
-
var
|
40
|
+
var import_chunk_NYIQRUZG = require("./chunk-NYIQRUZG.js");
|
41
41
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
42
42
|
var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
|
43
43
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
@@ -60,12 +60,11 @@ ${detailsHeader} ${message}`;
|
|
60
60
|
}).exhaustive();
|
61
61
|
const errorMessageWithContext = `${constructedErrorMessage}
|
62
62
|
[Context: getDmmf]`;
|
63
|
-
super((0,
|
63
|
+
super((0, import_chunk_SHCCLLD3.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
64
64
|
this.name = "GetDmmfError";
|
65
65
|
}
|
66
66
|
};
|
67
67
|
async function getDMMF(options) {
|
68
|
-
warnOnDeprecatedFeatureFlag(options.previewFeatures);
|
69
68
|
const debugErrorType = (0, import_chunk_I4467NNA.createDebugErrorType)(debug, "getDmmfWasm");
|
70
69
|
debug(`Using getDmmf Wasm`);
|
71
70
|
const dmmfPipeline = (0, import_function.pipe)(
|
@@ -91,13 +90,13 @@ async function getDMMF(options) {
|
|
91
90
|
() => {
|
92
91
|
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
|
93
92
|
debug("Triggering a Rust panic...");
|
94
|
-
|
93
|
+
import_chunk_NYIQRUZG.prismaSchemaWasm.debug_panic();
|
95
94
|
}
|
96
95
|
const params = JSON.stringify({
|
97
96
|
prismaSchema: datamodel,
|
98
97
|
noColor: Boolean(process.env.NO_COLOR)
|
99
98
|
});
|
100
|
-
const data =
|
99
|
+
const data = import_chunk_NYIQRUZG.prismaSchemaWasm.get_dmmf(params);
|
101
100
|
return data;
|
102
101
|
},
|
103
102
|
(e) => ({
|
@@ -165,29 +164,3 @@ Datamodel path: "${e.datamodelPath}"`,
|
|
165
164
|
}).exhaustive();
|
166
165
|
throw error;
|
167
166
|
}
|
168
|
-
function warnOnDeprecatedFeatureFlag(previewFeatures) {
|
169
|
-
const getMessage = (flag) => `${(0, import_chunk_PG5FDKSF.blue)((0, import_chunk_PG5FDKSF.bold)("info"))} The preview flag "${flag}" is not needed anymore, please remove it from your schema.prisma`;
|
170
|
-
const removedFeatureFlagMap = {
|
171
|
-
insensitiveFilters: getMessage("insensitiveFilters"),
|
172
|
-
atomicNumberOperations: getMessage("atomicNumberOperations"),
|
173
|
-
connectOrCreate: getMessage("connectOrCreate"),
|
174
|
-
transaction: getMessage("transaction"),
|
175
|
-
nApi: getMessage("nApi"),
|
176
|
-
transactionApi: getMessage("transactionApi"),
|
177
|
-
uncheckedScalarInputs: getMessage("uncheckedScalarInputs"),
|
178
|
-
nativeTypes: getMessage("nativeTypes"),
|
179
|
-
createMany: getMessage("createMany"),
|
180
|
-
groupBy: getMessage("groupBy"),
|
181
|
-
referentialActions: getMessage("referentialActions"),
|
182
|
-
microsoftSqlServer: getMessage("microsoftSqlServer"),
|
183
|
-
selectRelationCount: getMessage("selectRelationCount"),
|
184
|
-
orderByRelation: getMessage("orderByRelation"),
|
185
|
-
orderByAggregateGroup: getMessage("orderByAggregateGroup")
|
186
|
-
};
|
187
|
-
previewFeatures?.forEach((f) => {
|
188
|
-
const removedMessage = removedFeatureFlagMap[f];
|
189
|
-
if (removedMessage && !process.env.PRISMA_HIDE_PREVIEW_FLAG_WARNINGS) {
|
190
|
-
console.warn(removedMessage);
|
191
|
-
}
|
192
|
-
});
|
193
|
-
}
|
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
return to;
|
17
17
|
};
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var
|
20
|
-
__export(
|
19
|
+
var chunk_SHCCLLD3_exports = {};
|
20
|
+
__export(chunk_SHCCLLD3_exports, {
|
21
21
|
addVersionDetailsToErrorMessage: () => addVersionDetailsToErrorMessage
|
22
22
|
});
|
23
|
-
module.exports = __toCommonJS(
|
24
|
-
var
|
23
|
+
module.exports = __toCommonJS(chunk_SHCCLLD3_exports);
|
24
|
+
var import_chunk_JIAYIGQW = require("./chunk-JIAYIGQW.js");
|
25
25
|
var import_chunk_QN6PSQY7 = require("./chunk-QN6PSQY7.js");
|
26
26
|
function addVersionDetailsToErrorMessage(message) {
|
27
|
-
const rows = [["Prisma CLI Version",
|
27
|
+
const rows = [["Prisma CLI Version", import_chunk_JIAYIGQW.version]];
|
28
28
|
return `${message}
|
29
29
|
|
30
30
|
${(0, import_chunk_QN6PSQY7.formatTable)(rows)}`;
|
@@ -26,14 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_SM6BW5WS_exports = {};
|
30
|
+
__export(chunk_SM6BW5WS_exports, {
|
31
31
|
prismaSchemaWasm: () => import_prisma_schema_wasm.default,
|
32
32
|
prismaSchemaWasmVersion: () => prismaSchemaWasmVersion,
|
33
33
|
wasm_exports: () => wasm_exports
|
34
34
|
});
|
35
|
-
module.exports = __toCommonJS(
|
36
|
-
var
|
35
|
+
module.exports = __toCommonJS(chunk_SM6BW5WS_exports);
|
36
|
+
var import_chunk_T2RTHBYQ = require("./chunk-T2RTHBYQ.js");
|
37
37
|
var import_chunk_HOZFIXMD = require("./chunk-HOZFIXMD.js");
|
38
38
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
39
39
|
var import_prisma_schema_wasm = __toESM(require("@prisma/prisma-schema-wasm"));
|
@@ -42,6 +42,6 @@ var wasm_exports = {};
|
|
42
42
|
prismaSchemaWasm: () => import_prisma_schema_wasm.default,
|
43
43
|
prismaSchemaWasmVersion: () => prismaSchemaWasmVersion
|
44
44
|
});
|
45
|
-
var { dependencies } = (0,
|
45
|
+
var { dependencies } = (0, import_chunk_T2RTHBYQ.require_package)();
|
46
46
|
var prismaSchemaWasmVersion = dependencies["@prisma/prisma-schema-wasm"];
|
47
47
|
globalThis.PRISMA_WASM_PANIC_REGISTRY = new import_chunk_HOZFIXMD.WasmPanicRegistry();
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
return to;
|
17
17
|
};
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var
|
20
|
-
__export(
|
19
|
+
var chunk_T2RTHBYQ_exports = {};
|
20
|
+
__export(chunk_T2RTHBYQ_exports, {
|
21
21
|
require_package: () => require_package
|
22
22
|
});
|
23
|
-
module.exports = __toCommonJS(
|
23
|
+
module.exports = __toCommonJS(chunk_T2RTHBYQ_exports);
|
24
24
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
25
25
|
var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
26
26
|
"package.json"(exports, module2) {
|
@@ -111,7 +111,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
111
111
|
"@prisma/fetch-engine": "workspace:*",
|
112
112
|
"@prisma/generator-helper": "workspace:*",
|
113
113
|
"@prisma/get-platform": "workspace:*",
|
114
|
-
"@prisma/prisma-schema-wasm": "6.1.0-
|
114
|
+
"@prisma/prisma-schema-wasm": "6.1.0-5.c74f8976aaa3212c16a61537319f9024d0c21e85",
|
115
115
|
"@prisma/schema-files-loader": "workspace:*",
|
116
116
|
arg: "5.0.2",
|
117
117
|
prompts: "2.4.2"
|
@@ -0,0 +1,166 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var chunk_TFSZCVKC_exports = {};
|
20
|
+
__export(chunk_TFSZCVKC_exports, {
|
21
|
+
SchemaEngineExitCode: () => SchemaEngineExitCode,
|
22
|
+
canConnectToDatabase: () => canConnectToDatabase,
|
23
|
+
createDatabase: () => createDatabase,
|
24
|
+
dropDatabase: () => dropDatabase,
|
25
|
+
execaCommand: () => execaCommand
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(chunk_TFSZCVKC_exports);
|
28
|
+
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
29
|
+
var import_chunk_QJZIYUVB = require("./chunk-QJZIYUVB.js");
|
30
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
31
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
32
|
+
var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
|
33
|
+
var SchemaEngineExitCode = /* @__PURE__ */ ((SchemaEngineExitCode2) => {
|
34
|
+
SchemaEngineExitCode2[SchemaEngineExitCode2["Success"] = 0] = "Success";
|
35
|
+
SchemaEngineExitCode2[SchemaEngineExitCode2["Error"] = 1] = "Error";
|
36
|
+
SchemaEngineExitCode2[SchemaEngineExitCode2["Panic"] = 101] = "Panic";
|
37
|
+
return SchemaEngineExitCode2;
|
38
|
+
})(SchemaEngineExitCode || {});
|
39
|
+
function parseJsonFromStderr(stderr) {
|
40
|
+
const lines = stderr.split(/\r?\n/).slice(1);
|
41
|
+
const logs = [];
|
42
|
+
for (const line of lines) {
|
43
|
+
const data = String(line);
|
44
|
+
try {
|
45
|
+
const json = JSON.parse(data);
|
46
|
+
logs.push(json);
|
47
|
+
} catch (e) {
|
48
|
+
throw new Error(`Could not parse schema engine response: ${e}`);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return logs;
|
52
|
+
}
|
53
|
+
async function canConnectToDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
|
54
|
+
if (!connectionString) {
|
55
|
+
throw new Error(
|
56
|
+
"Connection url is empty. See https://www.prisma.io/docs/reference/database-reference/connection-urls"
|
57
|
+
);
|
58
|
+
}
|
59
|
+
try {
|
60
|
+
await execaCommand({
|
61
|
+
connectionString,
|
62
|
+
cwd,
|
63
|
+
schemaEnginePath,
|
64
|
+
engineCommandName: "can-connect-to-database"
|
65
|
+
});
|
66
|
+
} catch (_e) {
|
67
|
+
const e = _e;
|
68
|
+
if (e.stderr) {
|
69
|
+
const logs = parseJsonFromStderr(e.stderr);
|
70
|
+
const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
|
71
|
+
if (error && error.fields.error_code && error.fields.message) {
|
72
|
+
return {
|
73
|
+
code: error.fields.error_code,
|
74
|
+
message: error.fields.message
|
75
|
+
};
|
76
|
+
} else {
|
77
|
+
throw new Error(`Schema engine error:
|
78
|
+
${logs.map((log) => log.fields.message).join("\n")}`);
|
79
|
+
}
|
80
|
+
} else {
|
81
|
+
throw new Error(`Schema engine exited. ${_e}`);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
async function createDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
|
87
|
+
const dbExists = await canConnectToDatabase(connectionString, cwd, schemaEnginePath);
|
88
|
+
if (dbExists === true) {
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
try {
|
92
|
+
await execaCommand({
|
93
|
+
connectionString,
|
94
|
+
cwd,
|
95
|
+
schemaEnginePath,
|
96
|
+
engineCommandName: "create-database"
|
97
|
+
});
|
98
|
+
return true;
|
99
|
+
} catch (_e) {
|
100
|
+
const e = _e;
|
101
|
+
if (e.stderr) {
|
102
|
+
const logs = parseJsonFromStderr(e.stderr);
|
103
|
+
const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
|
104
|
+
if (error && error.fields.error_code && error.fields.message) {
|
105
|
+
throw new Error(`${error.fields.error_code}: ${error.fields.message}`);
|
106
|
+
} else {
|
107
|
+
throw new Error(`Schema engine error:
|
108
|
+
${logs.map((log) => log.fields.message).join("\n")}`);
|
109
|
+
}
|
110
|
+
} else {
|
111
|
+
throw new Error(`Schema engine exited. ${_e}`);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
async function dropDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
|
116
|
+
try {
|
117
|
+
const result = await execaCommand({
|
118
|
+
connectionString,
|
119
|
+
cwd,
|
120
|
+
schemaEnginePath,
|
121
|
+
engineCommandName: "drop-database"
|
122
|
+
});
|
123
|
+
if (result && result.exitCode === 0 && result.stderr.includes("The database was successfully dropped")) {
|
124
|
+
return true;
|
125
|
+
} else {
|
126
|
+
throw Error(`An error occurred during the drop: ${JSON.stringify(result, void 0, 2)}`);
|
127
|
+
}
|
128
|
+
} catch (e) {
|
129
|
+
if (e.stderr) {
|
130
|
+
const logs = parseJsonFromStderr(e.stderr);
|
131
|
+
throw new Error(`Schema engine error:
|
132
|
+
${logs.map((log) => log.fields.message).join("\n")}`);
|
133
|
+
} else {
|
134
|
+
throw new Error(`Schema engine exited. ${e}`);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
async function execaCommand({
|
139
|
+
connectionString,
|
140
|
+
cwd,
|
141
|
+
schemaEnginePath,
|
142
|
+
engineCommandName
|
143
|
+
}) {
|
144
|
+
schemaEnginePath = schemaEnginePath || await (0, import_chunk_QJZIYUVB.resolveBinary)(import_fetch_engine.BinaryType.SchemaEngineBinary);
|
145
|
+
try {
|
146
|
+
return await (0, import_execa.default)(schemaEnginePath, ["cli", "--datasource", connectionString, engineCommandName], {
|
147
|
+
cwd,
|
148
|
+
env: {
|
149
|
+
RUST_BACKTRACE: process.env.RUST_BACKTRACE ?? "1",
|
150
|
+
RUST_LOG: process.env.RUST_LOG ?? "info"
|
151
|
+
}
|
152
|
+
});
|
153
|
+
} catch (_e) {
|
154
|
+
const e = _e;
|
155
|
+
if (e.message) {
|
156
|
+
e.message = e.message.replace(connectionString, "<REDACTED>");
|
157
|
+
}
|
158
|
+
if (e.stdout) {
|
159
|
+
e.stdout = e.stdout.replace(connectionString, "<REDACTED>");
|
160
|
+
}
|
161
|
+
if (e.stderr) {
|
162
|
+
e.stderr = e.stderr.replace(connectionString, "<REDACTED>");
|
163
|
+
}
|
164
|
+
throw e;
|
165
|
+
}
|
166
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var chunk_V2VWODV3_exports = {};
|
20
|
+
__export(chunk_V2VWODV3_exports, {
|
21
|
+
getEngineVersion: () => getEngineVersion,
|
22
|
+
safeGetEngineVersion: () => safeGetEngineVersion
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(chunk_V2VWODV3_exports);
|
25
|
+
var import_chunk_S4LINK5Y = require("./chunk-S4LINK5Y.js");
|
26
|
+
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
27
|
+
var import_chunk_QJZIYUVB = require("./chunk-QJZIYUVB.js");
|
28
|
+
var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
|
29
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
30
|
+
var import_engines = require("@prisma/engines");
|
31
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
32
|
+
var import_get_platform = require("@prisma/get-platform");
|
33
|
+
var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
|
34
|
+
async function getEngineVersion(enginePath, binaryName) {
|
35
|
+
if (!binaryName) {
|
36
|
+
binaryName = (0, import_engines.getCliQueryEngineBinaryType)();
|
37
|
+
}
|
38
|
+
enginePath = await (0, import_chunk_QJZIYUVB.resolveBinary)(binaryName, enginePath);
|
39
|
+
const platformInfo = await (0, import_get_platform.getPlatformInfo)();
|
40
|
+
if (binaryName === import_fetch_engine.BinaryType.QueryEngineLibrary) {
|
41
|
+
(0, import_get_platform.assertNodeAPISupported)();
|
42
|
+
const QE = (0, import_chunk_S4LINK5Y.loadLibrary)(enginePath, platformInfo);
|
43
|
+
return `${import_fetch_engine.BinaryType.QueryEngineLibrary} ${QE.version().commit}`;
|
44
|
+
} else {
|
45
|
+
const { stdout } = await (0, import_execa.default)(enginePath, ["--version"]);
|
46
|
+
return stdout;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
function safeGetEngineVersion(enginePath, binaryName) {
|
50
|
+
return (0, import_chunk_7MD6344A.tryCatch2)(
|
51
|
+
() => getEngineVersion(enginePath, binaryName),
|
52
|
+
(error) => error
|
53
|
+
);
|
54
|
+
}
|
@@ -16,21 +16,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
return to;
|
17
17
|
};
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var
|
20
|
-
__export(
|
19
|
+
var chunk_Y673TJNF_exports = {};
|
20
|
+
__export(chunk_Y673TJNF_exports, {
|
21
21
|
getLintWarnings: () => getLintWarnings,
|
22
22
|
getLintWarningsAsText: () => getLintWarningsAsText,
|
23
23
|
handleLintPanic: () => handleLintPanic,
|
24
24
|
lintSchema: () => lintSchema,
|
25
25
|
warningToString: () => warningToString
|
26
26
|
});
|
27
|
-
module.exports = __toCommonJS(
|
27
|
+
module.exports = __toCommonJS(chunk_Y673TJNF_exports);
|
28
28
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
29
|
-
var
|
29
|
+
var import_chunk_NYIQRUZG = require("./chunk-NYIQRUZG.js");
|
30
30
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
31
31
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
32
32
|
function lintSchema({ schemas }) {
|
33
|
-
const lintResult =
|
33
|
+
const lintResult = import_chunk_NYIQRUZG.prismaSchemaWasm.lint(JSON.stringify(schemas));
|
34
34
|
const lintDiagnostics = JSON.parse(lintResult);
|
35
35
|
return lintDiagnostics;
|
36
36
|
}
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
19
|
var checkUnsupportedDataProxy_exports = {};
|
20
20
|
__export(checkUnsupportedDataProxy_exports, {
|
21
|
-
checkUnsupportedDataProxy: () =>
|
22
|
-
forbiddenCmdWithDataProxyFlagMessage: () =>
|
21
|
+
checkUnsupportedDataProxy: () => import_chunk_MDOYAOLV.checkUnsupportedDataProxy,
|
22
|
+
forbiddenCmdWithDataProxyFlagMessage: () => import_chunk_MDOYAOLV.forbiddenCmdWithDataProxyFlagMessage
|
23
23
|
});
|
24
24
|
module.exports = __toCommonJS(checkUnsupportedDataProxy_exports);
|
25
|
-
var
|
25
|
+
var import_chunk_MDOYAOLV = require("../chunk-MDOYAOLV.js");
|
26
26
|
var import_chunk_77IC3DNO = require("../chunk-77IC3DNO.js");
|
27
27
|
var import_chunk_MGZOEY6N = require("../chunk-MGZOEY6N.js");
|
28
28
|
var import_chunk_S57RMXZW = require("../chunk-S57RMXZW.js");
|
@@ -74,21 +74,21 @@ var import_chunk_IL7PSY44 = require("../chunk-IL7PSY44.js");
|
|
74
74
|
var import_chunk_AOQIUJT4 = require("../chunk-AOQIUJT4.js");
|
75
75
|
var import_chunk_L6KOIJJ5 = require("../chunk-L6KOIJJ5.js");
|
76
76
|
var import_chunk_NIWBAJZV = require("../chunk-NIWBAJZV.js");
|
77
|
-
var
|
78
|
-
var
|
79
|
-
var
|
77
|
+
var import_chunk_Y673TJNF = require("../chunk-Y673TJNF.js");
|
78
|
+
var import_chunk_GNMI6KU5 = require("../chunk-GNMI6KU5.js");
|
79
|
+
var import_chunk_ARAZIXTI = require("../chunk-ARAZIXTI.js");
|
80
80
|
var import_chunk_TQCLUNM2 = require("../chunk-TQCLUNM2.js");
|
81
81
|
var import_chunk_OIVPX3BR = require("../chunk-OIVPX3BR.js");
|
82
82
|
var import_chunk_CYAS6B5N = require("../chunk-CYAS6B5N.js");
|
83
83
|
var import_chunk_HPVMQFIY = require("../chunk-HPVMQFIY.js");
|
84
84
|
var import_chunk_E23HYCQJ = require("../chunk-E23HYCQJ.js");
|
85
|
-
var
|
86
|
-
var
|
85
|
+
var import_chunk_OFTYL4FA = require("../chunk-OFTYL4FA.js");
|
86
|
+
var import_chunk_RROXH3J7 = require("../chunk-RROXH3J7.js");
|
87
87
|
var import_chunk_YRBRUREX = require("../chunk-YRBRUREX.js");
|
88
88
|
var import_chunk_I4467NNA = require("../chunk-I4467NNA.js");
|
89
89
|
var import_chunk_C47SCASR = require("../chunk-C47SCASR.js");
|
90
|
-
var
|
91
|
-
var
|
90
|
+
var import_chunk_SHCCLLD3 = require("../chunk-SHCCLLD3.js");
|
91
|
+
var import_chunk_JIAYIGQW = require("../chunk-JIAYIGQW.js");
|
92
92
|
var import_chunk_QN6PSQY7 = require("../chunk-QN6PSQY7.js");
|
93
93
|
var import_chunk_JMZHUHCC = require("../chunk-JMZHUHCC.js");
|
94
94
|
var import_chunk_PFLLVWZX = require("../chunk-PFLLVWZX.js");
|
@@ -96,8 +96,8 @@ var import_chunk_G7LL2H2O = require("../chunk-G7LL2H2O.js");
|
|
96
96
|
var import_chunk_S4LINK5Y = require("../chunk-S4LINK5Y.js");
|
97
97
|
var import_chunk_J4MA2JIK = require("../chunk-J4MA2JIK.js");
|
98
98
|
var import_chunk_H3T4L34H = require("../chunk-H3T4L34H.js");
|
99
|
-
var
|
100
|
-
var
|
99
|
+
var import_chunk_NYIQRUZG = require("../chunk-NYIQRUZG.js");
|
100
|
+
var import_chunk_GZ3W4XBV = require("../chunk-GZ3W4XBV.js");
|
101
101
|
var import_chunk_6JE6QGSJ = require("../chunk-6JE6QGSJ.js");
|
102
102
|
var import_chunk_P6VBFLWR = require("../chunk-P6VBFLWR.js");
|
103
103
|
var import_chunk_XYCIH36R = require("../chunk-XYCIH36R.js");
|