@orpc/server 0.0.0-next.a246703 → 0.0.0-next.a2b3a55
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/fetch/index.d.mts +15 -10
- package/dist/adapters/fetch/index.d.ts +15 -10
- package/dist/adapters/fetch/index.mjs +104 -8
- package/dist/adapters/node/index.d.mts +15 -10
- package/dist/adapters/node/index.d.ts +15 -10
- package/dist/adapters/node/index.mjs +17 -12
- package/dist/adapters/standard/index.d.mts +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/adapters/standard/index.mjs +6 -4
- package/dist/index.d.mts +51 -34
- package/dist/index.d.ts +51 -34
- package/dist/index.mjs +32 -11
- package/dist/plugins/index.d.mts +101 -6
- package/dist/plugins/index.d.ts +101 -6
- package/dist/plugins/index.mjs +147 -2
- package/dist/shared/{server.ywWqDZgA.d.ts → server.B1oIHH_j.d.mts} +18 -10
- package/dist/shared/{server.D0YVcfZk.d.mts → server.BVHsfJ99.d.mts} +9 -8
- package/dist/shared/{server.D0YVcfZk.d.ts → server.BVHsfJ99.d.ts} +9 -8
- package/dist/shared/server.BW-nUGgA.mjs +36 -0
- package/dist/shared/server.BuLPHTX1.d.mts +18 -0
- package/dist/shared/{server.CjWkNG6l.mjs → server.C37gDhSZ.mjs} +18 -24
- package/dist/shared/{server.BMkFIQUb.d.mts → server.CaWivVk3.d.ts} +18 -10
- package/dist/shared/{server.D9QduY95.mjs → server.DFuJLDuo.mjs} +43 -14
- package/dist/shared/{server.taqJyaMn.d.ts → server.DMhSfHk1.d.ts} +2 -2
- package/dist/shared/server.D_vpYits.d.ts +18 -0
- package/dist/shared/{server.89QkKw3a.d.mts → server.Dwnm6cSk.d.mts} +2 -2
- package/package.json +8 -22
- package/dist/adapters/hono/index.d.mts +0 -22
- package/dist/adapters/hono/index.d.ts +0 -22
- package/dist/adapters/hono/index.mjs +0 -32
- package/dist/adapters/next/index.d.mts +0 -29
- package/dist/adapters/next/index.d.ts +0 -29
- package/dist/adapters/next/index.mjs +0 -29
- package/dist/shared/server.B1S3zwuw.d.mts +0 -8
- package/dist/shared/server.BT0gne12.d.ts +0 -8
- package/dist/shared/server.Et1O6Bm7.mjs +0 -98
package/README.md
CHANGED
@@ -53,6 +53,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
53
53
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
54
54
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
55
55
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
56
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
56
57
|
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
57
58
|
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
58
59
|
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
@@ -1,14 +1,21 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
2
|
-
import {
|
3
|
-
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
4
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.89QkKw3a.mjs';
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BVHsfJ99.mjs';
|
2
|
+
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
5
3
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
6
|
-
import {
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.B1oIHH_j.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Dwnm6cSk.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BuLPHTX1.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
10
10
|
import '@orpc/client/standard';
|
11
11
|
|
12
|
+
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
13
|
+
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
14
|
+
}
|
15
|
+
declare class CompositeFetchHandlerPlugin<T extends Context, TPlugin extends FetchHandlerPlugin<T>> extends CompositeStandardHandlerPlugin<T, TPlugin> implements FetchHandlerPlugin<T> {
|
16
|
+
initRuntimeAdapter(options: FetchHandlerOptions<T>): void;
|
17
|
+
}
|
18
|
+
|
12
19
|
type FetchHandleResult = {
|
13
20
|
matched: true;
|
14
21
|
response: Response;
|
@@ -16,15 +23,12 @@ type FetchHandleResult = {
|
|
16
23
|
matched: false;
|
17
24
|
response: undefined;
|
18
25
|
};
|
19
|
-
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
20
|
-
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
21
|
-
}
|
22
26
|
interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHandleOptions<T> {
|
23
27
|
request: Request;
|
24
28
|
toFetchResponseOptions: ToFetchResponseOptions;
|
25
29
|
}
|
26
30
|
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
27
|
-
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, FetchHandleResult,
|
31
|
+
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, FetchHandleResult, ThrowableError>[];
|
28
32
|
plugins?: FetchHandlerPlugin<T>[];
|
29
33
|
}
|
30
34
|
declare class FetchHandler<T extends Context> {
|
@@ -51,4 +55,5 @@ declare class RPCHandler<T extends Context> extends FetchHandler<T> {
|
|
51
55
|
constructor(router: Router<any, T>, options?: NoInfer<FetchHandlerOptions<T> & StandardRPCHandlerOptions<T>>);
|
52
56
|
}
|
53
57
|
|
54
|
-
export { BodyLimitPlugin,
|
58
|
+
export { BodyLimitPlugin, CompositeFetchHandlerPlugin, FetchHandler, RPCHandler };
|
59
|
+
export type { BodyLimitPluginOptions, FetchHandleResult, FetchHandlerInterceptorOptions, FetchHandlerOptions, FetchHandlerPlugin };
|
@@ -1,14 +1,21 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
2
|
-
import {
|
3
|
-
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
4
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.taqJyaMn.js';
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BVHsfJ99.js';
|
2
|
+
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
5
3
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
6
|
-
import {
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.CaWivVk3.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DMhSfHk1.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.D_vpYits.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
10
10
|
import '@orpc/client/standard';
|
11
11
|
|
12
|
+
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
13
|
+
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
14
|
+
}
|
15
|
+
declare class CompositeFetchHandlerPlugin<T extends Context, TPlugin extends FetchHandlerPlugin<T>> extends CompositeStandardHandlerPlugin<T, TPlugin> implements FetchHandlerPlugin<T> {
|
16
|
+
initRuntimeAdapter(options: FetchHandlerOptions<T>): void;
|
17
|
+
}
|
18
|
+
|
12
19
|
type FetchHandleResult = {
|
13
20
|
matched: true;
|
14
21
|
response: Response;
|
@@ -16,15 +23,12 @@ type FetchHandleResult = {
|
|
16
23
|
matched: false;
|
17
24
|
response: undefined;
|
18
25
|
};
|
19
|
-
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
20
|
-
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
21
|
-
}
|
22
26
|
interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHandleOptions<T> {
|
23
27
|
request: Request;
|
24
28
|
toFetchResponseOptions: ToFetchResponseOptions;
|
25
29
|
}
|
26
30
|
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
27
|
-
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, FetchHandleResult,
|
31
|
+
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, FetchHandleResult, ThrowableError>[];
|
28
32
|
plugins?: FetchHandlerPlugin<T>[];
|
29
33
|
}
|
30
34
|
declare class FetchHandler<T extends Context> {
|
@@ -51,4 +55,5 @@ declare class RPCHandler<T extends Context> extends FetchHandler<T> {
|
|
51
55
|
constructor(router: Router<any, T>, options?: NoInfer<FetchHandlerOptions<T> & StandardRPCHandlerOptions<T>>);
|
52
56
|
}
|
53
57
|
|
54
|
-
export { BodyLimitPlugin,
|
58
|
+
export { BodyLimitPlugin, CompositeFetchHandlerPlugin, FetchHandler, RPCHandler };
|
59
|
+
export type { BodyLimitPluginOptions, FetchHandleResult, FetchHandlerInterceptorOptions, FetchHandlerOptions, FetchHandlerPlugin };
|
@@ -1,9 +1,105 @@
|
|
1
|
-
|
2
|
-
import '@orpc/
|
3
|
-
import '@orpc/
|
4
|
-
import '../../shared/server.
|
5
|
-
import '@orpc/shared';
|
6
|
-
import '../../shared/server.CjWkNG6l.mjs';
|
1
|
+
import { ORPCError } from '@orpc/client';
|
2
|
+
import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
3
|
+
import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fetch';
|
4
|
+
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
7
5
|
import '@orpc/contract';
|
8
|
-
import '
|
9
|
-
import '
|
6
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.DFuJLDuo.mjs';
|
7
|
+
import '@orpc/client/standard';
|
8
|
+
import '@orpc/standard-server/batch';
|
9
|
+
import '../../shared/server.BW-nUGgA.mjs';
|
10
|
+
import '../../shared/server.C37gDhSZ.mjs';
|
11
|
+
|
12
|
+
class BodyLimitPlugin {
|
13
|
+
maxBodySize;
|
14
|
+
constructor(options) {
|
15
|
+
this.maxBodySize = options.maxBodySize;
|
16
|
+
}
|
17
|
+
initRuntimeAdapter(options) {
|
18
|
+
options.adapterInterceptors ??= [];
|
19
|
+
options.adapterInterceptors.push(async (options2) => {
|
20
|
+
if (!options2.request.body) {
|
21
|
+
return options2.next();
|
22
|
+
}
|
23
|
+
let currentBodySize = 0;
|
24
|
+
const rawReader = options2.request.body.getReader();
|
25
|
+
const reader = new ReadableStream({
|
26
|
+
start: async (controller) => {
|
27
|
+
try {
|
28
|
+
if (Number(options2.request.headers.get("content-length")) > this.maxBodySize) {
|
29
|
+
controller.error(new ORPCError("PAYLOAD_TOO_LARGE"));
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
while (true) {
|
33
|
+
const { done, value } = await rawReader.read();
|
34
|
+
if (done) {
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
currentBodySize += value.length;
|
38
|
+
if (currentBodySize > this.maxBodySize) {
|
39
|
+
controller.error(new ORPCError("PAYLOAD_TOO_LARGE"));
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
controller.enqueue(value);
|
43
|
+
}
|
44
|
+
} finally {
|
45
|
+
controller.close();
|
46
|
+
}
|
47
|
+
}
|
48
|
+
});
|
49
|
+
const requestInit = { body: reader, duplex: "half" };
|
50
|
+
return options2.next({
|
51
|
+
...options2,
|
52
|
+
request: new Request(options2.request, requestInit)
|
53
|
+
});
|
54
|
+
});
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
class CompositeFetchHandlerPlugin extends CompositeStandardHandlerPlugin {
|
59
|
+
initRuntimeAdapter(options) {
|
60
|
+
for (const plugin of this.plugins) {
|
61
|
+
plugin.initRuntimeAdapter?.(options);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
class FetchHandler {
|
67
|
+
constructor(standardHandler, options = {}) {
|
68
|
+
this.standardHandler = standardHandler;
|
69
|
+
const plugin = new CompositeFetchHandlerPlugin(options.plugins);
|
70
|
+
plugin.initRuntimeAdapter(options);
|
71
|
+
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
72
|
+
this.toFetchResponseOptions = options;
|
73
|
+
}
|
74
|
+
toFetchResponseOptions;
|
75
|
+
adapterInterceptors;
|
76
|
+
async handle(request, ...rest) {
|
77
|
+
return intercept(
|
78
|
+
this.adapterInterceptors,
|
79
|
+
{
|
80
|
+
...resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest)),
|
81
|
+
request,
|
82
|
+
toFetchResponseOptions: this.toFetchResponseOptions
|
83
|
+
},
|
84
|
+
async ({ request: request2, toFetchResponseOptions, ...options }) => {
|
85
|
+
const standardRequest = toStandardLazyRequest(request2);
|
86
|
+
const result = await this.standardHandler.handle(standardRequest, options);
|
87
|
+
if (!result.matched) {
|
88
|
+
return result;
|
89
|
+
}
|
90
|
+
return {
|
91
|
+
matched: true,
|
92
|
+
response: toFetchResponse(result.response, toFetchResponseOptions)
|
93
|
+
};
|
94
|
+
}
|
95
|
+
);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
class RPCHandler extends FetchHandler {
|
100
|
+
constructor(router, options = {}) {
|
101
|
+
super(new StandardRPCHandler(router, options), options);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
export { BodyLimitPlugin, CompositeFetchHandlerPlugin, FetchHandler, RPCHandler };
|
@@ -1,29 +1,33 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BVHsfJ99.mjs';
|
2
|
+
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
2
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@orpc/standard-server-node';
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.B1S3zwuw.mjs';
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.B1oIHH_j.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Dwnm6cSk.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.BuLPHTX1.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
10
10
|
import '@orpc/client/standard';
|
11
11
|
|
12
|
+
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
13
|
+
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
14
|
+
}
|
15
|
+
declare class CompositeNodeHttpHandlerPlugin<T extends Context, TPlugin extends NodeHttpHandlerPlugin<T>> extends CompositeStandardHandlerPlugin<T, TPlugin> implements NodeHttpHandlerPlugin<T> {
|
16
|
+
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
17
|
+
}
|
18
|
+
|
12
19
|
type NodeHttpHandleResult = {
|
13
20
|
matched: true;
|
14
21
|
} | {
|
15
22
|
matched: false;
|
16
23
|
};
|
17
|
-
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
18
|
-
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
19
|
-
}
|
20
24
|
interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardHandleOptions<T> {
|
21
25
|
request: NodeHttpRequest;
|
22
26
|
response: NodeHttpResponse;
|
23
27
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
24
28
|
}
|
25
29
|
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
26
|
-
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, NodeHttpHandleResult,
|
30
|
+
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, NodeHttpHandleResult, ThrowableError>[];
|
27
31
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
28
32
|
}
|
29
33
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
@@ -50,4 +54,5 @@ declare class RPCHandler<T extends Context> extends NodeHttpHandler<T> {
|
|
50
54
|
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T> & NodeHttpHandlerOptions<T>>);
|
51
55
|
}
|
52
56
|
|
53
|
-
export { BodyLimitPlugin,
|
57
|
+
export { BodyLimitPlugin, CompositeNodeHttpHandlerPlugin, NodeHttpHandler, RPCHandler };
|
58
|
+
export type { BodyLimitPluginOptions, NodeHttpHandleResult, NodeHttpHandlerInterceptorOptions, NodeHttpHandlerOptions, NodeHttpHandlerPlugin };
|
@@ -1,29 +1,33 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BVHsfJ99.js';
|
2
|
+
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
2
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@orpc/standard-server-node';
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.BT0gne12.js';
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.CaWivVk3.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DMhSfHk1.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.D_vpYits.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
10
10
|
import '@orpc/client/standard';
|
11
11
|
|
12
|
+
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
13
|
+
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
14
|
+
}
|
15
|
+
declare class CompositeNodeHttpHandlerPlugin<T extends Context, TPlugin extends NodeHttpHandlerPlugin<T>> extends CompositeStandardHandlerPlugin<T, TPlugin> implements NodeHttpHandlerPlugin<T> {
|
16
|
+
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
17
|
+
}
|
18
|
+
|
12
19
|
type NodeHttpHandleResult = {
|
13
20
|
matched: true;
|
14
21
|
} | {
|
15
22
|
matched: false;
|
16
23
|
};
|
17
|
-
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
18
|
-
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
19
|
-
}
|
20
24
|
interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardHandleOptions<T> {
|
21
25
|
request: NodeHttpRequest;
|
22
26
|
response: NodeHttpResponse;
|
23
27
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
24
28
|
}
|
25
29
|
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
26
|
-
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, NodeHttpHandleResult,
|
30
|
+
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, NodeHttpHandleResult, ThrowableError>[];
|
27
31
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
28
32
|
}
|
29
33
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
@@ -50,4 +54,5 @@ declare class RPCHandler<T extends Context> extends NodeHttpHandler<T> {
|
|
50
54
|
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T> & NodeHttpHandlerOptions<T>>);
|
51
55
|
}
|
52
56
|
|
53
|
-
export { BodyLimitPlugin,
|
57
|
+
export { BodyLimitPlugin, CompositeNodeHttpHandlerPlugin, NodeHttpHandler, RPCHandler };
|
58
|
+
export type { BodyLimitPluginOptions, NodeHttpHandleResult, NodeHttpHandlerInterceptorOptions, NodeHttpHandlerOptions, NodeHttpHandlerPlugin };
|
@@ -2,10 +2,12 @@ import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
5
|
-
import { StandardRPCJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
|
6
|
-
import { S as StandardHandler, b as StandardRPCMatcher, a as StandardRPCCodec } from '../../shared/server.D9QduY95.mjs';
|
7
|
-
import '../../shared/server.CjWkNG6l.mjs';
|
8
5
|
import '@orpc/contract';
|
6
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.DFuJLDuo.mjs';
|
7
|
+
import '@orpc/client/standard';
|
8
|
+
import '@orpc/standard-server/batch';
|
9
|
+
import '../../shared/server.BW-nUGgA.mjs';
|
10
|
+
import '../../shared/server.C37gDhSZ.mjs';
|
9
11
|
|
10
12
|
class BodyLimitPlugin {
|
11
13
|
maxBodySize;
|
@@ -39,12 +41,19 @@ class BodyLimitPlugin {
|
|
39
41
|
}
|
40
42
|
}
|
41
43
|
|
44
|
+
class CompositeNodeHttpHandlerPlugin extends CompositeStandardHandlerPlugin {
|
45
|
+
initRuntimeAdapter(options) {
|
46
|
+
for (const plugin of this.plugins) {
|
47
|
+
plugin.initRuntimeAdapter?.(options);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
42
52
|
class NodeHttpHandler {
|
43
53
|
constructor(standardHandler, options = {}) {
|
44
54
|
this.standardHandler = standardHandler;
|
45
|
-
|
46
|
-
|
47
|
-
}
|
55
|
+
const plugin = new CompositeNodeHttpHandlerPlugin(options.plugins);
|
56
|
+
plugin.initRuntimeAdapter(options);
|
48
57
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
49
58
|
this.sendStandardResponseOptions = options;
|
50
59
|
}
|
@@ -74,12 +83,8 @@ class NodeHttpHandler {
|
|
74
83
|
|
75
84
|
class RPCHandler extends NodeHttpHandler {
|
76
85
|
constructor(router, options = {}) {
|
77
|
-
|
78
|
-
const serializer = new StandardRPCSerializer(jsonSerializer);
|
79
|
-
const matcher = new StandardRPCMatcher();
|
80
|
-
const codec = new StandardRPCCodec(serializer);
|
81
|
-
super(new StandardHandler(router, matcher, codec, options), options);
|
86
|
+
super(new StandardRPCHandler(router, options), options);
|
82
87
|
}
|
83
88
|
}
|
84
89
|
|
85
|
-
export { BodyLimitPlugin, NodeHttpHandler, RPCHandler };
|
90
|
+
export { BodyLimitPlugin, CompositeNodeHttpHandlerPlugin, NodeHttpHandler, RPCHandler };
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
1
|
+
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.B1oIHH_j.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.B1oIHH_j.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 {
|
7
|
-
export { S as StandardRPCHandlerOptions } from '../../shared/server.
|
6
|
+
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.BVHsfJ99.mjs';
|
7
|
+
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.BuLPHTX1.mjs';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
1
|
+
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.CaWivVk3.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.CaWivVk3.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 {
|
7
|
-
export { S as StandardRPCHandlerOptions } from '../../shared/server.
|
6
|
+
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.BVHsfJ99.js';
|
7
|
+
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.D_vpYits.js';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,6 +1,8 @@
|
|
1
|
-
export { S as StandardHandler, a as StandardRPCCodec, b as StandardRPCMatcher } from '../../shared/server.
|
2
|
-
import '@orpc/client';
|
1
|
+
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.DFuJLDuo.mjs';
|
2
|
+
import '@orpc/client/standard';
|
3
3
|
import '@orpc/shared';
|
4
|
-
import '
|
4
|
+
import '@orpc/standard-server/batch';
|
5
|
+
import '@orpc/client';
|
6
|
+
import '../../shared/server.BW-nUGgA.mjs';
|
5
7
|
import '@orpc/contract';
|
6
|
-
import '
|
8
|
+
import '../../shared/server.C37gDhSZ.mjs';
|