@prisma/internals 5.19.0-integration-feat-typed-sql.1 → 5.19.0-integration-feat-typed-sql.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/{chunk-TXN4P2UY.js → chunk-2MV6JFB4.js} +7 -7
- package/dist/{chunk-WO5ENZU5.js → chunk-2MWIMEFK.js} +7 -7
- package/dist/{chunk-EYOPVHNV.js → chunk-3L4K6SFM.js} +7 -7
- package/dist/{chunk-QL3K6JIN.js → chunk-3VLJQQOA.js} +5 -5
- package/dist/{chunk-7OGLT63S.js → chunk-4SZRVZQO.js} +5 -5
- package/dist/chunk-5XRQ7ONW.js +122 -0
- package/dist/{chunk-PN2OFBAO.js → chunk-AYHYONDC.js} +5 -5
- package/dist/{chunk-OEXSUUW2.js → chunk-BGFWFIPR.js} +5 -5
- package/dist/{chunk-2HHWV7NR.js → chunk-CQHQ4JUN.js} +8 -8
- package/dist/chunk-CSV3AVJ4.js +177 -0
- package/dist/{chunk-5ACIJBB4.js → chunk-GRUJOQGE.js} +8 -8
- package/dist/{chunk-YFTWQDWC.js → chunk-ICI3HEHW.js} +5 -5
- package/dist/{chunk-INKUPLJ6.js → chunk-IEVQOUVE.js} +8 -8
- package/dist/{chunk-U5T2ALDL.js → chunk-IINMWKBZ.js} +8 -8
- package/dist/chunk-JD6UDOYA.js +54 -0
- package/dist/{chunk-PAX5TFEC.js → chunk-JSFAZ43I.js} +8 -8
- package/dist/chunk-JXQEYT4S.js +110 -0
- package/dist/{chunk-EV4E5GN6.js → chunk-LNF7AUE3.js} +27 -27
- package/dist/chunk-LZIL2VER.js +166 -0
- package/dist/{chunk-LVR5RA7C.js → chunk-NJB3A2FL.js} +5 -4
- package/dist/{chunk-ULQYCMW4.js → chunk-NM7ATUD2.js} +32 -803
- package/dist/chunk-NRYEKFWP.js +96 -0
- package/dist/chunk-QIVUAERL.js +2202 -0
- package/dist/{chunk-5S6LK7V2.js → chunk-RFDXHMHL.js} +7 -7
- package/dist/{chunk-SQX67EBR.js → chunk-RH2QBFDQ.js} +5 -5
- package/dist/{chunk-3LVVD3OG.js → chunk-SD47M7EE.js} +5 -5
- package/dist/{chunk-EIEZZJYX.js → chunk-SMYEIQP2.js} +5 -5
- package/dist/{chunk-D7HXSF3S.js → chunk-SQ2IEXGU.js} +5 -5
- package/dist/{chunk-VNIE2AZB.js → chunk-TQCLUNM2.js} +4 -4
- package/dist/{chunk-HDWBT4CR.js → chunk-UFDOSVWQ.js} +4 -3
- package/dist/{chunk-NEEB3TIJ.js → chunk-WZYYLYEI.js} +5 -5
- package/dist/{chunk-VCLUGB7N.js → chunk-XIWZFSTR.js} +5 -5
- package/dist/{chunk-GHYJGM56.js → chunk-YHTJPMCB.js} +4 -4
- package/dist/{chunk-WLCAAW3G.js → chunk-YVSBIU6Z.js} +8 -8
- package/dist/cli/checkUnsupportedDataProxy.js +26 -25
- package/dist/cli/getSchema.js +31 -30
- package/dist/cli/hashes.js +26 -25
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +25 -24
- package/dist/engine-commands/getConfig.js +10 -10
- package/dist/engine-commands/getDmmf.js +7 -7
- package/dist/engine-commands/getEngineVersion.js +5 -5
- package/dist/engine-commands/getEnginesMetaInfo.js +7 -7
- package/dist/engine-commands/index.js +36 -35
- 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 +25 -24
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +25 -24
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +25 -24
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +26 -25
- package/dist/get-generators/getGenerators.js +28 -27
- package/dist/highlight/highlight.js +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +67 -65
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +25 -24
- package/dist/utils/getEnvPaths.js +25 -24
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +25 -24
- package/dist/utils/isValidJsIdentifier.d.ts +1 -0
- package/dist/utils/isValidJsIdentifier.js +25 -0
- package/dist/utils/loadEnvFile.js +25 -24
- package/dist/utils/missingDatasource.js +4 -4
- package/dist/utils/missingGeneratorMessage.js +6 -6
- package/dist/wasm.js +4 -4
- package/package.json +8 -7
|
@@ -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_ICI3HEHW_exports = {};
|
|
20
|
+
__export(chunk_ICI3HEHW_exports, {
|
|
21
21
|
version: () => version
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
25
|
-
var packageJson = (0,
|
|
23
|
+
module.exports = __toCommonJS(chunk_ICI3HEHW_exports);
|
|
24
|
+
var import_chunk_UFDOSVWQ = require("./chunk-UFDOSVWQ.js");
|
|
25
|
+
var packageJson = (0, import_chunk_UFDOSVWQ.require_package)();
|
|
26
26
|
var version = packageJson.version;
|
|
@@ -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_IEVQOUVE_exports = {};
|
|
30
|
+
__export(chunk_IEVQOUVE_exports, {
|
|
31
31
|
ValidateError: () => ValidateError,
|
|
32
32
|
validate: () => validate
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_IEVQOUVE_exports);
|
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
36
36
|
var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
|
|
37
37
|
var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_RH2QBFDQ = require("./chunk-RH2QBFDQ.js");
|
|
39
39
|
var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
|
|
40
40
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
41
|
-
var
|
|
41
|
+
var import_chunk_4SZRVZQO = require("./chunk-4SZRVZQO.js");
|
|
42
42
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
43
43
|
var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.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: validate]`;
|
|
63
|
-
super((0,
|
|
63
|
+
super((0, import_chunk_RH2QBFDQ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
64
64
|
this.name = "ValidateError";
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -72,13 +72,13 @@ function validate(options) {
|
|
|
72
72
|
() => {
|
|
73
73
|
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
|
|
74
74
|
debug("Triggering a Rust panic...");
|
|
75
|
-
|
|
75
|
+
import_chunk_4SZRVZQO.prismaSchemaWasm.debug_panic();
|
|
76
76
|
}
|
|
77
77
|
const params = JSON.stringify({
|
|
78
78
|
prismaSchema: options.schemas,
|
|
79
79
|
noColor: Boolean(process.env.NO_COLOR)
|
|
80
80
|
});
|
|
81
|
-
|
|
81
|
+
import_chunk_4SZRVZQO.prismaSchemaWasm.validate(params);
|
|
82
82
|
},
|
|
83
83
|
(e) => ({
|
|
84
84
|
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_IINMWKBZ_exports = {};
|
|
30
|
+
__export(chunk_IINMWKBZ_exports, {
|
|
31
31
|
GetDmmfError: () => GetDmmfError,
|
|
32
32
|
getDMMF: () => getDMMF
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_IINMWKBZ_exports);
|
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
36
36
|
var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
|
|
37
|
-
var
|
|
37
|
+
var import_chunk_RH2QBFDQ = require("./chunk-RH2QBFDQ.js");
|
|
38
38
|
var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
|
|
39
39
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
40
|
-
var
|
|
40
|
+
var import_chunk_4SZRVZQO = require("./chunk-4SZRVZQO.js");
|
|
41
41
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
42
42
|
var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
|
|
43
43
|
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: getDmmf]`;
|
|
63
|
-
super((0,
|
|
63
|
+
super((0, import_chunk_RH2QBFDQ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
64
64
|
this.name = "GetDmmfError";
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -91,13 +91,13 @@ async function getDMMF(options) {
|
|
|
91
91
|
() => {
|
|
92
92
|
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
|
|
93
93
|
debug("Triggering a Rust panic...");
|
|
94
|
-
|
|
94
|
+
import_chunk_4SZRVZQO.prismaSchemaWasm.debug_panic();
|
|
95
95
|
}
|
|
96
96
|
const params = JSON.stringify({
|
|
97
97
|
prismaSchema: datamodel,
|
|
98
98
|
noColor: Boolean(process.env.NO_COLOR)
|
|
99
99
|
});
|
|
100
|
-
const data =
|
|
100
|
+
const data = import_chunk_4SZRVZQO.prismaSchemaWasm.get_dmmf(params);
|
|
101
101
|
return data;
|
|
102
102
|
},
|
|
103
103
|
(e) => ({
|
|
@@ -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_JD6UDOYA_exports = {};
|
|
20
|
+
__export(chunk_JD6UDOYA_exports, {
|
|
21
|
+
getEngineVersion: () => getEngineVersion,
|
|
22
|
+
safeGetEngineVersion: () => safeGetEngineVersion
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(chunk_JD6UDOYA_exports);
|
|
25
|
+
var import_chunk_S4LINK5Y = require("./chunk-S4LINK5Y.js");
|
|
26
|
+
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
|
27
|
+
var import_chunk_YHTJPMCB = require("./chunk-YHTJPMCB.js");
|
|
28
|
+
var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.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_YHTJPMCB.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_4A5ZK522.tryCatch2)(
|
|
51
|
+
() => getEngineVersion(enginePath, binaryName),
|
|
52
|
+
(error) => error
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -26,22 +26,22 @@ 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_JSFAZ43I_exports = {};
|
|
30
|
+
__export(chunk_JSFAZ43I_exports, {
|
|
31
31
|
GetConfigError: () => GetConfigError,
|
|
32
32
|
getConfig: () => getConfig,
|
|
33
33
|
getDirectUrl: () => getDirectUrl,
|
|
34
34
|
getEffectiveUrl: () => getEffectiveUrl,
|
|
35
35
|
resolveUrl: () => resolveUrl
|
|
36
36
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
37
|
+
module.exports = __toCommonJS(chunk_JSFAZ43I_exports);
|
|
38
38
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
39
39
|
var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
|
|
40
40
|
var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
|
|
41
|
-
var
|
|
41
|
+
var import_chunk_XIWZFSTR = require("./chunk-XIWZFSTR.js");
|
|
42
42
|
var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
|
|
43
43
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
44
|
-
var
|
|
44
|
+
var import_chunk_WZYYLYEI = require("./chunk-WZYYLYEI.js");
|
|
45
45
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
46
46
|
var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
|
|
47
47
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
@@ -65,7 +65,7 @@ ${detailsHeader} ${message}`;
|
|
|
65
65
|
}).exhaustive();
|
|
66
66
|
const errorMessageWithContext = `${constructedErrorMessage}
|
|
67
67
|
[Context: getConfig]`;
|
|
68
|
-
super((0,
|
|
68
|
+
super((0, import_chunk_XIWZFSTR.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
69
69
|
this.name = "GetConfigError";
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -90,7 +90,7 @@ async function getConfig(options) {
|
|
|
90
90
|
() => {
|
|
91
91
|
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {
|
|
92
92
|
debug("Triggering a Rust panic...");
|
|
93
|
-
|
|
93
|
+
import_chunk_WZYYLYEI.prismaSchemaWasm.debug_panic();
|
|
94
94
|
}
|
|
95
95
|
const params = JSON.stringify({
|
|
96
96
|
prismaSchema: options.datamodel,
|
|
@@ -98,7 +98,7 @@ async function getConfig(options) {
|
|
|
98
98
|
ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
|
|
99
99
|
env: process.env
|
|
100
100
|
});
|
|
101
|
-
const data =
|
|
101
|
+
const data = import_chunk_WZYYLYEI.prismaSchemaWasm.get_config(params);
|
|
102
102
|
return data;
|
|
103
103
|
},
|
|
104
104
|
(e) => ({
|
|
@@ -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_JXQEYT4S_exports = {};
|
|
30
|
+
__export(chunk_JXQEYT4S_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_JXQEYT4S_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_4A5ZK522 = require("./chunk-4A5ZK522.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_4A5ZK522.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,8 +26,8 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS2 = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export2(
|
|
29
|
+
var chunk_LNF7AUE3_exports = {};
|
|
30
|
+
__export2(chunk_LNF7AUE3_exports, {
|
|
31
31
|
checkTypeScriptVersion: () => checkTypeScriptVersion,
|
|
32
32
|
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
|
33
33
|
checkYarnVersion: () => checkYarnVersion,
|
|
@@ -56,38 +56,38 @@ __export2(chunk_EV4E5GN6_exports, {
|
|
|
56
56
|
sendPanic: () => sendPanic,
|
|
57
57
|
skipIndex: () => skipIndex
|
|
58
58
|
});
|
|
59
|
-
module.exports = __toCommonJS2(
|
|
59
|
+
module.exports = __toCommonJS2(chunk_LNF7AUE3_exports);
|
|
60
60
|
var import_chunk_IABMG3F4 = require("./chunk-IABMG3F4.js");
|
|
61
|
+
var import_chunk_3U2ANLD3 = require("./chunk-3U2ANLD3.js");
|
|
61
62
|
var import_chunk_FTS2IEWX = require("./chunk-FTS2IEWX.js");
|
|
62
63
|
var import_chunk_EUTJYQDW = require("./chunk-EUTJYQDW.js");
|
|
63
64
|
var import_chunk_IPKE37QC = require("./chunk-IPKE37QC.js");
|
|
64
65
|
var import_chunk_KEBDP2C3 = require("./chunk-KEBDP2C3.js");
|
|
65
|
-
var import_chunk_3U2ANLD3 = require("./chunk-3U2ANLD3.js");
|
|
66
66
|
var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
|
|
67
67
|
var import_chunk_D4MCOTL5 = require("./chunk-D4MCOTL5.js");
|
|
68
68
|
var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
|
|
69
69
|
var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
|
|
70
70
|
var import_chunk_ONHKZPSV = require("./chunk-ONHKZPSV.js");
|
|
71
|
+
var import_chunk_5V36RLCO = require("./chunk-5V36RLCO.js");
|
|
71
72
|
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
|
|
72
73
|
var import_chunk_JHQHVXIR = require("./chunk-JHQHVXIR.js");
|
|
73
74
|
var import_chunk_HMGEWJDY = require("./chunk-HMGEWJDY.js");
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var import_chunk_KDHESRKE = require("./chunk-KDHESRKE.js");
|
|
77
|
-
var import_chunk_OEXSUUW2 = require("./chunk-OEXSUUW2.js");
|
|
75
|
+
var import_chunk_BGFWFIPR = require("./chunk-BGFWFIPR.js");
|
|
76
|
+
var import_chunk_2MWIMEFK = require("./chunk-2MWIMEFK.js");
|
|
78
77
|
var import_chunk_L6GBFCXG = require("./chunk-L6GBFCXG.js");
|
|
78
|
+
var import_chunk_KDHESRKE = require("./chunk-KDHESRKE.js");
|
|
79
79
|
var import_chunk_J77ZIDXB = require("./chunk-J77ZIDXB.js");
|
|
80
80
|
var import_chunk_XLYQ6PQW = require("./chunk-XLYQ6PQW.js");
|
|
81
81
|
var import_chunk_EPJYKNCQ = require("./chunk-EPJYKNCQ.js");
|
|
82
82
|
var import_chunk_ODI3VNBD = require("./chunk-ODI3VNBD.js");
|
|
83
83
|
var import_chunk_TSJICM5S = require("./chunk-TSJICM5S.js");
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
var
|
|
84
|
+
var import_chunk_SQ2IEXGU = require("./chunk-SQ2IEXGU.js");
|
|
85
|
+
var import_chunk_RFDXHMHL = require("./chunk-RFDXHMHL.js");
|
|
86
|
+
var import_chunk_GRUJOQGE = require("./chunk-GRUJOQGE.js");
|
|
87
|
+
var import_chunk_IINMWKBZ = require("./chunk-IINMWKBZ.js");
|
|
88
88
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
89
89
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
90
|
-
var
|
|
90
|
+
var import_chunk_4SZRVZQO = require("./chunk-4SZRVZQO.js");
|
|
91
91
|
var import_chunk_MUPZUVSI = require("./chunk-MUPZUVSI.js");
|
|
92
92
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
93
93
|
var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
|
|
@@ -15517,7 +15517,7 @@ async function readSchemaFromDirectory(schemaPath2) {
|
|
|
15517
15517
|
}
|
|
15518
15518
|
const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
|
|
15519
15519
|
debug2("Loading config");
|
|
15520
|
-
const config2 = await (0,
|
|
15520
|
+
const config2 = await (0, import_chunk_GRUJOQGE.getConfig)({
|
|
15521
15521
|
datamodel: files,
|
|
15522
15522
|
ignoreEnvVarErrors: true
|
|
15523
15523
|
});
|
|
@@ -15909,8 +15909,8 @@ async function checkUnsupportedDataProxyMessage(command, args, implicitSchema) {
|
|
|
15909
15909
|
if (argName.includes("schema")) {
|
|
15910
15910
|
await loadEnvFile({ schemaPath: argValue, printMessage: false });
|
|
15911
15911
|
const datamodel = await import_fs.default.promises.readFile(argValue, "utf-8");
|
|
15912
|
-
const config2 = await (0,
|
|
15913
|
-
const url = (0,
|
|
15912
|
+
const config2 = await (0, import_chunk_GRUJOQGE.getConfig)({ datamodel, ignoreEnvVarErrors: true });
|
|
15913
|
+
const url = (0, import_chunk_GRUJOQGE.resolveUrl)((0, import_chunk_GRUJOQGE.getEffectiveUrl)(config2.datasources[0]));
|
|
15914
15914
|
if (url?.startsWith("prisma://")) {
|
|
15915
15915
|
return forbiddenCmdWithDataProxyFlagMessage(command);
|
|
15916
15916
|
}
|
|
@@ -16114,18 +16114,18 @@ async function getGenerators(options) {
|
|
|
16114
16114
|
prismaPath = binaryPathsWithEngineType[queryEngineBinaryType][binaryTarget];
|
|
16115
16115
|
}
|
|
16116
16116
|
}
|
|
16117
|
-
const config = await (0,
|
|
16117
|
+
const config = await (0, import_chunk_GRUJOQGE.getConfig)({
|
|
16118
16118
|
datamodel: schemas,
|
|
16119
16119
|
datamodelPath: schemaPath,
|
|
16120
16120
|
prismaPath,
|
|
16121
16121
|
ignoreEnvVarErrors: true
|
|
16122
16122
|
});
|
|
16123
16123
|
if (config.datasources.length === 0) {
|
|
16124
|
-
throw new Error(
|
|
16124
|
+
throw new Error(import_chunk_BGFWFIPR.missingDatasource);
|
|
16125
16125
|
}
|
|
16126
16126
|
(0, import_chunk_5FJ3MENK.printConfigWarnings)(config.warnings);
|
|
16127
16127
|
const previewFeatures = (0, import_chunk_TSJICM5S.extractPreviewFeatures)(config);
|
|
16128
|
-
const dmmf = await (0,
|
|
16128
|
+
const dmmf = await (0, import_chunk_IINMWKBZ.getDMMF)({
|
|
16129
16129
|
datamodel: schemas,
|
|
16130
16130
|
datamodelPath: schemaPath,
|
|
16131
16131
|
prismaPath,
|
|
@@ -16133,9 +16133,9 @@ async function getGenerators(options) {
|
|
|
16133
16133
|
});
|
|
16134
16134
|
if (dmmf.datamodel.models.length === 0 && !allowNoModels) {
|
|
16135
16135
|
if (config.datasources.some((d2) => d2.provider === "mongodb")) {
|
|
16136
|
-
throw new Error(
|
|
16136
|
+
throw new Error(import_chunk_2MWIMEFK.missingModelMessageMongoDB);
|
|
16137
16137
|
}
|
|
16138
|
-
throw new Error(
|
|
16138
|
+
throw new Error(import_chunk_2MWIMEFK.missingModelMessage);
|
|
16139
16139
|
}
|
|
16140
16140
|
(0, import_chunk_IPKE37QC.checkFeatureFlags)(config, options);
|
|
16141
16141
|
const generatorConfigs = filterGenerators(overrideGenerators || config.generators, generatorNames);
|
|
@@ -16186,7 +16186,7 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
|
|
|
16186
16186
|
fromEnvVar: "null"
|
|
16187
16187
|
};
|
|
16188
16188
|
}
|
|
16189
|
-
const datamodel = (0,
|
|
16189
|
+
const datamodel = (0, import_chunk_RFDXHMHL.mergeSchemas)({ schemas });
|
|
16190
16190
|
const envPaths2 = await getEnvPaths(schemaPath, { cwd: generator.output.value });
|
|
16191
16191
|
const options2 = {
|
|
16192
16192
|
datamodel,
|
|
@@ -16269,7 +16269,7 @@ generator gen {
|
|
|
16269
16269
|
debug6({ generatorBinaryPaths });
|
|
16270
16270
|
generator.setBinaryPaths(generatorBinaryPaths);
|
|
16271
16271
|
if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
|
|
16272
|
-
const customDmmf = await (0,
|
|
16272
|
+
const customDmmf = await (0, import_chunk_IINMWKBZ.getDMMF)({
|
|
16273
16273
|
datamodel: schemas,
|
|
16274
16274
|
datamodelPath: schemaPath,
|
|
16275
16275
|
prismaPath: generatorBinaryPaths[queryEngineType]?.[binaryTarget],
|
|
@@ -16567,7 +16567,7 @@ async function formatSchema({ schemas: schemas2 }, inputFormattingOptions) {
|
|
|
16567
16567
|
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
|
16568
16568
|
handleFormatPanic(
|
|
16569
16569
|
() => {
|
|
16570
|
-
|
|
16570
|
+
import_chunk_4SZRVZQO.prismaSchemaWasm.debug_panic();
|
|
16571
16571
|
},
|
|
16572
16572
|
{ schemas: schemas2 }
|
|
16573
16573
|
);
|
|
@@ -16587,12 +16587,12 @@ async function formatSchema({ schemas: schemas2 }, inputFormattingOptions) {
|
|
|
16587
16587
|
() => {
|
|
16588
16588
|
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas2), documentFormattingParams);
|
|
16589
16589
|
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
|
16590
|
-
const lintDiagnostics2 = (0,
|
|
16590
|
+
const lintDiagnostics2 = (0, import_chunk_SQ2IEXGU.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
|
16591
16591
|
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
|
16592
16592
|
},
|
|
16593
16593
|
{ schemas: schemas2 }
|
|
16594
16594
|
);
|
|
16595
|
-
const lintWarnings = (0,
|
|
16595
|
+
const lintWarnings = (0, import_chunk_SQ2IEXGU.getLintWarningsAsText)(lintDiagnostics);
|
|
16596
16596
|
if (lintWarnings && import_chunk_AZNLB67U.logger_exports.should.warn()) {
|
|
16597
16597
|
console.warn(lintWarnings);
|
|
16598
16598
|
}
|
|
@@ -16622,7 +16622,7 @@ function handleFormatPanic(tryCb, { schemas: schemas2 }) {
|
|
|
16622
16622
|
}
|
|
16623
16623
|
}
|
|
16624
16624
|
function formatWasm(schema, documentFormattingParams) {
|
|
16625
|
-
const formattedSchema =
|
|
16625
|
+
const formattedSchema = import_chunk_4SZRVZQO.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
|
16626
16626
|
return formattedSchema;
|
|
16627
16627
|
}
|
|
16628
16628
|
/*! Bundled license information:
|
|
@@ -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_LZIL2VER_exports = {};
|
|
20
|
+
__export(chunk_LZIL2VER_exports, {
|
|
21
|
+
SchemaEngineExitCode: () => SchemaEngineExitCode,
|
|
22
|
+
canConnectToDatabase: () => canConnectToDatabase,
|
|
23
|
+
createDatabase: () => createDatabase,
|
|
24
|
+
dropDatabase: () => dropDatabase,
|
|
25
|
+
execaCommand: () => execaCommand
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(chunk_LZIL2VER_exports);
|
|
28
|
+
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
|
29
|
+
var import_chunk_YHTJPMCB = require("./chunk-YHTJPMCB.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_YHTJPMCB.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
|
+
}
|