@prisma/internals 7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1 → 7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.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-VBLGRBF2.js → chunk-262R2PBW.js} +5 -5
- package/dist/chunk-3FP46GUV.js +471 -0
- package/dist/chunk-46ABODUM.js +186 -0
- package/dist/{chunk-GJSFP4V4.js → chunk-4CGPN5SR.js} +9 -3
- package/dist/{chunk-TCDF53CN.js → chunk-4JCVHBYR.js} +6 -6
- package/dist/{chunk-Q6D7PXUU.js → chunk-55ZV2II2.js} +38 -16
- package/dist/{chunk-YQYFLEMT.js → chunk-5ETP2F4G.js} +5 -5
- package/dist/{chunk-Z64WCHZR.js → chunk-5PEHPZHO.js} +11 -11
- package/dist/{chunk-PNYEHZAU.js → chunk-656EKQL7.js} +5 -5
- package/dist/{chunk-OWVQILDA.js → chunk-65XSDXPY.js} +13 -13
- package/dist/chunk-6TTRTZXU.js +37 -0
- package/dist/{chunk-Q5XW7CMJ.js → chunk-75BIJ5PX.js} +9 -9
- package/dist/{chunk-DXWYZA7B.js → chunk-7QC5VORA.js} +4 -3
- package/dist/{chunk-5YZKJGXV.js → chunk-7QKLIARO.js} +10 -8
- package/dist/{chunk-CQVWHHIJ.js → chunk-AX5N26KG.js} +6 -11
- package/dist/{chunk-NBWRGVYR.js → chunk-BCQZ6JQE.js} +6 -4
- package/dist/{chunk-BXIKQUP5.js → chunk-BVJP43JS.js} +7 -7
- package/dist/chunk-D4VDA2TZ.js +66 -0
- package/dist/{chunk-EQ6XBXVV.js → chunk-D6JNJJI7.js} +146 -58
- package/dist/chunk-DZYINYAA.js +68 -0
- package/dist/{chunk-4QR3X56D.js → chunk-E2QTLJH5.js} +13 -13
- package/dist/chunk-ERSH2BQA.js +58 -0
- package/dist/{chunk-42R3EIRM.js → chunk-EYVG6XQS.js} +67 -55
- package/dist/{chunk-GH2WAX5Y.js → chunk-F2OZV76L.js} +7 -7
- package/dist/{chunk-R3J2O23S.js → chunk-FCYHZHVW.js} +4 -4
- package/dist/{chunk-DQWKFZPY.js → chunk-FYZCPL2Z.js} +7 -4
- package/dist/{chunk-2GPDFPDR.js → chunk-GMW36QQF.js} +7 -7
- package/dist/{chunk-US23KCBP.js → chunk-H43XC5ET.js} +5 -5
- package/dist/{chunk-YXCPS3WU.js → chunk-HFFWZTVM.js} +15 -5
- package/dist/chunk-HO5HRHFZ.js +30 -0
- package/dist/chunk-HW5RCZSE.js +1 -0
- package/dist/{chunk-YV4IFLW4.js → chunk-JOIIWB3U.js} +129 -128
- package/dist/chunk-KDHESRKE.js +49 -0
- package/dist/{chunk-B4NUBXXO.js → chunk-KH7FI42S.js} +11 -11
- package/dist/chunk-L6KOIJJ5.js +125 -0
- package/dist/{chunk-3U4QB2G3.js → chunk-LYFOJ5NK.js} +6 -4
- package/dist/{chunk-Q75TMXCR.js → chunk-OAT7ZJED.js} +20 -7
- package/dist/{chunk-WK3RWN6T.js → chunk-OPLMJ5WZ.js} +146 -58
- package/dist/{chunk-SP2ETLT2.js → chunk-OSHZ4P3G.js} +5 -5
- package/dist/{chunk-QFQIWWVN.js → chunk-OWUYXGDF.js} +12 -12
- package/dist/chunk-PZMRR772.js +41 -0
- package/dist/{chunk-RR7B6GH2.js → chunk-QDT7TGYZ.js} +5 -5
- package/dist/{chunk-QNSOKYEF.js → chunk-QLOP3Z4E.js} +38 -16
- package/dist/{chunk-Y5TWK45J.js → chunk-QPQF4VGD.js} +12 -12
- package/dist/chunk-RFB2U4GQ.js +41 -0
- package/dist/{chunk-5I4ERIIY.js → chunk-RS2R7COT.js} +9 -3
- package/dist/chunk-T2PM5TKT.js +55 -0
- package/dist/{chunk-X2DGDDLX.js → chunk-THADADEM.js} +9 -7
- package/dist/{chunk-5BRXEOYH.js → chunk-TQFONRJP.js} +5 -5
- package/dist/{chunk-WSZXPLJQ.js → chunk-TZJROXB3.js} +4 -4
- package/dist/{chunk-YJVCIN4F.js → chunk-UHI6VYFX.js} +14 -16
- package/dist/{chunk-NYNXYKR4.js → chunk-UQUWZJVN.js} +7 -7
- package/dist/{chunk-N3FJZLFP.js → chunk-W6J5YFD2.js} +5 -5
- package/dist/{chunk-AJALNZEH.js → chunk-WDPDHAFW.js} +5 -5
- package/dist/{chunk-ARC7TW3L.js → chunk-WFNB7VRA.js} +14 -4
- package/dist/{chunk-5IS5OH7Z.js → chunk-WKP2TVYB.js} +5 -5
- package/dist/cli/checkUnsupportedDataProxy.d.ts +9 -7
- package/dist/cli/checkUnsupportedDataProxy.js +65 -53
- package/dist/cli/checkUnsupportedSchemaEngineWasm.d.ts +22 -0
- package/dist/cli/checkUnsupportedSchemaEngineWasm.js +135 -0
- package/dist/cli/directoryConfig.d.ts +2 -5
- package/dist/cli/directoryConfig.js +2 -2
- package/dist/cli/getGeneratorSuccessMessage.js +3 -2
- package/dist/cli/getSchema.d.ts +20 -28
- package/dist/cli/getSchema.js +5 -7
- package/dist/cli/hashes.d.ts +1 -2
- package/dist/cli/hashes.js +4 -4
- package/dist/cli/schemaContext.d.ts +22 -5
- package/dist/cli/schemaContext.js +65 -54
- package/dist/cli/types.d.ts +1 -1
- package/dist/client/getClientEngineType.d.ts +7 -0
- package/dist/client/getClientEngineType.js +26 -0
- package/dist/convertCredentials.js +4 -4
- package/dist/dotenvExpand.d.ts +35 -0
- package/dist/dotenvExpand.js +25 -0
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +64 -52
- package/dist/engine-commands/getConfig.d.ts +5 -1
- package/dist/engine-commands/getConfig.js +13 -10
- package/dist/engine-commands/getDmmf.js +10 -10
- package/dist/engine-commands/getEngineVersion.js +9 -5
- package/dist/engine-commands/getEnginesInfo.d.ts +1 -0
- package/dist/engine-commands/getEnginesInfo.js +9 -6
- package/dist/engine-commands/index.d.ts +1 -1
- package/dist/engine-commands/index.js +76 -62
- package/dist/engine-commands/lintSchema.js +9 -9
- package/dist/engine-commands/mergeSchemas.js +10 -10
- package/dist/engine-commands/queryEngineCommons.js +6 -6
- package/dist/engine-commands/validate.js +10 -10
- package/dist/get-generators/getGenerators.d.ts +2 -0
- package/dist/get-generators/getGenerators.js +67 -55
- package/dist/get-generators/utils/binaryTypeToEngineType.js +2 -2
- package/dist/get-generators/utils/engineTypeToBinaryType.js +2 -2
- package/dist/get-generators/utils/getBinaryPathsByVersion.js +4 -4
- package/dist/getPackedPackage.js +3 -3
- package/dist/index.d.ts +19 -5
- package/dist/index.js +125 -99
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +3 -2
- package/dist/tracing/types.d.ts +54 -0
- package/dist/tracing/types.js +2 -0
- package/dist/types.d.ts +0 -15
- package/dist/utils/__tests__/maskSchema.test.js +23 -0
- package/dist/utils/byline.d.ts +4 -0
- package/dist/utils/byline.js +28 -0
- package/dist/utils/canPrompt.js +3 -3
- package/dist/utils/cloudflareD1.d.ts +5 -0
- package/dist/utils/cloudflareD1.js +27 -0
- package/dist/utils/fs-functional.js +10 -10
- package/dist/utils/fs-utils.js +8 -8
- package/dist/utils/getEnvPaths.d.ts +14 -0
- package/dist/utils/{validatePrismaConfigWithDatasource.js → getEnvPaths.js} +8 -7
- package/dist/utils/getMigrateConfigDir.d.ts +2 -0
- package/dist/utils/getMigrateConfigDir.js +25 -0
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handleEngineLoadingErrors.d.ts +8 -0
- package/dist/utils/handleEngineLoadingErrors.js +27 -0
- package/dist/utils/handlePanic.js +7 -6
- package/dist/utils/load.d.ts +6 -0
- package/dist/utils/load.js +28 -0
- package/dist/utils/loadEnvFile.d.ts +10 -0
- package/dist/utils/loadEnvFile.js +30 -0
- package/dist/utils/maskSchema.d.ts +4 -0
- package/dist/utils/maskSchema.js +27 -0
- package/dist/utils/missingDatasource.js +2 -2
- package/dist/utils/missingGeneratorMessage.js +4 -4
- package/dist/utils/serializeQueryEngineName.d.ts +4 -0
- package/dist/utils/serializeQueryEngineName.js +25 -0
- package/dist/utils/toSchemasContainer.d.ts +1 -1
- package/dist/utils/toSchemasContainer.js +3 -3
- package/dist/utils/tryLoadEnvs.d.ts +25 -0
- package/dist/utils/tryLoadEnvs.js +30 -0
- package/dist/wasm.js +5 -5
- package/package.json +17 -15
- package/dist/chunk-5SAWCTGN.js +0 -46
- package/dist/utils/validatePrismaConfigWithDatasource.d.ts +0 -15
|
@@ -26,58 +26,83 @@ 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_D6JNJJI7_exports = {};
|
|
30
|
+
__export(chunk_D6JNJJI7_exports, {
|
|
31
31
|
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
|
32
|
+
checkUnsupportedSchemaEngineWasm: () => checkUnsupportedSchemaEngineWasm,
|
|
33
|
+
forbiddenCmdFlagWithSchemaEngineWasm: () => forbiddenCmdFlagWithSchemaEngineWasm,
|
|
32
34
|
forbiddenCmdWithDataProxyFlagMessage: () => forbiddenCmdWithDataProxyFlagMessage,
|
|
33
35
|
formatSchema: () => formatSchema,
|
|
34
36
|
getBinaryTargetForCurrentPlatform: () => import_get_platform2.getBinaryTargetForCurrentPlatform,
|
|
35
37
|
getGenerator: () => getGenerator,
|
|
36
38
|
getGenerators: () => getGenerators,
|
|
37
|
-
|
|
39
|
+
getNodeAPIName: () => import_get_platform2.getNodeAPIName,
|
|
38
40
|
knownBinaryTargets: () => knownBinaryTargets,
|
|
39
41
|
loadSchemaContext: () => loadSchemaContext,
|
|
40
42
|
processSchemaResult: () => processSchemaResult,
|
|
41
43
|
skipIndex: () => skipIndex
|
|
42
44
|
});
|
|
43
|
-
module.exports = __toCommonJS(
|
|
44
|
-
var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
|
|
45
|
-
var import_chunk_GH2WAX5Y = require("./chunk-GH2WAX5Y.js");
|
|
45
|
+
module.exports = __toCommonJS(chunk_D6JNJJI7_exports);
|
|
46
46
|
var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
|
|
47
47
|
var import_chunk_LRU47BGE = require("./chunk-LRU47BGE.js");
|
|
48
|
+
var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
|
|
49
|
+
var import_chunk_F2OZV76L = require("./chunk-F2OZV76L.js");
|
|
50
|
+
var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
|
|
48
51
|
var import_chunk_GXW4NTU2 = require("./chunk-GXW4NTU2.js");
|
|
49
52
|
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
|
|
50
|
-
var
|
|
51
|
-
var
|
|
53
|
+
var import_chunk_7QC5VORA = require("./chunk-7QC5VORA.js");
|
|
54
|
+
var import_chunk_AX5N26KG = require("./chunk-AX5N26KG.js");
|
|
55
|
+
var import_chunk_46ABODUM = require("./chunk-46ABODUM.js");
|
|
52
56
|
var import_chunk_I6WLABB2 = require("./chunk-I6WLABB2.js");
|
|
53
57
|
var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
58
|
+
var import_chunk_55ZV2II2 = require("./chunk-55ZV2II2.js");
|
|
59
|
+
var import_chunk_OWUYXGDF = require("./chunk-OWUYXGDF.js");
|
|
60
|
+
var import_chunk_5ETP2F4G = require("./chunk-5ETP2F4G.js");
|
|
61
|
+
var import_chunk_5PEHPZHO = require("./chunk-5PEHPZHO.js");
|
|
62
|
+
var import_chunk_EYVG6XQS = require("./chunk-EYVG6XQS.js");
|
|
63
|
+
var import_chunk_WKP2TVYB = require("./chunk-WKP2TVYB.js");
|
|
64
|
+
var import_chunk_ZJWZK45Z = require("./chunk-ZJWZK45Z.js");
|
|
60
65
|
var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
|
|
61
66
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
|
62
67
|
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
63
68
|
var import_chunk_BPDMLM32 = require("./chunk-BPDMLM32.js");
|
|
64
69
|
var import_chunk_IOIAK7V7 = require("./chunk-IOIAK7V7.js");
|
|
65
|
-
var import_chunk_BXIKQUP5 = require("./chunk-BXIKQUP5.js");
|
|
66
|
-
var import_chunk_ZJWZK45Z = require("./chunk-ZJWZK45Z.js");
|
|
67
70
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
71
|
+
var import_chunk_BVJP43JS = require("./chunk-BVJP43JS.js");
|
|
68
72
|
var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
|
|
69
|
-
var
|
|
73
|
+
var import_path = __toESM(require("path"));
|
|
70
74
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
71
75
|
var import_debug2 = __toESM(require("@prisma/debug"));
|
|
72
76
|
var import_engines = require("@prisma/engines");
|
|
73
77
|
var import_get_platform = require("@prisma/get-platform");
|
|
74
|
-
var
|
|
78
|
+
var import_path2 = __toESM(require("path"));
|
|
75
79
|
var import_get_platform2 = require("@prisma/get-platform");
|
|
80
|
+
var forbiddenCmdFlagWithSchemaEngineWasm = ({ cmd, flag }) => `
|
|
81
|
+
Passing the ${(0, import_chunk_PG5FDKSF.green)(`${flag}`)} flag to the ${(0, import_chunk_PG5FDKSF.green)(`prisma ${cmd}`)} command is not supported when
|
|
82
|
+
defining an ${(0, import_chunk_PG5FDKSF.green)(`adapter`)} in Prisma config file (e.g., ${(0, import_chunk_PG5FDKSF.green)(`\`prisma.config.ts\``)}).
|
|
83
|
+
|
|
84
|
+
More information about this limitation: ${(0, import_chunk_I6WLABB2.link)("https://pris.ly/d/schema-engine-limitations")}
|
|
85
|
+
`;
|
|
86
|
+
function checkUnsupportedSchemaEngineWasm({
|
|
87
|
+
cmd,
|
|
88
|
+
config,
|
|
89
|
+
args,
|
|
90
|
+
flags
|
|
91
|
+
}) {
|
|
92
|
+
if (config.engine !== "js") {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
for (const flag of flags) {
|
|
96
|
+
if (args[flag] !== void 0) {
|
|
97
|
+
throw new Error(forbiddenCmdFlagWithSchemaEngineWasm({ cmd, flag }));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
76
101
|
var debug = (0, import_debug.default)("prisma:format");
|
|
77
102
|
async function formatSchema({ schemas }, inputFormattingOptions) {
|
|
78
103
|
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
|
79
104
|
handleFormatPanic(() => {
|
|
80
|
-
|
|
105
|
+
import_chunk_WKP2TVYB.prismaSchemaWasm.debug_panic();
|
|
81
106
|
});
|
|
82
107
|
}
|
|
83
108
|
const defaultFormattingOptions = {
|
|
@@ -94,10 +119,10 @@ async function formatSchema({ schemas }, inputFormattingOptions) {
|
|
|
94
119
|
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(() => {
|
|
95
120
|
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
|
|
96
121
|
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
|
97
|
-
const lintDiagnostics2 = (0,
|
|
122
|
+
const lintDiagnostics2 = (0, import_chunk_5ETP2F4G.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
|
98
123
|
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
|
99
124
|
});
|
|
100
|
-
const lintWarnings = (0,
|
|
125
|
+
const lintWarnings = (0, import_chunk_5ETP2F4G.getLintWarningsAsText)(lintDiagnostics);
|
|
101
126
|
if (lintWarnings && import_chunk_ZJWZK45Z.logger_exports.should.warn()) {
|
|
102
127
|
console.warn(lintWarnings);
|
|
103
128
|
}
|
|
@@ -124,37 +149,60 @@ function handleFormatPanic(tryCb) {
|
|
|
124
149
|
}
|
|
125
150
|
}
|
|
126
151
|
function formatWasm(schema, documentFormattingParams) {
|
|
127
|
-
const formattedSchema =
|
|
152
|
+
const formattedSchema = import_chunk_WKP2TVYB.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
|
128
153
|
return formattedSchema;
|
|
129
154
|
}
|
|
130
|
-
async function loadSchemaContext({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
155
|
+
async function loadSchemaContext({
|
|
156
|
+
schemaPathFromArg,
|
|
157
|
+
schemaPathFromConfig,
|
|
158
|
+
schemaEngineConfig,
|
|
159
|
+
printLoadMessage = true,
|
|
160
|
+
ignoreEnvVarErrors = false,
|
|
161
|
+
allowNull = false,
|
|
162
|
+
schemaPathArgumentName = "--schema",
|
|
163
|
+
cwd = process.cwd()
|
|
164
|
+
} = {}) {
|
|
137
165
|
let schemaResult = null;
|
|
138
166
|
if (allowNull) {
|
|
139
|
-
schemaResult = await (0,
|
|
167
|
+
schemaResult = await (0, import_chunk_EYVG6XQS.getSchemaWithPathOptional)(schemaPathFromArg, schemaPathFromConfig, {
|
|
168
|
+
argumentName: schemaPathArgumentName,
|
|
169
|
+
cwd
|
|
170
|
+
});
|
|
140
171
|
if (!schemaResult) return null;
|
|
141
172
|
} else {
|
|
142
|
-
schemaResult = await (0,
|
|
173
|
+
schemaResult = await (0, import_chunk_EYVG6XQS.getSchemaWithPath)(schemaPathFromArg, schemaPathFromConfig, {
|
|
174
|
+
argumentName: schemaPathArgumentName,
|
|
175
|
+
cwd
|
|
176
|
+
});
|
|
143
177
|
}
|
|
144
|
-
return processSchemaResult({ schemaResult, printLoadMessage, cwd });
|
|
178
|
+
return processSchemaResult({ schemaResult, schemaEngineConfig, printLoadMessage, ignoreEnvVarErrors, cwd });
|
|
145
179
|
}
|
|
146
180
|
async function processSchemaResult({
|
|
147
181
|
schemaResult,
|
|
182
|
+
schemaEngineConfig,
|
|
148
183
|
printLoadMessage = true,
|
|
184
|
+
ignoreEnvVarErrors = false,
|
|
149
185
|
cwd = process.cwd()
|
|
150
186
|
}) {
|
|
151
|
-
const loadedFromPathForLogMessages =
|
|
187
|
+
const loadedFromPathForLogMessages = import_path.default.relative(cwd, schemaResult.schemaPath);
|
|
152
188
|
const schemaRootDir = schemaResult.schemaRootDir || cwd;
|
|
153
189
|
if (printLoadMessage) {
|
|
154
|
-
(0,
|
|
190
|
+
(0, import_chunk_EYVG6XQS.printSchemaLoadedMessage)(loadedFromPathForLogMessages);
|
|
155
191
|
}
|
|
156
|
-
const configFromPsl = await (0,
|
|
157
|
-
const
|
|
192
|
+
const configFromPsl = await (0, import_chunk_55ZV2II2.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
|
|
193
|
+
const datasourceFromPsl = configFromPsl.datasources.at(0);
|
|
194
|
+
const primaryDatasource = (0, import_chunk_XKZ6CBLA.z)(schemaEngineConfig).with({ engine: "classic" }, ({ datasource }) => {
|
|
195
|
+
const { url, directUrl, shadowDatabaseUrl } = datasource;
|
|
196
|
+
const primaryDatasource2 = {
|
|
197
|
+
...datasourceFromPsl,
|
|
198
|
+
url: { fromEnvVar: null, value: url },
|
|
199
|
+
directUrl: directUrl ? { fromEnvVar: null, value: directUrl } : void 0,
|
|
200
|
+
shadowDatabaseUrl: shadowDatabaseUrl ? { fromEnvVar: null, value: shadowDatabaseUrl } : void 0,
|
|
201
|
+
[Symbol.for("engine.classic")]: true
|
|
202
|
+
};
|
|
203
|
+
return primaryDatasource2;
|
|
204
|
+
}).otherwise(() => datasourceFromPsl);
|
|
205
|
+
const primaryDatasourceDirectory = getPrimaryDatasourceDirectory(datasourceFromPsl) || schemaRootDir;
|
|
158
206
|
return {
|
|
159
207
|
schemaFiles: schemaResult.schemas,
|
|
160
208
|
schemaPath: schemaResult.schemaPath,
|
|
@@ -162,17 +210,19 @@ async function processSchemaResult({
|
|
|
162
210
|
datasources: configFromPsl.datasources,
|
|
163
211
|
generators: configFromPsl.generators,
|
|
164
212
|
primaryDatasource,
|
|
213
|
+
primaryDatasourceDirectory,
|
|
165
214
|
warnings: configFromPsl.warnings,
|
|
166
215
|
loadedFromPathForLogMessages
|
|
167
216
|
};
|
|
168
217
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
|
|
218
|
+
function getPrimaryDatasourceDirectory(primaryDatasource) {
|
|
219
|
+
const datasourcePath = primaryDatasource?.sourceFilePath;
|
|
220
|
+
if (datasourcePath) {
|
|
221
|
+
return import_path.default.dirname(datasourcePath);
|
|
172
222
|
}
|
|
173
|
-
return
|
|
223
|
+
return null;
|
|
174
224
|
}
|
|
175
|
-
var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0,
|
|
225
|
+
var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_BVJP43JS.require_p_map)());
|
|
176
226
|
var debug2 = (0, import_debug2.default)("prisma:getGenerators");
|
|
177
227
|
async function getGenerators(options) {
|
|
178
228
|
if (options.registry === void 0 && options.providerAliases !== void 0) {
|
|
@@ -196,27 +246,29 @@ async function getGenerators(options) {
|
|
|
196
246
|
skipDownload,
|
|
197
247
|
binaryPathsOverride,
|
|
198
248
|
generatorNames = [],
|
|
249
|
+
postinstall,
|
|
250
|
+
noEngine,
|
|
199
251
|
allowNoModels = true,
|
|
200
252
|
typedSql
|
|
201
253
|
} = options;
|
|
202
|
-
const schemaContext = !options.schemaContext && schemaPath ? await loadSchemaContext({
|
|
254
|
+
const schemaContext = !options.schemaContext && schemaPath ? await loadSchemaContext({ schemaPathFromArg: schemaPath, ignoreEnvVarErrors: true }) : options.schemaContext;
|
|
203
255
|
if (!schemaContext) {
|
|
204
256
|
throw new Error(`no schema provided for getGenerators`);
|
|
205
257
|
}
|
|
206
258
|
if (!schemaContext.primaryDatasource) {
|
|
207
|
-
throw new Error(
|
|
259
|
+
throw new Error(import_chunk_7QC5VORA.missingDatasource);
|
|
208
260
|
}
|
|
209
261
|
(0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
|
|
210
262
|
const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
|
|
211
|
-
const dmmf = await (0,
|
|
263
|
+
const dmmf = await (0, import_chunk_OWUYXGDF.getDMMF)({
|
|
212
264
|
datamodel: schemaContext.schemaFiles,
|
|
213
265
|
previewFeatures
|
|
214
266
|
});
|
|
215
267
|
if (dmmf.datamodel.models.length === 0 && !allowNoModels) {
|
|
216
268
|
if (schemaContext.primaryDatasource.provider === "mongodb") {
|
|
217
|
-
throw new Error(
|
|
269
|
+
throw new Error(import_chunk_AX5N26KG.missingModelMessageMongoDB);
|
|
218
270
|
}
|
|
219
|
-
throw new Error(
|
|
271
|
+
throw new Error(import_chunk_AX5N26KG.missingModelMessage);
|
|
220
272
|
}
|
|
221
273
|
const generatorConfigs = filterGenerators(overrideGenerators || schemaContext.generators, generatorNames);
|
|
222
274
|
await validateGenerators(generatorConfigs);
|
|
@@ -225,7 +277,7 @@ async function getGenerators(options) {
|
|
|
225
277
|
const generators = await (0, import_p_map.default)(
|
|
226
278
|
generatorConfigs,
|
|
227
279
|
async (generatorConfig, index) => {
|
|
228
|
-
const baseDir =
|
|
280
|
+
const baseDir = import_path2.default.dirname(generatorConfig.sourceFilePath ?? schemaContext.schemaRootDir);
|
|
229
281
|
const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.provider);
|
|
230
282
|
const generatorDefinition = registry[providerValue] ?? {
|
|
231
283
|
type: "rpc",
|
|
@@ -238,7 +290,7 @@ async function getGenerators(options) {
|
|
|
238
290
|
await generatorInstance.init();
|
|
239
291
|
if (generatorConfig.output) {
|
|
240
292
|
generatorConfig.output = {
|
|
241
|
-
value:
|
|
293
|
+
value: import_path2.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.output)),
|
|
242
294
|
fromEnvVar: null
|
|
243
295
|
};
|
|
244
296
|
generatorConfig.isCustomOutput = true;
|
|
@@ -259,7 +311,8 @@ You need to define \`output\` in the generator block in the schema file.`
|
|
|
259
311
|
fromEnvVar: null
|
|
260
312
|
};
|
|
261
313
|
}
|
|
262
|
-
const datamodel = (0,
|
|
314
|
+
const datamodel = (0, import_chunk_5PEHPZHO.mergeSchemas)({ schemas: schemaContext.schemaFiles });
|
|
315
|
+
const envPaths = await (0, import_chunk_46ABODUM.getEnvPaths)(schemaContext.schemaPath, { cwd: generatorConfig.output.value });
|
|
263
316
|
const options2 = {
|
|
264
317
|
datamodel,
|
|
265
318
|
datasources: schemaContext.datasources,
|
|
@@ -270,7 +323,10 @@ You need to define \`output\` in the generator block in the schema file.`
|
|
|
270
323
|
// TODO:(schemaPath) can we get rid of schema path passing here?
|
|
271
324
|
version: version2 || import_engines.enginesVersion,
|
|
272
325
|
// this version makes no sense anymore and should be ignored
|
|
326
|
+
postinstall,
|
|
327
|
+
noEngine,
|
|
273
328
|
allowNoModels,
|
|
329
|
+
envPaths,
|
|
274
330
|
typedSql
|
|
275
331
|
};
|
|
276
332
|
generatorInstance.setOptions(options2);
|
|
@@ -314,16 +370,18 @@ generator gen {
|
|
|
314
370
|
}
|
|
315
371
|
const generatorBinaryTargets = g.options?.generator?.binaryTargets;
|
|
316
372
|
if (generatorBinaryTargets && generatorBinaryTargets.length > 0) {
|
|
317
|
-
for (const
|
|
318
|
-
if (!neededVersions[neededVersion].binaryTargets.find((object) => object.value ===
|
|
319
|
-
neededVersions[neededVersion].binaryTargets.push(
|
|
373
|
+
for (const binaryTarget2 of generatorBinaryTargets) {
|
|
374
|
+
if (!neededVersions[neededVersion].binaryTargets.find((object) => object.value === binaryTarget2.value)) {
|
|
375
|
+
neededVersions[neededVersion].binaryTargets.push(binaryTarget2);
|
|
320
376
|
}
|
|
321
377
|
}
|
|
322
378
|
}
|
|
323
379
|
}
|
|
324
380
|
}
|
|
381
|
+
const queryEngineBinaryType = (0, import_engines.getCliQueryEngineBinaryType)();
|
|
382
|
+
const queryEngineType = (0, import_chunk_RS2R7COT.binaryTypeToEngineType)(queryEngineBinaryType);
|
|
325
383
|
debug2("neededVersions", JSON.stringify(neededVersions, null, 2));
|
|
326
|
-
const { binaryPathsByVersion } = await (0,
|
|
384
|
+
const { binaryPathsByVersion, binaryTarget } = await (0, import_chunk_F2OZV76L.getBinaryPathsByVersion)({
|
|
327
385
|
neededVersions,
|
|
328
386
|
// We're lazily computing the binary target here, to avoid printing the
|
|
329
387
|
// `Prisma failed to detect the libssl/openssl version to use` warning
|
|
@@ -344,6 +402,17 @@ generator gen {
|
|
|
344
402
|
const generatorBinaryPaths = (0, import_chunk_GXW4NTU2.pick)(binaryPaths ?? {}, generator.manifest.requiresEngines);
|
|
345
403
|
debug2({ generatorBinaryPaths });
|
|
346
404
|
generator.setBinaryPaths(generatorBinaryPaths);
|
|
405
|
+
if (engineVersion !== version2 && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
|
|
406
|
+
const customDmmf = await (0, import_chunk_OWUYXGDF.getDMMF)({
|
|
407
|
+
datamodel: schemaContext.schemaFiles,
|
|
408
|
+
previewFeatures
|
|
409
|
+
});
|
|
410
|
+
const options2 = { ...generator.options, dmmf: customDmmf };
|
|
411
|
+
debug2("generator.manifest.prettyName", generator.manifest.prettyName);
|
|
412
|
+
debug2("options", options2);
|
|
413
|
+
debug2("options.generator.binaryTargets", options2.generator.binaryTargets);
|
|
414
|
+
generator.setOptions(options2);
|
|
415
|
+
}
|
|
347
416
|
}
|
|
348
417
|
}
|
|
349
418
|
return generators;
|
|
@@ -368,6 +437,17 @@ var oldToNewBinaryTargetsMapping = {
|
|
|
368
437
|
async function validateGenerators(generators) {
|
|
369
438
|
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
|
370
439
|
for (const generator of generators) {
|
|
440
|
+
if (generator.config.platforms) {
|
|
441
|
+
throw new Error(
|
|
442
|
+
`The \`platforms\` field on the generator definition is deprecated. Please rename it to \`binaryTargets\`.`
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
if (generator.config.pinnedBinaryTargets) {
|
|
446
|
+
throw new Error(
|
|
447
|
+
`The \`pinnedBinaryTargets\` field on the generator definition is deprecated.
|
|
448
|
+
Please use the PRISMA_QUERY_ENGINE_BINARY env var instead to pin the binary target.`
|
|
449
|
+
);
|
|
450
|
+
}
|
|
371
451
|
if (generator.binaryTargets) {
|
|
372
452
|
const binaryTargets2 = generator.binaryTargets && generator.binaryTargets.length > 0 ? generator.binaryTargets : [{ fromEnvVar: null, value: "native" }];
|
|
373
453
|
const resolvedBinaryTargets = binaryTargets2.flatMap((object) => (0, import_chunk_IOIAK7V7.parseBinaryTargetsEnvValue)(object)).map((p) => p === "native" ? binaryTarget : p);
|
|
@@ -427,17 +507,25 @@ function filterGenerators(generators, generatorNames) {
|
|
|
427
507
|
}
|
|
428
508
|
return filtered;
|
|
429
509
|
}
|
|
430
|
-
var forbiddenCmdWithDataProxyFlagMessage = (
|
|
431
|
-
Using an Accelerate URL is not supported for this CLI command ${(0, import_chunk_PG5FDKSF.green)(`prisma ${
|
|
432
|
-
Please use a direct connection to your database
|
|
510
|
+
var forbiddenCmdWithDataProxyFlagMessage = (command) => `
|
|
511
|
+
Using an Accelerate URL is not supported for this CLI command ${(0, import_chunk_PG5FDKSF.green)(`prisma ${command}`)} yet.
|
|
512
|
+
Please use a direct connection to your database via the datasource \`directUrl\` setting.
|
|
433
513
|
|
|
434
514
|
More information about this limitation: ${(0, import_chunk_I6WLABB2.link)("https://pris.ly/d/accelerate-limitations")}
|
|
435
515
|
`;
|
|
436
516
|
function checkUnsupportedDataProxy({
|
|
437
517
|
cmd,
|
|
438
|
-
|
|
518
|
+
schemaContext = void 0,
|
|
519
|
+
urls = []
|
|
439
520
|
}) {
|
|
440
|
-
|
|
521
|
+
for (const url2 of urls) {
|
|
522
|
+
if (url2 && url2.includes("prisma://")) {
|
|
523
|
+
throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (!schemaContext?.primaryDatasource) return;
|
|
527
|
+
const url = (0, import_chunk_55ZV2II2.resolveUrl)((0, import_chunk_55ZV2II2.getEffectiveUrl)(schemaContext.primaryDatasource));
|
|
528
|
+
if (url?.startsWith("prisma://")) {
|
|
441
529
|
throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
|
|
442
530
|
}
|
|
443
531
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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_DZYINYAA_exports = {};
|
|
20
|
+
__export(chunk_DZYINYAA_exports, {
|
|
21
|
+
handleLibraryLoadingErrors: () => handleLibraryLoadingErrors
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_DZYINYAA_exports);
|
|
24
|
+
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
|
25
|
+
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
26
|
+
var import_get_platform = require("@prisma/get-platform");
|
|
27
|
+
function handleLibraryLoadingErrors(args) {
|
|
28
|
+
const error = args.e;
|
|
29
|
+
const systemLibraryNotFound = (library) => `Prisma cannot find the required \`${library}\` system library in your system`;
|
|
30
|
+
const hasLinkingProblem = error.message.includes("cannot open shared object file");
|
|
31
|
+
const referToSystemRequirementsDocs = `Please refer to the documentation about Prisma's system requirements: ${(0, import_get_platform.link)(
|
|
32
|
+
"https://pris.ly/d/system-requirements"
|
|
33
|
+
)}`;
|
|
34
|
+
const errorTitle = `Unable to require(\`${(0, import_chunk_PG5FDKSF.dim)(args.id)}\`).`;
|
|
35
|
+
const potentialReasonMessage = (0, import_chunk_XKZ6CBLA.z)({ message: error.message, code: error.code }).with({ code: "ENOENT" }, () => `File does not exist.`).when(
|
|
36
|
+
({ message }) => hasLinkingProblem && message.includes("libz"),
|
|
37
|
+
() => {
|
|
38
|
+
return `${systemLibraryNotFound("libz")}. Please install it and try again.`;
|
|
39
|
+
}
|
|
40
|
+
).when(
|
|
41
|
+
({ message }) => hasLinkingProblem && message.includes("libgcc_s"),
|
|
42
|
+
() => {
|
|
43
|
+
return `${systemLibraryNotFound("libgcc_s")}. Please install it and try again.`;
|
|
44
|
+
}
|
|
45
|
+
).when(
|
|
46
|
+
({ message }) => hasLinkingProblem && message.includes("libssl"),
|
|
47
|
+
() => {
|
|
48
|
+
const libsslVersion = args.platformInfo.libssl ? `openssl-${args.platformInfo.libssl}` : "openssl";
|
|
49
|
+
return `${systemLibraryNotFound("libssl")}. Please install ${libsslVersion} and try again.`;
|
|
50
|
+
}
|
|
51
|
+
).when(
|
|
52
|
+
({ message }) => message.includes("GLIBC"),
|
|
53
|
+
() => {
|
|
54
|
+
return `Prisma has detected an incompatible version of the \`glibc\` C standard library installed in your system. This probably means your system may be too old to run Prisma. ${referToSystemRequirementsDocs}`;
|
|
55
|
+
}
|
|
56
|
+
).when(
|
|
57
|
+
({ message }) => args.platformInfo.platform === "linux" && message.includes("symbol not found"),
|
|
58
|
+
() => {
|
|
59
|
+
return `The Prisma engines are not compatible with your system ${args.platformInfo.originalDistro} on (${args.platformInfo.archFromUname}) which uses the \`${args.platformInfo.binaryTarget}\` binaryTarget by default. ${referToSystemRequirementsDocs}`;
|
|
60
|
+
}
|
|
61
|
+
).otherwise(() => {
|
|
62
|
+
return `The Prisma engines do not seem to be compatible with your system. ${referToSystemRequirementsDocs}`;
|
|
63
|
+
});
|
|
64
|
+
return `${errorTitle}
|
|
65
|
+
${potentialReasonMessage}
|
|
66
|
+
|
|
67
|
+
Details: ${error.message}`;
|
|
68
|
+
}
|
|
@@ -26,17 +26,17 @@ 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_E2QTLJH5_exports = {};
|
|
30
|
+
__export(chunk_E2QTLJH5_exports, {
|
|
31
31
|
ValidateError: () => ValidateError,
|
|
32
32
|
validate: () => validate
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
36
|
-
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
34
|
+
module.exports = __toCommonJS(chunk_E2QTLJH5_exports);
|
|
35
|
+
var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
|
|
37
36
|
var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
|
|
38
|
-
var
|
|
39
|
-
var
|
|
37
|
+
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
38
|
+
var import_chunk_WDPDHAFW = require("./chunk-WDPDHAFW.js");
|
|
39
|
+
var import_chunk_262R2PBW = require("./chunk-262R2PBW.js");
|
|
40
40
|
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
|
41
41
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
|
42
42
|
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
@@ -59,25 +59,25 @@ ${detailsHeader} ${message}`;
|
|
|
59
59
|
}).exhaustive();
|
|
60
60
|
const errorMessageWithContext = `${constructedErrorMessage}
|
|
61
61
|
[Context: validate]`;
|
|
62
|
-
super((0,
|
|
62
|
+
super((0, import_chunk_WDPDHAFW.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
63
63
|
this.name = "ValidateError";
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
function validate(options) {
|
|
67
|
-
const debugErrorType = (0,
|
|
67
|
+
const debugErrorType = (0, import_chunk_TZJROXB3.createDebugErrorType)(debug, "validateWasm");
|
|
68
68
|
debug(`Using validate Wasm`);
|
|
69
69
|
const validateEither = (0, import_function.pipe)(
|
|
70
70
|
(0, import_chunk_5DBOS77Y.tryCatch)(
|
|
71
71
|
() => {
|
|
72
|
-
if (process.env.
|
|
72
|
+
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
|
|
73
73
|
debug("Triggering a Rust panic...");
|
|
74
|
-
|
|
74
|
+
import_chunk_262R2PBW.prismaSchemaWasm.debug_panic();
|
|
75
75
|
}
|
|
76
76
|
const params = JSON.stringify({
|
|
77
77
|
prismaSchema: options.schemas,
|
|
78
78
|
noColor: Boolean(process.env.NO_COLOR)
|
|
79
79
|
});
|
|
80
|
-
|
|
80
|
+
import_chunk_262R2PBW.prismaSchemaWasm.validate(params);
|
|
81
81
|
},
|
|
82
82
|
(e) => ({
|
|
83
83
|
type: "wasm-error",
|
|
@@ -109,7 +109,7 @@ function validate(options) {
|
|
|
109
109
|
return panic;
|
|
110
110
|
}
|
|
111
111
|
const errorOutput = e.error.message;
|
|
112
|
-
return new ValidateError((0,
|
|
112
|
+
return new ValidateError((0, import_chunk_TZJROXB3.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
|
113
113
|
}).exhaustive();
|
|
114
114
|
throw error;
|
|
115
115
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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_ERSH2BQA_exports = {};
|
|
20
|
+
__export(chunk_ERSH2BQA_exports, {
|
|
21
|
+
ClientEngineType: () => ClientEngineType,
|
|
22
|
+
getClientEngineType: () => getClientEngineType
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(chunk_ERSH2BQA_exports);
|
|
25
|
+
var ClientEngineType = /* @__PURE__ */ ((ClientEngineType2) => {
|
|
26
|
+
ClientEngineType2["Library"] = "library";
|
|
27
|
+
ClientEngineType2["Binary"] = "binary";
|
|
28
|
+
ClientEngineType2["Client"] = "client";
|
|
29
|
+
return ClientEngineType2;
|
|
30
|
+
})(ClientEngineType || {});
|
|
31
|
+
function getClientEngineType(generatorConfig) {
|
|
32
|
+
const engineTypeFromEnvVar = getEngineTypeFromEnvVar();
|
|
33
|
+
if (engineTypeFromEnvVar) return engineTypeFromEnvVar;
|
|
34
|
+
if (generatorConfig?.config.engineType === "library") {
|
|
35
|
+
return "library";
|
|
36
|
+
} else if (generatorConfig?.config.engineType === "binary") {
|
|
37
|
+
return "binary";
|
|
38
|
+
} else if (generatorConfig?.config.engineType === "client") {
|
|
39
|
+
return "client";
|
|
40
|
+
} else {
|
|
41
|
+
return getDefaultEngineType();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function getEngineTypeFromEnvVar() {
|
|
45
|
+
const engineType = process.env.PRISMA_CLIENT_ENGINE_TYPE;
|
|
46
|
+
if (engineType === "library") {
|
|
47
|
+
return "library";
|
|
48
|
+
} else if (engineType === "binary") {
|
|
49
|
+
return "binary";
|
|
50
|
+
} else if (engineType === "client") {
|
|
51
|
+
return "client";
|
|
52
|
+
} else {
|
|
53
|
+
return void 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function getDefaultEngineType() {
|
|
57
|
+
return "library";
|
|
58
|
+
}
|