@prisma/internals 6.1.0-dev.11 → 6.1.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-JIAYIGQW.js → chunk-5SCYF67F.js} +5 -5
- package/dist/{chunk-GZ3W4XBV.js → chunk-66CT2RER.js} +4 -4
- package/dist/{chunk-PWZWCXZX.js → chunk-CVDEO2SW.js} +4 -4
- package/dist/{chunk-GNMI6KU5.js → chunk-DCH4JJZF.js} +7 -7
- package/dist/{chunk-RROXH3J7.js → chunk-HOBJNDEU.js} +8 -8
- package/dist/{chunk-NYIQRUZG.js → chunk-K5X4YYSR.js} +5 -5
- package/dist/{chunk-ARAZIXTI.js → chunk-UZZE33HJ.js} +8 -8
- package/dist/{chunk-SHCCLLD3.js → chunk-VISXL32C.js} +5 -5
- package/dist/{chunk-Y673TJNF.js → chunk-YHKLTOXO.js} +5 -5
- package/dist/{chunk-MDOYAOLV.js → chunk-ZGPWQ3WG.js} +25 -796
- package/dist/{chunk-OFTYL4FA.js → chunk-ZUVYU2QG.js} +8 -8
- package/dist/cli/checkUnsupportedDataProxy.js +18 -18
- package/dist/cli/getSchema.js +23 -23
- package/dist/cli/hashes.js +18 -18
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +17 -17
- 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 +28 -28
- 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 +17 -17
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +17 -17
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +18 -18
- package/dist/get-generators/getGenerators.js +20 -20
- package/dist/get-generators/utils/getBinaryPathsByVersion.js +3 -3
- package/dist/index.js +54 -54
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +17 -17
- package/dist/utils/getEnvPaths.js +17 -17
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +17 -17
- package/dist/utils/loadEnvFile.js +17 -17
- package/dist/wasm.js +4 -4
- package/package.json +7 -7
- package/dist/chunk-4RWCRJYD.js +0 -166
- package/dist/chunk-D4MCOTL5.js +0 -122
- package/dist/chunk-FPHZVRV4.js +0 -110
- package/dist/chunk-G7LL2H2O.js +0 -54
- package/dist/chunk-JMZHUHCC.js +0 -177
- package/dist/chunk-RQPDQSHK.js +0 -1429
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prisma/internals",
|
3
|
-
"version": "6.1.0-dev.
|
3
|
+
"version": "6.1.0-dev.13",
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -77,12 +77,12 @@
|
|
77
77
|
"@prisma/prisma-schema-wasm": "6.1.0-5.c74f8976aaa3212c16a61537319f9024d0c21e85",
|
78
78
|
"arg": "5.0.2",
|
79
79
|
"prompts": "2.4.2",
|
80
|
-
"@prisma/debug": "6.1.0-dev.
|
81
|
-
"@prisma/engines": "6.1.0-dev.
|
82
|
-
"@prisma/generator-helper": "6.1.0-dev.
|
83
|
-
"@prisma/
|
84
|
-
"@prisma/
|
85
|
-
"@prisma/schema-files-loader": "6.1.0-dev.
|
80
|
+
"@prisma/debug": "6.1.0-dev.13",
|
81
|
+
"@prisma/engines": "6.1.0-dev.13",
|
82
|
+
"@prisma/generator-helper": "6.1.0-dev.13",
|
83
|
+
"@prisma/fetch-engine": "6.1.0-dev.13",
|
84
|
+
"@prisma/get-platform": "6.1.0-dev.13",
|
85
|
+
"@prisma/schema-files-loader": "6.1.0-dev.13"
|
86
86
|
},
|
87
87
|
"sideEffects": false,
|
88
88
|
"scripts": {
|
package/dist/chunk-4RWCRJYD.js
DELETED
@@ -1,166 +0,0 @@
|
|
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_4RWCRJYD_exports = {};
|
20
|
-
__export(chunk_4RWCRJYD_exports, {
|
21
|
-
SchemaEngineExitCode: () => SchemaEngineExitCode,
|
22
|
-
canConnectToDatabase: () => canConnectToDatabase,
|
23
|
-
createDatabase: () => createDatabase,
|
24
|
-
dropDatabase: () => dropDatabase,
|
25
|
-
execaCommand: () => execaCommand
|
26
|
-
});
|
27
|
-
module.exports = __toCommonJS(chunk_4RWCRJYD_exports);
|
28
|
-
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
29
|
-
var import_chunk_FPHZVRV4 = require("./chunk-FPHZVRV4.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_FPHZVRV4.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
|
-
}
|
package/dist/chunk-D4MCOTL5.js
DELETED
@@ -1,122 +0,0 @@
|
|
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_D4MCOTL5_exports = {};
|
30
|
-
__export(chunk_D4MCOTL5_exports, {
|
31
|
-
getBinaryPathsByVersion: () => getBinaryPathsByVersion
|
32
|
-
});
|
33
|
-
module.exports = __toCommonJS(chunk_D4MCOTL5_exports);
|
34
|
-
var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
|
35
|
-
var import_chunk_4CGPN5SR = require("./chunk-4CGPN5SR.js");
|
36
|
-
var import_chunk_2SDPW6AX = require("./chunk-2SDPW6AX.js");
|
37
|
-
var import_chunk_7B5PXS6N = require("./chunk-7B5PXS6N.js");
|
38
|
-
var import_chunk_RQPDQSHK = require("./chunk-RQPDQSHK.js");
|
39
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
40
|
-
var import_engines = require("@prisma/engines");
|
41
|
-
var import_fetch_engine = require("@prisma/fetch-engine");
|
42
|
-
var import_path = __toESM2(require("path"));
|
43
|
-
var import_fs_extra = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_RQPDQSHK.require_lib)());
|
44
|
-
async function getBinaryPathsByVersion({
|
45
|
-
neededVersions,
|
46
|
-
binaryTarget,
|
47
|
-
version,
|
48
|
-
printDownloadProgress,
|
49
|
-
skipDownload,
|
50
|
-
binaryPathsOverride
|
51
|
-
}) {
|
52
|
-
const binaryPathsByVersion = /* @__PURE__ */ Object.create(null);
|
53
|
-
for (const currentVersion in neededVersions) {
|
54
|
-
binaryPathsByVersion[currentVersion] = {};
|
55
|
-
const neededVersion = neededVersions[currentVersion];
|
56
|
-
if (neededVersion.binaryTargets.length === 0) {
|
57
|
-
neededVersion.binaryTargets = [{ fromEnvVar: null, value: binaryTarget }];
|
58
|
-
}
|
59
|
-
if (process.env.NETLIFY) {
|
60
|
-
const isNodeMajor20OrUp = parseInt(process.versions.node.split(".")[0]) >= 20;
|
61
|
-
const awsRuntimeVersion = (0, import_chunk_2SDPW6AX.parseAWSNodejsRuntimeEnvVarVersion)();
|
62
|
-
const isRuntimeEnvVar20OrUp = awsRuntimeVersion && awsRuntimeVersion >= 20;
|
63
|
-
const isRuntimeEnvVar18OrDown = awsRuntimeVersion && awsRuntimeVersion <= 18;
|
64
|
-
const isRhelBinaryTarget1xInNeededVersions = neededVersion.binaryTargets.find(
|
65
|
-
(object) => object.value === "rhel-openssl-1.0.x"
|
66
|
-
);
|
67
|
-
const isRhelBinaryTarget3xInNeededVersions = neededVersion.binaryTargets.find(
|
68
|
-
(object) => object.value === "rhel-openssl-3.0.x"
|
69
|
-
);
|
70
|
-
if (!isRhelBinaryTarget3xInNeededVersions && (isNodeMajor20OrUp || isRuntimeEnvVar20OrUp) && !isRuntimeEnvVar18OrDown) {
|
71
|
-
neededVersion.binaryTargets.push({
|
72
|
-
fromEnvVar: null,
|
73
|
-
value: "rhel-openssl-3.0.x"
|
74
|
-
});
|
75
|
-
} else if (!isRhelBinaryTarget1xInNeededVersions) {
|
76
|
-
neededVersion.binaryTargets.push({
|
77
|
-
fromEnvVar: null,
|
78
|
-
value: "rhel-openssl-1.0.x"
|
79
|
-
});
|
80
|
-
}
|
81
|
-
}
|
82
|
-
let binaryTargetBaseDir = eval(`require('path').join(__dirname, '..')`);
|
83
|
-
if (version !== currentVersion) {
|
84
|
-
binaryTargetBaseDir = import_path.default.join(binaryTargetBaseDir, `./engines/${currentVersion}/`);
|
85
|
-
await (0, import_fs_extra.ensureDir)(binaryTargetBaseDir).catch((e) => console.error(e));
|
86
|
-
}
|
87
|
-
const binariesConfig = neededVersion.engines.reduce((acc, curr) => {
|
88
|
-
if (!binaryPathsOverride?.[curr]) {
|
89
|
-
acc[(0, import_chunk_4CGPN5SR.engineTypeToBinaryType)(curr)] = binaryTargetBaseDir;
|
90
|
-
}
|
91
|
-
return acc;
|
92
|
-
}, /* @__PURE__ */ Object.create(null));
|
93
|
-
if (Object.values(binariesConfig).length > 0) {
|
94
|
-
const binaryTargets = neededVersion.binaryTargets.map(
|
95
|
-
(binaryTarget2) => binaryTarget2.value
|
96
|
-
);
|
97
|
-
const downloadParams = {
|
98
|
-
binaries: binariesConfig,
|
99
|
-
binaryTargets,
|
100
|
-
showProgress: typeof printDownloadProgress === "boolean" ? printDownloadProgress : true,
|
101
|
-
version: currentVersion && currentVersion !== "latest" ? currentVersion : import_engines.enginesVersion,
|
102
|
-
skipDownload
|
103
|
-
};
|
104
|
-
const binaryPathsWithEngineType = await (0, import_fetch_engine.download)(downloadParams);
|
105
|
-
const binaryPaths = (0, import_chunk_7B5PXS6N.mapKeys)(binaryPathsWithEngineType, import_chunk_RS2R7COT.binaryTypeToEngineType);
|
106
|
-
binaryPathsByVersion[currentVersion] = binaryPaths;
|
107
|
-
}
|
108
|
-
if (binaryPathsOverride) {
|
109
|
-
const overrideEngines = Object.keys(binaryPathsOverride);
|
110
|
-
const enginesCoveredByOverride = neededVersion.engines.filter((engine) => overrideEngines.includes(engine));
|
111
|
-
if (enginesCoveredByOverride.length > 0) {
|
112
|
-
for (const engine of enginesCoveredByOverride) {
|
113
|
-
const enginePath = binaryPathsOverride[engine];
|
114
|
-
binaryPathsByVersion[currentVersion][engine] = {
|
115
|
-
[binaryTarget]: enginePath
|
116
|
-
};
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
return binaryPathsByVersion;
|
122
|
-
}
|
package/dist/chunk-FPHZVRV4.js
DELETED
@@ -1,110 +0,0 @@
|
|
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_FPHZVRV4_exports = {};
|
30
|
-
__export(chunk_FPHZVRV4_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_FPHZVRV4_exports);
|
38
|
-
var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
|
39
|
-
var import_chunk_RQPDQSHK = require("./chunk-RQPDQSHK.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_RQPDQSHK.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
|
-
}
|
package/dist/chunk-G7LL2H2O.js
DELETED
@@ -1,54 +0,0 @@
|
|
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_G7LL2H2O_exports = {};
|
20
|
-
__export(chunk_G7LL2H2O_exports, {
|
21
|
-
getEngineVersion: () => getEngineVersion,
|
22
|
-
safeGetEngineVersion: () => safeGetEngineVersion
|
23
|
-
});
|
24
|
-
module.exports = __toCommonJS(chunk_G7LL2H2O_exports);
|
25
|
-
var import_chunk_S4LINK5Y = require("./chunk-S4LINK5Y.js");
|
26
|
-
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
27
|
-
var import_chunk_FPHZVRV4 = require("./chunk-FPHZVRV4.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_FPHZVRV4.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
|
-
}
|
package/dist/chunk-JMZHUHCC.js
DELETED
@@ -1,177 +0,0 @@
|
|
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_JMZHUHCC_exports = {};
|
30
|
-
__export(chunk_JMZHUHCC_exports, {
|
31
|
-
getEnginesInfo: () => getEnginesInfo,
|
32
|
-
getEnginesMetaInfo: () => getEnginesMetaInfo,
|
33
|
-
resolveEngine: () => resolveEngine
|
34
|
-
});
|
35
|
-
module.exports = __toCommonJS(chunk_JMZHUHCC_exports);
|
36
|
-
var import_chunk_PFLLVWZX = require("./chunk-PFLLVWZX.js");
|
37
|
-
var import_chunk_G7LL2H2O = require("./chunk-G7LL2H2O.js");
|
38
|
-
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
39
|
-
var import_chunk_FPHZVRV4 = require("./chunk-FPHZVRV4.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_FPHZVRV4.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_G7LL2H2O.safeGetEngineVersion)(enginePath, binaryName);
|
169
|
-
})
|
170
|
-
)();
|
171
|
-
const engineInfo = {
|
172
|
-
path: enginePathEither,
|
173
|
-
version: versionEither,
|
174
|
-
fromEnvVar: fromEnvVarOption
|
175
|
-
};
|
176
|
-
return engineInfo;
|
177
|
-
}
|