@temporary-name/server 1.9.3-alpha.d751d322a9d105467b863db2bab6037dd277fd56 → 1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9
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 +3 -3
- package/dist/adapters/aws-lambda/index.d.ts +3 -3
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/fetch/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +3 -3
- package/dist/adapters/node/index.d.mts +3 -3
- package/dist/adapters/node/index.d.ts +3 -3
- package/dist/adapters/node/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +14 -30
- package/dist/adapters/standard/index.d.ts +14 -30
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/index.d.mts +8 -27
- package/dist/index.d.ts +8 -27
- package/dist/index.mjs +2 -12
- package/dist/openapi/index.mjs +27 -61
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/shared/{server.ChraIVaQ.d.mts → server.B93y_8tj.d.mts} +2 -2
- package/dist/shared/{server.CZNLCQBm.d.mts → server.C3RuMHWl.d.mts} +28 -28
- package/dist/shared/{server.CZNLCQBm.d.ts → server.C3RuMHWl.d.ts} +28 -28
- package/dist/shared/{server.B15EEOr0.d.ts → server.CT1xhSmE.d.mts} +1 -2
- package/dist/shared/{server.B9VxPdeK.mjs → server.CqTex_jI.mjs} +57 -85
- package/dist/shared/{server.8gkXYsTZ.d.ts → server.D_fags8X.d.ts} +2 -2
- package/dist/shared/{server.BEHw7Eyx.mjs → server.Kxw442A9.mjs} +1 -1
- package/dist/shared/{server.YXplw8TW.d.mts → server.cjcgLdr1.d.ts} +1 -2
- package/package.json +10 -10
- package/dist/shared/{server.DcfsPloY.mjs → server.BYYf0Wn6.mjs} +19 -19
|
@@ -1,8 +1,8 @@
|
|
|
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, R as Router } from '../../shared/server.
|
|
4
|
-
import { b as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.C3RuMHWl.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.CT1xhSmE.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.B93y_8tj.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
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, R as Router } from '../../shared/server.
|
|
4
|
-
import { b as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.C3RuMHWl.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.cjcgLdr1.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.D_fags8X.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-aws-lambda';
|
|
3
|
-
import { S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CqTex_jI.mjs';
|
|
4
4
|
import '@temporary-name/contract';
|
|
5
5
|
import '@temporary-name/standard-server';
|
|
6
6
|
import '@temporary-name/server';
|
|
7
7
|
import 'rou3';
|
|
8
|
-
import '../../shared/server.
|
|
8
|
+
import '../../shared/server.BYYf0Wn6.mjs';
|
|
9
9
|
import '@temporary-name/zod';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.Kxw442A9.mjs';
|
|
11
11
|
|
|
12
12
|
class AwsLambdaHandler {
|
|
13
13
|
sendStandardResponseOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.C3RuMHWl.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 StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.CT1xhSmE.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.B93y_8tj.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.C3RuMHWl.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 StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.cjcgLdr1.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.D_fags8X.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -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 { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
3
|
+
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CqTex_jI.mjs';
|
|
4
4
|
import '@temporary-name/contract';
|
|
5
5
|
import '@temporary-name/standard-server';
|
|
6
6
|
import '@temporary-name/server';
|
|
7
7
|
import 'rou3';
|
|
8
8
|
import '@temporary-name/zod';
|
|
9
|
-
import '../../shared/server.
|
|
10
|
-
import '../../shared/server.
|
|
9
|
+
import '../../shared/server.BYYf0Wn6.mjs';
|
|
10
|
+
import '../../shared/server.Kxw442A9.mjs';
|
|
11
11
|
|
|
12
12
|
class BodyLimitPlugin {
|
|
13
13
|
maxBodySize;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.C3RuMHWl.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 StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.CT1xhSmE.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.B93y_8tj.mjs';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
8
|
import '@temporary-name/standard-server';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.C3RuMHWl.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 StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.
|
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as StandardHandlerOptions, c as StandardHandleOptions } from '../../shared/server.cjcgLdr1.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.D_fags8X.js';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
8
|
import '@temporary-name/standard-server';
|
|
@@ -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 { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.
|
|
4
|
+
import { C as CompositeStandardHandlerPlugin, S as StandardHandler, r as resolveFriendlyStandardHandleOptions } from '../../shared/server.CqTex_jI.mjs';
|
|
5
5
|
import '@temporary-name/contract';
|
|
6
6
|
import '@temporary-name/standard-server';
|
|
7
7
|
import '@temporary-name/server';
|
|
8
8
|
import 'rou3';
|
|
9
9
|
import '@temporary-name/zod';
|
|
10
|
-
import '../../shared/server.
|
|
11
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.BYYf0Wn6.mjs';
|
|
11
|
+
import '../../shared/server.Kxw442A9.mjs';
|
|
12
12
|
|
|
13
13
|
class BodyLimitPlugin {
|
|
14
14
|
maxBodySize;
|
|
@@ -1,42 +1,26 @@
|
|
|
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.
|
|
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.CT1xhSmE.mjs';
|
|
2
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
3
|
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
5
4
|
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
6
|
-
|
|
7
|
-
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.ChraIVaQ.mjs';
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.B93y_8tj.mjs';
|
|
8
6
|
import '@temporary-name/contract';
|
|
7
|
+
import '../../shared/server.C3RuMHWl.mjs';
|
|
9
8
|
|
|
10
|
-
declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
decode(request: StandardLazyRequest, params: StandardParams$1 | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
14
|
-
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare class StandardOpenAPIMatcher implements StandardMatcher$1 {
|
|
19
|
-
private readonly tree;
|
|
20
|
-
private pendingRouters;
|
|
21
|
-
init(router: AnyRouter, path?: readonly string[]): void;
|
|
22
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult$1>;
|
|
23
|
-
}
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<unknown>;
|
|
10
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
24
12
|
|
|
25
|
-
type StandardParams = Record<string, string>;
|
|
26
13
|
type StandardMatchResult = {
|
|
27
14
|
path: readonly string[];
|
|
28
|
-
procedure: AnyProcedure
|
|
29
|
-
params?:
|
|
15
|
+
procedure: AnyProcedure;
|
|
16
|
+
params?: Record<string, string>;
|
|
30
17
|
} | undefined;
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
declare class StandardOpenAPIMatcher {
|
|
19
|
+
private readonly tree;
|
|
20
|
+
private pendingRouters;
|
|
21
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
33
22
|
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
34
23
|
}
|
|
35
|
-
interface StandardCodec {
|
|
36
|
-
encode(output: unknown, procedure: AnyProcedure$1): StandardResponse;
|
|
37
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
38
|
-
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure$1): Promise<unknown>;
|
|
39
|
-
}
|
|
40
24
|
|
|
41
|
-
export {
|
|
42
|
-
export type {
|
|
25
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
26
|
+
export type { StandardMatchResult };
|
|
@@ -1,42 +1,26 @@
|
|
|
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.
|
|
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.cjcgLdr1.js';
|
|
2
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
3
|
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
5
4
|
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
6
|
-
|
|
7
|
-
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.8gkXYsTZ.js';
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.D_fags8X.js';
|
|
8
6
|
import '@temporary-name/contract';
|
|
7
|
+
import '../../shared/server.C3RuMHWl.js';
|
|
9
8
|
|
|
10
|
-
declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
decode(request: StandardLazyRequest, params: StandardParams$1 | undefined, procedure: AnyProcedure): Promise<unknown>;
|
|
14
|
-
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
15
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare class StandardOpenAPIMatcher implements StandardMatcher$1 {
|
|
19
|
-
private readonly tree;
|
|
20
|
-
private pendingRouters;
|
|
21
|
-
init(router: AnyRouter, path?: readonly string[]): void;
|
|
22
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult$1>;
|
|
23
|
-
}
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<unknown>;
|
|
10
|
+
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
|
+
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
24
12
|
|
|
25
|
-
type StandardParams = Record<string, string>;
|
|
26
13
|
type StandardMatchResult = {
|
|
27
14
|
path: readonly string[];
|
|
28
|
-
procedure: AnyProcedure
|
|
29
|
-
params?:
|
|
15
|
+
procedure: AnyProcedure;
|
|
16
|
+
params?: Record<string, string>;
|
|
30
17
|
} | undefined;
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
declare class StandardOpenAPIMatcher {
|
|
19
|
+
private readonly tree;
|
|
20
|
+
private pendingRouters;
|
|
21
|
+
init(router: AnyRouter, path?: readonly string[]): void;
|
|
33
22
|
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
|
34
23
|
}
|
|
35
|
-
interface StandardCodec {
|
|
36
|
-
encode(output: unknown, procedure: AnyProcedure$1): StandardResponse;
|
|
37
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
38
|
-
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure$1): Promise<unknown>;
|
|
39
|
-
}
|
|
40
24
|
|
|
41
|
-
export {
|
|
42
|
-
export type {
|
|
25
|
+
export { StandardOpenAPIMatcher, decode, encode, encodeError };
|
|
26
|
+
export type { StandardMatchResult };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { C as CompositeStandardHandlerPlugin, S as StandardHandler,
|
|
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.CqTex_jI.mjs';
|
|
2
2
|
import '@temporary-name/shared';
|
|
3
3
|
import '@temporary-name/standard-server';
|
|
4
|
-
import '../../shared/server.
|
|
4
|
+
import '../../shared/server.BYYf0Wn6.mjs';
|
|
5
5
|
import '@temporary-name/contract';
|
|
6
6
|
import '@temporary-name/zod';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.Kxw442A9.mjs';
|
|
8
8
|
import '@temporary-name/server';
|
|
9
9
|
import 'rou3';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AnySchema, ErrorMap, Meta, EnhanceRouteOptions, MergedErrorMap, AnyContractRouter, AnyContractProcedure, ContractProcedure, Route, InferSchemaOutput,
|
|
2
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput,
|
|
1
|
+
import { AnySchema, ErrorMap, Meta, EnhanceRouteOptions, MergedErrorMap, AnyContractRouter, AnyContractProcedure, ContractProcedure, Route, InferSchemaOutput, InferSchemaInput, ContractRouter, ContractProcedureDef, Schema, InferContractRouterErrorMap, InferContractRouterMeta, ErrorFromErrorMap } from '@temporary-name/contract';
|
|
2
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
3
3
|
import { ClientContext, MaybeOptionalOptions, IntersectPick, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
4
4
|
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
5
5
|
import { SchemaClass } from '@temporary-name/zod';
|
|
6
|
-
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, A as AnyMiddleware, L as Lazyable, c as AnyRouter, d as Lazy, e as AnyProcedure, M as MergedInitialContext, f as Middleware, O as ORPCErrorConstructorMap, g as MergedCurrentContext, h as ProcedureHandler, R as Router, i as MapInputMiddleware, I as InferRouterInitialContext } from './shared/server.
|
|
7
|
-
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.
|
|
6
|
+
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, A as AnyMiddleware, L as Lazyable, c as AnyRouter, d as Lazy, e as AnyProcedure, M as MergedInitialContext, f as Middleware, O as ORPCErrorConstructorMap, g as MergedCurrentContext, h as ProcedureHandler, R as Router, i as MapInputMiddleware, I as InferRouterInitialContext } from './shared/server.C3RuMHWl.mjs';
|
|
7
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.C3RuMHWl.mjs';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
@@ -111,7 +111,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
111
111
|
*
|
|
112
112
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
113
113
|
*/
|
|
114
|
-
handler
|
|
114
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
115
115
|
}
|
|
116
116
|
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName> {
|
|
117
117
|
/**
|
|
@@ -136,17 +136,8 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
136
136
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
137
137
|
*/
|
|
138
138
|
router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
|
|
139
|
-
/**
|
|
140
|
-
* Create a lazy router
|
|
141
|
-
* And applies all of the previously defined options to the specified router.
|
|
142
|
-
*
|
|
143
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
144
|
-
*/
|
|
145
|
-
lazyRoute<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
|
|
146
|
-
default: U;
|
|
147
|
-
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, TErrorMap>;
|
|
148
139
|
}
|
|
149
|
-
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router'
|
|
140
|
+
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router'> {
|
|
150
141
|
/**
|
|
151
142
|
* This property holds the defined options.
|
|
152
143
|
*/
|
|
@@ -186,7 +177,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
|
186
177
|
*
|
|
187
178
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
188
179
|
*/
|
|
189
|
-
$context<U extends Context>(): Builder<U
|
|
180
|
+
$context<U extends Context>(): Builder<U, U, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
190
181
|
/**
|
|
191
182
|
* Creates a middleware.
|
|
192
183
|
*
|
|
@@ -278,16 +269,6 @@ interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitial
|
|
|
278
269
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
279
270
|
*/
|
|
280
271
|
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
281
|
-
/**
|
|
282
|
-
* Create a lazy router
|
|
283
|
-
* And applies all of the previously defined options to the specified router.
|
|
284
|
-
* And enforces the router match the contract.
|
|
285
|
-
*
|
|
286
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
287
|
-
*/
|
|
288
|
-
lazyRoute<U extends Router<T, TInitialContext>>(loader: () => Promise<{
|
|
289
|
-
default: U;
|
|
290
|
-
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
291
272
|
}
|
|
292
273
|
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
|
293
274
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
@@ -337,7 +318,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
|
337
318
|
*
|
|
338
319
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
339
320
|
*/
|
|
340
|
-
$context<U extends Context>(): Implementer<TContract, U
|
|
321
|
+
$context<U extends Context>(): Implementer<TContract, U, U>;
|
|
341
322
|
} & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
|
|
342
323
|
declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T): Implementer<T, TContext, TContext>;
|
|
343
324
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AnySchema, ErrorMap, Meta, EnhanceRouteOptions, MergedErrorMap, AnyContractRouter, AnyContractProcedure, ContractProcedure, Route, InferSchemaOutput,
|
|
2
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput,
|
|
1
|
+
import { AnySchema, ErrorMap, Meta, EnhanceRouteOptions, MergedErrorMap, AnyContractRouter, AnyContractProcedure, ContractProcedure, Route, InferSchemaOutput, InferSchemaInput, ContractRouter, ContractProcedureDef, Schema, InferContractRouterErrorMap, InferContractRouterMeta, ErrorFromErrorMap } from '@temporary-name/contract';
|
|
2
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
3
3
|
import { ClientContext, MaybeOptionalOptions, IntersectPick, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
4
4
|
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
5
5
|
import { SchemaClass } from '@temporary-name/zod';
|
|
6
|
-
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, A as AnyMiddleware, L as Lazyable, c as AnyRouter, d as Lazy, e as AnyProcedure, M as MergedInitialContext, f as Middleware, O as ORPCErrorConstructorMap, g as MergedCurrentContext, h as ProcedureHandler, R as Router, i as MapInputMiddleware, I as InferRouterInitialContext } from './shared/server.
|
|
7
|
-
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.
|
|
6
|
+
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, A as AnyMiddleware, L as Lazyable, c as AnyRouter, d as Lazy, e as AnyProcedure, M as MergedInitialContext, f as Middleware, O as ORPCErrorConstructorMap, g as MergedCurrentContext, h as ProcedureHandler, R as Router, i as MapInputMiddleware, I as InferRouterInitialContext } from './shared/server.C3RuMHWl.js';
|
|
7
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.C3RuMHWl.js';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
@@ -111,7 +111,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
111
111
|
*
|
|
112
112
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
113
113
|
*/
|
|
114
|
-
handler
|
|
114
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
115
115
|
}
|
|
116
116
|
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName> {
|
|
117
117
|
/**
|
|
@@ -136,17 +136,8 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
136
136
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
137
137
|
*/
|
|
138
138
|
router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
|
|
139
|
-
/**
|
|
140
|
-
* Create a lazy router
|
|
141
|
-
* And applies all of the previously defined options to the specified router.
|
|
142
|
-
*
|
|
143
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
144
|
-
*/
|
|
145
|
-
lazyRoute<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
|
|
146
|
-
default: U;
|
|
147
|
-
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, TErrorMap>;
|
|
148
139
|
}
|
|
149
|
-
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router'
|
|
140
|
+
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router'> {
|
|
150
141
|
/**
|
|
151
142
|
* This property holds the defined options.
|
|
152
143
|
*/
|
|
@@ -186,7 +177,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
|
186
177
|
*
|
|
187
178
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
188
179
|
*/
|
|
189
|
-
$context<U extends Context>(): Builder<U
|
|
180
|
+
$context<U extends Context>(): Builder<U, U, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
190
181
|
/**
|
|
191
182
|
* Creates a middleware.
|
|
192
183
|
*
|
|
@@ -278,16 +269,6 @@ interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitial
|
|
|
278
269
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
279
270
|
*/
|
|
280
271
|
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
281
|
-
/**
|
|
282
|
-
* Create a lazy router
|
|
283
|
-
* And applies all of the previously defined options to the specified router.
|
|
284
|
-
* And enforces the router match the contract.
|
|
285
|
-
*
|
|
286
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
287
|
-
*/
|
|
288
|
-
lazyRoute<U extends Router<T, TInitialContext>>(loader: () => Promise<{
|
|
289
|
-
default: U;
|
|
290
|
-
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
291
272
|
}
|
|
292
273
|
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
|
293
274
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
@@ -337,7 +318,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
|
337
318
|
*
|
|
338
319
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
339
320
|
*/
|
|
340
|
-
$context<U extends Context>(): Implementer<TContract, U
|
|
321
|
+
$context<U extends Context>(): Implementer<TContract, U, U>;
|
|
341
322
|
} & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
|
|
342
323
|
declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T): Implementer<T, TContext, TContext>;
|
|
343
324
|
|
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ export { AsyncIteratorClass, EventPublisher, ORPCError, asyncIteratorToStream as
|
|
|
3
3
|
import { isContractProcedure, mergePrefix, mergeErrorMap, enhanceRoute, mergeTags, ContractProcedure, mergeMeta, mergeRoute, prefixRoute, getContractRouter } from '@temporary-name/contract';
|
|
4
4
|
export { ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
5
5
|
import { SchemaClass, gatingContext } from '@temporary-name/zod';
|
|
6
|
-
import { c as createProcedureClient, i as isLazy, g as getLazyMeta, l as lazy, u as unlazy } from './shared/server.
|
|
7
|
-
export { L as LAZY_SYMBOL, a as createORPCErrorConstructorMap, m as mergeCurrentContext, b as middlewareOutputFn } from './shared/server.
|
|
6
|
+
import { c as createProcedureClient, i as isLazy, g as getLazyMeta, l as lazy, u as unlazy } from './shared/server.BYYf0Wn6.mjs';
|
|
7
|
+
export { L as LAZY_SYMBOL, a as createORPCErrorConstructorMap, m as mergeCurrentContext, b as middlewareOutputFn } from './shared/server.BYYf0Wn6.mjs';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
10
|
function isStartWithMiddlewares(middlewares, compare) {
|
|
@@ -349,16 +349,6 @@ class BuilderWithMiddlewares extends ProcedureBuilder {
|
|
|
349
349
|
router(router) {
|
|
350
350
|
return enhanceRouter(router, this["~orpc"]);
|
|
351
351
|
}
|
|
352
|
-
/**
|
|
353
|
-
* Create a lazy router
|
|
354
|
-
* And applies all of the previously defined options to the specified router.
|
|
355
|
-
*
|
|
356
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
357
|
-
*/
|
|
358
|
-
lazyRoute(loader) {
|
|
359
|
-
const lazied = lazy(loader);
|
|
360
|
-
return enhanceRouter(lazied, this["~orpc"]);
|
|
361
|
-
}
|
|
362
352
|
}
|
|
363
353
|
|
|
364
354
|
function decorateMiddleware(middleware) {
|
package/dist/openapi/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isProcedure, resolveContractProcedures, ORPCError, createRouterClient } from '@temporary-name/server';
|
|
2
2
|
import { fallbackContractConfig, getEventIteratorSchemaDetails } from '@temporary-name/contract';
|
|
3
3
|
import { isObject, stringifyJSON, findDeepMatches, toArray, clone, value, toHttpPath, isORPCErrorStatus, fallbackORPCErrorStatus, fallbackORPCErrorMessage, resolveMaybeOptionalOptions, createORPCErrorFromJson } from '@temporary-name/shared';
|
|
4
|
-
import { a as standardizeHTTPPath, j as jsonSerialize, g as getDynamicParams, d as deserialize, s as serialize } from '../shared/server.
|
|
4
|
+
import { a as standardizeHTTPPath, j as jsonSerialize, g as getDynamicParams, d as deserialize, s as serialize } from '../shared/server.Kxw442A9.mjs';
|
|
5
5
|
import '@temporary-name/standard-server';
|
|
6
6
|
import { TypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
7
7
|
export { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
@@ -542,77 +542,43 @@ ${errors.join("\n\n")}`
|
|
|
542
542
|
return;
|
|
543
543
|
}
|
|
544
544
|
const dynamicParams = getDynamicParams(def.route.path)?.map((v) => v.name);
|
|
545
|
-
const inputStructure = fallbackContractConfig("defaultInputStructure", def.route.inputStructure);
|
|
546
545
|
let [required, schema] = await this.converter.convert(def.inputSchema, {
|
|
547
546
|
...baseSchemaConvertOptions,
|
|
548
547
|
strategy: "input",
|
|
549
|
-
minStructureDepthForRef: dynamicParams?.length
|
|
548
|
+
minStructureDepthForRef: dynamicParams?.length ? 1 : 0
|
|
550
549
|
});
|
|
551
550
|
if (isAnySchema(schema) && !dynamicParams?.length) {
|
|
552
551
|
return;
|
|
553
552
|
}
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
throw error2;
|
|
561
|
-
}
|
|
562
|
-
const [paramsSchema, rest] = separateObjectSchema(schema, dynamicParams);
|
|
563
|
-
schema = rest;
|
|
564
|
-
required = rest.required ? rest.required.length !== 0 : false;
|
|
565
|
-
if (!checkParamsSchema(paramsSchema, dynamicParams)) {
|
|
566
|
-
throw error2;
|
|
567
|
-
}
|
|
568
|
-
ref.parameters ??= [];
|
|
569
|
-
ref.parameters.push(...toOpenAPIParameters(paramsSchema, "path"));
|
|
553
|
+
if (dynamicParams?.length) {
|
|
554
|
+
const error = new OpenAPIGeneratorError(
|
|
555
|
+
'When input structure is "compact", and path has dynamic params, input schema must be an object with all dynamic params as required.'
|
|
556
|
+
);
|
|
557
|
+
if (!isObjectSchema(schema)) {
|
|
558
|
+
throw error;
|
|
570
559
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
);
|
|
577
|
-
}
|
|
578
|
-
ref.parameters ??= [];
|
|
579
|
-
ref.parameters.push(...toOpenAPIParameters(resolvedSchema, "query"));
|
|
580
|
-
} else {
|
|
581
|
-
ref.requestBody = {
|
|
582
|
-
required,
|
|
583
|
-
content: toOpenAPIContent(schema)
|
|
584
|
-
};
|
|
560
|
+
const [paramsSchema, rest] = separateObjectSchema(schema, dynamicParams);
|
|
561
|
+
schema = rest;
|
|
562
|
+
required = rest.required ? rest.required.length !== 0 : false;
|
|
563
|
+
if (!checkParamsSchema(paramsSchema, dynamicParams)) {
|
|
564
|
+
throw error;
|
|
585
565
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
if (dynamicParams?.length && (resolvedParamSchema === void 0 || !isObjectSchema(resolvedParamSchema) || !checkParamsSchema(resolvedParamSchema, dynamicParams))) {
|
|
596
|
-
throw new OpenAPIGeneratorError(
|
|
597
|
-
'When input structure is "detailed" and path has dynamic params, the "params" schema must be an object with all dynamic params as required.'
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
for (const from of ["params", "query", "headers"]) {
|
|
601
|
-
const fromSchema = schema.properties?.[from];
|
|
602
|
-
if (fromSchema !== void 0) {
|
|
603
|
-
const resolvedSchema = resolveOpenAPIJsonSchemaRef(doc, fromSchema);
|
|
604
|
-
if (!isObjectSchema(resolvedSchema)) {
|
|
605
|
-
throw error;
|
|
606
|
-
}
|
|
607
|
-
const parameterIn = from === "params" ? "path" : from === "headers" ? "header" : "query";
|
|
608
|
-
ref.parameters ??= [];
|
|
609
|
-
ref.parameters.push(...toOpenAPIParameters(resolvedSchema, parameterIn));
|
|
566
|
+
ref.parameters ??= [];
|
|
567
|
+
ref.parameters.push(...toOpenAPIParameters(paramsSchema, "path"));
|
|
568
|
+
}
|
|
569
|
+
if (method === "GET") {
|
|
570
|
+
const resolvedSchema = resolveOpenAPIJsonSchemaRef(doc, schema);
|
|
571
|
+
if (!isObjectSchema(resolvedSchema)) {
|
|
572
|
+
throw new OpenAPIGeneratorError(
|
|
573
|
+
'When method is "GET", input schema must satisfy: object | any | unknown'
|
|
574
|
+
);
|
|
610
575
|
}
|
|
611
|
-
|
|
612
|
-
|
|
576
|
+
ref.parameters ??= [];
|
|
577
|
+
ref.parameters.push(...toOpenAPIParameters(resolvedSchema, "query"));
|
|
578
|
+
} else {
|
|
613
579
|
ref.requestBody = {
|
|
614
|
-
required
|
|
615
|
-
content: toOpenAPIContent(schema
|
|
580
|
+
required,
|
|
581
|
+
content: toOpenAPIContent(schema)
|
|
616
582
|
};
|
|
617
583
|
}
|
|
618
584
|
}
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Value, Promisable, ORPCError } from '@temporary-name/shared';
|
|
2
2
|
import { StandardRequest, StandardHeaders } from '@temporary-name/standard-server';
|
|
3
3
|
import { BatchResponseBodyItem } from '@temporary-name/standard-server/batch';
|
|
4
|
-
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.
|
|
5
|
-
import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.
|
|
4
|
+
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.CT1xhSmE.mjs';
|
|
5
|
+
import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.C3RuMHWl.mjs';
|
|
6
6
|
import { Meta } from '@temporary-name/contract';
|
|
7
7
|
|
|
8
8
|
interface BatchHandlerOptions<T extends Context> {
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Value, Promisable, ORPCError } from '@temporary-name/shared';
|
|
2
2
|
import { StandardRequest, StandardHeaders } from '@temporary-name/standard-server';
|
|
3
3
|
import { BatchResponseBodyItem } from '@temporary-name/standard-server/batch';
|
|
4
|
-
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.
|
|
5
|
-
import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.
|
|
4
|
+
import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.cjcgLdr1.js';
|
|
5
|
+
import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.C3RuMHWl.js';
|
|
6
6
|
import { Meta } from '@temporary-name/contract';
|
|
7
7
|
|
|
8
8
|
interface BatchHandlerOptions<T extends Context> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTTPPath } from '@temporary-name/shared';
|
|
2
|
-
import { C as Context } from './server.
|
|
3
|
-
import { c as StandardHandleOptions } from './server.
|
|
2
|
+
import { C as Context } from './server.C3RuMHWl.mjs';
|
|
3
|
+
import { c as StandardHandleOptions } from './server.CT1xhSmE.mjs';
|
|
4
4
|
|
|
5
5
|
type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
|
6
6
|
context?: T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@temporary-name/contract';
|
|
2
|
-
import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError,
|
|
2
|
+
import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, Promisable, HTTPPath, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
|
|
3
3
|
|
|
4
4
|
type Context = Record<PropertyKey, any>;
|
|
5
5
|
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
|
@@ -13,33 +13,6 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
|
13
13
|
};
|
|
14
14
|
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
|
15
15
|
|
|
16
|
-
declare const LAZY_SYMBOL: unique symbol;
|
|
17
|
-
interface LazyMeta {
|
|
18
|
-
prefix?: HTTPPath;
|
|
19
|
-
}
|
|
20
|
-
interface Lazy<T> {
|
|
21
|
-
[LAZY_SYMBOL]: {
|
|
22
|
-
loader: () => Promise<{
|
|
23
|
-
default: T;
|
|
24
|
-
}>;
|
|
25
|
-
meta: LazyMeta;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
type Lazyable<T> = T | Lazy<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a lazy-loaded item.
|
|
31
|
-
*
|
|
32
|
-
* @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
|
|
33
|
-
*/
|
|
34
|
-
declare function lazy<T>(loader: () => Promise<{
|
|
35
|
-
default: T;
|
|
36
|
-
}>, meta?: LazyMeta): Lazy<T>;
|
|
37
|
-
declare function isLazy(item: unknown): item is Lazy<any>;
|
|
38
|
-
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
|
39
|
-
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
|
40
|
-
default: T extends Lazy<infer U> ? U : T;
|
|
41
|
-
}>;
|
|
42
|
-
|
|
43
16
|
interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
44
17
|
context: TCurrentContext;
|
|
45
18
|
input: TInput;
|
|
@@ -112,6 +85,33 @@ interface MapInputMiddleware<TInput, TMappedInput> {
|
|
|
112
85
|
}
|
|
113
86
|
declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
|
114
87
|
|
|
88
|
+
declare const LAZY_SYMBOL: unique symbol;
|
|
89
|
+
interface LazyMeta {
|
|
90
|
+
prefix?: HTTPPath;
|
|
91
|
+
}
|
|
92
|
+
interface Lazy<T> {
|
|
93
|
+
[LAZY_SYMBOL]: {
|
|
94
|
+
loader: () => Promise<{
|
|
95
|
+
default: T;
|
|
96
|
+
}>;
|
|
97
|
+
meta: LazyMeta;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
type Lazyable<T> = T | Lazy<T>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a lazy-loaded item.
|
|
103
|
+
*
|
|
104
|
+
* @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
|
|
105
|
+
*/
|
|
106
|
+
declare function lazy<T>(loader: () => Promise<{
|
|
107
|
+
default: T;
|
|
108
|
+
}>, meta?: LazyMeta): Lazy<T>;
|
|
109
|
+
declare function isLazy(item: unknown): item is Lazy<any>;
|
|
110
|
+
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
|
111
|
+
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
|
112
|
+
default: T extends Lazy<infer U> ? U : T;
|
|
113
|
+
}>;
|
|
114
|
+
|
|
115
115
|
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
116
116
|
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
117
117
|
context: TInitialContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@temporary-name/contract';
|
|
2
|
-
import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError,
|
|
2
|
+
import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, Promisable, HTTPPath, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
|
|
3
3
|
|
|
4
4
|
type Context = Record<PropertyKey, any>;
|
|
5
5
|
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
|
@@ -13,33 +13,6 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
|
13
13
|
};
|
|
14
14
|
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
|
15
15
|
|
|
16
|
-
declare const LAZY_SYMBOL: unique symbol;
|
|
17
|
-
interface LazyMeta {
|
|
18
|
-
prefix?: HTTPPath;
|
|
19
|
-
}
|
|
20
|
-
interface Lazy<T> {
|
|
21
|
-
[LAZY_SYMBOL]: {
|
|
22
|
-
loader: () => Promise<{
|
|
23
|
-
default: T;
|
|
24
|
-
}>;
|
|
25
|
-
meta: LazyMeta;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
type Lazyable<T> = T | Lazy<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a lazy-loaded item.
|
|
31
|
-
*
|
|
32
|
-
* @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
|
|
33
|
-
*/
|
|
34
|
-
declare function lazy<T>(loader: () => Promise<{
|
|
35
|
-
default: T;
|
|
36
|
-
}>, meta?: LazyMeta): Lazy<T>;
|
|
37
|
-
declare function isLazy(item: unknown): item is Lazy<any>;
|
|
38
|
-
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
|
39
|
-
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
|
40
|
-
default: T extends Lazy<infer U> ? U : T;
|
|
41
|
-
}>;
|
|
42
|
-
|
|
43
16
|
interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
44
17
|
context: TCurrentContext;
|
|
45
18
|
input: TInput;
|
|
@@ -112,6 +85,33 @@ interface MapInputMiddleware<TInput, TMappedInput> {
|
|
|
112
85
|
}
|
|
113
86
|
declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
|
114
87
|
|
|
88
|
+
declare const LAZY_SYMBOL: unique symbol;
|
|
89
|
+
interface LazyMeta {
|
|
90
|
+
prefix?: HTTPPath;
|
|
91
|
+
}
|
|
92
|
+
interface Lazy<T> {
|
|
93
|
+
[LAZY_SYMBOL]: {
|
|
94
|
+
loader: () => Promise<{
|
|
95
|
+
default: T;
|
|
96
|
+
}>;
|
|
97
|
+
meta: LazyMeta;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
type Lazyable<T> = T | Lazy<T>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a lazy-loaded item.
|
|
103
|
+
*
|
|
104
|
+
* @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
|
|
105
|
+
*/
|
|
106
|
+
declare function lazy<T>(loader: () => Promise<{
|
|
107
|
+
default: T;
|
|
108
|
+
}>, meta?: LazyMeta): Lazy<T>;
|
|
109
|
+
declare function isLazy(item: unknown): item is Lazy<any>;
|
|
110
|
+
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
|
111
|
+
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
|
112
|
+
default: T extends Lazy<infer U> ? U : T;
|
|
113
|
+
}>;
|
|
114
|
+
|
|
115
115
|
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
116
116
|
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
117
117
|
context: TInitialContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@temporary-name/contract';
|
|
2
2
|
import { HTTPPath, Interceptor } from '@temporary-name/shared';
|
|
3
3
|
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
4
|
-
import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.
|
|
4
|
+
import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.C3RuMHWl.mjs';
|
|
5
5
|
|
|
6
6
|
interface StandardHandlerPlugin<T extends Context> {
|
|
7
7
|
order?: number;
|
|
@@ -48,7 +48,6 @@ declare class StandardHandler<T extends Context> {
|
|
|
48
48
|
private readonly clientInterceptors;
|
|
49
49
|
private readonly rootInterceptors;
|
|
50
50
|
private readonly matcher;
|
|
51
|
-
private readonly codec;
|
|
52
51
|
constructor(router: Router<any, T>, options: NoInfer<StandardHandlerOptions<T>>);
|
|
53
52
|
handle(request: StandardLazyRequest, options: StandardHandleOptions<T>): Promise<StandardHandleResult>;
|
|
54
53
|
}
|
|
@@ -1,67 +1,45 @@
|
|
|
1
1
|
import { isObject, stringifyJSON, isORPCErrorStatus, tryDecodeURIComponent, value, toHttpPath, toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, ORPCError, toORPCError } from '@temporary-name/shared';
|
|
2
2
|
import { flattenHeader } from '@temporary-name/standard-server';
|
|
3
|
-
import { c as createProcedureClient } from './server.
|
|
3
|
+
import { c as createProcedureClient } from './server.BYYf0Wn6.mjs';
|
|
4
4
|
import { fallbackContractConfig } from '@temporary-name/contract';
|
|
5
|
-
import { d as deserialize, s as serialize, a as standardizeHTTPPath } from './server.
|
|
5
|
+
import { d as deserialize, s as serialize, b as bracketNotationDeserialize, a as standardizeHTTPPath } from './server.Kxw442A9.mjs';
|
|
6
6
|
import { traverseContractProcedures, isProcedure, getLazyMeta, unlazy, getRouter, createContractedProcedure } from '@temporary-name/server';
|
|
7
7
|
import { createRouter, addRoute, findRoute } from 'rou3';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
async function decode(request, pathParams) {
|
|
10
|
+
const deserializeSearchParams = () => {
|
|
11
|
+
return bracketNotationDeserialize(Array.from(request.url.searchParams.entries()));
|
|
12
|
+
};
|
|
13
|
+
const data = request.method === "GET" ? deserializeSearchParams() : deserialize(await request.body());
|
|
14
|
+
if (data === void 0) {
|
|
15
|
+
return pathParams;
|
|
11
16
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
17
|
-
if (inputStructure === "compact") {
|
|
18
|
-
const data = request.method === "GET" ? deserialize(request.url.searchParams) : deserialize(await request.body());
|
|
19
|
-
if (data === void 0) {
|
|
20
|
-
return params;
|
|
21
|
-
}
|
|
22
|
-
if (isObject(data)) {
|
|
23
|
-
return {
|
|
24
|
-
...params,
|
|
25
|
-
...data
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
const deserializeSearchParams = () => {
|
|
31
|
-
return deserialize(request.url.searchParams);
|
|
17
|
+
if (isObject(data)) {
|
|
18
|
+
return {
|
|
19
|
+
...pathParams,
|
|
20
|
+
...data
|
|
32
21
|
};
|
|
22
|
+
}
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
function encode(output, procedure) {
|
|
26
|
+
const successStatus = fallbackContractConfig(
|
|
27
|
+
"defaultSuccessStatus",
|
|
28
|
+
procedure["~orpc"].route.successStatus
|
|
29
|
+
);
|
|
30
|
+
const outputStructure = fallbackContractConfig(
|
|
31
|
+
"defaultOutputStructure",
|
|
32
|
+
procedure["~orpc"].route.outputStructure
|
|
33
|
+
);
|
|
34
|
+
if (outputStructure === "compact") {
|
|
33
35
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Object.defineProperty(this, "query", { value, writable: true });
|
|
38
|
-
return value;
|
|
39
|
-
},
|
|
40
|
-
set query(value) {
|
|
41
|
-
Object.defineProperty(this, "query", { value, writable: true });
|
|
42
|
-
},
|
|
43
|
-
headers: request.headers,
|
|
44
|
-
body: deserialize(await request.body())
|
|
36
|
+
status: successStatus,
|
|
37
|
+
headers: {},
|
|
38
|
+
body: serialize(output)
|
|
45
39
|
};
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"defaultSuccessStatus",
|
|
50
|
-
procedure["~orpc"].route.successStatus
|
|
51
|
-
);
|
|
52
|
-
const outputStructure = fallbackContractConfig(
|
|
53
|
-
"defaultOutputStructure",
|
|
54
|
-
procedure["~orpc"].route.outputStructure
|
|
55
|
-
);
|
|
56
|
-
if (outputStructure === "compact") {
|
|
57
|
-
return {
|
|
58
|
-
status: successStatus,
|
|
59
|
-
headers: {},
|
|
60
|
-
body: serialize(output)
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
if (!this.#isDetailedOutput(output)) {
|
|
64
|
-
throw new Error(`
|
|
41
|
+
if (!isDetailedOutput(output)) {
|
|
42
|
+
throw new Error(`
|
|
65
43
|
Invalid "detailed" output structure:
|
|
66
44
|
\u2022 Expected an object with optional properties:
|
|
67
45
|
- status (number 200-399)
|
|
@@ -72,32 +50,31 @@ class StandardOpenAPICodec {
|
|
|
72
50
|
Actual value:
|
|
73
51
|
${stringifyJSON(output)}
|
|
74
52
|
`);
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
status: output.status ?? successStatus,
|
|
78
|
-
headers: output.headers ?? {},
|
|
79
|
-
body: serialize(output.body)
|
|
80
|
-
};
|
|
81
53
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
return {
|
|
55
|
+
status: output.status ?? successStatus,
|
|
56
|
+
headers: output.headers ?? {},
|
|
57
|
+
body: serialize(output.body)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function encodeError(error) {
|
|
61
|
+
return {
|
|
62
|
+
status: error.status,
|
|
63
|
+
headers: {},
|
|
64
|
+
body: serialize(error.toJSON(), { outputFormat: "plain" })
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function isDetailedOutput(output) {
|
|
68
|
+
if (!isObject(output)) {
|
|
69
|
+
return false;
|
|
88
70
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
if (output.status !== void 0 && (typeof output.status !== "number" || !Number.isInteger(output.status) || isORPCErrorStatus(output.status))) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
return true;
|
|
71
|
+
if (output.headers && !isObject(output.headers)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (output.status !== void 0 && (typeof output.status !== "number" || !Number.isInteger(output.status) || isORPCErrorStatus(output.status))) {
|
|
75
|
+
return false;
|
|
100
76
|
}
|
|
77
|
+
return true;
|
|
101
78
|
}
|
|
102
79
|
|
|
103
80
|
function resolveFriendlyStandardHandleOptions(options) {
|
|
@@ -204,10 +181,8 @@ class StandardHandler {
|
|
|
204
181
|
clientInterceptors;
|
|
205
182
|
rootInterceptors;
|
|
206
183
|
matcher;
|
|
207
|
-
codec;
|
|
208
184
|
constructor(router, options) {
|
|
209
185
|
this.matcher = new StandardOpenAPIMatcher();
|
|
210
|
-
this.codec = new StandardOpenAPICodec();
|
|
211
186
|
const plugins = new CompositeStandardHandlerPlugin(options.plugins);
|
|
212
187
|
plugins.init(options, router);
|
|
213
188
|
this.interceptors = toArray(options.interceptors);
|
|
@@ -242,10 +217,7 @@ class StandardHandler {
|
|
|
242
217
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
243
218
|
span?.setAttribute("rpc.method", match.path.join("."));
|
|
244
219
|
step = "decode_input";
|
|
245
|
-
let input = await runWithSpan(
|
|
246
|
-
{ name: "decode_input" },
|
|
247
|
-
() => this.codec.decode(request2, match.params, match.procedure)
|
|
248
|
-
);
|
|
220
|
+
let input = await runWithSpan({ name: "decode_input" }, () => decode(request2, match.params));
|
|
249
221
|
step = void 0;
|
|
250
222
|
if (isAsyncIteratorObject(input)) {
|
|
251
223
|
input = asyncIteratorWithSpan(
|
|
@@ -264,7 +236,7 @@ class StandardHandler {
|
|
|
264
236
|
lastEventId: flattenHeader(request2.headers["last-event-id"])
|
|
265
237
|
});
|
|
266
238
|
step = void 0;
|
|
267
|
-
const response =
|
|
239
|
+
const response = encode(output, match.procedure);
|
|
268
240
|
return {
|
|
269
241
|
matched: true,
|
|
270
242
|
response
|
|
@@ -279,7 +251,7 @@ class StandardHandler {
|
|
|
279
251
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
280
252
|
cause: e
|
|
281
253
|
}) : toORPCError(e);
|
|
282
|
-
const response =
|
|
254
|
+
const response = encodeError(error);
|
|
283
255
|
return {
|
|
284
256
|
matched: true,
|
|
285
257
|
response
|
|
@@ -290,4 +262,4 @@ class StandardHandler {
|
|
|
290
262
|
}
|
|
291
263
|
}
|
|
292
264
|
|
|
293
|
-
export { CompositeStandardHandlerPlugin as C, StandardHandler as S,
|
|
265
|
+
export { CompositeStandardHandlerPlugin as C, StandardHandler as S, encodeError as a, StandardOpenAPIMatcher as b, decodeParams as c, decode as d, encode as e, resolveFriendlyStandardHandleOptions as r, toRou3Pattern as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTTPPath } from '@temporary-name/shared';
|
|
2
|
-
import { C as Context } from './server.
|
|
3
|
-
import { c as StandardHandleOptions } from './server.
|
|
2
|
+
import { C as Context } from './server.C3RuMHWl.js';
|
|
3
|
+
import { c as StandardHandleOptions } from './server.cjcgLdr1.js';
|
|
4
4
|
|
|
5
5
|
type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
|
6
6
|
context?: T;
|
|
@@ -244,4 +244,4 @@ function getDynamicParams(path) {
|
|
|
244
244
|
})) : void 0;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
export { standardizeHTTPPath as a, deserialize as d, getDynamicParams as g, jsonSerialize as j, serialize as s };
|
|
247
|
+
export { standardizeHTTPPath as a, bracketNotationDeserialize as b, deserialize as d, getDynamicParams as g, jsonSerialize as j, serialize as s };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@temporary-name/contract';
|
|
2
2
|
import { HTTPPath, Interceptor } from '@temporary-name/shared';
|
|
3
3
|
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
4
|
-
import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.
|
|
4
|
+
import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.C3RuMHWl.js';
|
|
5
5
|
|
|
6
6
|
interface StandardHandlerPlugin<T extends Context> {
|
|
7
7
|
order?: number;
|
|
@@ -48,7 +48,6 @@ declare class StandardHandler<T extends Context> {
|
|
|
48
48
|
private readonly clientInterceptors;
|
|
49
49
|
private readonly rootInterceptors;
|
|
50
50
|
private readonly matcher;
|
|
51
|
-
private readonly codec;
|
|
52
51
|
constructor(router: Router<any, T>, options: NoInfer<StandardHandlerOptions<T>>);
|
|
53
52
|
handle(request: StandardLazyRequest, options: StandardHandleOptions<T>): Promise<StandardHandleResult>;
|
|
54
53
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporary-name/server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.3-alpha.
|
|
4
|
+
"version": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.stainless.com/",
|
|
7
7
|
"repository": {
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"cookie": "^1.0.2",
|
|
74
74
|
"rou3": "^0.7.7",
|
|
75
75
|
"zod": "^4.1.12",
|
|
76
|
-
"@temporary-name/interop": "1.9.3-alpha.
|
|
77
|
-
"@temporary-name/
|
|
78
|
-
"@temporary-name/
|
|
79
|
-
"@temporary-name/standard-server": "1.9.3-alpha.
|
|
80
|
-
"@temporary-name/
|
|
81
|
-
"@temporary-name/
|
|
82
|
-
"@temporary-name/
|
|
83
|
-
"@temporary-name/
|
|
84
|
-
"@temporary-name/
|
|
76
|
+
"@temporary-name/interop": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
77
|
+
"@temporary-name/json-schema": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
78
|
+
"@temporary-name/standard-server": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
79
|
+
"@temporary-name/standard-server-aws-lambda": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
80
|
+
"@temporary-name/contract": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
81
|
+
"@temporary-name/standard-server-fetch": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
82
|
+
"@temporary-name/shared": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
83
|
+
"@temporary-name/standard-server-node": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9",
|
|
84
|
+
"@temporary-name/zod": "1.9.3-alpha.dff27b31c00072e392d67d0cd8ca5b94835839f9"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@types/supertest": "^6.0.3",
|
|
@@ -3,25 +3,6 @@ import { resolveMaybeOptionalOptions, ORPCError, toArray, value, runWithSpan, in
|
|
|
3
3
|
import { HibernationEventIterator, mapEventIterator } from '@temporary-name/standard-server';
|
|
4
4
|
import { safeParseAsync } from '@temporary-name/zod';
|
|
5
5
|
|
|
6
|
-
const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
|
|
7
|
-
function lazy(loader, meta = {}) {
|
|
8
|
-
return {
|
|
9
|
-
[LAZY_SYMBOL]: {
|
|
10
|
-
loader,
|
|
11
|
-
meta
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function isLazy(item) {
|
|
16
|
-
return (typeof item === "object" || typeof item === "function") && item !== null && LAZY_SYMBOL in item;
|
|
17
|
-
}
|
|
18
|
-
function getLazyMeta(lazied) {
|
|
19
|
-
return lazied[LAZY_SYMBOL].meta;
|
|
20
|
-
}
|
|
21
|
-
function unlazy(lazied) {
|
|
22
|
-
return isLazy(lazied) ? lazied[LAZY_SYMBOL].loader() : Promise.resolve({ default: lazied });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
6
|
function mergeCurrentContext(context, other) {
|
|
26
7
|
return { ...context, ...other };
|
|
27
8
|
}
|
|
@@ -49,6 +30,25 @@ function createORPCErrorConstructorMap(errors) {
|
|
|
49
30
|
return proxy;
|
|
50
31
|
}
|
|
51
32
|
|
|
33
|
+
const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
|
|
34
|
+
function lazy(loader, meta = {}) {
|
|
35
|
+
return {
|
|
36
|
+
[LAZY_SYMBOL]: {
|
|
37
|
+
loader,
|
|
38
|
+
meta
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function isLazy(item) {
|
|
43
|
+
return (typeof item === "object" || typeof item === "function") && item !== null && LAZY_SYMBOL in item;
|
|
44
|
+
}
|
|
45
|
+
function getLazyMeta(lazied) {
|
|
46
|
+
return lazied[LAZY_SYMBOL].meta;
|
|
47
|
+
}
|
|
48
|
+
function unlazy(lazied) {
|
|
49
|
+
return isLazy(lazied) ? lazied[LAZY_SYMBOL].loader() : Promise.resolve({ default: lazied });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
52
|
function middlewareOutputFn(output) {
|
|
53
53
|
return { output, context: {} };
|
|
54
54
|
}
|