@orpc/client 0.28.0 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
package/dist/fetch.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import { ORPCError } from "@orpc/contract";
|
3
3
|
import { ORPCPayloadCodec } from "@orpc/server/fetch";
|
4
4
|
import { ORPC_HANDLER_HEADER, ORPC_HANDLER_VALUE, trim } from "@orpc/shared";
|
5
|
-
var
|
5
|
+
var RPCLink = class {
|
6
6
|
fetch;
|
7
7
|
payloadCodec;
|
8
8
|
maxURLLength;
|
@@ -84,6 +84,6 @@ var ORPCLink = class {
|
|
84
84
|
}
|
85
85
|
};
|
86
86
|
export {
|
87
|
-
|
87
|
+
RPCLink
|
88
88
|
};
|
89
89
|
//# sourceMappingURL=fetch.js.map
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import type {
|
1
|
+
import type { ClientOptions, HTTPMethod } from '@orpc/contract';
|
2
2
|
import type { Promisable } from '@orpc/shared';
|
3
3
|
import type { ClientLink } from '../../types';
|
4
4
|
import type { FetchWithContext } from './types';
|
5
|
-
import { type HTTPMethod } from '@orpc/contract';
|
6
5
|
import { type PublicORPCPayloadCodec } from '@orpc/server/fetch';
|
7
|
-
export interface
|
6
|
+
export interface RPCLinkOptions<TClientContext> {
|
8
7
|
/**
|
9
8
|
* Base url for all requests.
|
10
9
|
*/
|
@@ -32,7 +31,7 @@ export interface ORPCLinkOptions<TClientContext> {
|
|
32
31
|
fetch?: FetchWithContext<TClientContext>;
|
33
32
|
payloadCodec?: PublicORPCPayloadCodec;
|
34
33
|
}
|
35
|
-
export declare class
|
34
|
+
export declare class RPCLink<TClientContext> implements ClientLink<TClientContext> {
|
36
35
|
private readonly fetch;
|
37
36
|
private readonly payloadCodec;
|
38
37
|
private readonly maxURLLength;
|
@@ -40,8 +39,8 @@ export declare class ORPCLink<TClientContext> implements ClientLink<TClientConte
|
|
40
39
|
private readonly getMethod;
|
41
40
|
private readonly getHeaders;
|
42
41
|
private readonly url;
|
43
|
-
constructor(options:
|
44
|
-
call(path: readonly string[], input: unknown, options:
|
42
|
+
constructor(options: RPCLinkOptions<TClientContext>);
|
43
|
+
call(path: readonly string[], input: unknown, options: ClientOptions<TClientContext>): Promise<unknown>;
|
45
44
|
private encode;
|
46
45
|
}
|
47
46
|
//# sourceMappingURL=orpc-link.d.ts.map
|
package/dist/src/client.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ContractRouter } from '@orpc/contract';
|
1
|
+
import type { ContractRouter, ContractRouterClient } from '@orpc/contract';
|
2
2
|
import type { ANY_ROUTER, RouterClient } from '@orpc/server';
|
3
3
|
import type { ClientLink } from './types';
|
4
4
|
export interface createORPCClientOptions {
|
@@ -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
|
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;
|
11
11
|
//# sourceMappingURL=client.d.ts.map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { ClientOptions } from '@orpc/contract';
|
2
2
|
import type { Promisable } from '@orpc/shared';
|
3
3
|
import type { ClientLink } from './types';
|
4
4
|
/**
|
@@ -8,6 +8,6 @@ import type { ClientLink } from './types';
|
|
8
8
|
export declare class DynamicLink<TClientContext> implements ClientLink<TClientContext> {
|
9
9
|
private readonly linkResolver;
|
10
10
|
constructor(linkResolver: (path: readonly string[], input: unknown, context: TClientContext) => Promisable<ClientLink<TClientContext>>);
|
11
|
-
call(path: readonly string[], input: unknown, options:
|
11
|
+
call(path: readonly string[], input: unknown, options: ClientOptions<TClientContext>): Promise<unknown>;
|
12
12
|
}
|
13
13
|
//# sourceMappingURL=dynamic-link.d.ts.map
|
package/dist/src/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
1
|
+
import type { ClientOptions } from '@orpc/contract';
|
2
2
|
export interface ClientLink<TClientContext> {
|
3
|
-
call: (path: readonly string[], input: unknown, options:
|
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.
|
4
|
+
"version": "0.30.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.
|
38
|
-
"@orpc/
|
39
|
-
"@orpc/
|
37
|
+
"@orpc/contract": "0.30.0",
|
38
|
+
"@orpc/shared": "0.30.0",
|
39
|
+
"@orpc/server": "0.30.0"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"zod": "^3.24.1",
|
43
|
-
"@orpc/openapi": "0.
|
43
|
+
"@orpc/openapi": "0.30.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'",
|