@ohos-ports/prisma-internals 7.10.0-beta.0
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/LICENSE +201 -0
- package/dist/Generator.d.ts +42 -0
- package/dist/Generator.js +29 -0
- package/dist/WasmPanicRegistry.d.ts +5 -0
- package/dist/WasmPanicRegistry.js +25 -0
- package/dist/WasmSchemaEngineLoader.d.ts +5 -0
- package/dist/WasmSchemaEngineLoader.js +25 -0
- package/dist/built-in-provider.d.ts +5 -0
- package/dist/built-in-provider.js +25 -0
- package/dist/chunk-2B26F5N3.js +72 -0
- package/dist/chunk-2IOZUH3U.js +26 -0
- package/dist/chunk-2SDPW6AX.js +39 -0
- package/dist/chunk-3IMRWXIL.js +176 -0
- package/dist/chunk-3TYD3ZGQ.js +115 -0
- package/dist/chunk-3U4QB2G3.js +166 -0
- package/dist/chunk-3VD46SL7.js +151 -0
- package/dist/chunk-3YOF262C.js +176 -0
- package/dist/chunk-3ZHE2IX4.js +55 -0
- package/dist/chunk-4VNS5WPM.js +61 -0
- package/dist/chunk-5AI4FIZ3.js +1342 -0
- package/dist/chunk-5BDP445D.js +51 -0
- package/dist/chunk-5DBOS77Y.js +609 -0
- package/dist/chunk-5FJ3MENK.js +30 -0
- package/dist/chunk-5I4ERIIY.js +30 -0
- package/dist/chunk-5PJQQKQI.js +106 -0
- package/dist/chunk-5VQNKCKW.js +38 -0
- package/dist/chunk-5WRIOIZY.js +31 -0
- package/dist/chunk-6JE6QGSJ.js +37 -0
- package/dist/chunk-6PWHYRKR.js +74 -0
- package/dist/chunk-6QMQ2JYG.js +122 -0
- package/dist/chunk-6Z766KGR.js +95 -0
- package/dist/chunk-74RGCSUJ.js +44 -0
- package/dist/chunk-7B5PXS6N.js +29 -0
- package/dist/chunk-ANU3HEGF.js +29 -0
- package/dist/chunk-BERN76ZI.js +347 -0
- package/dist/chunk-BGMZPA2F.js +39 -0
- package/dist/chunk-BPDMLM32.js +105 -0
- package/dist/chunk-C47SCASR.js +37 -0
- package/dist/chunk-CGFNDGGI.js +40 -0
- package/dist/chunk-CTQD6OLG.js +438 -0
- package/dist/chunk-CUD726EK.js +36 -0
- package/dist/chunk-CXEXLFVL.js +166 -0
- package/dist/chunk-CYAS6B5N.js +48 -0
- package/dist/chunk-D4VZUY3O.js +71 -0
- package/dist/chunk-DODIJPCS.js +34 -0
- package/dist/chunk-DTPFRZWV.js +31 -0
- package/dist/chunk-DUDEWDFC.js +101 -0
- package/dist/chunk-DZ4QWHTB.js +127 -0
- package/dist/chunk-E23HYCQJ.js +37 -0
- package/dist/chunk-E476ARWS.js +2091 -0
- package/dist/chunk-EKGEKB22.js +28 -0
- package/dist/chunk-EU6UOKRD.js +26 -0
- package/dist/chunk-EWPXLBGE.js +115 -0
- package/dist/chunk-FCYHZHVW.js +43 -0
- package/dist/chunk-FRVJZOHP.js +1823 -0
- package/dist/chunk-GJSFP4V4.js +30 -0
- package/dist/chunk-GXW4NTU2.js +34 -0
- package/dist/chunk-H4NI2RIK.js +35 -0
- package/dist/chunk-HHG4DGHC.js +496 -0
- package/dist/chunk-HPVMQFIY.js +407 -0
- package/dist/chunk-I2CBQZJY.js +122 -0
- package/dist/chunk-I4K46RGG.js +31 -0
- package/dist/chunk-I6WLABB2.js +429 -0
- package/dist/chunk-ICFLO5JW.js +26 -0
- package/dist/chunk-IL7PSY44.js +26 -0
- package/dist/chunk-IOIAK7V7.js +53 -0
- package/dist/chunk-IYN5VKMD.js +110 -0
- package/dist/chunk-J77ZIDXB.js +69 -0
- package/dist/chunk-J7ZPY2XA.js +47 -0
- package/dist/chunk-JFXHOFJA.js +46 -0
- package/dist/chunk-JOIHHXR6.js +2067 -0
- package/dist/chunk-JPZYSRK3.js +6412 -0
- package/dist/chunk-JTKAT4KZ.js +26 -0
- package/dist/chunk-K2EOOA2X.js +91 -0
- package/dist/chunk-KDP6C3CB.js +56 -0
- package/dist/chunk-L3LDE52J.js +51 -0
- package/dist/chunk-L6V54WGO.js +39 -0
- package/dist/chunk-LMVSIVKQ.js +62 -0
- package/dist/chunk-LPNBWFQ3.js +38 -0
- package/dist/chunk-LRBXMV4B.js +26 -0
- package/dist/chunk-LRU47BGE.js +78 -0
- package/dist/chunk-M3GBKLGE.js +24 -0
- package/dist/chunk-MCS5ZY6Y.js +27 -0
- package/dist/chunk-NBWRGVYR.js +47 -0
- package/dist/chunk-NIWBAJZV.js +36 -0
- package/dist/chunk-NTDBN2N2.js +104 -0
- package/dist/chunk-NVNI2SRU.js +4230 -0
- package/dist/chunk-OIVPX3BR.js +32 -0
- package/dist/chunk-PFYALFCY.js +26 -0
- package/dist/chunk-PG5FDKSF.js +79 -0
- package/dist/chunk-PKF53VLJ.js +26 -0
- package/dist/chunk-PTPRBA7K.js +6675 -0
- package/dist/chunk-QBNYSYZK.js +74 -0
- package/dist/chunk-QMNPESAP.js +124 -0
- package/dist/chunk-QN6PSQY7.js +37 -0
- package/dist/chunk-QVJ2BXKF.js +3997 -0
- package/dist/chunk-R47SFJ5Z.js +104 -0
- package/dist/chunk-R6QH57HZ.js +311 -0
- package/dist/chunk-RBDYOTWB.js +193 -0
- package/dist/chunk-SBUSVJCV.js +62 -0
- package/dist/chunk-SP2ETLT2.js +41 -0
- package/dist/chunk-TPCPXGC5.js +218 -0
- package/dist/chunk-TWSLDIFL.js +48 -0
- package/dist/chunk-UGR6KLZN.js +30 -0
- package/dist/chunk-UMM35VP5.js +1193 -0
- package/dist/chunk-VFNP7Q3Y.js +15529 -0
- package/dist/chunk-VNIE2AZB.js +41 -0
- package/dist/chunk-VUGB2H7M.js +438 -0
- package/dist/chunk-WFMA7DI5.js +92 -0
- package/dist/chunk-WV4QHCSM.js +26 -0
- package/dist/chunk-WXRVYSYN.js +33 -0
- package/dist/chunk-X3P4J7WW.js +28 -0
- package/dist/chunk-X77CS5RK.js +33 -0
- package/dist/chunk-XAAVALN7.js +110 -0
- package/dist/chunk-XXTPN4LB.js +41 -0
- package/dist/chunk-XYCIH36R.js +29 -0
- package/dist/chunk-Y4TOGY6I.js +30 -0
- package/dist/chunk-YNDZCLVL.js +307 -0
- package/dist/chunk-YXB6APHS.js +447 -0
- package/dist/chunk-ZJWZK45Z.js +68 -0
- package/dist/chunk-ZKWDIAVF.js +29 -0
- package/dist/cli/Help.d.ts +11 -0
- package/dist/cli/Help.js +27 -0
- package/dist/cli/checkUnsupportedDataProxy.d.ts +16 -0
- package/dist/cli/checkUnsupportedDataProxy.js +125 -0
- package/dist/cli/completion-values.d.ts +24 -0
- package/dist/cli/completion-values.js +47 -0
- package/dist/cli/directoryConfig.d.ts +11 -0
- package/dist/cli/directoryConfig.js +25 -0
- package/dist/cli/getGeneratorSuccessMessage.d.ts +7 -0
- package/dist/cli/getGeneratorSuccessMessage.js +29 -0
- package/dist/cli/getSchema.d.ts +46 -0
- package/dist/cli/getSchema.js +31 -0
- package/dist/cli/getTypescriptVersion.d.ts +1 -0
- package/dist/cli/getTypescriptVersion.js +25 -0
- package/dist/cli/hashes.d.ts +11 -0
- package/dist/cli/hashes.js +28 -0
- package/dist/cli/schemaContext.d.ts +56 -0
- package/dist/cli/schemaContext.js +126 -0
- package/dist/cli/types.d.ts +63 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/utils.d.ts +13 -0
- package/dist/cli/utils.js +27 -0
- package/dist/convertCredentials.d.ts +10 -0
- package/dist/convertCredentials.js +28 -0
- package/dist/engine-commands/errorHelpers.d.ts +4 -0
- package/dist/engine-commands/errorHelpers.js +28 -0
- package/dist/engine-commands/formatSchema.d.ts +22 -0
- package/dist/engine-commands/formatSchema.js +124 -0
- package/dist/engine-commands/getConfig.d.ts +27 -0
- package/dist/engine-commands/getConfig.js +39 -0
- package/dist/engine-commands/getDmmf.d.ts +21 -0
- package/dist/engine-commands/getDmmf.js +40 -0
- package/dist/engine-commands/getEngineVersion.d.ts +4 -0
- package/dist/engine-commands/getEngineVersion.js +33 -0
- package/dist/engine-commands/getEnginesInfo.d.ts +20 -0
- package/dist/engine-commands/getEnginesInfo.js +36 -0
- package/dist/engine-commands/index.d.ts +10 -0
- package/dist/engine-commands/index.js +136 -0
- package/dist/engine-commands/lintSchema.d.ts +26 -0
- package/dist/engine-commands/lintSchema.js +34 -0
- package/dist/engine-commands/mergeSchemas.d.ts +12 -0
- package/dist/engine-commands/mergeSchemas.js +39 -0
- package/dist/engine-commands/queryEngineCommons.d.ts +31 -0
- package/dist/engine-commands/queryEngineCommons.js +33 -0
- package/dist/engine-commands/relativizePathInPSLError.d.ts +1 -0
- package/dist/engine-commands/relativizePathInPSLError.js +25 -0
- package/dist/engine-commands/validate.d.ts +12 -0
- package/dist/engine-commands/validate.js +39 -0
- package/dist/errorReporting.d.ts +25 -0
- package/dist/errorReporting.js +29 -0
- package/dist/get-generators/getGenerators.d.ts +71 -0
- package/dist/get-generators/getGenerators.js +127 -0
- package/dist/get-generators/utils/binaryTypeToEngineType.d.ts +3 -0
- package/dist/get-generators/utils/binaryTypeToEngineType.js +25 -0
- package/dist/get-generators/utils/engineTypeToBinaryType.d.ts +3 -0
- package/dist/get-generators/utils/engineTypeToBinaryType.js +25 -0
- package/dist/get-generators/utils/fixBinaryTargets.d.ts +3 -0
- package/dist/get-generators/utils/fixBinaryTargets.js +25 -0
- package/dist/get-generators/utils/getBinaryPathsByVersion.d.ts +7 -0
- package/dist/get-generators/utils/getBinaryPathsByVersion.js +30 -0
- package/dist/get-generators/utils/getEngineVersionForGenerator.d.ts +2 -0
- package/dist/get-generators/utils/getEngineVersionForGenerator.js +25 -0
- package/dist/get-generators/utils/printGeneratorConfig.d.ts +9 -0
- package/dist/get-generators/utils/printGeneratorConfig.js +29 -0
- package/dist/getPackedPackage.d.ts +1 -0
- package/dist/getPackedPackage.js +29 -0
- package/dist/highlight/highlight.d.ts +3 -0
- package/dist/highlight/highlight.js +32 -0
- package/dist/highlight/languages/dml.d.ts +2 -0
- package/dist/highlight/languages/dml.js +25 -0
- package/dist/highlight/languages/sql.d.ts +2 -0
- package/dist/highlight/languages/sql.js +25 -0
- package/dist/highlight/prism.d.ts +6 -0
- package/dist/highlight/prism.js +28 -0
- package/dist/highlight/theme.d.ts +2 -0
- package/dist/highlight/theme.js +26 -0
- package/dist/highlight/types.d.ts +35 -0
- package/dist/highlight/types.js +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +257 -0
- package/dist/logger.d.ts +14 -0
- package/dist/logger.js +32 -0
- package/dist/magic-string.es-B2CP4FDB.js +1324 -0
- package/dist/migrateTypes.d.ts +99 -0
- package/dist/migrateTypes.js +1 -0
- package/dist/multipart-parser-3AFJFP6K.js +374 -0
- package/dist/panic.d.ts +31 -0
- package/dist/panic.js +29 -0
- package/dist/resolveBinary.d.ts +6 -0
- package/dist/resolveBinary.js +34 -0
- package/dist/resolveOutput.d.ts +5 -0
- package/dist/resolveOutput.js +25 -0
- package/dist/resolvePkg.d.ts +7 -0
- package/dist/resolvePkg.js +25 -0
- package/dist/schemaEngineCommands.d.ts +36 -0
- package/dist/schemaEngineCommands.js +36 -0
- package/dist/sendPanic.d.ts +10 -0
- package/dist/sendPanic.js +29 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.js +1 -0
- package/dist/utils/__tests__/isCi.test.js +58 -0
- package/dist/utils/__tests__/isInteractive.test.js +47 -0
- package/dist/utils/assertAlways.d.ts +14 -0
- package/dist/utils/assertAlways.js +25 -0
- package/dist/utils/assertNever.d.ts +27 -0
- package/dist/utils/assertNever.js +25 -0
- package/dist/utils/binaryTargetRegex.d.ts +8 -0
- package/dist/utils/binaryTargetRegex.js +25 -0
- package/dist/utils/callOnce.d.ts +13 -0
- package/dist/utils/callOnce.js +25 -0
- package/dist/utils/callOnce.test.d.ts +1 -0
- package/dist/utils/callOnce.test.js +36 -0
- package/dist/utils/canPrompt.d.ts +1 -0
- package/dist/utils/canPrompt.js +27 -0
- package/dist/utils/chmodPlusX.d.ts +1 -0
- package/dist/utils/chmodPlusX.js +25 -0
- package/dist/utils/drawBox.d.ts +9 -0
- package/dist/utils/drawBox.js +26 -0
- package/dist/utils/extractPreviewFeatures.d.ts +2 -0
- package/dist/utils/extractPreviewFeatures.js +28 -0
- package/dist/utils/formatTable.d.ts +5 -0
- package/dist/utils/formatTable.js +25 -0
- package/dist/utils/formatms.d.ts +5 -0
- package/dist/utils/formatms.js +25 -0
- package/dist/utils/fs-functional.d.ts +53 -0
- package/dist/utils/fs-functional.js +35 -0
- package/dist/utils/fs-utils.d.ts +30 -0
- package/dist/utils/fs-utils.js +32 -0
- package/dist/utils/getCommandWithExecutor.d.ts +1 -0
- package/dist/utils/getCommandWithExecutor.js +26 -0
- package/dist/utils/getGitHubIssueUrl.d.ts +18 -0
- package/dist/utils/getGitHubIssueUrl.js +27 -0
- package/dist/utils/getVersionFromPackageJson.d.ts +1 -0
- package/dist/utils/getVersionFromPackageJson.js +26 -0
- package/dist/utils/handlePanic.d.ts +11 -0
- package/dist/utils/handlePanic.js +36 -0
- package/dist/utils/hasOwnProperty.d.ts +1 -0
- package/dist/utils/hasOwnProperty.js +25 -0
- package/dist/utils/isCi.d.ts +1 -0
- package/dist/utils/isCi.js +25 -0
- package/dist/utils/isCurrentBinInstalledGlobally.d.ts +1 -0
- package/dist/utils/isCurrentBinInstalledGlobally.js +25 -0
- package/dist/utils/isInContainer.d.ts +5 -0
- package/dist/utils/isInContainer.js +25 -0
- package/dist/utils/isInNpmLifecycleHook.d.ts +4 -0
- package/dist/utils/isInNpmLifecycleHook.js +25 -0
- package/dist/utils/isInteractive.d.ts +6 -0
- package/dist/utils/isInteractive.js +25 -0
- package/dist/utils/isPromiseLike.d.ts +1 -0
- package/dist/utils/isPromiseLike.js +25 -0
- package/dist/utils/isValidJsIdentifier.d.ts +1 -0
- package/dist/utils/isValidJsIdentifier.js +25 -0
- package/dist/utils/keyBy.d.ts +9 -0
- package/dist/utils/keyBy.js +25 -0
- package/dist/utils/link.d.ts +1 -0
- package/dist/utils/link.js +26 -0
- package/dist/utils/mapKeys.d.ts +1 -0
- package/dist/utils/mapKeys.js +25 -0
- package/dist/utils/mapObjectValues.d.ts +1 -0
- package/dist/utils/mapObjectValues.js +25 -0
- package/dist/utils/max.d.ts +11 -0
- package/dist/utils/max.js +26 -0
- package/dist/utils/max.test.d.ts +1 -0
- package/dist/utils/max.test.js +22 -0
- package/dist/utils/maybeInGitHook.d.ts +9 -0
- package/dist/utils/maybeInGitHook.js +25 -0
- package/dist/utils/missingDatasource.d.ts +1 -0
- package/dist/utils/missingDatasource.js +32 -0
- package/dist/utils/missingGeneratorMessage.d.ts +3 -0
- package/dist/utils/missingGeneratorMessage.js +34 -0
- package/dist/utils/now.d.ts +3 -0
- package/dist/utils/now.js +51 -0
- package/dist/utils/omit.d.ts +6 -0
- package/dist/utils/omit.js +30 -0
- package/dist/utils/parseAWSNodejsRuntimeEnvVarVersion.d.ts +1 -0
- package/dist/utils/parseAWSNodejsRuntimeEnvVarVersion.js +25 -0
- package/dist/utils/parseEnvValue.d.ts +17 -0
- package/dist/utils/parseEnvValue.js +27 -0
- package/dist/utils/path.d.ts +14 -0
- package/dist/utils/path.js +26 -0
- package/dist/utils/path.test.d.ts +1 -0
- package/dist/utils/path.test.js +54 -0
- package/dist/utils/pick.d.ts +1 -0
- package/dist/utils/pick.js +25 -0
- package/dist/utils/printConfigWarnings.d.ts +1 -0
- package/dist/utils/printConfigWarnings.js +26 -0
- package/dist/utils/prismaPostgres.d.ts +13 -0
- package/dist/utils/prismaPostgres.js +28 -0
- package/dist/utils/prismaPostgres.test.d.ts +1 -0
- package/dist/utils/prismaPostgres.test.js +33 -0
- package/dist/utils/schemaFileInput.d.ts +2 -0
- package/dist/utils/schemaFileInput.js +25 -0
- package/dist/utils/setClassName.d.ts +9 -0
- package/dist/utils/setClassName.js +25 -0
- package/dist/utils/toSchemasContainer.d.ts +5 -0
- package/dist/utils/toSchemasContainer.js +26 -0
- package/dist/utils/unique.d.ts +5 -0
- package/dist/utils/unique.js +38 -0
- package/dist/utils/validatePrismaConfigWithDatasource.d.ts +17 -0
- package/dist/utils/validatePrismaConfigWithDatasource.js +28 -0
- package/dist/utils/vercelPkgPathRegex.d.ts +1 -0
- package/dist/utils/vercelPkgPathRegex.js +25 -0
- package/dist/warnOnce.d.ts +1 -0
- package/dist/warnOnce.js +27 -0
- package/dist/wasm.d.ts +5 -0
- package/dist/wasm.js +29 -0
- package/package.json +93 -0
|
@@ -0,0 +1,176 @@
|
|
|
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_3IMRWXIL_exports = {};
|
|
30
|
+
__export(chunk_3IMRWXIL_exports, {
|
|
31
|
+
GetConfigError: () => GetConfigError,
|
|
32
|
+
getConfig: () => getConfig
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(chunk_3IMRWXIL_exports);
|
|
35
|
+
var import_chunk_6Z766KGR = require("./chunk-6Z766KGR.js");
|
|
36
|
+
var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
|
|
37
|
+
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
38
|
+
var import_chunk_5WRIOIZY = require("./chunk-5WRIOIZY.js");
|
|
39
|
+
var import_chunk_5BDP445D = require("./chunk-5BDP445D.js");
|
|
40
|
+
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
|
41
|
+
var import_chunk_YNDZCLVL = require("./chunk-YNDZCLVL.js");
|
|
42
|
+
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
43
|
+
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
44
|
+
var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
|
|
45
|
+
var import_debug = __toESM(require("@prisma/debug"));
|
|
46
|
+
var import_get_platform = require("@prisma/get-platform");
|
|
47
|
+
var import_function = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R6QH57HZ.require_function)());
|
|
48
|
+
var debug = (0, import_debug.default)("prisma:getConfig");
|
|
49
|
+
var SCHEMA_VALIDATION_ERROR_CODE = "P1012";
|
|
50
|
+
var GetConfigError = class extends Error {
|
|
51
|
+
constructor(params) {
|
|
52
|
+
const constructedErrorMessage = (0, import_chunk_YNDZCLVL.M)(params).with({ _tag: "parsed" }, ({ errorCode, message, reason }) => {
|
|
53
|
+
const errorCodeMessage = errorCode ? `Error code: ${errorCode}` : "";
|
|
54
|
+
return `${reason}
|
|
55
|
+
${errorCodeMessage}
|
|
56
|
+
${message}`;
|
|
57
|
+
}).with({ _tag: "unparsed" }, ({ message, reason }) => {
|
|
58
|
+
const detailsHeader = (0, import_chunk_PG5FDKSF.red)((0, import_chunk_PG5FDKSF.bold)("Details:"));
|
|
59
|
+
return `${reason}
|
|
60
|
+
${detailsHeader} ${message}`;
|
|
61
|
+
}).exhaustive();
|
|
62
|
+
const errorMessageWithContext = `${constructedErrorMessage}
|
|
63
|
+
[Context: getConfig]`;
|
|
64
|
+
super((0, import_chunk_5WRIOIZY.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
65
|
+
this.name = "GetConfigError";
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
async function getConfig(options) {
|
|
69
|
+
const debugErrorType = (0, import_chunk_6Z766KGR.createDebugErrorType)(debug, "getConfigWasm");
|
|
70
|
+
debug(`Using getConfig Wasm`);
|
|
71
|
+
const configEither = (0, import_function.pipe)(
|
|
72
|
+
(0, import_chunk_5DBOS77Y.tryCatch)(
|
|
73
|
+
() => {
|
|
74
|
+
if (process.env.FORCE_PANIC_GET_CONFIG) {
|
|
75
|
+
debug("Triggering a Rust panic...");
|
|
76
|
+
import_chunk_5BDP445D.prismaSchemaWasm.debug_panic();
|
|
77
|
+
}
|
|
78
|
+
const params = JSON.stringify({ prismaSchema: options.datamodel });
|
|
79
|
+
return import_chunk_5BDP445D.prismaSchemaWasm.get_config(params);
|
|
80
|
+
},
|
|
81
|
+
(e) => ({
|
|
82
|
+
type: "wasm-error",
|
|
83
|
+
reason: "(get-config wasm)",
|
|
84
|
+
error: e
|
|
85
|
+
})
|
|
86
|
+
),
|
|
87
|
+
(0, import_chunk_5DBOS77Y.map)((result) => ({ result })),
|
|
88
|
+
(0, import_chunk_5DBOS77Y.chainW)(
|
|
89
|
+
({ result }) => (
|
|
90
|
+
// NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings
|
|
91
|
+
(0, import_chunk_5DBOS77Y.tryCatch)(
|
|
92
|
+
() => JSON.parse(result),
|
|
93
|
+
(e) => ({
|
|
94
|
+
type: "parse-json",
|
|
95
|
+
reason: "Unable to parse JSON",
|
|
96
|
+
error: e
|
|
97
|
+
})
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
),
|
|
101
|
+
(0, import_chunk_5DBOS77Y.chainW)((response) => {
|
|
102
|
+
if (response.errors.length > 0) {
|
|
103
|
+
return (0, import_chunk_5DBOS77Y.left)({
|
|
104
|
+
type: "validation-error",
|
|
105
|
+
reason: "(get-config wasm)",
|
|
106
|
+
error: response.errors
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return (0, import_chunk_5DBOS77Y.right)(response.config);
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
if ((0, import_chunk_5DBOS77Y.isRight)(configEither)) {
|
|
113
|
+
debug("config data retrieved without errors in getConfig Wasm");
|
|
114
|
+
const { right: data } = configEither;
|
|
115
|
+
for (const generator of data.generators) {
|
|
116
|
+
await resolveBinaryTargets(generator);
|
|
117
|
+
}
|
|
118
|
+
return Promise.resolve(data);
|
|
119
|
+
}
|
|
120
|
+
const error = (0, import_chunk_YNDZCLVL.M)(configEither.left).with({ type: "wasm-error" }, (e) => {
|
|
121
|
+
debugErrorType(e);
|
|
122
|
+
if ((0, import_chunk_LMVSIVKQ.isWasmPanic)(e.error)) {
|
|
123
|
+
const { message, stack } = (0, import_chunk_LMVSIVKQ.getWasmError)(e.error);
|
|
124
|
+
const panic = new import_chunk_LMVSIVKQ.RustPanic(
|
|
125
|
+
/* message */
|
|
126
|
+
message,
|
|
127
|
+
/* rustStack */
|
|
128
|
+
stack,
|
|
129
|
+
/* request */
|
|
130
|
+
"@prisma/prisma-schema-wasm get_config",
|
|
131
|
+
"FMT_CLI"
|
|
132
|
+
/* FMT_CLI */
|
|
133
|
+
);
|
|
134
|
+
return panic;
|
|
135
|
+
}
|
|
136
|
+
const errorOutput = e.error.message;
|
|
137
|
+
return new GetConfigError((0, import_chunk_6Z766KGR.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
|
138
|
+
}).with({ type: "validation-error" }, (e) => {
|
|
139
|
+
return new GetConfigError({
|
|
140
|
+
_tag: "parsed",
|
|
141
|
+
errorCode: SCHEMA_VALIDATION_ERROR_CODE,
|
|
142
|
+
reason: (0, import_chunk_6Z766KGR.createSchemaValidationError)(e.reason),
|
|
143
|
+
message: formatErrors(e.error)
|
|
144
|
+
});
|
|
145
|
+
}).otherwise((e) => {
|
|
146
|
+
debugErrorType(e);
|
|
147
|
+
return new GetConfigError({ _tag: "unparsed", message: e.error.message, reason: e.reason });
|
|
148
|
+
});
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
async function resolveBinaryTargets(generator) {
|
|
152
|
+
for (const binaryTarget of generator.binaryTargets) {
|
|
153
|
+
if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {
|
|
154
|
+
const value = JSON.parse(process.env[binaryTarget.fromEnvVar]);
|
|
155
|
+
if (Array.isArray(value)) {
|
|
156
|
+
generator.binaryTargets = value.map((v) => ({ fromEnvVar: null, value: v }));
|
|
157
|
+
await resolveBinaryTargets(generator);
|
|
158
|
+
} else {
|
|
159
|
+
binaryTarget.value = value;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (binaryTarget.value === "native") {
|
|
163
|
+
binaryTarget.value = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
|
164
|
+
binaryTarget.native = true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (generator.binaryTargets.length === 0) {
|
|
168
|
+
generator.binaryTargets = [{ fromEnvVar: null, value: await (0, import_get_platform.getBinaryTargetForCurrentPlatform)(), native: true }];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function formatErrors(errors) {
|
|
172
|
+
const formattedErrors = errors.map((e) => (0, import_chunk_C47SCASR.relativizePathInPSLError)(e.message)).join("\n\n");
|
|
173
|
+
const errorCount = `Validation Error Count: ${errors.length}`;
|
|
174
|
+
return `${formattedErrors}
|
|
175
|
+
${errorCount}`;
|
|
176
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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_3TYD3ZGQ_exports = {};
|
|
30
|
+
__export(chunk_3TYD3ZGQ_exports, {
|
|
31
|
+
ValidateError: () => ValidateError,
|
|
32
|
+
validate: () => validate
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(chunk_3TYD3ZGQ_exports);
|
|
35
|
+
var import_chunk_6Z766KGR = require("./chunk-6Z766KGR.js");
|
|
36
|
+
var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
|
|
37
|
+
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
38
|
+
var import_chunk_I4K46RGG = require("./chunk-I4K46RGG.js");
|
|
39
|
+
var import_chunk_L3LDE52J = require("./chunk-L3LDE52J.js");
|
|
40
|
+
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
|
41
|
+
var import_chunk_YNDZCLVL = require("./chunk-YNDZCLVL.js");
|
|
42
|
+
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
43
|
+
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
44
|
+
var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
|
|
45
|
+
var import_debug = __toESM(require("@prisma/debug"));
|
|
46
|
+
var import_function = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R6QH57HZ.require_function)());
|
|
47
|
+
var debug = (0, import_debug.default)("prisma:validate");
|
|
48
|
+
var ValidateError = class extends Error {
|
|
49
|
+
constructor(params) {
|
|
50
|
+
const constructedErrorMessage = (0, import_chunk_YNDZCLVL.M)(params).with({ _tag: "parsed" }, ({ errorCode, message, reason }) => {
|
|
51
|
+
const errorCodeMessage = errorCode ? `Error code: ${errorCode}` : "";
|
|
52
|
+
return `${reason}
|
|
53
|
+
${errorCodeMessage}
|
|
54
|
+
${(0, import_chunk_C47SCASR.relativizePathInPSLError)(message)}`;
|
|
55
|
+
}).with({ _tag: "unparsed" }, ({ message, reason }) => {
|
|
56
|
+
const detailsHeader = (0, import_chunk_PG5FDKSF.red)((0, import_chunk_PG5FDKSF.bold)("Details:"));
|
|
57
|
+
return `${reason}
|
|
58
|
+
${detailsHeader} ${message}`;
|
|
59
|
+
}).exhaustive();
|
|
60
|
+
const errorMessageWithContext = `${constructedErrorMessage}
|
|
61
|
+
[Context: validate]`;
|
|
62
|
+
super((0, import_chunk_I4K46RGG.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
63
|
+
this.name = "ValidateError";
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
function validate(options) {
|
|
67
|
+
const debugErrorType = (0, import_chunk_6Z766KGR.createDebugErrorType)(debug, "validateWasm");
|
|
68
|
+
debug(`Using validate Wasm`);
|
|
69
|
+
const validateEither = (0, import_function.pipe)(
|
|
70
|
+
(0, import_chunk_5DBOS77Y.tryCatch)(
|
|
71
|
+
() => {
|
|
72
|
+
if (process.env.FORCE_PANIC_GET_DMMF) {
|
|
73
|
+
debug("Triggering a Rust panic...");
|
|
74
|
+
import_chunk_L3LDE52J.prismaSchemaWasm.debug_panic();
|
|
75
|
+
}
|
|
76
|
+
const params = JSON.stringify({
|
|
77
|
+
prismaSchema: options.schemas,
|
|
78
|
+
noColor: Boolean(process.env.NO_COLOR)
|
|
79
|
+
});
|
|
80
|
+
import_chunk_L3LDE52J.prismaSchemaWasm.validate(params);
|
|
81
|
+
},
|
|
82
|
+
(e) => ({
|
|
83
|
+
type: "wasm-error",
|
|
84
|
+
reason: "(validate wasm)",
|
|
85
|
+
error: e
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
if ((0, import_chunk_5DBOS77Y.isRight)(validateEither)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const error = (0, import_chunk_YNDZCLVL.M)(validateEither.left).with({ type: "wasm-error" }, (e) => {
|
|
93
|
+
debugErrorType(e);
|
|
94
|
+
console.error("");
|
|
95
|
+
if ((0, import_chunk_LMVSIVKQ.isWasmPanic)(e.error)) {
|
|
96
|
+
const { message, stack } = (0, import_chunk_LMVSIVKQ.getWasmError)(e.error);
|
|
97
|
+
debug(`Error validating schema: ${message}`);
|
|
98
|
+
debug(stack);
|
|
99
|
+
const panic = new import_chunk_LMVSIVKQ.RustPanic(
|
|
100
|
+
/* message */
|
|
101
|
+
message,
|
|
102
|
+
/* rustStack */
|
|
103
|
+
stack,
|
|
104
|
+
/* request */
|
|
105
|
+
"@prisma/prisma-schema-wasm validate",
|
|
106
|
+
"FMT_CLI"
|
|
107
|
+
/* FMT_CLI */
|
|
108
|
+
);
|
|
109
|
+
return panic;
|
|
110
|
+
}
|
|
111
|
+
const errorOutput = e.error.message;
|
|
112
|
+
return new ValidateError((0, import_chunk_6Z766KGR.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
|
113
|
+
}).exhaustive();
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
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_3U4QB2G3_exports = {};
|
|
30
|
+
__export(chunk_3U4QB2G3_exports, {
|
|
31
|
+
credentialsToUri: () => credentialsToUri,
|
|
32
|
+
protocolToConnectorType: () => protocolToConnectorType,
|
|
33
|
+
uriToCredentials: () => uriToCredentials
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(chunk_3U4QB2G3_exports);
|
|
36
|
+
var import_chunk_LPNBWFQ3 = require("./chunk-LPNBWFQ3.js");
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var NodeURL = __toESM(require("url"));
|
|
39
|
+
function credentialsToUri(credentials) {
|
|
40
|
+
const type = databaseTypeToProtocol(credentials.type);
|
|
41
|
+
if (credentials.type === "sqlite") {
|
|
42
|
+
return credentials.uri;
|
|
43
|
+
}
|
|
44
|
+
const url = new NodeURL.URL(type + "//");
|
|
45
|
+
if (credentials.host) {
|
|
46
|
+
url.hostname = credentials.host;
|
|
47
|
+
}
|
|
48
|
+
if (credentials.type === "postgresql") {
|
|
49
|
+
if (credentials.database) {
|
|
50
|
+
url.pathname = "/" + credentials.database;
|
|
51
|
+
}
|
|
52
|
+
if (credentials.schema) {
|
|
53
|
+
url.searchParams.set("schema", credentials.schema);
|
|
54
|
+
}
|
|
55
|
+
if (credentials.socket) {
|
|
56
|
+
url.host = credentials.socket;
|
|
57
|
+
}
|
|
58
|
+
} else if (credentials.type === "mysql") {
|
|
59
|
+
url.pathname = "/" + (credentials.database || credentials.schema || "");
|
|
60
|
+
if (credentials.socket) {
|
|
61
|
+
url.searchParams.set("socket", credentials.socket);
|
|
62
|
+
}
|
|
63
|
+
} else if (credentials.type === "mongodb") {
|
|
64
|
+
url.pathname = "/" + credentials.database;
|
|
65
|
+
}
|
|
66
|
+
if (credentials.ssl) {
|
|
67
|
+
url.searchParams.set("sslmode", "prefer");
|
|
68
|
+
}
|
|
69
|
+
if (credentials.user) {
|
|
70
|
+
url.username = credentials.user;
|
|
71
|
+
}
|
|
72
|
+
if (credentials.password) {
|
|
73
|
+
url.password = credentials.password;
|
|
74
|
+
}
|
|
75
|
+
if (credentials.port) {
|
|
76
|
+
url.port = String(credentials.port);
|
|
77
|
+
}
|
|
78
|
+
url.host = `${url.hostname}${url.port ? `:${url.port}` : ""}`;
|
|
79
|
+
if (credentials.extraFields) {
|
|
80
|
+
for (const [key, value] of Object.entries(credentials.extraFields)) {
|
|
81
|
+
url.searchParams.set(key, value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (url.pathname === "/") {
|
|
85
|
+
url.pathname = "";
|
|
86
|
+
}
|
|
87
|
+
return url.toString();
|
|
88
|
+
}
|
|
89
|
+
function uriToCredentials(connectionString) {
|
|
90
|
+
let uri;
|
|
91
|
+
try {
|
|
92
|
+
uri = new NodeURL.URL(connectionString);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
throw new Error("Invalid data source URL, see https://pris.ly/d/config-url");
|
|
95
|
+
}
|
|
96
|
+
const type = protocolToConnectorType(uri.protocol);
|
|
97
|
+
const exists = (str) => str && str.length > 0;
|
|
98
|
+
const extraFields = {};
|
|
99
|
+
const schema = uri.searchParams.get("schema");
|
|
100
|
+
const socket = uri.searchParams.get("socket");
|
|
101
|
+
for (const [name, value] of uri.searchParams) {
|
|
102
|
+
if (!["schema", "socket"].includes(name)) {
|
|
103
|
+
extraFields[name] = value;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
let database = void 0;
|
|
107
|
+
if (type === "sqlite" && uri.pathname) {
|
|
108
|
+
if (uri.pathname.startsWith("file:")) {
|
|
109
|
+
database = uri.pathname.slice(5);
|
|
110
|
+
} else {
|
|
111
|
+
database = import_path.default.basename(uri.pathname);
|
|
112
|
+
}
|
|
113
|
+
} else if (uri.pathname.length > 1) {
|
|
114
|
+
database = uri.pathname.slice(1);
|
|
115
|
+
if (type === "postgresql" && !database) {
|
|
116
|
+
database = "postgres";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
type,
|
|
121
|
+
host: exists(uri.hostname) ? uri.hostname : void 0,
|
|
122
|
+
user: exists(uri.username) ? uri.username : void 0,
|
|
123
|
+
port: exists(uri.port) ? Number(uri.port) : void 0,
|
|
124
|
+
password: exists(uri.password) ? uri.password : void 0,
|
|
125
|
+
database,
|
|
126
|
+
schema: schema || void 0,
|
|
127
|
+
uri: connectionString,
|
|
128
|
+
ssl: Boolean(uri.searchParams.get("sslmode")),
|
|
129
|
+
socket: socket || void 0,
|
|
130
|
+
extraFields
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function databaseTypeToProtocol(databaseType) {
|
|
134
|
+
switch (databaseType) {
|
|
135
|
+
case "postgresql":
|
|
136
|
+
case "cockroachdb":
|
|
137
|
+
return "postgresql:";
|
|
138
|
+
case "mysql":
|
|
139
|
+
return "mysql:";
|
|
140
|
+
case "mongodb":
|
|
141
|
+
return "mongodb:";
|
|
142
|
+
case "sqlite":
|
|
143
|
+
return "file:";
|
|
144
|
+
case "sqlserver":
|
|
145
|
+
return "sqlserver:";
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`Unknown databaseType ${databaseType}`);
|
|
148
|
+
}
|
|
149
|
+
function protocolToConnectorType(protocol) {
|
|
150
|
+
switch (protocol) {
|
|
151
|
+
case "postgresql:":
|
|
152
|
+
case "postgres:":
|
|
153
|
+
case import_chunk_LPNBWFQ3.PRISMA_POSTGRES_PROTOCOL:
|
|
154
|
+
return "postgresql";
|
|
155
|
+
case "mongodb+srv:":
|
|
156
|
+
case "mongodb:":
|
|
157
|
+
return "mongodb";
|
|
158
|
+
case "mysql:":
|
|
159
|
+
return "mysql";
|
|
160
|
+
case "file:":
|
|
161
|
+
return "sqlite";
|
|
162
|
+
case "sqlserver:":
|
|
163
|
+
return "sqlserver";
|
|
164
|
+
}
|
|
165
|
+
throw new Error(`Unknown protocol ${protocol}`);
|
|
166
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
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_3VD46SL7_exports = {};
|
|
30
|
+
__export(chunk_3VD46SL7_exports, {
|
|
31
|
+
getEnginesInfo: () => getEnginesInfo,
|
|
32
|
+
resolveEngine: () => resolveEngine
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(chunk_3VD46SL7_exports);
|
|
35
|
+
var import_chunk_L6V54WGO = require("./chunk-L6V54WGO.js");
|
|
36
|
+
var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
|
|
37
|
+
var import_chunk_5PJQQKQI = require("./chunk-5PJQQKQI.js");
|
|
38
|
+
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
|
39
|
+
var import_chunk_YNDZCLVL = require("./chunk-YNDZCLVL.js");
|
|
40
|
+
var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
|
|
41
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
|
+
var import_function2 = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R6QH57HZ.require_function)());
|
|
44
|
+
var none2 = import_chunk_5DBOS77Y.none;
|
|
45
|
+
var some2 = import_chunk_5DBOS77Y.some;
|
|
46
|
+
var getRight = function(ma) {
|
|
47
|
+
return ma._tag === "Left" ? none2 : some2(ma.right);
|
|
48
|
+
};
|
|
49
|
+
var _map = function(fa, f) {
|
|
50
|
+
return (0, import_chunk_5DBOS77Y.pipe)(fa, map(f));
|
|
51
|
+
};
|
|
52
|
+
var _ap = function(fab, fa) {
|
|
53
|
+
return (0, import_chunk_5DBOS77Y.pipe)(fab, ap(fa));
|
|
54
|
+
};
|
|
55
|
+
var URI = "Option";
|
|
56
|
+
var map = function(f) {
|
|
57
|
+
return function(fa) {
|
|
58
|
+
return isNone(fa) ? none2 : some2(f(fa.value));
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var Functor = {
|
|
62
|
+
URI,
|
|
63
|
+
map: _map
|
|
64
|
+
};
|
|
65
|
+
var as2 = (0, import_chunk_5DBOS77Y.dual)(2, (0, import_chunk_5DBOS77Y.as)(Functor));
|
|
66
|
+
var asUnit2 = (0, import_chunk_5DBOS77Y.asUnit)(Functor);
|
|
67
|
+
var ap = function(fa) {
|
|
68
|
+
return function(fab) {
|
|
69
|
+
return isNone(fab) ? none2 : isNone(fa) ? none2 : some2(fab.value(fa.value));
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
var flatMap = /* @__PURE__ */ (0, import_chunk_5DBOS77Y.dual)(2, function(ma, f) {
|
|
73
|
+
return isNone(ma) ? none2 : f(ma.value);
|
|
74
|
+
});
|
|
75
|
+
var Chain = {
|
|
76
|
+
URI,
|
|
77
|
+
map: _map,
|
|
78
|
+
ap: _ap,
|
|
79
|
+
chain: flatMap
|
|
80
|
+
};
|
|
81
|
+
var orElse = (0, import_chunk_5DBOS77Y.dual)(2, function(self, that) {
|
|
82
|
+
return isNone(self) ? that() : self;
|
|
83
|
+
});
|
|
84
|
+
var fromEither2 = getRight;
|
|
85
|
+
var FromEither = {
|
|
86
|
+
URI,
|
|
87
|
+
fromEither: fromEither2
|
|
88
|
+
};
|
|
89
|
+
var isSome2 = import_chunk_5DBOS77Y.isSome;
|
|
90
|
+
var isNone = function(fa) {
|
|
91
|
+
return fa._tag === "None";
|
|
92
|
+
};
|
|
93
|
+
var matchW = function(onNone, onSome) {
|
|
94
|
+
return function(ma) {
|
|
95
|
+
return isNone(ma) ? onNone() : onSome(ma.value);
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
var match = matchW;
|
|
99
|
+
var fold = match;
|
|
100
|
+
var tap2 = /* @__PURE__ */ (0, import_chunk_5DBOS77Y.dual)(2, (0, import_chunk_5DBOS77Y.tap)(Chain));
|
|
101
|
+
var tapEither2 = /* @__PURE__ */ (0, import_chunk_5DBOS77Y.dual)(2, (0, import_chunk_5DBOS77Y.tapEither)(FromEither, Chain));
|
|
102
|
+
var fromNullable = function(a) {
|
|
103
|
+
return a == null ? none2 : some2(a);
|
|
104
|
+
};
|
|
105
|
+
function getEnginesInfo(enginesInfo) {
|
|
106
|
+
const errors = [];
|
|
107
|
+
const resolved = (0, import_chunk_YNDZCLVL.M)(enginesInfo).with({ fromEnvVar: import_chunk_YNDZCLVL.z.when(isSome2) }, (_engineInfo) => {
|
|
108
|
+
return `, resolved by ${_engineInfo.fromEnvVar.value}`;
|
|
109
|
+
}).otherwise(() => "");
|
|
110
|
+
const absolutePath = (0, import_chunk_YNDZCLVL.M)(enginesInfo).with({ path: import_chunk_YNDZCLVL.z.when(import_chunk_5DBOS77Y.isRight) }, (_engineInfo) => {
|
|
111
|
+
return _engineInfo.path.right;
|
|
112
|
+
}).with({ path: import_chunk_YNDZCLVL.z.when(import_chunk_5DBOS77Y.isLeft) }, (_engineInfo) => {
|
|
113
|
+
errors.push(_engineInfo.path.left);
|
|
114
|
+
return "E_CANNOT_RESOLVE_PATH";
|
|
115
|
+
}).exhaustive();
|
|
116
|
+
const version = (0, import_chunk_YNDZCLVL.M)(enginesInfo).with({ version: import_chunk_YNDZCLVL.z.when(import_chunk_5DBOS77Y.isRight) }, (_engineInfo) => {
|
|
117
|
+
return _engineInfo.version.right;
|
|
118
|
+
}).with({ version: import_chunk_YNDZCLVL.z.when(import_chunk_5DBOS77Y.isLeft) }, (_engineInfo) => {
|
|
119
|
+
errors.push(_engineInfo.version.left);
|
|
120
|
+
return "E_CANNOT_RESOLVE_VERSION";
|
|
121
|
+
}).exhaustive();
|
|
122
|
+
const versionMessage = `${version} (at ${import_path.default.relative(process.cwd(), absolutePath)}${resolved})`;
|
|
123
|
+
return [versionMessage, errors];
|
|
124
|
+
}
|
|
125
|
+
async function resolveEngine(binaryName) {
|
|
126
|
+
const pathFromEnvOption = fromNullable((0, import_fetch_engine.getBinaryEnvVarPath)(binaryName));
|
|
127
|
+
const fromEnvVarOption = (0, import_function2.pipe)(
|
|
128
|
+
pathFromEnvOption,
|
|
129
|
+
map((p) => p.fromEnvVar)
|
|
130
|
+
);
|
|
131
|
+
const enginePathEither = await (0, import_function2.pipe)(
|
|
132
|
+
pathFromEnvOption,
|
|
133
|
+
fold(
|
|
134
|
+
() => (0, import_chunk_5PJQQKQI.safeResolveBinary)(binaryName),
|
|
135
|
+
(pathFromEnv) => (0, import_chunk_5DBOS77Y.right2)(pathFromEnv.path)
|
|
136
|
+
)
|
|
137
|
+
)();
|
|
138
|
+
const versionEither = await (0, import_function2.pipe)(
|
|
139
|
+
enginePathEither,
|
|
140
|
+
import_chunk_5DBOS77Y.fromEither,
|
|
141
|
+
(0, import_chunk_5DBOS77Y.chain)((enginePath) => {
|
|
142
|
+
return (0, import_chunk_L6V54WGO.safeGetEngineVersion)(enginePath, binaryName);
|
|
143
|
+
})
|
|
144
|
+
)();
|
|
145
|
+
const engineInfo = {
|
|
146
|
+
path: enginePathEither,
|
|
147
|
+
version: versionEither,
|
|
148
|
+
fromEnvVar: fromEnvVarOption
|
|
149
|
+
};
|
|
150
|
+
return engineInfo;
|
|
151
|
+
}
|