@prisma/internals 6.6.0-dev.58 → 6.6.0-dev.59

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 (74) hide show
  1. package/dist/Generator.d.ts +23 -5
  2. package/dist/Generator.js +4 -2
  3. package/dist/{chunk-VVPSLVOR.js → chunk-67I7CEQJ.js} +6 -7
  4. package/dist/{chunk-HQF2XKUK.js → chunk-6WQVUWQM.js} +5 -5
  5. package/dist/{chunk-7FA7GGK4.js → chunk-A5O5JLW5.js} +8 -8
  6. package/dist/{chunk-3TFJMQ4N.js → chunk-A6IRWWSZ.js} +3 -4
  7. package/dist/{chunk-DYVL6P7F.js → chunk-BPDMLM32.js} +46 -13
  8. package/dist/{chunk-WSMKAUWP.js → chunk-CQQIMP6N.js} +8 -8
  9. package/dist/{chunk-TJQK4HOJ.js → chunk-CW6KQ3VH.js} +8 -8
  10. package/dist/{chunk-MBOLKZSS.js → chunk-DB3Y5NDC.js} +7 -7
  11. package/dist/{chunk-KK4LFDOR.js → chunk-GNKWZC7O.js} +5 -5
  12. package/dist/{chunk-TI3QCOYR.js → chunk-GQD56R42.js} +8 -8
  13. package/dist/{chunk-CJ5BQW2U.js → chunk-HQXQG5GY.js} +83 -198
  14. package/dist/{chunk-PBDMN3UX.js → chunk-J3YY6H66.js} +5 -5
  15. package/dist/{chunk-IGJLNOSJ.js → chunk-JETLVL4E.js} +5 -5
  16. package/dist/{chunk-TPAYJAJV.js → chunk-JHOV6GLG.js} +4 -5
  17. package/dist/{chunk-AXZ6E37I.js → chunk-JUTACZEX.js} +5 -5
  18. package/dist/{chunk-SJTGFRIY.js → chunk-LOQLID3N.js} +8 -8
  19. package/dist/{chunk-K5W6WZ6E.js → chunk-MJIP3FY5.js} +6 -238
  20. package/dist/{chunk-UI7B22AM.js → chunk-NWAAPGFA.js} +5 -5
  21. package/dist/{chunk-WXILQIQF.js → chunk-QJ72IP2K.js} +8 -8
  22. package/dist/{chunk-HM7KBDAH.js → chunk-QXNNDOVP.js} +83 -198
  23. package/dist/{chunk-YOIAL2YX.js → chunk-T5MMBF2S.js} +5 -5
  24. package/dist/{chunk-S54BUEJF.js → chunk-TN4KCTWC.js} +7 -7
  25. package/dist/{chunk-NAZNTEI6.js → chunk-TRF2UWX2.js} +5 -5
  26. package/dist/cli/checkUnsupportedDataProxy.js +22 -28
  27. package/dist/cli/getSchema.js +25 -31
  28. package/dist/cli/hashes.js +22 -28
  29. package/dist/cli/schemaContext.js +22 -28
  30. package/dist/engine-commands/errorHelpers.js +4 -4
  31. package/dist/engine-commands/formatSchema.js +21 -27
  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 +30 -36
  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/getGenerators.d.ts +18 -9
  39. package/dist/get-generators/getGenerators.js +24 -30
  40. package/dist/getPackedPackage.js +3 -3
  41. package/dist/index.d.ts +2 -4
  42. package/dist/index.js +51 -57
  43. package/dist/resolvePkg.d.ts +7 -0
  44. package/dist/{get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.js → resolvePkg.js} +6 -6
  45. package/dist/utils/getEnvPaths.js +21 -27
  46. package/dist/utils/getVersionFromPackageJson.js +3 -3
  47. package/dist/utils/loadEnvFile.js +21 -27
  48. package/dist/wasm.js +4 -4
  49. package/package.json +10 -11
  50. package/dist/chunk-72UZXEBG.js +0 -28
  51. package/dist/chunk-BWGDP6B5.js +0 -4948
  52. package/dist/chunk-EUTJYQDW.js +0 -46
  53. package/dist/chunk-EWWOTVR3.js +0 -52
  54. package/dist/chunk-GHHABGYW.js +0 -28
  55. package/dist/chunk-QGJH4P4N.js +0 -35
  56. package/dist/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
  57. package/dist/get-generators/generatorResolvers/generatorResolvers.js +0 -138
  58. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
  59. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.js +0 -26
  60. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
  61. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.js +0 -26
  62. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
  63. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.js +0 -29
  64. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
  65. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +0 -138
  66. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
  67. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.js +0 -26
  68. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
  69. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.js +0 -26
  70. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
  71. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.d.ts +0 -1
  72. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.js +0 -17
  73. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
  74. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +0 -139
@@ -26,14 +26,11 @@ 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_HM7KBDAH_exports = {};
30
- __export(chunk_HM7KBDAH_exports, {
31
- checkTypeScriptVersion: () => checkTypeScriptVersion,
29
+ var chunk_QXNNDOVP_exports = {};
30
+ __export(chunk_QXNNDOVP_exports, {
32
31
  checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
33
- debug: () => debug4,
34
32
  forbiddenCmdWithDataProxyFlagMessage: () => forbiddenCmdWithDataProxyFlagMessage,
35
33
  formatSchema: () => formatSchema,
36
- generatorResolvers: () => generatorResolvers,
37
34
  getBinaryTargetForCurrentPlatform: () => import_get_platform2.getBinaryTargetForCurrentPlatform,
38
35
  getCLIPathHash: () => getCLIPathHash,
39
36
  getEnvPaths: () => getEnvPaths,
@@ -49,41 +46,34 @@ __export(chunk_HM7KBDAH_exports, {
49
46
  loadEnvFile: () => loadEnvFile,
50
47
  loadSchemaContext: () => loadSchemaContext,
51
48
  printSchemaLoadedMessage: () => printSchemaLoadedMessage,
52
- prismaClientResolver: () => prismaClientResolver,
53
49
  processSchemaResult: () => processSchemaResult,
54
50
  skipIndex: () => skipIndex
55
51
  });
56
- module.exports = __toCommonJS(chunk_HM7KBDAH_exports);
57
- var import_chunk_QGJH4P4N = require("./chunk-QGJH4P4N.js");
58
- var import_chunk_GHHABGYW = require("./chunk-GHHABGYW.js");
59
- var import_chunk_EUTJYQDW = require("./chunk-EUTJYQDW.js");
60
- var import_chunk_EWWOTVR3 = require("./chunk-EWWOTVR3.js");
61
- var import_chunk_72UZXEBG = require("./chunk-72UZXEBG.js");
52
+ module.exports = __toCommonJS(chunk_QXNNDOVP_exports);
62
53
  var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
63
54
  var import_chunk_EPXBOIA5 = require("./chunk-EPXBOIA5.js");
64
55
  var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
65
56
  var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
66
57
  var import_chunk_LRU47BGE = require("./chunk-LRU47BGE.js");
58
+ var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
67
59
  var import_chunk_UTJGRVMG = require("./chunk-UTJGRVMG.js");
60
+ var import_chunk_XLTQGAI2 = require("./chunk-XLTQGAI2.js");
68
61
  var import_chunk_5V36RLCO = require("./chunk-5V36RLCO.js");
69
- var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
70
62
  var import_chunk_AZV6HVKA = require("./chunk-AZV6HVKA.js");
71
- var import_chunk_XLTQGAI2 = require("./chunk-XLTQGAI2.js");
72
63
  var import_chunk_HAGJ64PM = require("./chunk-HAGJ64PM.js");
73
64
  var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
74
- var import_chunk_J77ZIDXB = require("./chunk-J77ZIDXB.js");
75
- var import_chunk_PBDMN3UX = require("./chunk-PBDMN3UX.js");
76
- var import_chunk_S54BUEJF = require("./chunk-S54BUEJF.js");
77
- var import_chunk_TJQK4HOJ = require("./chunk-TJQK4HOJ.js");
78
- var import_chunk_WXILQIQF = require("./chunk-WXILQIQF.js");
79
- var import_chunk_YOIAL2YX = require("./chunk-YOIAL2YX.js");
65
+ var import_chunk_QJ72IP2K = require("./chunk-QJ72IP2K.js");
66
+ var import_chunk_GNKWZC7O = require("./chunk-GNKWZC7O.js");
67
+ var import_chunk_TN4KCTWC = require("./chunk-TN4KCTWC.js");
68
+ var import_chunk_CW6KQ3VH = require("./chunk-CW6KQ3VH.js");
69
+ var import_chunk_T5MMBF2S = require("./chunk-T5MMBF2S.js");
80
70
  var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
81
71
  var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
72
+ var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
82
73
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
83
- var import_chunk_DYVL6P7F = require("./chunk-DYVL6P7F.js");
74
+ var import_chunk_BPDMLM32 = require("./chunk-BPDMLM32.js");
84
75
  var import_chunk_IOIAK7V7 = require("./chunk-IOIAK7V7.js");
85
- var import_chunk_K5W6WZ6E = require("./chunk-K5W6WZ6E.js");
86
- var import_chunk_VVPSLVOR = require("./chunk-VVPSLVOR.js");
76
+ var import_chunk_MJIP3FY5 = require("./chunk-MJIP3FY5.js");
87
77
  var import_chunk_ZJWZK45Z = require("./chunk-ZJWZK45Z.js");
88
78
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
89
79
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
@@ -101,26 +91,20 @@ var import_fetch_engine = require("@prisma/fetch-engine");
101
91
  var import_get_platform = require("@prisma/get-platform");
102
92
  var import_path3 = __toESM2(require("path"));
103
93
  var import_debug4 = __toESM2(require("@prisma/debug"));
104
- var import_fs2 = __toESM2(require("fs"));
105
- var import_path4 = __toESM2(require("path"));
106
- var import_debug5 = __toESM2(require("@prisma/debug"));
107
- var import_fs3 = __toESM2(require("fs"));
108
- var import_path5 = __toESM2(require("path"));
109
- var import_debug6 = __toESM2(require("@prisma/debug"));
110
94
  var import_node_path = __toESM2(require("node:path"));
111
95
  var import_node_process = __toESM2(require("node:process"));
112
96
  var import_node_path2 = __toESM2(require("node:path"));
113
97
  var import_node_fs = __toESM2(require("node:fs"));
114
98
  var import_node_url = require("node:url");
115
99
  var import_node_fs2 = __toESM2(require("node:fs"));
116
- var import_fs4 = __toESM2(require("fs"));
117
- var import_path6 = __toESM2(require("path"));
100
+ var import_fs2 = __toESM2(require("fs"));
101
+ var import_path4 = __toESM2(require("path"));
118
102
  var import_get_platform2 = require("@prisma/get-platform");
119
103
  var debug = (0, import_debug2.default)("prisma:format");
120
104
  async function formatSchema({ schemas }, inputFormattingOptions) {
121
105
  if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
122
106
  handleFormatPanic(() => {
123
- import_chunk_YOIAL2YX.prismaSchemaWasm.debug_panic();
107
+ import_chunk_T5MMBF2S.prismaSchemaWasm.debug_panic();
124
108
  });
125
109
  }
126
110
  const defaultFormattingOptions = {
@@ -137,10 +121,10 @@ async function formatSchema({ schemas }, inputFormattingOptions) {
137
121
  const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(() => {
138
122
  const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
139
123
  const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
140
- const lintDiagnostics2 = (0, import_chunk_PBDMN3UX.lintSchema)({ schemas: formattedMultipleSchemas2 });
124
+ const lintDiagnostics2 = (0, import_chunk_GNKWZC7O.lintSchema)({ schemas: formattedMultipleSchemas2 });
141
125
  return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
142
126
  });
143
- const lintWarnings = (0, import_chunk_PBDMN3UX.getLintWarningsAsText)(lintDiagnostics);
127
+ const lintWarnings = (0, import_chunk_GNKWZC7O.getLintWarningsAsText)(lintDiagnostics);
144
128
  if (lintWarnings && import_chunk_ZJWZK45Z.logger_exports.should.warn()) {
145
129
  console.warn(lintWarnings);
146
130
  }
@@ -167,7 +151,7 @@ function handleFormatPanic(tryCb) {
167
151
  }
168
152
  }
169
153
  function formatWasm(schema, documentFormattingParams) {
170
- const formattedSchema = import_chunk_YOIAL2YX.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
154
+ const formattedSchema = import_chunk_T5MMBF2S.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
171
155
  return formattedSchema;
172
156
  }
173
157
  var readFile = (0, import_util.promisify)(import_fs.default.readFile);
@@ -211,7 +195,7 @@ async function readSchemaFromDirectory(schemaPath2) {
211
195
  }
212
196
  const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
213
197
  debug2("Loading config");
214
- const config = await (0, import_chunk_TJQK4HOJ.getConfig)({
198
+ const config = await (0, import_chunk_CW6KQ3VH.getConfig)({
215
199
  datamodel: files,
216
200
  ignoreEnvVarErrors: true
217
201
  });
@@ -303,7 +287,7 @@ function renderDefaultLookupError(error, cwd) {
303
287
  return parts.join("\n");
304
288
  }
305
289
  async function getPrismaConfigFromPackageJson(cwd) {
306
- const pkgJson = await (0, import_chunk_K5W6WZ6E.readPackageUp)({ cwd, normalize: false });
290
+ const pkgJson = await (0, import_chunk_MJIP3FY5.readPackageUp)({ cwd, normalize: false });
307
291
  const prismaPropertyFromPkgJson = pkgJson?.packageJson?.prisma;
308
292
  if (!pkgJson) {
309
293
  return null;
@@ -362,11 +346,11 @@ async function getSchemaFromPackageJson(cwd) {
362
346
  }
363
347
  async function getDefaultSchema(cwd, failures = []) {
364
348
  const lookupPaths = [import_path.default.join(cwd, "schema.prisma"), import_path.default.join(cwd, "prisma", "schema.prisma")];
365
- for (const path9 of lookupPaths) {
366
- debug2(`Checking existence of ${path9}`);
367
- const schema = await readSchemaFromSingleFile(path9);
349
+ for (const path7 of lookupPaths) {
350
+ debug2(`Checking existence of ${path7}`);
351
+ const schema = await readSchemaFromSingleFile(path7);
368
352
  if (!schema.ok) {
369
- failures.push({ path: path9, error: schema.error });
353
+ failures.push({ path: path7, error: schema.error });
370
354
  continue;
371
355
  }
372
356
  return schema;
@@ -421,7 +405,7 @@ async function processSchemaResult({
421
405
  if (printLoadMessage) {
422
406
  printSchemaLoadedMessage(loadedFromPathForLogMessages);
423
407
  }
424
- const configFromPsl = await (0, import_chunk_TJQK4HOJ.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
408
+ const configFromPsl = await (0, import_chunk_CW6KQ3VH.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
425
409
  const primaryDatasource = configFromPsl.datasources.at(0);
426
410
  const schemaRootDir = schemaResult.schemaRootDir || cwd;
427
411
  return {
@@ -443,117 +427,25 @@ function primaryDatasourceDirectory(primaryDatasource) {
443
427
  }
444
428
  return null;
445
429
  }
446
- var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_K5W6WZ6E.require_p_map)());
447
- var debug3 = (0, import_debug5.default)("prisma:generator");
448
- async function checkTypeScriptVersion() {
449
- const minVersion = "4.1.0";
450
- try {
451
- const typescriptPath = await (0, import_chunk_VVPSLVOR.resolvePkg)("typescript", {
452
- basedir: process.cwd()
453
- });
454
- debug3("typescriptPath", typescriptPath);
455
- const typescriptPkg = typescriptPath && import_path5.default.join(typescriptPath, "package.json");
456
- if (typescriptPkg && import_fs3.default.existsSync(typescriptPkg)) {
457
- const pjson = (0, import_chunk_4VNS5WPM.__require)(typescriptPkg);
458
- const currentVersion = pjson.version;
459
- if ((0, import_chunk_EUTJYQDW.semverLt)(currentVersion, minVersion)) {
460
- import_chunk_ZJWZK45Z.logger_exports.warn(
461
- `Prisma detected that your ${(0, import_chunk_PG5FDKSF.bold)(
462
- "TypeScript"
463
- )} version ${currentVersion} is outdated. If you want to use Prisma Client with TypeScript please update it to version ${(0, import_chunk_PG5FDKSF.bold)(
464
- minVersion
465
- )} or ${(0, import_chunk_PG5FDKSF.bold)("newer")}. ${(0, import_chunk_PG5FDKSF.dim)(`TypeScript found in: ${(0, import_chunk_PG5FDKSF.bold)(typescriptPath)}`)}`
466
- );
467
- }
468
- }
469
- } catch (e) {
470
- }
471
- }
472
- var debug4 = (0, import_debug4.default)("prisma:generator");
473
- async function prismaClientResolver(baseDir, version3) {
474
- let prismaClientDir = await (0, import_chunk_EWWOTVR3.findPrismaClientDir)(baseDir);
475
- debug4("baseDir", baseDir);
476
- await checkTypeScriptVersion();
477
- if (!prismaClientDir && !process.env.PRISMA_GENERATE_SKIP_AUTOINSTALL) {
478
- let projectRoot = (0, import_chunk_J77ZIDXB.longestCommonPathPrefix)(baseDir, process.cwd());
479
- debug4("projectRoot", projectRoot);
480
- const warningTag = `${(0, import_chunk_PG5FDKSF.bold)("Warning:")} ${(0, import_chunk_PG5FDKSF.dim)("[Prisma auto-install on generate]")}`;
481
- if (projectRoot === void 0) {
482
- console.warn(
483
- (0, import_chunk_PG5FDKSF.yellow)(
484
- `${warningTag} The Prisma schema directory ${(0, import_chunk_PG5FDKSF.bold)(baseDir)} and the current working directory ${(0, import_chunk_PG5FDKSF.bold)(
485
- process.cwd()
486
- )} have no common ancestor. The Prisma schema directory will be used as the project root.`
487
- )
488
- );
489
- projectRoot = baseDir;
490
- }
491
- if (!import_fs2.default.existsSync(import_path4.default.join(projectRoot, "package.json"))) {
492
- console.warn(
493
- (0, import_chunk_PG5FDKSF.yellow)(
494
- `${warningTag} Prisma could not find a ${(0, import_chunk_PG5FDKSF.bold)("package.json")} file in the inferred project root ${(0, import_chunk_PG5FDKSF.bold)(
495
- projectRoot
496
- )}. During the next step, when an auto-install of Prisma package(s) will be attempted, it will then be created by your package manager on the appropriate level if necessary.`
497
- )
498
- );
499
- }
500
- const prismaCliDir = await (0, import_chunk_VVPSLVOR.resolvePkg)("prisma", { basedir: baseDir });
501
- if (process.platform === "win32" && await (0, import_chunk_GHHABGYW.isYarnUsed)(baseDir)) {
502
- const hasCli = (s) => prismaCliDir !== void 0 ? s : "";
503
- const missingCli = (s) => prismaCliDir === void 0 ? s : "";
504
- throw new Error(
505
- `Could not resolve ${missingCli(`${(0, import_chunk_PG5FDKSF.bold)("prisma")} and `)}${(0, import_chunk_PG5FDKSF.bold)(
506
- "@prisma/client"
507
- )} in the current project. Please install ${hasCli("it")}${missingCli("them")} with ${missingCli(
508
- `${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)(`${await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "add", "prisma", "-D")}`))} and `
509
- )}${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)(`${await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "add", "@prisma/client")}`))}, and rerun ${(0, import_chunk_PG5FDKSF.bold)(
510
- await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "execute", "prisma generate")
511
- )} \u{1F64F}.`
512
- );
513
- }
514
- if (!prismaCliDir) {
515
- await (0, import_chunk_QGJH4P4N.runPackageCmd)(projectRoot, "add", `prisma@${version3 ?? "latest"}`, "-D", "--silent");
516
- }
517
- await (0, import_chunk_QGJH4P4N.runPackageCmd)(projectRoot, "add", `@prisma/client@${version3 ?? "latest"}`, "--silent");
518
- prismaClientDir = await (0, import_chunk_EWWOTVR3.findPrismaClientDir)(import_path4.default.join(".", baseDir));
519
- if (!prismaClientDir) {
520
- throw new Error(
521
- `Could not resolve @prisma/client despite the installation that we just tried.
522
- Please try to install it by hand with ${(0, import_chunk_PG5FDKSF.bold)(
523
- (0, import_chunk_PG5FDKSF.green)(`${await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "add", "@prisma/client")}`)
524
- )} and rerun ${(0, import_chunk_PG5FDKSF.bold)(await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "execute", "prisma generate"))} \u{1F64F}.`
525
- );
526
- }
527
- console.info(
528
- `
529
- \u2714 Installed the ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)("@prisma/client"))} and ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)("prisma"))} packages in your project`
530
- );
531
- }
532
- if (!prismaClientDir) {
533
- throw new Error(
534
- `Could not resolve @prisma/client.
535
- Please try to install it with ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk_PG5FDKSF.green)("npm install @prisma/client"))} and rerun ${(0, import_chunk_PG5FDKSF.bold)(
536
- await (0, import_chunk_72UZXEBG.getPackageCmd)(baseDir, "execute", "prisma generate")
537
- )} \u{1F64F}.`
430
+ var import_p_map = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_MJIP3FY5.require_p_map)());
431
+ var debug3 = (0, import_debug3.default)("prisma:getGenerators");
432
+ async function getGenerators(options) {
433
+ if (options.registry === void 0 && options.providerAliases !== void 0) {
434
+ options.registry = Object.fromEntries(
435
+ Object.entries(options.providerAliases).map(([name, definition]) => [
436
+ name,
437
+ {
438
+ type: "rpc",
439
+ generatorPath: definition.generatorPath,
440
+ isNode: definition.isNode
441
+ }
442
+ ])
538
443
  );
539
444
  }
540
- return {
541
- outputPath: prismaClientDir,
542
- generatorPath: import_path4.default.resolve(prismaClientDir, "generator-build/index.js"),
543
- isNode: true
544
- };
545
- }
546
- var generatorResolvers = {
547
- "prisma-client-js": prismaClientResolver
548
- };
549
- var debug5 = (0, import_debug3.default)("prisma:getGenerators");
550
- async function getGenerators(options) {
551
445
  const {
552
446
  schemaPath,
553
- providerAliases: aliases,
554
- // do you get the pun?
447
+ registry,
555
448
  version,
556
- cliVersion,
557
449
  printDownloadProgress,
558
450
  overrideGenerators,
559
451
  skipDownload,
@@ -591,7 +483,7 @@ async function getGenerators(options) {
591
483
  }
592
484
  (0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
593
485
  const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
594
- const dmmf = await (0, import_chunk_WXILQIQF.getDMMF)({
486
+ const dmmf = await (0, import_chunk_QJ72IP2K.getDMMF)({
595
487
  datamodel: schemaContext.schemaFiles,
596
488
  previewFeatures
597
489
  });
@@ -607,41 +499,34 @@ async function getGenerators(options) {
607
499
  try {
608
500
  const generators = await (0, import_p_map.default)(
609
501
  generatorConfigs,
610
- async (generator, index) => {
611
- let generatorPath = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
612
- let paths;
613
- const baseDir = import_path3.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
614
- const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
615
- if (aliases && aliases[providerValue]) {
616
- generatorPath = aliases[providerValue].generatorPath;
617
- paths = aliases[providerValue];
618
- } else if (generatorResolvers[providerValue]) {
619
- paths = await generatorResolvers[providerValue](baseDir, cliVersion);
620
- generatorPath = paths.generatorPath;
621
- }
622
- const generatorInstance = new import_chunk_DYVL6P7F.Generator(generatorPath, generator, paths?.isNode);
502
+ async (generatorConfig, index) => {
503
+ const baseDir = import_path3.default.dirname(generatorConfig.sourceFilePath ?? schemaContext.schemaRootDir);
504
+ const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.provider);
505
+ const generatorDefinition = registry[providerValue] ?? {
506
+ type: "rpc",
507
+ generatorPath: providerValue
508
+ };
509
+ const generatorInstance = (0, import_chunk_XKZ6CBLA.z)(generatorDefinition).with({ type: "in-process" }, ({ generator }) => new import_chunk_BPDMLM32.InProcessGenerator(generatorConfig, generator)).with(
510
+ { type: "rpc" },
511
+ ({ generatorPath, isNode }) => new import_chunk_BPDMLM32.JsonRpcGenerator(generatorPath, generatorConfig, isNode)
512
+ ).exhaustive();
623
513
  await generatorInstance.init();
624
- if (generator.output) {
625
- generator.output = {
626
- value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.output)),
627
- fromEnvVar: null
628
- };
629
- generator.isCustomOutput = true;
630
- } else if (paths) {
631
- generator.output = {
632
- value: paths.outputPath,
514
+ if (generatorConfig.output) {
515
+ generatorConfig.output = {
516
+ value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.output)),
633
517
  fromEnvVar: null
634
518
  };
519
+ generatorConfig.isCustomOutput = true;
635
520
  } else {
636
- if (!generatorInstance.manifest || !generatorInstance.manifest.defaultOutput) {
521
+ if (!generatorInstance.manifest?.defaultOutput) {
637
522
  throw new Error(
638
- `Can't resolve output dir for generator ${(0, import_chunk_PG5FDKSF.bold)(generator.name)} with provider ${(0, import_chunk_PG5FDKSF.bold)(
639
- generator.provider.value
523
+ `Can't resolve output dir for generator ${(0, import_chunk_PG5FDKSF.bold)(generatorConfig.name)} with provider ${(0, import_chunk_PG5FDKSF.bold)(
524
+ generatorConfig.provider.value
640
525
  )}.
641
- The generator needs to either define the \`defaultOutput\` path in the manifest or you need to define \`output\` in the datamodel.prisma file.`
526
+ You need to define \`output\` in the generator block in the schema file.`
642
527
  );
643
528
  }
644
- generator.output = {
529
+ generatorConfig.output = {
645
530
  value: await (0, import_chunk_2B26F5N3.resolveOutput)({
646
531
  defaultOutput: generatorInstance.manifest.defaultOutput,
647
532
  baseDir
@@ -649,12 +534,12 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
649
534
  fromEnvVar: null
650
535
  };
651
536
  }
652
- const datamodel = (0, import_chunk_S54BUEJF.mergeSchemas)({ schemas: schemaContext.schemaFiles });
653
- const envPaths = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
537
+ const datamodel = (0, import_chunk_TN4KCTWC.mergeSchemas)({ schemas: schemaContext.schemaFiles });
538
+ const envPaths = await getEnvPaths(schemaContext.schemaPath, { cwd: generatorConfig.output.value });
654
539
  const options2 = {
655
540
  datamodel,
656
541
  datasources: schemaContext.datasources,
657
- generator,
542
+ generator: generatorConfig,
658
543
  dmmf,
659
544
  otherGenerators: skipIndex(generatorConfigs, index),
660
545
  schemaPath: schemaContext.schemaPath,
@@ -716,7 +601,7 @@ generator gen {
716
601
  }
717
602
  }
718
603
  }
719
- debug5("neededVersions", JSON.stringify(neededVersions, null, 2));
604
+ debug3("neededVersions", JSON.stringify(neededVersions, null, 2));
720
605
  const binaryPathsByVersion = await (0, import_chunk_EPXBOIA5.getBinaryPathsByVersion)({
721
606
  neededVersions,
722
607
  binaryTarget,
@@ -730,17 +615,17 @@ generator gen {
730
615
  const engineVersion = (0, import_chunk_X3P4J7WW.getEngineVersionForGenerator)(generator.manifest, version);
731
616
  const binaryPaths = binaryPathsByVersion[engineVersion];
732
617
  const generatorBinaryPaths = (0, import_chunk_5V36RLCO.pick)(binaryPaths, generator.manifest.requiresEngines);
733
- debug5({ generatorBinaryPaths });
618
+ debug3({ generatorBinaryPaths });
734
619
  generator.setBinaryPaths(generatorBinaryPaths);
735
620
  if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
736
- const customDmmf = await (0, import_chunk_WXILQIQF.getDMMF)({
621
+ const customDmmf = await (0, import_chunk_QJ72IP2K.getDMMF)({
737
622
  datamodel: schemaContext.schemaFiles,
738
623
  previewFeatures
739
624
  });
740
625
  const options2 = { ...generator.options, dmmf: customDmmf };
741
- debug5("generator.manifest.prettyName", generator.manifest.prettyName);
742
- debug5("options", options2);
743
- debug5("options.generator.binaryTargets", options2.generator.binaryTargets);
626
+ debug3("generator.manifest.prettyName", generator.manifest.prettyName);
627
+ debug3("options", options2);
628
+ debug3("options.generator.binaryTargets", options2.generator.binaryTargets);
744
629
  generator.setOptions(options2);
745
630
  }
746
631
  }
@@ -872,9 +757,9 @@ function locatePathSync(paths, {
872
757
  }
873
758
  }
874
759
  }
875
- function pathExistsSync(path9) {
760
+ function pathExistsSync(path7) {
876
761
  try {
877
- import_node_fs2.default.accessSync(path9);
762
+ import_node_fs2.default.accessSync(path7);
878
763
  return true;
879
764
  } catch {
880
765
  return false;
@@ -882,9 +767,9 @@ function pathExistsSync(path9) {
882
767
  }
883
768
  var findUpStop = Symbol("findUpStop");
884
769
  function findUpMultipleSync(name, options2 = {}) {
885
- let directory = import_node_path.default.resolve((0, import_chunk_K5W6WZ6E.toPath)(options2.cwd) ?? "");
770
+ let directory = import_node_path.default.resolve((0, import_chunk_MJIP3FY5.toPath)(options2.cwd) ?? "");
886
771
  const { root } = import_node_path.default.parse(directory);
887
- const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_K5W6WZ6E.toPath)(options2.stopAt) ?? root);
772
+ const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_MJIP3FY5.toPath)(options2.stopAt) ?? root);
888
773
  const limit = options2.limit ?? Number.POSITIVE_INFINITY;
889
774
  const paths = [name].flat();
890
775
  const runMatcher = (locateOptions) => {
@@ -917,7 +802,7 @@ function findUpSync(name, options2 = {}) {
917
802
  const matches = findUpMultipleSync(name, { ...options2, limit: 1 });
918
803
  return matches[0];
919
804
  }
920
- var debug6 = (0, import_debug6.default)("prisma:loadEnv");
805
+ var debug4 = (0, import_debug4.default)("prisma:loadEnv");
921
806
  async function getEnvPaths(schemaPath2, opts = { cwd: process.cwd() }) {
922
807
  const rootEnvPath = getProjectRootEnvPath({ cwd: opts.cwd }) ?? null;
923
808
  const schemaEnvPathFromArgs = schemaPathToEnvPath(schemaPath2);
@@ -948,16 +833,16 @@ async function readSchemaPathFromPkgJson() {
948
833
  }
949
834
  function getProjectRootEnvPath(opts) {
950
835
  const pkgJsonPath = findUpSync((dir) => {
951
- const pkgPath = import_path6.default.join(dir, "package.json");
836
+ const pkgPath = import_path4.default.join(dir, "package.json");
952
837
  if (pathExistsSync(pkgPath)) {
953
838
  try {
954
- const pkg = JSON.parse(import_fs4.default.readFileSync(pkgPath, "utf8"));
839
+ const pkg = JSON.parse(import_fs2.default.readFileSync(pkgPath, "utf8"));
955
840
  if (pkg["name"] !== ".prisma/client") {
956
- debug6(`project root found at ${pkgPath}`);
841
+ debug4(`project root found at ${pkgPath}`);
957
842
  return pkgPath;
958
843
  }
959
844
  } catch (e) {
960
- debug6(`skipping package.json at ${pkgPath}`);
845
+ debug4(`skipping package.json at ${pkgPath}`);
961
846
  }
962
847
  }
963
848
  return void 0;
@@ -965,15 +850,15 @@ function getProjectRootEnvPath(opts) {
965
850
  if (!pkgJsonPath) {
966
851
  return null;
967
852
  }
968
- const candidate = import_path6.default.join(import_path6.default.dirname(pkgJsonPath), ".env");
969
- if (!import_fs4.default.existsSync(candidate)) {
853
+ const candidate = import_path4.default.join(import_path4.default.dirname(pkgJsonPath), ".env");
854
+ if (!import_fs2.default.existsSync(candidate)) {
970
855
  return null;
971
856
  }
972
857
  return candidate;
973
858
  }
974
859
  function schemaPathToEnvPath(schemaPath2) {
975
860
  if (!schemaPath2) return null;
976
- return import_path6.default.join(import_path6.default.dirname(schemaPath2), ".env");
861
+ return import_path4.default.join(import_path4.default.dirname(schemaPath2), ".env");
977
862
  }
978
863
  async function loadEnvFile({
979
864
  schemaPath: schemaPath2,
@@ -1008,7 +893,7 @@ function checkUnsupportedDataProxy({
1008
893
  }
1009
894
  }
1010
895
  if (!schemaContext2?.primaryDatasource) return;
1011
- const url = (0, import_chunk_TJQK4HOJ.resolveUrl)((0, import_chunk_TJQK4HOJ.getEffectiveUrl)(schemaContext2.primaryDatasource));
896
+ const url = (0, import_chunk_CW6KQ3VH.resolveUrl)((0, import_chunk_CW6KQ3VH.getEffectiveUrl)(schemaContext2.primaryDatasource));
1012
897
  if (url?.startsWith("prisma://")) {
1013
898
  throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
1014
899
  }
@@ -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_YOIAL2YX_exports = {};
30
- __export(chunk_YOIAL2YX_exports, {
29
+ var chunk_T5MMBF2S_exports = {};
30
+ __export(chunk_T5MMBF2S_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_YOIAL2YX_exports);
36
- var import_chunk_TPAYJAJV = require("./chunk-TPAYJAJV.js");
35
+ module.exports = __toCommonJS(chunk_T5MMBF2S_exports);
36
+ var import_chunk_A6IRWWSZ = require("./chunk-A6IRWWSZ.js");
37
37
  var import_chunk_WXRVYSYN = require("./chunk-WXRVYSYN.js");
38
38
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.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_TPAYJAJV.require_package)();
45
+ var { dependencies } = (0, import_chunk_A6IRWWSZ.require_package)();
46
46
  var prismaSchemaWasmVersion = dependencies["@prisma/prisma-schema-wasm"];
47
47
  globalThis.PRISMA_WASM_PANIC_REGISTRY = new import_chunk_WXRVYSYN.WasmPanicRegistry();
@@ -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_S54BUEJF_exports = {};
30
- __export(chunk_S54BUEJF_exports, {
29
+ var chunk_TN4KCTWC_exports = {};
30
+ __export(chunk_TN4KCTWC_exports, {
31
31
  MergeSchemasError: () => MergeSchemasError,
32
32
  mergeSchemas: () => mergeSchemas
33
33
  });
34
- module.exports = __toCommonJS(chunk_S54BUEJF_exports);
34
+ module.exports = __toCommonJS(chunk_TN4KCTWC_exports);
35
35
  var import_chunk_WSZXPLJQ = require("./chunk-WSZXPLJQ.js");
36
36
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
37
37
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
38
- var import_chunk_NAZNTEI6 = require("./chunk-NAZNTEI6.js");
39
- var import_chunk_YOIAL2YX = require("./chunk-YOIAL2YX.js");
38
+ var import_chunk_JETLVL4E = require("./chunk-JETLVL4E.js");
39
+ var import_chunk_T5MMBF2S = require("./chunk-T5MMBF2S.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_NAZNTEI6.addVersionDetailsToErrorMessage)(errorMessageWithContext));
62
+ super((0, import_chunk_JETLVL4E.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_YOIAL2YX.prismaSchemaWasm.merge_schemas(params);
75
+ return import_chunk_T5MMBF2S.prismaSchemaWasm.merge_schemas(params);
76
76
  },
77
77
  (e) => ({
78
78
  type: "wasm-error",
@@ -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_NAZNTEI6_exports = {};
20
- __export(chunk_NAZNTEI6_exports, {
19
+ var chunk_TRF2UWX2_exports = {};
20
+ __export(chunk_TRF2UWX2_exports, {
21
21
  addVersionDetailsToErrorMessage: () => addVersionDetailsToErrorMessage
22
22
  });
23
- module.exports = __toCommonJS(chunk_NAZNTEI6_exports);
24
- var import_chunk_HQF2XKUK = require("./chunk-HQF2XKUK.js");
23
+ module.exports = __toCommonJS(chunk_TRF2UWX2_exports);
24
+ var import_chunk_JUTACZEX = require("./chunk-JUTACZEX.js");
25
25
  var import_chunk_QN6PSQY7 = require("./chunk-QN6PSQY7.js");
26
26
  function addVersionDetailsToErrorMessage(message) {
27
- const rows = [["Prisma CLI Version", import_chunk_HQF2XKUK.version]];
27
+ const rows = [["Prisma CLI Version", import_chunk_JUTACZEX.version]];
28
28
  return `${message}
29
29
 
30
30
  ${(0, import_chunk_QN6PSQY7.formatTable)(rows)}`;