@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_OPLMJ5WZ_exports = {};
|
|
30
|
+
__export(chunk_OPLMJ5WZ_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_OPLMJ5WZ_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_QLOP3Z4E = require("./chunk-QLOP3Z4E.js");
|
|
59
|
+
var import_chunk_QPQF4VGD = require("./chunk-QPQF4VGD.js");
|
|
60
|
+
var import_chunk_656EKQL7 = require("./chunk-656EKQL7.js");
|
|
61
|
+
var import_chunk_KH7FI42S = require("./chunk-KH7FI42S.js");
|
|
62
|
+
var import_chunk_EYVG6XQS = require("./chunk-EYVG6XQS.js");
|
|
63
|
+
var import_chunk_262R2PBW = require("./chunk-262R2PBW.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_262R2PBW.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_656EKQL7.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
|
98
123
|
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
|
99
124
|
});
|
|
100
|
-
const lintWarnings = (0,
|
|
125
|
+
const lintWarnings = (0, import_chunk_656EKQL7.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_262R2PBW.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_QLOP3Z4E.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_QPQF4VGD.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_KH7FI42S.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_QPQF4VGD.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_QLOP3Z4E.resolveUrl)((0, import_chunk_QLOP3Z4E.getEffectiveUrl)(schemaContext.primaryDatasource));
|
|
528
|
+
if (url?.startsWith("prisma://")) {
|
|
441
529
|
throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
|
|
442
530
|
}
|
|
443
531
|
}
|
|
@@ -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_OSHZ4P3G_exports = {};
|
|
20
|
+
__export(chunk_OSHZ4P3G_exports, {
|
|
21
21
|
toSchemasContainer: () => toSchemasContainer,
|
|
22
22
|
toSchemasWithConfigDir: () => toSchemasWithConfigDir
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_OSHZ4P3G_exports);
|
|
25
25
|
function toSchemasContainer(schemas) {
|
|
26
26
|
return {
|
|
27
27
|
files: multipleSchemasToSchemaContainers(schemas)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function toSchemasWithConfigDir(schemaContext
|
|
30
|
+
function toSchemasWithConfigDir(schemaContext) {
|
|
31
31
|
return {
|
|
32
32
|
files: multipleSchemasToSchemaContainers(schemaContext.schemaFiles),
|
|
33
|
-
configDir
|
|
33
|
+
configDir: schemaContext.primaryDatasourceDirectory
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function multipleSchemasToSchemaContainers(schemas) {
|
|
@@ -26,16 +26,16 @@ 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_OWUYXGDF_exports = {};
|
|
30
|
+
__export(chunk_OWUYXGDF_exports, {
|
|
31
31
|
GetDmmfError: () => GetDmmfError,
|
|
32
32
|
getDMMF: () => getDMMF
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
34
|
+
module.exports = __toCommonJS(chunk_OWUYXGDF_exports);
|
|
35
|
+
var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
|
|
36
36
|
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var import_chunk_QDT7TGYZ = require("./chunk-QDT7TGYZ.js");
|
|
38
|
+
var import_chunk_WKP2TVYB = require("./chunk-WKP2TVYB.js");
|
|
39
39
|
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
|
40
40
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
|
41
41
|
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
@@ -58,25 +58,25 @@ ${detailsHeader} ${message}`;
|
|
|
58
58
|
}).exhaustive();
|
|
59
59
|
const errorMessageWithContext = `${constructedErrorMessage}
|
|
60
60
|
[Context: getDmmf]`;
|
|
61
|
-
super((0,
|
|
61
|
+
super((0, import_chunk_QDT7TGYZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
62
62
|
this.name = "GetDmmfError";
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
async function getDMMF(options) {
|
|
66
|
-
const debugErrorType = (0,
|
|
66
|
+
const debugErrorType = (0, import_chunk_TZJROXB3.createDebugErrorType)(debug, "getDmmfWasm");
|
|
67
67
|
debug(`Using getDmmf Wasm`);
|
|
68
68
|
const dmmfPipeline = (0, import_function.pipe)(
|
|
69
69
|
(0, import_chunk_5DBOS77Y.tryCatch)(
|
|
70
70
|
() => {
|
|
71
|
-
if (process.env.
|
|
71
|
+
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
|
|
72
72
|
debug("Triggering a Rust panic...");
|
|
73
|
-
|
|
73
|
+
import_chunk_WKP2TVYB.prismaSchemaWasm.debug_panic();
|
|
74
74
|
}
|
|
75
75
|
const params = JSON.stringify({
|
|
76
76
|
prismaSchema: options.datamodel,
|
|
77
77
|
noColor: Boolean(process.env.NO_COLOR)
|
|
78
78
|
});
|
|
79
|
-
const data =
|
|
79
|
+
const data = import_chunk_WKP2TVYB.prismaSchemaWasm.get_dmmf(params);
|
|
80
80
|
return data;
|
|
81
81
|
},
|
|
82
82
|
(e) => ({
|
|
@@ -124,7 +124,7 @@ async function getDMMF(options) {
|
|
|
124
124
|
return panic;
|
|
125
125
|
}
|
|
126
126
|
const errorOutput = e.error.message;
|
|
127
|
-
return new GetDmmfError((0,
|
|
127
|
+
return new GetDmmfError((0, import_chunk_TZJROXB3.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
|
128
128
|
}).with({ type: "parse-json" }, (e) => {
|
|
129
129
|
debugErrorType(e);
|
|
130
130
|
return new GetDmmfError({ _tag: "unparsed", message: e.error.message, reason: e.reason });
|
|
@@ -0,0 +1,41 @@
|
|
|
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_PZMRR772_exports = {};
|
|
20
|
+
__export(chunk_PZMRR772_exports, {
|
|
21
|
+
loadEnvFile: () => loadEnvFile
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_PZMRR772_exports);
|
|
24
|
+
var import_chunk_46ABODUM = require("./chunk-46ABODUM.js");
|
|
25
|
+
var import_chunk_3FP46GUV = require("./chunk-3FP46GUV.js");
|
|
26
|
+
async function loadEnvFile({
|
|
27
|
+
schemaPath,
|
|
28
|
+
config,
|
|
29
|
+
printMessage = false
|
|
30
|
+
}) {
|
|
31
|
+
if (config.loadedFromFile) {
|
|
32
|
+
process.stderr.write(`Prisma config detected, skipping environment variable loading.
|
|
33
|
+
`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const envPaths = await (0, import_chunk_46ABODUM.getEnvPaths)(schemaPath);
|
|
37
|
+
const envData = (0, import_chunk_3FP46GUV.tryLoadEnvs)(envPaths, { conflictCheck: "error" });
|
|
38
|
+
if (printMessage && envData && envData.message) {
|
|
39
|
+
process.stderr.write(envData.message + "\n");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_QDT7TGYZ_exports = {};
|
|
20
|
+
__export(chunk_QDT7TGYZ_exports, {
|
|
21
21
|
addVersionDetailsToErrorMessage: () => addVersionDetailsToErrorMessage
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_QDT7TGYZ_exports);
|
|
24
|
+
var import_chunk_H43XC5ET = require("./chunk-H43XC5ET.js");
|
|
25
25
|
var import_chunk_QN6PSQY7 = require("./chunk-QN6PSQY7.js");
|
|
26
26
|
function addVersionDetailsToErrorMessage(message) {
|
|
27
|
-
const rows = [["Prisma CLI Version",
|
|
27
|
+
const rows = [["Prisma CLI Version", import_chunk_H43XC5ET.version]];
|
|
28
28
|
return `${message}
|
|
29
29
|
|
|
30
30
|
${(0, import_chunk_QN6PSQY7.formatTable)(rows)}`;
|
|
@@ -26,17 +26,20 @@ 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_QLOP3Z4E_exports = {};
|
|
30
|
+
__export(chunk_QLOP3Z4E_exports, {
|
|
31
31
|
GetConfigError: () => GetConfigError,
|
|
32
|
-
getConfig: () => getConfig
|
|
32
|
+
getConfig: () => getConfig,
|
|
33
|
+
getDirectUrl: () => getDirectUrl,
|
|
34
|
+
getEffectiveUrl: () => getEffectiveUrl,
|
|
35
|
+
resolveUrl: () => resolveUrl
|
|
33
36
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
36
|
-
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
37
|
+
module.exports = __toCommonJS(chunk_QLOP3Z4E_exports);
|
|
38
|
+
var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
|
|
37
39
|
var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
+
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
41
|
+
var import_chunk_WDPDHAFW = require("./chunk-WDPDHAFW.js");
|
|
42
|
+
var import_chunk_262R2PBW = require("./chunk-262R2PBW.js");
|
|
40
43
|
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
|
41
44
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
|
42
45
|
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
@@ -61,22 +64,41 @@ ${detailsHeader} ${message}`;
|
|
|
61
64
|
}).exhaustive();
|
|
62
65
|
const errorMessageWithContext = `${constructedErrorMessage}
|
|
63
66
|
[Context: getConfig]`;
|
|
64
|
-
super((0,
|
|
67
|
+
super((0, import_chunk_WDPDHAFW.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
65
68
|
this.name = "GetConfigError";
|
|
66
69
|
}
|
|
67
70
|
};
|
|
71
|
+
function getEffectiveUrl(ds) {
|
|
72
|
+
if (ds.directUrl !== void 0) return ds.directUrl;
|
|
73
|
+
return ds.url;
|
|
74
|
+
}
|
|
75
|
+
function getDirectUrl(ds) {
|
|
76
|
+
return ds.directUrl;
|
|
77
|
+
}
|
|
78
|
+
function resolveUrl(envValue) {
|
|
79
|
+
const urlFromValue = envValue?.value;
|
|
80
|
+
const urlEnvVarName = envValue?.fromEnvVar;
|
|
81
|
+
const urlEnvVarValue = urlEnvVarName ? process.env[urlEnvVarName] : void 0;
|
|
82
|
+
return urlFromValue ?? urlEnvVarValue;
|
|
83
|
+
}
|
|
68
84
|
async function getConfig(options) {
|
|
69
|
-
const debugErrorType = (0,
|
|
85
|
+
const debugErrorType = (0, import_chunk_TZJROXB3.createDebugErrorType)(debug, "getConfigWasm");
|
|
70
86
|
debug(`Using getConfig Wasm`);
|
|
71
87
|
const configEither = (0, import_function.pipe)(
|
|
72
88
|
(0, import_chunk_5DBOS77Y.tryCatch)(
|
|
73
89
|
() => {
|
|
74
|
-
if (process.env.
|
|
90
|
+
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {
|
|
75
91
|
debug("Triggering a Rust panic...");
|
|
76
|
-
|
|
92
|
+
import_chunk_262R2PBW.prismaSchemaWasm.debug_panic();
|
|
77
93
|
}
|
|
78
|
-
const params = JSON.stringify({
|
|
79
|
-
|
|
94
|
+
const params = JSON.stringify({
|
|
95
|
+
prismaSchema: options.datamodel,
|
|
96
|
+
datasourceOverrides: {},
|
|
97
|
+
ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
|
|
98
|
+
env: process.env
|
|
99
|
+
});
|
|
100
|
+
const data = import_chunk_262R2PBW.prismaSchemaWasm.get_config(params);
|
|
101
|
+
return data;
|
|
80
102
|
},
|
|
81
103
|
(e) => ({
|
|
82
104
|
type: "wasm-error",
|
|
@@ -134,12 +156,12 @@ async function getConfig(options) {
|
|
|
134
156
|
return panic;
|
|
135
157
|
}
|
|
136
158
|
const errorOutput = e.error.message;
|
|
137
|
-
return new GetConfigError((0,
|
|
159
|
+
return new GetConfigError((0, import_chunk_TZJROXB3.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
|
138
160
|
}).with({ type: "validation-error" }, (e) => {
|
|
139
161
|
return new GetConfigError({
|
|
140
162
|
_tag: "parsed",
|
|
141
163
|
errorCode: SCHEMA_VALIDATION_ERROR_CODE,
|
|
142
|
-
reason: (0,
|
|
164
|
+
reason: (0, import_chunk_TZJROXB3.createSchemaValidationError)(e.reason),
|
|
143
165
|
message: formatErrors(e.error)
|
|
144
166
|
});
|
|
145
167
|
}).otherwise((e) => {
|