@orpc/server 0.0.0-next.3beb06e → 0.0.0-next.3bec7fc
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 +7 -2
- package/dist/adapters/aws-lambda/index.d.mts +5 -5
- package/dist/adapters/aws-lambda/index.d.ts +5 -5
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/bun-ws/index.d.mts +5 -5
- package/dist/adapters/bun-ws/index.d.ts +5 -5
- package/dist/adapters/bun-ws/index.mjs +10 -10
- package/dist/adapters/crossws/index.d.mts +5 -5
- package/dist/adapters/crossws/index.d.ts +5 -5
- package/dist/adapters/crossws/index.mjs +5 -7
- package/dist/adapters/fastify/index.d.mts +53 -0
- package/dist/adapters/fastify/index.d.ts +53 -0
- package/dist/adapters/fastify/index.mjs +54 -0
- package/dist/adapters/fetch/index.d.mts +54 -9
- package/dist/adapters/fetch/index.d.ts +54 -9
- package/dist/adapters/fetch/index.mjs +74 -4
- package/dist/adapters/message-port/index.d.mts +35 -9
- package/dist/adapters/message-port/index.d.ts +35 -9
- package/dist/adapters/message-port/index.mjs +29 -15
- package/dist/adapters/node/index.d.mts +31 -10
- package/dist/adapters/node/index.d.ts +31 -10
- package/dist/adapters/node/index.mjs +69 -13
- package/dist/adapters/standard/index.d.mts +6 -6
- package/dist/adapters/standard/index.d.ts +6 -6
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/adapters/standard-peer/index.d.mts +9 -5
- package/dist/adapters/standard-peer/index.d.ts +9 -5
- package/dist/adapters/standard-peer/index.mjs +1 -1
- package/dist/adapters/websocket/index.d.mts +9 -7
- package/dist/adapters/websocket/index.d.ts +9 -7
- package/dist/adapters/websocket/index.mjs +5 -7
- package/dist/adapters/ws/index.d.mts +5 -5
- package/dist/adapters/ws/index.d.ts +5 -5
- package/dist/adapters/ws/index.mjs +5 -7
- package/dist/helpers/index.d.mts +20 -1
- package/dist/helpers/index.d.ts +20 -1
- package/dist/helpers/index.mjs +17 -1
- package/dist/hibernation/index.d.mts +11 -11
- package/dist/hibernation/index.d.ts +11 -11
- package/dist/hibernation/index.mjs +8 -8
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +9 -6
- package/dist/plugins/index.d.mts +5 -2
- package/dist/plugins/index.d.ts +5 -2
- package/dist/plugins/index.mjs +68 -57
- package/dist/shared/{server.CYNGeoCm.d.mts → server.B4BGqy3Y.d.mts} +2 -3
- package/dist/shared/{server.CYNGeoCm.d.ts → server.B4BGqy3Y.d.ts} +2 -3
- package/dist/shared/{server.CIL9uKTN.mjs → server.Bxx6tqNe.mjs} +64 -39
- package/dist/shared/{server.D0H-iaY3.d.ts → server.COL12UTb.d.ts} +3 -3
- package/dist/shared/{server.BEFBl-Cb.d.mts → server.CVKCo60T.d.mts} +2 -2
- package/dist/shared/{server.jMTkVNIb.d.ts → server.Cb6yD7DZ.d.ts} +1 -1
- package/dist/shared/{server.BU4WI18A.d.mts → server.Ck-gOLzq.d.mts} +3 -3
- package/dist/shared/{server.gqRxT-yN.d.mts → server.DBCUJijK.d.mts} +1 -1
- package/dist/shared/{server.B7b2w3_i.d.ts → server.DNtJ-p60.d.ts} +2 -2
- package/dist/shared/{server.Bmh5xd4n.d.ts → server.DPIFWpxG.d.ts} +1 -1
- package/dist/shared/{server.NeumLVdS.mjs → server.Ds4HPpvH.mjs} +105 -66
- package/dist/shared/{server.DhJj-1X9.d.mts → server.DzV1hr3z.d.mts} +1 -1
- package/dist/shared/{server.BW-nUGgA.mjs → server.TEVCLCFC.mjs} +3 -0
- package/dist/shared/server.UVMTOWrk.mjs +26 -0
- package/package.json +21 -11
- package/dist/shared/server.C6Q5sqYw.mjs +0 -20
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { ServerPeer, EncodedMessage } from '@orpc/standard-server-peer';
|
|
2
|
-
import { C as Context } from '../../shared/server.
|
|
3
|
-
import { f as StandardHandler } from '../../shared/server.
|
|
4
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
1
|
+
import { ServerPeer, EncodedMessage, ServerPeerHandleRequestFn } from '@orpc/standard-server-peer';
|
|
2
|
+
import { C as Context } from '../../shared/server.B4BGqy3Y.js';
|
|
3
|
+
import { f as StandardHandler } from '../../shared/server.DPIFWpxG.js';
|
|
4
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DNtJ-p60.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/shared';
|
|
8
8
|
import '@orpc/standard-server';
|
|
9
9
|
|
|
10
10
|
type HandleStandardServerPeerMessageOptions<T extends Context> = Omit<FriendlyStandardHandleOptions<T>, 'prefix'>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `createServerPeerRequestHandleFn` instead.
|
|
13
|
+
*/
|
|
11
14
|
declare function handleStandardServerPeerMessage<T extends Context>(handler: StandardHandler<T>, peer: ServerPeer, message: EncodedMessage, options: HandleStandardServerPeerMessageOptions<T>): Promise<void>;
|
|
15
|
+
declare function createServerPeerHandleRequestFn<T extends Context>(handler: StandardHandler<T>, options: HandleStandardServerPeerMessageOptions<T>): ServerPeerHandleRequestFn;
|
|
12
16
|
|
|
13
|
-
export { handleStandardServerPeerMessage };
|
|
17
|
+
export { createServerPeerHandleRequestFn, handleStandardServerPeerMessage };
|
|
14
18
|
export type { HandleStandardServerPeerMessageOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { h as handleStandardServerPeerMessage } from '../../shared/server.
|
|
1
|
+
export { c as createServerPeerHandleRequestFn, h as handleStandardServerPeerMessage } from '../../shared/server.UVMTOWrk.mjs';
|
|
2
2
|
import '@orpc/client';
|
|
3
3
|
import '@orpc/shared';
|
|
4
4
|
import '@orpc/standard-server';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
2
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
3
|
-
import { f as StandardHandler } from '../../shared/server.
|
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.B4BGqy3Y.mjs';
|
|
3
|
+
import { f as StandardHandler } from '../../shared/server.DBCUJijK.mjs';
|
|
4
4
|
import { HandleStandardServerPeerMessageOptions } from '../standard-peer/index.mjs';
|
|
5
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
|
5
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.Ck-gOLzq.mjs';
|
|
6
6
|
import '@orpc/client';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
import '@orpc/standard-server';
|
|
9
9
|
import '@orpc/standard-server-peer';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.CVKCo60T.mjs';
|
|
11
11
|
import '@orpc/client/standard';
|
|
12
|
-
import '../../shared/server.
|
|
12
|
+
import '../../shared/server.DzV1hr3z.mjs';
|
|
13
13
|
|
|
14
14
|
type MinimalWebsocket = Pick<WebSocket, 'addEventListener' | 'send'>;
|
|
15
15
|
declare class WebsocketHandler<T extends Context> {
|
|
@@ -40,6 +40,8 @@ declare class WebsocketHandler<T extends Context> {
|
|
|
40
40
|
close(ws: MinimalWebsocket): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
interface RPCHandlerOptions<T extends Context> extends StandardRPCHandlerOptions<T> {
|
|
44
|
+
}
|
|
43
45
|
/**
|
|
44
46
|
* RPC Handler for Websocket adapter
|
|
45
47
|
*
|
|
@@ -47,8 +49,8 @@ declare class WebsocketHandler<T extends Context> {
|
|
|
47
49
|
* @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
|
|
48
50
|
*/
|
|
49
51
|
declare class RPCHandler<T extends Context> extends WebsocketHandler<T> {
|
|
50
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
|
52
|
+
constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export { RPCHandler, WebsocketHandler };
|
|
54
|
-
export type { MinimalWebsocket };
|
|
56
|
+
export type { MinimalWebsocket, RPCHandlerOptions };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
2
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
3
|
-
import { f as StandardHandler } from '../../shared/server.
|
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.B4BGqy3Y.js';
|
|
3
|
+
import { f as StandardHandler } from '../../shared/server.DPIFWpxG.js';
|
|
4
4
|
import { HandleStandardServerPeerMessageOptions } from '../standard-peer/index.js';
|
|
5
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
|
5
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.COL12UTb.js';
|
|
6
6
|
import '@orpc/client';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
import '@orpc/standard-server';
|
|
9
9
|
import '@orpc/standard-server-peer';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.DNtJ-p60.js';
|
|
11
11
|
import '@orpc/client/standard';
|
|
12
|
-
import '../../shared/server.
|
|
12
|
+
import '../../shared/server.Cb6yD7DZ.js';
|
|
13
13
|
|
|
14
14
|
type MinimalWebsocket = Pick<WebSocket, 'addEventListener' | 'send'>;
|
|
15
15
|
declare class WebsocketHandler<T extends Context> {
|
|
@@ -40,6 +40,8 @@ declare class WebsocketHandler<T extends Context> {
|
|
|
40
40
|
close(ws: MinimalWebsocket): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
interface RPCHandlerOptions<T extends Context> extends StandardRPCHandlerOptions<T> {
|
|
44
|
+
}
|
|
43
45
|
/**
|
|
44
46
|
* RPC Handler for Websocket adapter
|
|
45
47
|
*
|
|
@@ -47,8 +49,8 @@ declare class WebsocketHandler<T extends Context> {
|
|
|
47
49
|
* @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
|
|
48
50
|
*/
|
|
49
51
|
declare class RPCHandler<T extends Context> extends WebsocketHandler<T> {
|
|
50
|
-
constructor(router: Router<any, T>, options?: NoInfer<
|
|
52
|
+
constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export { RPCHandler, WebsocketHandler };
|
|
54
|
-
export type { MinimalWebsocket };
|
|
56
|
+
export type { MinimalWebsocket, RPCHandlerOptions };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { readAsBuffer, resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
|
3
|
-
import {
|
|
3
|
+
import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOWrk.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.Bxx6tqNe.mjs';
|
|
8
8
|
import '@orpc/client/standard';
|
|
9
9
|
import '../../shared/server.DZ5BIITo.mjs';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.Ds4HPpvH.mjs';
|
|
11
11
|
|
|
12
12
|
class WebsocketHandler {
|
|
13
13
|
#peers = /* @__PURE__ */ new WeakMap();
|
|
@@ -40,11 +40,9 @@ class WebsocketHandler {
|
|
|
40
40
|
this.#peers.set(ws, peer = new ServerPeer(ws.send.bind(ws)));
|
|
41
41
|
}
|
|
42
42
|
const message = data instanceof Blob ? await readAsBuffer(data) : data;
|
|
43
|
-
await
|
|
44
|
-
this.#handler,
|
|
45
|
-
peer,
|
|
43
|
+
await peer.message(
|
|
46
44
|
message,
|
|
47
|
-
resolveMaybeOptionalOptions(rest)
|
|
45
|
+
createServerPeerHandleRequestFn(this.#handler, resolveMaybeOptionalOptions(rest))
|
|
48
46
|
);
|
|
49
47
|
}
|
|
50
48
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
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 { f as StandardHandler } from '../../shared/server.
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.B4BGqy3Y.mjs';
|
|
4
|
+
import { f as StandardHandler } from '../../shared/server.DBCUJijK.mjs';
|
|
5
5
|
import { HandleStandardServerPeerMessageOptions } from '../standard-peer/index.mjs';
|
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.Ck-gOLzq.mjs';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/contract';
|
|
9
9
|
import '@orpc/standard-server';
|
|
10
10
|
import '@orpc/standard-server-peer';
|
|
11
|
-
import '../../shared/server.
|
|
11
|
+
import '../../shared/server.CVKCo60T.mjs';
|
|
12
12
|
import '@orpc/client/standard';
|
|
13
|
-
import '../../shared/server.
|
|
13
|
+
import '../../shared/server.DzV1hr3z.mjs';
|
|
14
14
|
|
|
15
15
|
declare class WsHandler<T extends Context> {
|
|
16
16
|
private readonly standardHandler;
|
|
@@ -1,16 +1,16 @@
|
|
|
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 { f as StandardHandler } from '../../shared/server.
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.B4BGqy3Y.js';
|
|
4
|
+
import { f as StandardHandler } from '../../shared/server.DPIFWpxG.js';
|
|
5
5
|
import { HandleStandardServerPeerMessageOptions } from '../standard-peer/index.js';
|
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.COL12UTb.js';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/contract';
|
|
9
9
|
import '@orpc/standard-server';
|
|
10
10
|
import '@orpc/standard-server-peer';
|
|
11
|
-
import '../../shared/server.
|
|
11
|
+
import '../../shared/server.DNtJ-p60.js';
|
|
12
12
|
import '@orpc/client/standard';
|
|
13
|
-
import '../../shared/server.
|
|
13
|
+
import '../../shared/server.Cb6yD7DZ.js';
|
|
14
14
|
|
|
15
15
|
declare class WsHandler<T extends Context> {
|
|
16
16
|
private readonly standardHandler;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { readAsBuffer, resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
|
3
|
-
import {
|
|
3
|
+
import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOWrk.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.Bxx6tqNe.mjs';
|
|
8
8
|
import '@orpc/client/standard';
|
|
9
9
|
import '../../shared/server.DZ5BIITo.mjs';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.Ds4HPpvH.mjs';
|
|
11
11
|
|
|
12
12
|
class WsHandler {
|
|
13
13
|
constructor(standardHandler) {
|
|
@@ -17,11 +17,9 @@ class WsHandler {
|
|
|
17
17
|
const peer = new ServerPeer(ws.send.bind(ws));
|
|
18
18
|
ws.addEventListener("message", async (event) => {
|
|
19
19
|
const message = Array.isArray(event.data) ? await readAsBuffer(new Blob(event.data)) : event.data;
|
|
20
|
-
await
|
|
21
|
-
this.standardHandler,
|
|
22
|
-
peer,
|
|
20
|
+
await peer.message(
|
|
23
21
|
message,
|
|
24
|
-
resolveMaybeOptionalOptions(rest)
|
|
22
|
+
createServerPeerHandleRequestFn(this.standardHandler, resolveMaybeOptionalOptions(rest))
|
|
25
23
|
);
|
|
26
24
|
});
|
|
27
25
|
ws.addEventListener("close", () => {
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -68,6 +68,10 @@ interface GetCookieOptions extends ParseOptions {
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
declare function getCookie(headers: Headers | undefined, name: string, options?: GetCookieOptions): string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Deletes a cookie by marking it expired.
|
|
73
|
+
*/
|
|
74
|
+
declare function deleteCookie(headers: Headers | undefined, name: string, options?: Omit<SetCookieOptions, 'maxAge'>): void;
|
|
71
75
|
|
|
72
76
|
/**
|
|
73
77
|
* Encrypts a string using AES-GCM with a secret key.
|
|
@@ -125,6 +129,21 @@ declare function sign(value: string, secret: string): Promise<string>;
|
|
|
125
129
|
* ```
|
|
126
130
|
*/
|
|
127
131
|
declare function unsign(signedValue: string | undefined | null, secret: string): Promise<string | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Extracts the value part from a signed string without verification.
|
|
134
|
+
*
|
|
135
|
+
* This function simply extracts the original value from a signed string
|
|
136
|
+
* without performing any signature verification. It's useful when you need
|
|
137
|
+
* to access the value quickly without the overhead of cryptographic verification.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const signedValue = "user123.oneQsU0r5dvwQFHFEjjV1uOI_IR3gZfkYHij3TRauVA"
|
|
142
|
+
* const value = getSignedValue(signedValue)
|
|
143
|
+
* expect(value).toEqual("user123")
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
declare function getSignedValue(signedValue: string | undefined | null): string | undefined;
|
|
128
147
|
|
|
129
|
-
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
|
|
148
|
+
export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
|
|
130
149
|
export type { GetCookieOptions, SetCookieOptions };
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -68,6 +68,10 @@ interface GetCookieOptions extends ParseOptions {
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
declare function getCookie(headers: Headers | undefined, name: string, options?: GetCookieOptions): string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Deletes a cookie by marking it expired.
|
|
73
|
+
*/
|
|
74
|
+
declare function deleteCookie(headers: Headers | undefined, name: string, options?: Omit<SetCookieOptions, 'maxAge'>): void;
|
|
71
75
|
|
|
72
76
|
/**
|
|
73
77
|
* Encrypts a string using AES-GCM with a secret key.
|
|
@@ -125,6 +129,21 @@ declare function sign(value: string, secret: string): Promise<string>;
|
|
|
125
129
|
* ```
|
|
126
130
|
*/
|
|
127
131
|
declare function unsign(signedValue: string | undefined | null, secret: string): Promise<string | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Extracts the value part from a signed string without verification.
|
|
134
|
+
*
|
|
135
|
+
* This function simply extracts the original value from a signed string
|
|
136
|
+
* without performing any signature verification. It's useful when you need
|
|
137
|
+
* to access the value quickly without the overhead of cryptographic verification.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const signedValue = "user123.oneQsU0r5dvwQFHFEjjV1uOI_IR3gZfkYHij3TRauVA"
|
|
142
|
+
* const value = getSignedValue(signedValue)
|
|
143
|
+
* expect(value).toEqual("user123")
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
declare function getSignedValue(signedValue: string | undefined | null): string | undefined;
|
|
128
147
|
|
|
129
|
-
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
|
|
148
|
+
export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
|
|
130
149
|
export type { GetCookieOptions, SetCookieOptions };
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -50,6 +50,12 @@ function getCookie(headers, name, options = {}) {
|
|
|
50
50
|
}
|
|
51
51
|
return parse(cookieHeader, options)[name];
|
|
52
52
|
}
|
|
53
|
+
function deleteCookie(headers, name, options = {}) {
|
|
54
|
+
return setCookie(headers, name, "", {
|
|
55
|
+
...options,
|
|
56
|
+
maxAge: 0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
53
59
|
|
|
54
60
|
const PBKDF2_CONFIG = {
|
|
55
61
|
name: "PBKDF2",
|
|
@@ -178,5 +184,15 @@ async function unsign(signedValue, secret) {
|
|
|
178
184
|
);
|
|
179
185
|
return isValid ? value : void 0;
|
|
180
186
|
}
|
|
187
|
+
function getSignedValue(signedValue) {
|
|
188
|
+
if (typeof signedValue !== "string") {
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
const lastDotIndex = signedValue.lastIndexOf(".");
|
|
192
|
+
if (lastDotIndex === -1) {
|
|
193
|
+
return void 0;
|
|
194
|
+
}
|
|
195
|
+
return signedValue.slice(0, lastDotIndex);
|
|
196
|
+
}
|
|
181
197
|
|
|
182
|
-
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
|
|
198
|
+
export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
|
2
|
-
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { C as Context, R as Router } from '../shared/server.
|
|
2
|
+
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DBCUJijK.mjs';
|
|
3
|
+
import { HibernationEventIterator } from '@orpc/standard-server';
|
|
4
|
+
export { HibernationEventIterator, HibernationEventIteratorCallback } from '@orpc/standard-server';
|
|
5
|
+
import { C as Context, R as Router } from '../shared/server.B4BGqy3Y.mjs';
|
|
6
6
|
import '@orpc/client';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
import '@orpc/shared';
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
|
|
11
11
|
/**
|
|
12
12
|
* The type of event, each type corresponds a different operation
|
|
13
13
|
*
|
|
@@ -24,21 +24,21 @@ interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonS
|
|
|
24
24
|
*
|
|
25
25
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
26
26
|
*/
|
|
27
|
-
declare function
|
|
27
|
+
declare function encodeHibernationRPCEvent(id: string, payload: unknown, options?: EncodeHibernationRPCEventOptions): string;
|
|
28
28
|
|
|
29
|
-
interface
|
|
30
|
-
iterator?:
|
|
29
|
+
interface HibernationPluginContext {
|
|
30
|
+
iterator?: HibernationEventIterator<any>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Enable Hibernation APIs
|
|
34
34
|
*
|
|
35
35
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
36
36
|
*/
|
|
37
|
-
declare class
|
|
37
|
+
declare class HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
38
38
|
readonly CONTEXT_SYMBOL: symbol;
|
|
39
39
|
order: number;
|
|
40
40
|
init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export {
|
|
44
|
-
export type {
|
|
43
|
+
export { HibernationPlugin, encodeHibernationRPCEvent };
|
|
44
|
+
export type { EncodeHibernationRPCEventOptions, HibernationPluginContext };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
|
2
|
-
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { C as Context, R as Router } from '../shared/server.
|
|
2
|
+
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DPIFWpxG.js';
|
|
3
|
+
import { HibernationEventIterator } from '@orpc/standard-server';
|
|
4
|
+
export { HibernationEventIterator, HibernationEventIteratorCallback } from '@orpc/standard-server';
|
|
5
|
+
import { C as Context, R as Router } from '../shared/server.B4BGqy3Y.js';
|
|
6
6
|
import '@orpc/client';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
import '@orpc/shared';
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
|
|
11
11
|
/**
|
|
12
12
|
* The type of event, each type corresponds a different operation
|
|
13
13
|
*
|
|
@@ -24,21 +24,21 @@ interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonS
|
|
|
24
24
|
*
|
|
25
25
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
26
26
|
*/
|
|
27
|
-
declare function
|
|
27
|
+
declare function encodeHibernationRPCEvent(id: string, payload: unknown, options?: EncodeHibernationRPCEventOptions): string;
|
|
28
28
|
|
|
29
|
-
interface
|
|
30
|
-
iterator?:
|
|
29
|
+
interface HibernationPluginContext {
|
|
30
|
+
iterator?: HibernationEventIterator<any>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Enable Hibernation APIs
|
|
34
34
|
*
|
|
35
35
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
36
36
|
*/
|
|
37
|
-
declare class
|
|
37
|
+
declare class HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
38
38
|
readonly CONTEXT_SYMBOL: symbol;
|
|
39
39
|
order: number;
|
|
40
40
|
init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export {
|
|
44
|
-
export type {
|
|
43
|
+
export { HibernationPlugin, encodeHibernationRPCEvent };
|
|
44
|
+
export type { EncodeHibernationRPCEventOptions, HibernationPluginContext };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { toORPCError } from '@orpc/client';
|
|
2
2
|
import { StandardRPCJsonSerializer } from '@orpc/client/standard';
|
|
3
3
|
import { stringifyJSON } from '@orpc/shared';
|
|
4
|
-
import { getEventMeta,
|
|
5
|
-
export {
|
|
4
|
+
import { getEventMeta, HibernationEventIterator } from '@orpc/standard-server';
|
|
5
|
+
export { HibernationEventIterator } from '@orpc/standard-server';
|
|
6
6
|
import { MessageType } from '@orpc/standard-server-peer';
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function encodeHibernationRPCEvent(id, payload, options = {}) {
|
|
9
9
|
const { event = "message", ...rest } = options;
|
|
10
10
|
const serializer = new StandardRPCJsonSerializer(rest);
|
|
11
11
|
const data = event === "error" ? toORPCError(payload).toJSON() : payload;
|
|
@@ -21,7 +21,7 @@ function experimental_encodeHibernationRPCEvent(id, payload, options = {}) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class HibernationPlugin {
|
|
25
25
|
CONTEXT_SYMBOL = Symbol("ORPC_HIBERNATION_CONTEXT");
|
|
26
26
|
order = 2e6;
|
|
27
27
|
// make sure execute after the batch plugin
|
|
@@ -33,8 +33,8 @@ class experimental_HibernationPlugin {
|
|
|
33
33
|
const result = await options2.next({
|
|
34
34
|
...options2,
|
|
35
35
|
context: {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
...options2.context,
|
|
37
|
+
[this.CONTEXT_SYMBOL]: hibernationContext
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
if (!result.matched || !hibernationContext.iterator) {
|
|
@@ -54,7 +54,7 @@ class experimental_HibernationPlugin {
|
|
|
54
54
|
throw new TypeError("[HibernationPlugin] Hibernation context has been corrupted or modified by another plugin or interceptor");
|
|
55
55
|
}
|
|
56
56
|
const output = await options2.next();
|
|
57
|
-
if (output instanceof
|
|
57
|
+
if (output instanceof HibernationEventIterator) {
|
|
58
58
|
hibernationContext.iterator = output;
|
|
59
59
|
}
|
|
60
60
|
return output;
|
|
@@ -62,4 +62,4 @@ class experimental_HibernationPlugin {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export {
|
|
65
|
+
export { HibernationPlugin, encodeHibernationRPCEvent };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientOptions, 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, Schema, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure } from '@orpc/contract';
|
|
4
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
|
4
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
|
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
|
6
|
-
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
-
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.
|
|
8
|
-
export {
|
|
9
|
-
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.
|
|
10
|
-
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.
|
|
6
|
+
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
+
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.B4BGqy3Y.mjs';
|
|
8
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.B4BGqy3Y.mjs';
|
|
9
|
+
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.DzV1hr3z.mjs';
|
|
10
|
+
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.DzV1hr3z.mjs';
|
|
11
11
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
|
12
12
|
|
|
13
13
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientOptions, 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, Schema, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure } from '@orpc/contract';
|
|
4
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
|
4
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
|
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
|
6
|
-
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
-
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.
|
|
8
|
-
export {
|
|
9
|
-
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.
|
|
10
|
-
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.
|
|
6
|
+
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
+
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.B4BGqy3Y.js';
|
|
8
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.B4BGqy3Y.js';
|
|
9
|
+
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.Cb6yD7DZ.js';
|
|
10
|
+
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.Cb6yD7DZ.js';
|
|
11
11
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
|
12
12
|
|
|
13
13
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter, fallbackContractConfig } from '@orpc/contract';
|
|
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, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.
|
|
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,
|
|
2
|
+
export { ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
|
|
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.Ds4HPpvH.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, v as resolveContractProcedures, t as traverseContractProcedures, w as unlazyRouter } from './shared/server.Ds4HPpvH.mjs';
|
|
5
5
|
import { toORPCError } from '@orpc/client';
|
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
|
7
|
-
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
8
|
-
export { EventPublisher, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
+
import { isObject, resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
8
|
+
export { AsyncIteratorClass, EventPublisher, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
9
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
|
10
10
|
|
|
11
11
|
const DEFAULT_CONFIG = {
|
|
@@ -21,7 +21,7 @@ function fallbackConfig(key, value) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function decorateMiddleware(middleware) {
|
|
24
|
-
const decorated = (...args) => middleware(...args);
|
|
24
|
+
const decorated = ((...args) => middleware(...args));
|
|
25
25
|
decorated.mapInput = (mapInput) => {
|
|
26
26
|
const mapped = decorateMiddleware(
|
|
27
27
|
(options, input, ...rest) => middleware(options, mapInput(input), ...rest)
|
|
@@ -54,6 +54,9 @@ function createActionableClient(client) {
|
|
|
54
54
|
if (error instanceof Error && "digest" in error && typeof error.digest === "string" && error.digest.startsWith("NEXT_")) {
|
|
55
55
|
throw error;
|
|
56
56
|
}
|
|
57
|
+
if (error instanceof Response && "options" in error && isObject(error.options) || isObject(error) && error.isNotFound === true) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
57
60
|
return [toORPCError(error).toJSON(), void 0];
|
|
58
61
|
}
|
|
59
62
|
};
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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 { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
5
|
-
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.
|
|
4
|
+
import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DBCUJijK.mjs';
|
|
5
|
+
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.B4BGqy3Y.mjs';
|
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
|
7
7
|
import { ORPCError } from '@orpc/client';
|
|
8
8
|
|
|
@@ -160,6 +160,9 @@ interface StrictGetMethodPluginOptions {
|
|
|
160
160
|
*/
|
|
161
161
|
declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
162
162
|
private readonly error;
|
|
163
|
+
/**
|
|
164
|
+
* make sure execute before batch plugin to get real method
|
|
165
|
+
*/
|
|
163
166
|
order: number;
|
|
164
167
|
constructor(options?: StrictGetMethodPluginOptions);
|
|
165
168
|
init(options: StandardHandlerOptions<T>): void;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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 { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
5
|
-
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.
|
|
4
|
+
import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DPIFWpxG.js';
|
|
5
|
+
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.B4BGqy3Y.js';
|
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
|
7
7
|
import { ORPCError } from '@orpc/client';
|
|
8
8
|
|
|
@@ -160,6 +160,9 @@ interface StrictGetMethodPluginOptions {
|
|
|
160
160
|
*/
|
|
161
161
|
declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
162
162
|
private readonly error;
|
|
163
|
+
/**
|
|
164
|
+
* make sure execute before batch plugin to get real method
|
|
165
|
+
*/
|
|
163
166
|
order: number;
|
|
164
167
|
constructor(options?: StrictGetMethodPluginOptions);
|
|
165
168
|
init(options: StandardHandlerOptions<T>): void;
|