@orpc/client 0.0.0-next.9588d75 → 0.0.0-next.96f9dd3
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/README.md +101 -0
- package/dist/adapters/fetch/index.d.mts +26 -0
- package/dist/adapters/fetch/index.d.ts +26 -0
- package/dist/adapters/fetch/index.mjs +32 -0
- package/dist/adapters/standard/index.d.mts +10 -0
- package/dist/adapters/standard/index.d.ts +10 -0
- package/dist/adapters/standard/index.mjs +4 -0
- package/dist/index.d.mts +155 -0
- package/dist/index.d.ts +155 -0
- package/dist/index.mjs +65 -0
- package/dist/plugins/index.d.mts +112 -0
- package/dist/plugins/index.d.ts +112 -0
- package/dist/plugins/index.mjs +256 -0
- package/dist/shared/client.BhQShZ_Q.mjs +337 -0
- package/dist/shared/client.C7z5zk4v.d.mts +40 -0
- package/dist/shared/client.CDvsX60w.d.ts +87 -0
- package/dist/shared/client.CRWEpqLB.mjs +175 -0
- package/dist/shared/client.CUq1_W_X.d.mts +87 -0
- package/dist/shared/client.CipPQkhk.d.mts +29 -0
- package/dist/shared/client.CipPQkhk.d.ts +29 -0
- package/dist/shared/client.p3ON_yzu.d.ts +40 -0
- package/package.json +23 -16
- package/dist/index.js +0 -78
- package/dist/src/index.d.ts +0 -7
- package/dist/src/procedure-fetch-client.d.ts +0 -24
- package/dist/src/router-fetch-client.d.ts +0 -6
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { a as ClientContext, b as ClientOptions, d as HTTPMethod } from './client.CipPQkhk.mjs';
|
|
2
|
+
import { e as StandardLinkCodec, b as StandardLinkOptions } from './client.C7z5zk4v.mjs';
|
|
3
|
+
import { Segment, Value } from '@orpc/shared';
|
|
4
|
+
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
5
|
+
|
|
6
|
+
declare const STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES: {
|
|
7
|
+
readonly BIGINT: 0;
|
|
8
|
+
readonly DATE: 1;
|
|
9
|
+
readonly NAN: 2;
|
|
10
|
+
readonly UNDEFINED: 3;
|
|
11
|
+
readonly URL: 4;
|
|
12
|
+
readonly REGEXP: 5;
|
|
13
|
+
readonly SET: 6;
|
|
14
|
+
readonly MAP: 7;
|
|
15
|
+
};
|
|
16
|
+
type StandardRPCJsonSerializedMetaItem = readonly [type: number, ...path: Segment[]];
|
|
17
|
+
type StandardRPCJsonSerialized = [json: unknown, meta: StandardRPCJsonSerializedMetaItem[], maps: Segment[][], blobs: Blob[]];
|
|
18
|
+
interface StandardRPCCustomJsonSerializer {
|
|
19
|
+
type: number;
|
|
20
|
+
condition(data: unknown): boolean;
|
|
21
|
+
serialize(data: any): unknown;
|
|
22
|
+
deserialize(serialized: any): unknown;
|
|
23
|
+
}
|
|
24
|
+
interface StandardRPCJsonSerializerOptions {
|
|
25
|
+
customJsonSerializers?: readonly StandardRPCCustomJsonSerializer[];
|
|
26
|
+
}
|
|
27
|
+
declare class StandardRPCJsonSerializer {
|
|
28
|
+
private readonly customSerializers;
|
|
29
|
+
constructor(options?: StandardRPCJsonSerializerOptions);
|
|
30
|
+
serialize(data: unknown, segments?: Segment[], meta?: StandardRPCJsonSerializedMetaItem[], maps?: Segment[][], blobs?: Blob[]): StandardRPCJsonSerialized;
|
|
31
|
+
deserialize(json: unknown, meta: readonly StandardRPCJsonSerializedMetaItem[]): unknown;
|
|
32
|
+
deserialize(json: unknown, meta: readonly StandardRPCJsonSerializedMetaItem[], maps: readonly Segment[][], getBlob: (index: number) => Blob): unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class StandardRPCSerializer {
|
|
36
|
+
#private;
|
|
37
|
+
private readonly jsonSerializer;
|
|
38
|
+
constructor(jsonSerializer: StandardRPCJsonSerializer);
|
|
39
|
+
serialize(data: unknown): object;
|
|
40
|
+
deserialize(data: unknown): unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface StandardRPCLinkCodecOptions<T extends ClientContext> {
|
|
44
|
+
/**
|
|
45
|
+
* Base url for all requests.
|
|
46
|
+
*/
|
|
47
|
+
url: Value<string | URL, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
|
48
|
+
/**
|
|
49
|
+
* The maximum length of the URL.
|
|
50
|
+
*
|
|
51
|
+
* @default 2083
|
|
52
|
+
*/
|
|
53
|
+
maxUrlLength?: Value<number, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
|
54
|
+
/**
|
|
55
|
+
* The method used to make the request.
|
|
56
|
+
*
|
|
57
|
+
* @default 'POST'
|
|
58
|
+
*/
|
|
59
|
+
method?: Value<HTTPMethod, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
|
60
|
+
/**
|
|
61
|
+
* The method to use when the payload cannot safely pass to the server with method return from method function.
|
|
62
|
+
* GET is not allowed, it's very dangerous.
|
|
63
|
+
*
|
|
64
|
+
* @default 'POST'
|
|
65
|
+
*/
|
|
66
|
+
fallbackMethod?: Exclude<HTTPMethod, 'GET'>;
|
|
67
|
+
/**
|
|
68
|
+
* Inject headers to the request.
|
|
69
|
+
*/
|
|
70
|
+
headers?: Value<StandardHeaders, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
|
71
|
+
}
|
|
72
|
+
declare class StandardRPCLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
73
|
+
private readonly serializer;
|
|
74
|
+
private readonly baseUrl;
|
|
75
|
+
private readonly maxUrlLength;
|
|
76
|
+
private readonly fallbackMethod;
|
|
77
|
+
private readonly expectedMethod;
|
|
78
|
+
private readonly headers;
|
|
79
|
+
constructor(serializer: StandardRPCSerializer, options: StandardRPCLinkCodecOptions<T>);
|
|
80
|
+
encode(path: readonly string[], input: unknown, options: ClientOptions<T>): Promise<StandardRequest>;
|
|
81
|
+
decode(response: StandardLazyResponse): Promise<unknown>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface StandardRPCLinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardRPCLinkCodecOptions<T>, StandardRPCJsonSerializerOptions {
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES as S, type StandardRPCJsonSerializedMetaItem as a, type StandardRPCJsonSerialized as b, type StandardRPCCustomJsonSerializer as c, type StandardRPCJsonSerializerOptions as d, StandardRPCJsonSerializer as e, type StandardRPCLinkOptions as f, type StandardRPCLinkCodecOptions as g, StandardRPCLinkCodec as h, StandardRPCSerializer as i };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PromiseWithError } from '@orpc/shared';
|
|
2
|
+
|
|
3
|
+
type HTTPPath = `/${string}`;
|
|
4
|
+
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
5
|
+
type ClientContext = Record<PropertyKey, any>;
|
|
6
|
+
interface ClientOptions<T extends ClientContext> {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
lastEventId?: string | undefined;
|
|
9
|
+
context: T;
|
|
10
|
+
}
|
|
11
|
+
type FriendlyClientOptions<T extends ClientContext> = Omit<ClientOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
|
12
|
+
context?: T;
|
|
13
|
+
} : {
|
|
14
|
+
context: T;
|
|
15
|
+
});
|
|
16
|
+
type ClientRest<TClientContext extends ClientContext, TInput> = Record<never, never> extends TClientContext ? undefined extends TInput ? [input?: TInput, options?: FriendlyClientOptions<TClientContext>] : [input: TInput, options?: FriendlyClientOptions<TClientContext>] : [input: TInput, options: FriendlyClientOptions<TClientContext>];
|
|
17
|
+
type ClientPromiseResult<TOutput, TError> = PromiseWithError<TOutput, TError>;
|
|
18
|
+
interface Client<TClientContext extends ClientContext, TInput, TOutput, TError> {
|
|
19
|
+
(...rest: ClientRest<TClientContext, TInput>): ClientPromiseResult<TOutput, TError>;
|
|
20
|
+
}
|
|
21
|
+
type NestedClient<TClientContext extends ClientContext> = Client<TClientContext, any, any, any> | {
|
|
22
|
+
[k: string]: NestedClient<TClientContext>;
|
|
23
|
+
};
|
|
24
|
+
type InferClientContext<T extends NestedClient<any>> = T extends NestedClient<infer U> ? U : never;
|
|
25
|
+
interface ClientLink<TClientContext extends ClientContext> {
|
|
26
|
+
call: (path: readonly string[], input: unknown, options: ClientOptions<TClientContext>) => Promise<unknown>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { ClientLink as C, FriendlyClientOptions as F, HTTPPath as H, InferClientContext as I, NestedClient as N, ClientContext as a, ClientOptions as b, ClientPromiseResult as c, HTTPMethod as d, ClientRest as e, Client as f };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PromiseWithError } from '@orpc/shared';
|
|
2
|
+
|
|
3
|
+
type HTTPPath = `/${string}`;
|
|
4
|
+
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
5
|
+
type ClientContext = Record<PropertyKey, any>;
|
|
6
|
+
interface ClientOptions<T extends ClientContext> {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
lastEventId?: string | undefined;
|
|
9
|
+
context: T;
|
|
10
|
+
}
|
|
11
|
+
type FriendlyClientOptions<T extends ClientContext> = Omit<ClientOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
|
12
|
+
context?: T;
|
|
13
|
+
} : {
|
|
14
|
+
context: T;
|
|
15
|
+
});
|
|
16
|
+
type ClientRest<TClientContext extends ClientContext, TInput> = Record<never, never> extends TClientContext ? undefined extends TInput ? [input?: TInput, options?: FriendlyClientOptions<TClientContext>] : [input: TInput, options?: FriendlyClientOptions<TClientContext>] : [input: TInput, options: FriendlyClientOptions<TClientContext>];
|
|
17
|
+
type ClientPromiseResult<TOutput, TError> = PromiseWithError<TOutput, TError>;
|
|
18
|
+
interface Client<TClientContext extends ClientContext, TInput, TOutput, TError> {
|
|
19
|
+
(...rest: ClientRest<TClientContext, TInput>): ClientPromiseResult<TOutput, TError>;
|
|
20
|
+
}
|
|
21
|
+
type NestedClient<TClientContext extends ClientContext> = Client<TClientContext, any, any, any> | {
|
|
22
|
+
[k: string]: NestedClient<TClientContext>;
|
|
23
|
+
};
|
|
24
|
+
type InferClientContext<T extends NestedClient<any>> = T extends NestedClient<infer U> ? U : never;
|
|
25
|
+
interface ClientLink<TClientContext extends ClientContext> {
|
|
26
|
+
call: (path: readonly string[], input: unknown, options: ClientOptions<TClientContext>) => Promise<unknown>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { ClientLink as C, FriendlyClientOptions as F, HTTPPath as H, InferClientContext as I, NestedClient as N, ClientContext as a, ClientOptions as b, ClientPromiseResult as c, HTTPMethod as d, ClientRest as e, Client as f };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Interceptor, ThrowableError } from '@orpc/shared';
|
|
2
|
+
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
3
|
+
import { a as ClientContext, b as ClientOptions, C as ClientLink } from './client.CipPQkhk.js';
|
|
4
|
+
|
|
5
|
+
interface StandardLinkCodec<T extends ClientContext> {
|
|
6
|
+
encode(path: readonly string[], input: unknown, options: ClientOptions<T>): Promise<StandardRequest>;
|
|
7
|
+
decode(response: StandardLazyResponse, options: ClientOptions<T>, path: readonly string[], input: unknown): Promise<unknown>;
|
|
8
|
+
}
|
|
9
|
+
interface StandardLinkClient<T extends ClientContext> {
|
|
10
|
+
call(request: StandardRequest, options: ClientOptions<T>, path: readonly string[], input: unknown): Promise<StandardLazyResponse>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class InvalidEventIteratorRetryResponse extends Error {
|
|
14
|
+
}
|
|
15
|
+
interface StandardLinkPlugin<T extends ClientContext> {
|
|
16
|
+
init?(options: StandardLinkOptions<T>): void;
|
|
17
|
+
}
|
|
18
|
+
interface StandardLinkInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
|
|
19
|
+
path: readonly string[];
|
|
20
|
+
input: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface StandardLinkClientInterceptorOptions<T extends ClientContext> extends StandardLinkInterceptorOptions<T> {
|
|
23
|
+
request: StandardRequest;
|
|
24
|
+
}
|
|
25
|
+
interface StandardLinkOptions<T extends ClientContext> {
|
|
26
|
+
interceptors?: Interceptor<StandardLinkInterceptorOptions<T>, unknown, ThrowableError>[];
|
|
27
|
+
clientInterceptors?: Interceptor<StandardLinkClientInterceptorOptions<T>, StandardLazyResponse, ThrowableError>[];
|
|
28
|
+
plugins?: StandardLinkPlugin<T>[];
|
|
29
|
+
}
|
|
30
|
+
declare class StandardLink<T extends ClientContext> implements ClientLink<T> {
|
|
31
|
+
#private;
|
|
32
|
+
readonly codec: StandardLinkCodec<T>;
|
|
33
|
+
readonly sender: StandardLinkClient<T>;
|
|
34
|
+
private readonly interceptors;
|
|
35
|
+
private readonly clientInterceptors;
|
|
36
|
+
constructor(codec: StandardLinkCodec<T>, sender: StandardLinkClient<T>, options?: StandardLinkOptions<T>);
|
|
37
|
+
call(path: readonly string[], input: unknown, options: ClientOptions<T>): Promise<unknown>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { InvalidEventIteratorRetryResponse as I, type StandardLinkClientInterceptorOptions as S, type StandardLinkPlugin as a, type StandardLinkOptions as b, type StandardLinkInterceptorOptions as c, StandardLink as d, type StandardLinkCodec as e, type StandardLinkClient as f };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.96f9dd3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -15,32 +15,39 @@
|
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"import": "./dist/index.
|
|
20
|
-
"default": "./dist/index.
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"default": "./dist/index.mjs"
|
|
21
21
|
},
|
|
22
|
-
"
|
|
23
|
-
"types": "./dist/
|
|
22
|
+
"./plugins": {
|
|
23
|
+
"types": "./dist/plugins/index.d.mts",
|
|
24
|
+
"import": "./dist/plugins/index.mjs",
|
|
25
|
+
"default": "./dist/plugins/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./standard": {
|
|
28
|
+
"types": "./dist/adapters/standard/index.d.mts",
|
|
29
|
+
"import": "./dist/adapters/standard/index.mjs",
|
|
30
|
+
"default": "./dist/adapters/standard/index.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./fetch": {
|
|
33
|
+
"types": "./dist/adapters/fetch/index.d.mts",
|
|
34
|
+
"import": "./dist/adapters/fetch/index.mjs",
|
|
35
|
+
"default": "./dist/adapters/fetch/index.mjs"
|
|
24
36
|
}
|
|
25
37
|
},
|
|
26
38
|
"files": [
|
|
27
|
-
"!**/*.map",
|
|
28
|
-
"!**/*.tsbuildinfo",
|
|
29
39
|
"dist"
|
|
30
40
|
],
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"@orpc/contract": "0.0.0-next.9588d75"
|
|
33
|
-
},
|
|
34
41
|
"dependencies": {
|
|
35
|
-
"@orpc/
|
|
36
|
-
"@orpc/
|
|
42
|
+
"@orpc/shared": "0.0.0-next.96f9dd3",
|
|
43
|
+
"@orpc/standard-server": "0.0.0-next.96f9dd3",
|
|
44
|
+
"@orpc/standard-server-fetch": "0.0.0-next.96f9dd3"
|
|
37
45
|
},
|
|
38
46
|
"devDependencies": {
|
|
39
|
-
"zod": "^3.24.
|
|
40
|
-
"@orpc/openapi": "0.0.0-next.9588d75"
|
|
47
|
+
"zod": "^3.24.2"
|
|
41
48
|
},
|
|
42
49
|
"scripts": {
|
|
43
|
-
"build": "
|
|
50
|
+
"build": "unbuild",
|
|
44
51
|
"build:watch": "pnpm run build --watch",
|
|
45
52
|
"type:check": "tsc -b"
|
|
46
53
|
}
|
package/dist/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// src/procedure-fetch-client.ts
|
|
2
|
-
import { ORPCPayloadCodec } from "@orpc/server/fetch";
|
|
3
|
-
import { ORPC_HANDLER_HEADER, ORPC_HANDLER_VALUE, trim } from "@orpc/shared";
|
|
4
|
-
import { ORPCError } from "@orpc/shared/error";
|
|
5
|
-
var payloadCodec = new ORPCPayloadCodec();
|
|
6
|
-
function createProcedureFetchClient(options) {
|
|
7
|
-
const client = async (...[input, callerOptions]) => {
|
|
8
|
-
const fetchClient = options.fetch ?? fetch;
|
|
9
|
-
const url = `${trim(options.baseURL, "/")}/${options.path.map(encodeURIComponent).join("/")}`;
|
|
10
|
-
const encoded = payloadCodec.encode(input);
|
|
11
|
-
const headers = new Headers(encoded.headers);
|
|
12
|
-
headers.append(ORPC_HANDLER_HEADER, ORPC_HANDLER_VALUE);
|
|
13
|
-
let customHeaders = await options.headers?.(input);
|
|
14
|
-
customHeaders = customHeaders instanceof Headers ? customHeaders : new Headers(customHeaders);
|
|
15
|
-
for (const [key, value] of customHeaders.entries()) {
|
|
16
|
-
headers.append(key, value);
|
|
17
|
-
}
|
|
18
|
-
const response = await fetchClient(url, {
|
|
19
|
-
method: "POST",
|
|
20
|
-
headers,
|
|
21
|
-
body: encoded.body,
|
|
22
|
-
signal: callerOptions?.signal
|
|
23
|
-
});
|
|
24
|
-
const json = await (async () => {
|
|
25
|
-
try {
|
|
26
|
-
return await payloadCodec.decode(response);
|
|
27
|
-
} catch (e) {
|
|
28
|
-
throw new ORPCError({
|
|
29
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
30
|
-
message: "Cannot parse response.",
|
|
31
|
-
cause: e
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
})();
|
|
35
|
-
if (!response.ok) {
|
|
36
|
-
throw ORPCError.fromJSON(json) ?? new ORPCError({
|
|
37
|
-
status: response.status,
|
|
38
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
39
|
-
message: "Internal server error"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return json;
|
|
43
|
-
};
|
|
44
|
-
return client;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/router-fetch-client.ts
|
|
48
|
-
function createRouterFetchClient(options) {
|
|
49
|
-
const path = options?.path ?? [];
|
|
50
|
-
const client = new Proxy(
|
|
51
|
-
createProcedureFetchClient({
|
|
52
|
-
...options,
|
|
53
|
-
path
|
|
54
|
-
}),
|
|
55
|
-
{
|
|
56
|
-
get(target, key) {
|
|
57
|
-
if (typeof key !== "string") {
|
|
58
|
-
return Reflect.get(target, key);
|
|
59
|
-
}
|
|
60
|
-
return createRouterFetchClient({
|
|
61
|
-
...options,
|
|
62
|
-
path: [...path, key]
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
return client;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/index.ts
|
|
71
|
-
export * from "@orpc/shared/error";
|
|
72
|
-
var createORPCFetchClient = createRouterFetchClient;
|
|
73
|
-
export {
|
|
74
|
-
createORPCFetchClient,
|
|
75
|
-
createProcedureFetchClient,
|
|
76
|
-
createRouterFetchClient
|
|
77
|
-
};
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** unnoq */
|
|
2
|
-
import { createRouterFetchClient } from './router-fetch-client';
|
|
3
|
-
export * from './procedure-fetch-client';
|
|
4
|
-
export * from './router-fetch-client';
|
|
5
|
-
export * from '@orpc/shared/error';
|
|
6
|
-
export declare const createORPCFetchClient: typeof createRouterFetchClient;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ProcedureClient } from '@orpc/server';
|
|
2
|
-
import type { Promisable } from '@orpc/shared';
|
|
3
|
-
export interface CreateProcedureClientOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The base url of the server.
|
|
6
|
-
*/
|
|
7
|
-
baseURL: string;
|
|
8
|
-
/**
|
|
9
|
-
* The fetch function used to make the request.
|
|
10
|
-
* @default global fetch
|
|
11
|
-
*/
|
|
12
|
-
fetch?: typeof fetch;
|
|
13
|
-
/**
|
|
14
|
-
* The headers used to make the request.
|
|
15
|
-
* Invoked before the request is made.
|
|
16
|
-
*/
|
|
17
|
-
headers?: (input: unknown) => Promisable<Headers | Record<string, string>>;
|
|
18
|
-
/**
|
|
19
|
-
* The path of the procedure on server.
|
|
20
|
-
*/
|
|
21
|
-
path: string[];
|
|
22
|
-
}
|
|
23
|
-
export declare function createProcedureFetchClient<TInput, TOutput>(options: CreateProcedureClientOptions): ProcedureClient<TInput, TOutput>;
|
|
24
|
-
//# sourceMappingURL=procedure-fetch-client.d.ts.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ContractRouter } from '@orpc/contract';
|
|
2
|
-
import type { ANY_ROUTER, RouterClient } from '@orpc/server';
|
|
3
|
-
import type { SetOptional } from '@orpc/shared';
|
|
4
|
-
import type { CreateProcedureClientOptions } from './procedure-fetch-client';
|
|
5
|
-
export declare function createRouterFetchClient<T extends ANY_ROUTER | ContractRouter>(options: SetOptional<CreateProcedureClientOptions, 'path'>): RouterClient<T>;
|
|
6
|
-
//# sourceMappingURL=router-fetch-client.d.ts.map
|