@temporary-name/server 1.9.3-alpha.50b729ba628b987e14f5bd1004e5a04590fd4b4e → 1.9.3-alpha.52ad782be6ff2aac22845e524cd6454f857fb89b
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 +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/index.d.mts +46 -96
- package/dist/index.d.ts +46 -96
- package/dist/index.mjs +15 -215
- package/dist/openapi/index.mjs +30 -64
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/shared/{server.Bs6ka_UE.d.mts → server.B-pKBQ0r.d.mts} +2 -2
- package/dist/shared/{server.D2UFMrxf.d.ts → server.BQV-lt_s.d.ts} +2 -2
- package/dist/shared/{server.DcfsPloY.mjs → server.BdGbIyq8.mjs} +211 -17
- package/dist/shared/{server.Bk5r0-2R.d.ts → server.DAzElr6Q.d.ts} +1 -1
- package/dist/shared/{server.CZNLCQBm.d.mts → server.Do2Whl-h.d.mts} +114 -71
- package/dist/shared/{server.CZNLCQBm.d.ts → server.Do2Whl-h.d.ts} +114 -71
- package/dist/shared/{server.CbLTWfgn.d.mts → server.KIlJQ8K_.d.mts} +1 -1
- package/dist/shared/{server.BEHw7Eyx.mjs → server.Kxw442A9.mjs} +1 -1
- package/dist/shared/{server.BVxcyR6X.mjs → server.SmOM3Fae.mjs} +17 -42
- package/package.json +10 -10
|
@@ -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.Do2Whl-h.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.KIlJQ8K_.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.B-pKBQ0r.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.Do2Whl-h.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.DAzElr6Q.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BQV-lt_s.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.SmOM3Fae.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.BdGbIyq8.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.Do2Whl-h.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.KIlJQ8K_.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.B-pKBQ0r.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.Do2Whl-h.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.DAzElr6Q.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BQV-lt_s.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.SmOM3Fae.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.BdGbIyq8.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.Do2Whl-h.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.KIlJQ8K_.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.B-pKBQ0r.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.Do2Whl-h.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.DAzElr6Q.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.BQV-lt_s.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.SmOM3Fae.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.BdGbIyq8.mjs';
|
|
11
|
+
import '../../shared/server.Kxw442A9.mjs';
|
|
12
12
|
|
|
13
13
|
class BodyLimitPlugin {
|
|
14
14
|
maxBodySize;
|
|
@@ -1,12 +1,12 @@
|
|
|
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.KIlJQ8K_.mjs';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
3
|
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
4
|
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
5
|
-
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.B-pKBQ0r.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.Do2Whl-h.mjs';
|
|
8
8
|
|
|
9
|
-
declare function decode(request: StandardLazyRequest,
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<unknown>;
|
|
10
10
|
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
11
|
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
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.DAzElr6Q.js';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
3
|
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
4
4
|
import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
|
|
5
|
-
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.BQV-lt_s.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.Do2Whl-h.js';
|
|
8
8
|
|
|
9
|
-
declare function decode(request: StandardLazyRequest,
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<unknown>;
|
|
10
10
|
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
11
|
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
12
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
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.
|
|
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.SmOM3Fae.mjs';
|
|
2
2
|
import '@temporary-name/shared';
|
|
3
3
|
import '@temporary-name/standard-server';
|
|
4
|
-
import '../../shared/server.
|
|
4
|
+
import '../../shared/server.BdGbIyq8.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,79 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput,
|
|
1
|
+
import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap, Route, AnySchema, InferSchemaOutput, InferSchemaInput, ContractRouter, ContractProcedureDef, UnknownSchemas, AnyContractRouter, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure, ErrorFromErrorMap, Schema } 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,
|
|
7
|
-
export {
|
|
6
|
+
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, e as ProcedureHandler, E as EnhanceRouterOptions, R as Router, f as EnhancedRouter, g as MapInputMiddleware, A as AnyMiddleware, L as Lazy, h as AnyProcedure, i as Lazyable, j as AnyRouter, I as InferRouterInitialContext } from './shared/server.Do2Whl-h.mjs';
|
|
7
|
+
export { U as AccessibleLazyRouter, Z as ContractProcedureCallbackOptions, N as InferRouterCurrentContexts, K as InferRouterInitialContexts, Q as InferRouterInputs, S as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, _ as LazyTraverseContractProceduresOptions, x as MiddlewareNextFn, w as MiddlewareNextFnOptions, z as MiddlewareOptions, y as MiddlewareOutputFn, v as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, H as ProcedureClientInterceptorOptions, F as ProcedureDef, D as ProcedureHandlerOptions, Y as TraverseContractProcedureCallbackOptions, X as TraverseContractProceduresOptions, a1 as UnlaziedRouter, V as createAccessibleLazyRouter, n as createORPCErrorConstructorMap, J as createProcedureClient, W as enhanceRouter, t as getLazyMeta, T as getRouter, s as isLazy, G as isProcedure, r as lazy, q as lazyInternal, m as mergeCurrentContext, B as middlewareOutputFn, a0 as resolveContractProcedures, $ as traverseContractProcedures, u as unlazy, a2 as unlazyRouter } from './shared/server.Do2Whl-h.mjs';
|
|
8
8
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
9
|
|
|
10
|
-
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context,
|
|
10
|
+
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
|
|
11
11
|
/**
|
|
12
12
|
* Make this procedure callable (works like a function while still being a procedure).
|
|
13
13
|
*
|
|
14
14
|
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
15
15
|
*/
|
|
16
|
-
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext,
|
|
16
|
+
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> & ProcedureClient<TClientContext, TSchemas, TErrorMap>;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
declare
|
|
20
|
-
|
|
21
|
-
[K in keyof T]: T[K] extends Lazyable<AnyRouter> ? AccessibleLazyRouter<T[K]> : never;
|
|
22
|
-
};
|
|
23
|
-
declare function createAccessibleLazyRouter<T extends Lazy<AnyRouter | undefined>>(lazied: T): AccessibleLazyRouter<T>;
|
|
24
|
-
type EnhancedRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap> = T extends Lazy<infer U extends AnyRouter> ? AccessibleLazyRouter<EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>> : T extends (Procedure<infer UInitialContext, infer UCurrentContext, infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta>) ? Procedure<MergedInitialContext<TInitialContext, UInitialContext, TCurrentContext>, UCurrentContext, UInputSchema, UOutputSchema, MergedErrorMap<TErrorMap, UErrorMap>, UMeta> : {
|
|
25
|
-
[K in keyof T]: T[K] extends Lazyable<AnyRouter> ? EnhancedRouter<T[K], TInitialContext, TCurrentContext, TErrorMap> : never;
|
|
26
|
-
};
|
|
27
|
-
interface EnhanceRouterOptions<TErrorMap extends ErrorMap> extends EnhanceRouteOptions {
|
|
28
|
-
middlewares: readonly AnyMiddleware[];
|
|
29
|
-
errorMap: TErrorMap;
|
|
30
|
-
dedupeLeadingMiddlewares: boolean;
|
|
31
|
-
}
|
|
32
|
-
declare function enhanceRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap>(router: T, options: EnhanceRouterOptions<TErrorMap>): EnhancedRouter<T, TInitialContext, TCurrentContext, TErrorMap>;
|
|
33
|
-
interface TraverseContractProceduresOptions {
|
|
34
|
-
router: AnyContractRouter | AnyRouter;
|
|
35
|
-
path: readonly string[];
|
|
36
|
-
}
|
|
37
|
-
interface TraverseContractProcedureCallbackOptions {
|
|
38
|
-
contract: AnyContractProcedure | AnyProcedure;
|
|
39
|
-
path: readonly string[];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Use `TraverseContractProcedureCallbackOptions` instead.
|
|
43
|
-
*/
|
|
44
|
-
type ContractProcedureCallbackOptions = TraverseContractProcedureCallbackOptions;
|
|
45
|
-
interface LazyTraverseContractProceduresOptions {
|
|
46
|
-
router: Lazy<AnyRouter>;
|
|
47
|
-
path: readonly string[];
|
|
48
|
-
}
|
|
49
|
-
declare function traverseContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void, lazyOptions?: LazyTraverseContractProceduresOptions[]): LazyTraverseContractProceduresOptions[];
|
|
50
|
-
declare function resolveContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void): Promise<void>;
|
|
51
|
-
type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
|
|
52
|
-
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? UnlaziedRouter<U> : never;
|
|
53
|
-
};
|
|
54
|
-
declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
|
|
55
|
-
|
|
56
|
-
declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
57
|
-
z: SchemaClass;
|
|
19
|
+
declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedure<TSchemas, TErrorMap, TMeta> {
|
|
20
|
+
z: SchemaClass<TGateName>;
|
|
58
21
|
/**
|
|
59
22
|
* This property holds the defined options.
|
|
60
23
|
*/
|
|
61
|
-
'~orpc': BuilderDef<
|
|
62
|
-
constructor(def: BuilderDef<
|
|
24
|
+
'~orpc': BuilderDef<TSchemas, TErrorMap, TMeta>;
|
|
25
|
+
constructor(def: BuilderDef<TSchemas, TErrorMap, TMeta>);
|
|
63
26
|
/**
|
|
64
27
|
* Adds type-safe custom errors to the contract.
|
|
65
28
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
66
29
|
*
|
|
67
30
|
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
68
31
|
*/
|
|
69
|
-
errors<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext,
|
|
32
|
+
errors<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
70
33
|
/**
|
|
71
34
|
* Sets or updates the metadata for the contract.
|
|
72
35
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
73
36
|
*
|
|
74
37
|
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
75
38
|
*/
|
|
76
|
-
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext,
|
|
39
|
+
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
77
40
|
/**
|
|
78
41
|
* Sets or updates the route definition for the contract.
|
|
79
42
|
* The provided route is spared-merged with any existing route in the contract.
|
|
@@ -82,19 +45,25 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
82
45
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
83
46
|
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
84
47
|
*/
|
|
85
|
-
route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext,
|
|
48
|
+
route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
86
49
|
/**
|
|
87
50
|
* Defines the input validation schema.
|
|
88
51
|
*
|
|
89
52
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
|
|
90
53
|
*/
|
|
91
|
-
input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext,
|
|
54
|
+
input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, {
|
|
55
|
+
inputSchema: USchema;
|
|
56
|
+
outputSchema: TSchemas['outputSchema'];
|
|
57
|
+
}, TErrorMap, TMeta, TGateName>;
|
|
92
58
|
/**
|
|
93
59
|
* Defines the output validation schema.
|
|
94
60
|
*
|
|
95
61
|
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
96
62
|
*/
|
|
97
|
-
output<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext,
|
|
63
|
+
output<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, {
|
|
64
|
+
inputSchema: TSchemas['inputSchema'];
|
|
65
|
+
outputSchema: USchema;
|
|
66
|
+
}, TErrorMap, TMeta, TGateName>;
|
|
98
67
|
/**
|
|
99
68
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
100
69
|
*
|
|
@@ -102,18 +71,18 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
102
71
|
* @note The current context must be satisfy middleware dependent-context
|
|
103
72
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
104
73
|
*/
|
|
105
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>,
|
|
74
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
106
75
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
107
76
|
isGateEnabled: typeof isGateEnabled;
|
|
108
|
-
}>,
|
|
77
|
+
}>, TSchemas, TErrorMap, TMeta, TInferredGateName>;
|
|
109
78
|
/**
|
|
110
79
|
* Defines the handler of the procedure.
|
|
111
80
|
*
|
|
112
81
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
113
82
|
*/
|
|
114
|
-
handler(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<
|
|
83
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TSchemas['inputSchema']>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
115
84
|
}
|
|
116
|
-
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context,
|
|
85
|
+
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName> {
|
|
117
86
|
/**
|
|
118
87
|
* Prefixes all procedures in the router.
|
|
119
88
|
* The provided prefix is post-appended to any existing router prefix.
|
|
@@ -122,7 +91,7 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
122
91
|
*
|
|
123
92
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
124
93
|
*/
|
|
125
|
-
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext,
|
|
94
|
+
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
126
95
|
/**
|
|
127
96
|
* Adds tags to all procedures in the router.
|
|
128
97
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
@@ -136,17 +105,8 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
136
105
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
137
106
|
*/
|
|
138
107
|
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
108
|
}
|
|
149
|
-
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any,
|
|
109
|
+
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router'> {
|
|
150
110
|
/**
|
|
151
111
|
* This property holds the defined options.
|
|
152
112
|
*/
|
|
@@ -175,18 +135,18 @@ interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Co
|
|
|
175
135
|
}
|
|
176
136
|
declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta>(middleware: Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>): DecoratedMiddleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>;
|
|
177
137
|
|
|
178
|
-
interface BuilderDef<
|
|
138
|
+
interface BuilderDef<TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
|
|
179
139
|
middlewares: readonly AnyMiddleware[];
|
|
180
140
|
inputValidationIndex: number;
|
|
181
141
|
outputValidationIndex: number;
|
|
182
142
|
}
|
|
183
|
-
declare class Builder<TInitialContext extends Context, TCurrentContext extends Context,
|
|
143
|
+
declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName> {
|
|
184
144
|
/**
|
|
185
145
|
* Set or override the initial context.
|
|
186
146
|
*
|
|
187
147
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
188
148
|
*/
|
|
189
|
-
$context<U extends Context>(): Builder<U, U,
|
|
149
|
+
$context<U extends Context>(): Builder<U, U, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
190
150
|
/**
|
|
191
151
|
* Creates a middleware.
|
|
192
152
|
*
|
|
@@ -195,7 +155,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
|
195
155
|
middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
|
196
156
|
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, TMeta>;
|
|
197
157
|
}
|
|
198
|
-
type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>,
|
|
158
|
+
type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>, UnknownSchemas, Record<never, never>, TMeta, never>;
|
|
199
159
|
interface ApiBuilderOpts<TMeta extends Meta> {
|
|
200
160
|
meta?: TMeta;
|
|
201
161
|
}
|
|
@@ -205,7 +165,7 @@ declare const os: ApiBuilder<Record<never, never>>;
|
|
|
205
165
|
/**
|
|
206
166
|
* Like `DecoratedProcedure`, but removed all method that can change the contract.
|
|
207
167
|
*/
|
|
208
|
-
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context,
|
|
168
|
+
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
|
|
209
169
|
/**
|
|
210
170
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
211
171
|
*
|
|
@@ -214,7 +174,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
214
174
|
* @note The current context must be satisfy middleware dependent-context
|
|
215
175
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
216
176
|
*/
|
|
217
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<
|
|
177
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TSchemas['inputSchema']>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
218
178
|
/**
|
|
219
179
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
220
180
|
*
|
|
@@ -223,19 +183,19 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
223
183
|
* @note The current context must be satisfy middleware dependent-context
|
|
224
184
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
225
185
|
*/
|
|
226
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<
|
|
186
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TSchemas['inputSchema']>, UInput>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
227
187
|
/**
|
|
228
188
|
* Make this procedure callable (works like a function while still being a procedure).
|
|
229
189
|
*
|
|
230
190
|
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
231
191
|
*/
|
|
232
|
-
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext,
|
|
192
|
+
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> & ProcedureClient<TClientContext, TSchemas, TErrorMap>;
|
|
233
193
|
}
|
|
234
194
|
/**
|
|
235
195
|
* Like `ProcedureBuilderWithoutHandler`, but removed all method that can change the contract.
|
|
236
196
|
*/
|
|
237
|
-
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context,
|
|
238
|
-
'~orpc': BuilderDef<
|
|
197
|
+
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
198
|
+
'~orpc': BuilderDef<TSchemas, TErrorMap, TMeta>;
|
|
239
199
|
/**
|
|
240
200
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
241
201
|
*
|
|
@@ -244,7 +204,7 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
244
204
|
* @note The current context must be satisfy middleware dependent-context
|
|
245
205
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
246
206
|
*/
|
|
247
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<
|
|
207
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TSchemas['inputSchema']>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
248
208
|
/**
|
|
249
209
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
250
210
|
*
|
|
@@ -253,13 +213,13 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
253
213
|
* @note The current context must be satisfy middleware dependent-context
|
|
254
214
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
255
215
|
*/
|
|
256
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<
|
|
216
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TSchemas['inputSchema']>, UInput>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
257
217
|
/**
|
|
258
218
|
* Defines the handler of the procedure.
|
|
259
219
|
*
|
|
260
220
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
261
221
|
*/
|
|
262
|
-
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<
|
|
222
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TSchemas['inputSchema']>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
263
223
|
}
|
|
264
224
|
|
|
265
225
|
interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
|
@@ -278,18 +238,8 @@ interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitial
|
|
|
278
238
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
279
239
|
*/
|
|
280
240
|
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
241
|
}
|
|
292
|
-
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer
|
|
242
|
+
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer USchemas, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, USchemas, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
|
293
243
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
294
244
|
};
|
|
295
245
|
|
|
@@ -327,7 +277,7 @@ interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends
|
|
|
327
277
|
default: U;
|
|
328
278
|
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
329
279
|
}
|
|
330
|
-
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer
|
|
280
|
+
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer USchemas, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, USchemas, UErrorMap, UMeta> : RouterImplementer<TContract, TInitialContext, TCurrentContext> & {
|
|
331
281
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternal<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
332
282
|
};
|
|
333
283
|
declare function implementerInternal<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context>(contract: T, middlewares: AnyMiddleware[]): ImplementerInternal<T, TInitialContext, TCurrentContext>;
|
|
@@ -362,9 +312,9 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
|
362
312
|
* ```
|
|
363
313
|
*
|
|
364
314
|
*/
|
|
365
|
-
declare function call<TInitialContext extends Context,
|
|
315
|
+
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input: InferSchemaInput<TSchemas['inputSchema']>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
|
|
366
316
|
|
|
367
|
-
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer
|
|
317
|
+
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer USchemas, infer UErrorMap, any> ? ProcedureClient<TClientContext, USchemas, UErrorMap> : {
|
|
368
318
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
|
369
319
|
};
|
|
370
320
|
/**
|
|
@@ -377,5 +327,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
|
|
|
377
327
|
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
|
378
328
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
379
329
|
|
|
380
|
-
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call,
|
|
381
|
-
export type {
|
|
330
|
+
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, getHiddenRouterContract, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, setHiddenRouterContract };
|
|
331
|
+
export type { ApiBuilder, BuilderDef, DecoratedMiddleware, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares };
|