@orpc/server 0.44.0 → 0.45.1
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/fetch/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/hono/index.d.mts +3 -3
- package/dist/adapters/hono/index.d.ts +3 -3
- package/dist/adapters/next/index.d.mts +3 -3
- package/dist/adapters/next/index.d.ts +3 -3
- package/dist/adapters/node/index.d.mts +3 -3
- package/dist/adapters/node/index.d.ts +3 -3
- package/dist/adapters/standard/index.d.mts +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/index.d.mts +26 -24
- package/dist/index.d.ts +26 -24
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/shared/{server.MnOqRlBp.d.mts → server.B_cAGti1.d.mts} +2 -2
- package/dist/shared/{server.CI7U5gRZ.d.mts → server.Cn9ybJtE.d.mts} +8 -8
- package/dist/shared/{server.CI7U5gRZ.d.ts → server.Cn9ybJtE.d.ts} +8 -8
- package/dist/shared/{server.BqEaivV1.d.ts → server.CynXWJja.d.ts} +2 -2
- package/dist/shared/{server.CHpDfeOK.d.mts → server.D86dtDX_.d.mts} +1 -1
- package/dist/shared/{server.DSZ2XY8G.d.ts → server.dPmfqnQI.d.ts} +1 -1
- package/package.json +7 -7
@@ -1,8 +1,8 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
-
import { R as RPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.Cn9ybJtE.mjs';
|
4
|
+
import { S as StandardHandleOptions } from '../../shared/server.D86dtDX_.mjs';
|
5
|
+
import { R as RPCHandlerOptions } from '../../shared/server.B_cAGti1.mjs';
|
6
6
|
import '@orpc/client';
|
7
7
|
import '@orpc/contract';
|
8
8
|
import '@orpc/standard-server';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
-
import { R as RPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.Cn9ybJtE.js';
|
4
|
+
import { S as StandardHandleOptions } from '../../shared/server.dPmfqnQI.js';
|
5
|
+
import { R as RPCHandlerOptions } from '../../shared/server.CynXWJja.js';
|
6
6
|
import '@orpc/client';
|
7
7
|
import '@orpc/contract';
|
8
8
|
import '@orpc/standard-server';
|
@@ -2,10 +2,10 @@ import { FetchHandler } from '../fetch/index.mjs';
|
|
2
2
|
export { FetchHandleResult, RPCHandler } from '../fetch/index.mjs';
|
3
3
|
import { Value, MaybeOptionalOptions } from '@orpc/shared';
|
4
4
|
import { Context as Context$1, MiddlewareHandler } from 'hono';
|
5
|
-
import { C as Context } from '../../shared/server.
|
6
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
+
import { C as Context } from '../../shared/server.Cn9ybJtE.mjs';
|
6
|
+
import { S as StandardHandleOptions } from '../../shared/server.D86dtDX_.mjs';
|
7
7
|
import '@orpc/standard-server-fetch';
|
8
|
-
import '../../shared/server.
|
8
|
+
import '../../shared/server.B_cAGti1.mjs';
|
9
9
|
import '@orpc/client';
|
10
10
|
import '@orpc/contract';
|
11
11
|
import '@orpc/standard-server';
|
@@ -2,10 +2,10 @@ import { FetchHandler } from '../fetch/index.js';
|
|
2
2
|
export { FetchHandleResult, RPCHandler } from '../fetch/index.js';
|
3
3
|
import { Value, MaybeOptionalOptions } from '@orpc/shared';
|
4
4
|
import { Context as Context$1, MiddlewareHandler } from 'hono';
|
5
|
-
import { C as Context } from '../../shared/server.
|
6
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
+
import { C as Context } from '../../shared/server.Cn9ybJtE.js';
|
6
|
+
import { S as StandardHandleOptions } from '../../shared/server.dPmfqnQI.js';
|
7
7
|
import '@orpc/standard-server-fetch';
|
8
|
-
import '../../shared/server.
|
8
|
+
import '../../shared/server.CynXWJja.js';
|
9
9
|
import '@orpc/client';
|
10
10
|
import '@orpc/contract';
|
11
11
|
import '@orpc/standard-server';
|
@@ -2,10 +2,10 @@ import { FetchHandler } from '../fetch/index.mjs';
|
|
2
2
|
export { FetchHandleResult, RPCHandler } from '../fetch/index.mjs';
|
3
3
|
import { Value, MaybeOptionalOptions } from '@orpc/shared';
|
4
4
|
import { NextRequest } from 'next/server';
|
5
|
-
import { C as Context } from '../../shared/server.
|
6
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
+
import { C as Context } from '../../shared/server.Cn9ybJtE.mjs';
|
6
|
+
import { S as StandardHandleOptions } from '../../shared/server.D86dtDX_.mjs';
|
7
7
|
import '@orpc/standard-server-fetch';
|
8
|
-
import '../../shared/server.
|
8
|
+
import '../../shared/server.B_cAGti1.mjs';
|
9
9
|
import '@orpc/client';
|
10
10
|
import '@orpc/contract';
|
11
11
|
import '@orpc/standard-server';
|
@@ -2,10 +2,10 @@ import { FetchHandler } from '../fetch/index.js';
|
|
2
2
|
export { FetchHandleResult, RPCHandler } from '../fetch/index.js';
|
3
3
|
import { Value, MaybeOptionalOptions } from '@orpc/shared';
|
4
4
|
import { NextRequest } from 'next/server';
|
5
|
-
import { C as Context } from '../../shared/server.
|
6
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
+
import { C as Context } from '../../shared/server.Cn9ybJtE.js';
|
6
|
+
import { S as StandardHandleOptions } from '../../shared/server.dPmfqnQI.js';
|
7
7
|
import '@orpc/standard-server-fetch';
|
8
|
-
import '../../shared/server.
|
8
|
+
import '../../shared/server.CynXWJja.js';
|
9
9
|
import '@orpc/client';
|
10
10
|
import '@orpc/contract';
|
11
11
|
import '@orpc/standard-server';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { SendStandardResponseOptions } from '@orpc/standard-server-node';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
-
import { R as RPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.Cn9ybJtE.mjs';
|
4
|
+
import { S as StandardHandleOptions } from '../../shared/server.D86dtDX_.mjs';
|
5
|
+
import { R as RPCHandlerOptions } from '../../shared/server.B_cAGti1.mjs';
|
6
6
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
7
7
|
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
8
8
|
import '@orpc/client';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
2
2
|
import { SendStandardResponseOptions } from '@orpc/standard-server-node';
|
3
|
-
import { C as Context, R as Router } from '../../shared/server.
|
4
|
-
import { S as StandardHandleOptions } from '../../shared/server.
|
5
|
-
import { R as RPCHandlerOptions } from '../../shared/server.
|
3
|
+
import { C as Context, R as Router } from '../../shared/server.Cn9ybJtE.js';
|
4
|
+
import { S as StandardHandleOptions } from '../../shared/server.dPmfqnQI.js';
|
5
|
+
import { R as RPCHandlerOptions } from '../../shared/server.CynXWJja.js';
|
6
6
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
7
7
|
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
8
8
|
import '@orpc/client';
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { c as StandardCodec, e as StandardParams, b as StandardMatcher, f as StandardMatchResult } from '../../shared/server.
|
2
|
-
export { S as StandardHandleOptions, g as StandardHandleResult, h as StandardHandler, d as StandardHandlerInterceptorOptions, a as StandardHandlerOptions, W as WellStandardHandleOptions } from '../../shared/server.
|
1
|
+
import { c as StandardCodec, e as StandardParams, b as StandardMatcher, f as StandardMatchResult } from '../../shared/server.D86dtDX_.mjs';
|
2
|
+
export { S as StandardHandleOptions, g as StandardHandleResult, h as StandardHandler, d as StandardHandlerInterceptorOptions, a as StandardHandlerOptions, W as WellStandardHandleOptions } from '../../shared/server.D86dtDX_.mjs';
|
3
3
|
import { ORPCError } from '@orpc/client';
|
4
4
|
import { StandardRequest, StandardResponse } from '@orpc/standard-server';
|
5
|
-
import { A as AnyProcedure, a as AnyRouter } from '../../shared/server.
|
5
|
+
import { A as AnyProcedure, a as AnyRouter } from '../../shared/server.Cn9ybJtE.mjs';
|
6
6
|
import { RPCSerializer } from '@orpc/client/standard';
|
7
|
-
export { R as RPCHandlerOptions } from '../../shared/server.
|
7
|
+
export { R as RPCHandlerOptions } from '../../shared/server.B_cAGti1.mjs';
|
8
8
|
import { HTTPPath } from '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { c as StandardCodec, e as StandardParams, b as StandardMatcher, f as StandardMatchResult } from '../../shared/server.
|
2
|
-
export { S as StandardHandleOptions, g as StandardHandleResult, h as StandardHandler, d as StandardHandlerInterceptorOptions, a as StandardHandlerOptions, W as WellStandardHandleOptions } from '../../shared/server.
|
1
|
+
import { c as StandardCodec, e as StandardParams, b as StandardMatcher, f as StandardMatchResult } from '../../shared/server.dPmfqnQI.js';
|
2
|
+
export { S as StandardHandleOptions, g as StandardHandleResult, h as StandardHandler, d as StandardHandlerInterceptorOptions, a as StandardHandlerOptions, W as WellStandardHandleOptions } from '../../shared/server.dPmfqnQI.js';
|
3
3
|
import { ORPCError } from '@orpc/client';
|
4
4
|
import { StandardRequest, StandardResponse } from '@orpc/standard-server';
|
5
|
-
import { A as AnyProcedure, a as AnyRouter } from '../../shared/server.
|
5
|
+
import { A as AnyProcedure, a as AnyRouter } from '../../shared/server.Cn9ybJtE.js';
|
6
6
|
import { RPCSerializer } from '@orpc/client/standard';
|
7
|
-
export { R as RPCHandlerOptions } from '../../shared/server.
|
7
|
+
export { R as RPCHandlerOptions } from '../../shared/server.CynXWJja.js';
|
8
8
|
import { HTTPPath } from '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
package/dist/index.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Schema,
|
1
|
+
import { Schema, ErrorMap, Meta, MergedErrorMap, Route, SchemaOutput, SchemaInput, HTTPPath, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, ContractRouterToErrorMap, ContractRouterToMeta, ErrorFromErrorMap, AnyContractProcedure } from '@orpc/contract';
|
2
2
|
export { ValidationError, eventIterator, type } from '@orpc/contract';
|
3
|
-
import { L as Lazy, A as AnyProcedure, C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as ConflictContextGuard, d as MergedContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as ProcedureHandler, i as AdaptRouterOptions, R as Router, j as AdaptedRouter, k as AnyMiddleware, a as AnyRouter, l as Lazyable, I as InferRouterInitialContext } from './shared/server.
|
4
|
-
export { K as AccessibleLazyRouter, F as InferRouterInputs, G as InferRouterOutputs, n as LAZY_LOADER_SYMBOL, o as LazyMeta, p as LazyOptions, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, P as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, H as adaptRouter, N as createAccessibleLazyRouter, E as createProcedureClient, J as getRouterChild, r as isLazy, D as isProcedure, q as lazy, m as mergeContext, y as middlewareOutputFn, u as unlazy } from './shared/server.
|
3
|
+
import { L as Lazy, A as AnyProcedure, C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as ConflictContextGuard, d as MergedContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as ProcedureHandler, i as AdaptRouterOptions, R as Router, j as AdaptedRouter, k as AnyMiddleware, a as AnyRouter, l as Lazyable, I as InferRouterInitialContext } from './shared/server.Cn9ybJtE.mjs';
|
4
|
+
export { K as AccessibleLazyRouter, F as InferRouterInputs, G as InferRouterOutputs, n as LAZY_LOADER_SYMBOL, o as LazyMeta, p as LazyOptions, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, P as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, H as adaptRouter, N as createAccessibleLazyRouter, E as createProcedureClient, J as getRouterChild, r as isLazy, D as isProcedure, q as lazy, m as mergeContext, y as middlewareOutputFn, u as unlazy } from './shared/server.Cn9ybJtE.mjs';
|
5
5
|
import { ClientContext, ClientRest, ClientPromiseResult } from '@orpc/client';
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
7
7
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
@@ -12,12 +12,12 @@ type FlattenLazy<T> = T extends Lazy<infer U> ? FlattenLazy<U> : Lazy<T>;
|
|
12
12
|
declare function flatLazy<T extends Lazy<any>>(lazied: T): FlattenLazy<T>;
|
13
13
|
declare function createLazyProcedureFormAnyLazy(lazied: Lazy<any>): Lazy<AnyProcedure>;
|
14
14
|
|
15
|
-
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
15
|
+
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> {
|
16
16
|
errors<U extends ErrorMap>(errors: U): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, MergedErrorMap<TErrorMap, U>, TMeta>;
|
17
17
|
meta(meta: TMeta): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
18
18
|
route(route: Route): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
19
|
-
use<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>,
|
20
|
-
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput,
|
19
|
+
use<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, U>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, U>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
20
|
+
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
21
21
|
/**
|
22
22
|
* Make this procedure callable (works like a function while still being a procedure).
|
23
23
|
*/
|
@@ -31,12 +31,12 @@ declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContex
|
|
31
31
|
interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
32
32
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
33
33
|
'errors'<U extends ErrorMap>(errors: U): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
34
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
34
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
35
35
|
'meta'(meta: TMeta): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
36
36
|
'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
37
37
|
'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
38
38
|
'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
39
|
-
'handler'<UFuncOutput
|
39
|
+
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, unknown, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
40
40
|
'prefix'(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
41
41
|
'tag'(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
42
42
|
'router'<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
|
@@ -47,31 +47,31 @@ interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContex
|
|
47
47
|
interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
48
48
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
49
49
|
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
50
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
50
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilder<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
51
51
|
'meta'(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
52
52
|
'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
53
53
|
'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
54
54
|
'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
55
|
-
'handler'<UFuncOutput
|
55
|
+
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, unknown, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
56
56
|
}
|
57
57
|
interface ProcedureBuilderWithInput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
58
58
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
59
59
|
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
60
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>,
|
61
|
-
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput,
|
60
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
61
|
+
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
62
62
|
'meta'(meta: TMeta): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
63
63
|
'route'(route: Route): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
64
64
|
'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
65
|
-
'handler'<UFuncOutput
|
65
|
+
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, SchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
66
66
|
}
|
67
67
|
interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
68
68
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
69
69
|
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
70
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
70
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
71
71
|
'meta'(meta: TMeta): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
72
72
|
'route'(route: Route): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
73
73
|
'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
74
|
-
'handler'
|
74
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, unknown, SchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, unknown, TErrorMap, TMeta>;
|
75
75
|
}
|
76
76
|
interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
77
77
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
@@ -80,7 +80,7 @@ interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurr
|
|
80
80
|
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInputOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
81
81
|
'meta'(meta: TMeta): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
82
82
|
'route'(route: Route): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
83
|
-
'handler'
|
83
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, unknown, TErrorMap, TMeta>;
|
84
84
|
}
|
85
85
|
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
86
86
|
'~orpc': AdaptRouterOptions<TErrorMap>;
|
@@ -133,13 +133,13 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
133
133
|
middleware<UOutContext extends Context, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
134
134
|
middleware: Middleware<TCurrentContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TCurrentContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<any>, TMeta>;
|
135
135
|
errors<U extends ErrorMap>(errors: U): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
136
|
-
use<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
137
|
-
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput,
|
136
|
+
use<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
137
|
+
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<unknown, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
138
138
|
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
139
139
|
route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
140
140
|
input<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
141
141
|
output<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
142
|
-
handler<UFuncOutput
|
142
|
+
handler<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, unknown, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
143
143
|
prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
144
144
|
tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
145
145
|
router<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
|
@@ -163,8 +163,9 @@ declare function getLazyRouterPrefix(obj: object): HTTPPath | undefined;
|
|
163
163
|
/**
|
164
164
|
* Like `DecoratedProcedure`, but removed all method that can change the contract.
|
165
165
|
*/
|
166
|
-
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
167
|
-
use
|
166
|
+
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> {
|
167
|
+
use<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, U>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, U>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
168
|
+
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
168
169
|
/**
|
169
170
|
* Make this procedure callable (works like a function while still being a procedure).
|
170
171
|
*/
|
@@ -179,8 +180,9 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
179
180
|
*/
|
180
181
|
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
181
182
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
182
|
-
'use'
|
183
|
-
'
|
183
|
+
'use'<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, U>> & ProcedureImplementer<TInitialContext, MergedContext<TCurrentContext, U>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
184
|
+
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureImplementer<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
185
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, unknown, TErrorMap, TMeta>;
|
184
186
|
}
|
185
187
|
|
186
188
|
interface RouterImplementerWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
@@ -223,7 +225,7 @@ declare function implement<TContract extends AnyContractRouter, TInitialContext
|
|
223
225
|
* ```
|
224
226
|
*
|
225
227
|
*/
|
226
|
-
declare function call<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
228
|
+
declare function call<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, input: SchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, Record<never, never>>>): ClientPromiseResult<SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
|
227
229
|
|
228
230
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Lazy<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UFuncOutput, UErrorMap> : {
|
229
231
|
[K in keyof TRouter]: TRouter[K] extends AnyRouter ? RouterClient<TRouter[K], TClientContext> : never;
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Schema,
|
1
|
+
import { Schema, ErrorMap, Meta, MergedErrorMap, Route, SchemaOutput, SchemaInput, HTTPPath, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, ContractRouterToErrorMap, ContractRouterToMeta, ErrorFromErrorMap, AnyContractProcedure } from '@orpc/contract';
|
2
2
|
export { ValidationError, eventIterator, type } from '@orpc/contract';
|
3
|
-
import { L as Lazy, A as AnyProcedure, C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as ConflictContextGuard, d as MergedContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as ProcedureHandler, i as AdaptRouterOptions, R as Router, j as AdaptedRouter, k as AnyMiddleware, a as AnyRouter, l as Lazyable, I as InferRouterInitialContext } from './shared/server.
|
4
|
-
export { K as AccessibleLazyRouter, F as InferRouterInputs, G as InferRouterOutputs, n as LAZY_LOADER_SYMBOL, o as LazyMeta, p as LazyOptions, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, P as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, H as adaptRouter, N as createAccessibleLazyRouter, E as createProcedureClient, J as getRouterChild, r as isLazy, D as isProcedure, q as lazy, m as mergeContext, y as middlewareOutputFn, u as unlazy } from './shared/server.
|
3
|
+
import { L as Lazy, A as AnyProcedure, C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as ConflictContextGuard, d as MergedContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as ProcedureHandler, i as AdaptRouterOptions, R as Router, j as AdaptedRouter, k as AnyMiddleware, a as AnyRouter, l as Lazyable, I as InferRouterInitialContext } from './shared/server.Cn9ybJtE.js';
|
4
|
+
export { K as AccessibleLazyRouter, F as InferRouterInputs, G as InferRouterOutputs, n as LAZY_LOADER_SYMBOL, o as LazyMeta, p as LazyOptions, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, P as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, H as adaptRouter, N as createAccessibleLazyRouter, E as createProcedureClient, J as getRouterChild, r as isLazy, D as isProcedure, q as lazy, m as mergeContext, y as middlewareOutputFn, u as unlazy } from './shared/server.Cn9ybJtE.js';
|
5
5
|
import { ClientContext, ClientRest, ClientPromiseResult } from '@orpc/client';
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
7
7
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
@@ -12,12 +12,12 @@ type FlattenLazy<T> = T extends Lazy<infer U> ? FlattenLazy<U> : Lazy<T>;
|
|
12
12
|
declare function flatLazy<T extends Lazy<any>>(lazied: T): FlattenLazy<T>;
|
13
13
|
declare function createLazyProcedureFormAnyLazy(lazied: Lazy<any>): Lazy<AnyProcedure>;
|
14
14
|
|
15
|
-
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
15
|
+
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> {
|
16
16
|
errors<U extends ErrorMap>(errors: U): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, MergedErrorMap<TErrorMap, U>, TMeta>;
|
17
17
|
meta(meta: TMeta): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
18
18
|
route(route: Route): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
19
|
-
use<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>,
|
20
|
-
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput,
|
19
|
+
use<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, U>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, U>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
20
|
+
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
21
21
|
/**
|
22
22
|
* Make this procedure callable (works like a function while still being a procedure).
|
23
23
|
*/
|
@@ -31,12 +31,12 @@ declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContex
|
|
31
31
|
interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
32
32
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
33
33
|
'errors'<U extends ErrorMap>(errors: U): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
34
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
34
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
35
35
|
'meta'(meta: TMeta): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
36
36
|
'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
37
37
|
'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
38
38
|
'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
39
|
-
'handler'<UFuncOutput
|
39
|
+
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, unknown, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
40
40
|
'prefix'(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
41
41
|
'tag'(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
42
42
|
'router'<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
|
@@ -47,31 +47,31 @@ interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContex
|
|
47
47
|
interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
48
48
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
49
49
|
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
50
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
50
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilder<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
51
51
|
'meta'(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
52
52
|
'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
53
53
|
'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
54
54
|
'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
55
|
-
'handler'<UFuncOutput
|
55
|
+
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, unknown, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
56
56
|
}
|
57
57
|
interface ProcedureBuilderWithInput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
58
58
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
59
59
|
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
60
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>,
|
61
|
-
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput,
|
60
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
61
|
+
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
62
62
|
'meta'(meta: TMeta): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
63
63
|
'route'(route: Route): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
64
64
|
'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
65
|
-
'handler'<UFuncOutput
|
65
|
+
'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, SchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
66
66
|
}
|
67
67
|
interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
68
68
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
69
69
|
'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
70
|
-
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
70
|
+
'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
71
71
|
'meta'(meta: TMeta): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
72
72
|
'route'(route: Route): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
73
73
|
'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
74
|
-
'handler'
|
74
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, unknown, SchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, unknown, TErrorMap, TMeta>;
|
75
75
|
}
|
76
76
|
interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
77
77
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
@@ -80,7 +80,7 @@ interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurr
|
|
80
80
|
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInputOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
81
81
|
'meta'(meta: TMeta): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
82
82
|
'route'(route: Route): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
83
|
-
'handler'
|
83
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, unknown, TErrorMap, TMeta>;
|
84
84
|
}
|
85
85
|
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
86
86
|
'~orpc': AdaptRouterOptions<TErrorMap>;
|
@@ -133,13 +133,13 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
133
133
|
middleware<UOutContext extends Context, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
134
134
|
middleware: Middleware<TCurrentContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TCurrentContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<any>, TMeta>;
|
135
135
|
errors<U extends ErrorMap>(errors: U): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
136
|
-
use<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext,
|
137
|
-
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput,
|
136
|
+
use<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
137
|
+
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<unknown, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
138
138
|
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
139
139
|
route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
140
140
|
input<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
|
141
141
|
output<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
|
142
|
-
handler<UFuncOutput
|
142
|
+
handler<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, unknown, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
|
143
143
|
prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
144
144
|
tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
145
145
|
router<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
|
@@ -163,8 +163,9 @@ declare function getLazyRouterPrefix(obj: object): HTTPPath | undefined;
|
|
163
163
|
/**
|
164
164
|
* Like `DecoratedProcedure`, but removed all method that can change the contract.
|
165
165
|
*/
|
166
|
-
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
167
|
-
use
|
166
|
+
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> {
|
167
|
+
use<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, U>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, U>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
168
|
+
use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema, THandlerOutput>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & DecoratedProcedure<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
168
169
|
/**
|
169
170
|
* Make this procedure callable (works like a function while still being a procedure).
|
170
171
|
*/
|
@@ -179,8 +180,9 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
|
|
179
180
|
*/
|
180
181
|
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
181
182
|
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
182
|
-
'use'
|
183
|
-
'
|
183
|
+
'use'<U extends Context>(middleware: Middleware<TCurrentContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, U>> & ProcedureImplementer<TInitialContext, MergedContext<TCurrentContext, U>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
184
|
+
'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureImplementer<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
185
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, unknown, TErrorMap, TMeta>;
|
184
186
|
}
|
185
187
|
|
186
188
|
interface RouterImplementerWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
@@ -223,7 +225,7 @@ declare function implement<TContract extends AnyContractRouter, TInitialContext
|
|
223
225
|
* ```
|
224
226
|
*
|
225
227
|
*/
|
226
|
-
declare function call<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
228
|
+
declare function call<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, input: SchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, Record<never, never>>>): ClientPromiseResult<SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
|
227
229
|
|
228
230
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Lazy<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UFuncOutput, UErrorMap> : {
|
229
231
|
[K in keyof TRouter]: TRouter[K] extends AnyRouter ? RouterClient<TRouter[K], TClientContext> : never;
|
package/dist/plugins/index.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { d as StandardHandlerInterceptorOptions, P as Plugin, a as StandardHandlerOptions } from '../shared/server.
|
2
|
-
export { C as CompositePlugin } from '../shared/server.
|
1
|
+
import { d as StandardHandlerInterceptorOptions, P as Plugin, a as StandardHandlerOptions } from '../shared/server.D86dtDX_.mjs';
|
2
|
+
export { C as CompositePlugin } from '../shared/server.D86dtDX_.mjs';
|
3
3
|
import { Value } from '@orpc/shared';
|
4
|
-
import { C as Context } from '../shared/server.
|
4
|
+
import { C as Context } from '../shared/server.Cn9ybJtE.mjs';
|
5
5
|
import '@orpc/contract';
|
6
6
|
import '@orpc/standard-server';
|
7
7
|
import '@orpc/client';
|
package/dist/plugins/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { d as StandardHandlerInterceptorOptions, P as Plugin, a as StandardHandlerOptions } from '../shared/server.
|
2
|
-
export { C as CompositePlugin } from '../shared/server.
|
1
|
+
import { d as StandardHandlerInterceptorOptions, P as Plugin, a as StandardHandlerOptions } from '../shared/server.dPmfqnQI.js';
|
2
|
+
export { C as CompositePlugin } from '../shared/server.dPmfqnQI.js';
|
3
3
|
import { Value } from '@orpc/shared';
|
4
|
-
import { C as Context } from '../shared/server.
|
4
|
+
import { C as Context } from '../shared/server.Cn9ybJtE.js';
|
5
5
|
import '@orpc/contract';
|
6
6
|
import '@orpc/standard-server';
|
7
7
|
import '@orpc/client';
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { C as Context } from './server.
|
2
|
-
import { a as StandardHandlerOptions, b as StandardMatcher, c as StandardCodec } from './server.
|
1
|
+
import { C as Context } from './server.Cn9ybJtE.mjs';
|
2
|
+
import { a as StandardHandlerOptions, b as StandardMatcher, c as StandardCodec } from './server.D86dtDX_.mjs';
|
3
3
|
|
4
4
|
interface RPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T> {
|
5
5
|
matcher?: StandardMatcher;
|
@@ -78,24 +78,24 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
|
|
78
78
|
lastEventId: string | undefined;
|
79
79
|
errors: TErrorConstructorMap;
|
80
80
|
}
|
81
|
-
interface ProcedureHandler<TCurrentContext extends Context,
|
82
|
-
(opt: ProcedureHandlerOptions<TCurrentContext,
|
81
|
+
interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
82
|
+
(opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
|
83
83
|
}
|
84
|
-
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
84
|
+
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
85
85
|
__initialContext?: (type: TInitialContext) => unknown;
|
86
86
|
middlewares: AnyMiddleware[];
|
87
87
|
inputValidationIndex: number;
|
88
88
|
outputValidationIndex: number;
|
89
|
-
handler: ProcedureHandler<TCurrentContext, any,
|
89
|
+
handler: ProcedureHandler<TCurrentContext, any, THandlerOutput, any, any>;
|
90
90
|
}
|
91
|
-
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
91
|
+
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
92
92
|
'~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
93
93
|
constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>);
|
94
94
|
}
|
95
95
|
type AnyProcedure = Procedure<any, any, any, any, any, any, any>;
|
96
96
|
declare function isProcedure(item: unknown): item is AnyProcedure;
|
97
97
|
|
98
|
-
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
98
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
|
99
99
|
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TInputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
100
100
|
context: TInitialContext;
|
101
101
|
input: SchemaInput<TInputSchema>;
|
@@ -108,7 +108,7 @@ interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TIn
|
|
108
108
|
/**
|
109
109
|
* Options for creating a procedure caller with comprehensive type safety
|
110
110
|
*/
|
111
|
-
type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
111
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
|
112
112
|
/**
|
113
113
|
* This is helpful for logging and analytics.
|
114
114
|
*/
|
@@ -119,7 +119,7 @@ type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema
|
|
119
119
|
} : {
|
120
120
|
context: Value<TInitialContext, [clientContext: TClientContext]>;
|
121
121
|
});
|
122
|
-
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
122
|
+
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
|
123
123
|
|
124
124
|
type AccessibleLazyRouter<T extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : Lazy<T> & (T extends AnyProcedure | undefined ? unknown : {
|
125
125
|
[K in keyof T]: T[K] extends AnyRouter ? AccessibleLazyRouter<T[K]> : never;
|
@@ -78,24 +78,24 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
|
|
78
78
|
lastEventId: string | undefined;
|
79
79
|
errors: TErrorConstructorMap;
|
80
80
|
}
|
81
|
-
interface ProcedureHandler<TCurrentContext extends Context,
|
82
|
-
(opt: ProcedureHandlerOptions<TCurrentContext,
|
81
|
+
interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
82
|
+
(opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
|
83
83
|
}
|
84
|
-
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
84
|
+
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
85
85
|
__initialContext?: (type: TInitialContext) => unknown;
|
86
86
|
middlewares: AnyMiddleware[];
|
87
87
|
inputValidationIndex: number;
|
88
88
|
outputValidationIndex: number;
|
89
|
-
handler: ProcedureHandler<TCurrentContext, any,
|
89
|
+
handler: ProcedureHandler<TCurrentContext, any, THandlerOutput, any, any>;
|
90
90
|
}
|
91
|
-
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
91
|
+
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
92
92
|
'~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
|
93
93
|
constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>);
|
94
94
|
}
|
95
95
|
type AnyProcedure = Procedure<any, any, any, any, any, any, any>;
|
96
96
|
declare function isProcedure(item: unknown): item is AnyProcedure;
|
97
97
|
|
98
|
-
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
98
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
|
99
99
|
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TInputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
100
100
|
context: TInitialContext;
|
101
101
|
input: SchemaInput<TInputSchema>;
|
@@ -108,7 +108,7 @@ interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TIn
|
|
108
108
|
/**
|
109
109
|
* Options for creating a procedure caller with comprehensive type safety
|
110
110
|
*/
|
111
|
-
type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
111
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
|
112
112
|
/**
|
113
113
|
* This is helpful for logging and analytics.
|
114
114
|
*/
|
@@ -119,7 +119,7 @@ type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema
|
|
119
119
|
} : {
|
120
120
|
context: Value<TInitialContext, [clientContext: TClientContext]>;
|
121
121
|
});
|
122
|
-
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput
|
122
|
+
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
|
123
123
|
|
124
124
|
type AccessibleLazyRouter<T extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : Lazy<T> & (T extends AnyProcedure | undefined ? unknown : {
|
125
125
|
[K in keyof T]: T[K] extends AnyRouter ? AccessibleLazyRouter<T[K]> : never;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { C as Context } from './server.
|
2
|
-
import { a as StandardHandlerOptions, b as StandardMatcher, c as StandardCodec } from './server.
|
1
|
+
import { C as Context } from './server.Cn9ybJtE.js';
|
2
|
+
import { a as StandardHandlerOptions, b as StandardMatcher, c as StandardCodec } from './server.dPmfqnQI.js';
|
3
3
|
|
4
4
|
interface RPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T> {
|
5
5
|
matcher?: StandardMatcher;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { HTTPPath, Schema, Meta, SchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { StandardResponse, StandardRequest } from '@orpc/standard-server';
|
4
|
-
import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.
|
4
|
+
import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.Cn9ybJtE.mjs';
|
5
5
|
import { ORPCError } from '@orpc/client';
|
6
6
|
|
7
7
|
type StandardParams = Record<string, string>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { HTTPPath, Schema, Meta, SchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { StandardResponse, StandardRequest } from '@orpc/standard-server';
|
4
|
-
import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.
|
4
|
+
import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.Cn9ybJtE.js';
|
5
5
|
import { ORPCError } from '@orpc/client';
|
6
6
|
|
7
7
|
type StandardParams = Record<string, string>;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.45.1",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -58,12 +58,12 @@
|
|
58
58
|
"next": ">=14.0.0"
|
59
59
|
},
|
60
60
|
"dependencies": {
|
61
|
-
"@orpc/client": "0.
|
62
|
-
"@orpc/contract": "0.
|
63
|
-
"@orpc/shared": "0.
|
64
|
-
"@orpc/standard-server": "0.
|
65
|
-
"@orpc/standard-server-fetch": "0.
|
66
|
-
"@orpc/standard-server-node": "0.
|
61
|
+
"@orpc/client": "0.45.1",
|
62
|
+
"@orpc/contract": "0.45.1",
|
63
|
+
"@orpc/shared": "0.45.1",
|
64
|
+
"@orpc/standard-server": "0.45.1",
|
65
|
+
"@orpc/standard-server-fetch": "0.45.1",
|
66
|
+
"@orpc/standard-server-node": "0.45.1"
|
67
67
|
},
|
68
68
|
"devDependencies": {
|
69
69
|
"light-my-request": "^6.5.1"
|