@orpc/client 0.26.0 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/fetch.js +5 -3
- package/dist/index.js +5 -2
- package/dist/src/adapters/fetch/orpc-link.d.ts +1 -1
- package/dist/src/index.d.ts +1 -1
- package/package.json +5 -7
package/dist/fetch.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// src/adapters/fetch/orpc-link.ts
|
2
|
+
import { ORPCError } from "@orpc/contract";
|
2
3
|
import { ORPCPayloadCodec } from "@orpc/server/fetch";
|
3
4
|
import { ORPC_HANDLER_HEADER, ORPC_HANDLER_VALUE, trim } from "@orpc/shared";
|
4
|
-
import { ORPCError } from "@orpc/shared/error";
|
5
5
|
var ORPCLink = class {
|
6
6
|
fetch;
|
7
7
|
payloadCodec;
|
@@ -34,13 +34,15 @@ var ORPCLink = class {
|
|
34
34
|
}, clientContext);
|
35
35
|
const decoded = await this.payloadCodec.decode(response);
|
36
36
|
if (!response.ok) {
|
37
|
-
|
37
|
+
if (ORPCError.isValidJSON(decoded)) {
|
38
|
+
throw new ORPCError(decoded);
|
39
|
+
}
|
40
|
+
throw new ORPCError({
|
38
41
|
status: response.status,
|
39
42
|
code: "INTERNAL_SERVER_ERROR",
|
40
43
|
message: "Internal server error",
|
41
44
|
cause: decoded
|
42
45
|
});
|
43
|
-
throw error;
|
44
46
|
}
|
45
47
|
return decoded;
|
46
48
|
}
|
package/dist/index.js
CHANGED
@@ -31,9 +31,12 @@ var DynamicLink = class {
|
|
31
31
|
};
|
32
32
|
|
33
33
|
// src/index.ts
|
34
|
-
|
34
|
+
import { isDefinedError, ORPCError, safe } from "@orpc/contract";
|
35
35
|
export {
|
36
36
|
DynamicLink,
|
37
|
-
|
37
|
+
ORPCError,
|
38
|
+
createORPCClient,
|
39
|
+
isDefinedError,
|
40
|
+
safe
|
38
41
|
};
|
39
42
|
//# sourceMappingURL=index.js.map
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import type { HTTPMethod } from '@orpc/contract';
|
2
1
|
import type { ProcedureClientOptions } from '@orpc/server';
|
3
2
|
import type { Promisable } from '@orpc/shared';
|
4
3
|
import type { ClientLink } from '../../types';
|
5
4
|
import type { FetchWithContext } from './types';
|
5
|
+
import { type HTTPMethod } from '@orpc/contract';
|
6
6
|
import { type PublicORPCPayloadCodec } from '@orpc/server/fetch';
|
7
7
|
export interface ORPCLinkOptions<TClientContext> {
|
8
8
|
/**
|
package/dist/src/index.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/client",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.28.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -33,16 +33,14 @@
|
|
33
33
|
"!**/*.tsbuildinfo",
|
34
34
|
"dist"
|
35
35
|
],
|
36
|
-
"peerDependencies": {
|
37
|
-
"@orpc/contract": "0.26.0"
|
38
|
-
},
|
39
36
|
"dependencies": {
|
40
|
-
"@orpc/
|
41
|
-
"@orpc/server": "0.
|
37
|
+
"@orpc/contract": "0.28.0",
|
38
|
+
"@orpc/server": "0.28.0",
|
39
|
+
"@orpc/shared": "0.28.0"
|
42
40
|
},
|
43
41
|
"devDependencies": {
|
44
42
|
"zod": "^3.24.1",
|
45
|
-
"@orpc/openapi": "0.
|
43
|
+
"@orpc/openapi": "0.28.0"
|
46
44
|
},
|
47
45
|
"scripts": {
|
48
46
|
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/adapters/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|