@orpc/server 0.0.0-next.6c5bfe4 → 0.0.0-next.7134cf9
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/README.md +5 -1
- package/dist/adapters/fetch/index.d.mts +5 -3
- package/dist/adapters/fetch/index.d.ts +5 -3
- package/dist/adapters/fetch/index.mjs +4 -4
- package/dist/adapters/hono/index.d.mts +4 -2
- package/dist/adapters/hono/index.d.ts +4 -2
- package/dist/adapters/hono/index.mjs +4 -4
- package/dist/adapters/next/index.d.mts +4 -2
- package/dist/adapters/next/index.d.ts +4 -2
- package/dist/adapters/next/index.mjs +4 -4
- package/dist/adapters/node/index.d.mts +5 -3
- package/dist/adapters/node/index.d.ts +5 -3
- package/dist/adapters/node/index.mjs +8 -7
- package/dist/adapters/standard/index.d.mts +9 -8
- package/dist/adapters/standard/index.d.ts +9 -8
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/index.d.mts +58 -50
- package/dist/index.d.ts +58 -50
- package/dist/index.mjs +29 -26
- package/dist/plugins/index.d.mts +9 -9
- package/dist/plugins/index.d.ts +9 -9
- package/dist/plugins/index.mjs +2 -2
- package/dist/shared/{server.N2ttmv6r.mjs → server.BY9sDlwl.mjs} +6 -6
- package/dist/shared/server.BqBN5WhH.d.mts +8 -0
- package/dist/shared/{server.kPUGzsdw.mjs → server.BtxZnWJ9.mjs} +32 -15
- package/dist/shared/{server.BZRSVRDu.d.ts → server.CPqNKiJp.d.ts} +5 -7
- package/dist/shared/{server.Q6ZmnTgO.mjs → server.Dba3Iiyp.mjs} +2 -2
- package/dist/shared/{server.CXu_v2vM.mjs → server.Del5OmaY.mjs} +6 -5
- package/dist/shared/server.Dm3ZuTuI.d.ts +8 -0
- package/dist/shared/{server.CPteJIPP.d.mts → server.MZvbGc3n.d.mts} +11 -11
- package/dist/shared/{server.CPteJIPP.d.ts → server.MZvbGc3n.d.ts} +11 -11
- package/dist/shared/{server.iM8li30u.d.mts → server.P4_D9lKb.d.mts} +5 -7
- package/package.json +7 -7
@@ -21,19 +21,25 @@ function unlazy(lazied) {
|
|
21
21
|
return isLazy(lazied) ? lazied[LAZY_SYMBOL].loader() : Promise.resolve({ default: lazied });
|
22
22
|
}
|
23
23
|
|
24
|
-
function
|
25
|
-
|
24
|
+
function isStartWithMiddlewares(middlewares, compare) {
|
25
|
+
if (compare.length > middlewares.length) {
|
26
|
+
return false;
|
27
|
+
}
|
26
28
|
for (let i = 0; i < middlewares.length; i++) {
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
if (compare[i] === void 0) {
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
if (middlewares[i] !== compare[i]) {
|
33
|
+
return false;
|
30
34
|
}
|
31
|
-
min = index + 1;
|
32
35
|
}
|
33
|
-
return
|
36
|
+
return true;
|
34
37
|
}
|
35
|
-
function mergeMiddlewares(first, second) {
|
36
|
-
|
38
|
+
function mergeMiddlewares(first, second, options) {
|
39
|
+
if (options.dedupeLeading && isStartWithMiddlewares(second, first)) {
|
40
|
+
return second;
|
41
|
+
}
|
42
|
+
return [...first, ...second];
|
37
43
|
}
|
38
44
|
function addMiddleware(middlewares, addition) {
|
39
45
|
return [...middlewares, addition];
|
@@ -52,6 +58,10 @@ function isProcedure(item) {
|
|
52
58
|
return isContractProcedure(item) && "middlewares" in item["~orpc"] && "inputValidationIndex" in item["~orpc"] && "outputValidationIndex" in item["~orpc"] && "handler" in item["~orpc"];
|
53
59
|
}
|
54
60
|
|
61
|
+
function mergeCurrentContext(context, other) {
|
62
|
+
return { ...context, ...other };
|
63
|
+
}
|
64
|
+
|
55
65
|
function createORPCErrorConstructorMap(errors) {
|
56
66
|
const proxy = new Proxy(errors, {
|
57
67
|
get(target, code) {
|
@@ -164,23 +174,30 @@ async function executeProcedureInternal(procedure, options) {
|
|
164
174
|
let currentInput = options.input;
|
165
175
|
const next = async (...[nextOptions]) => {
|
166
176
|
const index = currentIndex;
|
177
|
+
const midContext = nextOptions?.context ?? {};
|
167
178
|
currentIndex += 1;
|
168
|
-
currentContext =
|
179
|
+
currentContext = mergeCurrentContext(currentContext, midContext);
|
169
180
|
if (index === inputValidationIndex) {
|
170
181
|
currentInput = await validateInput(procedure, currentInput);
|
171
182
|
}
|
172
183
|
const mid = middlewares[index];
|
173
|
-
const result = mid ?
|
184
|
+
const result = mid ? {
|
185
|
+
context: midContext,
|
186
|
+
output: (await mid({ ...options, context: currentContext, next }, currentInput, middlewareOutputFn)).output
|
187
|
+
} : {
|
188
|
+
context: midContext,
|
189
|
+
output: await procedure["~orpc"].handler({ ...options, context: currentContext, input: currentInput })
|
190
|
+
};
|
174
191
|
if (index === outputValidationIndex) {
|
175
192
|
const validatedOutput = await validateOutput(procedure, result.output);
|
176
193
|
return {
|
177
|
-
|
194
|
+
context: result.context,
|
178
195
|
output: validatedOutput
|
179
196
|
};
|
180
197
|
}
|
181
198
|
return result;
|
182
199
|
};
|
183
|
-
return (await next(
|
200
|
+
return (await next()).output;
|
184
201
|
}
|
185
202
|
|
186
203
|
const HIDDEN_ROUTER_CONTRACT_SYMBOL = Symbol("ORPC_HIDDEN_ROUTER_CONTRACT");
|
@@ -250,7 +267,7 @@ function enhanceRouter(router, options) {
|
|
250
267
|
return accessible;
|
251
268
|
}
|
252
269
|
if (isProcedure(router)) {
|
253
|
-
const newMiddlewares = mergeMiddlewares(options.middlewares, router["~orpc"].middlewares);
|
270
|
+
const newMiddlewares = mergeMiddlewares(options.middlewares, router["~orpc"].middlewares, { dedupeLeading: options.dedupeLeadingMiddlewares });
|
254
271
|
const newMiddlewareAdded = newMiddlewares.length - router["~orpc"].middlewares.length;
|
255
272
|
const enhanced2 = new Procedure({
|
256
273
|
...router["~orpc"],
|
@@ -354,4 +371,4 @@ function toHttpPath(path) {
|
|
354
371
|
return `/${path.map(encodeURIComponent).join("/")}`;
|
355
372
|
}
|
356
373
|
|
357
|
-
export { LAZY_SYMBOL as L, Procedure as P, toHttpPath as a, createContractedProcedure as b, createProcedureClient as c, addMiddleware as d, enhanceRouter as e, isLazy as f, getRouter as g, createAssertedLazyProcedure as h, isProcedure as i,
|
374
|
+
export { LAZY_SYMBOL as L, Procedure as P, toHttpPath as a, createContractedProcedure as b, createProcedureClient as c, addMiddleware as d, enhanceRouter as e, isLazy as f, getRouter as g, createAssertedLazyProcedure as h, isProcedure as i, createORPCErrorConstructorMap as j, getLazyMeta as k, lazy as l, mergeCurrentContext as m, middlewareOutputFn as n, isStartWithMiddlewares as o, mergeMiddlewares as p, call as q, getHiddenRouterContract as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u, validateORPCError as v, createAccessibleLazyRouter as w, resolveContractProcedures as x, unlazyRouter as y };
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { HTTPPath, AnySchema, Meta, InferSchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { StandardResponse, StandardLazyRequest } 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.MZvbGc3n.js';
|
5
5
|
import { ORPCError } from '@orpc/client';
|
6
6
|
|
7
7
|
type StandardParams = Record<string, string>;
|
@@ -27,9 +27,6 @@ type StandardHandleOptions<T extends Context> = {
|
|
27
27
|
} : {
|
28
28
|
context: T;
|
29
29
|
});
|
30
|
-
type WellStandardHandleOptions<T extends Context> = StandardHandleOptions<T> & {
|
31
|
-
context: T;
|
32
|
-
};
|
33
30
|
type StandardHandleResult = {
|
34
31
|
matched: true;
|
35
32
|
response: StandardResponse;
|
@@ -37,7 +34,8 @@ type StandardHandleResult = {
|
|
37
34
|
matched: false;
|
38
35
|
response: undefined;
|
39
36
|
};
|
40
|
-
type StandardHandlerInterceptorOptions<
|
37
|
+
type StandardHandlerInterceptorOptions<T extends Context> = StandardHandleOptions<T> & {
|
38
|
+
context: T;
|
41
39
|
request: StandardLazyRequest;
|
42
40
|
};
|
43
41
|
interface StandardHandlerOptions<TContext extends Context> {
|
@@ -68,10 +66,10 @@ declare class StandardHandler<T extends Context> {
|
|
68
66
|
interface HandlerPlugin<TContext extends Context> {
|
69
67
|
init?(options: StandardHandlerOptions<TContext>): void;
|
70
68
|
}
|
71
|
-
declare class
|
69
|
+
declare class CompositeHandlerPlugin<TContext extends Context> implements HandlerPlugin<TContext> {
|
72
70
|
private readonly plugins;
|
73
71
|
constructor(plugins?: HandlerPlugin<TContext>[]);
|
74
72
|
init(options: StandardHandlerOptions<TContext>): void;
|
75
73
|
}
|
76
74
|
|
77
|
-
export {
|
75
|
+
export { CompositeHandlerPlugin as C, type HandlerPlugin as H, type StandardHandleOptions as S, type StandardHandlerOptions as a, type StandardHandlerInterceptorOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleResult as g, StandardHandler as h };
|
@@ -1,13 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import { StandardRPCJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
|
2
2
|
import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fetch';
|
3
|
-
import { S as StandardHandler,
|
3
|
+
import { S as StandardHandler, b as StandardRPCMatcher, a as StandardRPCCodec } from './server.BY9sDlwl.mjs';
|
4
4
|
|
5
5
|
class RPCHandler {
|
6
6
|
standardHandler;
|
7
7
|
constructor(router, options = {}) {
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
8
|
+
const jsonSerializer = new StandardRPCJsonSerializer(options);
|
9
|
+
const serializer = new StandardRPCSerializer(jsonSerializer);
|
10
|
+
const matcher = new StandardRPCMatcher();
|
11
|
+
const codec = new StandardRPCCodec(serializer);
|
11
12
|
this.standardHandler = new StandardHandler(router, matcher, codec, options);
|
12
13
|
}
|
13
14
|
async handle(request, ...[
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
2
|
+
import { C as Context } from './server.MZvbGc3n.js';
|
3
|
+
import { a as StandardHandlerOptions } from './server.CPqNKiJp.js';
|
4
|
+
|
5
|
+
interface StandardRPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardRPCJsonSerializerOptions {
|
6
|
+
}
|
7
|
+
|
8
|
+
export type { StandardRPCHandlerOptions as S };
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import { ORPCErrorCode, ORPCErrorOptions, ORPCError, ClientContext, Client } from '@orpc/client';
|
2
|
-
import {
|
2
|
+
import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
|
3
3
|
import { ErrorMap, ErrorMapItem, InferSchemaInput, HTTPPath, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
|
4
4
|
|
5
5
|
type Context = Record<string, any>;
|
6
|
-
type
|
7
|
-
|
8
|
-
|
9
|
-
[K in keyof T]: IsNever<T[K]>;
|
10
|
-
}[keyof T] ? never : unknown;
|
6
|
+
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
7
|
+
type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
|
8
|
+
declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
|
11
9
|
|
12
10
|
type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
|
13
11
|
type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
|
14
12
|
type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
15
13
|
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
16
14
|
};
|
15
|
+
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
16
|
+
declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
|
17
17
|
|
18
18
|
declare const LAZY_SYMBOL: unique symbol;
|
19
19
|
interface LazyMeta {
|
@@ -51,7 +51,7 @@ interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutp
|
|
51
51
|
}
|
52
52
|
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
53
53
|
__initialContext?: (type: TInitialContext) => unknown;
|
54
|
-
middlewares: AnyMiddleware[];
|
54
|
+
middlewares: readonly AnyMiddleware[];
|
55
55
|
inputValidationIndex: number;
|
56
56
|
outputValidationIndex: number;
|
57
57
|
handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
|
@@ -72,8 +72,8 @@ type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never>
|
|
72
72
|
} : {
|
73
73
|
context: TOutContext;
|
74
74
|
};
|
75
|
-
interface MiddlewareNextFn<
|
76
|
-
<U extends Context
|
75
|
+
interface MiddlewareNextFn<TOutput> {
|
76
|
+
<U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
|
77
77
|
}
|
78
78
|
interface MiddlewareOutputFn<TOutput> {
|
79
79
|
(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
@@ -84,7 +84,7 @@ interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstruct
|
|
84
84
|
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
85
85
|
signal?: AbortSignal;
|
86
86
|
lastEventId: string | undefined;
|
87
|
-
next: MiddlewareNextFn<
|
87
|
+
next: MiddlewareNextFn<TOutput>;
|
88
88
|
errors: TErrorConstructorMap;
|
89
89
|
}
|
90
90
|
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
@@ -140,4 +140,4 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
140
140
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
141
141
|
};
|
142
142
|
|
143
|
-
export { type AnyProcedure as A,
|
143
|
+
export { type AnyProcedure as A, middlewareOutputFn as B, type Context as C, type ProcedureHandlerOptions as D, type ProcedureDef as E, isProcedure as F, createProcedureClient as G, type InferRouterInitialContexts as H, type InferRouterInitialContext as I, type InferRouterCurrentContexts as J, type InferRouterInputs as K, type Lazyable as L, type Middleware as M, type InferRouterOutputs as N, type ORPCErrorConstructorMap as O, type ProcedureClientInterceptorOptions as P, type Router as R, type AnyRouter as a, Procedure as b, type MergedInitialContext as c, type MergedCurrentContext as d, type MapInputMiddleware as e, type CreateProcedureClientOptions as f, type ProcedureClient as g, type AnyMiddleware as h, type Lazy as i, type ProcedureHandler as j, type ORPCErrorConstructorMapItemOptions as k, type ORPCErrorConstructorMapItem as l, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, type LazyMeta as p, lazy as q, isLazy as r, getLazyMeta as s, type MiddlewareResult as t, unlazy as u, validateORPCError as v, type MiddlewareNextFnOptions as w, type MiddlewareNextFn as x, type MiddlewareOutputFn as y, type MiddlewareOptions as z };
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import { ORPCErrorCode, ORPCErrorOptions, ORPCError, ClientContext, Client } from '@orpc/client';
|
2
|
-
import {
|
2
|
+
import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
|
3
3
|
import { ErrorMap, ErrorMapItem, InferSchemaInput, HTTPPath, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
|
4
4
|
|
5
5
|
type Context = Record<string, any>;
|
6
|
-
type
|
7
|
-
|
8
|
-
|
9
|
-
[K in keyof T]: IsNever<T[K]>;
|
10
|
-
}[keyof T] ? never : unknown;
|
6
|
+
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
7
|
+
type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
|
8
|
+
declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
|
11
9
|
|
12
10
|
type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
|
13
11
|
type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
|
14
12
|
type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
15
13
|
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
16
14
|
};
|
15
|
+
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
16
|
+
declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
|
17
17
|
|
18
18
|
declare const LAZY_SYMBOL: unique symbol;
|
19
19
|
interface LazyMeta {
|
@@ -51,7 +51,7 @@ interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutp
|
|
51
51
|
}
|
52
52
|
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
53
53
|
__initialContext?: (type: TInitialContext) => unknown;
|
54
|
-
middlewares: AnyMiddleware[];
|
54
|
+
middlewares: readonly AnyMiddleware[];
|
55
55
|
inputValidationIndex: number;
|
56
56
|
outputValidationIndex: number;
|
57
57
|
handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
|
@@ -72,8 +72,8 @@ type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never>
|
|
72
72
|
} : {
|
73
73
|
context: TOutContext;
|
74
74
|
};
|
75
|
-
interface MiddlewareNextFn<
|
76
|
-
<U extends Context
|
75
|
+
interface MiddlewareNextFn<TOutput> {
|
76
|
+
<U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
|
77
77
|
}
|
78
78
|
interface MiddlewareOutputFn<TOutput> {
|
79
79
|
(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
@@ -84,7 +84,7 @@ interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstruct
|
|
84
84
|
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
85
85
|
signal?: AbortSignal;
|
86
86
|
lastEventId: string | undefined;
|
87
|
-
next: MiddlewareNextFn<
|
87
|
+
next: MiddlewareNextFn<TOutput>;
|
88
88
|
errors: TErrorConstructorMap;
|
89
89
|
}
|
90
90
|
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
@@ -140,4 +140,4 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
140
140
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
141
141
|
};
|
142
142
|
|
143
|
-
export { type AnyProcedure as A,
|
143
|
+
export { type AnyProcedure as A, middlewareOutputFn as B, type Context as C, type ProcedureHandlerOptions as D, type ProcedureDef as E, isProcedure as F, createProcedureClient as G, type InferRouterInitialContexts as H, type InferRouterInitialContext as I, type InferRouterCurrentContexts as J, type InferRouterInputs as K, type Lazyable as L, type Middleware as M, type InferRouterOutputs as N, type ORPCErrorConstructorMap as O, type ProcedureClientInterceptorOptions as P, type Router as R, type AnyRouter as a, Procedure as b, type MergedInitialContext as c, type MergedCurrentContext as d, type MapInputMiddleware as e, type CreateProcedureClientOptions as f, type ProcedureClient as g, type AnyMiddleware as h, type Lazy as i, type ProcedureHandler as j, type ORPCErrorConstructorMapItemOptions as k, type ORPCErrorConstructorMapItem as l, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, type LazyMeta as p, lazy as q, isLazy as r, getLazyMeta as s, type MiddlewareResult as t, unlazy as u, validateORPCError as v, type MiddlewareNextFnOptions as w, type MiddlewareNextFn as x, type MiddlewareOutputFn as y, type MiddlewareOptions as z };
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { HTTPPath, AnySchema, Meta, InferSchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { StandardResponse, StandardLazyRequest } 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.MZvbGc3n.mjs';
|
5
5
|
import { ORPCError } from '@orpc/client';
|
6
6
|
|
7
7
|
type StandardParams = Record<string, string>;
|
@@ -27,9 +27,6 @@ type StandardHandleOptions<T extends Context> = {
|
|
27
27
|
} : {
|
28
28
|
context: T;
|
29
29
|
});
|
30
|
-
type WellStandardHandleOptions<T extends Context> = StandardHandleOptions<T> & {
|
31
|
-
context: T;
|
32
|
-
};
|
33
30
|
type StandardHandleResult = {
|
34
31
|
matched: true;
|
35
32
|
response: StandardResponse;
|
@@ -37,7 +34,8 @@ type StandardHandleResult = {
|
|
37
34
|
matched: false;
|
38
35
|
response: undefined;
|
39
36
|
};
|
40
|
-
type StandardHandlerInterceptorOptions<
|
37
|
+
type StandardHandlerInterceptorOptions<T extends Context> = StandardHandleOptions<T> & {
|
38
|
+
context: T;
|
41
39
|
request: StandardLazyRequest;
|
42
40
|
};
|
43
41
|
interface StandardHandlerOptions<TContext extends Context> {
|
@@ -68,10 +66,10 @@ declare class StandardHandler<T extends Context> {
|
|
68
66
|
interface HandlerPlugin<TContext extends Context> {
|
69
67
|
init?(options: StandardHandlerOptions<TContext>): void;
|
70
68
|
}
|
71
|
-
declare class
|
69
|
+
declare class CompositeHandlerPlugin<TContext extends Context> implements HandlerPlugin<TContext> {
|
72
70
|
private readonly plugins;
|
73
71
|
constructor(plugins?: HandlerPlugin<TContext>[]);
|
74
72
|
init(options: StandardHandlerOptions<TContext>): void;
|
75
73
|
}
|
76
74
|
|
77
|
-
export {
|
75
|
+
export { CompositeHandlerPlugin as C, type HandlerPlugin as H, type StandardHandleOptions as S, type StandardHandlerOptions as a, type StandardHandlerInterceptorOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleResult as g, StandardHandler as h };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next.
|
4
|
+
"version": "0.0.0-next.7134cf9",
|
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.0.0-next.
|
62
|
-
"@orpc/contract": "0.0.0-next.
|
63
|
-
"@orpc/
|
64
|
-
"@orpc/
|
65
|
-
"@orpc/standard-server-node": "0.0.0-next.
|
66
|
-
"@orpc/standard-server-fetch": "0.0.0-next.
|
61
|
+
"@orpc/client": "0.0.0-next.7134cf9",
|
62
|
+
"@orpc/contract": "0.0.0-next.7134cf9",
|
63
|
+
"@orpc/shared": "0.0.0-next.7134cf9",
|
64
|
+
"@orpc/standard-server": "0.0.0-next.7134cf9",
|
65
|
+
"@orpc/standard-server-node": "0.0.0-next.7134cf9",
|
66
|
+
"@orpc/standard-server-fetch": "0.0.0-next.7134cf9"
|
67
67
|
},
|
68
68
|
"devDependencies": {
|
69
69
|
"light-my-request": "^6.5.1"
|