@prisma/internals 5.19.0-dev.13 → 5.19.0-dev.15

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 (72) hide show
  1. package/dist/{chunk-WO5ENZU5.js → chunk-2MWIMEFK.js} +7 -7
  2. package/dist/{chunk-QQJZI2CR.js → chunk-3BGFTG6S.js} +8 -8
  3. package/dist/{chunk-CYKOCRN3.js → chunk-3BPQHI4U.js} +7 -7
  4. package/dist/{chunk-KBVBWTBF.js → chunk-3PGKH52K.js} +8 -8
  5. package/dist/{chunk-G4BGJ6IP.js → chunk-4RWCRJYD.js} +5 -5
  6. package/dist/{chunk-D3G3WRZU.js → chunk-5LEVB4CZ.js} +5 -5
  7. package/dist/{chunk-YIJ776AZ.js → chunk-7EYXPHZ4.js} +47 -45
  8. package/dist/{chunk-JPEBIQUM.js → chunk-7VJ4E7IJ.js} +823 -50
  9. package/dist/{chunk-NK2ML3NJ.js → chunk-BATANHVC.js} +5 -5
  10. package/dist/{chunk-OEXSUUW2.js → chunk-BGFWFIPR.js} +5 -5
  11. package/dist/{chunk-IY43XBPH.js → chunk-BVQBWOXN.js} +8 -8
  12. package/dist/{chunk-IB5PDCFO.js → chunk-E56I7IH3.js} +5 -5
  13. package/dist/chunk-FHXAG4A2.js +29 -0
  14. package/dist/{chunk-7SPHTPDV.js → chunk-FPHZVRV4.js} +4 -4
  15. package/dist/{chunk-TZ2WAB57.js → chunk-G456GF4D.js} +8 -8
  16. package/dist/{chunk-244YD7SK.js → chunk-G7LL2H2O.js} +5 -5
  17. package/dist/{chunk-EBLDSWRI.js → chunk-J3JE5NVO.js} +14 -178
  18. package/dist/{chunk-NDEGWMVS.js → chunk-JMZHUHCC.js} +7 -7
  19. package/dist/{chunk-CNKDIKWK.js → chunk-JUYCPLGZ.js} +8 -8
  20. package/dist/{chunk-IJUVQMZY.js → chunk-L7365XMK.js} +5 -5
  21. package/dist/{chunk-KK64NLNR.js → chunk-NACVCIVP.js} +5 -5
  22. package/dist/{chunk-DQMYNBP3.js → chunk-RM7X45II.js} +5 -5
  23. package/dist/{chunk-7KXMQZFT.js → chunk-RME2Y7TQ.js} +5 -5
  24. package/dist/chunk-T5RACBRF.js +189 -0
  25. package/dist/{chunk-VNIE2AZB.js → chunk-TQCLUNM2.js} +4 -4
  26. package/dist/{chunk-42K3GPYJ.js → chunk-TWPJ7ZJ2.js} +7 -4
  27. package/dist/{chunk-34FTC6KK.js → chunk-UJN33GSS.js} +5 -5
  28. package/dist/{chunk-I3YDYYM2.js → chunk-VYSSB3YM.js} +7 -7
  29. package/dist/{chunk-6GTQHWWT.js → chunk-YSOLUZHL.js} +8 -5
  30. package/dist/{chunk-XKRUNUS5.js → chunk-ZWQVHKXW.js} +8 -8
  31. package/dist/cli/checkUnsupportedDataProxy.js +28 -26
  32. package/dist/cli/getSchema.js +33 -31
  33. package/dist/cli/hashes.js +28 -26
  34. package/dist/engine-commands/errorHelpers.js +4 -4
  35. package/dist/engine-commands/formatSchema.js +27 -25
  36. package/dist/engine-commands/getConfig.js +10 -10
  37. package/dist/engine-commands/getDmmf.js +7 -7
  38. package/dist/engine-commands/getEngineVersion.js +5 -5
  39. package/dist/engine-commands/getEnginesMetaInfo.js +7 -7
  40. package/dist/engine-commands/index.js +38 -36
  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.js +27 -25
  45. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +27 -25
  46. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +27 -25
  47. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +28 -26
  48. package/dist/get-generators/getGenerators.d.ts +2 -1
  49. package/dist/get-generators/getGenerators.js +30 -28
  50. package/dist/getPackedPackage.js +3 -2
  51. package/dist/highlight/highlight.js +5 -5
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.js +70 -67
  54. package/dist/resolveBinary.js +7 -7
  55. package/dist/schemaEngineCommands.js +8 -8
  56. package/dist/sendPanic.js +27 -25
  57. package/dist/utils/getEnvPaths.js +27 -25
  58. package/dist/utils/getVersionFromPackageJson.js +3 -3
  59. package/dist/utils/handlePanic.js +27 -25
  60. package/dist/utils/isValidJsIdentifier.d.ts +1 -0
  61. package/dist/utils/isValidJsIdentifier.js +26 -0
  62. package/dist/utils/loadEnvFile.js +27 -25
  63. package/dist/utils/missingDatasource.js +4 -4
  64. package/dist/utils/missingGeneratorMessage.js +6 -6
  65. package/dist/wasm.js +4 -4
  66. package/package.json +11 -8
  67. package/dist/chunk-5XRQ7ONW.js +0 -122
  68. package/dist/chunk-HD4N22SB.js +0 -177
  69. package/dist/chunk-NXIWDQBF.js +0 -110
  70. package/dist/chunk-QIVUAERL.js +0 -2202
  71. package/dist/chunk-X4GRUQLB.js +0 -166
  72. package/dist/chunk-X6M256IK.js +0 -54
@@ -1,166 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_X4GRUQLB_exports = {};
20
- __export(chunk_X4GRUQLB_exports, {
21
- SchemaEngineExitCode: () => SchemaEngineExitCode,
22
- canConnectToDatabase: () => canConnectToDatabase,
23
- createDatabase: () => createDatabase,
24
- dropDatabase: () => dropDatabase,
25
- execaCommand: () => execaCommand
26
- });
27
- module.exports = __toCommonJS(chunk_X4GRUQLB_exports);
28
- var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
29
- var import_chunk_7SPHTPDV = require("./chunk-7SPHTPDV.js");
30
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
31
- var import_fetch_engine = require("@prisma/fetch-engine");
32
- var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
33
- var SchemaEngineExitCode = /* @__PURE__ */ ((SchemaEngineExitCode2) => {
34
- SchemaEngineExitCode2[SchemaEngineExitCode2["Success"] = 0] = "Success";
35
- SchemaEngineExitCode2[SchemaEngineExitCode2["Error"] = 1] = "Error";
36
- SchemaEngineExitCode2[SchemaEngineExitCode2["Panic"] = 101] = "Panic";
37
- return SchemaEngineExitCode2;
38
- })(SchemaEngineExitCode || {});
39
- function parseJsonFromStderr(stderr) {
40
- const lines = stderr.split(/\r?\n/).slice(1);
41
- const logs = [];
42
- for (const line of lines) {
43
- const data = String(line);
44
- try {
45
- const json = JSON.parse(data);
46
- logs.push(json);
47
- } catch (e) {
48
- throw new Error(`Could not parse schema engine response: ${e}`);
49
- }
50
- }
51
- return logs;
52
- }
53
- async function canConnectToDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
54
- if (!connectionString) {
55
- throw new Error(
56
- "Connection url is empty. See https://www.prisma.io/docs/reference/database-reference/connection-urls"
57
- );
58
- }
59
- try {
60
- await execaCommand({
61
- connectionString,
62
- cwd,
63
- schemaEnginePath,
64
- engineCommandName: "can-connect-to-database"
65
- });
66
- } catch (_e) {
67
- const e = _e;
68
- if (e.stderr) {
69
- const logs = parseJsonFromStderr(e.stderr);
70
- const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
71
- if (error && error.fields.error_code && error.fields.message) {
72
- return {
73
- code: error.fields.error_code,
74
- message: error.fields.message
75
- };
76
- } else {
77
- throw new Error(`Schema engine error:
78
- ${logs.map((log) => log.fields.message).join("\n")}`);
79
- }
80
- } else {
81
- throw new Error(`Schema engine exited. ${_e}`);
82
- }
83
- }
84
- return true;
85
- }
86
- async function createDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
87
- const dbExists = await canConnectToDatabase(connectionString, cwd, schemaEnginePath);
88
- if (dbExists === true) {
89
- return false;
90
- }
91
- try {
92
- await execaCommand({
93
- connectionString,
94
- cwd,
95
- schemaEnginePath,
96
- engineCommandName: "create-database"
97
- });
98
- return true;
99
- } catch (_e) {
100
- const e = _e;
101
- if (e.stderr) {
102
- const logs = parseJsonFromStderr(e.stderr);
103
- const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
104
- if (error && error.fields.error_code && error.fields.message) {
105
- throw new Error(`${error.fields.error_code}: ${error.fields.message}`);
106
- } else {
107
- throw new Error(`Schema engine error:
108
- ${logs.map((log) => log.fields.message).join("\n")}`);
109
- }
110
- } else {
111
- throw new Error(`Schema engine exited. ${_e}`);
112
- }
113
- }
114
- }
115
- async function dropDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
116
- try {
117
- const result = await execaCommand({
118
- connectionString,
119
- cwd,
120
- schemaEnginePath,
121
- engineCommandName: "drop-database"
122
- });
123
- if (result && result.exitCode === 0 && result.stderr.includes("The database was successfully dropped")) {
124
- return true;
125
- } else {
126
- throw Error(`An error occurred during the drop: ${JSON.stringify(result, void 0, 2)}`);
127
- }
128
- } catch (e) {
129
- if (e.stderr) {
130
- const logs = parseJsonFromStderr(e.stderr);
131
- throw new Error(`Schema engine error:
132
- ${logs.map((log) => log.fields.message).join("\n")}`);
133
- } else {
134
- throw new Error(`Schema engine exited. ${e}`);
135
- }
136
- }
137
- }
138
- async function execaCommand({
139
- connectionString,
140
- cwd,
141
- schemaEnginePath,
142
- engineCommandName
143
- }) {
144
- schemaEnginePath = schemaEnginePath || await (0, import_chunk_7SPHTPDV.resolveBinary)(import_fetch_engine.BinaryType.SchemaEngineBinary);
145
- try {
146
- return await (0, import_execa.default)(schemaEnginePath, ["cli", "--datasource", connectionString, engineCommandName], {
147
- cwd,
148
- env: {
149
- RUST_BACKTRACE: process.env.RUST_BACKTRACE ?? "1",
150
- RUST_LOG: process.env.RUST_LOG ?? "info"
151
- }
152
- });
153
- } catch (_e) {
154
- const e = _e;
155
- if (e.message) {
156
- e.message = e.message.replace(connectionString, "<REDACTED>");
157
- }
158
- if (e.stdout) {
159
- e.stdout = e.stdout.replace(connectionString, "<REDACTED>");
160
- }
161
- if (e.stderr) {
162
- e.stderr = e.stderr.replace(connectionString, "<REDACTED>");
163
- }
164
- throw e;
165
- }
166
- }
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_X6M256IK_exports = {};
20
- __export(chunk_X6M256IK_exports, {
21
- getEngineVersion: () => getEngineVersion,
22
- safeGetEngineVersion: () => safeGetEngineVersion
23
- });
24
- module.exports = __toCommonJS(chunk_X6M256IK_exports);
25
- var import_chunk_S4LINK5Y = require("./chunk-S4LINK5Y.js");
26
- var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
27
- var import_chunk_NXIWDQBF = require("./chunk-NXIWDQBF.js");
28
- var import_chunk_7MD6344A = require("./chunk-7MD6344A.js");
29
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
30
- var import_engines = require("@prisma/engines");
31
- var import_fetch_engine = require("@prisma/fetch-engine");
32
- var import_get_platform = require("@prisma/get-platform");
33
- var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
34
- async function getEngineVersion(enginePath, binaryName) {
35
- if (!binaryName) {
36
- binaryName = (0, import_engines.getCliQueryEngineBinaryType)();
37
- }
38
- enginePath = await (0, import_chunk_NXIWDQBF.resolveBinary)(binaryName, enginePath);
39
- const platformInfo = await (0, import_get_platform.getPlatformInfo)();
40
- if (binaryName === import_fetch_engine.BinaryType.QueryEngineLibrary) {
41
- (0, import_get_platform.assertNodeAPISupported)();
42
- const QE = (0, import_chunk_S4LINK5Y.loadLibrary)(enginePath, platformInfo);
43
- return `${import_fetch_engine.BinaryType.QueryEngineLibrary} ${QE.version().commit}`;
44
- } else {
45
- const { stdout } = await (0, import_execa.default)(enginePath, ["--version"]);
46
- return stdout;
47
- }
48
- }
49
- function safeGetEngineVersion(enginePath, binaryName) {
50
- return (0, import_chunk_7MD6344A.tryCatch2)(
51
- () => getEngineVersion(enginePath, binaryName),
52
- (error) => error
53
- );
54
- }