@temporary-name/server 1.9.3-alpha.62445d8d52a6787e7750865cd468fca8cccd3e28 → 1.9.3-alpha.6a70825f6d8c3dc99b87e4e5b778aea0fa007417
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 +4 -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 +4 -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 +4 -3
- package/dist/adapters/standard/index.d.mts +10 -5
- package/dist/adapters/standard/index.d.ts +10 -5
- package/dist/adapters/standard/index.mjs +4 -3
- package/dist/index.d.mts +51 -83
- package/dist/index.d.ts +51 -83
- package/dist/index.mjs +50 -213
- package/dist/openapi/index.d.mts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.mjs +52 -34
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/shared/{server.CT1xhSmE.d.mts → server.BCcLYvdF.d.mts} +1 -1
- package/dist/shared/server.CHV9AQHl.mjs +412 -0
- package/dist/shared/{server.cjcgLdr1.d.ts → server.CdeqmULw.d.ts} +1 -1
- package/dist/shared/{server.B93y_8tj.d.mts → server.DHezmW6C.d.mts} +2 -2
- package/dist/shared/server.DN9mVGfv.mjs +11 -0
- package/dist/shared/{server.CqTex_jI.mjs → server.DWwaAM-a.mjs} +13 -23
- package/dist/shared/{server.D_fags8X.d.ts → server.Da-qLzdU.d.ts} +2 -2
- package/dist/shared/{server.C3RuMHWl.d.mts → server.DecvGKtb.d.mts} +118 -68
- package/dist/shared/{server.C3RuMHWl.d.ts → server.DecvGKtb.d.ts} +118 -68
- package/dist/shared/{server.Kxw442A9.mjs → server.JtIZ8YG7.mjs} +1 -11
- package/package.json +10 -10
- package/dist/shared/server.BYYf0Wn6.mjs +0 -202
|
@@ -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.DecvGKtb.mjs';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.BCcLYvdF.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DHezmW6C.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -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.DecvGKtb.js';
|
|
4
|
+
import { b as StandardHandlerOptions } from '../../shared/server.CdeqmULw.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Da-qLzdU.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -1,13 +1,14 @@
|
|
|
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.DWwaAM-a.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.CHV9AQHl.mjs';
|
|
9
9
|
import '@temporary-name/zod';
|
|
10
|
-
import '../../shared/server.
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
|
11
12
|
|
|
12
13
|
class AwsLambdaHandler {
|
|
13
14
|
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.DecvGKtb.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as 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.BCcLYvdF.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DHezmW6C.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -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.DecvGKtb.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@temporary-name/standard-server-fetch';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as 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.CdeqmULw.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Da-qLzdU.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
7
|
import '@temporary-name/standard-server';
|
|
8
8
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ORPCError, toArray, intercept, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import { toStandardLazyRequest, toFetchResponse } from '@temporary-name/standard-server-fetch';
|
|
3
|
-
import { 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.DWwaAM-a.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.CHV9AQHl.mjs';
|
|
10
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
11
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
|
11
12
|
|
|
12
13
|
class BodyLimitPlugin {
|
|
13
14
|
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.DecvGKtb.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as 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.BCcLYvdF.mjs';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DHezmW6C.mjs';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
8
|
import '@temporary-name/standard-server';
|
|
@@ -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.DecvGKtb.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@temporary-name/shared';
|
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, b as 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.CdeqmULw.js';
|
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.Da-qLzdU.js';
|
|
6
6
|
import compression from '@temporary-name/interop/compression';
|
|
7
7
|
import '@temporary-name/contract';
|
|
8
8
|
import '@temporary-name/standard-server';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { once, ORPCError, toArray, intercept, resolveMaybeOptionalOptions } from '@temporary-name/shared';
|
|
2
2
|
import compression from '@temporary-name/interop/compression';
|
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@temporary-name/standard-server-node';
|
|
4
|
-
import { 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.DWwaAM-a.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.CHV9AQHl.mjs';
|
|
11
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
12
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
|
12
13
|
|
|
13
14
|
class BodyLimitPlugin {
|
|
14
15
|
maxBodySize;
|
|
@@ -1,12 +1,17 @@
|
|
|
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.BCcLYvdF.mjs';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
3
|
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
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.
|
|
4
|
+
import { StandardLazyRequest, StandardHeaders, StandardResponse } from '@temporary-name/standard-server';
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.DHezmW6C.mjs';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.DecvGKtb.mjs';
|
|
8
8
|
|
|
9
|
-
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
10
|
+
path: unknown;
|
|
11
|
+
query: unknown;
|
|
12
|
+
headers: StandardHeaders;
|
|
13
|
+
body: unknown;
|
|
14
|
+
}>;
|
|
10
15
|
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
16
|
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
12
17
|
|
|
@@ -1,12 +1,17 @@
|
|
|
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.CdeqmULw.js';
|
|
2
2
|
import { AnyProcedure, AnyRouter } from '@temporary-name/server';
|
|
3
3
|
import { ORPCError, HTTPPath } from '@temporary-name/shared';
|
|
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.
|
|
4
|
+
import { StandardLazyRequest, StandardHeaders, StandardResponse } from '@temporary-name/standard-server';
|
|
5
|
+
export { F as FriendlyStandardHandleOptions, d as decodeParams, r as resolveFriendlyStandardHandleOptions, t as toRou3Pattern } from '../../shared/server.Da-qLzdU.js';
|
|
6
6
|
import '@temporary-name/contract';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.DecvGKtb.js';
|
|
8
8
|
|
|
9
|
-
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<
|
|
9
|
+
declare function decode(request: StandardLazyRequest, pathParams: Record<string, string> | undefined): Promise<{
|
|
10
|
+
path: unknown;
|
|
11
|
+
query: unknown;
|
|
12
|
+
headers: StandardHeaders;
|
|
13
|
+
body: unknown;
|
|
14
|
+
}>;
|
|
10
15
|
declare function encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
|
11
16
|
declare function encodeError(error: ORPCError<any, any>): StandardResponse;
|
|
12
17
|
|
|
@@ -1,9 +1,10 @@
|
|
|
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.DWwaAM-a.mjs';
|
|
2
2
|
import '@temporary-name/shared';
|
|
3
3
|
import '@temporary-name/standard-server';
|
|
4
|
-
import '../../shared/server.
|
|
4
|
+
import '../../shared/server.CHV9AQHl.mjs';
|
|
5
5
|
import '@temporary-name/contract';
|
|
6
6
|
import '@temporary-name/zod';
|
|
7
|
-
import '../../shared/server.
|
|
7
|
+
import '../../shared/server.JtIZ8YG7.mjs';
|
|
8
8
|
import '@temporary-name/server';
|
|
9
9
|
import 'rou3';
|
|
10
|
+
import '../../shared/server.DN9mVGfv.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,79 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap, AnySchema, AnyShape, MergedSchemas, WrapShape, Route, InferHandlerInputs, InferSchemaInput, ContractRouter, ContractProcedureDef, InitialSchemas, AnyContractRouter, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure, InferProcedureClientInputs, InferSchemaOutput, ErrorFromErrorMap, Schema } from '@temporary-name/contract';
|
|
2
2
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
3
|
-
import { ClientContext, MaybeOptionalOptions, IntersectPick, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
3
|
+
import { ClientContext, MaybeOptionalOptions, HTTPEndpoint, 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
|
-
import { SchemaClass } from '@temporary-name/zod';
|
|
6
|
-
import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient,
|
|
7
|
-
export {
|
|
5
|
+
import { SchemaClass, core } from '@temporary-name/zod';
|
|
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.DecvGKtb.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.DecvGKtb.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>;
|
|
40
|
+
endpoint<U extends AnySchema | AnyShape = core.$ZodType<Record<string, never>, Record<string, never>>>(endpoint: HTTPEndpoint, schema?: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
41
|
+
pathSchema: WrapShape<U>;
|
|
42
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
77
43
|
/**
|
|
78
44
|
* Sets or updates the route definition for the contract.
|
|
79
45
|
* The provided route is spared-merged with any existing route in the contract.
|
|
@@ -82,19 +48,21 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
82
48
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
83
49
|
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
84
50
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
51
|
+
endpointOpts(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
52
|
+
query<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
53
|
+
querySchema: WrapShape<U>;
|
|
54
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
55
|
+
body<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
56
|
+
bodySchema: WrapShape<U>;
|
|
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<
|
|
63
|
+
output<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
64
|
+
outputSchema: WrapShape<U>;
|
|
65
|
+
}>, TErrorMap, TMeta, TGateName>;
|
|
98
66
|
/**
|
|
99
67
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
100
68
|
*
|
|
@@ -102,18 +70,18 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
102
70
|
* @note The current context must be satisfy middleware dependent-context
|
|
103
71
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
104
72
|
*/
|
|
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>,
|
|
73
|
+
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
74
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
107
75
|
isGateEnabled: typeof isGateEnabled;
|
|
108
|
-
}>,
|
|
76
|
+
}>, TSchemas, TErrorMap, TMeta, TInferredGateName>;
|
|
109
77
|
/**
|
|
110
78
|
* Defines the handler of the procedure.
|
|
111
79
|
*
|
|
112
80
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
113
81
|
*/
|
|
114
|
-
handler(handler: ProcedureHandler<TCurrentContext,
|
|
82
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
115
83
|
}
|
|
116
|
-
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context,
|
|
84
|
+
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
85
|
/**
|
|
118
86
|
* Prefixes all procedures in the router.
|
|
119
87
|
* The provided prefix is post-appended to any existing router prefix.
|
|
@@ -122,7 +90,7 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
122
90
|
*
|
|
123
91
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
124
92
|
*/
|
|
125
|
-
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext,
|
|
93
|
+
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
126
94
|
/**
|
|
127
95
|
* Adds tags to all procedures in the router.
|
|
128
96
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
@@ -137,7 +105,7 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
137
105
|
*/
|
|
138
106
|
router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
|
|
139
107
|
}
|
|
140
|
-
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any,
|
|
108
|
+
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'> {
|
|
141
109
|
/**
|
|
142
110
|
* This property holds the defined options.
|
|
143
111
|
*/
|
|
@@ -166,18 +134,18 @@ interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Co
|
|
|
166
134
|
}
|
|
167
135
|
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>;
|
|
168
136
|
|
|
169
|
-
interface BuilderDef<
|
|
137
|
+
interface BuilderDef<TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
|
|
170
138
|
middlewares: readonly AnyMiddleware[];
|
|
171
139
|
inputValidationIndex: number;
|
|
172
140
|
outputValidationIndex: number;
|
|
173
141
|
}
|
|
174
|
-
declare class Builder<TInitialContext extends Context, TCurrentContext extends Context,
|
|
142
|
+
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> {
|
|
175
143
|
/**
|
|
176
144
|
* Set or override the initial context.
|
|
177
145
|
*
|
|
178
146
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
179
147
|
*/
|
|
180
|
-
$context<U extends Context>(): Builder<U, U,
|
|
148
|
+
$context<U extends Context>(): Builder<U, U, TSchemas, TErrorMap, TMeta, TGateName>;
|
|
181
149
|
/**
|
|
182
150
|
* Creates a middleware.
|
|
183
151
|
*
|
|
@@ -186,7 +154,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
|
186
154
|
middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
|
187
155
|
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, TMeta>;
|
|
188
156
|
}
|
|
189
|
-
type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>,
|
|
157
|
+
type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>, InitialSchemas, Record<never, never>, TMeta, never>;
|
|
190
158
|
interface ApiBuilderOpts<TMeta extends Meta> {
|
|
191
159
|
meta?: TMeta;
|
|
192
160
|
}
|
|
@@ -196,7 +164,7 @@ declare const os: ApiBuilder<Record<never, never>>;
|
|
|
196
164
|
/**
|
|
197
165
|
* Like `DecoratedProcedure`, but removed all method that can change the contract.
|
|
198
166
|
*/
|
|
199
|
-
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context,
|
|
167
|
+
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
|
|
200
168
|
/**
|
|
201
169
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
202
170
|
*
|
|
@@ -205,7 +173,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
205
173
|
* @note The current context must be satisfy middleware dependent-context
|
|
206
174
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
207
175
|
*/
|
|
208
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext,
|
|
176
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
209
177
|
/**
|
|
210
178
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
211
179
|
*
|
|
@@ -214,19 +182,19 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
|
214
182
|
* @note The current context must be satisfy middleware dependent-context
|
|
215
183
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
216
184
|
*/
|
|
217
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<
|
|
185
|
+
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<InferHandlerInputs<TSchemas>, UInput>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
218
186
|
/**
|
|
219
187
|
* Make this procedure callable (works like a function while still being a procedure).
|
|
220
188
|
*
|
|
221
189
|
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
222
190
|
*/
|
|
223
|
-
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext,
|
|
191
|
+
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> & ProcedureClient<TClientContext, TSchemas, TErrorMap>;
|
|
224
192
|
}
|
|
225
193
|
/**
|
|
226
194
|
* Like `ProcedureBuilderWithoutHandler`, but removed all method that can change the contract.
|
|
227
195
|
*/
|
|
228
|
-
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context,
|
|
229
|
-
'~orpc': BuilderDef<
|
|
196
|
+
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
197
|
+
'~orpc': BuilderDef<TSchemas, TErrorMap, TMeta>;
|
|
230
198
|
/**
|
|
231
199
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
232
200
|
*
|
|
@@ -235,7 +203,7 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
235
203
|
* @note The current context must be satisfy middleware dependent-context
|
|
236
204
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
237
205
|
*/
|
|
238
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext,
|
|
206
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
239
207
|
/**
|
|
240
208
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
241
209
|
*
|
|
@@ -244,13 +212,13 @@ interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext
|
|
|
244
212
|
* @note The current context must be satisfy middleware dependent-context
|
|
245
213
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
246
214
|
*/
|
|
247
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<
|
|
215
|
+
'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<InferHandlerInputs<TSchemas>, UInput>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
248
216
|
/**
|
|
249
217
|
* Defines the handler of the procedure.
|
|
250
218
|
*
|
|
251
219
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
252
220
|
*/
|
|
253
|
-
'handler'(handler: ProcedureHandler<TCurrentContext,
|
|
221
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
254
222
|
}
|
|
255
223
|
|
|
256
224
|
interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
|
@@ -270,7 +238,7 @@ interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitial
|
|
|
270
238
|
*/
|
|
271
239
|
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
272
240
|
}
|
|
273
|
-
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer
|
|
241
|
+
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> & {
|
|
274
242
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
275
243
|
};
|
|
276
244
|
|
|
@@ -308,7 +276,7 @@ interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends
|
|
|
308
276
|
default: U;
|
|
309
277
|
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
310
278
|
}
|
|
311
|
-
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer
|
|
279
|
+
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> & {
|
|
312
280
|
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternal<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
313
281
|
};
|
|
314
282
|
declare function implementerInternal<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context>(contract: T, middlewares: AnyMiddleware[]): ImplementerInternal<T, TInitialContext, TCurrentContext>;
|
|
@@ -343,9 +311,9 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
|
343
311
|
* ```
|
|
344
312
|
*
|
|
345
313
|
*/
|
|
346
|
-
declare function call<TInitialContext extends Context,
|
|
314
|
+
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input: InferProcedureClientInputs<TSchemas>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
|
|
347
315
|
|
|
348
|
-
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer
|
|
316
|
+
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> : {
|
|
349
317
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
|
350
318
|
};
|
|
351
319
|
/**
|
|
@@ -358,5 +326,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
|
|
|
358
326
|
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
|
359
327
|
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
360
328
|
|
|
361
|
-
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call,
|
|
362
|
-
export type {
|
|
329
|
+
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 };
|
|
330
|
+
export type { ApiBuilder, BuilderDef, DecoratedMiddleware, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares };
|