@prisma/internals 5.18.0-dev.11 → 5.18.0-dev.13

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.
Files changed (50) hide show
  1. package/dist/{chunk-BLULYUWY.js → chunk-2BL7LKSL.js} +8 -8
  2. package/dist/{chunk-B5E7N5EI.js → chunk-55YL6AVS.js} +5 -5
  3. package/dist/chunk-5R627ZMI.js +54 -0
  4. package/dist/chunk-5XRQ7ONW.js +122 -0
  5. package/dist/{chunk-UZSNKPF4.js → chunk-ABU6EJNC.js} +8 -8
  6. package/dist/{chunk-FT35USHW.js → chunk-ASWLLIVQ.js} +5 -5
  7. package/dist/{chunk-BHNUWJO3.js → chunk-DHN2XIRZ.js} +5 -5
  8. package/dist/{chunk-AFCRE4BS.js → chunk-DRWTM5KG.js} +8 -8
  9. package/dist/chunk-EDDYQ5ZF.js +166 -0
  10. package/dist/{chunk-MYFOBLBN.js → chunk-EG4QUDYP.js} +5 -5
  11. package/dist/{chunk-75XKZNDX.js → chunk-IAFJSEXW.js} +8 -8
  12. package/dist/{chunk-3563RQQW.js → chunk-IFSLRT7D.js} +8 -8
  13. package/dist/{chunk-SSUVKXR5.js → chunk-IXDI7ZTH.js} +5 -5
  14. package/dist/chunk-JTMEVPXK.js +177 -0
  15. package/dist/chunk-JUIG32DW.js +110 -0
  16. package/dist/{chunk-2QYJYJB4.js → chunk-LK5H2ODL.js} +5 -5
  17. package/dist/{chunk-GITY7OEL.js → chunk-LXAII2QU.js} +19 -19
  18. package/dist/{chunk-KSJGU56U.js → chunk-NBCTOS5M.js} +4 -4
  19. package/dist/{chunk-5M5M473Z.js → chunk-O4PI6OCZ.js} +5 -5
  20. package/dist/{chunk-R635HD75.js → chunk-O56V7KU3.js} +5 -5
  21. package/dist/chunk-QIVUAERL.js +2202 -0
  22. package/dist/{chunk-YWPWOGJW.js → chunk-RDIYTER2.js} +8 -8
  23. package/dist/{chunk-JW77HQ7O.js → chunk-SO5L745S.js} +7 -7
  24. package/dist/{chunk-H3USL3OR.js → chunk-UHHDFKO5.js} +5 -5
  25. package/dist/{chunk-R2OQ7RVH.js → chunk-XLTZBUJB.js} +7 -7
  26. package/dist/{chunk-YVNJ2BWR.js → chunk-XZTSBD4M.js} +24 -795
  27. package/dist/cli/checkUnsupportedDataProxy.js +12 -12
  28. package/dist/cli/getSchema.js +17 -17
  29. package/dist/cli/hashes.js +12 -12
  30. package/dist/engine-commands/errorHelpers.js +4 -4
  31. package/dist/engine-commands/formatSchema.js +11 -11
  32. package/dist/engine-commands/getConfig.js +10 -10
  33. package/dist/engine-commands/getDmmf.js +7 -7
  34. package/dist/engine-commands/index.js +20 -20
  35. package/dist/engine-commands/lintSchema.js +8 -8
  36. package/dist/engine-commands/mergeSchemas.js +7 -7
  37. package/dist/engine-commands/validate.js +7 -7
  38. package/dist/get-generators/generatorResolvers/generatorResolvers.js +11 -11
  39. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +11 -11
  40. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +11 -11
  41. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +12 -12
  42. package/dist/get-generators/getGenerators.js +14 -14
  43. package/dist/index.js +39 -39
  44. package/dist/sendPanic.js +11 -11
  45. package/dist/utils/getEnvPaths.js +11 -11
  46. package/dist/utils/getVersionFromPackageJson.js +3 -3
  47. package/dist/utils/handlePanic.js +11 -11
  48. package/dist/utils/loadEnvFile.js +11 -11
  49. package/dist/wasm.js +4 -4
  50. package/package.json +8 -8
@@ -26,19 +26,19 @@ 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 chunk_BLULYUWY_exports = {};
30
- __export(chunk_BLULYUWY_exports, {
29
+ var chunk_2BL7LKSL_exports = {};
30
+ __export(chunk_2BL7LKSL_exports, {
31
31
  ValidateError: () => ValidateError,
32
32
  validate: () => validate
33
33
  });
34
- module.exports = __toCommonJS(chunk_BLULYUWY_exports);
34
+ module.exports = __toCommonJS(chunk_2BL7LKSL_exports);
35
35
  var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
36
36
  var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
37
37
  var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
38
- var import_chunk_5M5M473Z = require("./chunk-5M5M473Z.js");
38
+ var import_chunk_O4PI6OCZ = require("./chunk-O4PI6OCZ.js");
39
39
  var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
40
40
  var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
41
- var import_chunk_BHNUWJO3 = require("./chunk-BHNUWJO3.js");
41
+ var import_chunk_DHN2XIRZ = require("./chunk-DHN2XIRZ.js");
42
42
  var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
43
43
  var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
44
44
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
@@ -60,7 +60,7 @@ ${detailsHeader} ${message}`;
60
60
  }).exhaustive();
61
61
  const errorMessageWithContext = `${constructedErrorMessage}
62
62
  [Context: validate]`;
63
- super((0, import_chunk_5M5M473Z.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
+ super((0, import_chunk_O4PI6OCZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
64
64
  this.name = "ValidateError";
65
65
  }
66
66
  };
@@ -72,13 +72,13 @@ function validate(options) {
72
72
  () => {
73
73
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
74
74
  debug("Triggering a Rust panic...");
75
- import_chunk_BHNUWJO3.prismaSchemaWasm.debug_panic();
75
+ import_chunk_DHN2XIRZ.prismaSchemaWasm.debug_panic();
76
76
  }
77
77
  const params = JSON.stringify({
78
78
  prismaSchema: options.schemas,
79
79
  noColor: Boolean(process.env.NO_COLOR)
80
80
  });
81
- import_chunk_BHNUWJO3.prismaSchemaWasm.validate(params);
81
+ import_chunk_DHN2XIRZ.prismaSchemaWasm.validate(params);
82
82
  },
83
83
  (e) => ({
84
84
  type: "wasm-error",
@@ -16,11 +16,11 @@ 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 chunk_B5E7N5EI_exports = {};
20
- __export(chunk_B5E7N5EI_exports, {
19
+ var chunk_55YL6AVS_exports = {};
20
+ __export(chunk_55YL6AVS_exports, {
21
21
  version: () => version
22
22
  });
23
- module.exports = __toCommonJS(chunk_B5E7N5EI_exports);
24
- var import_chunk_FT35USHW = require("./chunk-FT35USHW.js");
25
- var packageJson = (0, import_chunk_FT35USHW.require_package)();
23
+ module.exports = __toCommonJS(chunk_55YL6AVS_exports);
24
+ var import_chunk_NBCTOS5M = require("./chunk-NBCTOS5M.js");
25
+ var packageJson = (0, import_chunk_NBCTOS5M.require_package)();
26
26
  var version = packageJson.version;
@@ -0,0 +1,54 @@
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_5R627ZMI_exports = {};
20
+ __export(chunk_5R627ZMI_exports, {
21
+ getEngineVersion: () => getEngineVersion,
22
+ safeGetEngineVersion: () => safeGetEngineVersion
23
+ });
24
+ module.exports = __toCommonJS(chunk_5R627ZMI_exports);
25
+ var import_chunk_S4LINK5Y = require("./chunk-S4LINK5Y.js");
26
+ var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
27
+ var import_chunk_JUIG32DW = require("./chunk-JUIG32DW.js");
28
+ var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
29
+ var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
30
+ var import_engines = require("@prisma/engines");
31
+ var import_fetch_engine = require("@prisma/fetch-engine");
32
+ var import_get_platform = require("@prisma/get-platform");
33
+ var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
34
+ async function getEngineVersion(enginePath, binaryName) {
35
+ if (!binaryName) {
36
+ binaryName = (0, import_engines.getCliQueryEngineBinaryType)();
37
+ }
38
+ enginePath = await (0, import_chunk_JUIG32DW.resolveBinary)(binaryName, enginePath);
39
+ const platformInfo = await (0, import_get_platform.getPlatformInfo)();
40
+ if (binaryName === import_fetch_engine.BinaryType.QueryEngineLibrary) {
41
+ (0, import_get_platform.assertNodeAPISupported)();
42
+ const QE = (0, import_chunk_S4LINK5Y.loadLibrary)(enginePath, platformInfo);
43
+ return `${import_fetch_engine.BinaryType.QueryEngineLibrary} ${QE.version().commit}`;
44
+ } else {
45
+ const { stdout } = await (0, import_execa.default)(enginePath, ["--version"]);
46
+ return stdout;
47
+ }
48
+ }
49
+ function safeGetEngineVersion(enginePath, binaryName) {
50
+ return (0, import_chunk_4A5ZK522.tryCatch2)(
51
+ () => getEngineVersion(enginePath, binaryName),
52
+ (error) => error
53
+ );
54
+ }
@@ -0,0 +1,122 @@
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 __toESM2 = (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_5XRQ7ONW_exports = {};
30
+ __export(chunk_5XRQ7ONW_exports, {
31
+ getBinaryPathsByVersion: () => getBinaryPathsByVersion
32
+ });
33
+ module.exports = __toCommonJS(chunk_5XRQ7ONW_exports);
34
+ var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
35
+ var import_chunk_4CGPN5SR = require("./chunk-4CGPN5SR.js");
36
+ var import_chunk_2SDPW6AX = require("./chunk-2SDPW6AX.js");
37
+ var import_chunk_7B5PXS6N = require("./chunk-7B5PXS6N.js");
38
+ var import_chunk_QIVUAERL = require("./chunk-QIVUAERL.js");
39
+ var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
40
+ var import_engines = require("@prisma/engines");
41
+ var import_fetch_engine = require("@prisma/fetch-engine");
42
+ var import_path = __toESM2(require("path"));
43
+ var import_fs_extra = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_QIVUAERL.require_lib)());
44
+ async function getBinaryPathsByVersion({
45
+ neededVersions,
46
+ binaryTarget,
47
+ version,
48
+ printDownloadProgress,
49
+ skipDownload,
50
+ binaryPathsOverride
51
+ }) {
52
+ const binaryPathsByVersion = /* @__PURE__ */ Object.create(null);
53
+ for (const currentVersion in neededVersions) {
54
+ binaryPathsByVersion[currentVersion] = {};
55
+ const neededVersion = neededVersions[currentVersion];
56
+ if (neededVersion.binaryTargets.length === 0) {
57
+ neededVersion.binaryTargets = [{ fromEnvVar: null, value: binaryTarget }];
58
+ }
59
+ if (process.env.NETLIFY) {
60
+ const isNodeMajor20OrUp = parseInt(process.versions.node.split(".")[0]) >= 20;
61
+ const awsRuntimeVersion = (0, import_chunk_2SDPW6AX.parseAWSNodejsRuntimeEnvVarVersion)();
62
+ const isRuntimeEnvVar20OrUp = awsRuntimeVersion && awsRuntimeVersion >= 20;
63
+ const isRuntimeEnvVar18OrDown = awsRuntimeVersion && awsRuntimeVersion <= 18;
64
+ const isRhelBinaryTarget1xInNeededVersions = neededVersion.binaryTargets.find(
65
+ (object) => object.value === "rhel-openssl-1.0.x"
66
+ );
67
+ const isRhelBinaryTarget3xInNeededVersions = neededVersion.binaryTargets.find(
68
+ (object) => object.value === "rhel-openssl-3.0.x"
69
+ );
70
+ if (!isRhelBinaryTarget3xInNeededVersions && (isNodeMajor20OrUp || isRuntimeEnvVar20OrUp) && !isRuntimeEnvVar18OrDown) {
71
+ neededVersion.binaryTargets.push({
72
+ fromEnvVar: null,
73
+ value: "rhel-openssl-3.0.x"
74
+ });
75
+ } else if (!isRhelBinaryTarget1xInNeededVersions) {
76
+ neededVersion.binaryTargets.push({
77
+ fromEnvVar: null,
78
+ value: "rhel-openssl-1.0.x"
79
+ });
80
+ }
81
+ }
82
+ let binaryTargetBaseDir = eval(`require('path').join(__dirname, '..')`);
83
+ if (version !== currentVersion) {
84
+ binaryTargetBaseDir = import_path.default.join(binaryTargetBaseDir, `./engines/${currentVersion}/`);
85
+ await (0, import_fs_extra.ensureDir)(binaryTargetBaseDir).catch((e) => console.error(e));
86
+ }
87
+ const binariesConfig = neededVersion.engines.reduce((acc, curr) => {
88
+ if (!binaryPathsOverride?.[curr]) {
89
+ acc[(0, import_chunk_4CGPN5SR.engineTypeToBinaryType)(curr)] = binaryTargetBaseDir;
90
+ }
91
+ return acc;
92
+ }, /* @__PURE__ */ Object.create(null));
93
+ if (Object.values(binariesConfig).length > 0) {
94
+ const binaryTargets = neededVersion.binaryTargets.map(
95
+ (binaryTarget2) => binaryTarget2.value
96
+ );
97
+ const downloadParams = {
98
+ binaries: binariesConfig,
99
+ binaryTargets,
100
+ showProgress: typeof printDownloadProgress === "boolean" ? printDownloadProgress : true,
101
+ version: currentVersion && currentVersion !== "latest" ? currentVersion : import_engines.enginesVersion,
102
+ skipDownload
103
+ };
104
+ const binaryPathsWithEngineType = await (0, import_fetch_engine.download)(downloadParams);
105
+ const binaryPaths = (0, import_chunk_7B5PXS6N.mapKeys)(binaryPathsWithEngineType, import_chunk_RS2R7COT.binaryTypeToEngineType);
106
+ binaryPathsByVersion[currentVersion] = binaryPaths;
107
+ }
108
+ if (binaryPathsOverride) {
109
+ const overrideEngines = Object.keys(binaryPathsOverride);
110
+ const enginesCoveredByOverride = neededVersion.engines.filter((engine) => overrideEngines.includes(engine));
111
+ if (enginesCoveredByOverride.length > 0) {
112
+ for (const engine of enginesCoveredByOverride) {
113
+ const enginePath = binaryPathsOverride[engine];
114
+ binaryPathsByVersion[currentVersion][engine] = {
115
+ [binaryTarget]: enginePath
116
+ };
117
+ }
118
+ }
119
+ }
120
+ }
121
+ return binaryPathsByVersion;
122
+ }
@@ -26,18 +26,18 @@ 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 chunk_UZSNKPF4_exports = {};
30
- __export(chunk_UZSNKPF4_exports, {
29
+ var chunk_ABU6EJNC_exports = {};
30
+ __export(chunk_ABU6EJNC_exports, {
31
31
  GetDmmfError: () => GetDmmfError,
32
32
  getDMMF: () => getDMMF
33
33
  });
34
- module.exports = __toCommonJS(chunk_UZSNKPF4_exports);
34
+ module.exports = __toCommonJS(chunk_ABU6EJNC_exports);
35
35
  var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
36
36
  var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
37
- var import_chunk_5M5M473Z = require("./chunk-5M5M473Z.js");
37
+ var import_chunk_O4PI6OCZ = require("./chunk-O4PI6OCZ.js");
38
38
  var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
39
39
  var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
40
- var import_chunk_BHNUWJO3 = require("./chunk-BHNUWJO3.js");
40
+ var import_chunk_DHN2XIRZ = require("./chunk-DHN2XIRZ.js");
41
41
  var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
42
42
  var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
43
43
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
@@ -60,7 +60,7 @@ ${detailsHeader} ${message}`;
60
60
  }).exhaustive();
61
61
  const errorMessageWithContext = `${constructedErrorMessage}
62
62
  [Context: getDmmf]`;
63
- super((0, import_chunk_5M5M473Z.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
+ super((0, import_chunk_O4PI6OCZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
64
64
  this.name = "GetDmmfError";
65
65
  }
66
66
  };
@@ -91,13 +91,13 @@ async function getDMMF(options) {
91
91
  () => {
92
92
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
93
93
  debug("Triggering a Rust panic...");
94
- import_chunk_BHNUWJO3.prismaSchemaWasm.debug_panic();
94
+ import_chunk_DHN2XIRZ.prismaSchemaWasm.debug_panic();
95
95
  }
96
96
  const params = JSON.stringify({
97
97
  prismaSchema: datamodel,
98
98
  noColor: Boolean(process.env.NO_COLOR)
99
99
  });
100
- const data = import_chunk_BHNUWJO3.prismaSchemaWasm.get_dmmf(params);
100
+ const data = import_chunk_DHN2XIRZ.prismaSchemaWasm.get_dmmf(params);
101
101
  return data;
102
102
  },
103
103
  (e) => ({
@@ -16,17 +16,17 @@ 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 chunk_FT35USHW_exports = {};
20
- __export(chunk_FT35USHW_exports, {
19
+ var chunk_ASWLLIVQ_exports = {};
20
+ __export(chunk_ASWLLIVQ_exports, {
21
21
  require_package: () => require_package
22
22
  });
23
- module.exports = __toCommonJS(chunk_FT35USHW_exports);
23
+ module.exports = __toCommonJS(chunk_ASWLLIVQ_exports);
24
24
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
25
25
  var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
26
26
  "package.json"(exports, module2) {
27
27
  module2.exports = {
28
28
  name: "@prisma/internals",
29
- version: "5.18.0-dev.11",
29
+ version: "5.18.0-dev.13",
30
30
  description: "This package is intended for Prisma's internal use",
31
31
  main: "dist/index.js",
32
32
  types: "dist/index.d.ts",
@@ -107,7 +107,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
107
107
  "@prisma/fetch-engine": "workspace:*",
108
108
  "@prisma/generator-helper": "workspace:*",
109
109
  "@prisma/get-platform": "workspace:*",
110
- "@prisma/prisma-schema-wasm": "5.18.0-15.a6977e518975c6a4e6ae77bf7faf8afc08b97e7d",
110
+ "@prisma/prisma-schema-wasm": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169",
111
111
  "@prisma/schema-files-loader": "workspace:*",
112
112
  arg: "5.0.2",
113
113
  prompts: "2.4.2"
@@ -26,14 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_BHNUWJO3_exports = {};
30
- __export(chunk_BHNUWJO3_exports, {
29
+ var chunk_DHN2XIRZ_exports = {};
30
+ __export(chunk_DHN2XIRZ_exports, {
31
31
  prismaSchemaWasm: () => import_prisma_schema_wasm.default,
32
32
  prismaSchemaWasmVersion: () => prismaSchemaWasmVersion,
33
33
  wasm_exports: () => wasm_exports
34
34
  });
35
- module.exports = __toCommonJS(chunk_BHNUWJO3_exports);
36
- var import_chunk_FT35USHW = require("./chunk-FT35USHW.js");
35
+ module.exports = __toCommonJS(chunk_DHN2XIRZ_exports);
36
+ var import_chunk_ASWLLIVQ = require("./chunk-ASWLLIVQ.js");
37
37
  var import_chunk_HOZFIXMD = require("./chunk-HOZFIXMD.js");
38
38
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
39
39
  var import_prisma_schema_wasm = __toESM(require("@prisma/prisma-schema-wasm"));
@@ -42,6 +42,6 @@ var wasm_exports = {};
42
42
  prismaSchemaWasm: () => import_prisma_schema_wasm.default,
43
43
  prismaSchemaWasmVersion: () => prismaSchemaWasmVersion
44
44
  });
45
- var { dependencies } = (0, import_chunk_FT35USHW.require_package)();
45
+ var { dependencies } = (0, import_chunk_ASWLLIVQ.require_package)();
46
46
  var prismaSchemaWasmVersion = dependencies["@prisma/prisma-schema-wasm"];
47
47
  globalThis.PRISMA_WASM_PANIC_REGISTRY = new import_chunk_HOZFIXMD.WasmPanicRegistry();
@@ -26,22 +26,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_AFCRE4BS_exports = {};
30
- __export(chunk_AFCRE4BS_exports, {
29
+ var chunk_DRWTM5KG_exports = {};
30
+ __export(chunk_DRWTM5KG_exports, {
31
31
  GetConfigError: () => GetConfigError,
32
32
  getConfig: () => getConfig,
33
33
  getDirectUrl: () => getDirectUrl,
34
34
  getEffectiveUrl: () => getEffectiveUrl,
35
35
  resolveUrl: () => resolveUrl
36
36
  });
37
- module.exports = __toCommonJS(chunk_AFCRE4BS_exports);
37
+ module.exports = __toCommonJS(chunk_DRWTM5KG_exports);
38
38
  var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
39
39
  var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
40
40
  var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
41
- var import_chunk_MYFOBLBN = require("./chunk-MYFOBLBN.js");
41
+ var import_chunk_O4PI6OCZ = require("./chunk-O4PI6OCZ.js");
42
42
  var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
43
43
  var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
44
- var import_chunk_H3USL3OR = require("./chunk-H3USL3OR.js");
44
+ var import_chunk_DHN2XIRZ = require("./chunk-DHN2XIRZ.js");
45
45
  var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
46
46
  var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
47
47
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
@@ -65,7 +65,7 @@ ${detailsHeader} ${message}`;
65
65
  }).exhaustive();
66
66
  const errorMessageWithContext = `${constructedErrorMessage}
67
67
  [Context: getConfig]`;
68
- super((0, import_chunk_MYFOBLBN.addVersionDetailsToErrorMessage)(errorMessageWithContext));
68
+ super((0, import_chunk_O4PI6OCZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
69
69
  this.name = "GetConfigError";
70
70
  }
71
71
  };
@@ -90,7 +90,7 @@ async function getConfig(options) {
90
90
  () => {
91
91
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {
92
92
  debug("Triggering a Rust panic...");
93
- import_chunk_H3USL3OR.prismaSchemaWasm.debug_panic();
93
+ import_chunk_DHN2XIRZ.prismaSchemaWasm.debug_panic();
94
94
  }
95
95
  const params = JSON.stringify({
96
96
  prismaSchema: options.datamodel,
@@ -98,7 +98,7 @@ async function getConfig(options) {
98
98
  ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
99
99
  env: process.env
100
100
  });
101
- const data = import_chunk_H3USL3OR.prismaSchemaWasm.get_config(params);
101
+ const data = import_chunk_DHN2XIRZ.prismaSchemaWasm.get_config(params);
102
102
  return data;
103
103
  },
104
104
  (e) => ({
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_EDDYQ5ZF_exports = {};
20
+ __export(chunk_EDDYQ5ZF_exports, {
21
+ SchemaEngineExitCode: () => SchemaEngineExitCode,
22
+ canConnectToDatabase: () => canConnectToDatabase,
23
+ createDatabase: () => createDatabase,
24
+ dropDatabase: () => dropDatabase,
25
+ execaCommand: () => execaCommand
26
+ });
27
+ module.exports = __toCommonJS(chunk_EDDYQ5ZF_exports);
28
+ var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
29
+ var import_chunk_JUIG32DW = require("./chunk-JUIG32DW.js");
30
+ var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
31
+ var import_fetch_engine = require("@prisma/fetch-engine");
32
+ var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
33
+ var SchemaEngineExitCode = /* @__PURE__ */ ((SchemaEngineExitCode2) => {
34
+ SchemaEngineExitCode2[SchemaEngineExitCode2["Success"] = 0] = "Success";
35
+ SchemaEngineExitCode2[SchemaEngineExitCode2["Error"] = 1] = "Error";
36
+ SchemaEngineExitCode2[SchemaEngineExitCode2["Panic"] = 101] = "Panic";
37
+ return SchemaEngineExitCode2;
38
+ })(SchemaEngineExitCode || {});
39
+ function parseJsonFromStderr(stderr) {
40
+ const lines = stderr.split(/\r?\n/).slice(1);
41
+ const logs = [];
42
+ for (const line of lines) {
43
+ const data = String(line);
44
+ try {
45
+ const json = JSON.parse(data);
46
+ logs.push(json);
47
+ } catch (e) {
48
+ throw new Error(`Could not parse schema engine response: ${e}`);
49
+ }
50
+ }
51
+ return logs;
52
+ }
53
+ async function canConnectToDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
54
+ if (!connectionString) {
55
+ throw new Error(
56
+ "Connection url is empty. See https://www.prisma.io/docs/reference/database-reference/connection-urls"
57
+ );
58
+ }
59
+ try {
60
+ await execaCommand({
61
+ connectionString,
62
+ cwd,
63
+ schemaEnginePath,
64
+ engineCommandName: "can-connect-to-database"
65
+ });
66
+ } catch (_e) {
67
+ const e = _e;
68
+ if (e.stderr) {
69
+ const logs = parseJsonFromStderr(e.stderr);
70
+ const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
71
+ if (error && error.fields.error_code && error.fields.message) {
72
+ return {
73
+ code: error.fields.error_code,
74
+ message: error.fields.message
75
+ };
76
+ } else {
77
+ throw new Error(`Schema engine error:
78
+ ${logs.map((log) => log.fields.message).join("\n")}`);
79
+ }
80
+ } else {
81
+ throw new Error(`Schema engine exited. ${_e}`);
82
+ }
83
+ }
84
+ return true;
85
+ }
86
+ async function createDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
87
+ const dbExists = await canConnectToDatabase(connectionString, cwd, schemaEnginePath);
88
+ if (dbExists === true) {
89
+ return false;
90
+ }
91
+ try {
92
+ await execaCommand({
93
+ connectionString,
94
+ cwd,
95
+ schemaEnginePath,
96
+ engineCommandName: "create-database"
97
+ });
98
+ return true;
99
+ } catch (_e) {
100
+ const e = _e;
101
+ if (e.stderr) {
102
+ const logs = parseJsonFromStderr(e.stderr);
103
+ const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
104
+ if (error && error.fields.error_code && error.fields.message) {
105
+ throw new Error(`${error.fields.error_code}: ${error.fields.message}`);
106
+ } else {
107
+ throw new Error(`Schema engine error:
108
+ ${logs.map((log) => log.fields.message).join("\n")}`);
109
+ }
110
+ } else {
111
+ throw new Error(`Schema engine exited. ${_e}`);
112
+ }
113
+ }
114
+ }
115
+ async function dropDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
116
+ try {
117
+ const result = await execaCommand({
118
+ connectionString,
119
+ cwd,
120
+ schemaEnginePath,
121
+ engineCommandName: "drop-database"
122
+ });
123
+ if (result && result.exitCode === 0 && result.stderr.includes("The database was successfully dropped")) {
124
+ return true;
125
+ } else {
126
+ throw Error(`An error occurred during the drop: ${JSON.stringify(result, void 0, 2)}`);
127
+ }
128
+ } catch (e) {
129
+ if (e.stderr) {
130
+ const logs = parseJsonFromStderr(e.stderr);
131
+ throw new Error(`Schema engine error:
132
+ ${logs.map((log) => log.fields.message).join("\n")}`);
133
+ } else {
134
+ throw new Error(`Schema engine exited. ${e}`);
135
+ }
136
+ }
137
+ }
138
+ async function execaCommand({
139
+ connectionString,
140
+ cwd,
141
+ schemaEnginePath,
142
+ engineCommandName
143
+ }) {
144
+ schemaEnginePath = schemaEnginePath || await (0, import_chunk_JUIG32DW.resolveBinary)(import_fetch_engine.BinaryType.SchemaEngineBinary);
145
+ try {
146
+ return await (0, import_execa.default)(schemaEnginePath, ["cli", "--datasource", connectionString, engineCommandName], {
147
+ cwd,
148
+ env: {
149
+ RUST_BACKTRACE: process.env.RUST_BACKTRACE ?? "1",
150
+ RUST_LOG: process.env.RUST_LOG ?? "info"
151
+ }
152
+ });
153
+ } catch (_e) {
154
+ const e = _e;
155
+ if (e.message) {
156
+ e.message = e.message.replace(connectionString, "<REDACTED>");
157
+ }
158
+ if (e.stdout) {
159
+ e.stdout = e.stdout.replace(connectionString, "<REDACTED>");
160
+ }
161
+ if (e.stderr) {
162
+ e.stderr = e.stderr.replace(connectionString, "<REDACTED>");
163
+ }
164
+ throw e;
165
+ }
166
+ }
@@ -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 chunk_MYFOBLBN_exports = {};
20
- __export(chunk_MYFOBLBN_exports, {
19
+ var chunk_EG4QUDYP_exports = {};
20
+ __export(chunk_EG4QUDYP_exports, {
21
21
  addVersionDetailsToErrorMessage: () => addVersionDetailsToErrorMessage
22
22
  });
23
- module.exports = __toCommonJS(chunk_MYFOBLBN_exports);
24
- var import_chunk_SSUVKXR5 = require("./chunk-SSUVKXR5.js");
23
+ module.exports = __toCommonJS(chunk_EG4QUDYP_exports);
24
+ var import_chunk_55YL6AVS = require("./chunk-55YL6AVS.js");
25
25
  var import_chunk_QN6PSQY7 = require("./chunk-QN6PSQY7.js");
26
26
  function addVersionDetailsToErrorMessage(message) {
27
- const rows = [["Prisma CLI Version", import_chunk_SSUVKXR5.version]];
27
+ const rows = [["Prisma CLI Version", import_chunk_55YL6AVS.version]];
28
28
  return `${message}
29
29
 
30
30
  ${(0, import_chunk_QN6PSQY7.formatTable)(rows)}`;
@@ -26,19 +26,19 @@ 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 chunk_75XKZNDX_exports = {};
30
- __export(chunk_75XKZNDX_exports, {
29
+ var chunk_IAFJSEXW_exports = {};
30
+ __export(chunk_IAFJSEXW_exports, {
31
31
  ValidateError: () => ValidateError,
32
32
  validate: () => validate
33
33
  });
34
- module.exports = __toCommonJS(chunk_75XKZNDX_exports);
34
+ module.exports = __toCommonJS(chunk_IAFJSEXW_exports);
35
35
  var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
36
36
  var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
37
37
  var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
38
- var import_chunk_MYFOBLBN = require("./chunk-MYFOBLBN.js");
38
+ var import_chunk_EG4QUDYP = require("./chunk-EG4QUDYP.js");
39
39
  var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
40
40
  var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
41
- var import_chunk_H3USL3OR = require("./chunk-H3USL3OR.js");
41
+ var import_chunk_UHHDFKO5 = require("./chunk-UHHDFKO5.js");
42
42
  var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
43
43
  var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
44
44
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
@@ -60,7 +60,7 @@ ${detailsHeader} ${message}`;
60
60
  }).exhaustive();
61
61
  const errorMessageWithContext = `${constructedErrorMessage}
62
62
  [Context: validate]`;
63
- super((0, import_chunk_MYFOBLBN.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
+ super((0, import_chunk_EG4QUDYP.addVersionDetailsToErrorMessage)(errorMessageWithContext));
64
64
  this.name = "ValidateError";
65
65
  }
66
66
  };
@@ -72,13 +72,13 @@ function validate(options) {
72
72
  () => {
73
73
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
74
74
  debug("Triggering a Rust panic...");
75
- import_chunk_H3USL3OR.prismaSchemaWasm.debug_panic();
75
+ import_chunk_UHHDFKO5.prismaSchemaWasm.debug_panic();
76
76
  }
77
77
  const params = JSON.stringify({
78
78
  prismaSchema: options.schemas,
79
79
  noColor: Boolean(process.env.NO_COLOR)
80
80
  });
81
- import_chunk_H3USL3OR.prismaSchemaWasm.validate(params);
81
+ import_chunk_UHHDFKO5.prismaSchemaWasm.validate(params);
82
82
  },
83
83
  (e) => ({
84
84
  type: "wasm-error",