@orpc/client 0.31.0 → 0.33.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.
package/dist/fetch.js CHANGED
@@ -35,11 +35,10 @@ var RPCLink = class {
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);
38
+ throw ORPCError.fromJSON(decoded);
39
39
  }
40
- throw new ORPCError({
40
+ throw new ORPCError("INTERNAL_SERVER_ERROR", {
41
41
  status: response.status,
42
- code: "INTERNAL_SERVER_ERROR",
43
42
  message: "Internal server error",
44
43
  cause: decoded
45
44
  });
@@ -77,8 +76,7 @@ var RPCLink = class {
77
76
  body: encoded.body
78
77
  };
79
78
  }
80
- throw new ORPCError({
81
- code: "BAD_REQUEST",
79
+ throw new ORPCError("BAD_REQUEST", {
82
80
  message: "Cannot encode the request, please check the url length or payload."
83
81
  });
84
82
  }
@@ -19,7 +19,7 @@ export interface RPCLinkOptions<TClientContext> {
19
19
  *
20
20
  * @default 'POST'
21
21
  */
22
- method?: (path: readonly string[], input: unknown, context: TClientContext) => Promisable<HTTPMethod | undefined>;
22
+ method?(path: readonly string[], input: unknown, context: TClientContext): Promisable<HTTPMethod | undefined>;
23
23
  /**
24
24
  * The method to use when the payload cannot safely pass to the server with method return from method function.
25
25
  * Do not use GET as fallback method, it's very dangerous.
@@ -27,7 +27,7 @@ export interface RPCLinkOptions<TClientContext> {
27
27
  * @default 'POST'
28
28
  */
29
29
  fallbackMethod?: HTTPMethod;
30
- headers?: (path: readonly string[], input: unknown, context: TClientContext) => Promisable<Headers | Record<string, string>>;
30
+ headers?(path: readonly string[], input: unknown, context: TClientContext): Promisable<Headers | Record<string, string>>;
31
31
  fetch?: FetchWithContext<TClientContext>;
32
32
  payloadCodec?: PublicORPCPayloadCodec;
33
33
  }
@@ -1,5 +1,5 @@
1
1
  import type { ContractRouter, ContractRouterClient } from '@orpc/contract';
2
- import type { ANY_ROUTER, RouterClient } from '@orpc/server';
2
+ import type { AnyRouter, RouterClient } from '@orpc/server';
3
3
  import type { ClientLink } from './types';
4
4
  export interface createORPCClientOptions {
5
5
  /**
@@ -7,5 +7,5 @@ export interface createORPCClientOptions {
7
7
  */
8
8
  path?: string[];
9
9
  }
10
- export declare function createORPCClient<TRouter extends ANY_ROUTER | ContractRouter<any>, TClientContext = unknown>(link: ClientLink<TClientContext>, options?: createORPCClientOptions): TRouter extends ContractRouter<any> ? ContractRouterClient<TRouter, TClientContext> : TRouter extends ANY_ROUTER ? RouterClient<TRouter, TClientContext> : never;
10
+ export declare function createORPCClient<TRouter extends AnyRouter | ContractRouter<any>, TClientContext = unknown>(link: ClientLink<TClientContext>, options?: createORPCClientOptions): TRouter extends ContractRouter<any> ? ContractRouterClient<TRouter, TClientContext> : TRouter extends AnyRouter ? RouterClient<TRouter, TClientContext> : never;
11
11
  //# sourceMappingURL=client.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ClientOptions } from '@orpc/contract';
2
2
  export interface ClientLink<TClientContext> {
3
- call: (path: readonly string[], input: unknown, options: ClientOptions<TClientContext>) => Promise<unknown>;
3
+ call(path: readonly string[], input: unknown, options: ClientOptions<TClientContext>): Promise<unknown>;
4
4
  }
5
5
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/client",
3
3
  "type": "module",
4
- "version": "0.31.0",
4
+ "version": "0.33.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,13 +34,13 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@orpc/contract": "0.31.0",
38
- "@orpc/shared": "0.31.0",
39
- "@orpc/server": "0.31.0"
37
+ "@orpc/contract": "0.33.0",
38
+ "@orpc/shared": "0.33.0",
39
+ "@orpc/server": "0.33.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "zod": "^3.24.1",
43
- "@orpc/openapi": "0.31.0"
43
+ "@orpc/openapi": "0.33.0"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/adapters/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",