@prisma/internals 5.19.0-dev.12 → 5.19.0-dev.13
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-QL3K6JIN.js → chunk-244YD7SK.js} +7 -7
- package/dist/{chunk-2GL5KAYM.js → chunk-34FTC6KK.js} +5 -5
- package/dist/{chunk-3DGPDGD3.js → chunk-42K3GPYJ.js} +4 -4
- package/dist/chunk-5XRQ7ONW.js +122 -0
- package/dist/{chunk-VU4BZAMD.js → chunk-6GTQHWWT.js} +5 -5
- package/dist/{chunk-3CEAGGAZ.js → chunk-7KXMQZFT.js} +5 -5
- package/dist/{chunk-4A5ZK522.js → chunk-7MD6344A.js} +3 -3
- package/dist/{chunk-GHYJGM56.js → chunk-7SPHTPDV.js} +5 -5
- package/dist/{chunk-P7PMCE2W.js → chunk-CNKDIKWK.js} +16 -16
- package/dist/{chunk-6TPLIQJ5.js → chunk-CYKOCRN3.js} +15 -15
- package/dist/{chunk-B7JVEC2F.js → chunk-D3G3WRZU.js} +5 -5
- package/dist/{chunk-4RKJ76H7.js → chunk-DQMYNBP3.js} +5 -5
- package/dist/{chunk-SLGMG65I.js → chunk-EBLDSWRI.js} +20 -14
- package/dist/{chunk-PN2OFBAO.js → chunk-G4BGJ6IP.js} +5 -5
- package/dist/{chunk-EYOPVHNV.js → chunk-HD4N22SB.js} +28 -28
- package/dist/{chunk-RZG4NJ36.js → chunk-I3YDYYM2.js} +15 -15
- package/dist/{chunk-KUMD5MBR.js → chunk-IAEMHQAC.js} +10 -10
- package/dist/{chunk-AP37UO7C.js → chunk-IB5PDCFO.js} +5 -5
- package/dist/{chunk-J3L6JLSQ.js → chunk-IJUVQMZY.js} +5 -5
- package/dist/{chunk-JBKRHDKT.js → chunk-IY43XBPH.js} +16 -16
- package/dist/{chunk-6J3WFMQY.js → chunk-JPEBIQUM.js} +40 -811
- package/dist/{chunk-4KELZQEZ.js → chunk-KBVBWTBF.js} +23 -23
- package/dist/{chunk-RDUPLVMD.js → chunk-KK64NLNR.js} +5 -5
- package/dist/chunk-NDEGWMVS.js +177 -0
- package/dist/{chunk-AFG6YPOK.js → chunk-NK2ML3NJ.js} +5 -5
- package/dist/chunk-NXIWDQBF.js +110 -0
- package/dist/{chunk-QOTVZEEZ.js → chunk-PFLLVWZX.js} +4 -4
- package/dist/chunk-QIVUAERL.js +2202 -0
- package/dist/{chunk-OKF6INNR.js → chunk-QQJZI2CR.js} +22 -22
- package/dist/{chunk-YM3CE76B.js → chunk-S3323RUL.js} +48 -48
- package/dist/{chunk-NQ7OW3TG.js → chunk-TZ2WAB57.js} +23 -23
- package/dist/chunk-X4GRUQLB.js +166 -0
- package/dist/chunk-X6M256IK.js +54 -0
- package/dist/{chunk-3I7L4PJV.js → chunk-XKRUNUS5.js} +22 -22
- package/dist/{chunk-5M5ACSPI.js → chunk-YIJ776AZ.js} +35 -35
- package/dist/cli/checkUnsupportedDataProxy.js +21 -21
- package/dist/cli/getSchema.js +26 -26
- package/dist/cli/hashes.js +21 -21
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +20 -20
- package/dist/engine-commands/getConfig.js +13 -13
- package/dist/engine-commands/getDmmf.js +10 -10
- package/dist/engine-commands/getEngineVersion.js +5 -5
- package/dist/engine-commands/getEnginesMetaInfo.js +8 -8
- package/dist/engine-commands/index.js +31 -31
- package/dist/engine-commands/lintSchema.js +8 -8
- package/dist/engine-commands/mergeSchemas.js +10 -10
- package/dist/engine-commands/queryEngineCommons.js +7 -7
- package/dist/engine-commands/validate.js +10 -10
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +20 -20
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +20 -20
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +20 -20
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +21 -21
- package/dist/get-generators/getGenerators.js +23 -23
- package/dist/getPackedPackage.js +2 -2
- package/dist/index.js +59 -59
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +20 -20
- package/dist/utils/fs-functional.js +9 -9
- package/dist/utils/getEnvPaths.js +20 -20
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +20 -20
- package/dist/utils/loadEnvFile.js +20 -20
- package/dist/wasm.js +4 -4
- package/package.json +8 -8
|
@@ -26,29 +26,29 @@ 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_KBVBWTBF_exports = {};
|
|
30
|
+
__export(chunk_KBVBWTBF_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_KBVBWTBF_exports);
|
|
38
38
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
39
|
-
var
|
|
39
|
+
var import_chunk_IAEMHQAC = require("./chunk-IAEMHQAC.js");
|
|
40
40
|
var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_chunk_NK2ML3NJ = require("./chunk-NK2ML3NJ.js");
|
|
42
|
+
var import_chunk_PFLLVWZX = require("./chunk-PFLLVWZX.js");
|
|
43
43
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
44
|
-
var
|
|
44
|
+
var import_chunk_IJUVQMZY = require("./chunk-IJUVQMZY.js");
|
|
45
45
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
46
|
-
var
|
|
46
|
+
var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
|
|
47
47
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
48
48
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
49
49
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
50
50
|
var import_get_platform = require("@prisma/get-platform");
|
|
51
|
-
var import_function = (0, import_chunk_WWAWV7DQ.__toESM)((0,
|
|
51
|
+
var import_function = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_PFLLVWZX.require_function)());
|
|
52
52
|
var debug = (0, import_debug.default)("prisma:getConfig");
|
|
53
53
|
var SCHEMA_VALIDATION_ERROR_CODE = "P1012";
|
|
54
54
|
var GetConfigError = class extends Error {
|
|
@@ -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_NK2ML3NJ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
69
69
|
this.name = "GetConfigError";
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -83,14 +83,14 @@ function resolveUrl(envValue) {
|
|
|
83
83
|
return urlFromValue ?? urlEnvVarValue;
|
|
84
84
|
}
|
|
85
85
|
async function getConfig(options) {
|
|
86
|
-
const debugErrorType = (0,
|
|
86
|
+
const debugErrorType = (0, import_chunk_IAEMHQAC.createDebugErrorType)(debug, "getConfigWasm");
|
|
87
87
|
debug(`Using getConfig Wasm`);
|
|
88
88
|
const configEither = (0, import_function.pipe)(
|
|
89
|
-
(0,
|
|
89
|
+
(0, import_chunk_7MD6344A.tryCatch)(
|
|
90
90
|
() => {
|
|
91
91
|
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {
|
|
92
92
|
debug("Triggering a Rust panic...");
|
|
93
|
-
|
|
93
|
+
import_chunk_IJUVQMZY.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_IJUVQMZY.prismaSchemaWasm.get_config(params);
|
|
102
102
|
return data;
|
|
103
103
|
},
|
|
104
104
|
(e) => ({
|
|
@@ -107,11 +107,11 @@ async function getConfig(options) {
|
|
|
107
107
|
error: e
|
|
108
108
|
})
|
|
109
109
|
),
|
|
110
|
-
(0,
|
|
111
|
-
(0,
|
|
110
|
+
(0, import_chunk_7MD6344A.map)((result) => ({ result })),
|
|
111
|
+
(0, import_chunk_7MD6344A.chainW)(
|
|
112
112
|
({ result }) => (
|
|
113
113
|
// NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings
|
|
114
|
-
(0,
|
|
114
|
+
(0, import_chunk_7MD6344A.tryCatch)(
|
|
115
115
|
() => JSON.parse(result),
|
|
116
116
|
(e) => ({
|
|
117
117
|
type: "parse-json",
|
|
@@ -121,18 +121,18 @@ async function getConfig(options) {
|
|
|
121
121
|
)
|
|
122
122
|
)
|
|
123
123
|
),
|
|
124
|
-
(0,
|
|
124
|
+
(0, import_chunk_7MD6344A.chainW)((response) => {
|
|
125
125
|
if (response.errors.length > 0) {
|
|
126
|
-
return (0,
|
|
126
|
+
return (0, import_chunk_7MD6344A.left)({
|
|
127
127
|
type: "validation-error",
|
|
128
128
|
reason: "(get-config wasm)",
|
|
129
129
|
error: response.errors
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
return (0,
|
|
132
|
+
return (0, import_chunk_7MD6344A.right)(response.config);
|
|
133
133
|
})
|
|
134
134
|
);
|
|
135
|
-
if ((0,
|
|
135
|
+
if ((0, import_chunk_7MD6344A.isRight)(configEither)) {
|
|
136
136
|
debug("config data retrieved without errors in getConfig Wasm");
|
|
137
137
|
const { right: data } = configEither;
|
|
138
138
|
for (const generator of data.generators) {
|
|
@@ -160,12 +160,12 @@ async function getConfig(options) {
|
|
|
160
160
|
return panic;
|
|
161
161
|
}
|
|
162
162
|
const errorOutput = e.error.message;
|
|
163
|
-
return new GetConfigError((0,
|
|
163
|
+
return new GetConfigError((0, import_chunk_IAEMHQAC.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
|
164
164
|
}).with({ type: "validation-error" }, (e) => {
|
|
165
165
|
return new GetConfigError({
|
|
166
166
|
_tag: "parsed",
|
|
167
167
|
errorCode: SCHEMA_VALIDATION_ERROR_CODE,
|
|
168
|
-
reason: (0,
|
|
168
|
+
reason: (0, import_chunk_IAEMHQAC.createSchemaValidationError)(e.reason),
|
|
169
169
|
message: formatErrors(e.error)
|
|
170
170
|
});
|
|
171
171
|
}).otherwise((e) => {
|
|
@@ -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_KK64NLNR_exports = {};
|
|
30
|
+
__export(chunk_KK64NLNR_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_KK64NLNR_exports);
|
|
36
|
+
var import_chunk_42K3GPYJ = require("./chunk-42K3GPYJ.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_42K3GPYJ.require_package)();
|
|
46
46
|
var prismaSchemaWasmVersion = dependencies["@prisma/prisma-schema-wasm"];
|
|
47
47
|
globalThis.PRISMA_WASM_PANIC_REGISTRY = new import_chunk_HOZFIXMD.WasmPanicRegistry();
|
|
@@ -0,0 +1,177 @@
|
|
|
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 __toESM = (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_NDEGWMVS_exports = {};
|
|
30
|
+
__export(chunk_NDEGWMVS_exports, {
|
|
31
|
+
getEnginesInfo: () => getEnginesInfo,
|
|
32
|
+
getEnginesMetaInfo: () => getEnginesMetaInfo,
|
|
33
|
+
resolveEngine: () => resolveEngine
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(chunk_NDEGWMVS_exports);
|
|
36
|
+
var import_chunk_PFLLVWZX = require("./chunk-PFLLVWZX.js");
|
|
37
|
+
var import_chunk_244YD7SK = require("./chunk-244YD7SK.js");
|
|
38
|
+
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
39
|
+
var import_chunk_7SPHTPDV = require("./chunk-7SPHTPDV.js");
|
|
40
|
+
var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
|
|
41
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
42
|
+
var import_engines = require("@prisma/engines");
|
|
43
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
|
44
|
+
var import_path = __toESM(require("path"));
|
|
45
|
+
var import_function2 = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_PFLLVWZX.require_function)());
|
|
46
|
+
var none2 = import_chunk_7MD6344A.none;
|
|
47
|
+
var some2 = import_chunk_7MD6344A.some;
|
|
48
|
+
var getRight = function(ma) {
|
|
49
|
+
return ma._tag === "Left" ? none2 : some2(ma.right);
|
|
50
|
+
};
|
|
51
|
+
var _map = function(fa, f) {
|
|
52
|
+
return (0, import_chunk_7MD6344A.pipe)(fa, map(f));
|
|
53
|
+
};
|
|
54
|
+
var _ap = function(fab, fa) {
|
|
55
|
+
return (0, import_chunk_7MD6344A.pipe)(fab, ap(fa));
|
|
56
|
+
};
|
|
57
|
+
var URI = "Option";
|
|
58
|
+
var map = function(f) {
|
|
59
|
+
return function(fa) {
|
|
60
|
+
return isNone(fa) ? none2 : some2(f(fa.value));
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var Functor = {
|
|
64
|
+
URI,
|
|
65
|
+
map: _map
|
|
66
|
+
};
|
|
67
|
+
var as2 = (0, import_chunk_7MD6344A.dual)(2, (0, import_chunk_7MD6344A.as)(Functor));
|
|
68
|
+
var asUnit2 = (0, import_chunk_7MD6344A.asUnit)(Functor);
|
|
69
|
+
var ap = function(fa) {
|
|
70
|
+
return function(fab) {
|
|
71
|
+
return isNone(fab) ? none2 : isNone(fa) ? none2 : some2(fab.value(fa.value));
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var flatMap = /* @__PURE__ */ (0, import_chunk_7MD6344A.dual)(2, function(ma, f) {
|
|
75
|
+
return isNone(ma) ? none2 : f(ma.value);
|
|
76
|
+
});
|
|
77
|
+
var Chain = {
|
|
78
|
+
URI,
|
|
79
|
+
map: _map,
|
|
80
|
+
ap: _ap,
|
|
81
|
+
chain: flatMap
|
|
82
|
+
};
|
|
83
|
+
var orElse = (0, import_chunk_7MD6344A.dual)(2, function(self, that) {
|
|
84
|
+
return isNone(self) ? that() : self;
|
|
85
|
+
});
|
|
86
|
+
var fromEither2 = getRight;
|
|
87
|
+
var FromEither = {
|
|
88
|
+
URI,
|
|
89
|
+
fromEither: fromEither2
|
|
90
|
+
};
|
|
91
|
+
var isSome2 = import_chunk_7MD6344A.isSome;
|
|
92
|
+
var isNone = function(fa) {
|
|
93
|
+
return fa._tag === "None";
|
|
94
|
+
};
|
|
95
|
+
var matchW = function(onNone, onSome) {
|
|
96
|
+
return function(ma) {
|
|
97
|
+
return isNone(ma) ? onNone() : onSome(ma.value);
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
var match = matchW;
|
|
101
|
+
var fold = match;
|
|
102
|
+
var tap2 = /* @__PURE__ */ (0, import_chunk_7MD6344A.dual)(2, (0, import_chunk_7MD6344A.tap)(Chain));
|
|
103
|
+
var tapEither2 = /* @__PURE__ */ (0, import_chunk_7MD6344A.dual)(2, (0, import_chunk_7MD6344A.tapEither)(FromEither, Chain));
|
|
104
|
+
var fromNullable = function(a) {
|
|
105
|
+
return a == null ? none2 : some2(a);
|
|
106
|
+
};
|
|
107
|
+
async function getEnginesMetaInfo() {
|
|
108
|
+
const cliQueryEngineBinaryType = (0, import_engines.getCliQueryEngineBinaryType)();
|
|
109
|
+
const engines = [
|
|
110
|
+
{
|
|
111
|
+
name: "query-engine",
|
|
112
|
+
type: cliQueryEngineBinaryType
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "schema-engine",
|
|
116
|
+
type: import_fetch_engine.BinaryType.SchemaEngineBinary
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
const enginePromises = engines.map(({ name, type }) => {
|
|
120
|
+
return resolveEngine(type).then((result) => [name, result]);
|
|
121
|
+
});
|
|
122
|
+
const engineMatrix = await Promise.all(enginePromises).then(Object.fromEntries);
|
|
123
|
+
const engineDataAcc = engines.map(({ name }) => {
|
|
124
|
+
const [engineInfo, errors] = getEnginesInfo(engineMatrix[name]);
|
|
125
|
+
return [{ [name]: engineInfo }, errors];
|
|
126
|
+
});
|
|
127
|
+
const engineMetaInfo = engineDataAcc.map((arr) => arr[0]);
|
|
128
|
+
const enginesMetaInfoErrors = engineDataAcc.flatMap((arr) => arr[1]);
|
|
129
|
+
return [engineMetaInfo, enginesMetaInfoErrors];
|
|
130
|
+
}
|
|
131
|
+
function getEnginesInfo(enginesInfo) {
|
|
132
|
+
const errors = [];
|
|
133
|
+
const resolved = (0, import_chunk_H3T4L34H.$)(enginesInfo).with({ fromEnvVar: import_chunk_H3T4L34H.N.when(isSome2) }, (_engineInfo) => {
|
|
134
|
+
return `, resolved by ${_engineInfo.fromEnvVar.value}`;
|
|
135
|
+
}).otherwise(() => "");
|
|
136
|
+
const absolutePath = (0, import_chunk_H3T4L34H.$)(enginesInfo).with({ path: import_chunk_H3T4L34H.N.when(import_chunk_7MD6344A.isRight) }, (_engineInfo) => {
|
|
137
|
+
return _engineInfo.path.right;
|
|
138
|
+
}).with({ path: import_chunk_H3T4L34H.N.when(import_chunk_7MD6344A.isLeft) }, (_engineInfo) => {
|
|
139
|
+
errors.push(_engineInfo.path.left);
|
|
140
|
+
return "E_CANNOT_RESOLVE_PATH";
|
|
141
|
+
}).exhaustive();
|
|
142
|
+
const version = (0, import_chunk_H3T4L34H.$)(enginesInfo).with({ version: import_chunk_H3T4L34H.N.when(import_chunk_7MD6344A.isRight) }, (_engineInfo) => {
|
|
143
|
+
return _engineInfo.version.right;
|
|
144
|
+
}).with({ version: import_chunk_H3T4L34H.N.when(import_chunk_7MD6344A.isLeft) }, (_engineInfo) => {
|
|
145
|
+
errors.push(_engineInfo.version.left);
|
|
146
|
+
return "E_CANNOT_RESOLVE_VERSION";
|
|
147
|
+
}).exhaustive();
|
|
148
|
+
const versionMessage = `${version} (at ${import_path.default.relative(process.cwd(), absolutePath)}${resolved})`;
|
|
149
|
+
return [versionMessage, errors];
|
|
150
|
+
}
|
|
151
|
+
async function resolveEngine(binaryName) {
|
|
152
|
+
const pathFromEnvOption = fromNullable((0, import_fetch_engine.getBinaryEnvVarPath)(binaryName));
|
|
153
|
+
const fromEnvVarOption = (0, import_function2.pipe)(
|
|
154
|
+
pathFromEnvOption,
|
|
155
|
+
map((p) => p.fromEnvVar)
|
|
156
|
+
);
|
|
157
|
+
const enginePathEither = await (0, import_function2.pipe)(
|
|
158
|
+
pathFromEnvOption,
|
|
159
|
+
fold(
|
|
160
|
+
() => (0, import_chunk_7SPHTPDV.safeResolveBinary)(binaryName),
|
|
161
|
+
(pathFromEnv) => (0, import_chunk_7MD6344A.right2)(pathFromEnv.path)
|
|
162
|
+
)
|
|
163
|
+
)();
|
|
164
|
+
const versionEither = await (0, import_function2.pipe)(
|
|
165
|
+
enginePathEither,
|
|
166
|
+
import_chunk_7MD6344A.fromEither,
|
|
167
|
+
(0, import_chunk_7MD6344A.chain)((enginePath) => {
|
|
168
|
+
return (0, import_chunk_244YD7SK.safeGetEngineVersion)(enginePath, binaryName);
|
|
169
|
+
})
|
|
170
|
+
)();
|
|
171
|
+
const engineInfo = {
|
|
172
|
+
path: enginePathEither,
|
|
173
|
+
version: versionEither,
|
|
174
|
+
fromEnvVar: fromEnvVarOption
|
|
175
|
+
};
|
|
176
|
+
return engineInfo;
|
|
177
|
+
}
|
|
@@ -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_NK2ML3NJ_exports = {};
|
|
20
|
+
__export(chunk_NK2ML3NJ_exports, {
|
|
21
21
|
addVersionDetailsToErrorMessage: () => addVersionDetailsToErrorMessage
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_NK2ML3NJ_exports);
|
|
24
|
+
var import_chunk_34FTC6KK = require("./chunk-34FTC6KK.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_34FTC6KK.version]];
|
|
28
28
|
return `${message}
|
|
29
29
|
|
|
30
30
|
${(0, import_chunk_QN6PSQY7.formatTable)(rows)}`;
|
|
@@ -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_NXIWDQBF_exports = {};
|
|
30
|
+
__export(chunk_NXIWDQBF_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_NXIWDQBF_exports);
|
|
38
|
+
var import_chunk_QIVUAERL = require("./chunk-QIVUAERL.js");
|
|
39
|
+
var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.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
|
+
}
|
|
@@ -16,14 +16,14 @@ 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_PFLLVWZX_exports = {};
|
|
20
|
+
__export(chunk_PFLLVWZX_exports, {
|
|
21
21
|
require_function: () => require_function
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_PFLLVWZX_exports);
|
|
24
24
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
25
25
|
var require_function = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
26
|
-
"../../node_modules/.pnpm/fp-ts@2.16.
|
|
26
|
+
"../../node_modules/.pnpm/fp-ts@2.16.9/node_modules/fp-ts/lib/function.js"(exports) {
|
|
27
27
|
"use strict";
|
|
28
28
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
29
29
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|