@prisma/client-engine-runtime 6.9.0-dev.12 → 6.9.0-dev.14

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.
@@ -1,14 +1,14 @@
1
1
  export declare class UserFacingError extends Error {
2
2
  name: string;
3
3
  code: string;
4
- meta: unknown;
5
- constructor(message: string, code: string, meta?: unknown);
4
+ meta: Record<string, unknown>;
5
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
6
6
  toQueryResponseErrorObject(): {
7
7
  error: string;
8
8
  user_facing_error: {
9
9
  is_panic: boolean;
10
10
  message: string;
11
- meta: unknown;
11
+ meta: Record<string, unknown>;
12
12
  error_code: string;
13
13
  };
14
14
  };
package/dist/index.d.mts CHANGED
@@ -307,10 +307,9 @@ export declare class TransactionManager {
307
307
  private validateOptions;
308
308
  }
309
309
 
310
- export declare class TransactionManagerError extends Error {
311
- meta?: Record<string, unknown> | undefined;
312
- code: string;
313
- constructor(message: string, meta?: Record<string, unknown> | undefined);
310
+ export declare class TransactionManagerError extends UserFacingError {
311
+ name: string;
312
+ constructor(message: string, meta?: Record<string, unknown>);
314
313
  }
315
314
 
316
315
  export declare type TransactionOptions = {
@@ -322,14 +321,14 @@ export declare type TransactionOptions = {
322
321
  export declare class UserFacingError extends Error {
323
322
  name: string;
324
323
  code: string;
325
- meta: unknown;
326
- constructor(message: string, code: string, meta?: unknown);
324
+ meta: Record<string, unknown>;
325
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
327
326
  toQueryResponseErrorObject(): {
328
327
  error: string;
329
328
  user_facing_error: {
330
329
  is_panic: boolean;
331
330
  message: string;
332
- meta: unknown;
331
+ meta: Record<string, unknown>;
333
332
  error_code: string;
334
333
  };
335
334
  };
package/dist/index.d.ts CHANGED
@@ -307,10 +307,9 @@ export declare class TransactionManager {
307
307
  private validateOptions;
308
308
  }
309
309
 
310
- export declare class TransactionManagerError extends Error {
311
- meta?: Record<string, unknown> | undefined;
312
- code: string;
313
- constructor(message: string, meta?: Record<string, unknown> | undefined);
310
+ export declare class TransactionManagerError extends UserFacingError {
311
+ name: string;
312
+ constructor(message: string, meta?: Record<string, unknown>);
314
313
  }
315
314
 
316
315
  export declare type TransactionOptions = {
@@ -322,14 +321,14 @@ export declare type TransactionOptions = {
322
321
  export declare class UserFacingError extends Error {
323
322
  name: string;
324
323
  code: string;
325
- meta: unknown;
326
- constructor(message: string, code: string, meta?: unknown);
324
+ meta: Record<string, unknown>;
325
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
327
326
  toQueryResponseErrorObject(): {
328
327
  error: string;
329
328
  user_facing_error: {
330
329
  is_panic: boolean;
331
330
  message: string;
332
- meta: unknown;
331
+ meta: Record<string, unknown>;
333
332
  error_code: string;
334
333
  };
335
334
  };
package/dist/index.js CHANGED
@@ -193,7 +193,7 @@ var UserFacingError = class extends Error {
193
193
  constructor(message, code, meta) {
194
194
  super(message);
195
195
  this.code = code;
196
- this.meta = meta;
196
+ this.meta = meta ?? {};
197
197
  }
198
198
  toQueryResponseErrorObject() {
199
199
  return {
@@ -216,7 +216,7 @@ function rethrowAsUserFacing(error) {
216
216
  if (!code || !message) {
217
217
  throw error;
218
218
  }
219
- throw new UserFacingError(message, code, error);
219
+ throw new UserFacingError(message, code, { driverAdapterError: error });
220
220
  }
221
221
  function getErrorCode(err) {
222
222
  switch (err.cause.kind) {
@@ -714,11 +714,11 @@ var QueryInterpreter = class _QueryInterpreter {
714
714
  }
715
715
  case "concat": {
716
716
  const parts = await Promise.all(node.args.map((arg) => this.interpretNode(arg, queryable, scope, generators)));
717
- return parts.reduce((acc, part) => acc.concat(asList(part)), []);
717
+ return parts.length > 0 ? parts.reduce((acc, part) => acc.concat(asList(part)), []) : [];
718
718
  }
719
719
  case "sum": {
720
720
  const parts = await Promise.all(node.args.map((arg) => this.interpretNode(arg, queryable, scope, generators)));
721
- return parts.reduce((acc, part) => asNumber(acc) + asNumber(part));
721
+ return parts.length > 0 ? parts.reduce((acc, part) => asNumber(acc) + asNumber(part)) : 0;
722
722
  }
723
723
  case "execute": {
724
724
  const query = renderQuery(node.args, scope, generators);
@@ -976,12 +976,11 @@ async function randomUUID() {
976
976
  }
977
977
 
978
978
  // src/transactionManager/TransactionManagerErrors.ts
979
- var TransactionManagerError = class extends Error {
979
+ var TransactionManagerError = class extends UserFacingError {
980
+ name = "TransactionManagerError";
980
981
  constructor(message, meta) {
981
- super("Transaction API error: " + message);
982
- this.meta = meta;
982
+ super("Transaction API error: " + message, "P2028", meta);
983
983
  }
984
- code = "P2028";
985
984
  };
986
985
  var TransactionNotFoundError = class extends TransactionManagerError {
987
986
  constructor() {
package/dist/index.mjs CHANGED
@@ -148,7 +148,7 @@ var UserFacingError = class extends Error {
148
148
  constructor(message, code, meta) {
149
149
  super(message);
150
150
  this.code = code;
151
- this.meta = meta;
151
+ this.meta = meta ?? {};
152
152
  }
153
153
  toQueryResponseErrorObject() {
154
154
  return {
@@ -171,7 +171,7 @@ function rethrowAsUserFacing(error) {
171
171
  if (!code || !message) {
172
172
  throw error;
173
173
  }
174
- throw new UserFacingError(message, code, error);
174
+ throw new UserFacingError(message, code, { driverAdapterError: error });
175
175
  }
176
176
  function getErrorCode(err) {
177
177
  switch (err.cause.kind) {
@@ -669,11 +669,11 @@ var QueryInterpreter = class _QueryInterpreter {
669
669
  }
670
670
  case "concat": {
671
671
  const parts = await Promise.all(node.args.map((arg) => this.interpretNode(arg, queryable, scope, generators)));
672
- return parts.reduce((acc, part) => acc.concat(asList(part)), []);
672
+ return parts.length > 0 ? parts.reduce((acc, part) => acc.concat(asList(part)), []) : [];
673
673
  }
674
674
  case "sum": {
675
675
  const parts = await Promise.all(node.args.map((arg) => this.interpretNode(arg, queryable, scope, generators)));
676
- return parts.reduce((acc, part) => asNumber(acc) + asNumber(part));
676
+ return parts.length > 0 ? parts.reduce((acc, part) => asNumber(acc) + asNumber(part)) : 0;
677
677
  }
678
678
  case "execute": {
679
679
  const query = renderQuery(node.args, scope, generators);
@@ -931,12 +931,11 @@ async function randomUUID() {
931
931
  }
932
932
 
933
933
  // src/transactionManager/TransactionManagerErrors.ts
934
- var TransactionManagerError = class extends Error {
934
+ var TransactionManagerError = class extends UserFacingError {
935
+ name = "TransactionManagerError";
935
936
  constructor(message, meta) {
936
- super("Transaction API error: " + message);
937
- this.meta = meta;
937
+ super("Transaction API error: " + message, "P2028", meta);
938
938
  }
939
- code = "P2028";
940
939
  };
941
940
  var TransactionNotFoundError = class extends TransactionManagerError {
942
941
  constructor() {
@@ -1,7 +1,7 @@
1
- export declare class TransactionManagerError extends Error {
2
- meta?: Record<string, unknown> | undefined;
3
- code: string;
4
- constructor(message: string, meta?: Record<string, unknown> | undefined);
1
+ import { UserFacingError } from '../UserFacingError';
2
+ export declare class TransactionManagerError extends UserFacingError {
3
+ name: string;
4
+ constructor(message: string, meta?: Record<string, unknown>);
5
5
  }
6
6
  export declare class TransactionNotFoundError extends TransactionManagerError {
7
7
  constructor();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.9.0-dev.12",
3
+ "version": "6.9.0-dev.14",
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,8 +31,8 @@
31
31
  "nanoid": "5.1.5",
32
32
  "ulid": "3.0.0",
33
33
  "uuid": "11.1.0",
34
- "@prisma/debug": "6.9.0-dev.12",
35
- "@prisma/driver-adapter-utils": "6.9.0-dev.12"
34
+ "@prisma/driver-adapter-utils": "6.9.0-dev.14",
35
+ "@prisma/debug": "6.9.0-dev.14"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.14",