@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,438 @@
|
|
|
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_CTQD6OLG_exports = {};
|
|
30
|
+
__export(chunk_CTQD6OLG_exports, {
|
|
31
|
+
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
|
32
|
+
forbiddenCmdWithDataProxyFlagMessage: () => forbiddenCmdWithDataProxyFlagMessage,
|
|
33
|
+
formatSchema: () => formatSchema,
|
|
34
|
+
getBinaryTargetForCurrentPlatform: () => import_get_platform2.getBinaryTargetForCurrentPlatform,
|
|
35
|
+
getGenerator: () => getGenerator,
|
|
36
|
+
getGenerators: () => getGenerators,
|
|
37
|
+
getSchemaDatasourceProvider: () => getSchemaDatasourceProvider,
|
|
38
|
+
knownBinaryTargets: () => knownBinaryTargets,
|
|
39
|
+
loadSchemaContext: () => loadSchemaContext,
|
|
40
|
+
processSchemaResult: () => processSchemaResult,
|
|
41
|
+
skipIndex: () => skipIndex
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(chunk_CTQD6OLG_exports);
|
|
44
|
+
var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
|
|
45
|
+
var import_chunk_DZ4QWHTB = require("./chunk-DZ4QWHTB.js");
|
|
46
|
+
var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
|
|
47
|
+
var import_chunk_LRU47BGE = require("./chunk-LRU47BGE.js");
|
|
48
|
+
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
|
|
49
|
+
var import_chunk_WFMA7DI5 = require("./chunk-WFMA7DI5.js");
|
|
50
|
+
var import_chunk_GXW4NTU2 = require("./chunk-GXW4NTU2.js");
|
|
51
|
+
var import_chunk_BGMZPA2F = require("./chunk-BGMZPA2F.js");
|
|
52
|
+
var import_chunk_I6WLABB2 = require("./chunk-I6WLABB2.js");
|
|
53
|
+
var import_chunk_3YOF262C = require("./chunk-3YOF262C.js");
|
|
54
|
+
var import_chunk_NTDBN2N2 = require("./chunk-NTDBN2N2.js");
|
|
55
|
+
var import_chunk_6PWHYRKR = require("./chunk-6PWHYRKR.js");
|
|
56
|
+
var import_chunk_IYN5VKMD = require("./chunk-IYN5VKMD.js");
|
|
57
|
+
var import_chunk_TPCPXGC5 = require("./chunk-TPCPXGC5.js");
|
|
58
|
+
var import_chunk_L3LDE52J = require("./chunk-L3LDE52J.js");
|
|
59
|
+
var import_chunk_ZJWZK45Z = require("./chunk-ZJWZK45Z.js");
|
|
60
|
+
var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
|
|
61
|
+
var import_chunk_YNDZCLVL = require("./chunk-YNDZCLVL.js");
|
|
62
|
+
var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
|
|
63
|
+
var import_chunk_BPDMLM32 = require("./chunk-BPDMLM32.js");
|
|
64
|
+
var import_chunk_IOIAK7V7 = require("./chunk-IOIAK7V7.js");
|
|
65
|
+
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
66
|
+
var import_chunk_PTPRBA7K = require("./chunk-PTPRBA7K.js");
|
|
67
|
+
var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
|
|
68
|
+
var import_node_path = __toESM(require("node:path"));
|
|
69
|
+
var import_debug = __toESM(require("@prisma/debug"));
|
|
70
|
+
var import_debug2 = __toESM(require("@prisma/debug"));
|
|
71
|
+
var import_engines = require("@prisma/engines");
|
|
72
|
+
var import_get_platform = require("@prisma/get-platform");
|
|
73
|
+
var import_path = __toESM(require("path"));
|
|
74
|
+
var import_get_platform2 = require("@prisma/get-platform");
|
|
75
|
+
var debug = (0, import_debug.default)("prisma:format");
|
|
76
|
+
async function formatSchema({ schemas }, inputFormattingOptions) {
|
|
77
|
+
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
|
78
|
+
handleFormatPanic(() => {
|
|
79
|
+
import_chunk_L3LDE52J.prismaSchemaWasm.debug_panic();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const defaultFormattingOptions = {
|
|
83
|
+
tabSize: 2,
|
|
84
|
+
insertSpaces: true
|
|
85
|
+
};
|
|
86
|
+
const documentFormattingParams = {
|
|
87
|
+
textDocument: { uri: "file:/dev/null" },
|
|
88
|
+
options: {
|
|
89
|
+
...defaultFormattingOptions,
|
|
90
|
+
...inputFormattingOptions
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(() => {
|
|
94
|
+
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
|
|
95
|
+
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
|
96
|
+
const lintDiagnostics2 = (0, import_chunk_6PWHYRKR.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
|
97
|
+
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
|
98
|
+
});
|
|
99
|
+
const lintWarnings = (0, import_chunk_6PWHYRKR.getLintWarningsAsText)(lintDiagnostics);
|
|
100
|
+
if (lintWarnings && import_chunk_ZJWZK45Z.logger_exports.should.warn()) {
|
|
101
|
+
console.warn(lintWarnings);
|
|
102
|
+
}
|
|
103
|
+
return Promise.resolve(formattedMultipleSchemas);
|
|
104
|
+
}
|
|
105
|
+
function handleFormatPanic(tryCb) {
|
|
106
|
+
try {
|
|
107
|
+
return tryCb();
|
|
108
|
+
} catch (e) {
|
|
109
|
+
const { message, stack } = (0, import_chunk_LMVSIVKQ.getWasmError)(e);
|
|
110
|
+
debug(`Error formatting schema: ${message}`);
|
|
111
|
+
debug(stack);
|
|
112
|
+
const panic = new import_chunk_LMVSIVKQ.RustPanic(
|
|
113
|
+
/* message */
|
|
114
|
+
message,
|
|
115
|
+
/* rustStack */
|
|
116
|
+
stack,
|
|
117
|
+
/* request */
|
|
118
|
+
"@prisma/prisma-schema-wasm format",
|
|
119
|
+
"FMT_CLI"
|
|
120
|
+
/* FMT_CLI */
|
|
121
|
+
);
|
|
122
|
+
throw panic;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function formatWasm(schema, documentFormattingParams) {
|
|
126
|
+
const formattedSchema = import_chunk_L3LDE52J.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
|
127
|
+
return formattedSchema;
|
|
128
|
+
}
|
|
129
|
+
async function loadSchemaContext({ schemaPath, printLoadMessage, allowNull, schemaPathArgumentName, cwd } = {
|
|
130
|
+
schemaPath: { baseDir: process.cwd() },
|
|
131
|
+
printLoadMessage: true,
|
|
132
|
+
allowNull: false,
|
|
133
|
+
schemaPathArgumentName: "--schema",
|
|
134
|
+
cwd: process.cwd()
|
|
135
|
+
}) {
|
|
136
|
+
let schemaResult = null;
|
|
137
|
+
if (allowNull) {
|
|
138
|
+
schemaResult = await (0, import_chunk_TPCPXGC5.getSchemaWithPathOptional)({ schemaPath, cwd, argumentName: schemaPathArgumentName });
|
|
139
|
+
if (!schemaResult) return null;
|
|
140
|
+
} else {
|
|
141
|
+
schemaResult = await (0, import_chunk_TPCPXGC5.getSchemaWithPath)({ schemaPath, cwd, argumentName: schemaPathArgumentName });
|
|
142
|
+
}
|
|
143
|
+
return processSchemaResult({ schemaResult, printLoadMessage, cwd });
|
|
144
|
+
}
|
|
145
|
+
async function processSchemaResult({
|
|
146
|
+
schemaResult,
|
|
147
|
+
printLoadMessage = true,
|
|
148
|
+
cwd = process.cwd()
|
|
149
|
+
}) {
|
|
150
|
+
const loadedFromPathForLogMessages = import_node_path.default.relative(cwd, schemaResult.schemaPath);
|
|
151
|
+
const schemaRootDir = schemaResult.schemaRootDir || cwd;
|
|
152
|
+
if (printLoadMessage) {
|
|
153
|
+
(0, import_chunk_TPCPXGC5.printSchemaLoadedMessage)(loadedFromPathForLogMessages);
|
|
154
|
+
}
|
|
155
|
+
const configFromPsl = await (0, import_chunk_3YOF262C.getConfig)({ datamodel: schemaResult.schemas });
|
|
156
|
+
const primaryDatasource = configFromPsl.datasources.at(0);
|
|
157
|
+
return {
|
|
158
|
+
schemaFiles: schemaResult.schemas,
|
|
159
|
+
schemaPath: schemaResult.schemaPath,
|
|
160
|
+
schemaRootDir,
|
|
161
|
+
datasources: configFromPsl.datasources,
|
|
162
|
+
generators: configFromPsl.generators,
|
|
163
|
+
primaryDatasource,
|
|
164
|
+
warnings: configFromPsl.warnings,
|
|
165
|
+
loadedFromPathForLogMessages
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function getSchemaDatasourceProvider(schemaContext) {
|
|
169
|
+
if (schemaContext.primaryDatasource === void 0) {
|
|
170
|
+
throw new Error("Schema must contain a datasource block");
|
|
171
|
+
}
|
|
172
|
+
return schemaContext.primaryDatasource.activeProvider;
|
|
173
|
+
}
|
|
174
|
+
var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_PTPRBA7K.require_p_map)());
|
|
175
|
+
var debug2 = (0, import_debug2.default)("prisma:getGenerators");
|
|
176
|
+
async function getGenerators(options) {
|
|
177
|
+
if (options.registry === void 0 && options.providerAliases !== void 0) {
|
|
178
|
+
options.registry = Object.fromEntries(
|
|
179
|
+
Object.entries(options.providerAliases).map(([name, definition]) => [
|
|
180
|
+
name,
|
|
181
|
+
{
|
|
182
|
+
type: "rpc",
|
|
183
|
+
generatorPath: definition.generatorPath,
|
|
184
|
+
isNode: definition.isNode
|
|
185
|
+
}
|
|
186
|
+
])
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
const {
|
|
190
|
+
schemaPath,
|
|
191
|
+
registry,
|
|
192
|
+
version: version2,
|
|
193
|
+
printDownloadProgress,
|
|
194
|
+
overrideGenerators,
|
|
195
|
+
skipDownload,
|
|
196
|
+
binaryPathsOverride,
|
|
197
|
+
generatorNames = [],
|
|
198
|
+
allowNoModels = true,
|
|
199
|
+
typedSql
|
|
200
|
+
} = options;
|
|
201
|
+
const schemaContext = !options.schemaContext && schemaPath ? await loadSchemaContext({ schemaPath: { cliProvidedPath: schemaPath } }) : options.schemaContext;
|
|
202
|
+
if (!schemaContext) {
|
|
203
|
+
throw new Error(`no schema provided for getGenerators`);
|
|
204
|
+
}
|
|
205
|
+
if (!schemaContext.primaryDatasource) {
|
|
206
|
+
throw new Error(import_chunk_BGMZPA2F.missingDatasource);
|
|
207
|
+
}
|
|
208
|
+
(0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
|
|
209
|
+
const dmmf = await (0, import_chunk_NTDBN2N2.getDMMF)({ datamodel: schemaContext.schemaFiles });
|
|
210
|
+
if (dmmf.datamodel.models.length === 0 && !allowNoModels) {
|
|
211
|
+
if (schemaContext.primaryDatasource.provider === "mongodb") {
|
|
212
|
+
throw new Error((0, import_chunk_WFMA7DI5.missingModelMessageMongoDB)(options.cliCommand));
|
|
213
|
+
}
|
|
214
|
+
throw new Error((0, import_chunk_WFMA7DI5.missingModelMessage)(options.cliCommand));
|
|
215
|
+
}
|
|
216
|
+
const generatorConfigs = filterGenerators(overrideGenerators || schemaContext.generators, generatorNames);
|
|
217
|
+
await validateGenerators(generatorConfigs);
|
|
218
|
+
const runningGenerators = [];
|
|
219
|
+
try {
|
|
220
|
+
const generators = await (0, import_p_map.default)(
|
|
221
|
+
generatorConfigs,
|
|
222
|
+
async (generatorConfig, index) => {
|
|
223
|
+
const baseDir = import_path.default.dirname(generatorConfig.sourceFilePath ?? schemaContext.schemaRootDir);
|
|
224
|
+
const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.provider);
|
|
225
|
+
const generatorDefinition = registry[providerValue] ?? {
|
|
226
|
+
type: "rpc",
|
|
227
|
+
generatorPath: providerValue
|
|
228
|
+
};
|
|
229
|
+
const generatorInstance = (0, import_chunk_YNDZCLVL.M)(generatorDefinition).with({ type: "in-process" }, ({ generator }) => new import_chunk_BPDMLM32.InProcessGenerator(generatorConfig, generator)).with(
|
|
230
|
+
{ type: "rpc" },
|
|
231
|
+
({ generatorPath, isNode }) => new import_chunk_BPDMLM32.JsonRpcGenerator(generatorPath, generatorConfig, isNode)
|
|
232
|
+
).exhaustive();
|
|
233
|
+
await generatorInstance.init();
|
|
234
|
+
if (generatorConfig.output) {
|
|
235
|
+
generatorConfig.output = {
|
|
236
|
+
value: import_path.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.output)),
|
|
237
|
+
fromEnvVar: null
|
|
238
|
+
};
|
|
239
|
+
generatorConfig.isCustomOutput = true;
|
|
240
|
+
} else {
|
|
241
|
+
if (!generatorInstance.manifest?.defaultOutput) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
`Can't resolve output dir for generator ${(0, import_chunk_PG5FDKSF.bold)(generatorConfig.name)} with provider ${(0, import_chunk_PG5FDKSF.bold)(
|
|
244
|
+
generatorConfig.provider.value
|
|
245
|
+
)}.
|
|
246
|
+
You need to define \`output\` in the generator block in the schema file.`
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
generatorConfig.output = {
|
|
250
|
+
value: await (0, import_chunk_2B26F5N3.resolveOutput)({
|
|
251
|
+
defaultOutput: generatorInstance.manifest.defaultOutput,
|
|
252
|
+
baseDir
|
|
253
|
+
}),
|
|
254
|
+
fromEnvVar: null
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const datamodel = (0, import_chunk_IYN5VKMD.mergeSchemas)({ schemas: schemaContext.schemaFiles });
|
|
258
|
+
const options2 = {
|
|
259
|
+
datamodel,
|
|
260
|
+
datasources: schemaContext.datasources,
|
|
261
|
+
generator: generatorConfig,
|
|
262
|
+
dmmf,
|
|
263
|
+
otherGenerators: skipIndex(generatorConfigs, index),
|
|
264
|
+
schemaPath: schemaContext.schemaPath,
|
|
265
|
+
// TODO:(schemaPath) can we get rid of schema path passing here?
|
|
266
|
+
version: version2 || import_engines.enginesVersion,
|
|
267
|
+
// this version makes no sense anymore and should be ignored
|
|
268
|
+
allowNoModels,
|
|
269
|
+
typedSql
|
|
270
|
+
};
|
|
271
|
+
generatorInstance.setOptions(options2);
|
|
272
|
+
runningGenerators.push(generatorInstance);
|
|
273
|
+
return generatorInstance;
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
stopOnError: false
|
|
277
|
+
// needed so we can first make sure all generators are created properly, then cleaned up properly
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
const generatorProviders = generatorConfigs.map((g) => (0, import_chunk_IOIAK7V7.parseEnvValue)(g.provider));
|
|
281
|
+
for (const g of generators) {
|
|
282
|
+
if (g.manifest && g.manifest.requiresGenerators && g.manifest.requiresGenerators.length > 0) {
|
|
283
|
+
for (const neededGenerator of g.manifest.requiresGenerators) {
|
|
284
|
+
if (!generatorProviders.includes(neededGenerator)) {
|
|
285
|
+
throw new Error(
|
|
286
|
+
`Generator "${g.manifest.prettyName}" requires generator "${neededGenerator}", but it is missing in your schema.prisma.
|
|
287
|
+
Please add it to your schema.prisma:
|
|
288
|
+
|
|
289
|
+
generator gen {
|
|
290
|
+
provider = "${neededGenerator}"
|
|
291
|
+
}
|
|
292
|
+
`
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const neededVersions = /* @__PURE__ */ Object.create(null);
|
|
299
|
+
for (const g of generators) {
|
|
300
|
+
if (g.manifest && g.manifest.requiresEngines && Array.isArray(g.manifest.requiresEngines) && g.manifest.requiresEngines.length > 0) {
|
|
301
|
+
const neededVersion = (0, import_chunk_X3P4J7WW.getEngineVersionForGenerator)(g.manifest, version2);
|
|
302
|
+
if (!neededVersions[neededVersion]) {
|
|
303
|
+
neededVersions[neededVersion] = { engines: [], binaryTargets: [] };
|
|
304
|
+
}
|
|
305
|
+
for (const engine of g.manifest.requiresEngines) {
|
|
306
|
+
if (!neededVersions[neededVersion].engines.includes(engine)) {
|
|
307
|
+
neededVersions[neededVersion].engines.push(engine);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const generatorBinaryTargets = g.options?.generator?.binaryTargets;
|
|
311
|
+
if (generatorBinaryTargets && generatorBinaryTargets.length > 0) {
|
|
312
|
+
for (const binaryTarget of generatorBinaryTargets) {
|
|
313
|
+
if (!neededVersions[neededVersion].binaryTargets.find((object) => object.value === binaryTarget.value)) {
|
|
314
|
+
neededVersions[neededVersion].binaryTargets.push(binaryTarget);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
debug2("neededVersions", JSON.stringify(neededVersions, null, 2));
|
|
321
|
+
const { binaryPathsByVersion } = await (0, import_chunk_DZ4QWHTB.getBinaryPathsByVersion)({
|
|
322
|
+
neededVersions,
|
|
323
|
+
// We're lazily computing the binary target here, to avoid printing the
|
|
324
|
+
// `Prisma failed to detect the libssl/openssl version to use` warning
|
|
325
|
+
// on StackBlitz, where the binary target is not detected.
|
|
326
|
+
//
|
|
327
|
+
// On other platforms, it's safe and fast to call this function again,
|
|
328
|
+
// as its result is memoized anyway.
|
|
329
|
+
detectBinaryTarget: import_get_platform.getBinaryTargetForCurrentPlatform,
|
|
330
|
+
version: version2,
|
|
331
|
+
printDownloadProgress,
|
|
332
|
+
skipDownload,
|
|
333
|
+
binaryPathsOverride
|
|
334
|
+
});
|
|
335
|
+
for (const generator of generators) {
|
|
336
|
+
if (generator.manifest && generator.manifest.requiresEngines) {
|
|
337
|
+
const engineVersion = (0, import_chunk_X3P4J7WW.getEngineVersionForGenerator)(generator.manifest, version2);
|
|
338
|
+
const binaryPaths = binaryPathsByVersion[engineVersion];
|
|
339
|
+
const generatorBinaryPaths = (0, import_chunk_GXW4NTU2.pick)(binaryPaths ?? {}, generator.manifest.requiresEngines);
|
|
340
|
+
debug2({ generatorBinaryPaths });
|
|
341
|
+
generator.setBinaryPaths(generatorBinaryPaths);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return generators;
|
|
345
|
+
} catch (e) {
|
|
346
|
+
runningGenerators.forEach((g) => g.stop());
|
|
347
|
+
throw e;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async function getGenerator(options) {
|
|
351
|
+
const generators = await getGenerators(options);
|
|
352
|
+
return generators[0];
|
|
353
|
+
}
|
|
354
|
+
function skipIndex(arr, index) {
|
|
355
|
+
return [...arr.slice(0, index), ...arr.slice(index + 1)];
|
|
356
|
+
}
|
|
357
|
+
var knownBinaryTargets = [...import_get_platform.binaryTargets, "native"];
|
|
358
|
+
var oldToNewBinaryTargetsMapping = {
|
|
359
|
+
"linux-glibc-libssl1.0.1": "debian-openssl-1.0.x",
|
|
360
|
+
"linux-glibc-libssl1.0.2": "debian-openssl-1.0.x",
|
|
361
|
+
"linux-glibc-libssl1.1.0": "debian-openssl1.1.x"
|
|
362
|
+
};
|
|
363
|
+
async function validateGenerators(generators) {
|
|
364
|
+
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
|
365
|
+
for (const generator of generators) {
|
|
366
|
+
if (generator.binaryTargets) {
|
|
367
|
+
const binaryTargets2 = generator.binaryTargets && generator.binaryTargets.length > 0 ? generator.binaryTargets : [{ fromEnvVar: null, value: "native" }];
|
|
368
|
+
const resolvedBinaryTargets = binaryTargets2.flatMap((object) => (0, import_chunk_IOIAK7V7.parseBinaryTargetsEnvValue)(object)).map((p) => p === "native" ? binaryTarget : p);
|
|
369
|
+
for (const resolvedBinaryTarget of resolvedBinaryTargets) {
|
|
370
|
+
if (oldToNewBinaryTargetsMapping[resolvedBinaryTarget]) {
|
|
371
|
+
throw new Error(
|
|
372
|
+
`Binary target ${(0, import_chunk_PG5FDKSF.red)((0, import_chunk_PG5FDKSF.bold)(resolvedBinaryTarget))} is deprecated. Please use ${(0, import_chunk_PG5FDKSF.green)(
|
|
373
|
+
(0, import_chunk_PG5FDKSF.bold)(oldToNewBinaryTargetsMapping[resolvedBinaryTarget])
|
|
374
|
+
)} instead.`
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
if (!knownBinaryTargets.includes(resolvedBinaryTarget)) {
|
|
378
|
+
throw new Error(
|
|
379
|
+
`Unknown binary target ${(0, import_chunk_PG5FDKSF.red)(resolvedBinaryTarget)} in generator ${(0, import_chunk_PG5FDKSF.bold)(generator.name)}.
|
|
380
|
+
Possible binaryTargets: ${(0, import_chunk_PG5FDKSF.green)(knownBinaryTargets.join(", "))}`
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (!resolvedBinaryTargets.includes(binaryTarget)) {
|
|
385
|
+
const originalBinaryTargetsConfig = (0, import_chunk_LRU47BGE.getOriginalBinaryTargetsValue)(generator.binaryTargets);
|
|
386
|
+
console.log(`${(0, import_chunk_PG5FDKSF.yellow)("Warning:")} Your current platform \`${(0, import_chunk_PG5FDKSF.bold)(
|
|
387
|
+
binaryTarget
|
|
388
|
+
)}\` is not included in your generator's \`binaryTargets\` configuration ${JSON.stringify(
|
|
389
|
+
originalBinaryTargetsConfig
|
|
390
|
+
)}.
|
|
391
|
+
To fix it, use this generator config in your ${(0, import_chunk_PG5FDKSF.bold)("schema.prisma")}:
|
|
392
|
+
${(0, import_chunk_PG5FDKSF.green)(
|
|
393
|
+
(0, import_chunk_LRU47BGE.printGeneratorConfig)({
|
|
394
|
+
...generator,
|
|
395
|
+
binaryTargets: (0, import_chunk_X77CS5RK.fixBinaryTargets)(generator.binaryTargets, binaryTarget)
|
|
396
|
+
})
|
|
397
|
+
)}
|
|
398
|
+
${(0, import_chunk_PG5FDKSF.gray)(
|
|
399
|
+
`Note, that by providing \`native\`, Prisma Client automatically resolves \`${binaryTarget}\`.
|
|
400
|
+
Read more about deploying Prisma Client: ${(0, import_chunk_PG5FDKSF.underline)(
|
|
401
|
+
"https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/generators"
|
|
402
|
+
)}`
|
|
403
|
+
)}
|
|
404
|
+
`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function filterGenerators(generators, generatorNames) {
|
|
410
|
+
if (generatorNames.length < 1) {
|
|
411
|
+
return generators;
|
|
412
|
+
}
|
|
413
|
+
const filtered = generators.filter((generator) => generatorNames.includes(generator.name));
|
|
414
|
+
if (filtered.length !== generatorNames.length) {
|
|
415
|
+
const missings = generatorNames.filter((name) => filtered.find((generator) => generator.name === name) == null);
|
|
416
|
+
const isSingular = missings.length <= 1;
|
|
417
|
+
throw new Error(
|
|
418
|
+
`The ${isSingular ? "generator" : "generators"} ${(0, import_chunk_PG5FDKSF.bold)(missings.join(", "))} specified via ${(0, import_chunk_PG5FDKSF.bold)(
|
|
419
|
+
"--generator"
|
|
420
|
+
)} ${isSingular ? "does" : "do"} not exist in your Prisma schema`
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
return filtered;
|
|
424
|
+
}
|
|
425
|
+
var forbiddenCmdWithDataProxyFlagMessage = (command) => `
|
|
426
|
+
Using an Accelerate URL is not supported for this CLI command ${(0, import_chunk_PG5FDKSF.green)(command)} yet.
|
|
427
|
+
Please use a direct connection to your database in \`prisma7.config.ts\`.
|
|
428
|
+
|
|
429
|
+
More information about this limitation: ${(0, import_chunk_I6WLABB2.link)("https://pris.ly/d/accelerate-limitations")}
|
|
430
|
+
`;
|
|
431
|
+
function checkUnsupportedDataProxy({
|
|
432
|
+
command,
|
|
433
|
+
validatedConfig
|
|
434
|
+
}) {
|
|
435
|
+
if (validatedConfig.datasource.url.startsWith("prisma://")) {
|
|
436
|
+
throw new Error(forbiddenCmdWithDataProxyFlagMessage(command));
|
|
437
|
+
}
|
|
438
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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_CUD726EK_exports = {};
|
|
20
|
+
__export(chunk_CUD726EK_exports, {
|
|
21
|
+
getCommandWithExecutor: () => getCommandWithExecutor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_CUD726EK_exports);
|
|
24
|
+
var import_chunk_BERN76ZI = require("./chunk-BERN76ZI.js");
|
|
25
|
+
function getCommandWithExecutor(command) {
|
|
26
|
+
if ((0, import_chunk_BERN76ZI.isCurrentBinInstalledGlobally)()) {
|
|
27
|
+
return command;
|
|
28
|
+
} else {
|
|
29
|
+
const npxUsed = __dirname.includes("_npx");
|
|
30
|
+
if (npxUsed) {
|
|
31
|
+
return `npx ${command}`;
|
|
32
|
+
} else {
|
|
33
|
+
return command;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_CXEXLFVL_exports = {};
|
|
20
|
+
__export(chunk_CXEXLFVL_exports, {
|
|
21
|
+
SchemaEngineExitCode: () => SchemaEngineExitCode,
|
|
22
|
+
canConnectToDatabase: () => canConnectToDatabase,
|
|
23
|
+
createDatabase: () => createDatabase,
|
|
24
|
+
dropDatabase: () => dropDatabase,
|
|
25
|
+
execaCommand: () => execaCommand
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(chunk_CXEXLFVL_exports);
|
|
28
|
+
var import_chunk_JOIHHXR6 = require("./chunk-JOIHHXR6.js");
|
|
29
|
+
var import_chunk_5PJQQKQI = require("./chunk-5PJQQKQI.js");
|
|
30
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
|
31
|
+
var SchemaEngineExitCode = /* @__PURE__ */ ((SchemaEngineExitCode2) => {
|
|
32
|
+
SchemaEngineExitCode2[SchemaEngineExitCode2["Success"] = 0] = "Success";
|
|
33
|
+
SchemaEngineExitCode2[SchemaEngineExitCode2["Error"] = 1] = "Error";
|
|
34
|
+
SchemaEngineExitCode2[SchemaEngineExitCode2["Panic"] = 101] = "Panic";
|
|
35
|
+
return SchemaEngineExitCode2;
|
|
36
|
+
})(SchemaEngineExitCode || {});
|
|
37
|
+
function parseJsonFromStderr(stderr) {
|
|
38
|
+
const lines = stderr.split(/\r?\n/).slice(1);
|
|
39
|
+
const logs = [];
|
|
40
|
+
for (const line of lines) {
|
|
41
|
+
const data = String(line);
|
|
42
|
+
try {
|
|
43
|
+
const json = JSON.parse(data);
|
|
44
|
+
logs.push(json);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
throw new Error(`Could not parse schema engine response: ${e}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return logs;
|
|
50
|
+
}
|
|
51
|
+
async function canConnectToDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
|
|
52
|
+
if (!connectionString) {
|
|
53
|
+
throw new Error("Connection url is empty. See https://pris.ly/d/config-url");
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
await execaCommand({
|
|
57
|
+
connectionString,
|
|
58
|
+
cwd,
|
|
59
|
+
schemaEnginePath,
|
|
60
|
+
engineCommandName: "can-connect-to-database"
|
|
61
|
+
});
|
|
62
|
+
} catch (_e) {
|
|
63
|
+
const e = _e;
|
|
64
|
+
if (e.stderr) {
|
|
65
|
+
const logs = parseJsonFromStderr(e.stderr);
|
|
66
|
+
const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
|
|
67
|
+
if (error && error.fields.error_code && error.fields.message) {
|
|
68
|
+
return {
|
|
69
|
+
code: error.fields.error_code,
|
|
70
|
+
message: error.fields.message
|
|
71
|
+
};
|
|
72
|
+
} else {
|
|
73
|
+
throw new Error(`Schema engine error:
|
|
74
|
+
${logs.map((log) => log.fields.message).join("\n")}`);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
throw new Error(`Schema engine exited. ${_e}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
async function createDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
|
|
83
|
+
const dbExists = await canConnectToDatabase(connectionString, cwd, schemaEnginePath);
|
|
84
|
+
if (dbExists === true) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
await execaCommand({
|
|
89
|
+
connectionString,
|
|
90
|
+
cwd,
|
|
91
|
+
schemaEnginePath,
|
|
92
|
+
engineCommandName: "create-database"
|
|
93
|
+
});
|
|
94
|
+
return true;
|
|
95
|
+
} catch (_e) {
|
|
96
|
+
const e = _e;
|
|
97
|
+
if (e.stderr) {
|
|
98
|
+
const logs = parseJsonFromStderr(e.stderr);
|
|
99
|
+
const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
|
|
100
|
+
if (error && error.fields.error_code && error.fields.message) {
|
|
101
|
+
throw new Error(`${error.fields.error_code}: ${error.fields.message}`);
|
|
102
|
+
} else {
|
|
103
|
+
throw new Error(`Schema engine error:
|
|
104
|
+
${logs.map((log) => log.fields.message).join("\n")}`);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
throw new Error(`Schema engine exited. ${_e}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function dropDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
|
|
112
|
+
try {
|
|
113
|
+
const result = await execaCommand({
|
|
114
|
+
connectionString,
|
|
115
|
+
cwd,
|
|
116
|
+
schemaEnginePath,
|
|
117
|
+
engineCommandName: "drop-database"
|
|
118
|
+
});
|
|
119
|
+
if (result && result.exitCode === 0 && result.stderr.includes("The database was successfully dropped")) {
|
|
120
|
+
return true;
|
|
121
|
+
} else {
|
|
122
|
+
throw Error(`An error occurred during the drop: ${JSON.stringify(result, void 0, 2)}`);
|
|
123
|
+
}
|
|
124
|
+
} catch (e) {
|
|
125
|
+
if (e.stderr) {
|
|
126
|
+
const logs = parseJsonFromStderr(e.stderr);
|
|
127
|
+
throw new Error(`Schema engine error:
|
|
128
|
+
${logs.map((log) => log.fields.message).join("\n")}`);
|
|
129
|
+
} else {
|
|
130
|
+
throw new Error(`Schema engine exited. ${e}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function execaCommand({
|
|
135
|
+
connectionString,
|
|
136
|
+
cwd,
|
|
137
|
+
schemaEnginePath,
|
|
138
|
+
engineCommandName
|
|
139
|
+
}) {
|
|
140
|
+
schemaEnginePath = schemaEnginePath || await (0, import_chunk_5PJQQKQI.resolveBinary)(import_fetch_engine.BinaryType.SchemaEngineBinary);
|
|
141
|
+
try {
|
|
142
|
+
return await (0, import_chunk_JOIHHXR6.execa)(
|
|
143
|
+
schemaEnginePath,
|
|
144
|
+
["--datasource", JSON.stringify({ url: connectionString }), "cli", engineCommandName],
|
|
145
|
+
{
|
|
146
|
+
cwd,
|
|
147
|
+
env: {
|
|
148
|
+
RUST_BACKTRACE: process.env.RUST_BACKTRACE ?? "1",
|
|
149
|
+
RUST_LOG: process.env.RUST_LOG ?? "info"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
} catch (_e) {
|
|
154
|
+
const e = _e;
|
|
155
|
+
if (e.message) {
|
|
156
|
+
e.message = e.message.replace(connectionString, "<REDACTED>");
|
|
157
|
+
}
|
|
158
|
+
if (e.stdout) {
|
|
159
|
+
e.stdout = e.stdout.replace(connectionString, "<REDACTED>");
|
|
160
|
+
}
|
|
161
|
+
if (e.stderr) {
|
|
162
|
+
e.stderr = e.stderr.replace(connectionString, "<REDACTED>");
|
|
163
|
+
}
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
}
|