@orpc/server 0.0.0-next.eae6003 → 0.0.0-next.eaf61c7
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 +4 -6
- package/dist/adapters/aws-lambda/index.d.mts +45 -0
- package/dist/adapters/aws-lambda/index.d.ts +45 -0
- package/dist/adapters/aws-lambda/index.mjs +41 -0
- package/dist/adapters/bun-ws/index.d.mts +4 -4
- package/dist/adapters/bun-ws/index.d.ts +4 -4
- package/dist/adapters/bun-ws/index.mjs +4 -9
- package/dist/adapters/crossws/index.d.mts +4 -4
- package/dist/adapters/crossws/index.d.ts +4 -4
- package/dist/adapters/crossws/index.mjs +4 -9
- package/dist/adapters/fetch/index.d.mts +6 -6
- package/dist/adapters/fetch/index.d.ts +6 -6
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/message-port/index.d.mts +28 -0
- package/dist/adapters/message-port/index.d.ts +28 -0
- package/dist/adapters/message-port/index.mjs +41 -0
- package/dist/adapters/node/index.d.mts +6 -6
- package/dist/adapters/node/index.d.ts +6 -6
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.d.mts +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/adapters/websocket/index.d.mts +30 -6
- package/dist/adapters/websocket/index.d.ts +30 -6
- package/dist/adapters/websocket/index.mjs +46 -15
- package/dist/adapters/ws/index.d.mts +4 -4
- package/dist/adapters/ws/index.d.ts +4 -4
- package/dist/adapters/ws/index.mjs +4 -3
- package/dist/hibernation/index.d.mts +44 -0
- package/dist/hibernation/index.d.ts +44 -0
- package/dist/hibernation/index.mjs +65 -0
- package/dist/index.d.mts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.mjs +21 -7
- package/dist/plugins/index.d.mts +13 -13
- package/dist/plugins/index.d.ts +13 -13
- package/dist/plugins/index.mjs +5 -3
- package/dist/shared/{server.YZzrREz9.d.ts → server.-ACo36I0.d.ts} +6 -6
- package/dist/shared/{server.Cy1vfSiG.d.ts → server.BPAWobQg.d.ts} +2 -2
- package/dist/shared/{server.BRoxSiSC.d.mts → server.Bd52nNaH.d.mts} +2 -2
- package/dist/shared/{server.QUe9N8P4.d.mts → server.BliFSTnG.d.mts} +2 -2
- package/dist/shared/{server.4FnxLwwr.mjs → server.CHvOkcM3.mjs} +2 -2
- package/dist/shared/{server.DPWk5pjW.d.mts → server.DD2C4ujN.d.mts} +4 -4
- package/dist/shared/{server.DPWk5pjW.d.ts → server.DD2C4ujN.d.ts} +4 -4
- package/dist/shared/{server.BVwwTHyO.mjs → server.DZ5BIITo.mjs} +1 -1
- package/dist/shared/{server.eWLxY3lq.d.mts → server.Dq8xr7PQ.d.mts} +6 -6
- package/dist/shared/{server.BjiJH9Vo.d.ts → server.IG2MjhrD.d.ts} +2 -2
- package/package.json +25 -9
@@ -1,17 +1,40 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
-
import { C as Context, R as Router } from '../../shared/server.
|
3
|
-
import { i as StandardHandler } from '../../shared/server.
|
4
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
5
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.js';
|
3
|
+
import { i as StandardHandler } from '../../shared/server.-ACo36I0.js';
|
4
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.IG2MjhrD.js';
|
5
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BPAWobQg.js';
|
6
6
|
import '@orpc/client';
|
7
7
|
import '@orpc/contract';
|
8
8
|
import '@orpc/standard-server';
|
9
9
|
import '@orpc/client/standard';
|
10
10
|
|
11
|
+
type experimental_MinimalWebsocket = Pick<WebSocket, 'addEventListener' | 'send'>;
|
11
12
|
declare class experimental_WebsocketHandler<T extends Context> {
|
12
|
-
private
|
13
|
+
#private;
|
13
14
|
constructor(standardHandler: StandardHandler<T>);
|
14
|
-
|
15
|
+
/**
|
16
|
+
* Upgrades a WebSocket to enable handling
|
17
|
+
*
|
18
|
+
* This attaches the necessary 'message' and 'close' listeners to the WebSocket
|
19
|
+
*
|
20
|
+
* @warning Do not use this method if you're using `.message()` or `.close()`
|
21
|
+
*/
|
22
|
+
upgrade(ws: experimental_MinimalWebsocket, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): void;
|
23
|
+
/**
|
24
|
+
* Handles a single message received from a WebSocket.
|
25
|
+
*
|
26
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
27
|
+
*
|
28
|
+
* @param ws The WebSocket instance
|
29
|
+
* @param data The message payload, usually place in `event.data`
|
30
|
+
*/
|
31
|
+
message(ws: experimental_MinimalWebsocket, data: string | ArrayBuffer | Blob, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): Promise<void>;
|
32
|
+
/**
|
33
|
+
* Closes the WebSocket peer and cleans up.
|
34
|
+
*
|
35
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
36
|
+
*/
|
37
|
+
close(ws: experimental_MinimalWebsocket): void;
|
15
38
|
}
|
16
39
|
|
17
40
|
/**
|
@@ -25,3 +48,4 @@ declare class experimental_RPCHandler<T extends Context> extends experimental_We
|
|
25
48
|
}
|
26
49
|
|
27
50
|
export { experimental_RPCHandler, experimental_WebsocketHandler };
|
51
|
+
export type { experimental_MinimalWebsocket };
|
@@ -1,31 +1,62 @@
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
4
4
|
import '@orpc/client';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
9
|
import '../../shared/server.DG7Tamti.mjs';
|
10
10
|
|
11
11
|
class experimental_WebsocketHandler {
|
12
|
+
#peers = /* @__PURE__ */ new WeakMap();
|
13
|
+
#handler;
|
12
14
|
constructor(standardHandler) {
|
13
|
-
this
|
15
|
+
this.#handler = standardHandler;
|
14
16
|
}
|
17
|
+
/**
|
18
|
+
* Upgrades a WebSocket to enable handling
|
19
|
+
*
|
20
|
+
* This attaches the necessary 'message' and 'close' listeners to the WebSocket
|
21
|
+
*
|
22
|
+
* @warning Do not use this method if you're using `.message()` or `.close()`
|
23
|
+
*/
|
15
24
|
upgrade(ws, ...rest) {
|
16
|
-
|
17
|
-
ws.addEventListener("
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
ws.addEventListener("message", (event) => this.message(ws, event.data, ...rest));
|
26
|
+
ws.addEventListener("close", () => this.close(ws));
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Handles a single message received from a WebSocket.
|
30
|
+
*
|
31
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
32
|
+
*
|
33
|
+
* @param ws The WebSocket instance
|
34
|
+
* @param data The message payload, usually place in `event.data`
|
35
|
+
*/
|
36
|
+
async message(ws, data, ...rest) {
|
37
|
+
let peer = this.#peers.get(ws);
|
38
|
+
if (!peer) {
|
39
|
+
this.#peers.set(ws, peer = new ServerPeer(ws.send.bind(ws)));
|
40
|
+
}
|
41
|
+
const message = data instanceof Blob ? await data.arrayBuffer() : data;
|
42
|
+
const [id, request] = await peer.message(message);
|
43
|
+
if (!request) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
47
|
+
const { response } = await this.#handler.handle({ ...request, body: () => Promise.resolve(request.body) }, options);
|
48
|
+
await peer.response(id, response ?? { status: 404, headers: {}, body: "No procedure matched" });
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* Closes the WebSocket peer and cleans up.
|
52
|
+
*
|
53
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
54
|
+
*/
|
55
|
+
close(ws) {
|
56
|
+
const peer = this.#peers.get(ws);
|
57
|
+
if (peer) {
|
27
58
|
peer.close();
|
28
|
-
}
|
59
|
+
}
|
29
60
|
}
|
30
61
|
}
|
31
62
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { WebSocket } from 'ws';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.mjs';
|
4
|
+
import { i as StandardHandler } from '../../shared/server.Dq8xr7PQ.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BliFSTnG.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.Bd52nNaH.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { WebSocket } from 'ws';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.js';
|
4
|
+
import { i as StandardHandler } from '../../shared/server.-ACo36I0.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.IG2MjhrD.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BPAWobQg.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
4
4
|
import '@orpc/client';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
9
|
import '../../shared/server.DG7Tamti.mjs';
|
10
10
|
|
@@ -15,7 +15,8 @@ class experimental_WsHandler {
|
|
15
15
|
async upgrade(ws, ...rest) {
|
16
16
|
const peer = new ServerPeer(ws.send.bind(ws));
|
17
17
|
ws.addEventListener("message", async (event) => {
|
18
|
-
const
|
18
|
+
const message = Array.isArray(event.data) ? await new Blob(event.data).arrayBuffer() : event.data;
|
19
|
+
const [id, request] = await peer.message(message);
|
19
20
|
if (!request) {
|
20
21
|
return;
|
21
22
|
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
+
import { a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.Dq8xr7PQ.mjs';
|
3
|
+
import { experimental_HibernationEventIterator } from '@orpc/standard-server';
|
4
|
+
export { experimental_HibernationEventIterator, experimental_HibernationEventIteratorCallback } from '@orpc/standard-server';
|
5
|
+
import { C as Context, R as Router } from '../shared/server.DD2C4ujN.mjs';
|
6
|
+
import '@orpc/client';
|
7
|
+
import '@orpc/contract';
|
8
|
+
import '@orpc/shared';
|
9
|
+
|
10
|
+
interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
|
11
|
+
/**
|
12
|
+
* The type of event, each type corresponds a different operation
|
13
|
+
*
|
14
|
+
* - 'message' = 'yield'
|
15
|
+
* - 'error' = 'throw'
|
16
|
+
* - 'done' = 'return'
|
17
|
+
*
|
18
|
+
* @default 'message'
|
19
|
+
*/
|
20
|
+
event?: 'message' | 'error' | 'done';
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Encodes a Hibernation RPC Event
|
24
|
+
*
|
25
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
26
|
+
*/
|
27
|
+
declare function experimental_encodeHibernationRPCEvent(id: number, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
|
28
|
+
|
29
|
+
interface experimental_HibernationContext {
|
30
|
+
iterator?: experimental_HibernationEventIterator<any>;
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Enable Hibernation APIs
|
34
|
+
*
|
35
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
36
|
+
*/
|
37
|
+
declare class experimental_HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
38
|
+
readonly HIBERNATION_CONTEXT_SYMBOL: symbol;
|
39
|
+
order: number;
|
40
|
+
init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
|
41
|
+
}
|
42
|
+
|
43
|
+
export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
|
44
|
+
export type { experimental_EncodeHibernationRPCEventOptions, experimental_HibernationContext };
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
+
import { a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.-ACo36I0.js';
|
3
|
+
import { experimental_HibernationEventIterator } from '@orpc/standard-server';
|
4
|
+
export { experimental_HibernationEventIterator, experimental_HibernationEventIteratorCallback } from '@orpc/standard-server';
|
5
|
+
import { C as Context, R as Router } from '../shared/server.DD2C4ujN.js';
|
6
|
+
import '@orpc/client';
|
7
|
+
import '@orpc/contract';
|
8
|
+
import '@orpc/shared';
|
9
|
+
|
10
|
+
interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
|
11
|
+
/**
|
12
|
+
* The type of event, each type corresponds a different operation
|
13
|
+
*
|
14
|
+
* - 'message' = 'yield'
|
15
|
+
* - 'error' = 'throw'
|
16
|
+
* - 'done' = 'return'
|
17
|
+
*
|
18
|
+
* @default 'message'
|
19
|
+
*/
|
20
|
+
event?: 'message' | 'error' | 'done';
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Encodes a Hibernation RPC Event
|
24
|
+
*
|
25
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
26
|
+
*/
|
27
|
+
declare function experimental_encodeHibernationRPCEvent(id: number, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
|
28
|
+
|
29
|
+
interface experimental_HibernationContext {
|
30
|
+
iterator?: experimental_HibernationEventIterator<any>;
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Enable Hibernation APIs
|
34
|
+
*
|
35
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
36
|
+
*/
|
37
|
+
declare class experimental_HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
38
|
+
readonly HIBERNATION_CONTEXT_SYMBOL: symbol;
|
39
|
+
order: number;
|
40
|
+
init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
|
41
|
+
}
|
42
|
+
|
43
|
+
export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
|
44
|
+
export type { experimental_EncodeHibernationRPCEventOptions, experimental_HibernationContext };
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { toORPCError } from '@orpc/client';
|
2
|
+
import { StandardRPCJsonSerializer } from '@orpc/client/standard';
|
3
|
+
import { stringifyJSON } from '@orpc/shared';
|
4
|
+
import { getEventMeta, experimental_HibernationEventIterator } from '@orpc/standard-server';
|
5
|
+
export { experimental_HibernationEventIterator } from '@orpc/standard-server';
|
6
|
+
import { MessageType } from '@orpc/standard-server-peer';
|
7
|
+
|
8
|
+
function experimental_encodeHibernationRPCEvent(id, payload, options = {}) {
|
9
|
+
const { event = "message", ...rest } = options;
|
10
|
+
const serializer = new StandardRPCJsonSerializer(rest);
|
11
|
+
const data = event === "error" ? toORPCError(payload).toJSON() : payload;
|
12
|
+
const [json, meta] = serializer.serialize(data);
|
13
|
+
return stringifyJSON({
|
14
|
+
i: id,
|
15
|
+
t: MessageType.EVENT_ITERATOR,
|
16
|
+
p: {
|
17
|
+
e: event,
|
18
|
+
d: { json, meta: meta.length > 0 ? meta : void 0 },
|
19
|
+
m: getEventMeta(payload)
|
20
|
+
}
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
class experimental_HibernationPlugin {
|
25
|
+
HIBERNATION_CONTEXT_SYMBOL = Symbol("HIBERNATION_CONTEXT");
|
26
|
+
order = 2e6;
|
27
|
+
// make sure execute after the batch plugin
|
28
|
+
init(options, _router) {
|
29
|
+
options.interceptors ??= [];
|
30
|
+
options.clientInterceptors ??= [];
|
31
|
+
options.interceptors.unshift(async (options2) => {
|
32
|
+
const hibernationContext = {};
|
33
|
+
const result = await options2.next({
|
34
|
+
...options2,
|
35
|
+
context: {
|
36
|
+
[this.HIBERNATION_CONTEXT_SYMBOL]: hibernationContext,
|
37
|
+
...options2.context
|
38
|
+
}
|
39
|
+
});
|
40
|
+
if (!result.matched || !hibernationContext.iterator) {
|
41
|
+
return result;
|
42
|
+
}
|
43
|
+
return {
|
44
|
+
...result,
|
45
|
+
response: {
|
46
|
+
...result.response,
|
47
|
+
body: hibernationContext.iterator
|
48
|
+
}
|
49
|
+
};
|
50
|
+
});
|
51
|
+
options.clientInterceptors.unshift(async (options2) => {
|
52
|
+
const hibernationContext = options2.context[this.HIBERNATION_CONTEXT_SYMBOL];
|
53
|
+
if (!hibernationContext) {
|
54
|
+
throw new TypeError("[HibernationPlugin] Hibernation context has been corrupted or modified by another plugin or interceptor");
|
55
|
+
}
|
56
|
+
const output = await options2.next();
|
57
|
+
if (output instanceof experimental_HibernationEventIterator) {
|
58
|
+
hibernationContext.iterator = output;
|
59
|
+
}
|
60
|
+
return output;
|
61
|
+
});
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
|
package/dist/index.d.mts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, ClientPromiseResult } from '@orpc/client';
|
1
|
+
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientPromiseResult } from '@orpc/client';
|
2
2
|
export { ClientContext, HTTPMethod, HTTPPath, ORPCError, isDefinedError, safe } from '@orpc/client';
|
3
3
|
import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErrorMap, Meta, MergedErrorMap, Route, EnhanceRouteOptions, AnyContractRouter, AnyContractProcedure, Schema, ContractRouter, ContractProcedureDef, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta } from '@orpc/contract';
|
4
4
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
6
|
-
export { IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
-
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.
|
8
|
-
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.
|
6
|
+
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.DD2C4ujN.mjs';
|
8
|
+
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.DD2C4ujN.mjs';
|
9
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
10
10
|
|
11
11
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
@@ -789,6 +789,11 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
789
789
|
} & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
|
790
790
|
declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T, config?: BuilderConfig): Implementer<T, TContext, TContext>;
|
791
791
|
|
792
|
+
/**
|
793
|
+
* Help RPCLink automatically send requests using the specified HTTP method in the router.
|
794
|
+
*/
|
795
|
+
declare function inferRPCMethodFromRouter(router: AnyRouter): (options: unknown, path: readonly string[]) => Promise<Exclude<HTTPMethod, 'HEAD'>>;
|
796
|
+
|
792
797
|
declare function isStartWithMiddlewares(middlewares: readonly AnyMiddleware[], compare: readonly AnyMiddleware[]): boolean;
|
793
798
|
declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: readonly AnyMiddleware[], options: {
|
794
799
|
dedupeLeading: boolean;
|
@@ -825,5 +830,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
|
|
825
830
|
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
826
831
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
827
832
|
|
828
|
-
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createActionableClient, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, fallbackConfig, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
833
|
+
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createActionableClient, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, fallbackConfig, getHiddenRouterContract, getRouter, implement, implementerInternal, inferRPCMethodFromRouter, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
829
834
|
export type { AccessibleLazyRouter, ActionableClient, ActionableClientRest, ActionableClientResult, ActionableError, BuilderConfig, BuilderDef, BuilderWithMiddlewares, Config, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureActionableClient, ProcedureBuilder, ProcedureBuilderWithInput, ProcedureBuilderWithInputOutput, ProcedureBuilderWithOutput, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProceduresOptions, UnactionableError, UnlaziedRouter };
|
package/dist/index.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, ClientPromiseResult } from '@orpc/client';
|
1
|
+
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientPromiseResult } from '@orpc/client';
|
2
2
|
export { ClientContext, HTTPMethod, HTTPPath, ORPCError, isDefinedError, safe } from '@orpc/client';
|
3
3
|
import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErrorMap, Meta, MergedErrorMap, Route, EnhanceRouteOptions, AnyContractRouter, AnyContractProcedure, Schema, ContractRouter, ContractProcedureDef, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta } from '@orpc/contract';
|
4
4
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
6
|
-
export { IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
-
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.
|
8
|
-
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.
|
6
|
+
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.DD2C4ujN.js';
|
8
|
+
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.DD2C4ujN.js';
|
9
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
10
10
|
|
11
11
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
@@ -789,6 +789,11 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
789
789
|
} & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
|
790
790
|
declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T, config?: BuilderConfig): Implementer<T, TContext, TContext>;
|
791
791
|
|
792
|
+
/**
|
793
|
+
* Help RPCLink automatically send requests using the specified HTTP method in the router.
|
794
|
+
*/
|
795
|
+
declare function inferRPCMethodFromRouter(router: AnyRouter): (options: unknown, path: readonly string[]) => Promise<Exclude<HTTPMethod, 'HEAD'>>;
|
796
|
+
|
792
797
|
declare function isStartWithMiddlewares(middlewares: readonly AnyMiddleware[], compare: readonly AnyMiddleware[]): boolean;
|
793
798
|
declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: readonly AnyMiddleware[], options: {
|
794
799
|
dedupeLeading: boolean;
|
@@ -825,5 +830,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
|
|
825
830
|
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
826
831
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
827
832
|
|
828
|
-
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createActionableClient, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, fallbackConfig, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
833
|
+
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createActionableClient, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, fallbackConfig, getHiddenRouterContract, getRouter, implement, implementerInternal, inferRPCMethodFromRouter, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
829
834
|
export type { AccessibleLazyRouter, ActionableClient, ActionableClientRest, ActionableClientResult, ActionableError, BuilderConfig, BuilderDef, BuilderWithMiddlewares, Config, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureActionableClient, ProcedureBuilder, ProcedureBuilderWithInput, ProcedureBuilderWithInputOutput, ProcedureBuilderWithOutput, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProceduresOptions, UnactionableError, UnlaziedRouter };
|
package/dist/index.mjs
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter } from '@orpc/contract';
|
1
|
+
import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter, fallbackContractConfig } from '@orpc/contract';
|
2
2
|
export { ValidationError, eventIterator, type } from '@orpc/contract';
|
3
|
-
import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure
|
4
|
-
export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, w as resolveContractProcedures, t as traverseContractProcedures,
|
3
|
+
import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.DG7Tamti.mjs';
|
4
|
+
export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, w as resolveContractProcedures, t as traverseContractProcedures, x as unlazyRouter, v as validateORPCError } from './shared/server.DG7Tamti.mjs';
|
5
5
|
import { toORPCError } from '@orpc/client';
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
7
|
-
|
7
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
8
|
+
export { EventPublisher, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
8
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
9
10
|
|
10
11
|
const DEFAULT_CONFIG = {
|
@@ -447,12 +448,25 @@ function implement(contract, config = {}) {
|
|
447
448
|
return impl;
|
448
449
|
}
|
449
450
|
|
451
|
+
function inferRPCMethodFromRouter(router) {
|
452
|
+
return async (_, path) => {
|
453
|
+
const { default: procedure } = await unlazy(getRouter(router, path));
|
454
|
+
if (!isProcedure(procedure)) {
|
455
|
+
throw new Error(
|
456
|
+
`[inferRPCMethodFromRouter] No valid procedure found at path "${path.join(".")}". This may happen when the router is not properly configured.`
|
457
|
+
);
|
458
|
+
}
|
459
|
+
const method = fallbackContractConfig("defaultMethod", procedure["~orpc"].route.method);
|
460
|
+
return method === "HEAD" ? "GET" : method;
|
461
|
+
};
|
462
|
+
}
|
463
|
+
|
450
464
|
function createRouterClient(router, ...rest) {
|
451
465
|
if (isProcedure(router)) {
|
452
|
-
const caller = createProcedureClient(router,
|
466
|
+
const caller = createProcedureClient(router, resolveMaybeOptionalOptions(rest));
|
453
467
|
return caller;
|
454
468
|
}
|
455
|
-
const procedureCaller = isLazy(router) ? createProcedureClient(createAssertedLazyProcedure(router),
|
469
|
+
const procedureCaller = isLazy(router) ? createProcedureClient(createAssertedLazyProcedure(router), resolveMaybeOptionalOptions(rest)) : {};
|
456
470
|
const recursive = new Proxy(procedureCaller, {
|
457
471
|
get(target, key) {
|
458
472
|
if (typeof key !== "string") {
|
@@ -471,4 +485,4 @@ function createRouterClient(router, ...rest) {
|
|
471
485
|
return recursive;
|
472
486
|
}
|
473
487
|
|
474
|
-
export { Builder, DecoratedProcedure, Procedure, addMiddleware, createActionableClient, createAssertedLazyProcedure, createProcedureClient, createRouterClient, decorateMiddleware, enhanceRouter, fallbackConfig, getRouter, implement, implementerInternal, isLazy, isProcedure, lazy, os, setHiddenRouterContract };
|
488
|
+
export { Builder, DecoratedProcedure, Procedure, addMiddleware, createActionableClient, createAssertedLazyProcedure, createProcedureClient, createRouterClient, decorateMiddleware, enhanceRouter, fallbackConfig, getRouter, implement, implementerInternal, inferRPCMethodFromRouter, isLazy, isProcedure, lazy, os, setHiddenRouterContract, unlazy };
|
package/dist/plugins/index.d.mts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Value } from '@orpc/shared';
|
1
|
+
import { Value, Promisable } from '@orpc/shared';
|
2
2
|
import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
|
3
3
|
import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
|
4
|
-
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.
|
5
|
-
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.
|
4
|
+
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.Dq8xr7PQ.mjs';
|
5
|
+
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.DD2C4ujN.mjs';
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
7
7
|
import { ORPCError } from '@orpc/client';
|
8
8
|
|
@@ -12,7 +12,7 @@ interface BatchHandlerOptions<T extends Context> {
|
|
12
12
|
*
|
13
13
|
* @default 10
|
14
14
|
*/
|
15
|
-
maxSize?: Value<number
|
15
|
+
maxSize?: Value<Promisable<number>, [StandardHandlerInterceptorOptions<T>]>;
|
16
16
|
/**
|
17
17
|
* Map the request before processing it.
|
18
18
|
*
|
@@ -24,19 +24,19 @@ interface BatchHandlerOptions<T extends Context> {
|
|
24
24
|
*
|
25
25
|
* @default 207
|
26
26
|
*/
|
27
|
-
successStatus?: Value<number
|
27
|
+
successStatus?: Value<Promisable<number>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
|
28
28
|
/**
|
29
29
|
* success batch response headers.
|
30
30
|
*
|
31
31
|
* @default {}
|
32
32
|
*/
|
33
|
-
headers?: Value<StandardHeaders
|
33
|
+
headers?: Value<Promisable<StandardHeaders>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
|
34
34
|
}
|
35
35
|
/**
|
36
|
-
* The Batch
|
36
|
+
* The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
|
37
37
|
* reducing the overhead of sending each one separately.
|
38
38
|
*
|
39
|
-
* @see {@link https://orpc.unnoq.com/docs/plugins/batch-
|
39
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/batch-requests Batch Requests Plugin Docs}
|
40
40
|
*/
|
41
41
|
declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
42
42
|
private readonly maxSize;
|
@@ -49,8 +49,8 @@ declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPl
|
|
49
49
|
}
|
50
50
|
|
51
51
|
interface CORSOptions<T extends Context> {
|
52
|
-
origin?: Value<string | readonly string[] | null | undefined
|
53
|
-
timingOrigin?: Value<string | readonly string[] | null | undefined
|
52
|
+
origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
|
53
|
+
timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
|
54
54
|
allowMethods?: readonly string[];
|
55
55
|
allowHeaders?: readonly string[];
|
56
56
|
maxAge?: number;
|
@@ -88,21 +88,21 @@ interface SimpleCsrfProtectionHandlerPluginOptions<T extends Context> {
|
|
88
88
|
*
|
89
89
|
* @default 'x-csrf-token'
|
90
90
|
*/
|
91
|
-
headerName?: Value<string
|
91
|
+
headerName?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
|
92
92
|
/**
|
93
93
|
* The value of the header to check.
|
94
94
|
*
|
95
95
|
* @default 'orpc'
|
96
96
|
*
|
97
97
|
*/
|
98
|
-
headerValue?: Value<string
|
98
|
+
headerValue?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
|
99
99
|
/**
|
100
100
|
* Exclude a procedure from the plugin.
|
101
101
|
*
|
102
102
|
* @default false
|
103
103
|
*
|
104
104
|
*/
|
105
|
-
exclude?: Value<boolean
|
105
|
+
exclude?: Value<Promisable<boolean>, [options: ProcedureClientInterceptorOptions<T, Record<never, never>, Meta>]>;
|
106
106
|
/**
|
107
107
|
* The error thrown when the CSRF token is invalid.
|
108
108
|
*
|