@prisma/internals 7.7.0-dev.1 → 7.7.0-dev.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 (47) hide show
  1. package/dist/{chunk-KAFC7IGG.js → chunk-2HPKSKDE.js} +5 -5
  2. package/dist/{chunk-TMOVLDY3.js → chunk-57ZFKPEC.js} +8 -8
  3. package/dist/{chunk-AOVYEIA4.js → chunk-AYKHFUHB.js} +5 -5
  4. package/dist/{chunk-DECRNQAX.js → chunk-E644FVCY.js} +8 -8
  5. package/dist/{chunk-FLEBZERR.js → chunk-ELUS2FGF.js} +5 -4
  6. package/dist/{chunk-YHPLOIZP.js → chunk-FIDYCH4Q.js} +5 -5
  7. package/dist/chunk-H5RJM5KP.js +104 -0
  8. package/dist/{chunk-327ITEMP.js → chunk-IN7DJEWK.js} +7 -7
  9. package/dist/chunk-IVPOBWVG.js +104 -0
  10. package/dist/{chunk-55UUDRJ3.js → chunk-M32TYUAI.js} +5 -5
  11. package/dist/{chunk-FUDRGWAF.js → chunk-NWDOSRX2.js} +4 -3
  12. package/dist/{chunk-D27PKXGJ.js → chunk-OBFJDH7C.js} +8 -8
  13. package/dist/{chunk-OMJOKO7H.js → chunk-SZ735VHI.js} +5 -5
  14. package/dist/{chunk-OCIOQHKS.js → chunk-UINW4OZY.js} +5 -5
  15. package/dist/{chunk-LDN2T2EE.js → chunk-USHXVHZH.js} +7 -7
  16. package/dist/{chunk-DTWLDI62.js → chunk-VL7TE7XG.js} +5 -5
  17. package/dist/{chunk-6JKAPABH.js → chunk-VPHYIISP.js} +5 -5
  18. package/dist/{chunk-6S76OKUD.js → chunk-WJPDCCIW.js} +8 -8
  19. package/dist/{chunk-MIBKSCPH.js → chunk-XV2QLA4M.js} +15 -20
  20. package/dist/{chunk-VAD6ZZ6O.js → chunk-ZI7BX3VK.js} +15 -20
  21. package/dist/cli/checkUnsupportedDataProxy.js +12 -12
  22. package/dist/cli/schemaContext.js +13 -13
  23. package/dist/engine-commands/errorHelpers.js +4 -4
  24. package/dist/engine-commands/formatSchema.d.ts +1 -1
  25. package/dist/engine-commands/formatSchema.js +11 -11
  26. package/dist/engine-commands/getConfig.d.ts +1 -1
  27. package/dist/engine-commands/getConfig.js +7 -7
  28. package/dist/engine-commands/getDmmf.d.ts +3 -2
  29. package/dist/engine-commands/getDmmf.js +9 -8
  30. package/dist/engine-commands/index.d.ts +1 -1
  31. package/dist/engine-commands/index.js +20 -18
  32. package/dist/engine-commands/lintSchema.d.ts +1 -1
  33. package/dist/engine-commands/lintSchema.js +8 -8
  34. package/dist/engine-commands/mergeSchemas.d.ts +1 -1
  35. package/dist/engine-commands/mergeSchemas.js +7 -7
  36. package/dist/engine-commands/validate.d.ts +1 -1
  37. package/dist/engine-commands/validate.js +7 -7
  38. package/dist/get-generators/getGenerators.js +14 -14
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.js +29 -27
  41. package/dist/utils/getVersionFromPackageJson.js +3 -3
  42. package/dist/utils/schemaFileInput.d.ts +1 -4
  43. package/dist/utils/toSchemasContainer.d.ts +1 -1
  44. package/dist/wasm.js +5 -5
  45. package/package.json +12 -11
  46. package/dist/chunk-3SIYV325.js +0 -193
  47. package/dist/chunk-OPOVQ5PN.js +0 -193
@@ -1,193 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_3SIYV325_exports = {};
30
- __export(chunk_3SIYV325_exports, {
31
- GetDmmfError: () => GetDmmfError,
32
- getDMMF: () => getDMMF
33
- });
34
- module.exports = __toCommonJS(chunk_3SIYV325_exports);
35
- var import_chunk_WSZXPLJQ = require("./chunk-WSZXPLJQ.js");
36
- var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
37
- var import_chunk_OCIOQHKS = require("./chunk-OCIOQHKS.js");
38
- var import_chunk_AOVYEIA4 = require("./chunk-AOVYEIA4.js");
39
- var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
40
- var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
41
- var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
42
- var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
43
- var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
44
- var import_debug = __toESM(require("@prisma/debug"));
45
- var import_json = require("@streamparser/json");
46
- var import_function = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R6QH57HZ.require_function)());
47
- var debug = (0, import_debug.default)("prisma:getDMMF");
48
- var debugErrorType = (0, import_chunk_WSZXPLJQ.createDebugErrorType)(debug, "getDmmfWasm");
49
- var GetDmmfError = class extends Error {
50
- constructor(params) {
51
- const constructedErrorMessage = (0, import_chunk_XKZ6CBLA.z)(params).with({ _tag: "parsed" }, ({ errorCode, message, reason }) => {
52
- const errorCodeMessage = errorCode ? `Error code: ${errorCode}` : "";
53
- return `${reason}
54
- ${errorCodeMessage}
55
- ${message}`;
56
- }).with({ _tag: "unparsed" }, ({ message, reason }) => {
57
- const detailsHeader = (0, import_chunk_PG5FDKSF.red)((0, import_chunk_PG5FDKSF.bold)("Details:"));
58
- return `${reason}
59
- ${detailsHeader} ${message}`;
60
- }).exhaustive();
61
- const errorMessageWithContext = `${constructedErrorMessage}
62
- [Context: getDmmf]`;
63
- super((0, import_chunk_OCIOQHKS.addVersionDetailsToErrorMessage)(errorMessageWithContext));
64
- this.name = "GetDmmfError";
65
- }
66
- };
67
- function isV8StringLimitError(error) {
68
- return error instanceof Error && "code" in error && error.code === "ERR_STRING_TOO_LONG";
69
- }
70
- function getDMMFBuffered(params) {
71
- const CHUNK_SIZE = 16 * 1024 * 1024;
72
- if (typeof import_chunk_AOVYEIA4.prismaSchemaWasm.get_dmmf_buffered !== "function") {
73
- throw new Error(
74
- "Buffered DMMF API not available. It's required for schemas that do not fit within the default V8 memory limit. Ensure you are using latest @prisma/prisma-schema-wasm."
75
- );
76
- }
77
- const buffer = import_chunk_AOVYEIA4.prismaSchemaWasm.get_dmmf_buffered(params);
78
- try {
79
- const totalBytes = buffer.len();
80
- debug(`DMMF buffered: ${totalBytes} bytes (${(totalBytes / 1024 / 1024).toFixed(1)}MB)`);
81
- const parser = new import_json.JSONParser();
82
- let result;
83
- parser.onValue = ({ value, stack }) => {
84
- if (stack.length === 0 && value !== void 0) {
85
- result = value;
86
- }
87
- };
88
- let offset = 0;
89
- while (offset < totalBytes) {
90
- const len = Math.min(CHUNK_SIZE, totalBytes - offset);
91
- const chunk = buffer.read_chunk(offset, len);
92
- parser.write(chunk);
93
- offset += len;
94
- }
95
- if (result === void 0) {
96
- throw new Error("Streaming JSON parse produced no result");
97
- }
98
- debug(`DMMF parsed via streaming parser (${(totalBytes / 1024 / 1024).toFixed(1)}MB)`);
99
- return result;
100
- } finally {
101
- buffer.free();
102
- }
103
- }
104
- async function getDMMF(options) {
105
- debug(`Using getDmmf Wasm`);
106
- const params = JSON.stringify({
107
- prismaSchema: options.datamodel,
108
- noColor: Boolean(process.env.NO_COLOR)
109
- });
110
- const dmmfPipeline = (0, import_function.pipe)(
111
- (0, import_chunk_5DBOS77Y.tryCatch)(
112
- () => {
113
- if (process.env.FORCE_PANIC_GET_DMMF) {
114
- debug("Triggering a Rust panic...");
115
- import_chunk_AOVYEIA4.prismaSchemaWasm.debug_panic();
116
- }
117
- const data = import_chunk_AOVYEIA4.prismaSchemaWasm.get_dmmf(params);
118
- return data;
119
- },
120
- (e) => ({
121
- type: "wasm-error",
122
- reason: "(get-dmmf wasm)",
123
- error: e
124
- })
125
- ),
126
- (0, import_chunk_5DBOS77Y.map)((result) => ({ result })),
127
- (0, import_chunk_5DBOS77Y.chainW)(
128
- ({ result }) => (
129
- // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings
130
- (0, import_chunk_5DBOS77Y.tryCatch)(
131
- () => JSON.parse(result),
132
- (e) => ({
133
- type: "parse-json",
134
- reason: "Unable to parse JSON",
135
- error: e
136
- })
137
- )
138
- )
139
- ),
140
- import_chunk_5DBOS77Y.fromEither
141
- );
142
- const dmmfEither = await dmmfPipeline();
143
- if ((0, import_chunk_5DBOS77Y.isRight)(dmmfEither)) {
144
- debug("dmmf data retrieved without errors in getDmmf Wasm");
145
- const { right: data } = dmmfEither;
146
- return Promise.resolve(data);
147
- }
148
- const leftError = dmmfEither.left;
149
- if (leftError.type === "wasm-error" && isV8StringLimitError(leftError.error)) {
150
- debug("V8 string limit hit, falling back to buffered DMMF API");
151
- try {
152
- const data = getDMMFBuffered(params);
153
- debug("dmmf data retrieved via buffered API");
154
- return data;
155
- } catch (error2) {
156
- if (error2 instanceof Error) {
157
- debugErrorType({ type: "wasm-error", reason: "(get-dmmf-buffered wasm)", error: error2 });
158
- throw mapWasmPanicToGetDmmfError(error2, "(get-dmmf-buffered wasm)");
159
- }
160
- throw new GetDmmfError({
161
- _tag: "unparsed",
162
- message: `Unknown error during buffered DMMF retrieval: ${error2}`,
163
- reason: "(get-dmmf-buffered wasm)"
164
- });
165
- }
166
- }
167
- const error = (0, import_chunk_XKZ6CBLA.z)(dmmfEither.left).with({ type: "wasm-error" }, (e) => {
168
- debugErrorType(e);
169
- return mapWasmPanicToGetDmmfError(e.error, e.reason);
170
- }).with({ type: "parse-json" }, (e) => {
171
- debugErrorType(e);
172
- return new GetDmmfError({ _tag: "unparsed", message: e.error.message, reason: e.reason });
173
- }).exhaustive();
174
- throw error;
175
- }
176
- function mapWasmPanicToGetDmmfError(error, reason) {
177
- if ((0, import_chunk_LMVSIVKQ.isWasmPanic)(error)) {
178
- const { message, stack } = (0, import_chunk_LMVSIVKQ.getWasmError)(error);
179
- const panic = new import_chunk_LMVSIVKQ.RustPanic(
180
- /* message */
181
- message,
182
- /* rustStack */
183
- stack,
184
- /* request */
185
- "@prisma/prisma-schema-wasm get_dmmf",
186
- "FMT_CLI"
187
- /* FMT_CLI */
188
- );
189
- return panic;
190
- }
191
- const errorOutput = error.message;
192
- return new GetDmmfError((0, import_chunk_WSZXPLJQ.parseQueryEngineError)({ errorOutput, reason }));
193
- }
@@ -1,193 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_OPOVQ5PN_exports = {};
30
- __export(chunk_OPOVQ5PN_exports, {
31
- GetDmmfError: () => GetDmmfError,
32
- getDMMF: () => getDMMF
33
- });
34
- module.exports = __toCommonJS(chunk_OPOVQ5PN_exports);
35
- var import_chunk_WSZXPLJQ = require("./chunk-WSZXPLJQ.js");
36
- var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
37
- var import_chunk_DTWLDI62 = require("./chunk-DTWLDI62.js");
38
- var import_chunk_KAFC7IGG = require("./chunk-KAFC7IGG.js");
39
- var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
40
- var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
41
- var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
42
- var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
43
- var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
44
- var import_debug = __toESM(require("@prisma/debug"));
45
- var import_json = require("@streamparser/json");
46
- var import_function = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R6QH57HZ.require_function)());
47
- var debug = (0, import_debug.default)("prisma:getDMMF");
48
- var debugErrorType = (0, import_chunk_WSZXPLJQ.createDebugErrorType)(debug, "getDmmfWasm");
49
- var GetDmmfError = class extends Error {
50
- constructor(params) {
51
- const constructedErrorMessage = (0, import_chunk_XKZ6CBLA.z)(params).with({ _tag: "parsed" }, ({ errorCode, message, reason }) => {
52
- const errorCodeMessage = errorCode ? `Error code: ${errorCode}` : "";
53
- return `${reason}
54
- ${errorCodeMessage}
55
- ${message}`;
56
- }).with({ _tag: "unparsed" }, ({ message, reason }) => {
57
- const detailsHeader = (0, import_chunk_PG5FDKSF.red)((0, import_chunk_PG5FDKSF.bold)("Details:"));
58
- return `${reason}
59
- ${detailsHeader} ${message}`;
60
- }).exhaustive();
61
- const errorMessageWithContext = `${constructedErrorMessage}
62
- [Context: getDmmf]`;
63
- super((0, import_chunk_DTWLDI62.addVersionDetailsToErrorMessage)(errorMessageWithContext));
64
- this.name = "GetDmmfError";
65
- }
66
- };
67
- function isV8StringLimitError(error) {
68
- return error instanceof Error && "code" in error && error.code === "ERR_STRING_TOO_LONG";
69
- }
70
- function getDMMFBuffered(params) {
71
- const CHUNK_SIZE = 16 * 1024 * 1024;
72
- if (typeof import_chunk_KAFC7IGG.prismaSchemaWasm.get_dmmf_buffered !== "function") {
73
- throw new Error(
74
- "Buffered DMMF API not available. It's required for schemas that do not fit within the default V8 memory limit. Ensure you are using latest @prisma/prisma-schema-wasm."
75
- );
76
- }
77
- const buffer = import_chunk_KAFC7IGG.prismaSchemaWasm.get_dmmf_buffered(params);
78
- try {
79
- const totalBytes = buffer.len();
80
- debug(`DMMF buffered: ${totalBytes} bytes (${(totalBytes / 1024 / 1024).toFixed(1)}MB)`);
81
- const parser = new import_json.JSONParser();
82
- let result;
83
- parser.onValue = ({ value, stack }) => {
84
- if (stack.length === 0 && value !== void 0) {
85
- result = value;
86
- }
87
- };
88
- let offset = 0;
89
- while (offset < totalBytes) {
90
- const len = Math.min(CHUNK_SIZE, totalBytes - offset);
91
- const chunk = buffer.read_chunk(offset, len);
92
- parser.write(chunk);
93
- offset += len;
94
- }
95
- if (result === void 0) {
96
- throw new Error("Streaming JSON parse produced no result");
97
- }
98
- debug(`DMMF parsed via streaming parser (${(totalBytes / 1024 / 1024).toFixed(1)}MB)`);
99
- return result;
100
- } finally {
101
- buffer.free();
102
- }
103
- }
104
- async function getDMMF(options) {
105
- debug(`Using getDmmf Wasm`);
106
- const params = JSON.stringify({
107
- prismaSchema: options.datamodel,
108
- noColor: Boolean(process.env.NO_COLOR)
109
- });
110
- const dmmfPipeline = (0, import_function.pipe)(
111
- (0, import_chunk_5DBOS77Y.tryCatch)(
112
- () => {
113
- if (process.env.FORCE_PANIC_GET_DMMF) {
114
- debug("Triggering a Rust panic...");
115
- import_chunk_KAFC7IGG.prismaSchemaWasm.debug_panic();
116
- }
117
- const data = import_chunk_KAFC7IGG.prismaSchemaWasm.get_dmmf(params);
118
- return data;
119
- },
120
- (e) => ({
121
- type: "wasm-error",
122
- reason: "(get-dmmf wasm)",
123
- error: e
124
- })
125
- ),
126
- (0, import_chunk_5DBOS77Y.map)((result) => ({ result })),
127
- (0, import_chunk_5DBOS77Y.chainW)(
128
- ({ result }) => (
129
- // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings
130
- (0, import_chunk_5DBOS77Y.tryCatch)(
131
- () => JSON.parse(result),
132
- (e) => ({
133
- type: "parse-json",
134
- reason: "Unable to parse JSON",
135
- error: e
136
- })
137
- )
138
- )
139
- ),
140
- import_chunk_5DBOS77Y.fromEither
141
- );
142
- const dmmfEither = await dmmfPipeline();
143
- if ((0, import_chunk_5DBOS77Y.isRight)(dmmfEither)) {
144
- debug("dmmf data retrieved without errors in getDmmf Wasm");
145
- const { right: data } = dmmfEither;
146
- return Promise.resolve(data);
147
- }
148
- const leftError = dmmfEither.left;
149
- if (leftError.type === "wasm-error" && isV8StringLimitError(leftError.error)) {
150
- debug("V8 string limit hit, falling back to buffered DMMF API");
151
- try {
152
- const data = getDMMFBuffered(params);
153
- debug("dmmf data retrieved via buffered API");
154
- return data;
155
- } catch (error2) {
156
- if (error2 instanceof Error) {
157
- debugErrorType({ type: "wasm-error", reason: "(get-dmmf-buffered wasm)", error: error2 });
158
- throw mapWasmPanicToGetDmmfError(error2, "(get-dmmf-buffered wasm)");
159
- }
160
- throw new GetDmmfError({
161
- _tag: "unparsed",
162
- message: `Unknown error during buffered DMMF retrieval: ${error2}`,
163
- reason: "(get-dmmf-buffered wasm)"
164
- });
165
- }
166
- }
167
- const error = (0, import_chunk_XKZ6CBLA.z)(dmmfEither.left).with({ type: "wasm-error" }, (e) => {
168
- debugErrorType(e);
169
- return mapWasmPanicToGetDmmfError(e.error, e.reason);
170
- }).with({ type: "parse-json" }, (e) => {
171
- debugErrorType(e);
172
- return new GetDmmfError({ _tag: "unparsed", message: e.error.message, reason: e.reason });
173
- }).exhaustive();
174
- throw error;
175
- }
176
- function mapWasmPanicToGetDmmfError(error, reason) {
177
- if ((0, import_chunk_LMVSIVKQ.isWasmPanic)(error)) {
178
- const { message, stack } = (0, import_chunk_LMVSIVKQ.getWasmError)(error);
179
- const panic = new import_chunk_LMVSIVKQ.RustPanic(
180
- /* message */
181
- message,
182
- /* rustStack */
183
- stack,
184
- /* request */
185
- "@prisma/prisma-schema-wasm get_dmmf",
186
- "FMT_CLI"
187
- /* FMT_CLI */
188
- );
189
- return panic;
190
- }
191
- const errorOutput = error.message;
192
- return new GetDmmfError((0, import_chunk_WSZXPLJQ.parseQueryEngineError)({ errorOutput, reason }));
193
- }