@temporary-name/server 1.9.3-alpha.9f176ca3f9388d51e8dffa98a15fcf9f14f6a75e → 1.9.3-alpha.a253b67a3639148c12f13a47295e1922182adecd
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 -7
- package/dist/adapters/aws-lambda/index.d.ts +12 -7
- package/dist/adapters/aws-lambda/index.mjs +12 -4
- package/dist/adapters/fetch/index.d.mts +12 -7
- package/dist/adapters/fetch/index.d.ts +12 -7
- package/dist/adapters/fetch/index.mjs +12 -11
- package/dist/adapters/node/index.d.mts +12 -7
- package/dist/adapters/node/index.d.ts +12 -7
- package/dist/adapters/node/index.mjs +12 -11
- package/dist/adapters/standard/index.d.mts +27 -13
- package/dist/adapters/standard/index.d.ts +27 -13
- package/dist/adapters/standard/index.mjs +8 -100
- package/dist/helpers/index.mjs +3 -29
- package/dist/index.d.mts +62 -583
- package/dist/index.d.ts +62 -583
- package/dist/index.mjs +212 -446
- package/dist/openapi/index.d.mts +220 -0
- package/dist/openapi/index.d.ts +220 -0
- package/dist/openapi/index.mjs +707 -0
- package/dist/plugins/index.d.mts +5 -83
- package/dist/plugins/index.d.ts +5 -83
- package/dist/plugins/index.mjs +17 -189
- package/dist/shared/server.BR0GBxlv.d.ts +23 -0
- package/dist/shared/server.C1RJffw4.mjs +30 -0
- package/dist/shared/server.C7HccVwN.d.mts +23 -0
- package/dist/shared/{server.Btxrgkj5.d.ts → server.CPThlZ_E.d.ts} +9 -27
- package/dist/shared/server.D-DR5Z00.mjs +362 -0
- package/dist/shared/server.JtIZ8YG7.mjs +237 -0
- package/dist/shared/server.oy0285uM.d.mts +252 -0
- package/dist/shared/server.oy0285uM.d.ts +252 -0
- package/dist/shared/server.rZDPWnA8.mjs +234 -0
- package/dist/shared/{server.Bo94xDTv.d.mts → server.y97Td78c.d.mts} +9 -27
- package/package.json +17 -22
- package/dist/shared/server.BEQrAa3A.mjs +0 -207
- package/dist/shared/server.C1YnHvvf.d.mts +0 -192
- package/dist/shared/server.C1YnHvvf.d.ts +0 -192
- 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,27 @@
|
|
|
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.oy0285uM.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.y97Td78c.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.C7HccVwN.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
|
-
interface AwsLambdaHandlerOptions extends SendStandardResponseOptions {
|
|
8
|
+
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
10
9
|
}
|
|
11
10
|
type AwsLambdaHandleResult = {
|
|
12
11
|
matched: true;
|
|
13
12
|
} | {
|
|
14
13
|
matched: false;
|
|
15
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* OpenAPI Handler for AWS Lambda.
|
|
17
|
+
*
|
|
18
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
19
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
20
|
+
*/
|
|
16
21
|
declare class AwsLambdaHandler<T extends Context> {
|
|
17
|
-
private readonly standardHandler;
|
|
18
22
|
private readonly sendStandardResponseOptions;
|
|
19
|
-
|
|
23
|
+
private readonly standardHandler;
|
|
24
|
+
constructor(router: Router<T>, options?: AwsLambdaHandlerOptions<T>);
|
|
20
25
|
handle(event: APIGatewayProxyEventV2, responseStream: ResponseStream, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<AwsLambdaHandleResult>;
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -1,22 +1,27 @@
|
|
|
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.oy0285uM.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.CPThlZ_E.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BR0GBxlv.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
|
-
interface AwsLambdaHandlerOptions extends SendStandardResponseOptions {
|
|
8
|
+
interface AwsLambdaHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, SendStandardResponseOptions {
|
|
10
9
|
}
|
|
11
10
|
type AwsLambdaHandleResult = {
|
|
12
11
|
matched: true;
|
|
13
12
|
} | {
|
|
14
13
|
matched: false;
|
|
15
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* OpenAPI Handler for AWS Lambda.
|
|
17
|
+
*
|
|
18
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
19
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
20
|
+
*/
|
|
16
21
|
declare class AwsLambdaHandler<T extends Context> {
|
|
17
|
-
private readonly standardHandler;
|
|
18
22
|
private readonly sendStandardResponseOptions;
|
|
19
|
-
|
|
23
|
+
private readonly standardHandler;
|
|
24
|
+
constructor(router: Router<T>, options?: AwsLambdaHandlerOptions<T>);
|
|
20
25
|
handle(event: APIGatewayProxyEventV2, responseStream: ResponseStream, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<AwsLambdaHandleResult>;
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -1,13 +1,21 @@
|
|
|
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.rZDPWnA8.mjs';
|
|
4
|
+
import '@temporary-name/contract';
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
|
+
import '@temporary-name/server';
|
|
7
|
+
import 'rou3';
|
|
8
|
+
import '../../shared/server.D-DR5Z00.mjs';
|
|
9
|
+
import '@temporary-name/zod';
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
4
11
|
|
|
5
12
|
class AwsLambdaHandler {
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
sendStandardResponseOptions;
|
|
14
|
+
standardHandler;
|
|
15
|
+
constructor(router, options = {}) {
|
|
16
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
8
17
|
this.sendStandardResponseOptions = options;
|
|
9
18
|
}
|
|
10
|
-
sendStandardResponseOptions;
|
|
11
19
|
async handle(event, responseStream, ...rest) {
|
|
12
20
|
const standardRequest = toStandardLazyRequest(event, responseStream);
|
|
13
21
|
const options = resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.oy0285uM.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.y97Td78c.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.C7HccVwN.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
8
|
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
10
9
|
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
|
@@ -24,15 +23,21 @@ interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHand
|
|
|
24
23
|
request: Request;
|
|
25
24
|
toFetchResponseOptions: ToFetchResponseOptions;
|
|
26
25
|
}
|
|
27
|
-
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
|
26
|
+
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
27
|
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, Promise<FetchHandleResult>>[];
|
|
29
28
|
plugins?: FetchHandlerPlugin<T>[];
|
|
30
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* OpenAPI Handler for Fetch Server
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
35
|
+
*/
|
|
31
36
|
declare class FetchHandler<T extends Context> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
37
|
private readonly toFetchResponseOptions;
|
|
34
38
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
39
|
+
private readonly standardHandler;
|
|
40
|
+
constructor(router: Router<T>, options?: NoInfer<FetchHandlerOptions<T>>);
|
|
36
41
|
handle(request: Request, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<FetchHandleResult>;
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.oy0285uM.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.CPThlZ_E.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BR0GBxlv.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '@temporary-name/standard-server';
|
|
8
7
|
|
|
9
8
|
interface FetchHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
10
9
|
initRuntimeAdapter?(options: FetchHandlerOptions<T>): void;
|
|
@@ -24,15 +23,21 @@ interface FetchHandlerInterceptorOptions<T extends Context> extends StandardHand
|
|
|
24
23
|
request: Request;
|
|
25
24
|
toFetchResponseOptions: ToFetchResponseOptions;
|
|
26
25
|
}
|
|
27
|
-
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions {
|
|
26
|
+
interface FetchHandlerOptions<T extends Context> extends ToFetchResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
27
|
adapterInterceptors?: Interceptor<FetchHandlerInterceptorOptions<T>, Promise<FetchHandleResult>>[];
|
|
29
28
|
plugins?: FetchHandlerPlugin<T>[];
|
|
30
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* OpenAPI Handler for Fetch Server
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
35
|
+
*/
|
|
31
36
|
declare class FetchHandler<T extends Context> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
37
|
private readonly toFetchResponseOptions;
|
|
34
38
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
39
|
+
private readonly standardHandler;
|
|
40
|
+
constructor(router: Router<T>, options?: NoInfer<FetchHandlerOptions<T>>);
|
|
36
41
|
handle(request: Request, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<FetchHandleResult>;
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -1,13 +1,13 @@
|
|
|
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.rZDPWnA8.mjs';
|
|
5
4
|
import '@temporary-name/contract';
|
|
6
|
-
import '
|
|
7
|
-
import
|
|
8
|
-
import '
|
|
9
|
-
import 'zod';
|
|
10
|
-
import '
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
|
+
import '@temporary-name/server';
|
|
7
|
+
import 'rou3';
|
|
8
|
+
import '@temporary-name/zod';
|
|
9
|
+
import '../../shared/server.D-DR5Z00.mjs';
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
11
|
|
|
12
12
|
class BodyLimitPlugin {
|
|
13
13
|
maxBodySize;
|
|
@@ -136,15 +136,16 @@ class CompositeFetchHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
class FetchHandler {
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
toFetchResponseOptions;
|
|
140
|
+
adapterInterceptors;
|
|
141
|
+
standardHandler;
|
|
142
|
+
constructor(router, options = {}) {
|
|
143
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
141
144
|
const plugin = new CompositeFetchHandlerPlugin(options.plugins);
|
|
142
145
|
plugin.initRuntimeAdapter(options);
|
|
143
146
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
144
147
|
this.toFetchResponseOptions = options;
|
|
145
148
|
}
|
|
146
|
-
toFetchResponseOptions;
|
|
147
|
-
adapterInterceptors;
|
|
148
149
|
async handle(request, ...rest) {
|
|
149
150
|
return intercept(
|
|
150
151
|
this.adapterInterceptors,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.oy0285uM.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.y97Td78c.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.C7HccVwN.mjs';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
|
-
import '@temporary-name/standard-server';
|
|
9
8
|
|
|
10
9
|
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
11
10
|
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
|
@@ -24,15 +23,21 @@ interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardH
|
|
|
24
23
|
response: NodeHttpResponse;
|
|
25
24
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
|
26
25
|
}
|
|
27
|
-
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
|
26
|
+
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
27
|
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
|
29
28
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
|
30
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* OpenAPI Handler for Node Server
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
35
|
+
*/
|
|
31
36
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
37
|
private readonly sendStandardResponseOptions;
|
|
34
38
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
39
|
+
private readonly standardHandler;
|
|
40
|
+
constructor(router: Router<T>, options?: NoInfer<NodeHttpHandlerOptions<T>>);
|
|
36
41
|
handle(request: NodeHttpRequest, response: NodeHttpResponse, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { C as Context } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.oy0285uM.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.CPThlZ_E.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BR0GBxlv.js';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
|
-
import '@temporary-name/standard-server';
|
|
9
8
|
|
|
10
9
|
interface NodeHttpHandlerPlugin<T extends Context> extends StandardHandlerPlugin<T> {
|
|
11
10
|
initRuntimeAdapter?(options: NodeHttpHandlerOptions<T>): void;
|
|
@@ -24,15 +23,21 @@ interface NodeHttpHandlerInterceptorOptions<T extends Context> extends StandardH
|
|
|
24
23
|
response: NodeHttpResponse;
|
|
25
24
|
sendStandardResponseOptions: SendStandardResponseOptions;
|
|
26
25
|
}
|
|
27
|
-
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions {
|
|
26
|
+
interface NodeHttpHandlerOptions<T extends Context> extends SendStandardResponseOptions, Omit<StandardHandlerOptions<T>, 'plugins'> {
|
|
28
27
|
adapterInterceptors?: Interceptor<NodeHttpHandlerInterceptorOptions<T>, Promise<NodeHttpHandleResult>>[];
|
|
29
28
|
plugins?: NodeHttpHandlerPlugin<T>[];
|
|
30
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* OpenAPI Handler for Node Server
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-handler OpenAPI Handler Docs}
|
|
34
|
+
* @see {@link https://orpc.unnoq.com/docs/adapters/http HTTP Adapter Docs}
|
|
35
|
+
*/
|
|
31
36
|
declare class NodeHttpHandler<T extends Context> implements NodeHttpHandler<T> {
|
|
32
|
-
private readonly standardHandler;
|
|
33
37
|
private readonly sendStandardResponseOptions;
|
|
34
38
|
private readonly adapterInterceptors;
|
|
35
|
-
|
|
39
|
+
private readonly standardHandler;
|
|
40
|
+
constructor(router: Router<T>, options?: NoInfer<NodeHttpHandlerOptions<T>>);
|
|
36
41
|
handle(request: NodeHttpRequest, response: NodeHttpResponse, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -1,14 +1,14 @@
|
|
|
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.rZDPWnA8.mjs';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '
|
|
8
|
-
import
|
|
9
|
-
import '
|
|
10
|
-
import 'zod';
|
|
11
|
-
import '
|
|
6
|
+
import '@temporary-name/standard-server';
|
|
7
|
+
import '@temporary-name/server';
|
|
8
|
+
import 'rou3';
|
|
9
|
+
import '@temporary-name/zod';
|
|
10
|
+
import '../../shared/server.D-DR5Z00.mjs';
|
|
11
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
12
12
|
|
|
13
13
|
class BodyLimitPlugin {
|
|
14
14
|
maxBodySize;
|
|
@@ -102,15 +102,16 @@ class CompositeNodeHttpHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
class NodeHttpHandler {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
sendStandardResponseOptions;
|
|
106
|
+
adapterInterceptors;
|
|
107
|
+
standardHandler;
|
|
108
|
+
constructor(router, options = {}) {
|
|
109
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
107
110
|
const plugin = new CompositeNodeHttpHandlerPlugin(options.plugins);
|
|
108
111
|
plugin.initRuntimeAdapter(options);
|
|
109
112
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
110
113
|
this.sendStandardResponseOptions = options;
|
|
111
114
|
}
|
|
112
|
-
sendStandardResponseOptions;
|
|
113
|
-
adapterInterceptors;
|
|
114
115
|
async handle(request, response, ...rest) {
|
|
115
116
|
return intercept(
|
|
116
117
|
this.adapterInterceptors,
|
|
@@ -1,16 +1,30 @@
|
|
|
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.y97Td78c.mjs';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.C7HccVwN.mjs';
|
|
4
5
|
import '@temporary-name/contract';
|
|
5
|
-
import '
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
6
|
+
import '../../shared/server.oy0285uM.mjs';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
9
|
+
path: unknown;
|
|
10
|
+
query: unknown;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
body: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
type StandardMatchResult = {
|
|
18
|
+
path: readonly string[];
|
|
19
|
+
procedure: AnyProcedure;
|
|
20
|
+
params?: Record<string, string>;
|
|
21
|
+
} | undefined;
|
|
22
|
+
declare class StandardOpenAPIMatcher {
|
|
23
|
+
private readonly tree;
|
|
24
|
+
private pendingRouters;
|
|
25
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
26
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
30
|
+
export type { StandardMatchResult };
|
|
@@ -1,16 +1,30 @@
|
|
|
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.CPThlZ_E.js';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { StandardLazyRequest, StandardResponse, ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.BR0GBxlv.js';
|
|
4
5
|
import '@temporary-name/contract';
|
|
5
|
-
import '
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
6
|
+
import '../../shared/server.oy0285uM.js';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
9
|
+
path: unknown;
|
|
10
|
+
query: unknown;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
body: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
type StandardMatchResult = {
|
|
18
|
+
path: readonly string[];
|
|
19
|
+
procedure: AnyProcedure;
|
|
20
|
+
params?: Record<string, string>;
|
|
21
|
+
} | undefined;
|
|
22
|
+
declare class StandardOpenAPIMatcher {
|
|
23
|
+
private readonly tree;
|
|
24
|
+
private pendingRouters;
|
|
25
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
26
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
30
|
+
export type { StandardMatchResult };
|
|
@@ -1,101 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { C as CompositeStandardHandlerPlugin } from '../../shared/server.X0YaZxSJ.mjs';
|
|
5
|
-
export { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
|
1
|
+
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, b as StandardOpenAPIMatcher, d as decode, c as decodeParams, e as encode, a as encodeError, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.rZDPWnA8.mjs';
|
|
2
|
+
import '@temporary-name/shared';
|
|
3
|
+
import '../../shared/server.D-DR5Z00.mjs';
|
|
6
4
|
import '@temporary-name/contract';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
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 };
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
|
+
import '@temporary-name/zod';
|
|
7
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
8
|
+
import '@temporary-name/server';
|
|
9
|
+
import 'rou3';
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { d as deleteCookie, g as getCookie, s as setCookie } from '../shared/server.C1RJffw4.mjs';
|
|
2
|
+
import 'cookie';
|
|
2
3
|
|
|
3
4
|
function encodeBase64url(data) {
|
|
4
5
|
const chunkSize = 8192;
|
|
@@ -30,33 +31,6 @@ function decodeBase64url(base64url) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
function setCookie(headers, name, value, options = {}) {
|
|
34
|
-
if (headers === void 0) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const cookieString = serialize(name, value, {
|
|
38
|
-
path: "/",
|
|
39
|
-
...options
|
|
40
|
-
});
|
|
41
|
-
headers.append("Set-Cookie", cookieString);
|
|
42
|
-
}
|
|
43
|
-
function getCookie(headers, name, options = {}) {
|
|
44
|
-
if (headers === void 0) {
|
|
45
|
-
return void 0;
|
|
46
|
-
}
|
|
47
|
-
const cookieHeader = headers.get("cookie");
|
|
48
|
-
if (cookieHeader === null) {
|
|
49
|
-
return void 0;
|
|
50
|
-
}
|
|
51
|
-
return parse(cookieHeader, options)[name];
|
|
52
|
-
}
|
|
53
|
-
function deleteCookie(headers, name, options = {}) {
|
|
54
|
-
return setCookie(headers, name, "", {
|
|
55
|
-
...options,
|
|
56
|
-
maxAge: 0
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
34
|
const PBKDF2_CONFIG = {
|
|
61
35
|
name: "PBKDF2",
|
|
62
36
|
iterations: 6e4,
|
|
@@ -165,4 +139,4 @@ function getSignedValue(signedValue) {
|
|
|
165
139
|
return signedValue.slice(0, lastDotIndex);
|
|
166
140
|
}
|
|
167
141
|
|
|
168
|
-
export { decodeBase64url, decrypt,
|
|
142
|
+
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getSignedValue, sign, unsign };
|