@orpc/shared 0.14.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
|
-
|
|
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:
|
|
64
|
-
data:
|
|
65
|
-
|
|
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-
|
|
88
|
+
//# sourceMappingURL=chunk-CCTAECMC.js.map
|
package/dist/error.js
CHANGED
package/dist/index.js
CHANGED
package/dist/src/error.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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?:
|
|
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():
|
|
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/dist/src/hook.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type OnErrorState<TInput> = {
|
|
|
20
20
|
export interface BaseHookMeta<TOutput> {
|
|
21
21
|
next: () => Promise<TOutput>;
|
|
22
22
|
}
|
|
23
|
-
export interface Hooks<TInput, TOutput, TContext, TMeta extends (Record<string,
|
|
23
|
+
export interface Hooks<TInput, TOutput, TContext, TMeta extends (Record<string, any> & {
|
|
24
24
|
next?: never;
|
|
25
25
|
}) | undefined> {
|
|
26
26
|
execute?: Arrayable<(input: TInput, context: TContext, meta: (TMeta extends undefined ? unknown : TMeta) & BaseHookMeta<TOutput>) => Promise<TOutput>>;
|
package/dist/src/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "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.23.8"
|
|
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'",
|