@prisma/client-engine-runtime 7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1 → 7.3.0-dev.1

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
@@ -17,6 +17,9 @@ import { Transaction } from '@prisma/driver-adapter-utils';
17
17
  /**
18
18
  * Applies SQL commenter plugins and returns the merged key-value pairs.
19
19
  * Keys with undefined values are filtered out.
20
+ *
21
+ * Each plugin receives a deep clone of the context to prevent mutations
22
+ * that could affect other plugins.
20
23
  */
21
24
  export declare function applySqlCommenters(plugins: SqlCommenterPlugin[], context: SqlCommenterContext): Record<string, string>;
22
25
 
package/dist/index.d.ts CHANGED
@@ -17,6 +17,9 @@ import { Transaction } from '@prisma/driver-adapter-utils';
17
17
  /**
18
18
  * Applies SQL commenter plugins and returns the merged key-value pairs.
19
19
  * Keys with undefined values are filtered out.
20
+ *
21
+ * Each plugin receives a deep clone of the context to prevent mutations
22
+ * that could affect other plugins.
20
23
  */
21
24
  export declare function applySqlCommenters(plugins: SqlCommenterPlugin[], context: SqlCommenterContext): Record<string, string>;
22
25
 
package/dist/index.js CHANGED
@@ -604,7 +604,7 @@ function mapValue(value, columnName, scalarType, enums) {
604
604
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
605
605
  }
606
606
  }
607
- if (Array.isArray(value)) {
607
+ if (Array.isArray(value) || value instanceof Uint8Array) {
608
608
  for (const byte of value) {
609
609
  if (byte !== 0) return true;
610
610
  }
@@ -700,6 +700,7 @@ function normalizeDateTime(dt) {
700
700
  }
701
701
 
702
702
  // src/sql-commenter.ts
703
+ var import_klona = require("klona");
703
704
  function formatSqlComment(tags) {
704
705
  const entries = Object.entries(tags);
705
706
  if (entries.length === 0) {
@@ -716,7 +717,7 @@ function formatSqlComment(tags) {
716
717
  function applySqlCommenters(plugins, context) {
717
718
  const merged = {};
718
719
  for (const plugin of plugins) {
719
- const tags = plugin(context);
720
+ const tags = plugin((0, import_klona.klona)(context));
720
721
  for (const [key, value] of Object.entries(tags)) {
721
722
  if (value !== void 0) {
722
723
  merged[key] = value;
@@ -1301,17 +1302,6 @@ function serializeRawValue(value, type) {
1301
1302
  throw new Error(`Cannot serialize value of type ${typeof value} as JsonArray`);
1302
1303
  }
1303
1304
  return value.map((v) => serializeRawValue(v, import_driver_adapter_utils2.ColumnTypeEnum.Json));
1304
- case import_driver_adapter_utils2.ColumnTypeEnum.Bytes:
1305
- if (Array.isArray(value)) {
1306
- return new Uint8Array(value);
1307
- } else {
1308
- throw new Error(`Cannot serialize value of type ${typeof value} as Bytes`);
1309
- }
1310
- case import_driver_adapter_utils2.ColumnTypeEnum.BytesArray:
1311
- if (!Array.isArray(value)) {
1312
- throw new Error(`Cannot serialize value of type ${typeof value} as BytesArray`);
1313
- }
1314
- return value.map((v) => serializeRawValue(v, import_driver_adapter_utils2.ColumnTypeEnum.Bytes));
1315
1305
  case import_driver_adapter_utils2.ColumnTypeEnum.Boolean:
1316
1306
  switch (typeof value) {
1317
1307
  case "boolean":
package/dist/index.mjs CHANGED
@@ -553,7 +553,7 @@ function mapValue(value, columnName, scalarType, enums) {
553
553
  throw new DataMapperError(`Expected a boolean in column '${columnName}', got ${typeof value}: ${value}`);
554
554
  }
555
555
  }
556
- if (Array.isArray(value)) {
556
+ if (Array.isArray(value) || value instanceof Uint8Array) {
557
557
  for (const byte of value) {
558
558
  if (byte !== 0) return true;
559
559
  }
@@ -649,6 +649,7 @@ function normalizeDateTime(dt) {
649
649
  }
650
650
 
651
651
  // src/sql-commenter.ts
652
+ import { klona } from "klona";
652
653
  function formatSqlComment(tags) {
653
654
  const entries = Object.entries(tags);
654
655
  if (entries.length === 0) {
@@ -665,7 +666,7 @@ function formatSqlComment(tags) {
665
666
  function applySqlCommenters(plugins, context) {
666
667
  const merged = {};
667
668
  for (const plugin of plugins) {
668
- const tags = plugin(context);
669
+ const tags = plugin(klona(context));
669
670
  for (const [key, value] of Object.entries(tags)) {
670
671
  if (value !== void 0) {
671
672
  merged[key] = value;
@@ -1250,17 +1251,6 @@ function serializeRawValue(value, type) {
1250
1251
  throw new Error(`Cannot serialize value of type ${typeof value} as JsonArray`);
1251
1252
  }
1252
1253
  return value.map((v) => serializeRawValue(v, ColumnTypeEnum.Json));
1253
- case ColumnTypeEnum.Bytes:
1254
- if (Array.isArray(value)) {
1255
- return new Uint8Array(value);
1256
- } else {
1257
- throw new Error(`Cannot serialize value of type ${typeof value} as Bytes`);
1258
- }
1259
- case ColumnTypeEnum.BytesArray:
1260
- if (!Array.isArray(value)) {
1261
- throw new Error(`Cannot serialize value of type ${typeof value} as BytesArray`);
1262
- }
1263
- return value.map((v) => serializeRawValue(v, ColumnTypeEnum.Bytes));
1264
1254
  case ColumnTypeEnum.Boolean:
1265
1255
  switch (typeof value) {
1266
1256
  case "boolean":
@@ -10,12 +10,15 @@ import type { SqlCommenterContext, SqlCommenterPlugin } from '@prisma/sqlcomment
10
10
  * 5. Replace ' with \' in values (after URL encoding)
11
11
  * 6. Wrap values in single quotes
12
12
  * 7. Join key='value' pairs with commas
13
- * 8. Wrap in /* *\/
13
+ * 8. Wrap in a SQL comment
14
14
  */
15
15
  export declare function formatSqlComment(tags: Record<string, string>): string;
16
16
  /**
17
17
  * Applies SQL commenter plugins and returns the merged key-value pairs.
18
18
  * Keys with undefined values are filtered out.
19
+ *
20
+ * Each plugin receives a deep clone of the context to prevent mutations
21
+ * that could affect other plugins.
19
22
  */
20
23
  export declare function applySqlCommenters(plugins: SqlCommenterPlugin[], context: SqlCommenterContext): Record<string, string>;
21
24
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1",
3
+ "version": "7.3.0-dev.1",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,13 +27,14 @@
27
27
  "@bugsnag/cuid": "3.2.1",
28
28
  "@opentelemetry/api": "1.9.0",
29
29
  "@paralleldrive/cuid2": "2.2.2",
30
+ "klona": "2.0.6",
30
31
  "nanoid": "5.1.5",
31
32
  "ulid": "3.0.0",
32
33
  "uuid": "11.1.0",
33
- "@prisma/client-runtime-utils": "7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1",
34
- "@prisma/sqlcommenter": "7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1",
35
- "@prisma/driver-adapter-utils": "7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1",
36
- "@prisma/debug": "7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1"
34
+ "@prisma/client-runtime-utils": "7.3.0-dev.1",
35
+ "@prisma/debug": "7.3.0-dev.1",
36
+ "@prisma/driver-adapter-utils": "7.3.0-dev.1",
37
+ "@prisma/sqlcommenter": "7.3.0-dev.1"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@types/jest": "29.5.14",