@orpc/server 0.0.0-next.de766b3 → 0.0.0-next.de7ca70
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 -1
- package/dist/adapters/aws-lambda/index.d.mts +4 -4
- package/dist/adapters/aws-lambda/index.d.ts +4 -4
- package/dist/adapters/aws-lambda/index.mjs +2 -2
- package/dist/adapters/bun-ws/index.d.mts +8 -8
- package/dist/adapters/bun-ws/index.d.ts +8 -8
- package/dist/adapters/bun-ws/index.mjs +11 -10
- package/dist/adapters/crossws/index.d.mts +7 -5
- package/dist/adapters/crossws/index.d.ts +7 -5
- package/dist/adapters/crossws/index.mjs +11 -10
- package/dist/adapters/fetch/index.d.mts +4 -4
- package/dist/adapters/fetch/index.d.ts +4 -4
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/message-port/index.d.mts +7 -5
- package/dist/adapters/message-port/index.d.ts +7 -5
- package/dist/adapters/message-port/index.mjs +10 -10
- package/dist/adapters/node/index.d.mts +4 -4
- package/dist/adapters/node/index.d.ts +4 -4
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.d.mts +5 -4
- package/dist/adapters/standard/index.d.ts +5 -4
- package/dist/adapters/standard/index.mjs +3 -2
- package/dist/adapters/standard-peer/index.d.mts +14 -0
- package/dist/adapters/standard-peer/index.d.ts +14 -0
- package/dist/adapters/standard-peer/index.mjs +7 -0
- package/dist/adapters/websocket/index.d.mts +32 -6
- package/dist/adapters/websocket/index.d.ts +32 -6
- package/dist/adapters/websocket/index.mjs +48 -18
- package/dist/adapters/ws/index.d.mts +7 -5
- package/dist/adapters/ws/index.d.ts +7 -5
- package/dist/adapters/ws/index.mjs +12 -12
- 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 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.mjs +3 -3
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/plugins/index.mjs +9 -3
- package/dist/shared/{server.DD2C4ujN.d.mts → server.6ohwBdwx.d.mts} +2 -2
- package/dist/shared/{server.DD2C4ujN.d.ts → server.6ohwBdwx.d.ts} +2 -2
- package/dist/shared/server.B3dVpAsJ.d.mts +12 -0
- package/dist/shared/{server.BPAWobQg.d.ts → server.B6GspgNq.d.ts} +2 -2
- package/dist/shared/{server.-ACo36I0.d.ts → server.BE3B4vij.d.ts} +3 -3
- package/dist/shared/{server.Dq8xr7PQ.d.mts → server.BtQsqpPB.d.mts} +3 -3
- package/dist/shared/{server.CHvOkcM3.mjs → server.CB8Snncu.mjs} +1 -1
- package/dist/shared/{server.Bd52nNaH.d.mts → server.CKafa5G2.d.mts} +2 -2
- package/dist/shared/server.CeW2jMCj.d.ts +12 -0
- package/dist/shared/{server.DG7Tamti.mjs → server.DLJzqnSX.mjs} +3 -2
- package/dist/shared/server.DxNFsvpM.mjs +20 -0
- package/package.json +22 -12
- package/dist/shared/server.BliFSTnG.d.mts +0 -10
- package/dist/shared/server.IG2MjhrD.d.ts +0 -10
@@ -1,17 +1,42 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
-
import { C as Context, R as Router } from '../../shared/server.
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.6ohwBdwx.js';
|
3
|
+
import { a as StandardHandler } from '../../shared/server.BE3B4vij.js';
|
4
|
+
import { experimental_HandleStandardServerPeerMessageOptions } from '../standard-peer/index.js';
|
5
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.B6GspgNq.js';
|
6
6
|
import '@orpc/client';
|
7
7
|
import '@orpc/contract';
|
8
8
|
import '@orpc/standard-server';
|
9
|
+
import '@orpc/standard-server-peer';
|
10
|
+
import '../../shared/server.CeW2jMCj.js';
|
9
11
|
import '@orpc/client/standard';
|
10
12
|
|
13
|
+
type experimental_MinimalWebsocket = Pick<WebSocket, 'addEventListener' | 'send'>;
|
11
14
|
declare class experimental_WebsocketHandler<T extends Context> {
|
12
|
-
private
|
15
|
+
#private;
|
13
16
|
constructor(standardHandler: StandardHandler<T>);
|
14
|
-
|
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
|
+
*/
|
24
|
+
upgrade(ws: experimental_MinimalWebsocket, ...rest: MaybeOptionalOptions<experimental_HandleStandardServerPeerMessageOptions<T>>): void;
|
25
|
+
/**
|
26
|
+
* Handles a single message received from a WebSocket.
|
27
|
+
*
|
28
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
29
|
+
*
|
30
|
+
* @param ws The WebSocket instance
|
31
|
+
* @param data The message payload, usually place in `event.data`
|
32
|
+
*/
|
33
|
+
message(ws: experimental_MinimalWebsocket, data: string | ArrayBuffer | Blob, ...rest: MaybeOptionalOptions<experimental_HandleStandardServerPeerMessageOptions<T>>): Promise<void>;
|
34
|
+
/**
|
35
|
+
* Closes the WebSocket peer and cleans up.
|
36
|
+
*
|
37
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
38
|
+
*/
|
39
|
+
close(ws: experimental_MinimalWebsocket): void;
|
15
40
|
}
|
16
41
|
|
17
42
|
/**
|
@@ -25,3 +50,4 @@ declare class experimental_RPCHandler<T extends Context> extends experimental_We
|
|
25
50
|
}
|
26
51
|
|
27
52
|
export { experimental_RPCHandler, experimental_WebsocketHandler };
|
53
|
+
export type { experimental_MinimalWebsocket };
|
@@ -1,32 +1,62 @@
|
|
1
|
-
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
1
|
+
import { readAsBuffer, resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
-
import {
|
3
|
+
import { e as experimental_handleStandardServerPeerMessage } from '../../shared/server.DxNFsvpM.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.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DZ5BIITo.mjs';
|
10
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
10
11
|
|
11
12
|
class experimental_WebsocketHandler {
|
13
|
+
#peers = /* @__PURE__ */ new WeakMap();
|
14
|
+
#handler;
|
12
15
|
constructor(standardHandler) {
|
13
|
-
this
|
16
|
+
this.#handler = standardHandler;
|
14
17
|
}
|
18
|
+
/**
|
19
|
+
* Upgrades a WebSocket to enable handling
|
20
|
+
*
|
21
|
+
* This attaches the necessary 'message' and 'close' listeners to the WebSocket
|
22
|
+
*
|
23
|
+
* @warning Do not use this method if you're using `.message()` or `.close()`
|
24
|
+
*/
|
15
25
|
upgrade(ws, ...rest) {
|
16
|
-
|
17
|
-
ws.addEventListener("
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
ws.addEventListener("message", (event) => this.message(ws, event.data, ...rest));
|
27
|
+
ws.addEventListener("close", () => this.close(ws));
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Handles a single message received from a WebSocket.
|
31
|
+
*
|
32
|
+
* @warning Avoid calling this directly if `.upgrade()` is used.
|
33
|
+
*
|
34
|
+
* @param ws The WebSocket instance
|
35
|
+
* @param data The message payload, usually place in `event.data`
|
36
|
+
*/
|
37
|
+
async message(ws, data, ...rest) {
|
38
|
+
let peer = this.#peers.get(ws);
|
39
|
+
if (!peer) {
|
40
|
+
this.#peers.set(ws, peer = new ServerPeer(ws.send.bind(ws)));
|
41
|
+
}
|
42
|
+
const message = data instanceof Blob ? await readAsBuffer(data) : data;
|
43
|
+
await experimental_handleStandardServerPeerMessage(
|
44
|
+
this.#handler,
|
45
|
+
peer,
|
46
|
+
message,
|
47
|
+
resolveMaybeOptionalOptions(rest)
|
48
|
+
);
|
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) {
|
28
58
|
peer.close();
|
29
|
-
}
|
59
|
+
}
|
30
60
|
}
|
31
61
|
}
|
32
62
|
|
@@ -1,18 +1,20 @@
|
|
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 {
|
5
|
-
import {
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.6ohwBdwx.mjs';
|
4
|
+
import { a as StandardHandler } from '../../shared/server.BtQsqpPB.mjs';
|
5
|
+
import { experimental_HandleStandardServerPeerMessageOptions } from '../standard-peer/index.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.CKafa5G2.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
10
|
+
import '@orpc/standard-server-peer';
|
11
|
+
import '../../shared/server.B3dVpAsJ.mjs';
|
10
12
|
import '@orpc/client/standard';
|
11
13
|
|
12
14
|
declare class experimental_WsHandler<T extends Context> {
|
13
15
|
private readonly standardHandler;
|
14
16
|
constructor(standardHandler: StandardHandler<T>);
|
15
|
-
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<
|
17
|
+
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<experimental_HandleStandardServerPeerMessageOptions<T>>): Promise<void>;
|
16
18
|
}
|
17
19
|
|
18
20
|
/**
|
@@ -1,18 +1,20 @@
|
|
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 {
|
5
|
-
import {
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.6ohwBdwx.js';
|
4
|
+
import { a as StandardHandler } from '../../shared/server.BE3B4vij.js';
|
5
|
+
import { experimental_HandleStandardServerPeerMessageOptions } from '../standard-peer/index.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.B6GspgNq.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
10
|
+
import '@orpc/standard-server-peer';
|
11
|
+
import '../../shared/server.CeW2jMCj.js';
|
10
12
|
import '@orpc/client/standard';
|
11
13
|
|
12
14
|
declare class experimental_WsHandler<T extends Context> {
|
13
15
|
private readonly standardHandler;
|
14
16
|
constructor(standardHandler: StandardHandler<T>);
|
15
|
-
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<
|
17
|
+
upgrade(ws: Pick<WebSocket, 'addEventListener' | 'send'>, ...rest: MaybeOptionalOptions<experimental_HandleStandardServerPeerMessageOptions<T>>): Promise<void>;
|
16
18
|
}
|
17
19
|
|
18
20
|
/**
|
@@ -1,12 +1,13 @@
|
|
1
|
-
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
1
|
+
import { readAsBuffer, resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
-
import {
|
3
|
+
import { e as experimental_handleStandardServerPeerMessage } from '../../shared/server.DxNFsvpM.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.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DZ5BIITo.mjs';
|
10
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
10
11
|
|
11
12
|
class experimental_WsHandler {
|
12
13
|
constructor(standardHandler) {
|
@@ -15,14 +16,13 @@ class experimental_WsHandler {
|
|
15
16
|
async upgrade(ws, ...rest) {
|
16
17
|
const peer = new ServerPeer(ws.send.bind(ws));
|
17
18
|
ws.addEventListener("message", async (event) => {
|
18
|
-
const message = Array.isArray(event.data) ? await new Blob(event.data)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
await peer.response(id, response ?? { status: 404, headers: {}, body: "No procedure matched" });
|
19
|
+
const message = Array.isArray(event.data) ? await readAsBuffer(new Blob(event.data)) : event.data;
|
20
|
+
await experimental_handleStandardServerPeerMessage(
|
21
|
+
this.standardHandler,
|
22
|
+
peer,
|
23
|
+
message,
|
24
|
+
resolveMaybeOptionalOptions(rest)
|
25
|
+
);
|
26
26
|
});
|
27
27
|
ws.addEventListener("close", () => {
|
28
28
|
peer.close();
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
+
import { c as StandardHandlerPlugin, S as StandardHandlerOptions } from '../shared/server.BtQsqpPB.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.6ohwBdwx.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: string, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
|
28
|
+
|
29
|
+
interface experimental_HibernationPluginContext {
|
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 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_HibernationPluginContext };
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
+
import { c as StandardHandlerPlugin, S as StandardHandlerOptions } from '../shared/server.BE3B4vij.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.6ohwBdwx.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: string, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
|
28
|
+
|
29
|
+
interface experimental_HibernationPluginContext {
|
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 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_HibernationPluginContext };
|
@@ -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
|
+
CONTEXT_SYMBOL = Symbol("ORPC_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.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.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, HTTPMethod, ClientPromiseResult } from '@orpc/client';
|
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, 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
6
|
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
-
import { C as Context,
|
8
|
-
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs,
|
7
|
+
import { C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as AnyMiddleware, L as Lazyable, a as AnyRouter, i as Lazy, A as AnyProcedure, j as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.6ohwBdwx.mjs';
|
8
|
+
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, x as MiddlewareNextFn, w as MiddlewareNextFnOptions, z as MiddlewareOptions, y as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, P as ProcedureClientInterceptorOptions, E as ProcedureDef, D as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, G as createProcedureClient, s as getLazyMeta, r as isLazy, F as isProcedure, q as lazy, m as mergeCurrentContext, B as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.6ohwBdwx.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> & {
|
@@ -510,7 +510,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
510
510
|
/**
|
511
511
|
* Sets or overrides the config.
|
512
512
|
*
|
513
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
513
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
514
514
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
515
515
|
*/
|
516
516
|
$config(config: BuilderConfig): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
@@ -730,9 +730,9 @@ interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitial
|
|
730
730
|
default: U;
|
731
731
|
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
732
732
|
}
|
733
|
-
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> =
|
733
|
+
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
734
734
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
735
|
-
}
|
735
|
+
};
|
736
736
|
|
737
737
|
interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
738
738
|
/**
|
@@ -768,9 +768,9 @@ interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends
|
|
768
768
|
default: U;
|
769
769
|
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
770
770
|
}
|
771
|
-
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> =
|
771
|
+
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementer<TContract, TInitialContext, TCurrentContext> & {
|
772
772
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternal<TContract[K], TInitialContext, TCurrentContext> : never;
|
773
|
-
}
|
773
|
+
};
|
774
774
|
declare function implementerInternal<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context>(contract: T, config: BuilderConfig, middlewares: AnyMiddleware[]): ImplementerInternal<T, TInitialContext, TCurrentContext>;
|
775
775
|
type Implementer<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = {
|
776
776
|
/**
|
@@ -782,7 +782,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
782
782
|
/**
|
783
783
|
* Sets or overrides the config.
|
784
784
|
*
|
785
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
785
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
786
786
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
787
787
|
*/
|
788
788
|
$config(config: BuilderConfig): Implementer<TContract, TInitialContext, TCurrentContext>;
|
@@ -815,7 +815,7 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
815
815
|
* ```
|
816
816
|
*
|
817
817
|
*/
|
818
|
-
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never
|
818
|
+
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
819
819
|
|
820
820
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
|
821
821
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
package/dist/index.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientPromiseResult } from '@orpc/client';
|
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, 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
6
|
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
-
import { C as Context,
|
8
|
-
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs,
|
7
|
+
import { C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as AnyMiddleware, L as Lazyable, a as AnyRouter, i as Lazy, A as AnyProcedure, j as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.6ohwBdwx.js';
|
8
|
+
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, x as MiddlewareNextFn, w as MiddlewareNextFnOptions, z as MiddlewareOptions, y as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, P as ProcedureClientInterceptorOptions, E as ProcedureDef, D as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, G as createProcedureClient, s as getLazyMeta, r as isLazy, F as isProcedure, q as lazy, m as mergeCurrentContext, B as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.6ohwBdwx.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> & {
|
@@ -510,7 +510,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
510
510
|
/**
|
511
511
|
* Sets or overrides the config.
|
512
512
|
*
|
513
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
513
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
514
514
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
515
515
|
*/
|
516
516
|
$config(config: BuilderConfig): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
@@ -730,9 +730,9 @@ interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitial
|
|
730
730
|
default: U;
|
731
731
|
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
732
732
|
}
|
733
|
-
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> =
|
733
|
+
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
734
734
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
735
|
-
}
|
735
|
+
};
|
736
736
|
|
737
737
|
interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
738
738
|
/**
|
@@ -768,9 +768,9 @@ interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends
|
|
768
768
|
default: U;
|
769
769
|
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
770
770
|
}
|
771
|
-
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> =
|
771
|
+
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementer<TContract, TInitialContext, TCurrentContext> & {
|
772
772
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternal<TContract[K], TInitialContext, TCurrentContext> : never;
|
773
|
-
}
|
773
|
+
};
|
774
774
|
declare function implementerInternal<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context>(contract: T, config: BuilderConfig, middlewares: AnyMiddleware[]): ImplementerInternal<T, TInitialContext, TCurrentContext>;
|
775
775
|
type Implementer<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = {
|
776
776
|
/**
|
@@ -782,7 +782,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
782
782
|
/**
|
783
783
|
* Sets or overrides the config.
|
784
784
|
*
|
785
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
785
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
786
786
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
787
787
|
*/
|
788
788
|
$config(config: BuilderConfig): Implementer<TContract, TInitialContext, TCurrentContext>;
|
@@ -815,7 +815,7 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
815
815
|
* ```
|
816
816
|
*
|
817
817
|
*/
|
818
|
-
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never
|
818
|
+
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
819
819
|
|
820
820
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
|
821
821
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
package/dist/index.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
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, 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, w as resolveContractProcedures, t as traverseContractProcedures, x as unlazyRouter, v as validateORPCError } from './shared/server.
|
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.DLJzqnSX.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.DLJzqnSX.mjs';
|
5
5
|
import { toORPCError } from '@orpc/client';
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
7
7
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
@@ -151,7 +151,7 @@ class Builder {
|
|
151
151
|
/**
|
152
152
|
* Sets or overrides the config.
|
153
153
|
*
|
154
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
154
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
155
155
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
156
156
|
*/
|
157
157
|
$config(config) {
|
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 {
|
5
|
-
import { C as Context,
|
4
|
+
import { i as StandardHandlerInterceptorOptions, c as StandardHandlerPlugin, S as StandardHandlerOptions } from '../shared/server.BtQsqpPB.mjs';
|
5
|
+
import { C as Context, P as ProcedureClientInterceptorOptions } from '../shared/server.6ohwBdwx.mjs';
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
7
7
|
import { ORPCError } from '@orpc/client';
|
8
8
|
|
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 {
|
5
|
-
import { C as Context,
|
4
|
+
import { i as StandardHandlerInterceptorOptions, c as StandardHandlerPlugin, S as StandardHandlerOptions } from '../shared/server.BE3B4vij.js';
|
5
|
+
import { C as Context, P as ProcedureClientInterceptorOptions } from '../shared/server.6ohwBdwx.js';
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
7
7
|
import { ORPCError } from '@orpc/client';
|
8
8
|
|
package/dist/plugins/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { value, isAsyncIteratorObject } from '@orpc/shared';
|
1
|
+
import { value, isAsyncIteratorObject, clone } from '@orpc/shared';
|
2
2
|
import { flattenHeader } from '@orpc/standard-server';
|
3
3
|
import { parseBatchRequest, toBatchResponse } from '@orpc/standard-server/batch';
|
4
4
|
import { ORPCError } from '@orpc/client';
|
@@ -192,7 +192,7 @@ class ResponseHeadersPlugin {
|
|
192
192
|
if (!result.matched) {
|
193
193
|
return result;
|
194
194
|
}
|
195
|
-
const responseHeaders = result.response.headers;
|
195
|
+
const responseHeaders = clone(result.response.headers);
|
196
196
|
for (const [key, value] of resHeaders) {
|
197
197
|
if (Array.isArray(responseHeaders[key])) {
|
198
198
|
responseHeaders[key].push(value);
|
@@ -202,7 +202,13 @@ class ResponseHeadersPlugin {
|
|
202
202
|
responseHeaders[key] = value;
|
203
203
|
}
|
204
204
|
}
|
205
|
-
return
|
205
|
+
return {
|
206
|
+
...result,
|
207
|
+
response: {
|
208
|
+
...result.response,
|
209
|
+
headers: responseHeaders
|
210
|
+
}
|
211
|
+
};
|
206
212
|
});
|
207
213
|
}
|
208
214
|
}
|
@@ -188,5 +188,5 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
188
188
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
189
189
|
};
|
190
190
|
|
191
|
-
export { isProcedure as
|
192
|
-
export type {
|
191
|
+
export { middlewareOutputFn as B, isProcedure as F, createProcedureClient as G, Procedure as b, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, validateORPCError as v };
|
192
|
+
export type { AnyProcedure as A, Context as C, ProcedureHandlerOptions as D, ProcedureDef as E, InferRouterInitialContexts as H, InferRouterInitialContext as I, InferRouterCurrentContexts as J, InferRouterInputs as K, Lazyable as L, Middleware as M, InferRouterOutputs as N, ORPCErrorConstructorMap as O, ProcedureClientInterceptorOptions as P, Router as R, AnyRouter as a, MergedInitialContext as c, MergedCurrentContext as d, MapInputMiddleware as e, CreateProcedureClientOptions as f, ProcedureClient as g, AnyMiddleware as h, Lazy as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as w, MiddlewareNextFn as x, MiddlewareOutputFn as y, MiddlewareOptions as z };
|