@orpc/server 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/adapters/aws-lambda/index.d.mts +45 -0
- package/dist/adapters/aws-lambda/index.d.ts +45 -0
- package/dist/adapters/aws-lambda/index.mjs +41 -0
- package/dist/adapters/bun-ws/index.d.mts +4 -4
- package/dist/adapters/bun-ws/index.d.ts +4 -4
- package/dist/adapters/bun-ws/index.mjs +2 -1
- package/dist/adapters/crossws/index.d.mts +4 -4
- package/dist/adapters/crossws/index.d.ts +4 -4
- package/dist/adapters/crossws/index.mjs +2 -1
- package/dist/adapters/fetch/index.d.mts +6 -6
- package/dist/adapters/fetch/index.d.ts +6 -6
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/message-port/index.d.mts +28 -0
- package/dist/adapters/message-port/index.d.ts +28 -0
- package/dist/adapters/message-port/index.mjs +41 -0
- package/dist/adapters/node/index.d.mts +6 -6
- package/dist/adapters/node/index.d.ts +6 -6
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.d.mts +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/adapters/standard/index.mjs +2 -1
- package/dist/adapters/websocket/index.d.mts +4 -4
- package/dist/adapters/websocket/index.d.ts +4 -4
- package/dist/adapters/websocket/index.mjs +2 -1
- package/dist/adapters/ws/index.d.mts +4 -4
- package/dist/adapters/ws/index.d.ts +4 -4
- package/dist/adapters/ws/index.mjs +2 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +3 -2
- package/dist/plugins/index.d.mts +13 -13
- package/dist/plugins/index.d.ts +13 -13
- package/dist/plugins/index.mjs +5 -3
- package/dist/shared/{server.YZzrREz9.d.ts → server.-ACo36I0.d.ts} +6 -6
- package/dist/shared/{server.Cy1vfSiG.d.ts → server.BPAWobQg.d.ts} +2 -2
- package/dist/shared/{server.BRoxSiSC.d.mts → server.Bd52nNaH.d.mts} +2 -2
- package/dist/shared/{server.QUe9N8P4.d.mts → server.BliFSTnG.d.mts} +2 -2
- package/dist/shared/{server.SxlTJfG2.mjs → server.CHvOkcM3.mjs} +7 -4
- package/dist/shared/{server.DPWk5pjW.d.ts → server.DD2C4ujN.d.mts} +4 -4
- package/dist/shared/{server.DPWk5pjW.d.mts → server.DD2C4ujN.d.ts} +4 -4
- 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 +20 -9
package/README.md
CHANGED
@@ -49,6 +49,7 @@ 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/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
|
52
53
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
53
54
|
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
54
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).
|
@@ -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.BVwwTHyO.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.CHvOkcM3.mjs';
|
10
|
+
import '@orpc/client/standard';
|
11
|
+
import '../../shared/server.DG7Tamti.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';
|
@@ -2,8 +2,9 @@ import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
3
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.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.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '../../shared/server.DG7Tamti.mjs';
|
9
10
|
|
@@ -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';
|
@@ -2,8 +2,9 @@ import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
3
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.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.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '../../shared/server.DG7Tamti.mjs';
|
9
10
|
|
@@ -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> {
|
@@ -2,11 +2,11 @@ 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
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
5
|
+
import '@orpc/standard-server';
|
5
6
|
import '@orpc/contract';
|
6
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '@orpc/standard-server/batch';
|
9
|
-
import '@orpc/standard-server';
|
10
10
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
11
11
|
import '../../shared/server.DG7Tamti.mjs';
|
12
12
|
|
@@ -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 { 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.BVwwTHyO.mjs';
|
5
|
+
import '@orpc/client';
|
6
|
+
import '@orpc/standard-server';
|
7
|
+
import '@orpc/contract';
|
8
|
+
import { b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
9
|
+
import '@orpc/client/standard';
|
10
|
+
import '../../shared/server.DG7Tamti.mjs';
|
11
|
+
|
12
|
+
class experimental_MessagePortHandler {
|
13
|
+
constructor(standardHandler) {
|
14
|
+
this.standardHandler = standardHandler;
|
15
|
+
}
|
16
|
+
upgrade(port, ...rest) {
|
17
|
+
const peer = new ServerPeer(async (message) => {
|
18
|
+
port.postMessage(message instanceof Blob ? await message.arrayBuffer() : 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> {
|
@@ -2,11 +2,11 @@ import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
5
|
+
import '@orpc/standard-server';
|
5
6
|
import '@orpc/contract';
|
6
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '@orpc/standard-server/batch';
|
9
|
-
import '@orpc/standard-server';
|
10
10
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
11
11
|
import '../../shared/server.DG7Tamti.mjs';
|
12
12
|
|
@@ -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.CHvOkcM3.mjs';
|
2
2
|
import '@orpc/client/standard';
|
3
3
|
import '@orpc/client';
|
4
4
|
import '@orpc/shared';
|
5
|
+
import '@orpc/standard-server';
|
5
6
|
import '../../shared/server.DG7Tamti.mjs';
|
6
7
|
import '@orpc/contract';
|
@@ -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';
|
@@ -2,8 +2,9 @@ import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
3
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.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.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '../../shared/server.DG7Tamti.mjs';
|
9
10
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { WebSocket } from 'ws';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.mjs';
|
4
|
+
import { i as StandardHandler } from '../../shared/server.Dq8xr7PQ.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BliFSTnG.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.Bd52nNaH.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { WebSocket } from 'ws';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.DD2C4ujN.js';
|
4
|
+
import { i as StandardHandler } from '../../shared/server.-ACo36I0.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.IG2MjhrD.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BPAWobQg.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -2,8 +2,9 @@ import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { ServerPeer } from '@orpc/standard-server-peer';
|
3
3
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.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.CHvOkcM3.mjs';
|
7
8
|
import '@orpc/client/standard';
|
8
9
|
import '../../shared/server.DG7Tamti.mjs';
|
9
10
|
|
package/dist/index.d.mts
CHANGED
@@ -4,8 +4,8 @@ import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErro
|
|
4
4
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
6
6
|
export { IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
-
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.
|
8
|
-
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.
|
7
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.DD2C4ujN.mjs';
|
8
|
+
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.DD2C4ujN.mjs';
|
9
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
10
10
|
|
11
11
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
package/dist/index.d.ts
CHANGED
@@ -4,8 +4,8 @@ import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErro
|
|
4
4
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
6
6
|
export { IntersectPick, Registry, ThrowableError, onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
-
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.
|
8
|
-
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.
|
7
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.DD2C4ujN.js';
|
8
|
+
export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, w as MiddlewareNextFn, t as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, F as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, G as createProcedureClient, r as getLazyMeta, q as isLazy, E as isProcedure, p as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.DD2C4ujN.js';
|
9
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
10
10
|
|
11
11
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
package/dist/index.mjs
CHANGED
@@ -4,6 +4,7 @@ import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as en
|
|
4
4
|
export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, w as resolveContractProcedures, t as traverseContractProcedures, u as unlazy, x as unlazyRouter, v as validateORPCError } from './shared/server.DG7Tamti.mjs';
|
5
5
|
import { toORPCError } from '@orpc/client';
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
7
|
+
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
7
8
|
export { onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
8
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
9
10
|
|
@@ -449,10 +450,10 @@ function implement(contract, config = {}) {
|
|
449
450
|
|
450
451
|
function createRouterClient(router, ...rest) {
|
451
452
|
if (isProcedure(router)) {
|
452
|
-
const caller = createProcedureClient(router,
|
453
|
+
const caller = createProcedureClient(router, resolveMaybeOptionalOptions(rest));
|
453
454
|
return caller;
|
454
455
|
}
|
455
|
-
const procedureCaller = isLazy(router) ? createProcedureClient(createAssertedLazyProcedure(router),
|
456
|
+
const procedureCaller = isLazy(router) ? createProcedureClient(createAssertedLazyProcedure(router), resolveMaybeOptionalOptions(rest)) : {};
|
456
457
|
const recursive = new Proxy(procedureCaller, {
|
457
458
|
get(target, key) {
|
458
459
|
if (typeof key !== "string") {
|
package/dist/plugins/index.d.mts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Value } from '@orpc/shared';
|
1
|
+
import { Value, Promisable } from '@orpc/shared';
|
2
2
|
import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
|
3
3
|
import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
|
4
|
-
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.
|
5
|
-
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.
|
4
|
+
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.Dq8xr7PQ.mjs';
|
5
|
+
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.DD2C4ujN.mjs';
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
7
7
|
import { ORPCError } from '@orpc/client';
|
8
8
|
|
@@ -12,7 +12,7 @@ interface BatchHandlerOptions<T extends Context> {
|
|
12
12
|
*
|
13
13
|
* @default 10
|
14
14
|
*/
|
15
|
-
maxSize?: Value<number
|
15
|
+
maxSize?: Value<Promisable<number>, [StandardHandlerInterceptorOptions<T>]>;
|
16
16
|
/**
|
17
17
|
* Map the request before processing it.
|
18
18
|
*
|
@@ -24,19 +24,19 @@ interface BatchHandlerOptions<T extends Context> {
|
|
24
24
|
*
|
25
25
|
* @default 207
|
26
26
|
*/
|
27
|
-
successStatus?: Value<number
|
27
|
+
successStatus?: Value<Promisable<number>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
|
28
28
|
/**
|
29
29
|
* success batch response headers.
|
30
30
|
*
|
31
31
|
* @default {}
|
32
32
|
*/
|
33
|
-
headers?: Value<StandardHeaders
|
33
|
+
headers?: Value<Promisable<StandardHeaders>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
|
34
34
|
}
|
35
35
|
/**
|
36
|
-
* The Batch
|
36
|
+
* The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
|
37
37
|
* reducing the overhead of sending each one separately.
|
38
38
|
*
|
39
|
-
* @see {@link https://orpc.unnoq.com/docs/plugins/batch-
|
39
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/batch-requests Batch Requests Plugin Docs}
|
40
40
|
*/
|
41
41
|
declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
42
42
|
private readonly maxSize;
|
@@ -49,8 +49,8 @@ declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPl
|
|
49
49
|
}
|
50
50
|
|
51
51
|
interface CORSOptions<T extends Context> {
|
52
|
-
origin?: Value<string | readonly string[] | null | undefined
|
53
|
-
timingOrigin?: Value<string | readonly string[] | null | undefined
|
52
|
+
origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
|
53
|
+
timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
|
54
54
|
allowMethods?: readonly string[];
|
55
55
|
allowHeaders?: readonly string[];
|
56
56
|
maxAge?: number;
|
@@ -88,21 +88,21 @@ interface SimpleCsrfProtectionHandlerPluginOptions<T extends Context> {
|
|
88
88
|
*
|
89
89
|
* @default 'x-csrf-token'
|
90
90
|
*/
|
91
|
-
headerName?: Value<string
|
91
|
+
headerName?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
|
92
92
|
/**
|
93
93
|
* The value of the header to check.
|
94
94
|
*
|
95
95
|
* @default 'orpc'
|
96
96
|
*
|
97
97
|
*/
|
98
|
-
headerValue?: Value<string
|
98
|
+
headerValue?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
|
99
99
|
/**
|
100
100
|
* Exclude a procedure from the plugin.
|
101
101
|
*
|
102
102
|
* @default false
|
103
103
|
*
|
104
104
|
*/
|
105
|
-
exclude?: Value<boolean
|
105
|
+
exclude?: Value<Promisable<boolean>, [options: ProcedureClientInterceptorOptions<T, Record<never, never>, Meta>]>;
|
106
106
|
/**
|
107
107
|
* The error thrown when the CSRF token is invalid.
|
108
108
|
*
|
package/dist/plugins/index.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Value } from '@orpc/shared';
|
1
|
+
import { Value, Promisable } from '@orpc/shared';
|
2
2
|
import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
|
3
3
|
import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
|
4
|
-
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.
|
5
|
-
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.
|
4
|
+
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.-ACo36I0.js';
|
5
|
+
import { C as Context, F as ProcedureClientInterceptorOptions } from '../shared/server.DD2C4ujN.js';
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
7
7
|
import { ORPCError } from '@orpc/client';
|
8
8
|
|
@@ -12,7 +12,7 @@ interface BatchHandlerOptions<T extends Context> {
|
|
12
12
|
*
|
13
13
|
* @default 10
|
14
14
|
*/
|
15
|
-
maxSize?: Value<number
|
15
|
+
maxSize?: Value<Promisable<number>, [StandardHandlerInterceptorOptions<T>]>;
|
16
16
|
/**
|
17
17
|
* Map the request before processing it.
|
18
18
|
*
|
@@ -24,19 +24,19 @@ interface BatchHandlerOptions<T extends Context> {
|
|
24
24
|
*
|
25
25
|
* @default 207
|
26
26
|
*/
|
27
|
-
successStatus?: Value<number
|
27
|
+
successStatus?: Value<Promisable<number>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
|
28
28
|
/**
|
29
29
|
* success batch response headers.
|
30
30
|
*
|
31
31
|
* @default {}
|
32
32
|
*/
|
33
|
-
headers?: Value<StandardHeaders
|
33
|
+
headers?: Value<Promisable<StandardHeaders>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
|
34
34
|
}
|
35
35
|
/**
|
36
|
-
* The Batch
|
36
|
+
* The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
|
37
37
|
* reducing the overhead of sending each one separately.
|
38
38
|
*
|
39
|
-
* @see {@link https://orpc.unnoq.com/docs/plugins/batch-
|
39
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/batch-requests Batch Requests Plugin Docs}
|
40
40
|
*/
|
41
41
|
declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
42
42
|
private readonly maxSize;
|
@@ -49,8 +49,8 @@ declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPl
|
|
49
49
|
}
|
50
50
|
|
51
51
|
interface CORSOptions<T extends Context> {
|
52
|
-
origin?: Value<string | readonly string[] | null | undefined
|
53
|
-
timingOrigin?: Value<string | readonly string[] | null | undefined
|
52
|
+
origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
|
53
|
+
timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
|
54
54
|
allowMethods?: readonly string[];
|
55
55
|
allowHeaders?: readonly string[];
|
56
56
|
maxAge?: number;
|
@@ -88,21 +88,21 @@ interface SimpleCsrfProtectionHandlerPluginOptions<T extends Context> {
|
|
88
88
|
*
|
89
89
|
* @default 'x-csrf-token'
|
90
90
|
*/
|
91
|
-
headerName?: Value<string
|
91
|
+
headerName?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
|
92
92
|
/**
|
93
93
|
* The value of the header to check.
|
94
94
|
*
|
95
95
|
* @default 'orpc'
|
96
96
|
*
|
97
97
|
*/
|
98
|
-
headerValue?: Value<string
|
98
|
+
headerValue?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
|
99
99
|
/**
|
100
100
|
* Exclude a procedure from the plugin.
|
101
101
|
*
|
102
102
|
* @default false
|
103
103
|
*
|
104
104
|
*/
|
105
|
-
exclude?: Value<boolean
|
105
|
+
exclude?: Value<Promisable<boolean>, [options: ProcedureClientInterceptorOptions<T, Record<never, never>, Meta>]>;
|
106
106
|
/**
|
107
107
|
* The error thrown when the CSRF token is invalid.
|
108
108
|
*
|
package/dist/plugins/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { value, isAsyncIteratorObject } from '@orpc/shared';
|
2
|
-
import { parseBatchRequest, toBatchResponse } from '@orpc/standard-server/batch';
|
3
2
|
import { flattenHeader } from '@orpc/standard-server';
|
3
|
+
import { parseBatchRequest, toBatchResponse } from '@orpc/standard-server/batch';
|
4
4
|
import { ORPCError } from '@orpc/client';
|
5
5
|
export { S as StrictGetMethodPlugin } from '../shared/server.BW-nUGgA.mjs';
|
6
6
|
import '@orpc/contract';
|
@@ -26,7 +26,8 @@ class BatchHandlerPlugin {
|
|
26
26
|
init(options) {
|
27
27
|
options.rootInterceptors ??= [];
|
28
28
|
options.rootInterceptors.unshift(async (options2) => {
|
29
|
-
|
29
|
+
const xHeader = flattenHeader(options2.request.headers["x-orpc-batch"]);
|
30
|
+
if (xHeader === void 0) {
|
30
31
|
return options2.next();
|
31
32
|
}
|
32
33
|
let isParsing = false;
|
@@ -69,9 +70,10 @@ class BatchHandlerPlugin {
|
|
69
70
|
await Promise.race(responses);
|
70
71
|
const status = await value(this.successStatus, responses, options2);
|
71
72
|
const headers = await value(this.headers, responses, options2);
|
72
|
-
const response = toBatchResponse({
|
73
|
+
const response = await toBatchResponse({
|
73
74
|
status,
|
74
75
|
headers,
|
76
|
+
mode: xHeader === "buffered" ? "buffered" : "streaming",
|
75
77
|
body: async function* () {
|
76
78
|
const promises = [...responses];
|
77
79
|
while (true) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { HTTPPath, ORPCError } from '@orpc/client';
|
2
|
-
import { Meta
|
3
|
-
import { Interceptor
|
2
|
+
import { Meta } from '@orpc/contract';
|
3
|
+
import { Interceptor } from '@orpc/shared';
|
4
4
|
import { StandardResponse, StandardLazyRequest } from '@orpc/standard-server';
|
5
|
-
import { C as Context, R as Router, f as AnyRouter, h as AnyProcedure, F as ProcedureClientInterceptorOptions } from './server.
|
5
|
+
import { C as Context, R as Router, f as AnyRouter, h as AnyProcedure, F as ProcedureClientInterceptorOptions } from './server.DD2C4ujN.js';
|
6
6
|
|
7
7
|
interface StandardHandlerPlugin<T extends Context> {
|
8
8
|
order?: number;
|
@@ -49,16 +49,16 @@ interface StandardHandlerOptions<TContext extends Context> {
|
|
49
49
|
/**
|
50
50
|
* Interceptors at the request level, helpful when you want catch errors
|
51
51
|
*/
|
52
|
-
interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult
|
52
|
+
interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, Promise<StandardHandleResult>>[];
|
53
53
|
/**
|
54
54
|
* Interceptors at the root level, helpful when you want override the request/response
|
55
55
|
*/
|
56
|
-
rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult
|
56
|
+
rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, Promise<StandardHandleResult>>[];
|
57
57
|
/**
|
58
58
|
*
|
59
59
|
* Interceptors for procedure client.
|
60
60
|
*/
|
61
|
-
clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Record<never, never>, Meta>,
|
61
|
+
clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Record<never, never>, Meta>, Promise<unknown>>[];
|
62
62
|
}
|
63
63
|
declare class StandardHandler<T extends Context> {
|
64
64
|
private readonly matcher;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
-
import { C as Context, R as Router } from './server.
|
3
|
-
import { b as StandardHandlerOptions, i as StandardHandler } from './server.
|
2
|
+
import { C as Context, R as Router } from './server.DD2C4ujN.js';
|
3
|
+
import { b as StandardHandlerOptions, i as StandardHandler } from './server.-ACo36I0.js';
|
4
4
|
|
5
5
|
interface StandardRPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardRPCJsonSerializerOptions {
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
-
import { C as Context, R as Router } from './server.
|
3
|
-
import { b as StandardHandlerOptions, i as StandardHandler } from './server.
|
2
|
+
import { C as Context, R as Router } from './server.DD2C4ujN.mjs';
|
3
|
+
import { b as StandardHandlerOptions, i as StandardHandler } from './server.Dq8xr7PQ.mjs';
|
4
4
|
|
5
5
|
interface StandardRPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardRPCJsonSerializerOptions {
|
6
6
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { C as Context } from './server.
|
2
|
-
import { g as StandardHandleOptions } from './server.
|
1
|
+
import { C as Context } from './server.DD2C4ujN.mjs';
|
2
|
+
import { g as StandardHandleOptions } from './server.Dq8xr7PQ.mjs';
|
3
3
|
|
4
4
|
type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
5
5
|
context?: T;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { toHttpPath, StandardRPCJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
|
2
2
|
import { ORPCError, toORPCError } from '@orpc/client';
|
3
|
-
import { toArray, intercept, parseEmptyableJSON } from '@orpc/shared';
|
3
|
+
import { toArray, intercept, parseEmptyableJSON, NullProtoObj } from '@orpc/shared';
|
4
|
+
import { flattenHeader } from '@orpc/standard-server';
|
4
5
|
import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.DG7Tamti.mjs';
|
5
6
|
|
6
7
|
class CompositeStandardHandlerPlugin {
|
@@ -59,8 +60,10 @@ class StandardHandler {
|
|
59
60
|
isDecoding = true;
|
60
61
|
const input = await this.codec.decode(request2, match.params, match.procedure);
|
61
62
|
isDecoding = false;
|
62
|
-
const
|
63
|
-
|
63
|
+
const output = await client(input, {
|
64
|
+
signal: request2.signal,
|
65
|
+
lastEventId: flattenHeader(request2.headers["last-event-id"])
|
66
|
+
});
|
64
67
|
const response = this.codec.encode(output, match.procedure);
|
65
68
|
return {
|
66
69
|
matched: true,
|
@@ -109,7 +112,7 @@ class StandardRPCCodec {
|
|
109
112
|
}
|
110
113
|
|
111
114
|
class StandardRPCMatcher {
|
112
|
-
tree =
|
115
|
+
tree = new NullProtoObj();
|
113
116
|
pendingRouters = [];
|
114
117
|
init(router, path = []) {
|
115
118
|
const laziedOptions = traverseContractProcedures({ router, path }, ({ path: path2, contract }) => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ORPCErrorCode, ORPCErrorOptions, ORPCError, HTTPPath, ClientContext, Client } from '@orpc/client';
|
2
2
|
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
|
3
|
-
import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
|
3
|
+
import { MaybeOptionalOptions, Promisable, Interceptor, PromiseWithError, Value } from '@orpc/shared';
|
4
4
|
|
5
5
|
type Context = Record<PropertyKey, any>;
|
6
6
|
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
@@ -127,11 +127,11 @@ type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema
|
|
127
127
|
* This is helpful for logging and analytics.
|
128
128
|
*/
|
129
129
|
path?: readonly string[];
|
130
|
-
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap
|
130
|
+
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
|
131
131
|
} & (Record<never, never> extends TInitialContext ? {
|
132
|
-
context?: Value<TInitialContext
|
132
|
+
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
133
133
|
} : {
|
134
|
-
context: Value<TInitialContext
|
134
|
+
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
135
135
|
});
|
136
136
|
/**
|
137
137
|
* Create Server-side client from a procedure.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ORPCErrorCode, ORPCErrorOptions, ORPCError, HTTPPath, ClientContext, Client } from '@orpc/client';
|
2
2
|
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
|
3
|
-
import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
|
3
|
+
import { MaybeOptionalOptions, Promisable, Interceptor, PromiseWithError, Value } from '@orpc/shared';
|
4
4
|
|
5
5
|
type Context = Record<PropertyKey, any>;
|
6
6
|
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
@@ -127,11 +127,11 @@ type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema
|
|
127
127
|
* This is helpful for logging and analytics.
|
128
128
|
*/
|
129
129
|
path?: readonly string[];
|
130
|
-
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap
|
130
|
+
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
|
131
131
|
} & (Record<never, never> extends TInitialContext ? {
|
132
|
-
context?: Value<TInitialContext
|
132
|
+
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
133
133
|
} : {
|
134
|
-
context: Value<TInitialContext
|
134
|
+
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
135
135
|
});
|
136
136
|
/**
|
137
137
|
* Create Server-side client from a procedure.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { HTTPPath, ORPCError } from '@orpc/client';
|
2
|
-
import { Meta
|
3
|
-
import { Interceptor
|
2
|
+
import { Meta } from '@orpc/contract';
|
3
|
+
import { Interceptor } from '@orpc/shared';
|
4
4
|
import { StandardResponse, StandardLazyRequest } from '@orpc/standard-server';
|
5
|
-
import { C as Context, R as Router, f as AnyRouter, h as AnyProcedure, F as ProcedureClientInterceptorOptions } from './server.
|
5
|
+
import { C as Context, R as Router, f as AnyRouter, h as AnyProcedure, F as ProcedureClientInterceptorOptions } from './server.DD2C4ujN.mjs';
|
6
6
|
|
7
7
|
interface StandardHandlerPlugin<T extends Context> {
|
8
8
|
order?: number;
|
@@ -49,16 +49,16 @@ interface StandardHandlerOptions<TContext extends Context> {
|
|
49
49
|
/**
|
50
50
|
* Interceptors at the request level, helpful when you want catch errors
|
51
51
|
*/
|
52
|
-
interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult
|
52
|
+
interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, Promise<StandardHandleResult>>[];
|
53
53
|
/**
|
54
54
|
* Interceptors at the root level, helpful when you want override the request/response
|
55
55
|
*/
|
56
|
-
rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult
|
56
|
+
rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, Promise<StandardHandleResult>>[];
|
57
57
|
/**
|
58
58
|
*
|
59
59
|
* Interceptors for procedure client.
|
60
60
|
*/
|
61
|
-
clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Record<never, never>, Meta>,
|
61
|
+
clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Record<never, never>, Meta>, Promise<unknown>>[];
|
62
62
|
}
|
63
63
|
declare class StandardHandler<T extends Context> {
|
64
64
|
private readonly matcher;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { C as Context } from './server.
|
2
|
-
import { g as StandardHandleOptions } from './server.
|
1
|
+
import { C as Context } from './server.DD2C4ujN.js';
|
2
|
+
import { g as StandardHandleOptions } from './server.-ACo36I0.js';
|
3
3
|
|
4
4
|
type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
5
5
|
context?: T;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.4.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -39,6 +39,11 @@
|
|
39
39
|
"import": "./dist/adapters/node/index.mjs",
|
40
40
|
"default": "./dist/adapters/node/index.mjs"
|
41
41
|
},
|
42
|
+
"./aws-lambda": {
|
43
|
+
"types": "./dist/adapters/aws-lambda/index.d.mts",
|
44
|
+
"import": "./dist/adapters/aws-lambda/index.mjs",
|
45
|
+
"default": "./dist/adapters/aws-lambda/index.mjs"
|
46
|
+
},
|
42
47
|
"./websocket": {
|
43
48
|
"types": "./dist/adapters/websocket/index.d.mts",
|
44
49
|
"import": "./dist/adapters/websocket/index.mjs",
|
@@ -58,6 +63,11 @@
|
|
58
63
|
"types": "./dist/adapters/bun-ws/index.d.mts",
|
59
64
|
"import": "./dist/adapters/bun-ws/index.mjs",
|
60
65
|
"default": "./dist/adapters/bun-ws/index.mjs"
|
66
|
+
},
|
67
|
+
"./message-port": {
|
68
|
+
"types": "./dist/adapters/message-port/index.d.mts",
|
69
|
+
"import": "./dist/adapters/message-port/index.mjs",
|
70
|
+
"default": "./dist/adapters/message-port/index.mjs"
|
61
71
|
}
|
62
72
|
},
|
63
73
|
"files": [
|
@@ -76,17 +86,18 @@
|
|
76
86
|
}
|
77
87
|
},
|
78
88
|
"dependencies": {
|
79
|
-
"@orpc/client": "1.
|
80
|
-
"@orpc/shared": "1.
|
81
|
-
"@orpc/contract": "1.
|
82
|
-
"@orpc/standard-server
|
83
|
-
"@orpc/standard-server": "1.
|
84
|
-
"@orpc/standard-server-node": "1.
|
85
|
-
"@orpc/standard-server-
|
89
|
+
"@orpc/client": "1.4.0",
|
90
|
+
"@orpc/shared": "1.4.0",
|
91
|
+
"@orpc/contract": "1.4.0",
|
92
|
+
"@orpc/standard-server": "1.4.0",
|
93
|
+
"@orpc/standard-server-aws-lambda": "1.4.0",
|
94
|
+
"@orpc/standard-server-node": "1.4.0",
|
95
|
+
"@orpc/standard-server-fetch": "1.4.0",
|
96
|
+
"@orpc/standard-server-peer": "1.4.0"
|
86
97
|
},
|
87
98
|
"devDependencies": {
|
88
99
|
"@types/ws": "^8.18.1",
|
89
|
-
"crossws": "^0.
|
100
|
+
"crossws": "^0.4.1",
|
90
101
|
"next": "^15.3.0",
|
91
102
|
"supertest": "^7.1.0",
|
92
103
|
"ws": "^8.18.1"
|