@temporary-name/server 1.9.3-alpha.9f176ca3f9388d51e8dffa98a15fcf9f14f6a75e → 1.9.3-alpha.afd18ec2afa743b08cf1b5c2eb6252ded18a1f43
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 +14 -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 -8
- 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 -8
- package/dist/adapters/standard/index.d.mts +85 -13
- package/dist/adapters/standard/index.d.ts +85 -13
- package/dist/adapters/standard/index.mjs +7 -97
- package/dist/index.d.mts +6 -108
- package/dist/index.d.ts +6 -108
- package/dist/index.mjs +2 -3
- package/dist/openapi/index.d.mts +221 -0
- package/dist/openapi/index.d.ts +221 -0
- package/dist/openapi/index.mjs +784 -0
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- 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.BKh8I1Ny.mjs} +34 -2
- 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.Bo94xDTv.d.mts → server.CQyYNJ1H.d.ts} +8 -24
- package/dist/shared/server.DhdDYN-Z.mjs +261 -0
- package/dist/shared/server.SLLuK6_v.d.ts +23 -0
- package/dist/shared/server._YqJjI50.mjs +297 -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,23 @@
|
|
|
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._YqJjI50.mjs';
|
|
4
|
+
import '@temporary-name/contract';
|
|
5
|
+
import '@temporary-name/server';
|
|
6
|
+
import 'rou3';
|
|
7
|
+
import '@temporary-name/standard-server';
|
|
8
|
+
import '../../shared/server.BKh8I1Ny.mjs';
|
|
9
|
+
import 'node:async_hooks';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import 'zod/v4/core';
|
|
12
|
+
import '../../shared/server.DhdDYN-Z.mjs';
|
|
4
13
|
|
|
5
14
|
class AwsLambdaHandler {
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
sendStandardResponseOptions;
|
|
16
|
+
standardHandler;
|
|
17
|
+
constructor(router, options = {}) {
|
|
18
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
8
19
|
this.sendStandardResponseOptions = options;
|
|
9
20
|
}
|
|
10
|
-
sendStandardResponseOptions;
|
|
11
21
|
async handle(event, responseStream, ...rest) {
|
|
12
22
|
const standardRequest = toStandardLazyRequest(event, responseStream);
|
|
13
23
|
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,10 +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._YqJjI50.mjs';
|
|
5
4
|
import '@temporary-name/contract';
|
|
6
|
-
import '
|
|
7
|
-
import
|
|
5
|
+
import '@temporary-name/server';
|
|
6
|
+
import 'rou3';
|
|
7
|
+
import '@temporary-name/standard-server';
|
|
8
|
+
import '../../shared/server.BKh8I1Ny.mjs';
|
|
9
|
+
import '../../shared/server.DhdDYN-Z.mjs';
|
|
8
10
|
import 'node:async_hooks';
|
|
9
11
|
import 'zod';
|
|
10
12
|
import 'zod/v4/core';
|
|
@@ -136,15 +138,16 @@ class CompositeFetchHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
class FetchHandler {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
toFetchResponseOptions;
|
|
142
|
+
adapterInterceptors;
|
|
143
|
+
standardHandler;
|
|
144
|
+
constructor(router, options = {}) {
|
|
145
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
141
146
|
const plugin = new CompositeFetchHandlerPlugin(options.plugins);
|
|
142
147
|
plugin.initRuntimeAdapter(options);
|
|
143
148
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
144
149
|
this.toFetchResponseOptions = options;
|
|
145
150
|
}
|
|
146
|
-
toFetchResponseOptions;
|
|
147
|
-
adapterInterceptors;
|
|
148
151
|
async handle(request, ...rest) {
|
|
149
152
|
return intercept(
|
|
150
153
|
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,11 +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._YqJjI50.mjs';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '
|
|
8
|
-
import
|
|
6
|
+
import '@temporary-name/server';
|
|
7
|
+
import 'rou3';
|
|
8
|
+
import '@temporary-name/standard-server';
|
|
9
|
+
import '../../shared/server.BKh8I1Ny.mjs';
|
|
10
|
+
import '../../shared/server.DhdDYN-Z.mjs';
|
|
9
11
|
import 'node:async_hooks';
|
|
10
12
|
import 'zod';
|
|
11
13
|
import 'zod/v4/core';
|
|
@@ -102,15 +104,16 @@ class CompositeNodeHttpHandlerPlugin extends CompositeStandardHandlerPlugin {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
class NodeHttpHandler {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
sendStandardResponseOptions;
|
|
108
|
+
adapterInterceptors;
|
|
109
|
+
standardHandler;
|
|
110
|
+
constructor(router, options = {}) {
|
|
111
|
+
this.standardHandler = new StandardHandler(router, options);
|
|
107
112
|
const plugin = new CompositeNodeHttpHandlerPlugin(options.plugins);
|
|
108
113
|
plugin.initRuntimeAdapter(options);
|
|
109
114
|
this.adapterInterceptors = toArray(options.adapterInterceptors);
|
|
110
115
|
this.sendStandardResponseOptions = options;
|
|
111
116
|
}
|
|
112
|
-
sendStandardResponseOptions;
|
|
113
|
-
adapterInterceptors;
|
|
114
117
|
async handle(request, response, ...rest) {
|
|
115
118
|
return intercept(
|
|
116
119
|
this.adapterInterceptors,
|
|
@@ -1,16 +1,88 @@
|
|
|
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 { Segment, 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
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
type StandardBracketNotationSerialized = [string, unknown][];
|
|
11
|
+
interface StandardBracketNotationSerializerOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Maximum allowed array index for bracket notation deserialization.
|
|
14
|
+
*
|
|
15
|
+
* This helps protect against memory exhaustion attacks where malicious input
|
|
16
|
+
* uses extremely large array indices (e.g., `?arr[4294967296]=value`).
|
|
17
|
+
*
|
|
18
|
+
* While bracket notation creates sparse arrays that handle large indices efficiently,
|
|
19
|
+
* downstream code might inadvertently convert these sparse arrays to dense arrays,
|
|
20
|
+
* potentially creating millions of undefined elements and causing memory issues.
|
|
21
|
+
*
|
|
22
|
+
* @note Only applies to deserialization.
|
|
23
|
+
* @default 9_999 (array with 10,000 elements)
|
|
24
|
+
*/
|
|
25
|
+
maxBracketNotationArrayIndex?: number;
|
|
26
|
+
}
|
|
27
|
+
declare class StandardBracketNotationSerializer {
|
|
28
|
+
private readonly maxArrayIndex;
|
|
29
|
+
constructor(options?: StandardBracketNotationSerializerOptions);
|
|
30
|
+
serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
|
|
31
|
+
deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
|
|
32
|
+
stringifyPath(segments: readonly Segment[]): string;
|
|
33
|
+
parsePath(path: string): string[];
|
|
34
|
+
}
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
36
|
+
type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
|
|
37
|
+
declare class StandardOpenAPIJsonSerializer {
|
|
38
|
+
serialize(data: unknown, hasBlobRef?: {
|
|
39
|
+
value: boolean;
|
|
40
|
+
}): StandardOpenAPIJsonSerialized;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface StandardOpenAPISerializeOptions {
|
|
44
|
+
outputFormat?: 'plain' | 'URLSearchParams';
|
|
45
|
+
}
|
|
46
|
+
declare class StandardOpenAPISerializer {
|
|
47
|
+
#private;
|
|
48
|
+
private readonly jsonSerializer;
|
|
49
|
+
private readonly bracketNotation;
|
|
50
|
+
constructor(jsonSerializer: StandardOpenAPIJsonSerializer, bracketNotation: StandardBracketNotationSerializer);
|
|
51
|
+
serialize(data: unknown, options?: StandardOpenAPISerializeOptions): unknown;
|
|
52
|
+
deserialize(data: unknown): unknown;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class StandardOpenAPICodec implements StandardCodec$1 {
|
|
56
|
+
#private;
|
|
57
|
+
private readonly serializer;
|
|
58
|
+
constructor(serializer: StandardOpenAPISerializer);
|
|
59
|
+
decode(request: StandardLazyRequest, params: StandardParams$1 | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
60
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
61
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher$1 {
|
|
65
|
+
private readonly tree;
|
|
66
|
+
private pendingRouters;
|
|
67
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
68
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult$1>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type StandardParams = Record<string, string>;
|
|
72
|
+
type StandardMatchResult = {
|
|
73
|
+
path: readonly string[];
|
|
74
|
+
procedure: AnyProcedure$1;
|
|
75
|
+
params?: StandardParams;
|
|
76
|
+
} | undefined;
|
|
77
|
+
interface StandardMatcher {
|
|
78
|
+
init(router: AnyRouter$1): void;
|
|
79
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
80
|
+
}
|
|
81
|
+
interface StandardCodec {
|
|
82
|
+
encode(output: unknown, procedure: AnyProcedure$1): StandardResponse;
|
|
83
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
84
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure$1): Promise<unknown>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { StandardOpenAPICodec, StandardOpenAPIMatcher };
|
|
88
|
+
export type { StandardCodec, StandardMatchResult, StandardMatcher, StandardParams };
|
|
@@ -1,16 +1,88 @@
|
|
|
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 { Segment, 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
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
type StandardBracketNotationSerialized = [string, unknown][];
|
|
11
|
+
interface StandardBracketNotationSerializerOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Maximum allowed array index for bracket notation deserialization.
|
|
14
|
+
*
|
|
15
|
+
* This helps protect against memory exhaustion attacks where malicious input
|
|
16
|
+
* uses extremely large array indices (e.g., `?arr[4294967296]=value`).
|
|
17
|
+
*
|
|
18
|
+
* While bracket notation creates sparse arrays that handle large indices efficiently,
|
|
19
|
+
* downstream code might inadvertently convert these sparse arrays to dense arrays,
|
|
20
|
+
* potentially creating millions of undefined elements and causing memory issues.
|
|
21
|
+
*
|
|
22
|
+
* @note Only applies to deserialization.
|
|
23
|
+
* @default 9_999 (array with 10,000 elements)
|
|
24
|
+
*/
|
|
25
|
+
maxBracketNotationArrayIndex?: number;
|
|
26
|
+
}
|
|
27
|
+
declare class StandardBracketNotationSerializer {
|
|
28
|
+
private readonly maxArrayIndex;
|
|
29
|
+
constructor(options?: StandardBracketNotationSerializerOptions);
|
|
30
|
+
serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
|
|
31
|
+
deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
|
|
32
|
+
stringifyPath(segments: readonly Segment[]): string;
|
|
33
|
+
parsePath(path: string): string[];
|
|
34
|
+
}
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
36
|
+
type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
|
|
37
|
+
declare class StandardOpenAPIJsonSerializer {
|
|
38
|
+
serialize(data: unknown, hasBlobRef?: {
|
|
39
|
+
value: boolean;
|
|
40
|
+
}): StandardOpenAPIJsonSerialized;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface StandardOpenAPISerializeOptions {
|
|
44
|
+
outputFormat?: 'plain' | 'URLSearchParams';
|
|
45
|
+
}
|
|
46
|
+
declare class StandardOpenAPISerializer {
|
|
47
|
+
#private;
|
|
48
|
+
private readonly jsonSerializer;
|
|
49
|
+
private readonly bracketNotation;
|
|
50
|
+
constructor(jsonSerializer: StandardOpenAPIJsonSerializer, bracketNotation: StandardBracketNotationSerializer);
|
|
51
|
+
serialize(data: unknown, options?: StandardOpenAPISerializeOptions): unknown;
|
|
52
|
+
deserialize(data: unknown): unknown;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class StandardOpenAPICodec implements StandardCodec$1 {
|
|
56
|
+
#private;
|
|
57
|
+
private readonly serializer;
|
|
58
|
+
constructor(serializer: StandardOpenAPISerializer);
|
|
59
|
+
decode(request: StandardLazyRequest, params: StandardParams$1 | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
60
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
61
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class StandardOpenAPIMatcher implements StandardMatcher$1 {
|
|
65
|
+
private readonly tree;
|
|
66
|
+
private pendingRouters;
|
|
67
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
68
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult$1>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type StandardParams = Record<string, string>;
|
|
72
|
+
type StandardMatchResult = {
|
|
73
|
+
path: readonly string[];
|
|
74
|
+
procedure: AnyProcedure$1;
|
|
75
|
+
params?: StandardParams;
|
|
76
|
+
} | undefined;
|
|
77
|
+
interface StandardMatcher {
|
|
78
|
+
init(router: AnyRouter$1): void;
|
|
79
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
80
|
+
}
|
|
81
|
+
interface StandardCodec {
|
|
82
|
+
encode(output: unknown, procedure: AnyProcedure$1): StandardResponse;
|
|
83
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
84
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure$1): Promise<unknown>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { StandardOpenAPICodec, StandardOpenAPIMatcher };
|
|
88
|
+
export type { StandardCodec, StandardMatchResult, StandardMatcher, StandardParams };
|
|
@@ -1,101 +1,11 @@
|
|
|
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._YqJjI50.mjs';
|
|
2
|
+
import '@temporary-name/shared';
|
|
3
|
+
import '@temporary-name/standard-server';
|
|
4
|
+
import '../../shared/server.BKh8I1Ny.mjs';
|
|
6
5
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.D6K9uoPI.mjs';
|
|
8
6
|
import 'node:async_hooks';
|
|
9
7
|
import 'zod';
|
|
10
8
|
import 'zod/v4/core';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 };
|
|
9
|
+
import '../../shared/server.DhdDYN-Z.mjs';
|
|
10
|
+
import '@temporary-name/server';
|
|
11
|
+
import 'rou3';
|