@temporary-name/server 1.9.3-alpha.0d2fa3247b6b23bbc2e3097a95f631b86740e4d8 → 1.9.3-alpha.102eab0800942eb736f7669a86c850ebfdfcd4a3
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 +13 -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 +13 -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 +13 -11
- package/dist/adapters/standard/index.d.mts +28 -13
- package/dist/adapters/standard/index.d.ts +28 -13
- package/dist/adapters/standard/index.mjs +9 -100
- package/dist/index.d.mts +69 -441
- package/dist/index.d.ts +69 -441
- package/dist/index.mjs +149 -356
- package/dist/openapi/index.d.mts +220 -0
- package/dist/openapi/index.d.ts +220 -0
- package/dist/openapi/index.mjs +760 -0
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/shared/{server.Btxrgkj5.d.ts → server.BCcLYvdF.d.mts} +7 -24
- package/dist/shared/server.CHV9AQHl.mjs +412 -0
- package/dist/shared/{server.Bo94xDTv.d.mts → server.CdeqmULw.d.ts} +7 -24
- package/dist/shared/server.DHezmW6C.d.mts +23 -0
- package/dist/shared/server.DN9mVGfv.mjs +11 -0
- package/dist/shared/server.DWwaAM-a.mjs +255 -0
- package/dist/shared/server.Da-qLzdU.d.ts +23 -0
- package/dist/shared/{server.C1YnHvvf.d.ts → server.DecvGKtb.d.mts} +125 -75
- package/dist/shared/{server.C1YnHvvf.d.mts → server.DecvGKtb.d.ts} +125 -75
- package/dist/shared/server.JtIZ8YG7.mjs +237 -0
- package/package.json +18 -11
- package/dist/shared/server.BEQrAa3A.mjs +0 -207
- 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.DecvGKtb.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.BCcLYvdF.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DHezmW6C.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.DecvGKtb.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.CdeqmULw.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Da-qLzdU.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,22 @@
|
|
|
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.DWwaAM-a.mjs';
|
|
4
|
+
import '@temporary-name/contract';
|
|
5
|
+
import '@temporary-name/standard-server';
|
|
6
|
+
import '@temporary-name/server';
|
|
7
|
+
import 'rou3';
|
|
8
|
+
import '../../shared/server.CHV9AQHl.mjs';
|
|
9
|
+
import '@temporary-name/zod';
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
|
4
12
|
|
|
5
13
|
class AwsLambdaHandler {
|
|
6
|
-
|
|
7
|
-
|
|
14
|
+
sendStandardResponseOptions;
|
|
15
|
+
standardHandler;
|
|
16
|
+
constructor(router, options = {}) {
|
|
17
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
8
18
|
this.sendStandardResponseOptions = options;
|
|
9
19
|
}
|
|
10
|
-
sendStandardResponseOptions;
|
|
11
20
|
async handle(event, responseStream, ...rest) {
|
|
12
21
|
const standardRequest = toStandardLazyRequest(event, responseStream);
|
|
13
22
|
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.DecvGKtb.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.BCcLYvdF.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DHezmW6C.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.DecvGKtb.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.CdeqmULw.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Da-qLzdU.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,14 @@
|
|
|
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.DWwaAM-a.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.CHV9AQHl.mjs';
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
|
11
12
|
|
|
12
13
|
class BodyLimitPlugin {
|
|
13
14
|
maxBodySize;
|
|
@@ -136,15 +137,16 @@ class CompositeFetchHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
class FetchHandler {
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
toFetchResponseOptions;
|
|
141
|
+
adapterInterceptors;
|
|
142
|
+
standardHandler;
|
|
143
|
+
constructor(router, options = {}) {
|
|
144
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
141
145
|
const plugin = new CompositeFetchHandlerPlugin(options.plugins);
|
|
142
146
|
plugin.initRuntimeAdapter(options);
|
|
143
147
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
144
148
|
this.toFetchResponseOptions = options;
|
|
145
149
|
}
|
|
146
|
-
toFetchResponseOptions;
|
|
147
|
-
adapterInterceptors;
|
|
148
150
|
async handle(request, ...rest) {
|
|
149
151
|
return intercept(
|
|
150
152
|
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.DecvGKtb.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.BCcLYvdF.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DHezmW6C.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.DecvGKtb.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.CdeqmULw.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Da-qLzdU.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,15 @@
|
|
|
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.DWwaAM-a.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.CHV9AQHl.mjs';
|
|
11
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
12
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
|
12
13
|
|
|
13
14
|
class BodyLimitPlugin {
|
|
14
15
|
maxBodySize;
|
|
@@ -102,15 +103,16 @@ class CompositeNodeHttpHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
class NodeHttpHandler {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
sendStandardResponseOptions;
|
|
107
|
+
adapterInterceptors;
|
|
108
|
+
standardHandler;
|
|
109
|
+
constructor(router, options = {}) {
|
|
110
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
107
111
|
const plugin = new CompositeNodeHttpHandlerPlugin(options.plugins);
|
|
108
112
|
plugin.initRuntimeAdapter(options);
|
|
109
113
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
110
114
|
this.sendStandardResponseOptions = options;
|
|
111
115
|
}
|
|
112
|
-
sendStandardResponseOptions;
|
|
113
|
-
adapterInterceptors;
|
|
114
116
|
async handle(request, response, ...rest) {
|
|
115
117
|
return intercept(
|
|
116
118
|
this.adapterInterceptors,
|
|
@@ -1,16 +1,31 @@
|
|
|
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.BCcLYvdF.mjs';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
import { StandardLazyRequest, StandardHeaders, StandardResponse } from '@temporary-name/standard-server';
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.DHezmW6C.mjs';
|
|
4
6
|
import '@temporary-name/contract';
|
|
5
|
-
import '
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
7
|
+
import '../../shared/server.DecvGKtb.mjs';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
10
|
+
path: unknown;
|
|
11
|
+
query: unknown;
|
|
12
|
+
headers: StandardHeaders;
|
|
13
|
+
body: unknown;
|
|
14
|
+
}>;
|
|
15
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
16
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
type StandardMatchResult = {
|
|
19
|
+
path: readonly string[];
|
|
20
|
+
procedure: AnyProcedure;
|
|
21
|
+
params?: Record<string, string>;
|
|
22
|
+
} | undefined;
|
|
23
|
+
declare class StandardOpenAPIMatcher {
|
|
24
|
+
private readonly tree;
|
|
25
|
+
private pendingRouters;
|
|
26
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
27
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
31
|
+
export type { StandardMatchResult };
|
|
@@ -1,16 +1,31 @@
|
|
|
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.CdeqmULw.js';
|
|
2
|
+
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
|
+
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
|
+
import { StandardLazyRequest, StandardHeaders, StandardResponse } from '@temporary-name/standard-server';
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.Da-qLzdU.js';
|
|
4
6
|
import '@temporary-name/contract';
|
|
5
|
-
import '
|
|
6
|
-
import '@temporary-name/standard-server';
|
|
7
|
+
import '../../shared/server.DecvGKtb.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
10
|
+
path: unknown;
|
|
11
|
+
query: unknown;
|
|
12
|
+
headers: StandardHeaders;
|
|
13
|
+
body: unknown;
|
|
14
|
+
}>;
|
|
15
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
16
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
type StandardMatchResult = {
|
|
19
|
+
path: readonly string[];
|
|
20
|
+
procedure: AnyProcedure;
|
|
21
|
+
params?: Record<string, string>;
|
|
22
|
+
} | undefined;
|
|
23
|
+
declare class StandardOpenAPIMatcher {
|
|
24
|
+
private readonly tree;
|
|
25
|
+
private pendingRouters;
|
|
26
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
27
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
31
|
+
export type { StandardMatchResult };
|
|
@@ -1,101 +1,10 @@
|
|
|
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, b as StandardOpenAPIMatcher, d as decode, c as decodeParams, e as encode, a as encodeError, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.DWwaAM-a.mjs';
|
|
2
|
+
import '@temporary-name/shared';
|
|
3
|
+
import '@temporary-name/standard-server';
|
|
4
|
+
import '../../shared/server.CHV9AQHl.mjs';
|
|
6
5
|
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 };
|
|
6
|
+
import '@temporary-name/zod';
|
|
7
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
8
|
+
import '@temporary-name/server';
|
|
9
|
+
import 'rou3';
|
|
10
|
+
import '../../shared/server.DN9mVGfv.mjs';
|