@temporary-name/server 1.9.3-alpha.9f176ca3f9388d51e8dffa98a15fcf9f14f6a75e → 1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e
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/dist/adapters/aws-lambda/index.d.mts +12 -6
- package/dist/adapters/aws-lambda/index.d.ts +12 -6
- package/dist/adapters/aws-lambda/index.mjs +11 -4
- package/dist/adapters/fetch/index.d.mts +12 -6
- package/dist/adapters/fetch/index.d.ts +12 -6
- package/dist/adapters/fetch/index.mjs +11 -11
- package/dist/adapters/node/index.d.mts +12 -6
- package/dist/adapters/node/index.d.ts +12 -6
- package/dist/adapters/node/index.mjs +11 -11
- package/dist/adapters/standard/index.d.mts +39 -13
- package/dist/adapters/standard/index.d.ts +39 -13
- package/dist/adapters/standard/index.mjs +7 -100
- package/dist/index.d.mts +940 -321
- package/dist/index.d.ts +940 -321
- package/dist/index.mjs +1677 -96
- package/dist/openapi/index.d.mts +220 -0
- package/dist/openapi/index.d.ts +220 -0
- package/dist/openapi/index.mjs +776 -0
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/shared/server.BEHw7Eyx.mjs +247 -0
- package/dist/shared/{server.C1YnHvvf.d.ts → server.BKSOrA6h.d.mts} +2 -2
- package/dist/shared/{server.C1YnHvvf.d.mts → server.BKSOrA6h.d.ts} +2 -2
- package/dist/shared/{server.BEQrAa3A.mjs → server.BZtKt8i8.mjs} +6 -12
- package/dist/shared/server.BeuTpcmO.d.mts +23 -0
- package/dist/shared/{server.Btxrgkj5.d.ts → server.C1fnTLq0.d.mts} +8 -24
- package/dist/shared/server.CMTfy2UB.mjs +293 -0
- package/dist/shared/{server.Bo94xDTv.d.mts → server.CQyYNJ1H.d.ts} +8 -24
- package/dist/shared/server.SLLuK6_v.d.ts +23 -0
- package/package.json +15 -9
- package/dist/shared/server.D6K9uoPI.mjs +0 -35
- package/dist/shared/server.DZ5BIITo.mjs +0 -9
- package/dist/shared/server.X0YaZxSJ.mjs +0 -13
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { SendStandardResponseOptions, APIGatewayProxyEventV2, ResponseStream } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { C as Context } from '../../shared/server.
|
|
4
|
-
import {
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.BKSOrA6h.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.C1fnTLq0.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BeuTpcmO.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
9
|
-
interface AwsLambdaHandlerOptions extends SendStandardResponseOptions {
|
|
9
|
+
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
10
10
|
}
|
|
11
11
|
type AwsLambdaHandleResult = {
|
|
12
12
|
matched: true;
|
|
13
13
|
} | {
|
|
14
14
|
matched: false;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* OpenAPI Handler for AWS Lambda.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
20
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
21
|
+
*/
|
|
16
22
|
declare class AwsLambdaHandler<T extends Context> {
|
|
17
|
-
private readonly standardHandler;
|
|
18
23
|
private readonly sendStandardResponseOptions;
|
|
19
|
-
|
|
24
|
+
private readonly standardHandler;
|
|
25
|
+
constructor(router: Router<any, T>, options?: AwsLambdaHandlerOptions<T>);
|
|
20
26
|
handle(event: APIGatewayProxyEventV2, responseStream: ResponseStream, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<AwsLambdaHandleResult>;
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { SendStandardResponseOptions, APIGatewayProxyEventV2, ResponseStream } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { C as Context } from '../../shared/server.
|
|
4
|
-
import {
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.BKSOrA6h.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.CQyYNJ1H.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.SLLuK6_v.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
9
|
-
interface AwsLambdaHandlerOptions extends SendStandardResponseOptions {
|
|
9
|
+
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
10
10
|
}
|
|
11
11
|
type AwsLambdaHandleResult = {
|
|
12
12
|
matched: true;
|
|
13
13
|
} | {
|
|
14
14
|
matched: false;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* OpenAPI Handler for AWS Lambda.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
20
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
21
|
+
*/
|
|
16
22
|
declare class AwsLambdaHandler<T extends Context> {
|
|
17
|
-
private readonly standardHandler;
|
|
18
23
|
private readonly sendStandardResponseOptions;
|
|
19
|
-
|
|
24
|
+
private readonly standardHandler;
|
|
25
|
+
constructor(router: Router<any, T>, options?: AwsLambdaHandlerOptions<T>);
|
|
20
26
|
handle(event: APIGatewayProxyEventV2, responseStream: ResponseStream, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<AwsLambdaHandleResult>;
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CMTfy2UB.mjs';
|
|
4
|
+
import '@temporary-name/contract';
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
|
+
import '@temporary-name/server';
|
|
7
|
+
import 'rou3';
|
|
8
|
+
import '../../shared/server.BZtKt8i8.mjs';
|
|
9
|
+
import '../../shared/server.BEHw7Eyx.mjs';
|
|
4
10
|
|
|
5
11
|
class AwsLambdaHandler {
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
sendStandardResponseOptions;
|
|
13
|
+
standardHandler;
|
|
14
|
+
constructor(router, options = {}) {
|
|
15
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
8
16
|
this.sendStandardResponseOptions = options;
|
|
9
17
|
}
|
|
10
|
-
sendStandardResponseOptions;
|
|
11
18
|
async handle(event, responseStream, ...rest) {
|
|
12
19
|
const standardRequest = toStandardLazyRequest(event, responseStream);
|
|
13
20
|
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BKSOrA6h.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.C1fnTLq0.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BeuTpcmO.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -24,15 +24,21 @@ interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHand
|
|
|
24
24
|
request: Request;
|
|
25
25
|
toFetchResponseOptions: ToFetchResponseOptions;
|
|
26
26
|
}
|
|
27
|
-
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
|
27
|
+
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
28
|
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, Promise<FetchHandleResult>>[];
|
|
29
29
|
plugins?: FetchHandlerPlugin<T>[];
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* OpenAPI Handler for Fetch Server
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
35
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
36
|
+
*/
|
|
31
37
|
declare class FetchHandler<T extends Context> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
38
|
private readonly toFetchResponseOptions;
|
|
34
39
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
40
|
+
private readonly standardHandler;
|
|
41
|
+
constructor(router: Router<any, T>, options?: NoInfer<FetchHandlerOptions<T>>);
|
|
36
42
|
handle(request: Request, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<FetchHandleResult>;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BKSOrA6h.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.CQyYNJ1H.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.SLLuK6_v.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -24,15 +24,21 @@ interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHand
|
|
|
24
24
|
request: Request;
|
|
25
25
|
toFetchResponseOptions: ToFetchResponseOptions;
|
|
26
26
|
}
|
|
27
|
-
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
|
27
|
+
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
28
|
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, Promise<FetchHandleResult>>[];
|
|
29
29
|
plugins?: FetchHandlerPlugin<T>[];
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* OpenAPI Handler for Fetch Server
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
35
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
36
|
+
*/
|
|
31
37
|
declare class FetchHandler<T extends Context> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
38
|
private readonly toFetchResponseOptions;
|
|
34
39
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
40
|
+
private readonly standardHandler;
|
|
41
|
+
constructor(router: Router<any, T>, options?: NoInfer<FetchHandlerOptions<T>>);
|
|
36
42
|
handle(request: Request, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<FetchHandleResult>;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ORPCError, toArray, intercept, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { toStandardLazyRequest, toFetchResponse } from '@temporary-name/standard-server-fetch';
|
|
3
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
-
import '@temporary-name/standard-server';
|
|
3
|
+
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CMTfy2UB.mjs';
|
|
5
4
|
import '@temporary-name/contract';
|
|
6
|
-
import '
|
|
7
|
-
import
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
|
+
import '@temporary-name/server';
|
|
7
|
+
import 'rou3';
|
|
8
|
+
import '../../shared/server.BZtKt8i8.mjs';
|
|
9
|
+
import '../../shared/server.BEHw7Eyx.mjs';
|
|
11
10
|
|
|
12
11
|
class BodyLimitPlugin {
|
|
13
12
|
maxBodySize;
|
|
@@ -136,15 +135,16 @@ class CompositeFetchHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
class FetchHandler {
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
toFetchResponseOptions;
|
|
139
|
+
adapterInterceptors;
|
|
140
|
+
standardHandler;
|
|
141
|
+
constructor(router, options = {}) {
|
|
142
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
141
143
|
const plugin = new CompositeFetchHandlerPlugin(options.plugins);
|
|
142
144
|
plugin.initRuntimeAdapter(options);
|
|
143
145
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
144
146
|
this.toFetchResponseOptions = options;
|
|
145
147
|
}
|
|
146
|
-
toFetchResponseOptions;
|
|
147
|
-
adapterInterceptors;
|
|
148
148
|
async handle(request, ...rest) {
|
|
149
149
|
return intercept(
|
|
150
150
|
this.adapterInterceptors,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BKSOrA6h.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.C1fnTLq0.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BeuTpcmO.mjs';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
8
|
import '@temporary-name/standard-server';
|
|
@@ -24,15 +24,21 @@ interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardH
|
|
|
24
24
|
response: NodeHttpResponse;
|
|
25
25
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
|
26
26
|
}
|
|
27
|
-
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
|
27
|
+
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
28
|
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
|
29
29
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* OpenAPI Handler for Node Server
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
35
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
36
|
+
*/
|
|
31
37
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
38
|
private readonly sendStandardResponseOptions;
|
|
34
39
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
40
|
+
private readonly standardHandler;
|
|
41
|
+
constructor(router: Router<any, T>, options?: NoInfer<NodeHttpHandlerOptions<T>>);
|
|
36
42
|
handle(request: NodeHttpRequest, response: NodeHttpResponse, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.BKSOrA6h.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as
|
|
5
|
-
import { FriendlyStandardHandleOptions } from '
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.CQyYNJ1H.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.SLLuK6_v.js';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
8
|
import '@temporary-name/standard-server';
|
|
@@ -24,15 +24,21 @@ interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardH
|
|
|
24
24
|
response: NodeHttpResponse;
|
|
25
25
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
|
26
26
|
}
|
|
27
|
-
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
|
27
|
+
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
28
|
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
|
29
29
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* OpenAPI Handler for Node Server
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
35
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
36
|
+
*/
|
|
31
37
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
38
|
private readonly sendStandardResponseOptions;
|
|
34
39
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
40
|
+
private readonly standardHandler;
|
|
41
|
+
constructor(router: Router<any, T>, options?: NoInfer<NodeHttpHandlerOptions<T>>);
|
|
36
42
|
handle(request: NodeHttpRequest, response: NodeHttpResponse, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { once, ORPCError, toArray, intercept, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import compression from '@temporary-name/interop/compression';
|
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import '@temporary-name/standard-server';
|
|
4
|
+
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CMTfy2UB.mjs';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '
|
|
8
|
-
import
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
6
|
+
import '@temporary-name/standard-server';
|
|
7
|
+
import '@temporary-name/server';
|
|
8
|
+
import 'rou3';
|
|
9
|
+
import '../../shared/server.BZtKt8i8.mjs';
|
|
10
|
+
import '../../shared/server.BEHw7Eyx.mjs';
|
|
12
11
|
|
|
13
12
|
class BodyLimitPlugin {
|
|
14
13
|
maxBodySize;
|
|
@@ -102,15 +101,16 @@ class CompositeNodeHttpHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
class NodeHttpHandler {
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
sendStandardResponseOptions;
|
|
105
|
+
adapterInterceptors;
|
|
106
|
+
standardHandler;
|
|
107
|
+
constructor(router, options = {}) {
|
|
108
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
107
109
|
const plugin = new CompositeNodeHttpHandlerPlugin(options.plugins);
|
|
108
110
|
plugin.initRuntimeAdapter(options);
|
|
109
111
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
110
112
|
this.sendStandardResponseOptions = options;
|
|
111
113
|
}
|
|
112
|
-
sendStandardResponseOptions;
|
|
113
|
-
adapterInterceptors;
|
|
114
114
|
async handle(request, response, ...rest) {
|
|
115
115
|
return intercept(
|
|
116
116
|
this.adapterInterceptors,
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, c as StandardHandleOptions, d as StandardHandleResult, e as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.C1fnTLq0.mjs';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { StandardCodec as StandardCodec$1, StandardParams as StandardParams$1, StandardMatcher as StandardMatcher$1, StandardMatchResult as StandardMatchResult$1 } from '@temporary-name/server/standard';
|
|
4
|
+
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
5
|
+
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
6
|
+
import { h as AnyProcedure$1, f as AnyRouter$1 } from '../../shared/server.BKSOrA6h.mjs';
|
|
7
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.BeuTpcmO.mjs';
|
|
4
8
|
import '@temporary-name/contract';
|
|
5
|
-
import '@temporary-name/shared';
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
declare class StandardOpenAPICodec implements StandardCodec$1 {
|
|
11
|
+
#private;
|
|
12
|
+
constructor();
|
|
13
|
+
decode(request: StandardLazyRequest, params: StandardParams$1 | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
14
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
16
|
+
}
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher$1 {
|
|
19
|
+
private readonly tree;
|
|
20
|
+
private pendingRouters;
|
|
21
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
22
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult$1>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type StandardParams = Record<string, string>;
|
|
26
|
+
type StandardMatchResult = {
|
|
27
|
+
path: readonly string[];
|
|
28
|
+
procedure: AnyProcedure$1;
|
|
29
|
+
params?: StandardParams;
|
|
30
|
+
} | undefined;
|
|
31
|
+
interface StandardMatcher {
|
|
32
|
+
init(router: AnyRouter$1): void;
|
|
33
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
34
|
+
}
|
|
35
|
+
interface StandardCodec {
|
|
36
|
+
encode(output: unknown, procedure: AnyProcedure$1): StandardResponse;
|
|
37
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
38
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure$1): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { StandardOpenAPICodec, StandardOpenAPIMatcher };
|
|
42
|
+
export type { StandardCodec, StandardMatchResult, StandardMatcher, StandardParams };
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, c as StandardHandleOptions, d as StandardHandleResult, e as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.CQyYNJ1H.js';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { StandardCodec as StandardCodec$1, StandardParams as StandardParams$1, StandardMatcher as StandardMatcher$1, StandardMatchResult as StandardMatchResult$1 } from '@temporary-name/server/standard';
|
|
4
|
+
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
5
|
+
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
6
|
+
import { h as AnyProcedure$1, f as AnyRouter$1 } from '../../shared/server.BKSOrA6h.js';
|
|
7
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.SLLuK6_v.js';
|
|
4
8
|
import '@temporary-name/contract';
|
|
5
|
-
import '@temporary-name/shared';
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
declare class StandardOpenAPICodec implements StandardCodec$1 {
|
|
11
|
+
#private;
|
|
12
|
+
constructor();
|
|
13
|
+
decode(request: StandardLazyRequest, params: StandardParams$1 | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
14
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
16
|
+
}
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher$1 {
|
|
19
|
+
private readonly tree;
|
|
20
|
+
private pendingRouters;
|
|
21
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
22
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult$1>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type StandardParams = Record<string, string>;
|
|
26
|
+
type StandardMatchResult = {
|
|
27
|
+
path: readonly string[];
|
|
28
|
+
procedure: AnyProcedure$1;
|
|
29
|
+
params?: StandardParams;
|
|
30
|
+
} | undefined;
|
|
31
|
+
interface StandardMatcher {
|
|
32
|
+
init(router: AnyRouter$1): void;
|
|
33
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
34
|
+
}
|
|
35
|
+
interface StandardCodec {
|
|
36
|
+
encode(output: unknown, procedure: AnyProcedure$1): StandardResponse;
|
|
37
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
38
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure$1): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { StandardOpenAPICodec, StandardOpenAPIMatcher };
|
|
42
|
+
export type { StandardCodec, StandardMatchResult, StandardMatcher, StandardParams };
|
|
@@ -1,101 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
export { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardOpenAPICodec, b as StandardOpenAPIMatcher, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.CMTfy2UB.mjs';
|
|
2
|
+
import '@temporary-name/shared';
|
|
3
|
+
import '@temporary-name/standard-server';
|
|
4
|
+
import '../../shared/server.BZtKt8i8.mjs';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import 'zod/v4/core';
|
|
11
|
-
|
|
12
|
-
class StandardHandler {
|
|
13
|
-
constructor(router, matcher, codec, options) {
|
|
14
|
-
this.matcher = matcher;
|
|
15
|
-
this.codec = codec;
|
|
16
|
-
const plugins = new CompositeStandardHandlerPlugin(options.plugins);
|
|
17
|
-
plugins.init(options, router);
|
|
18
|
-
this.interceptors = toArray(options.interceptors);
|
|
19
|
-
this.clientInterceptors = toArray(options.clientInterceptors);
|
|
20
|
-
this.rootInterceptors = toArray(options.rootInterceptors);
|
|
21
|
-
this.matcher.init(router);
|
|
22
|
-
}
|
|
23
|
-
interceptors;
|
|
24
|
-
clientInterceptors;
|
|
25
|
-
rootInterceptors;
|
|
26
|
-
async handle(request, options) {
|
|
27
|
-
const prefix = options.prefix?.replace(/\/$/, "") || void 0;
|
|
28
|
-
if (prefix && !request.url.pathname.startsWith(`${prefix}/`) && request.url.pathname !== prefix) {
|
|
29
|
-
return { matched: false, response: void 0 };
|
|
30
|
-
}
|
|
31
|
-
return intercept(this.rootInterceptors, { ...options, request, prefix }, async (interceptorOptions) => {
|
|
32
|
-
return runWithSpan({ name: `${request.method} ${request.url.pathname}` }, async (span) => {
|
|
33
|
-
let step;
|
|
34
|
-
try {
|
|
35
|
-
return await intercept(
|
|
36
|
-
this.interceptors,
|
|
37
|
-
interceptorOptions,
|
|
38
|
-
async ({ request: request2, context, prefix: prefix2 }) => {
|
|
39
|
-
const method = request2.method;
|
|
40
|
-
const url = request2.url;
|
|
41
|
-
const pathname = prefix2 ? url.pathname.replace(prefix2, "") : url.pathname;
|
|
42
|
-
const match = await runWithSpan(
|
|
43
|
-
{ name: "find_procedure" },
|
|
44
|
-
() => this.matcher.match(method, `/${pathname.replace(/^\/|\/$/g, "")}`)
|
|
45
|
-
);
|
|
46
|
-
if (!match) {
|
|
47
|
-
return { matched: false, response: void 0 };
|
|
48
|
-
}
|
|
49
|
-
span?.updateName(`${ORPC_NAME}.${match.path.join("/")}`);
|
|
50
|
-
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
51
|
-
span?.setAttribute("rpc.method", match.path.join("."));
|
|
52
|
-
step = "decode_input";
|
|
53
|
-
let input = await runWithSpan(
|
|
54
|
-
{ name: "decode_input" },
|
|
55
|
-
() => this.codec.decode(request2, match.params, match.procedure)
|
|
56
|
-
);
|
|
57
|
-
step = void 0;
|
|
58
|
-
if (isAsyncIteratorObject(input)) {
|
|
59
|
-
input = asyncIteratorWithSpan(
|
|
60
|
-
{ name: "consume_event_iterator_input", signal: request2.signal },
|
|
61
|
-
input
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
const client = createProcedureClient(match.procedure, {
|
|
65
|
-
context,
|
|
66
|
-
path: match.path,
|
|
67
|
-
interceptors: this.clientInterceptors
|
|
68
|
-
});
|
|
69
|
-
step = "call_procedure";
|
|
70
|
-
const output = await client(input, {
|
|
71
|
-
signal: request2.signal,
|
|
72
|
-
lastEventId: flattenHeader(request2.headers["last-event-id"])
|
|
73
|
-
});
|
|
74
|
-
step = void 0;
|
|
75
|
-
const response = this.codec.encode(output, match.procedure);
|
|
76
|
-
return {
|
|
77
|
-
matched: true,
|
|
78
|
-
response
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
} catch (e) {
|
|
83
|
-
if (step !== "call_procedure") {
|
|
84
|
-
setSpanError(span, e);
|
|
85
|
-
}
|
|
86
|
-
const error = step === "decode_input" && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
|
|
87
|
-
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
88
|
-
cause: e
|
|
89
|
-
}) : toORPCError(e);
|
|
90
|
-
const response = this.codec.encodeError(error);
|
|
91
|
-
return {
|
|
92
|
-
matched: true,
|
|
93
|
-
response
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { CompositeStandardHandlerPlugin, StandardHandler };
|
|
6
|
+
import '../../shared/server.BEHw7Eyx.mjs';
|
|
7
|
+
import '@temporary-name/server';
|
|
8
|
+
import 'rou3';
|