@orpc/server 0.0.0-next.a09e9be → 0.0.0-next.a153125
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 +5 -7
- package/dist/adapters/aws-lambda/index.d.mts +45 -0
- package/dist/adapters/aws-lambda/index.d.ts +45 -0
- package/dist/adapters/aws-lambda/index.mjs +41 -0
- package/dist/adapters/bun-ws/index.d.mts +4 -4
- package/dist/adapters/bun-ws/index.d.ts +4 -4
- package/dist/adapters/bun-ws/index.mjs +6 -10
- package/dist/adapters/crossws/index.d.mts +4 -4
- package/dist/adapters/crossws/index.d.ts +4 -4
- package/dist/adapters/crossws/index.mjs +6 -10
- package/dist/adapters/fetch/index.d.mts +6 -6
- package/dist/adapters/fetch/index.d.ts +6 -6
- package/dist/adapters/fetch/index.mjs +4 -4
- package/dist/adapters/message-port/index.d.mts +28 -0
- package/dist/adapters/message-port/index.d.ts +28 -0
- package/dist/adapters/message-port/index.mjs +41 -0
- package/dist/adapters/node/index.d.mts +6 -6
- package/dist/adapters/node/index.d.ts +6 -6
- package/dist/adapters/node/index.mjs +4 -4
- package/dist/adapters/standard/index.d.mts +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/adapters/standard/index.mjs +3 -2
- package/dist/adapters/websocket/index.d.mts +30 -6
- package/dist/adapters/websocket/index.d.ts +30 -6
- package/dist/adapters/websocket/index.mjs +48 -16
- package/dist/adapters/ws/index.d.mts +4 -4
- package/dist/adapters/ws/index.d.ts +4 -4
- package/dist/adapters/ws/index.mjs +6 -4
- 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 +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.mjs +21 -7
- package/dist/plugins/index.d.mts +13 -13
- package/dist/plugins/index.d.ts +13 -13
- package/dist/plugins/index.mjs +14 -6
- package/dist/shared/{server.YZzrREz9.d.ts → server.-ACo36I0.d.ts} +6 -6
- package/dist/shared/{server.Cy1vfSiG.d.ts → server.BPAWobQg.d.ts} +2 -2
- package/dist/shared/{server.BRoxSiSC.d.mts → server.Bd52nNaH.d.mts} +2 -2
- package/dist/shared/{server.QUe9N8P4.d.mts → server.BliFSTnG.d.mts} +2 -2
- package/dist/shared/{server.SxlTJfG2.mjs → server.CB8Snncu.mjs} +8 -5
- 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.DG7Tamti.mjs → server.DLJzqnSX.mjs} +3 -2
- package/dist/shared/{server.BVwwTHyO.mjs → server.DZ5BIITo.mjs} +1 -1
- package/dist/shared/{server.eWLxY3lq.d.mts → server.Dq8xr7PQ.d.mts} +6 -6
- package/dist/shared/{server.BjiJH9Vo.d.ts → server.IG2MjhrD.d.ts} +2 -2
- package/package.json +26 -10
package/README.md
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
31
31
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
32
32
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
33
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
33
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
34
34
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
35
35
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
36
36
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
@@ -49,14 +49,12 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
49
49
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
50
50
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
51
51
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
52
|
-
- [@orpc/
|
52
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
53
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
53
54
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
54
|
-
- [@orpc/
|
55
|
-
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
56
|
-
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
57
|
-
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
55
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
58
56
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
59
|
-
- [@orpc/
|
57
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
60
58
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
61
59
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
62
60
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { SendStandardResponseOptions, APIGatewayProxyEventV2, ResponseStream } from '@orpc/standard-server-aws-lambda';
|
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
|
+
interface AwsLambdaHandlerOptions extends SendStandardResponseOptions {
|
13
|
+
}
|
14
|
+
type AwsLambdaHandleResult = {
|
15
|
+
matched: true;
|
16
|
+
} | {
|
17
|
+
matched: false;
|
18
|
+
};
|
19
|
+
declare class AwsLambdaHandler<T extends Context> {
|
20
|
+
private readonly standardHandler;
|
21
|
+
private readonly sendStandardResponseOptions;
|
22
|
+
constructor(standardHandler: StandardHandler<T>, options?: AwsLambdaHandlerOptions);
|
23
|
+
handle(event: APIGatewayProxyEventV2, responseStream: ResponseStream, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<AwsLambdaHandleResult>;
|
24
|
+
}
|
25
|
+
|
26
|
+
type RPCHandlerOptions<T extends Context> = AwsLambdaHandlerOptions & StandardRPCHandlerOptions<T> & {
|
27
|
+
/**
|
28
|
+
* Enables or disables the StrictGetMethodPlugin.
|
29
|
+
*
|
30
|
+
* @default true
|
31
|
+
*/
|
32
|
+
strictGetMethodPluginEnabled?: boolean;
|
33
|
+
};
|
34
|
+
/**
|
35
|
+
* RPC Handler for AWS Lambda.
|
36
|
+
*
|
37
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
38
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
39
|
+
*/
|
40
|
+
declare class experimental_RPCHandler<T extends Context> extends AwsLambdaHandler<T> {
|
41
|
+
constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
|
42
|
+
}
|
43
|
+
|
44
|
+
export { AwsLambdaHandler, experimental_RPCHandler };
|
45
|
+
export type { AwsLambdaHandleResult, AwsLambdaHandlerOptions, RPCHandlerOptions };
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { SendStandardResponseOptions, APIGatewayProxyEventV2, ResponseStream } from '@orpc/standard-server-aws-lambda';
|
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
|
+
interface AwsLambdaHandlerOptions extends SendStandardResponseOptions {
|
13
|
+
}
|
14
|
+
type AwsLambdaHandleResult = {
|
15
|
+
matched: true;
|
16
|
+
} | {
|
17
|
+
matched: false;
|
18
|
+
};
|
19
|
+
declare class AwsLambdaHandler<T extends Context> {
|
20
|
+
private readonly standardHandler;
|
21
|
+
private readonly sendStandardResponseOptions;
|
22
|
+
constructor(standardHandler: StandardHandler<T>, options?: AwsLambdaHandlerOptions);
|
23
|
+
handle(event: APIGatewayProxyEventV2, responseStream: ResponseStream, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<AwsLambdaHandleResult>;
|
24
|
+
}
|
25
|
+
|
26
|
+
type RPCHandlerOptions<T extends Context> = AwsLambdaHandlerOptions & StandardRPCHandlerOptions<T> & {
|
27
|
+
/**
|
28
|
+
* Enables or disables the StrictGetMethodPlugin.
|
29
|
+
*
|
30
|
+
* @default true
|
31
|
+
*/
|
32
|
+
strictGetMethodPluginEnabled?: boolean;
|
33
|
+
};
|
34
|
+
/**
|
35
|
+
* RPC Handler for AWS Lambda.
|
36
|
+
*
|
37
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
38
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
39
|
+
*/
|
40
|
+
declare class experimental_RPCHandler<T extends Context> extends AwsLambdaHandler<T> {
|
41
|
+
constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
|
42
|
+
}
|
43
|
+
|
44
|
+
export { AwsLambdaHandler, experimental_RPCHandler };
|
45
|
+
export type { AwsLambdaHandleResult, AwsLambdaHandlerOptions, RPCHandlerOptions };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
|
+
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-aws-lambda';
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
4
|
+
import '@orpc/standard-server';
|
5
|
+
import '@orpc/standard-server/batch';
|
6
|
+
import '@orpc/client';
|
7
|
+
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
8
|
+
import '@orpc/contract';
|
9
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
10
|
+
import '@orpc/client/standard';
|
11
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
12
|
+
|
13
|
+
class AwsLambdaHandler {
|
14
|
+
constructor(standardHandler, options = {}) {
|
15
|
+
this.standardHandler = standardHandler;
|
16
|
+
this.sendStandardResponseOptions = options;
|
17
|
+
}
|
18
|
+
sendStandardResponseOptions;
|
19
|
+
async handle(event, responseStream, ...rest) {
|
20
|
+
const standardRequest = toStandardLazyRequest(event, responseStream);
|
21
|
+
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
22
|
+
const result = await this.standardHandler.handle(standardRequest, options);
|
23
|
+
if (!result.matched) {
|
24
|
+
return { matched: false };
|
25
|
+
}
|
26
|
+
await sendStandardResponse(responseStream, result.response, this.sendStandardResponseOptions);
|
27
|
+
return { matched: true };
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
class experimental_RPCHandler extends AwsLambdaHandler {
|
32
|
+
constructor(router, options = {}) {
|
33
|
+
if (options.strictGetMethodPluginEnabled ?? true) {
|
34
|
+
options.plugins ??= [];
|
35
|
+
options.plugins.push(new StrictGetMethodPlugin());
|
36
|
+
}
|
37
|
+
super(new StandardRPCHandler(router, options), options);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
export { AwsLambdaHandler, experimental_RPCHandler };
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
-
import { C as Context, R as Router } from '../../shared/server.
|
3
|
-
import { i as StandardHandler } from '../../shared/server.
|
4
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
5
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.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
6
|
import '@orpc/client';
|
7
7
|
import '@orpc/contract';
|
8
8
|
import '@orpc/standard-server';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
|
-
import { C as Context, R as Router } from '../../shared/server.
|
3
|
-
import { i as StandardHandler } from '../../shared/server.
|
4
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
5
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
2
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.js';
|
3
|
+
import { i as StandardHandler } from '../../shared/server.-ACo36I0.js';
|
4
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.IG2MjhrD.js';
|
5
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BPAWobQg.js';
|
6
6
|
import '@orpc/client';
|
7
7
|
import '@orpc/contract';
|
8
8
|
import '@orpc/standard-server';
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
4
4
|
import '@orpc/client';
|
5
|
+
import '@orpc/standard-server';
|
5
6
|
import '@orpc/contract';
|
6
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
9
10
|
|
10
11
|
class experimental_BunWsHandler {
|
11
12
|
constructor(standardHandler) {
|
@@ -15,13 +16,8 @@ class experimental_BunWsHandler {
|
|
15
16
|
async message(ws, message, ...rest) {
|
16
17
|
let peer = this.peers.get(ws);
|
17
18
|
if (!peer) {
|
18
|
-
this.peers.set(ws, peer = new ServerPeer(
|
19
|
-
|
20
|
-
const buffer = await raw.arrayBuffer();
|
21
|
-
ws.send(buffer);
|
22
|
-
} else {
|
23
|
-
ws.send(raw);
|
24
|
-
}
|
19
|
+
this.peers.set(ws, peer = new ServerPeer((message2) => {
|
20
|
+
ws.send(message2);
|
25
21
|
}));
|
26
22
|
}
|
27
23
|
const [id, request] = await peer.message(typeof message === "string" ? message : message.buffer);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { Peer, Message } from 'crossws';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.mjs';
|
4
|
+
import { i as StandardHandler } from '../../shared/server.Dq8xr7PQ.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BliFSTnG.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.Bd52nNaH.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { Peer, Message } from 'crossws';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.js';
|
4
|
+
import { i as StandardHandler } from '../../shared/server.-ACo36I0.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.IG2MjhrD.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BPAWobQg.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
3
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
4
4
|
import '@orpc/client';
|
5
|
+
import '@orpc/standard-server';
|
5
6
|
import '@orpc/contract';
|
6
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
9
10
|
|
10
11
|
class experimental_CrosswsHandler {
|
11
12
|
constructor(standardHandler) {
|
@@ -15,13 +16,8 @@ class experimental_CrosswsHandler {
|
|
15
16
|
async message(ws, message, ...rest) {
|
16
17
|
let peer = this.peers.get(ws);
|
17
18
|
if (!peer) {
|
18
|
-
this.peers.set(ws, peer = new ServerPeer(
|
19
|
-
|
20
|
-
const buffer = await raw.arrayBuffer();
|
21
|
-
ws.send(buffer);
|
22
|
-
} else {
|
23
|
-
ws.send(raw);
|
24
|
-
}
|
19
|
+
this.peers.set(ws, peer = new ServerPeer((message2) => {
|
20
|
+
ws.send(message2);
|
25
21
|
}));
|
26
22
|
}
|
27
23
|
const [id, request] = await peer.message(typeof message.rawData === "string" ? message.rawData : message.uint8Array());
|
@@ -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 { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
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';
|
@@ -28,7 +28,7 @@ interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHand
|
|
28
28
|
toFetchResponseOptions: ToFetchResponseOptions;
|
29
29
|
}
|
30
30
|
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
31
|
-
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, FetchHandleResult
|
31
|
+
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, Promise<FetchHandleResult>>[];
|
32
32
|
plugins?: FetchHandlerPlugin<T>[];
|
33
33
|
}
|
34
34
|
declare class FetchHandler<T extends Context> {
|
@@ -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 { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
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';
|
@@ -28,7 +28,7 @@ interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHand
|
|
28
28
|
toFetchResponseOptions: ToFetchResponseOptions;
|
29
29
|
}
|
30
30
|
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
31
|
-
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, FetchHandleResult
|
31
|
+
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, Promise<FetchHandleResult>>[];
|
32
32
|
plugins?: FetchHandlerPlugin<T>[];
|
33
33
|
}
|
34
34
|
declare class FetchHandler<T extends Context> {
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
2
2
|
import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fetch';
|
4
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
4
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.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.CB8Snncu.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '@orpc/standard-server/batch';
|
9
|
-
import '@orpc/standard-server';
|
10
10
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
11
|
-
import '../../shared/server.
|
11
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
12
12
|
|
13
13
|
class BodyLimitPlugin {
|
14
14
|
maxBodySize;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { SupportedMessagePort } from '@orpc/client/message-port';
|
2
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
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_MessagePortHandler<T extends Context> {
|
13
|
+
private readonly standardHandler;
|
14
|
+
constructor(standardHandler: StandardHandler<T>);
|
15
|
+
upgrade(port: SupportedMessagePort, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): void;
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* RPC Handler for common message port implementations.
|
20
|
+
*
|
21
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
22
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/message-port Message Port Adapter Docs}
|
23
|
+
*/
|
24
|
+
declare class experimental_RPCHandler<T extends Context> extends experimental_MessagePortHandler<T> {
|
25
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
|
26
|
+
}
|
27
|
+
|
28
|
+
export { experimental_MessagePortHandler, experimental_RPCHandler };
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { SupportedMessagePort } from '@orpc/client/message-port';
|
2
|
+
import { MaybeOptionalOptions } from '@orpc/shared';
|
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_MessagePortHandler<T extends Context> {
|
13
|
+
private readonly standardHandler;
|
14
|
+
constructor(standardHandler: StandardHandler<T>);
|
15
|
+
upgrade(port: SupportedMessagePort, ...rest: MaybeOptionalOptions<Omit<FriendlyStandardHandleOptions<T>, 'prefix'>>): void;
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* RPC Handler for common message port implementations.
|
20
|
+
*
|
21
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
22
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/message-port Message Port Adapter Docs}
|
23
|
+
*/
|
24
|
+
declare class experimental_RPCHandler<T extends Context> extends experimental_MessagePortHandler<T> {
|
25
|
+
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
|
26
|
+
}
|
27
|
+
|
28
|
+
export { experimental_MessagePortHandler, experimental_RPCHandler };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { postMessagePortMessage, onMessagePortMessage, onMessagePortClose } from '@orpc/client/message-port';
|
2
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
3
|
+
import { ServerPeer } from '@orpc/standard-server-peer';
|
4
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
5
|
+
import '@orpc/client';
|
6
|
+
import '@orpc/standard-server';
|
7
|
+
import '@orpc/contract';
|
8
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
9
|
+
import '@orpc/client/standard';
|
10
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
11
|
+
|
12
|
+
class experimental_MessagePortHandler {
|
13
|
+
constructor(standardHandler) {
|
14
|
+
this.standardHandler = standardHandler;
|
15
|
+
}
|
16
|
+
upgrade(port, ...rest) {
|
17
|
+
const peer = new ServerPeer((message) => {
|
18
|
+
return postMessagePortMessage(port, message);
|
19
|
+
});
|
20
|
+
onMessagePortMessage(port, async (message) => {
|
21
|
+
const [id, request] = await peer.message(message);
|
22
|
+
if (!request) {
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
26
|
+
const { response } = await this.standardHandler.handle({ ...request, body: () => Promise.resolve(request.body) }, options);
|
27
|
+
await peer.response(id, response ?? { status: 404, headers: {}, body: "No procedure matched" });
|
28
|
+
});
|
29
|
+
onMessagePortClose(port, () => {
|
30
|
+
peer.close();
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
class experimental_RPCHandler extends experimental_MessagePortHandler {
|
36
|
+
constructor(router, options = {}) {
|
37
|
+
super(new StandardRPCHandler(router, options));
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
export { experimental_MessagePortHandler, experimental_RPCHandler };
|
@@ -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> {
|
@@ -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> {
|
@@ -1,14 +1,14 @@
|
|
1
1
|
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
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
4
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.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.CB8Snncu.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '@orpc/standard-server/batch';
|
9
|
-
import '@orpc/standard-server';
|
10
10
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
11
|
-
import '../../shared/server.
|
11
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
12
12
|
|
13
13
|
class BodyLimitPlugin {
|
14
14
|
maxBodySize;
|
@@ -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,6 +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.CB8Snncu.mjs';
|
2
2
|
import '@orpc/client/standard';
|
3
3
|
import '@orpc/client';
|
4
4
|
import '@orpc/shared';
|
5
|
-
import '
|
5
|
+
import '@orpc/standard-server';
|
6
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
6
7
|
import '@orpc/contract';
|