@orpc/shared 0.15.0 → 0.16.0

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,5 +1,4 @@
1
1
  // src/error.ts
2
- import { ZodError } from "zod";
3
2
  var ORPC_ERROR_CODE_STATUSES = {
4
3
  BAD_REQUEST: 400,
5
4
  UNAUTHORIZED: 401,
@@ -39,10 +38,7 @@ var ORPCError = class _ORPCError extends Error {
39
38
  return this.zz$oe.data;
40
39
  }
41
40
  get issues() {
42
- if (this.code === "BAD_REQUEST" && this.zz$oe.cause instanceof ZodError) {
43
- return this.zz$oe.cause.issues;
44
- }
45
- return void 0;
41
+ return this.zz$oe.issues;
46
42
  }
47
43
  toJSON() {
48
44
  return {
@@ -60,9 +56,9 @@ var ORPCError = class _ORPCError extends Error {
60
56
  return new _ORPCError({
61
57
  code: json.code,
62
58
  status: json.status,
63
- message: Reflect.get(json, "message"),
64
- data: Reflect.get(json, "data"),
65
- cause: "issues" in json ? new ZodError(json.issues) : void 0
59
+ message: json.message,
60
+ data: json.data,
61
+ issues: json.issues
66
62
  });
67
63
  }
68
64
  };
@@ -89,4 +85,4 @@ export {
89
85
  ORPCError,
90
86
  convertToStandardError
91
87
  };
92
- //# sourceMappingURL=chunk-4KZEIATV.js.map
88
+ //# sourceMappingURL=chunk-CCTAECMC.js.map
package/dist/error.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  ORPCError,
3
3
  ORPC_ERROR_CODE_STATUSES,
4
4
  convertToStandardError
5
- } from "./chunk-4KZEIATV.js";
5
+ } from "./chunk-CCTAECMC.js";
6
6
  export {
7
7
  ORPCError,
8
8
  ORPC_ERROR_CODE_STATUSES,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  convertToStandardError
3
- } from "./chunk-4KZEIATV.js";
3
+ } from "./chunk-CCTAECMC.js";
4
4
 
5
5
  // src/hook.ts
6
6
  async function executeWithHooks(options) {
@@ -1,4 +1,4 @@
1
- import { type ZodIssue } from 'zod';
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  export declare const ORPC_ERROR_CODE_STATUSES: {
3
3
  readonly BAD_REQUEST: 400;
4
4
  readonly UNAUTHORIZED: 401;
@@ -26,7 +26,7 @@ export interface ORPCErrorJSON<TCode extends ORPCErrorCode, TData> {
26
26
  status: number;
27
27
  message: string;
28
28
  data: TData;
29
- issues?: ZodIssue[];
29
+ issues?: readonly StandardSchemaV1.Issue[];
30
30
  }
31
31
  export type ANY_ORPC_ERROR_JSON = ORPCErrorJSON<any, any>;
32
32
  export type WELL_ORPC_ERROR_JSON = ORPCErrorJSON<ORPCErrorCode, unknown>;
@@ -36,6 +36,7 @@ export declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error
36
36
  status?: number;
37
37
  message?: string;
38
38
  cause?: unknown;
39
+ issues?: readonly StandardSchemaV1.Issue[];
39
40
  } & (undefined extends TData ? {
40
41
  data?: TData;
41
42
  } : {
@@ -46,6 +47,7 @@ export declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error
46
47
  status?: number;
47
48
  message?: string;
48
49
  cause?: unknown;
50
+ issues?: readonly StandardSchemaV1.Issue[];
49
51
  } & (undefined extends TData ? {
50
52
  data?: TData;
51
53
  } : {
@@ -54,7 +56,7 @@ export declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error
54
56
  get code(): TCode;
55
57
  get status(): number;
56
58
  get data(): TData;
57
- get issues(): ZodIssue[] | undefined;
59
+ get issues(): readonly StandardSchemaV1.Issue[] | undefined;
58
60
  toJSON(): ORPCErrorJSON<TCode, TData>;
59
61
  static fromJSON(json: unknown): ORPCError<ORPCErrorCode, any> | undefined;
60
62
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/shared",
3
3
  "type": "module",
4
- "version": "0.15.0",
4
+ "version": "0.16.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,10 +34,10 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
+ "@standard-schema/spec": "1.0.0-beta.4",
37
38
  "is-what": "^5.0.2",
38
39
  "radash": "^12.1.0",
39
- "type-fest": "^4.26.1",
40
- "zod": "^3.24.1"
40
+ "type-fest": "^4.26.1"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.error=src/error.ts --format=esm --onSuccess='tsc -b --noCheck'",