@prisma/internals 6.19.0-integration-feat-remove-binary-engine.1 → 6.19.0-integration-engines-6-19-0-7-next-44e0881a477328a478a36acec141ddc4630ec61e.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/{chunk-PELP7NEY.js → chunk-2KDWDZTH.js} +5 -5
  2. package/dist/{chunk-6QTN4DDB.js → chunk-46ABODUM.js} +21 -6
  3. package/dist/{chunk-VRGMXDRD.js → chunk-4CGPN5SR.js} +6 -3
  4. package/dist/{chunk-GL7OANR6.js → chunk-4JCVHBYR.js} +5 -5
  5. package/dist/{chunk-PNLK5PK2.js → chunk-7CG7DKAH.js} +8 -8
  6. package/dist/{chunk-2AYJLW73.js → chunk-7QBHQULK.js} +5 -5
  7. package/dist/{chunk-4XXX5FAL.js → chunk-BDZNOEJA.js} +8 -8
  8. package/dist/{chunk-Z3TOT5L3.js → chunk-BFZSHJFH.js} +5 -5
  9. package/dist/{chunk-FUYRCYVL.js → chunk-ERSH2BQA.js} +8 -3
  10. package/dist/{chunk-OKVM3CW4.js → chunk-EYVG6XQS.js} +39 -3
  11. package/dist/{chunk-5XFNC2RY.js → chunk-F2OZV76L.js} +7 -7
  12. package/dist/{chunk-DGWYSK57.js → chunk-FD3BKIVX.js} +8 -8
  13. package/dist/{chunk-3GX3XWYB.js → chunk-FHHLGSN4.js} +7 -7
  14. package/dist/{chunk-FC6CQUSK.js → chunk-GMW36QQF.js} +5 -5
  15. package/dist/{chunk-CEHARWN2.js → chunk-HA4QQNKW.js} +41 -28
  16. package/dist/{chunk-GSH4BXBI.js → chunk-HFFWZTVM.js} +6 -4
  17. package/dist/{chunk-5W3BSMTH.js → chunk-HO5HRHFZ.js} +6 -3
  18. package/dist/{chunk-ZJN5O3G3.js → chunk-HP6MKXP4.js} +5 -5
  19. package/dist/{chunk-HEJWJKAQ.js → chunk-J4CTGZBO.js} +5 -5
  20. package/dist/{chunk-43ZFMWOZ.js → chunk-JUGNIBHR.js} +41 -28
  21. package/dist/{chunk-6JZNCXUA.js → chunk-MDLQ6JZC.js} +5 -5
  22. package/dist/{chunk-LDEKYOKN.js → chunk-NFLWGUB3.js} +8 -8
  23. package/dist/{chunk-4IDPZNYW.js → chunk-NMRDNXL3.js} +8 -8
  24. package/dist/{chunk-SRZLJFU4.js → chunk-OAT7ZJED.js} +8 -4
  25. package/dist/{chunk-RDOF2VXZ.js → chunk-OTBIULQS.js} +8 -8
  26. package/dist/{chunk-HQKRIT7Z.js → chunk-OYXXGKCE.js} +5 -5
  27. package/dist/{chunk-XVZQ5TSR.js → chunk-PN6FPX2L.js} +7 -7
  28. package/dist/{chunk-FURGECAD.js → chunk-PZMRR772.js} +6 -6
  29. package/dist/{chunk-BXLJID4Q.js → chunk-RML5TGZ7.js} +7 -7
  30. package/dist/{chunk-B22EOFPW.js → chunk-RS2R7COT.js} +6 -3
  31. package/dist/{chunk-IV6ZGJI6.js → chunk-UHBOD7I5.js} +5 -5
  32. package/dist/{chunk-KIFFN3IT.js → chunk-UQUWZJVN.js} +5 -5
  33. package/dist/{chunk-ARC7TW3L.js → chunk-WFNB7VRA.js} +14 -4
  34. package/dist/{chunk-A7GNRMO6.js → chunk-X3DR2QSA.js} +8 -8
  35. package/dist/cli/checkUnsupportedDataProxy.js +26 -26
  36. package/dist/cli/checkUnsupportedSchemaEngineWasm.js +26 -26
  37. package/dist/cli/getGeneratorSuccessMessage.js +3 -2
  38. package/dist/cli/getSchema.d.ts +15 -1
  39. package/dist/cli/getSchema.js +5 -4
  40. package/dist/cli/hashes.js +4 -4
  41. package/dist/cli/schemaContext.js +26 -26
  42. package/dist/client/getClientEngineType.d.ts +1 -0
  43. package/dist/client/getClientEngineType.js +3 -3
  44. package/dist/engine-commands/errorHelpers.js +4 -4
  45. package/dist/engine-commands/formatSchema.js +25 -25
  46. package/dist/engine-commands/getConfig.js +10 -10
  47. package/dist/engine-commands/getDmmf.js +7 -7
  48. package/dist/engine-commands/getEngineVersion.js +3 -3
  49. package/dist/engine-commands/getEnginesInfo.d.ts +1 -0
  50. package/dist/engine-commands/getEnginesInfo.js +4 -4
  51. package/dist/engine-commands/index.js +37 -37
  52. package/dist/engine-commands/lintSchema.js +8 -8
  53. package/dist/engine-commands/mergeSchemas.js +7 -7
  54. package/dist/engine-commands/validate.js +7 -7
  55. package/dist/get-generators/getGenerators.d.ts +1 -0
  56. package/dist/get-generators/getGenerators.js +28 -28
  57. package/dist/get-generators/utils/binaryTypeToEngineType.js +2 -2
  58. package/dist/get-generators/utils/engineTypeToBinaryType.js +2 -2
  59. package/dist/get-generators/utils/getBinaryPathsByVersion.js +4 -4
  60. package/dist/index.js +61 -61
  61. package/dist/sendPanic.js +2 -2
  62. package/dist/utils/getEnvPaths.d.ts +1 -1
  63. package/dist/utils/getEnvPaths.js +3 -2
  64. package/dist/utils/getVersionFromPackageJson.js +3 -3
  65. package/dist/utils/handlePanic.js +3 -3
  66. package/dist/utils/loadEnvFile.d.ts +1 -1
  67. package/dist/utils/loadEnvFile.js +4 -3
  68. package/dist/utils/serializeQueryEngineName.js +2 -2
  69. package/dist/wasm.js +5 -5
  70. package/package.json +15 -15
@@ -16,20 +16,20 @@ 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_PELP7NEY_exports = {};
20
- __export(chunk_PELP7NEY_exports, {
19
+ var chunk_2KDWDZTH_exports = {};
20
+ __export(chunk_2KDWDZTH_exports, {
21
21
  getLintWarnings: () => getLintWarnings,
22
22
  getLintWarningsAsText: () => getLintWarningsAsText,
23
23
  handleLintPanic: () => handleLintPanic,
24
24
  lintSchema: () => lintSchema,
25
25
  warningToString: () => warningToString
26
26
  });
27
- module.exports = __toCommonJS(chunk_PELP7NEY_exports);
28
- var import_chunk_HEJWJKAQ = require("./chunk-HEJWJKAQ.js");
27
+ module.exports = __toCommonJS(chunk_2KDWDZTH_exports);
28
+ var import_chunk_J4CTGZBO = require("./chunk-J4CTGZBO.js");
29
29
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
30
30
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
31
31
  function lintSchema({ schemas }) {
32
- const lintResult = import_chunk_HEJWJKAQ.prismaSchemaWasm.lint(JSON.stringify(schemas));
32
+ const lintResult = import_chunk_J4CTGZBO.prismaSchemaWasm.lint(JSON.stringify(schemas));
33
33
  const lintDiagnostics = JSON.parse(lintResult);
34
34
  return lintDiagnostics;
35
35
  }
@@ -26,12 +26,13 @@ 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_6QTN4DDB_exports = {};
30
- __export(chunk_6QTN4DDB_exports, {
29
+ var chunk_46ABODUM_exports = {};
30
+ __export(chunk_46ABODUM_exports, {
31
31
  getEnvPaths: () => getEnvPaths
32
32
  });
33
- module.exports = __toCommonJS(chunk_6QTN4DDB_exports);
33
+ module.exports = __toCommonJS(chunk_46ABODUM_exports);
34
34
  var import_chunk_3FP46GUV = require("./chunk-3FP46GUV.js");
35
+ var import_chunk_EYVG6XQS = require("./chunk-EYVG6XQS.js");
35
36
  var import_debug = __toESM(require("@prisma/debug"));
36
37
  var import_node_path = __toESM(require("node:path"));
37
38
  var import_node_process = __toESM(require("node:process"));
@@ -126,20 +127,34 @@ function findUpSync(name, options = {}) {
126
127
  return matches[0];
127
128
  }
128
129
  var debug = (0, import_debug.default)("prisma:loadEnv");
129
- function getEnvPaths(schemaPath, opts = { cwd: process.cwd() }) {
130
+ async function getEnvPaths(schemaPath, opts = { cwd: process.cwd() }) {
130
131
  const rootEnvPath = getProjectRootEnvPath({ cwd: opts.cwd }) ?? null;
131
132
  const schemaEnvPathFromArgs = schemaPathToEnvPath(schemaPath);
133
+ const schemaEnvPathFromPkgJson = schemaPathToEnvPath(await readSchemaPathFromPkgJson());
132
134
  const schemaEnvPaths = [
133
135
  schemaEnvPathFromArgs,
134
136
  // 1 - Check --schema directory for .env
137
+ schemaEnvPathFromPkgJson,
138
+ // 2 - Check package.json schema directory for .env
135
139
  "./prisma/.env",
136
- // 2 - Check ./prisma directory for .env
140
+ // 3 - Check ./prisma directory for .env
137
141
  "./.env"
138
- // 3 - Check cwd for .env
142
+ // 4 - Check cwd for .env
139
143
  ];
140
144
  const schemaEnvPath = schemaEnvPaths.find(import_chunk_3FP46GUV.exists);
141
145
  return { rootEnvPath, schemaEnvPath };
142
146
  }
147
+ async function readSchemaPathFromPkgJson() {
148
+ try {
149
+ const pkgJsonSchema = await (0, import_chunk_EYVG6XQS.getSchemaFromPackageJson)(process.cwd());
150
+ if (pkgJsonSchema.ok) {
151
+ pkgJsonSchema.schema.schemaPath;
152
+ }
153
+ return null;
154
+ } catch {
155
+ return null;
156
+ }
157
+ }
143
158
  function getProjectRootEnvPath(opts) {
144
159
  const pkgJsonPath = findUpSync((dir) => {
145
160
  const pkgPath = import_path.default.join(dir, "package.json");
@@ -16,16 +16,19 @@ 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_VRGMXDRD_exports = {};
20
- __export(chunk_VRGMXDRD_exports, {
19
+ var chunk_4CGPN5SR_exports = {};
20
+ __export(chunk_4CGPN5SR_exports, {
21
21
  engineTypeToBinaryType: () => engineTypeToBinaryType
22
22
  });
23
- module.exports = __toCommonJS(chunk_VRGMXDRD_exports);
23
+ module.exports = __toCommonJS(chunk_4CGPN5SR_exports);
24
24
  var import_fetch_engine = require("@prisma/fetch-engine");
25
25
  function engineTypeToBinaryType(engineType) {
26
26
  if (engineType === "schemaEngine") {
27
27
  return import_fetch_engine.BinaryType.SchemaEngineBinary;
28
28
  }
29
+ if (engineType === "queryEngine") {
30
+ return import_fetch_engine.BinaryType.QueryEngineBinary;
31
+ }
29
32
  if (engineType === "libqueryEngine") {
30
33
  return import_fetch_engine.BinaryType.QueryEngineLibrary;
31
34
  }
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_GL7OANR6_exports = {};
30
- __export(chunk_GL7OANR6_exports, {
29
+ var chunk_4JCVHBYR_exports = {};
30
+ __export(chunk_4JCVHBYR_exports, {
31
31
  getCLIPathHash: () => getCLIPathHash,
32
32
  getProjectHash: () => getProjectHash
33
33
  });
34
- module.exports = __toCommonJS(chunk_GL7OANR6_exports);
35
- var import_chunk_OKVM3CW4 = require("./chunk-OKVM3CW4.js");
34
+ module.exports = __toCommonJS(chunk_4JCVHBYR_exports);
35
+ var import_chunk_EYVG6XQS = require("./chunk-EYVG6XQS.js");
36
36
  var import_crypto = __toESM(require("crypto"));
37
37
  async function getProjectHash(schemaPathFromArgs, schemaPathFromConfig) {
38
- const projectPath = (await (0, import_chunk_OKVM3CW4.getSchemaWithPath)(schemaPathFromArgs, schemaPathFromConfig))?.schemaPath ?? process.cwd();
38
+ const projectPath = (await (0, import_chunk_EYVG6XQS.getSchemaWithPath)(schemaPathFromArgs, schemaPathFromConfig))?.schemaPath ?? process.cwd();
39
39
  return import_crypto.default.createHash("sha256").update(projectPath).digest("hex").substring(0, 8);
40
40
  }
41
41
  function getCLIPathHash() {
@@ -26,17 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_PNLK5PK2_exports = {};
30
- __export(chunk_PNLK5PK2_exports, {
29
+ var chunk_7CG7DKAH_exports = {};
30
+ __export(chunk_7CG7DKAH_exports, {
31
31
  ValidateError: () => ValidateError,
32
32
  validate: () => validate
33
33
  });
34
- module.exports = __toCommonJS(chunk_PNLK5PK2_exports);
34
+ module.exports = __toCommonJS(chunk_7CG7DKAH_exports);
35
35
  var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
36
36
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
37
37
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
38
- var import_chunk_IV6ZGJI6 = require("./chunk-IV6ZGJI6.js");
39
- var import_chunk_HEJWJKAQ = require("./chunk-HEJWJKAQ.js");
38
+ var import_chunk_UHBOD7I5 = require("./chunk-UHBOD7I5.js");
39
+ var import_chunk_OYXXGKCE = require("./chunk-OYXXGKCE.js");
40
40
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
41
41
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
42
42
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -59,7 +59,7 @@ ${detailsHeader} ${message}`;
59
59
  }).exhaustive();
60
60
  const errorMessageWithContext = `${constructedErrorMessage}
61
61
  [Context: validate]`;
62
- super((0, import_chunk_IV6ZGJI6.addVersionDetailsToErrorMessage)(errorMessageWithContext));
62
+ super((0, import_chunk_UHBOD7I5.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
63
  this.name = "ValidateError";
64
64
  }
65
65
  };
@@ -71,13 +71,13 @@ function validate(options) {
71
71
  () => {
72
72
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
73
73
  debug("Triggering a Rust panic...");
74
- import_chunk_HEJWJKAQ.prismaSchemaWasm.debug_panic();
74
+ import_chunk_OYXXGKCE.prismaSchemaWasm.debug_panic();
75
75
  }
76
76
  const params = JSON.stringify({
77
77
  prismaSchema: options.schemas,
78
78
  noColor: Boolean(process.env.NO_COLOR)
79
79
  });
80
- import_chunk_HEJWJKAQ.prismaSchemaWasm.validate(params);
80
+ import_chunk_OYXXGKCE.prismaSchemaWasm.validate(params);
81
81
  },
82
82
  (e) => ({
83
83
  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_2AYJLW73_exports = {};
20
- __export(chunk_2AYJLW73_exports, {
19
+ var chunk_7QBHQULK_exports = {};
20
+ __export(chunk_7QBHQULK_exports, {
21
21
  version: () => version
22
22
  });
23
- module.exports = __toCommonJS(chunk_2AYJLW73_exports);
24
- var import_chunk_BXLJID4Q = require("./chunk-BXLJID4Q.js");
25
- var packageJson = (0, import_chunk_BXLJID4Q.require_package)();
23
+ module.exports = __toCommonJS(chunk_7QBHQULK_exports);
24
+ var import_chunk_RML5TGZ7 = require("./chunk-RML5TGZ7.js");
25
+ var packageJson = (0, import_chunk_RML5TGZ7.require_package)();
26
26
  var version = packageJson.version;
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_4XXX5FAL_exports = {};
30
- __export(chunk_4XXX5FAL_exports, {
29
+ var chunk_BDZNOEJA_exports = {};
30
+ __export(chunk_BDZNOEJA_exports, {
31
31
  GetDmmfError: () => GetDmmfError,
32
32
  getDMMF: () => getDMMF
33
33
  });
34
- module.exports = __toCommonJS(chunk_4XXX5FAL_exports);
34
+ module.exports = __toCommonJS(chunk_BDZNOEJA_exports);
35
35
  var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
36
36
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
37
- var import_chunk_IV6ZGJI6 = require("./chunk-IV6ZGJI6.js");
38
- var import_chunk_HEJWJKAQ = require("./chunk-HEJWJKAQ.js");
37
+ var import_chunk_HP6MKXP4 = require("./chunk-HP6MKXP4.js");
38
+ var import_chunk_J4CTGZBO = require("./chunk-J4CTGZBO.js");
39
39
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
40
40
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
41
41
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -58,7 +58,7 @@ ${detailsHeader} ${message}`;
58
58
  }).exhaustive();
59
59
  const errorMessageWithContext = `${constructedErrorMessage}
60
60
  [Context: getDmmf]`;
61
- super((0, import_chunk_IV6ZGJI6.addVersionDetailsToErrorMessage)(errorMessageWithContext));
61
+ super((0, import_chunk_HP6MKXP4.addVersionDetailsToErrorMessage)(errorMessageWithContext));
62
62
  this.name = "GetDmmfError";
63
63
  }
64
64
  };
@@ -70,13 +70,13 @@ async function getDMMF(options) {
70
70
  () => {
71
71
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
72
72
  debug("Triggering a Rust panic...");
73
- import_chunk_HEJWJKAQ.prismaSchemaWasm.debug_panic();
73
+ import_chunk_J4CTGZBO.prismaSchemaWasm.debug_panic();
74
74
  }
75
75
  const params = JSON.stringify({
76
76
  prismaSchema: options.datamodel,
77
77
  noColor: Boolean(process.env.NO_COLOR)
78
78
  });
79
- const data = import_chunk_HEJWJKAQ.prismaSchemaWasm.get_dmmf(params);
79
+ const data = import_chunk_J4CTGZBO.prismaSchemaWasm.get_dmmf(params);
80
80
  return data;
81
81
  },
82
82
  (e) => ({
@@ -16,20 +16,20 @@ 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_Z3TOT5L3_exports = {};
20
- __export(chunk_Z3TOT5L3_exports, {
19
+ var chunk_BFZSHJFH_exports = {};
20
+ __export(chunk_BFZSHJFH_exports, {
21
21
  getLintWarnings: () => getLintWarnings,
22
22
  getLintWarningsAsText: () => getLintWarningsAsText,
23
23
  handleLintPanic: () => handleLintPanic,
24
24
  lintSchema: () => lintSchema,
25
25
  warningToString: () => warningToString
26
26
  });
27
- module.exports = __toCommonJS(chunk_Z3TOT5L3_exports);
28
- var import_chunk_HQKRIT7Z = require("./chunk-HQKRIT7Z.js");
27
+ module.exports = __toCommonJS(chunk_BFZSHJFH_exports);
28
+ var import_chunk_OYXXGKCE = require("./chunk-OYXXGKCE.js");
29
29
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
30
30
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
31
31
  function lintSchema({ schemas }) {
32
- const lintResult = import_chunk_HQKRIT7Z.prismaSchemaWasm.lint(JSON.stringify(schemas));
32
+ const lintResult = import_chunk_OYXXGKCE.prismaSchemaWasm.lint(JSON.stringify(schemas));
33
33
  const lintDiagnostics = JSON.parse(lintResult);
34
34
  return lintDiagnostics;
35
35
  }
@@ -16,14 +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_FUYRCYVL_exports = {};
20
- __export(chunk_FUYRCYVL_exports, {
19
+ var chunk_ERSH2BQA_exports = {};
20
+ __export(chunk_ERSH2BQA_exports, {
21
21
  ClientEngineType: () => ClientEngineType,
22
22
  getClientEngineType: () => getClientEngineType
23
23
  });
24
- module.exports = __toCommonJS(chunk_FUYRCYVL_exports);
24
+ module.exports = __toCommonJS(chunk_ERSH2BQA_exports);
25
25
  var ClientEngineType = /* @__PURE__ */ ((ClientEngineType2) => {
26
26
  ClientEngineType2["Library"] = "library";
27
+ ClientEngineType2["Binary"] = "binary";
27
28
  ClientEngineType2["Client"] = "client";
28
29
  return ClientEngineType2;
29
30
  })(ClientEngineType || {});
@@ -32,6 +33,8 @@ function getClientEngineType(generatorConfig) {
32
33
  if (engineTypeFromEnvVar) return engineTypeFromEnvVar;
33
34
  if (generatorConfig?.config.engineType === "library") {
34
35
  return "library";
36
+ } else if (generatorConfig?.config.engineType === "binary") {
37
+ return "binary";
35
38
  } else if (generatorConfig?.config.engineType === "client") {
36
39
  return "client";
37
40
  } else {
@@ -42,6 +45,8 @@ function getEngineTypeFromEnvVar() {
42
45
  const engineType = process.env.PRISMA_CLIENT_ENGINE_TYPE;
43
46
  if (engineType === "library") {
44
47
  return "library";
48
+ } else if (engineType === "binary") {
49
+ return "binary";
45
50
  } else if (engineType === "client") {
46
51
  return "client";
47
52
  } else {
@@ -26,14 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_OKVM3CW4_exports = {};
30
- __export(chunk_OKVM3CW4_exports, {
29
+ var chunk_EYVG6XQS_exports = {};
30
+ __export(chunk_EYVG6XQS_exports, {
31
+ getSchemaFromPackageJson: () => getSchemaFromPackageJson,
31
32
  getSchemaWithPath: () => getSchemaWithPath,
32
33
  getSchemaWithPathOptional: () => getSchemaWithPathOptional,
33
34
  printSchemaLoadedMessage: () => printSchemaLoadedMessage
34
35
  });
35
- module.exports = __toCommonJS(chunk_OKVM3CW4_exports);
36
+ module.exports = __toCommonJS(chunk_EYVG6XQS_exports);
36
37
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
38
+ var import_config = require("@prisma/config");
37
39
  var import_debug = require("@prisma/debug");
38
40
  var import_schema_files_loader = require("@prisma/schema-files-loader");
39
41
  var import_fs = __toESM(require("fs"));
@@ -117,6 +119,10 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfi
117
119
  if (prismaConfigResult.ok) {
118
120
  return prismaConfigResult;
119
121
  }
122
+ const pkgJsonResult = await getSchemaFromPackageJson(cwd);
123
+ if (pkgJsonResult.ok) {
124
+ return pkgJsonResult;
125
+ }
120
126
  const defaultResult = await getDefaultSchema(cwd);
121
127
  if (defaultResult.ok) {
122
128
  return defaultResult;
@@ -173,6 +179,36 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
173
179
  }
174
180
  return schemaResult;
175
181
  }
182
+ async function getSchemaFromPackageJson(cwd) {
183
+ const prismaConfig = await (0, import_config.loadConfigFromPackageJson)(cwd);
184
+ debug("prismaConfig", prismaConfig);
185
+ if (!prismaConfig || !prismaConfig.config?.schema) {
186
+ return { ok: false, error: { kind: "PackageJsonNotConfigured" } };
187
+ }
188
+ const schemaPathFromPkgJson = prismaConfig.config.schema;
189
+ if (typeof schemaPathFromPkgJson !== "string") {
190
+ throw new Error(
191
+ `Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path.default.relative(
192
+ cwd,
193
+ prismaConfig.loadedFromFile
194
+ )}\` must be of type string`
195
+ );
196
+ }
197
+ const absoluteSchemaPath = import_path.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path.default.resolve(import_path.default.dirname(prismaConfig.loadedFromFile), schemaPathFromPkgJson);
198
+ const lookupResult = await readSchemaFromFileOrDirectory(absoluteSchemaPath);
199
+ if (!lookupResult.ok) {
200
+ throw new Error(
201
+ `Could not load schema from \`${import_path.default.relative(
202
+ cwd,
203
+ absoluteSchemaPath
204
+ )}\` provided by "prisma.schema" config of \`${import_path.default.relative(
205
+ cwd,
206
+ prismaConfig.loadedFromFile
207
+ )}\`: ${renderLookupError(lookupResult.error)}`
208
+ );
209
+ }
210
+ return lookupResult;
211
+ }
176
212
  async function getDefaultSchema(cwd, failures = []) {
177
213
  const lookupPaths = [import_path.default.join(cwd, "schema.prisma"), import_path.default.join(cwd, "prisma", "schema.prisma")];
178
214
  for (const path2 of lookupPaths) {
@@ -26,13 +26,13 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_5XFNC2RY_exports = {};
30
- __export(chunk_5XFNC2RY_exports, {
29
+ var chunk_F2OZV76L_exports = {};
30
+ __export(chunk_F2OZV76L_exports, {
31
31
  getBinaryPathsByVersion: () => getBinaryPathsByVersion
32
32
  });
33
- module.exports = __toCommonJS(chunk_5XFNC2RY_exports);
34
- var import_chunk_B22EOFPW = require("./chunk-B22EOFPW.js");
35
- var import_chunk_VRGMXDRD = require("./chunk-VRGMXDRD.js");
33
+ module.exports = __toCommonJS(chunk_F2OZV76L_exports);
34
+ var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
35
+ var import_chunk_4CGPN5SR = require("./chunk-4CGPN5SR.js");
36
36
  var import_chunk_2SDPW6AX = require("./chunk-2SDPW6AX.js");
37
37
  var import_chunk_7B5PXS6N = require("./chunk-7B5PXS6N.js");
38
38
  var import_chunk_IDINCQMN = require("./chunk-IDINCQMN.js");
@@ -91,7 +91,7 @@ async function getBinaryPathsByVersion({
91
91
  }
92
92
  const binariesConfig = neededVersion.engines.reduce((acc, curr) => {
93
93
  if (!binaryPathsOverride?.[curr]) {
94
- acc[(0, import_chunk_VRGMXDRD.engineTypeToBinaryType)(curr)] = binaryTargetBaseDir;
94
+ acc[(0, import_chunk_4CGPN5SR.engineTypeToBinaryType)(curr)] = binaryTargetBaseDir;
95
95
  }
96
96
  return acc;
97
97
  }, /* @__PURE__ */ Object.create(null));
@@ -107,7 +107,7 @@ async function getBinaryPathsByVersion({
107
107
  skipDownload
108
108
  };
109
109
  const binaryPathsWithEngineType = await (0, import_fetch_engine.download)(downloadParams);
110
- const binaryPaths = (0, import_chunk_7B5PXS6N.mapKeys)(binaryPathsWithEngineType, import_chunk_B22EOFPW.binaryTypeToEngineType);
110
+ const binaryPaths = (0, import_chunk_7B5PXS6N.mapKeys)(binaryPathsWithEngineType, import_chunk_RS2R7COT.binaryTypeToEngineType);
111
111
  binaryPathsByVersion[currentVersion] = binaryPaths;
112
112
  }
113
113
  if (binaryPathsOverride) {
@@ -26,20 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_DGWYSK57_exports = {};
30
- __export(chunk_DGWYSK57_exports, {
29
+ var chunk_FD3BKIVX_exports = {};
30
+ __export(chunk_FD3BKIVX_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_DGWYSK57_exports);
37
+ module.exports = __toCommonJS(chunk_FD3BKIVX_exports);
38
38
  var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
39
39
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
40
40
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
41
- var import_chunk_IV6ZGJI6 = require("./chunk-IV6ZGJI6.js");
42
- var import_chunk_HEJWJKAQ = require("./chunk-HEJWJKAQ.js");
41
+ var import_chunk_UHBOD7I5 = require("./chunk-UHBOD7I5.js");
42
+ var import_chunk_OYXXGKCE = require("./chunk-OYXXGKCE.js");
43
43
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
44
44
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
45
45
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -64,7 +64,7 @@ ${detailsHeader} ${message}`;
64
64
  }).exhaustive();
65
65
  const errorMessageWithContext = `${constructedErrorMessage}
66
66
  [Context: getConfig]`;
67
- super((0, import_chunk_IV6ZGJI6.addVersionDetailsToErrorMessage)(errorMessageWithContext));
67
+ super((0, import_chunk_UHBOD7I5.addVersionDetailsToErrorMessage)(errorMessageWithContext));
68
68
  this.name = "GetConfigError";
69
69
  }
70
70
  };
@@ -89,7 +89,7 @@ async function getConfig(options) {
89
89
  () => {
90
90
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {
91
91
  debug("Triggering a Rust panic...");
92
- import_chunk_HEJWJKAQ.prismaSchemaWasm.debug_panic();
92
+ import_chunk_OYXXGKCE.prismaSchemaWasm.debug_panic();
93
93
  }
94
94
  const params = JSON.stringify({
95
95
  prismaSchema: options.datamodel,
@@ -97,7 +97,7 @@ async function getConfig(options) {
97
97
  ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
98
98
  env: process.env
99
99
  });
100
- const data = import_chunk_HEJWJKAQ.prismaSchemaWasm.get_config(params);
100
+ const data = import_chunk_OYXXGKCE.prismaSchemaWasm.get_config(params);
101
101
  return data;
102
102
  },
103
103
  (e) => ({
@@ -26,17 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_3GX3XWYB_exports = {};
30
- __export(chunk_3GX3XWYB_exports, {
29
+ var chunk_FHHLGSN4_exports = {};
30
+ __export(chunk_FHHLGSN4_exports, {
31
31
  MergeSchemasError: () => MergeSchemasError,
32
32
  mergeSchemas: () => mergeSchemas
33
33
  });
34
- module.exports = __toCommonJS(chunk_3GX3XWYB_exports);
34
+ module.exports = __toCommonJS(chunk_FHHLGSN4_exports);
35
35
  var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
36
36
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
37
37
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
38
- var import_chunk_IV6ZGJI6 = require("./chunk-IV6ZGJI6.js");
39
- var import_chunk_HEJWJKAQ = require("./chunk-HEJWJKAQ.js");
38
+ var import_chunk_UHBOD7I5 = require("./chunk-UHBOD7I5.js");
39
+ var import_chunk_OYXXGKCE = require("./chunk-OYXXGKCE.js");
40
40
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
41
41
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
42
42
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -59,7 +59,7 @@ ${detailsHeader} ${message}`;
59
59
  }).exhaustive();
60
60
  const errorMessageWithContext = `${constructedErrorMessage}
61
61
  [Context: mergeSchemas]`;
62
- super((0, import_chunk_IV6ZGJI6.addVersionDetailsToErrorMessage)(errorMessageWithContext));
62
+ super((0, import_chunk_UHBOD7I5.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
63
  this.name = "MergeSchemasError";
64
64
  }
65
65
  };
@@ -72,7 +72,7 @@ function mergeSchemas(options) {
72
72
  const params = JSON.stringify({
73
73
  schema: options.schemas
74
74
  });
75
- return import_chunk_HEJWJKAQ.prismaSchemaWasm.merge_schemas(params);
75
+ return import_chunk_OYXXGKCE.prismaSchemaWasm.merge_schemas(params);
76
76
  },
77
77
  (e) => ({
78
78
  type: "wasm-error",
@@ -26,13 +26,13 @@ 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_FC6CQUSK_exports = {};
30
- __export(chunk_FC6CQUSK_exports, {
29
+ var chunk_GMW36QQF_exports = {};
30
+ __export(chunk_GMW36QQF_exports, {
31
31
  getEnginesInfo: () => getEnginesInfo,
32
32
  resolveEngine: () => resolveEngine
33
33
  });
34
- module.exports = __toCommonJS(chunk_FC6CQUSK_exports);
35
- var import_chunk_SRZLJFU4 = require("./chunk-SRZLJFU4.js");
34
+ module.exports = __toCommonJS(chunk_GMW36QQF_exports);
35
+ var import_chunk_OAT7ZJED = require("./chunk-OAT7ZJED.js");
36
36
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
37
37
  var import_chunk_FYZCPL2Z = require("./chunk-FYZCPL2Z.js");
38
38
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
@@ -139,7 +139,7 @@ async function resolveEngine(binaryName) {
139
139
  enginePathEither,
140
140
  import_chunk_5DBOS77Y.fromEither,
141
141
  (0, import_chunk_5DBOS77Y.chain)((enginePath) => {
142
- return (0, import_chunk_SRZLJFU4.safeGetEngineVersion)(enginePath, binaryName);
142
+ return (0, import_chunk_OAT7ZJED.safeGetEngineVersion)(enginePath, binaryName);
143
143
  })
144
144
  )();
145
145
  const engineInfo = {