@prisma/client-engine-runtime 7.4.0 → 7.5.0-dev.10

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.
package/dist/index.d.mts CHANGED
@@ -80,7 +80,7 @@ export declare type DecimalTaggedValue = {
80
80
  value: string;
81
81
  };
82
82
 
83
- export declare function deserializeJsonResponse(result: unknown): unknown;
83
+ export declare function deserializeJsonObject(result: unknown): unknown;
84
84
 
85
85
  /**
86
86
  * Checks if two objects representing the names and values of key columns match. A match is
@@ -187,7 +187,7 @@ export declare type JoinExpression = {
187
187
  isRelationUnique: boolean;
188
188
  };
189
189
 
190
- export declare type JsonInputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | FieldRefTaggedValue | JsonTaggedValue | EnumTaggedValue;
190
+ export declare type JsonInputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | FieldRefTaggedValue | JsonTaggedValue | EnumTaggedValue | RawTaggedValue;
191
191
 
192
192
  export declare type JsonOutputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | JsonTaggedValue;
193
193
 
@@ -212,7 +212,7 @@ export declare function normalizeJsonProtocolValues(result: unknown): unknown;
212
212
  export declare function normalizeRawJsonProtocolResponse(response: RawResponse): RawResponse;
213
213
 
214
214
  export declare type Pagination = {
215
- cursor: Record<string, PrismaValue> | null;
215
+ cursor: Record<string, unknown> | null;
216
216
  take: number | null;
217
217
  skip: number | null;
218
218
  };
@@ -421,6 +421,11 @@ export declare type RawResponse = {
421
421
  rows: unknown[][];
422
422
  };
423
423
 
424
+ export declare type RawTaggedValue = {
425
+ $type: 'Raw';
426
+ value: unknown;
427
+ };
428
+
424
429
  export declare type ResultNode = {
425
430
  type: 'affectedRows';
426
431
  } | {
package/dist/index.d.ts CHANGED
@@ -80,7 +80,7 @@ export declare type DecimalTaggedValue = {
80
80
  value: string;
81
81
  };
82
82
 
83
- export declare function deserializeJsonResponse(result: unknown): unknown;
83
+ export declare function deserializeJsonObject(result: unknown): unknown;
84
84
 
85
85
  /**
86
86
  * Checks if two objects representing the names and values of key columns match. A match is
@@ -187,7 +187,7 @@ export declare type JoinExpression = {
187
187
  isRelationUnique: boolean;
188
188
  };
189
189
 
190
- export declare type JsonInputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | FieldRefTaggedValue | JsonTaggedValue | EnumTaggedValue;
190
+ export declare type JsonInputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | FieldRefTaggedValue | JsonTaggedValue | EnumTaggedValue | RawTaggedValue;
191
191
 
192
192
  export declare type JsonOutputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | JsonTaggedValue;
193
193
 
@@ -212,7 +212,7 @@ export declare function normalizeJsonProtocolValues(result: unknown): unknown;
212
212
  export declare function normalizeRawJsonProtocolResponse(response: RawResponse): RawResponse;
213
213
 
214
214
  export declare type Pagination = {
215
- cursor: Record<string, PrismaValue> | null;
215
+ cursor: Record<string, unknown> | null;
216
216
  take: number | null;
217
217
  skip: number | null;
218
218
  };
@@ -421,6 +421,11 @@ export declare type RawResponse = {
421
421
  rows: unknown[][];
422
422
  };
423
423
 
424
+ export declare type RawTaggedValue = {
425
+ $type: 'Raw';
426
+ value: unknown;
427
+ };
428
+
424
429
  export declare type ResultNode = {
425
430
  type: 'affectedRows';
426
431
  } | {
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ __export(index_exports, {
37
37
  UserFacingError: () => UserFacingError,
38
38
  applySqlCommenters: () => applySqlCommenters,
39
39
  convertCompactedRows: () => convertCompactedRows,
40
- deserializeJsonResponse: () => deserializeJsonResponse,
40
+ deserializeJsonObject: () => deserializeJsonObject,
41
41
  doKeysMatch: () => doKeysMatch,
42
42
  isDeepStrictEqual: () => isDeepStrictEqual,
43
43
  isPrismaValueGenerator: () => isPrismaValueGenerator,
@@ -170,7 +170,10 @@ function normalizeJsonProtocolValues(result) {
170
170
  function isTaggedValue(value) {
171
171
  return value !== null && typeof value == "object" && typeof value["$type"] === "string";
172
172
  }
173
- function normalizeTaggedValue({ $type, value }) {
173
+ function normalizeTaggedValue({
174
+ $type,
175
+ value
176
+ }) {
174
177
  switch ($type) {
175
178
  case "BigInt":
176
179
  return { $type, value: String(value) };
@@ -182,6 +185,12 @@ function normalizeTaggedValue({ $type, value }) {
182
185
  return { $type, value: String(new import_client_runtime_utils2.Decimal(value)) };
183
186
  case "Json":
184
187
  return { $type, value: JSON.stringify(JSON.parse(value)) };
188
+ case "Raw":
189
+ return { $type, value };
190
+ case "FieldRef":
191
+ return { $type, value };
192
+ case "Enum":
193
+ return { $type, value };
185
194
  default:
186
195
  assertNever(value, "Unknown tagged value");
187
196
  }
@@ -193,12 +202,12 @@ function mapObjectValues(object, mapper) {
193
202
  }
194
203
  return result;
195
204
  }
196
- function deserializeJsonResponse(result) {
205
+ function deserializeJsonObject(result) {
197
206
  if (result === null) {
198
207
  return result;
199
208
  }
200
209
  if (Array.isArray(result)) {
201
- return result.map(deserializeJsonResponse);
210
+ return result.map(deserializeJsonObject);
202
211
  }
203
212
  if (typeof result === "object") {
204
213
  if (isTaggedValue(result)) {
@@ -207,7 +216,7 @@ function deserializeJsonResponse(result) {
207
216
  if (result.constructor !== null && result.constructor.name !== "Object") {
208
217
  return result;
209
218
  }
210
- return mapObjectValues(result, deserializeJsonResponse);
219
+ return mapObjectValues(result, deserializeJsonObject);
211
220
  }
212
221
  return result;
213
222
  }
@@ -225,6 +234,12 @@ function deserializeTaggedValue({ $type, value }) {
225
234
  return new import_client_runtime_utils2.Decimal(value);
226
235
  case "Json":
227
236
  return JSON.parse(value);
237
+ case "Raw":
238
+ return value;
239
+ case "FieldRef":
240
+ throw new Error("FieldRef tagged values cannot be deserialized to JavaScript values");
241
+ case "Enum":
242
+ return value;
228
243
  default:
229
244
  assertNever(value, "Unknown tagged value");
230
245
  }
@@ -456,7 +471,7 @@ function resolveArgPlaceholders(args, placeholderValues) {
456
471
  function convertCompactedRows(rows, compiledBatch, placeholderValues = {}) {
457
472
  const keysPerRow = rows.map(
458
473
  (item) => compiledBatch.keys.reduce((acc, key) => {
459
- acc[key] = deserializeJsonResponse(item[key]);
474
+ acc[key] = deserializeJsonObject(item[key]);
460
475
  return acc;
461
476
  }, {})
462
477
  );
@@ -1729,6 +1744,7 @@ var QueryInterpreter = class _QueryInterpreter {
1729
1744
  }
1730
1745
  case "process": {
1731
1746
  const { value, lastInsertId } = await this.interpretNode(node.args.expr, context);
1747
+ evaluateProcessingParameters(node.args.operations, context.scope, context.generators);
1732
1748
  return { value: processRecords(value, node.args.operations), lastInsertId };
1733
1749
  }
1734
1750
  case "initializeRecord": {
@@ -1904,6 +1920,17 @@ function applyComments(query, sqlCommenter) {
1904
1920
  sql: appendSqlComment(query.sql, comment)
1905
1921
  };
1906
1922
  }
1923
+ function evaluateProcessingParameters(ops, scope, generators) {
1924
+ const cursor = ops.pagination?.cursor;
1925
+ if (cursor) {
1926
+ for (const [key, value] of Object.entries(cursor)) {
1927
+ cursor[key] = evaluateArg(value, scope, generators);
1928
+ }
1929
+ }
1930
+ for (const nested of Object.values(ops.nested)) {
1931
+ evaluateProcessingParameters(nested, scope, generators);
1932
+ }
1933
+ }
1907
1934
 
1908
1935
  // src/raw-json-protocol.ts
1909
1936
  var import_client_runtime_utils4 = require("@prisma/client-runtime-utils");
@@ -2254,7 +2281,7 @@ function createTimeoutIfDefined(cb, ms) {
2254
2281
  UserFacingError,
2255
2282
  applySqlCommenters,
2256
2283
  convertCompactedRows,
2257
- deserializeJsonResponse,
2284
+ deserializeJsonObject,
2258
2285
  doKeysMatch,
2259
2286
  isDeepStrictEqual,
2260
2287
  isPrismaValueGenerator,
package/dist/index.mjs CHANGED
@@ -119,7 +119,10 @@ function normalizeJsonProtocolValues(result) {
119
119
  function isTaggedValue(value) {
120
120
  return value !== null && typeof value == "object" && typeof value["$type"] === "string";
121
121
  }
122
- function normalizeTaggedValue({ $type, value }) {
122
+ function normalizeTaggedValue({
123
+ $type,
124
+ value
125
+ }) {
123
126
  switch ($type) {
124
127
  case "BigInt":
125
128
  return { $type, value: String(value) };
@@ -131,6 +134,12 @@ function normalizeTaggedValue({ $type, value }) {
131
134
  return { $type, value: String(new Decimal2(value)) };
132
135
  case "Json":
133
136
  return { $type, value: JSON.stringify(JSON.parse(value)) };
137
+ case "Raw":
138
+ return { $type, value };
139
+ case "FieldRef":
140
+ return { $type, value };
141
+ case "Enum":
142
+ return { $type, value };
134
143
  default:
135
144
  assertNever(value, "Unknown tagged value");
136
145
  }
@@ -142,12 +151,12 @@ function mapObjectValues(object, mapper) {
142
151
  }
143
152
  return result;
144
153
  }
145
- function deserializeJsonResponse(result) {
154
+ function deserializeJsonObject(result) {
146
155
  if (result === null) {
147
156
  return result;
148
157
  }
149
158
  if (Array.isArray(result)) {
150
- return result.map(deserializeJsonResponse);
159
+ return result.map(deserializeJsonObject);
151
160
  }
152
161
  if (typeof result === "object") {
153
162
  if (isTaggedValue(result)) {
@@ -156,7 +165,7 @@ function deserializeJsonResponse(result) {
156
165
  if (result.constructor !== null && result.constructor.name !== "Object") {
157
166
  return result;
158
167
  }
159
- return mapObjectValues(result, deserializeJsonResponse);
168
+ return mapObjectValues(result, deserializeJsonObject);
160
169
  }
161
170
  return result;
162
171
  }
@@ -174,6 +183,12 @@ function deserializeTaggedValue({ $type, value }) {
174
183
  return new Decimal2(value);
175
184
  case "Json":
176
185
  return JSON.parse(value);
186
+ case "Raw":
187
+ return value;
188
+ case "FieldRef":
189
+ throw new Error("FieldRef tagged values cannot be deserialized to JavaScript values");
190
+ case "Enum":
191
+ return value;
177
192
  default:
178
193
  assertNever(value, "Unknown tagged value");
179
194
  }
@@ -405,7 +420,7 @@ function resolveArgPlaceholders(args, placeholderValues) {
405
420
  function convertCompactedRows(rows, compiledBatch, placeholderValues = {}) {
406
421
  const keysPerRow = rows.map(
407
422
  (item) => compiledBatch.keys.reduce((acc, key) => {
408
- acc[key] = deserializeJsonResponse(item[key]);
423
+ acc[key] = deserializeJsonObject(item[key]);
409
424
  return acc;
410
425
  }, {})
411
426
  );
@@ -1678,6 +1693,7 @@ var QueryInterpreter = class _QueryInterpreter {
1678
1693
  }
1679
1694
  case "process": {
1680
1695
  const { value, lastInsertId } = await this.interpretNode(node.args.expr, context);
1696
+ evaluateProcessingParameters(node.args.operations, context.scope, context.generators);
1681
1697
  return { value: processRecords(value, node.args.operations), lastInsertId };
1682
1698
  }
1683
1699
  case "initializeRecord": {
@@ -1853,6 +1869,17 @@ function applyComments(query, sqlCommenter) {
1853
1869
  sql: appendSqlComment(query.sql, comment)
1854
1870
  };
1855
1871
  }
1872
+ function evaluateProcessingParameters(ops, scope, generators) {
1873
+ const cursor = ops.pagination?.cursor;
1874
+ if (cursor) {
1875
+ for (const [key, value] of Object.entries(cursor)) {
1876
+ cursor[key] = evaluateArg(value, scope, generators);
1877
+ }
1878
+ }
1879
+ for (const nested of Object.values(ops.nested)) {
1880
+ evaluateProcessingParameters(nested, scope, generators);
1881
+ }
1882
+ }
1856
1883
 
1857
1884
  // src/raw-json-protocol.ts
1858
1885
  import { Decimal as Decimal4 } from "@prisma/client-runtime-utils";
@@ -2202,7 +2229,7 @@ export {
2202
2229
  UserFacingError,
2203
2230
  applySqlCommenters,
2204
2231
  convertCompactedRows,
2205
- deserializeJsonResponse,
2232
+ deserializeJsonObject,
2206
2233
  doKeysMatch,
2207
2234
  isDeepStrictEqual,
2208
2235
  isPrismaValueGenerator,
@@ -29,10 +29,14 @@ export type JsonTaggedValue = {
29
29
  $type: 'Json';
30
30
  value: string;
31
31
  };
32
- export type JsonInputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | FieldRefTaggedValue | JsonTaggedValue | EnumTaggedValue;
32
+ export type RawTaggedValue = {
33
+ $type: 'Raw';
34
+ value: unknown;
35
+ };
36
+ export type JsonInputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | FieldRefTaggedValue | JsonTaggedValue | EnumTaggedValue | RawTaggedValue;
33
37
  export type JsonOutputTaggedValue = DateTaggedValue | DecimalTaggedValue | BytesTaggedValue | BigIntTaggedValue | JsonTaggedValue;
34
38
  export type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
35
39
  [key: string]: JsOutputValue;
36
40
  };
37
41
  export declare function normalizeJsonProtocolValues(result: unknown): unknown;
38
- export declare function deserializeJsonResponse(result: unknown): unknown;
42
+ export declare function deserializeJsonObject(result: unknown): unknown;
@@ -203,7 +203,7 @@ export type FieldOperation = {
203
203
  value: PrismaValue;
204
204
  };
205
205
  export type Pagination = {
206
- cursor: Record<string, PrismaValue> | null;
206
+ cursor: Record<string, unknown> | null;
207
207
  take: number | null;
208
208
  skip: number | null;
209
209
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "7.4.0",
3
+ "version": "7.5.0-dev.10",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -31,10 +31,10 @@
31
31
  "nanoid": "5.1.5",
32
32
  "ulid": "3.0.0",
33
33
  "uuid": "11.1.0",
34
- "@prisma/client-runtime-utils": "7.4.0",
35
- "@prisma/driver-adapter-utils": "7.4.0",
36
- "@prisma/sqlcommenter": "7.4.0",
37
- "@prisma/debug": "7.4.0"
34
+ "@prisma/client-runtime-utils": "7.5.0-dev.10",
35
+ "@prisma/debug": "7.5.0-dev.10",
36
+ "@prisma/driver-adapter-utils": "7.5.0-dev.10",
37
+ "@prisma/sqlcommenter": "7.5.0-dev.10"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@codspeed/benchmark.js-plugin": "4.0.0",