@danielhritcu/zenstack-orm 3.5.10 → 3.5.12

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.cts CHANGED
@@ -2442,7 +2442,9 @@ type ClientContract<Schema extends SchemaDef, Options extends ClientOptions<Sche
2442
2442
  * });
2443
2443
  * ```
2444
2444
  */
2445
- $batch(requests: Record<string, any>): ZenStackPromise<Schema, any>;
2445
+ $batch<T extends Record<string, PromiseLike<any>>>(requests: T): ZenStackPromise<Schema, {
2446
+ [K in keyof T]: Awaited<T[K]>;
2447
+ }>;
2446
2448
  /**
2447
2449
  * Returns a new client with the specified plugin installed. The original client remains unchanged.
2448
2450
  *
package/dist/index.d.ts CHANGED
@@ -2442,7 +2442,9 @@ type ClientContract<Schema extends SchemaDef, Options extends ClientOptions<Sche
2442
2442
  * });
2443
2443
  * ```
2444
2444
  */
2445
- $batch(requests: Record<string, any>): ZenStackPromise<Schema, any>;
2445
+ $batch<T extends Record<string, PromiseLike<any>>>(requests: T): ZenStackPromise<Schema, {
2446
+ [K in keyof T]: Awaited<T[K]>;
2447
+ }>;
2446
2448
  /**
2447
2449
  * Returns a new client with the specified plugin installed. The original client remains unchanged.
2448
2450
  *
package/dist/index.js CHANGED
@@ -23,9 +23,16 @@ import { CompiledQuery, DefaultConnectionProvider, DefaultQueryExecutor as Defau
23
23
  import z2 from "zod";
24
24
 
25
25
  // src/utils/zod-utils.ts
26
- import { fromError } from "zod-validation-error/v3";
27
26
  function formatError(error) {
28
- return fromError(error).toString();
27
+ const err = error;
28
+ if (err?.issues && Array.isArray(err.issues)) {
29
+ return err.issues.map((i) => {
30
+ const path = i.path?.length ? i.path.join(".") + ": " : "";
31
+ return path + (i.message ?? "invalid");
32
+ }).join("; ");
33
+ }
34
+ if (err?.message) return String(err.message);
35
+ return String(error);
29
36
  }
30
37
  __name(formatError, "formatError");
31
38