@orpc/server 0.0.0-next.eea495c → 0.0.0-next.f107a0e
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 +1 -0
- 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 +35 -0
- package/dist/adapters/bun-ws/index.d.ts +35 -0
- package/dist/adapters/bun-ws/index.mjs +51 -0
- package/dist/adapters/crossws/index.d.mts +30 -0
- package/dist/adapters/crossws/index.d.ts +30 -0
- package/dist/adapters/crossws/index.mjs +51 -0
- package/dist/adapters/fetch/index.d.mts +17 -9
- package/dist/adapters/fetch/index.d.ts +17 -9
- package/dist/adapters/fetch/index.mjs +7 -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 +17 -9
- package/dist/adapters/node/index.d.ts +17 -9
- package/dist/adapters/node/index.mjs +7 -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 +4 -5
- package/dist/adapters/websocket/index.d.mts +27 -0
- package/dist/adapters/websocket/index.d.ts +27 -0
- package/dist/adapters/websocket/index.mjs +38 -0
- package/dist/adapters/ws/index.d.mts +28 -0
- package/dist/adapters/ws/index.d.ts +28 -0
- package/dist/adapters/ws/index.mjs +38 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -2
- package/dist/plugins/index.d.mts +13 -13
- package/dist/plugins/index.d.ts +13 -13
- package/dist/plugins/index.mjs +10 -9
- package/dist/shared/{server.D5fBlF9j.d.ts → server.-ACo36I0.d.ts} +9 -9
- package/dist/shared/{server.CuD15qZB.d.ts → server.BPAWobQg.d.ts} +3 -9
- package/dist/shared/{server.CN0534_m.d.mts → server.Bd52nNaH.d.mts} +3 -9
- package/dist/shared/{server.DjgtLwKi.d.mts → server.BliFSTnG.d.mts} +2 -2
- package/dist/shared/{server.qf03T-Xn.mjs → server.CHvOkcM3.mjs} +11 -15
- 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.DY7OKEoj.d.mts → server.Dq8xr7PQ.d.mts} +9 -9
- package/dist/shared/{server.CjlA3NKP.d.ts → server.IG2MjhrD.d.ts} +2 -2
- package/package.json +56 -8
@@ -1,9 +1,9 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
2
|
-
import { Interceptor,
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.mjs';
|
2
|
+
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@orpc/standard-server-node';
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, 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';
|
@@ -27,7 +27,7 @@ interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardH
|
|
27
27
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
28
28
|
}
|
29
29
|
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
30
|
-
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, NodeHttpHandleResult
|
30
|
+
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
31
31
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
32
32
|
}
|
33
33
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
@@ -55,15 +55,23 @@ declare class BodyLimitPlugin<T extends Context> implements NodeHttpHandlerPlugi
|
|
55
55
|
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
56
56
|
}
|
57
57
|
|
58
|
+
type RPCHandlerOptions<T extends Context> = NodeHttpHandlerOptions<T> & StandardRPCHandlerOptions<T> & {
|
59
|
+
/**
|
60
|
+
* Enables or disables the StrictGetMethodPlugin.
|
61
|
+
*
|
62
|
+
* @default true
|
63
|
+
*/
|
64
|
+
strictGetMethodPluginEnabled?: boolean;
|
65
|
+
};
|
58
66
|
/**
|
59
67
|
* RPC Handler for Node.js HTTP Server
|
60
68
|
*
|
61
69
|
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
62
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
70
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
63
71
|
*/
|
64
72
|
declare class RPCHandler<T extends Context> extends NodeHttpHandler<T> {
|
65
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
73
|
+
constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
|
66
74
|
}
|
67
75
|
|
68
76
|
export { BodyLimitPlugin, CompositeNodeHttpHandlerPlugin, NodeHttpHandler, RPCHandler };
|
69
|
-
export type { BodyLimitPluginOptions, NodeHttpHandleResult, NodeHttpHandlerInterceptorOptions, NodeHttpHandlerOptions, NodeHttpHandlerPlugin };
|
77
|
+
export type { BodyLimitPluginOptions, NodeHttpHandleResult, NodeHttpHandlerInterceptorOptions, NodeHttpHandlerOptions, NodeHttpHandlerPlugin, RPCHandlerOptions };
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
2
|
-
import { Interceptor,
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.js';
|
2
|
+
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@orpc/standard-server-node';
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, 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';
|
@@ -27,7 +27,7 @@ interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardH
|
|
27
27
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
28
28
|
}
|
29
29
|
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
30
|
-
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, NodeHttpHandleResult
|
30
|
+
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
31
31
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
32
32
|
}
|
33
33
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
@@ -55,15 +55,23 @@ declare class BodyLimitPlugin<T extends Context> implements NodeHttpHandlerPlugi
|
|
55
55
|
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
56
56
|
}
|
57
57
|
|
58
|
+
type RPCHandlerOptions<T extends Context> = NodeHttpHandlerOptions<T> & StandardRPCHandlerOptions<T> & {
|
59
|
+
/**
|
60
|
+
* Enables or disables the StrictGetMethodPlugin.
|
61
|
+
*
|
62
|
+
* @default true
|
63
|
+
*/
|
64
|
+
strictGetMethodPluginEnabled?: boolean;
|
65
|
+
};
|
58
66
|
/**
|
59
67
|
* RPC Handler for Node.js HTTP Server
|
60
68
|
*
|
61
69
|
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
62
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
70
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
63
71
|
*/
|
64
72
|
declare class RPCHandler<T extends Context> extends NodeHttpHandler<T> {
|
65
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
73
|
+
constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
|
66
74
|
}
|
67
75
|
|
68
76
|
export { BodyLimitPlugin, CompositeNodeHttpHandlerPlugin, NodeHttpHandler, RPCHandler };
|
69
|
-
export type { BodyLimitPluginOptions, NodeHttpHandleResult, NodeHttpHandlerInterceptorOptions, NodeHttpHandlerOptions, NodeHttpHandlerPlugin };
|
77
|
+
export type { BodyLimitPluginOptions, NodeHttpHandleResult, NodeHttpHandlerInterceptorOptions, NodeHttpHandlerOptions, NodeHttpHandlerPlugin, RPCHandlerOptions };
|
@@ -2,11 +2,12 @@ import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
5
|
+
import '@orpc/standard-server';
|
5
6
|
import '@orpc/contract';
|
6
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '@orpc/standard-server/batch';
|
9
|
-
import '../../shared/server.BW-nUGgA.mjs';
|
10
|
+
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
10
11
|
import '../../shared/server.DG7Tamti.mjs';
|
11
12
|
|
12
13
|
class BodyLimitPlugin {
|
@@ -83,6 +84,10 @@ class NodeHttpHandler {
|
|
83
84
|
|
84
85
|
class RPCHandler extends NodeHttpHandler {
|
85
86
|
constructor(router, options = {}) {
|
87
|
+
if (options.strictGetMethodPluginEnabled ?? true) {
|
88
|
+
options.plugins ??= [];
|
89
|
+
options.plugins.push(new StrictGetMethodPlugin());
|
90
|
+
}
|
86
91
|
super(new StandardRPCHandler(router, options), options);
|
87
92
|
}
|
88
93
|
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.
|
2
|
-
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.
|
1
|
+
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.Dq8xr7PQ.mjs';
|
2
|
+
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.Dq8xr7PQ.mjs';
|
3
3
|
import { ORPCError, HTTPPath } from '@orpc/client';
|
4
4
|
import { StandardRPCSerializer } from '@orpc/client/standard';
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
6
|
-
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.
|
7
|
-
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.
|
6
|
+
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.DD2C4ujN.mjs';
|
7
|
+
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.Bd52nNaH.mjs';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.
|
2
|
-
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.
|
1
|
+
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.-ACo36I0.js';
|
2
|
+
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.-ACo36I0.js';
|
3
3
|
import { ORPCError, HTTPPath } from '@orpc/client';
|
4
4
|
import { StandardRPCSerializer } from '@orpc/client/standard';
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
6
|
-
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.
|
7
|
-
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.
|
6
|
+
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.DD2C4ujN.js';
|
7
|
+
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.BPAWobQg.js';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,8 +1,7 @@
|
|
1
|
-
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.
|
1
|
+
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.CHvOkcM3.mjs';
|
2
2
|
import '@orpc/client/standard';
|
3
|
-
import '@orpc/shared';
|
4
|
-
import '@orpc/standard-server/batch';
|
5
3
|
import '@orpc/client';
|
6
|
-
import '
|
7
|
-
import '@orpc/
|
4
|
+
import '@orpc/shared';
|
5
|
+
import '@orpc/standard-server';
|
8
6
|
import '../../shared/server.DG7Tamti.mjs';
|
7
|
+
import '@orpc/contract';
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.mjs';
|
3
|
+
import { i as StandardHandler } from '../../shared/server.Dq8xr7PQ.mjs';
|
4
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BliFSTnG.mjs';
|
5
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.Bd52nNaH.mjs';
|
6
|
+
import '@orpc/client';
|
7
|
+
import '@orpc/contract';
|
8
|
+
import '@orpc/standard-server';
|
9
|
+
import '@orpc/client/standard';
|
10
|
+
|
11
|
+
declare class experimental_WebsocketHandler<T extends Context> {
|
12
|
+
private readonly standardHandler;
|
13
|
+
constructor(standardHandler: StandardHandler<T>);
|
14
|
+
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): void;
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* RPC Handler for Websocket adapter
|
19
|
+
*
|
20
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
21
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
|
22
|
+
*/
|
23
|
+
declare class experimental_RPCHandler<T extends Context> extends experimental_WebsocketHandler<T> {
|
24
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
|
25
|
+
}
|
26
|
+
|
27
|
+
export { experimental_RPCHandler, experimental_WebsocketHandler };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
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
|
+
import '@orpc/client';
|
7
|
+
import '@orpc/contract';
|
8
|
+
import '@orpc/standard-server';
|
9
|
+
import '@orpc/client/standard';
|
10
|
+
|
11
|
+
declare class experimental_WebsocketHandler<T extends Context> {
|
12
|
+
private readonly standardHandler;
|
13
|
+
constructor(standardHandler: StandardHandler<T>);
|
14
|
+
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): void;
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* RPC Handler for Websocket adapter
|
19
|
+
*
|
20
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
21
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
|
22
|
+
*/
|
23
|
+
declare class experimental_RPCHandler<T extends Context> extends experimental_WebsocketHandler<T> {
|
24
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
|
25
|
+
}
|
26
|
+
|
27
|
+
export { experimental_RPCHandler, experimental_WebsocketHandler };
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
4
|
+
import '@orpc/client';
|
5
|
+
import '@orpc/standard-server';
|
6
|
+
import '@orpc/contract';
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
8
|
+
import '@orpc/client/standard';
|
9
|
+
import '../../shared/server.DG7Tamti.mjs';
|
10
|
+
|
11
|
+
class experimental_WebsocketHandler {
|
12
|
+
constructor(standardHandler) {
|
13
|
+
this.standardHandler = standardHandler;
|
14
|
+
}
|
15
|
+
upgrade(ws, ...rest) {
|
16
|
+
const peer = new ServerPeer(ws.send.bind(ws));
|
17
|
+
ws.addEventListener("message", async (event) => {
|
18
|
+
const [id, request] = await peer.message(event.data);
|
19
|
+
if (!request) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
23
|
+
const { response } = await this.standardHandler.handle({ ...request, body: () => Promise.resolve(request.body) }, options);
|
24
|
+
await peer.response(id, response ?? { status: 404, headers: {}, body: "No procedure matched" });
|
25
|
+
});
|
26
|
+
ws.addEventListener("close", () => {
|
27
|
+
peer.close();
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
class experimental_RPCHandler extends experimental_WebsocketHandler {
|
33
|
+
constructor(router, options = {}) {
|
34
|
+
super(new StandardRPCHandler(router, options));
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
export { experimental_RPCHandler, experimental_WebsocketHandler };
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { WebSocket } from 'ws';
|
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
|
+
import '@orpc/client';
|
8
|
+
import '@orpc/contract';
|
9
|
+
import '@orpc/standard-server';
|
10
|
+
import '@orpc/client/standard';
|
11
|
+
|
12
|
+
declare class experimental_WsHandler<T extends Context> {
|
13
|
+
private readonly standardHandler;
|
14
|
+
constructor(standardHandler: StandardHandler<T>);
|
15
|
+
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): Promise<void>;
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* RPC Handler for ws (node ws) adapter
|
20
|
+
*
|
21
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
22
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
|
23
|
+
*/
|
24
|
+
declare class experimental_RPCHandler<T extends Context> extends experimental_WsHandler<T> {
|
25
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
|
26
|
+
}
|
27
|
+
|
28
|
+
export { experimental_RPCHandler, experimental_WsHandler };
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { WebSocket } from 'ws';
|
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
|
+
import '@orpc/client';
|
8
|
+
import '@orpc/contract';
|
9
|
+
import '@orpc/standard-server';
|
10
|
+
import '@orpc/client/standard';
|
11
|
+
|
12
|
+
declare class experimental_WsHandler<T extends Context> {
|
13
|
+
private readonly standardHandler;
|
14
|
+
constructor(standardHandler: StandardHandler<T>);
|
15
|
+
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): Promise<void>;
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* RPC Handler for ws (node ws) adapter
|
20
|
+
*
|
21
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
22
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
|
23
|
+
*/
|
24
|
+
declare class experimental_RPCHandler<T extends Context> extends experimental_WsHandler<T> {
|
25
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
|
26
|
+
}
|
27
|
+
|
28
|
+
export { experimental_RPCHandler, experimental_WsHandler };
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
4
|
+
import '@orpc/client';
|
5
|
+
import '@orpc/standard-server';
|
6
|
+
import '@orpc/contract';
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
8
|
+
import '@orpc/client/standard';
|
9
|
+
import '../../shared/server.DG7Tamti.mjs';
|
10
|
+
|
11
|
+
class experimental_WsHandler {
|
12
|
+
constructor(standardHandler) {
|
13
|
+
this.standardHandler = standardHandler;
|
14
|
+
}
|
15
|
+
async upgrade(ws, ...rest) {
|
16
|
+
const peer = new ServerPeer(ws.send.bind(ws));
|
17
|
+
ws.addEventListener("message", async (event) => {
|
18
|
+
const [id, request] = await peer.message(new Blob(Array.isArray(event.data) ? event.data : [event.data]));
|
19
|
+
if (!request) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
23
|
+
const { response } = await this.standardHandler.handle({ ...request, body: () => Promise.resolve(request.body) }, options);
|
24
|
+
await peer.response(id, response ?? { status: 404, headers: {}, body: "No procedure matched" });
|
25
|
+
});
|
26
|
+
ws.addEventListener("close", () => {
|
27
|
+
peer.close();
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
class experimental_RPCHandler extends experimental_WsHandler {
|
33
|
+
constructor(router, options = {}) {
|
34
|
+
super(new StandardRPCHandler(router, options));
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
export { experimental_RPCHandler, experimental_WsHandler };
|
package/dist/index.d.mts
CHANGED
@@ -4,8 +4,8 @@ import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErro
|
|
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
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.
|
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> & {
|
package/dist/index.d.ts
CHANGED
@@ -4,8 +4,8 @@ import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErro
|
|
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
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.
|
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> & {
|
package/dist/index.mjs
CHANGED
@@ -4,6 +4,7 @@ import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as en
|
|
4
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, u as unlazy, 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
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
7
8
|
export { onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
8
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
9
10
|
|
@@ -50,6 +51,9 @@ function createActionableClient(client) {
|
|
50
51
|
try {
|
51
52
|
return [null, await client(input)];
|
52
53
|
} catch (error) {
|
54
|
+
if (error instanceof Error && "digest" in error && typeof error.digest === "string" && error.digest.startsWith("NEXT_")) {
|
55
|
+
throw error;
|
56
|
+
}
|
53
57
|
return [toORPCError(error).toJSON(), void 0];
|
54
58
|
}
|
55
59
|
};
|
@@ -446,10 +450,10 @@ function implement(contract, config = {}) {
|
|
446
450
|
|
447
451
|
function createRouterClient(router, ...rest) {
|
448
452
|
if (isProcedure(router)) {
|
449
|
-
const caller = createProcedureClient(router,
|
453
|
+
const caller = createProcedureClient(router, resolveMaybeOptionalOptions(rest));
|
450
454
|
return caller;
|
451
455
|
}
|
452
|
-
const procedureCaller = isLazy(router) ? createProcedureClient(createAssertedLazyProcedure(router),
|
456
|
+
const procedureCaller = isLazy(router) ? createProcedureClient(createAssertedLazyProcedure(router), resolveMaybeOptionalOptions(rest)) : {};
|
453
457
|
const recursive = new Proxy(procedureCaller, {
|
454
458
|
get(target, key) {
|
455
459
|
if (typeof key !== "string") {
|
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
|
*
|
package/dist/plugins/index.d.ts
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.-ACo36I0.js';
|
5
|
+
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.DD2C4ujN.js';
|
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
|
*
|