@prisma/internals 6.6.0-integration-push-xmzqvqxpztks.12 → 6.6.0-integration-mcp.3

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 +5 -23
  2. package/dist/Generator.js +2 -4
  3. package/dist/{chunk-LVXOY25I.js → chunk-46FA36ZM.js} +5 -5
  4. package/dist/chunk-72UZXEBG.js +28 -0
  5. package/dist/{chunk-62PNTFVL.js → chunk-7SLJMIAW.js} +5 -5
  6. package/dist/{chunk-XAAXHLR3.js → chunk-AP52B62F.js} +5 -5
  7. package/dist/chunk-BWGDP6B5.js +4948 -0
  8. package/dist/{chunk-BPDMLM32.js → chunk-DYVL6P7F.js} +13 -46
  9. package/dist/chunk-EUTJYQDW.js +46 -0
  10. package/dist/chunk-EWWOTVR3.js +52 -0
  11. package/dist/{chunk-Z5PI6LVB.js → chunk-FAPPXX7W.js} +8 -8
  12. package/dist/{chunk-MVXDMOUP.js → chunk-FXFNXBNO.js} +8 -8
  13. package/dist/chunk-GHHABGYW.js +28 -0
  14. package/dist/{chunk-TURIBUFP.js → chunk-GV244NDE.js} +7 -7
  15. package/dist/{chunk-UKGGGBT7.js → chunk-INWG6J3Y.js} +5 -5
  16. package/dist/{chunk-BD2NGNRL.js → chunk-ITKXEANW.js} +198 -83
  17. package/dist/{chunk-MJIP3FY5.js → chunk-K5W6WZ6E.js} +238 -6
  18. package/dist/{chunk-62LU4TVK.js → chunk-LWBLVV7Y.js} +8 -8
  19. package/dist/{chunk-VEXYKK6K.js → chunk-MZHKUMZX.js} +8 -8
  20. package/dist/{chunk-72C2UHFB.js → chunk-OL4K6FMD.js} +7 -7
  21. package/dist/{chunk-XARFXSI5.js → chunk-OUQPIJFQ.js} +5 -5
  22. package/dist/{chunk-BWPH7QBV.js → chunk-PING5S2U.js} +8 -8
  23. package/dist/chunk-QGJH4P4N.js +35 -0
  24. package/dist/{chunk-BTAROFR3.js → chunk-RT6W6X7Y.js} +8 -8
  25. package/dist/{chunk-R3ZRLDO2.js → chunk-SNSJWJTA.js} +5 -5
  26. package/dist/{chunk-MM2LGTOC.js → chunk-TYGHBZMD.js} +6 -5
  27. package/dist/{chunk-VXSXRDY2.js → chunk-VTJOX6HO.js} +5 -5
  28. package/dist/{chunk-67I7CEQJ.js → chunk-VVPSLVOR.js} +7 -6
  29. package/dist/{chunk-P3WMSDK6.js → chunk-VYJSNZF3.js} +5 -4
  30. package/dist/{chunk-SDEBGULW.js → chunk-W4ZUPFHQ.js} +198 -83
  31. package/dist/{chunk-RTT3E5AL.js → chunk-ZQEXNNVO.js} +5 -5
  32. package/dist/cli/checkUnsupportedDataProxy.js +28 -22
  33. package/dist/cli/getSchema.js +31 -25
  34. package/dist/cli/hashes.js +28 -22
  35. package/dist/cli/schemaContext.js +28 -22
  36. package/dist/engine-commands/errorHelpers.js +4 -4
  37. package/dist/engine-commands/formatSchema.js +27 -21
  38. package/dist/engine-commands/getConfig.js +10 -10
  39. package/dist/engine-commands/getDmmf.js +7 -7
  40. package/dist/engine-commands/index.js +36 -30
  41. package/dist/engine-commands/lintSchema.js +8 -8
  42. package/dist/engine-commands/mergeSchemas.js +7 -7
  43. package/dist/engine-commands/validate.js +7 -7
  44. package/dist/get-generators/generatorResolvers/generatorResolvers.d.ts +15 -0
  45. package/dist/get-generators/generatorResolvers/generatorResolvers.js +138 -0
  46. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +6 -0
  47. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.js +26 -0
  48. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +9 -0
  49. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.js +26 -0
  50. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +8 -0
  51. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.js +29 -0
  52. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +6 -0
  53. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +138 -0
  54. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +1 -0
  55. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.js +26 -0
  56. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +20 -0
  57. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.js +26 -0
  58. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +7 -0
  59. package/dist/{resolvePkg.js → get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.js} +6 -6
  60. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.d.ts +1 -0
  61. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.js +17 -0
  62. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +20 -0
  63. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +139 -0
  64. package/dist/get-generators/getGenerators.d.ts +9 -18
  65. package/dist/get-generators/getGenerators.js +30 -24
  66. package/dist/getPackedPackage.js +3 -3
  67. package/dist/index.d.ts +4 -2
  68. package/dist/index.js +57 -51
  69. package/dist/utils/getEnvPaths.js +27 -21
  70. package/dist/utils/getVersionFromPackageJson.js +3 -3
  71. package/dist/utils/loadEnvFile.js +27 -21
  72. package/dist/wasm.js +4 -4
  73. package/package.json +12 -11
  74. package/dist/resolvePkg.d.ts +0 -7
@@ -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_VXSXRDY2_exports = {};
20
- __export(chunk_VXSXRDY2_exports, {
19
+ var chunk_VTJOX6HO_exports = {};
20
+ __export(chunk_VTJOX6HO_exports, {
21
21
  version: () => version
22
22
  });
23
- module.exports = __toCommonJS(chunk_VXSXRDY2_exports);
24
- var import_chunk_MM2LGTOC = require("./chunk-MM2LGTOC.js");
25
- var packageJson = (0, import_chunk_MM2LGTOC.require_package)();
23
+ module.exports = __toCommonJS(chunk_VTJOX6HO_exports);
24
+ var import_chunk_VYJSNZF3 = require("./chunk-VYJSNZF3.js");
25
+ var packageJson = (0, import_chunk_VYJSNZF3.require_package)();
26
26
  var version = packageJson.version;
@@ -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_67I7CEQJ_exports = {};
30
- __export(chunk_67I7CEQJ_exports, {
31
- require_is_core_module: () => require_is_core_module,
29
+ var chunk_VVPSLVOR_exports = {};
30
+ __export(chunk_VVPSLVOR_exports, {
31
+ require_function_bind: () => require_function_bind,
32
+ resolve: () => resolve,
32
33
  resolvePkg: () => resolvePkg
33
34
  });
34
- module.exports = __toCommonJS(chunk_67I7CEQJ_exports);
35
+ module.exports = __toCommonJS(chunk_VVPSLVOR_exports);
35
36
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
36
37
  var import_path = __toESM(require("path"));
37
38
  var require_homedir = (0, import_chunk_4VNS5WPM.__commonJS)({
@@ -1179,7 +1180,7 @@ var require_resolve = (0, import_chunk_4VNS5WPM.__commonJS)({
1179
1180
  }
1180
1181
  });
1181
1182
  var import_resolve = (0, import_chunk_4VNS5WPM.__toESM)(require_resolve());
1182
- async function resolveOrUndefined(id, options) {
1183
+ async function resolve(id, options) {
1183
1184
  const _options = { preserveSymlinks: false, ...options };
1184
1185
  return new Promise((res) => {
1185
1186
  (0, import_resolve.default)(id, _options, (e, v) => {
@@ -1189,6 +1190,6 @@ async function resolveOrUndefined(id, options) {
1189
1190
  });
1190
1191
  }
1191
1192
  async function resolvePkg(id, options) {
1192
- const resolvedPath = await resolveOrUndefined(`${id}/package.json`, options);
1193
+ const resolvedPath = await resolve(`${id}/package.json`, options);
1193
1194
  return resolvedPath && import_path.default.dirname(resolvedPath);
1194
1195
  }
@@ -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_P3WMSDK6_exports = {};
20
- __export(chunk_P3WMSDK6_exports, {
19
+ var chunk_VYJSNZF3_exports = {};
20
+ __export(chunk_VYJSNZF3_exports, {
21
21
  require_package: () => require_package
22
22
  });
23
- module.exports = __toCommonJS(chunk_P3WMSDK6_exports);
23
+ module.exports = __toCommonJS(chunk_VYJSNZF3_exports);
24
24
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
25
25
  var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
26
26
  "package.json"(exports, module2) {
@@ -53,6 +53,7 @@ var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
53
53
  "scripts"
54
54
  ],
55
55
  devDependencies: {
56
+ "@antfu/ni": "0.21.12",
56
57
  "@babel/helper-validator-identifier": "7.25.9",
57
58
  "@opentelemetry/api": "1.9.0",
58
59
  "@swc/core": "1.11.5",
@@ -112,7 +113,7 @@ var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
112
113
  "@prisma/generator": "workspace:*",
113
114
  "@prisma/generator-helper": "workspace:*",
114
115
  "@prisma/get-platform": "workspace:*",
115
- "@prisma/prisma-schema-wasm": "6.6.0-27.ff4e67a11a395e489261256f882adb6d6a7eea11",
116
+ "@prisma/prisma-schema-wasm": "6.6.0-26.47cb872770bc2c9ff45909bd09f7326df36d9130",
116
117
  "@prisma/schema-files-loader": "workspace:*",
117
118
  arg: "5.0.2",
118
119
  prompts: "2.4.2"
@@ -26,11 +26,14 @@ 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_SDEBGULW_exports = {};
30
- __export(chunk_SDEBGULW_exports, {
29
+ var chunk_W4ZUPFHQ_exports = {};
30
+ __export(chunk_W4ZUPFHQ_exports, {
31
+ checkTypeScriptVersion: () => checkTypeScriptVersion,
31
32
  checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
33
+ debug: () => debug4,
32
34
  forbiddenCmdWithDataProxyFlagMessage: () => forbiddenCmdWithDataProxyFlagMessage,
33
35
  formatSchema: () => formatSchema,
36
+ generatorResolvers: () => generatorResolvers,
34
37
  getBinaryTargetForCurrentPlatform: () => import_get_platform2.getBinaryTargetForCurrentPlatform,
35
38
  getCLIPathHash: () => getCLIPathHash,
36
39
  getEnvPaths: () => getEnvPaths,
@@ -46,34 +49,41 @@ __export(chunk_SDEBGULW_exports, {
46
49
  loadEnvFile: () => loadEnvFile,
47
50
  loadSchemaContext: () => loadSchemaContext,
48
51
  printSchemaLoadedMessage: () => printSchemaLoadedMessage,
52
+ prismaClientResolver: () => prismaClientResolver,
49
53
  processSchemaResult: () => processSchemaResult,
50
54
  skipIndex: () => skipIndex
51
55
  });
52
- module.exports = __toCommonJS(chunk_SDEBGULW_exports);
56
+ module.exports = __toCommonJS(chunk_W4ZUPFHQ_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");
53
62
  var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
54
63
  var import_chunk_EPXBOIA5 = require("./chunk-EPXBOIA5.js");
55
64
  var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
56
65
  var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
57
66
  var import_chunk_LRU47BGE = require("./chunk-LRU47BGE.js");
58
- var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
59
67
  var import_chunk_UTJGRVMG = require("./chunk-UTJGRVMG.js");
60
- var import_chunk_XLTQGAI2 = require("./chunk-XLTQGAI2.js");
61
68
  var import_chunk_5V36RLCO = require("./chunk-5V36RLCO.js");
69
+ var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
62
70
  var import_chunk_AZV6HVKA = require("./chunk-AZV6HVKA.js");
71
+ var import_chunk_XLTQGAI2 = require("./chunk-XLTQGAI2.js");
63
72
  var import_chunk_HAGJ64PM = require("./chunk-HAGJ64PM.js");
64
73
  var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
65
- var import_chunk_VEXYKK6K = require("./chunk-VEXYKK6K.js");
66
- var import_chunk_UKGGGBT7 = require("./chunk-UKGGGBT7.js");
67
- var import_chunk_TURIBUFP = require("./chunk-TURIBUFP.js");
68
- var import_chunk_Z5PI6LVB = require("./chunk-Z5PI6LVB.js");
69
- var import_chunk_62PNTFVL = require("./chunk-62PNTFVL.js");
74
+ var import_chunk_J77ZIDXB = require("./chunk-J77ZIDXB.js");
75
+ var import_chunk_OUQPIJFQ = require("./chunk-OUQPIJFQ.js");
76
+ var import_chunk_GV244NDE = require("./chunk-GV244NDE.js");
77
+ var import_chunk_FAPPXX7W = require("./chunk-FAPPXX7W.js");
78
+ var import_chunk_LWBLVV7Y = require("./chunk-LWBLVV7Y.js");
79
+ var import_chunk_SNSJWJTA = require("./chunk-SNSJWJTA.js");
70
80
  var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
71
81
  var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
72
- var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
73
82
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
74
- var import_chunk_BPDMLM32 = require("./chunk-BPDMLM32.js");
83
+ var import_chunk_DYVL6P7F = require("./chunk-DYVL6P7F.js");
75
84
  var import_chunk_IOIAK7V7 = require("./chunk-IOIAK7V7.js");
76
- var import_chunk_MJIP3FY5 = require("./chunk-MJIP3FY5.js");
85
+ var import_chunk_K5W6WZ6E = require("./chunk-K5W6WZ6E.js");
86
+ var import_chunk_VVPSLVOR = require("./chunk-VVPSLVOR.js");
77
87
  var import_chunk_ZJWZK45Z = require("./chunk-ZJWZK45Z.js");
78
88
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
79
89
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
@@ -91,20 +101,26 @@ var import_fetch_engine = require("@prisma/fetch-engine");
91
101
  var import_get_platform = require("@prisma/get-platform");
92
102
  var import_path3 = __toESM2(require("path"));
93
103
  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"));
94
110
  var import_node_path = __toESM2(require("node:path"));
95
111
  var import_node_process = __toESM2(require("node:process"));
96
112
  var import_node_path2 = __toESM2(require("node:path"));
97
113
  var import_node_fs = __toESM2(require("node:fs"));
98
114
  var import_node_url = require("node:url");
99
115
  var import_node_fs2 = __toESM2(require("node:fs"));
100
- var import_fs2 = __toESM2(require("fs"));
101
- var import_path4 = __toESM2(require("path"));
116
+ var import_fs4 = __toESM2(require("fs"));
117
+ var import_path6 = __toESM2(require("path"));
102
118
  var import_get_platform2 = require("@prisma/get-platform");
103
119
  var debug = (0, import_debug2.default)("prisma:format");
104
120
  async function formatSchema({ schemas }, inputFormattingOptions) {
105
121
  if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
106
122
  handleFormatPanic(() => {
107
- import_chunk_62PNTFVL.prismaSchemaWasm.debug_panic();
123
+ import_chunk_SNSJWJTA.prismaSchemaWasm.debug_panic();
108
124
  });
109
125
  }
110
126
  const defaultFormattingOptions = {
@@ -121,10 +137,10 @@ async function formatSchema({ schemas }, inputFormattingOptions) {
121
137
  const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(() => {
122
138
  const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
123
139
  const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
124
- const lintDiagnostics2 = (0, import_chunk_UKGGGBT7.lintSchema)({ schemas: formattedMultipleSchemas2 });
140
+ const lintDiagnostics2 = (0, import_chunk_OUQPIJFQ.lintSchema)({ schemas: formattedMultipleSchemas2 });
125
141
  return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
126
142
  });
127
- const lintWarnings = (0, import_chunk_UKGGGBT7.getLintWarningsAsText)(lintDiagnostics);
143
+ const lintWarnings = (0, import_chunk_OUQPIJFQ.getLintWarningsAsText)(lintDiagnostics);
128
144
  if (lintWarnings && import_chunk_ZJWZK45Z.logger_exports.should.warn()) {
129
145
  console.warn(lintWarnings);
130
146
  }
@@ -151,7 +167,7 @@ function handleFormatPanic(tryCb) {
151
167
  }
152
168
  }
153
169
  function formatWasm(schema, documentFormattingParams) {
154
- const formattedSchema = import_chunk_62PNTFVL.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
170
+ const formattedSchema = import_chunk_SNSJWJTA.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
155
171
  return formattedSchema;
156
172
  }
157
173
  var readFile = (0, import_util.promisify)(import_fs.default.readFile);
@@ -195,7 +211,7 @@ async function readSchemaFromDirectory(schemaPath2) {
195
211
  }
196
212
  const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
197
213
  debug2("Loading config");
198
- const config = await (0, import_chunk_Z5PI6LVB.getConfig)({
214
+ const config = await (0, import_chunk_FAPPXX7W.getConfig)({
199
215
  datamodel: files,
200
216
  ignoreEnvVarErrors: true
201
217
  });
@@ -287,7 +303,7 @@ function renderDefaultLookupError(error, cwd) {
287
303
  return parts.join("\n");
288
304
  }
289
305
  async function getPrismaConfigFromPackageJson(cwd) {
290
- const pkgJson = await (0, import_chunk_MJIP3FY5.readPackageUp)({ cwd, normalize: false });
306
+ const pkgJson = await (0, import_chunk_K5W6WZ6E.readPackageUp)({ cwd, normalize: false });
291
307
  const prismaPropertyFromPkgJson = pkgJson?.packageJson?.prisma;
292
308
  if (!pkgJson) {
293
309
  return null;
@@ -346,11 +362,11 @@ async function getSchemaFromPackageJson(cwd) {
346
362
  }
347
363
  async function getDefaultSchema(cwd, failures = []) {
348
364
  const lookupPaths = [import_path.default.join(cwd, "schema.prisma"), import_path.default.join(cwd, "prisma", "schema.prisma")];
349
- for (const path7 of lookupPaths) {
350
- debug2(`Checking existence of ${path7}`);
351
- const schema = await readSchemaFromSingleFile(path7);
365
+ for (const path9 of lookupPaths) {
366
+ debug2(`Checking existence of ${path9}`);
367
+ const schema = await readSchemaFromSingleFile(path9);
352
368
  if (!schema.ok) {
353
- failures.push({ path: path7, error: schema.error });
369
+ failures.push({ path: path9, error: schema.error });
354
370
  continue;
355
371
  }
356
372
  return schema;
@@ -405,7 +421,7 @@ async function processSchemaResult({
405
421
  if (printLoadMessage) {
406
422
  printSchemaLoadedMessage(loadedFromPathForLogMessages);
407
423
  }
408
- const configFromPsl = await (0, import_chunk_Z5PI6LVB.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
424
+ const configFromPsl = await (0, import_chunk_FAPPXX7W.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
409
425
  const primaryDatasource = configFromPsl.datasources.at(0);
410
426
  const schemaRootDir = schemaResult.schemaRootDir || cwd;
411
427
  return {
@@ -427,25 +443,117 @@ function primaryDatasourceDirectory(primaryDatasource) {
427
443
  }
428
444
  return null;
429
445
  }
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
- ])
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}.`
443
538
  );
444
539
  }
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) {
445
551
  const {
446
552
  schemaPath,
447
- registry,
553
+ providerAliases: aliases,
554
+ // do you get the pun?
448
555
  version,
556
+ cliVersion,
449
557
  printDownloadProgress,
450
558
  overrideGenerators,
451
559
  skipDownload,
@@ -483,7 +591,7 @@ async function getGenerators(options) {
483
591
  }
484
592
  (0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
485
593
  const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
486
- const dmmf = await (0, import_chunk_VEXYKK6K.getDMMF)({
594
+ const dmmf = await (0, import_chunk_LWBLVV7Y.getDMMF)({
487
595
  datamodel: schemaContext.schemaFiles,
488
596
  previewFeatures
489
597
  });
@@ -499,34 +607,41 @@ async function getGenerators(options) {
499
607
  try {
500
608
  const generators = await (0, import_p_map.default)(
501
609
  generatorConfigs,
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();
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);
513
623
  await generatorInstance.init();
514
- if (generatorConfig.output) {
515
- generatorConfig.output = {
516
- value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generatorConfig.output)),
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,
517
633
  fromEnvVar: null
518
634
  };
519
- generatorConfig.isCustomOutput = true;
520
635
  } else {
521
- if (!generatorInstance.manifest?.defaultOutput) {
636
+ if (!generatorInstance.manifest || !generatorInstance.manifest.defaultOutput) {
522
637
  throw new Error(
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
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
525
640
  )}.
526
- You need to define \`output\` in the generator block in the schema file.`
641
+ The generator needs to either define the \`defaultOutput\` path in the manifest or you need to define \`output\` in the datamodel.prisma file.`
527
642
  );
528
643
  }
529
- generatorConfig.output = {
644
+ generator.output = {
530
645
  value: await (0, import_chunk_2B26F5N3.resolveOutput)({
531
646
  defaultOutput: generatorInstance.manifest.defaultOutput,
532
647
  baseDir
@@ -534,12 +649,12 @@ You need to define \`output\` in the generator block in the schema file.`
534
649
  fromEnvVar: null
535
650
  };
536
651
  }
537
- const datamodel = (0, import_chunk_TURIBUFP.mergeSchemas)({ schemas: schemaContext.schemaFiles });
538
- const envPaths = await getEnvPaths(schemaContext.schemaPath, { cwd: generatorConfig.output.value });
652
+ const datamodel = (0, import_chunk_GV244NDE.mergeSchemas)({ schemas: schemaContext.schemaFiles });
653
+ const envPaths = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
539
654
  const options2 = {
540
655
  datamodel,
541
656
  datasources: schemaContext.datasources,
542
- generator: generatorConfig,
657
+ generator,
543
658
  dmmf,
544
659
  otherGenerators: skipIndex(generatorConfigs, index),
545
660
  schemaPath: schemaContext.schemaPath,
@@ -601,7 +716,7 @@ generator gen {
601
716
  }
602
717
  }
603
718
  }
604
- debug3("neededVersions", JSON.stringify(neededVersions, null, 2));
719
+ debug5("neededVersions", JSON.stringify(neededVersions, null, 2));
605
720
  const binaryPathsByVersion = await (0, import_chunk_EPXBOIA5.getBinaryPathsByVersion)({
606
721
  neededVersions,
607
722
  binaryTarget,
@@ -615,17 +730,17 @@ generator gen {
615
730
  const engineVersion = (0, import_chunk_X3P4J7WW.getEngineVersionForGenerator)(generator.manifest, version);
616
731
  const binaryPaths = binaryPathsByVersion[engineVersion];
617
732
  const generatorBinaryPaths = (0, import_chunk_5V36RLCO.pick)(binaryPaths, generator.manifest.requiresEngines);
618
- debug3({ generatorBinaryPaths });
733
+ debug5({ generatorBinaryPaths });
619
734
  generator.setBinaryPaths(generatorBinaryPaths);
620
735
  if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
621
- const customDmmf = await (0, import_chunk_VEXYKK6K.getDMMF)({
736
+ const customDmmf = await (0, import_chunk_LWBLVV7Y.getDMMF)({
622
737
  datamodel: schemaContext.schemaFiles,
623
738
  previewFeatures
624
739
  });
625
740
  const options2 = { ...generator.options, dmmf: customDmmf };
626
- debug3("generator.manifest.prettyName", generator.manifest.prettyName);
627
- debug3("options", options2);
628
- debug3("options.generator.binaryTargets", options2.generator.binaryTargets);
741
+ debug5("generator.manifest.prettyName", generator.manifest.prettyName);
742
+ debug5("options", options2);
743
+ debug5("options.generator.binaryTargets", options2.generator.binaryTargets);
629
744
  generator.setOptions(options2);
630
745
  }
631
746
  }
@@ -757,9 +872,9 @@ function locatePathSync(paths, {
757
872
  }
758
873
  }
759
874
  }
760
- function pathExistsSync(path7) {
875
+ function pathExistsSync(path9) {
761
876
  try {
762
- import_node_fs2.default.accessSync(path7);
877
+ import_node_fs2.default.accessSync(path9);
763
878
  return true;
764
879
  } catch {
765
880
  return false;
@@ -767,9 +882,9 @@ function pathExistsSync(path7) {
767
882
  }
768
883
  var findUpStop = Symbol("findUpStop");
769
884
  function findUpMultipleSync(name, options2 = {}) {
770
- let directory = import_node_path.default.resolve((0, import_chunk_MJIP3FY5.toPath)(options2.cwd) ?? "");
885
+ let directory = import_node_path.default.resolve((0, import_chunk_K5W6WZ6E.toPath)(options2.cwd) ?? "");
771
886
  const { root } = import_node_path.default.parse(directory);
772
- const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_MJIP3FY5.toPath)(options2.stopAt) ?? root);
887
+ const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_K5W6WZ6E.toPath)(options2.stopAt) ?? root);
773
888
  const limit = options2.limit ?? Number.POSITIVE_INFINITY;
774
889
  const paths = [name].flat();
775
890
  const runMatcher = (locateOptions) => {
@@ -802,7 +917,7 @@ function findUpSync(name, options2 = {}) {
802
917
  const matches = findUpMultipleSync(name, { ...options2, limit: 1 });
803
918
  return matches[0];
804
919
  }
805
- var debug4 = (0, import_debug4.default)("prisma:loadEnv");
920
+ var debug6 = (0, import_debug6.default)("prisma:loadEnv");
806
921
  async function getEnvPaths(schemaPath2, opts = { cwd: process.cwd() }) {
807
922
  const rootEnvPath = getProjectRootEnvPath({ cwd: opts.cwd }) ?? null;
808
923
  const schemaEnvPathFromArgs = schemaPathToEnvPath(schemaPath2);
@@ -833,16 +948,16 @@ async function readSchemaPathFromPkgJson() {
833
948
  }
834
949
  function getProjectRootEnvPath(opts) {
835
950
  const pkgJsonPath = findUpSync((dir) => {
836
- const pkgPath = import_path4.default.join(dir, "package.json");
951
+ const pkgPath = import_path6.default.join(dir, "package.json");
837
952
  if (pathExistsSync(pkgPath)) {
838
953
  try {
839
- const pkg = JSON.parse(import_fs2.default.readFileSync(pkgPath, "utf8"));
954
+ const pkg = JSON.parse(import_fs4.default.readFileSync(pkgPath, "utf8"));
840
955
  if (pkg["name"] !== ".prisma/client") {
841
- debug4(`project root found at ${pkgPath}`);
956
+ debug6(`project root found at ${pkgPath}`);
842
957
  return pkgPath;
843
958
  }
844
959
  } catch (e) {
845
- debug4(`skipping package.json at ${pkgPath}`);
960
+ debug6(`skipping package.json at ${pkgPath}`);
846
961
  }
847
962
  }
848
963
  return void 0;
@@ -850,15 +965,15 @@ function getProjectRootEnvPath(opts) {
850
965
  if (!pkgJsonPath) {
851
966
  return null;
852
967
  }
853
- const candidate = import_path4.default.join(import_path4.default.dirname(pkgJsonPath), ".env");
854
- if (!import_fs2.default.existsSync(candidate)) {
968
+ const candidate = import_path6.default.join(import_path6.default.dirname(pkgJsonPath), ".env");
969
+ if (!import_fs4.default.existsSync(candidate)) {
855
970
  return null;
856
971
  }
857
972
  return candidate;
858
973
  }
859
974
  function schemaPathToEnvPath(schemaPath2) {
860
975
  if (!schemaPath2) return null;
861
- return import_path4.default.join(import_path4.default.dirname(schemaPath2), ".env");
976
+ return import_path6.default.join(import_path6.default.dirname(schemaPath2), ".env");
862
977
  }
863
978
  async function loadEnvFile({
864
979
  schemaPath: schemaPath2,
@@ -893,7 +1008,7 @@ function checkUnsupportedDataProxy({
893
1008
  }
894
1009
  }
895
1010
  if (!schemaContext2?.primaryDatasource) return;
896
- const url = (0, import_chunk_Z5PI6LVB.resolveUrl)((0, import_chunk_Z5PI6LVB.getEffectiveUrl)(schemaContext2.primaryDatasource));
1011
+ const url = (0, import_chunk_FAPPXX7W.resolveUrl)((0, import_chunk_FAPPXX7W.getEffectiveUrl)(schemaContext2.primaryDatasource));
897
1012
  if (url?.startsWith("prisma://")) {
898
1013
  throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
899
1014
  }
@@ -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_RTT3E5AL_exports = {};
20
- __export(chunk_RTT3E5AL_exports, {
19
+ var chunk_ZQEXNNVO_exports = {};
20
+ __export(chunk_ZQEXNNVO_exports, {
21
21
  addVersionDetailsToErrorMessage: () => addVersionDetailsToErrorMessage
22
22
  });
23
- module.exports = __toCommonJS(chunk_RTT3E5AL_exports);
24
- var import_chunk_LVXOY25I = require("./chunk-LVXOY25I.js");
23
+ module.exports = __toCommonJS(chunk_ZQEXNNVO_exports);
24
+ var import_chunk_46FA36ZM = require("./chunk-46FA36ZM.js");
25
25
  var import_chunk_QN6PSQY7 = require("./chunk-QN6PSQY7.js");
26
26
  function addVersionDetailsToErrorMessage(message) {
27
- const rows = [["Prisma CLI Version", import_chunk_LVXOY25I.version]];
27
+ const rows = [["Prisma CLI Version", import_chunk_46FA36ZM.version]];
28
28
  return `${message}
29
29
 
30
30
  ${(0, import_chunk_QN6PSQY7.formatTable)(rows)}`;