@prisma/internals 5.16.0 → 5.17.0-integration-es2021.1
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-ZOCBNOCC.js → chunk-3BQPLVGY.js} +5 -5
- package/dist/{chunk-TKRKGGID.js → chunk-3H62IOKX.js} +7 -7
- package/dist/chunk-5XRQ7ONW.js +122 -0
- package/dist/{chunk-2W5SRYSU.js → chunk-B4R5MGJU.js} +8 -8
- package/dist/chunk-DGQEXKUB.js +110 -0
- package/dist/{chunk-GJ3353AA.js → chunk-GJYU5LSN.js} +24 -795
- package/dist/{chunk-R4T44FN3.js → chunk-HQZBRMTO.js} +8 -8
- package/dist/chunk-KIC4MOJQ.js +166 -0
- package/dist/{chunk-GEBTVXQ6.js → chunk-O4OJPE6I.js} +5 -5
- package/dist/chunk-ONFZFD3I.js +177 -0
- package/dist/{chunk-HLFMAFRO.js → chunk-PJDEZXWV.js} +5 -5
- package/dist/chunk-QIVUAERL.js +2202 -0
- package/dist/chunk-QMNSOAXY.js +54 -0
- package/dist/{chunk-EYCPUVNF.js → chunk-RYHJYMR4.js} +8 -8
- package/dist/{chunk-YGAQN2OS.js → chunk-TE5WSCMG.js} +19 -19
- package/dist/{chunk-P72YOUAS.js → chunk-TVHGQWBG.js} +5 -5
- package/dist/{chunk-M2FQFXUO.js → chunk-YA7KEMAF.js} +4 -4
- package/dist/cli/checkUnsupportedDataProxy.js +12 -12
- package/dist/cli/getSchema.js +17 -17
- package/dist/cli/hashes.js +12 -12
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +11 -11
- package/dist/engine-commands/getConfig.js +10 -10
- package/dist/engine-commands/getDmmf.js +7 -7
- package/dist/engine-commands/index.js +20 -20
- package/dist/engine-commands/lintSchema.js +8 -8
- package/dist/engine-commands/mergeSchemas.js +7 -7
- package/dist/engine-commands/validate.js +7 -7
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +12 -12
- package/dist/get-generators/getGenerators.js +14 -14
- package/dist/index.js +39 -39
- package/dist/sendPanic.js +11 -11
- package/dist/utils/getEnvPaths.js +11 -11
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +11 -11
- package/dist/utils/loadEnvFile.js +11 -11
- package/dist/wasm.js +4 -4
- package/package.json +7 -7
|
@@ -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_HQZBRMTO_exports = {};
|
|
30
|
+
__export(chunk_HQZBRMTO_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_HQZBRMTO_exports);
|
|
38
38
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
39
39
|
var import_chunk_EKSAMZHR = require("./chunk-EKSAMZHR.js");
|
|
40
40
|
var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
|
|
41
|
-
var
|
|
41
|
+
var import_chunk_TVHGQWBG = require("./chunk-TVHGQWBG.js");
|
|
42
42
|
var import_chunk_SMHAELKS = require("./chunk-SMHAELKS.js");
|
|
43
43
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
44
|
-
var
|
|
44
|
+
var import_chunk_O4OJPE6I = require("./chunk-O4OJPE6I.js");
|
|
45
45
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
46
46
|
var import_chunk_JM6ICT4D = require("./chunk-JM6ICT4D.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_TVHGQWBG.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_O4OJPE6I.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_O4OJPE6I.prismaSchemaWasm.get_config(params);
|
|
102
102
|
return data;
|
|
103
103
|
},
|
|
104
104
|
(e) => ({
|
|
@@ -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_KIC4MOJQ_exports = {};
|
|
20
|
+
__export(chunk_KIC4MOJQ_exports, {
|
|
21
|
+
SchemaEngineExitCode: () => SchemaEngineExitCode,
|
|
22
|
+
canConnectToDatabase: () => canConnectToDatabase,
|
|
23
|
+
createDatabase: () => createDatabase,
|
|
24
|
+
dropDatabase: () => dropDatabase,
|
|
25
|
+
execaCommand: () => execaCommand
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(chunk_KIC4MOJQ_exports);
|
|
28
|
+
var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
|
|
29
|
+
var import_chunk_DGQEXKUB = require("./chunk-DGQEXKUB.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_DGQEXKUB.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
|
+
}
|
|
@@ -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_O4OJPE6I_exports = {};
|
|
30
|
+
__export(chunk_O4OJPE6I_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_O4OJPE6I_exports);
|
|
36
|
+
var import_chunk_YA7KEMAF = require("./chunk-YA7KEMAF.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_YA7KEMAF.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_ONFZFD3I_exports = {};
|
|
30
|
+
__export(chunk_ONFZFD3I_exports, {
|
|
31
|
+
getEnginesInfo: () => getEnginesInfo,
|
|
32
|
+
getEnginesMetaInfo: () => getEnginesMetaInfo,
|
|
33
|
+
resolveEngine: () => resolveEngine
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(chunk_ONFZFD3I_exports);
|
|
36
|
+
var import_chunk_SMHAELKS = require("./chunk-SMHAELKS.js");
|
|
37
|
+
var import_chunk_QMNSOAXY = require("./chunk-QMNSOAXY.js");
|
|
38
|
+
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
39
|
+
var import_chunk_DGQEXKUB = require("./chunk-DGQEXKUB.js");
|
|
40
|
+
var import_chunk_JM6ICT4D = require("./chunk-JM6ICT4D.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_SMHAELKS.require_function)());
|
|
46
|
+
var none2 = import_chunk_JM6ICT4D.none;
|
|
47
|
+
var some2 = import_chunk_JM6ICT4D.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_JM6ICT4D.pipe)(fa, map(f));
|
|
53
|
+
};
|
|
54
|
+
var _ap = function(fab, fa) {
|
|
55
|
+
return (0, import_chunk_JM6ICT4D.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_JM6ICT4D.dual)(2, (0, import_chunk_JM6ICT4D.as)(Functor));
|
|
68
|
+
var asUnit2 = (0, import_chunk_JM6ICT4D.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_JM6ICT4D.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_JM6ICT4D.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_JM6ICT4D.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_JM6ICT4D.dual)(2, (0, import_chunk_JM6ICT4D.tap)(Chain));
|
|
103
|
+
var tapEither2 = /* @__PURE__ */ (0, import_chunk_JM6ICT4D.dual)(2, (0, import_chunk_JM6ICT4D.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_JM6ICT4D.isRight) }, (_engineInfo) => {
|
|
137
|
+
return _engineInfo.path.right;
|
|
138
|
+
}).with({ path: import_chunk_H3T4L34H.N.when(import_chunk_JM6ICT4D.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_JM6ICT4D.isRight) }, (_engineInfo) => {
|
|
143
|
+
return _engineInfo.version.right;
|
|
144
|
+
}).with({ version: import_chunk_H3T4L34H.N.when(import_chunk_JM6ICT4D.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_DGQEXKUB.safeResolveBinary)(binaryName),
|
|
161
|
+
(pathFromEnv) => (0, import_chunk_JM6ICT4D.right2)(pathFromEnv.path)
|
|
162
|
+
)
|
|
163
|
+
)();
|
|
164
|
+
const versionEither = await (0, import_function2.pipe)(
|
|
165
|
+
enginePathEither,
|
|
166
|
+
import_chunk_JM6ICT4D.fromEither,
|
|
167
|
+
(0, import_chunk_JM6ICT4D.chain)((enginePath) => {
|
|
168
|
+
return (0, import_chunk_QMNSOAXY.safeGetEngineVersion)(enginePath, binaryName);
|
|
169
|
+
})
|
|
170
|
+
)();
|
|
171
|
+
const engineInfo = {
|
|
172
|
+
path: enginePathEither,
|
|
173
|
+
version: versionEither,
|
|
174
|
+
fromEnvVar: fromEnvVarOption
|
|
175
|
+
};
|
|
176
|
+
return engineInfo;
|
|
177
|
+
}
|
|
@@ -16,21 +16,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_PJDEZXWV_exports = {};
|
|
20
|
+
__export(chunk_PJDEZXWV_exports, {
|
|
21
21
|
getLintWarnings: () => getLintWarnings,
|
|
22
22
|
getLintWarningsAsText: () => getLintWarningsAsText,
|
|
23
23
|
handleLintPanic: () => handleLintPanic,
|
|
24
24
|
lintSchema: () => lintSchema,
|
|
25
25
|
warningToString: () => warningToString
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(chunk_PJDEZXWV_exports);
|
|
28
28
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
29
|
-
var
|
|
29
|
+
var import_chunk_O4OJPE6I = require("./chunk-O4OJPE6I.js");
|
|
30
30
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
31
31
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
32
32
|
function lintSchema({ schemas }) {
|
|
33
|
-
const lintResult =
|
|
33
|
+
const lintResult = import_chunk_O4OJPE6I.prismaSchemaWasm.lint(JSON.stringify(schemas));
|
|
34
34
|
const lintDiagnostics = JSON.parse(lintResult);
|
|
35
35
|
return lintDiagnostics;
|
|
36
36
|
}
|