@orpc/server 0.0.0-next.dc23561 → 0.0.0-next.dc2afcb
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 +11 -8
- package/dist/adapters/aws-lambda/index.d.mts +7 -7
- package/dist/adapters/aws-lambda/index.d.ts +7 -7
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/bun-ws/index.d.mts +7 -7
- package/dist/adapters/bun-ws/index.d.ts +7 -7
- package/dist/adapters/bun-ws/index.mjs +2 -2
- package/dist/adapters/crossws/index.d.mts +7 -7
- package/dist/adapters/crossws/index.d.ts +7 -7
- package/dist/adapters/crossws/index.mjs +2 -2
- package/dist/adapters/fastify/index.d.mts +53 -0
- package/dist/adapters/fastify/index.d.ts +53 -0
- package/dist/adapters/fastify/index.mjs +54 -0
- package/dist/adapters/fetch/index.d.mts +10 -10
- package/dist/adapters/fetch/index.d.ts +10 -10
- package/dist/adapters/fetch/index.mjs +5 -4
- package/dist/adapters/message-port/index.d.mts +37 -11
- package/dist/adapters/message-port/index.d.ts +37 -11
- package/dist/adapters/message-port/index.mjs +28 -12
- package/dist/adapters/node/index.d.mts +11 -11
- package/dist/adapters/node/index.d.ts +11 -11
- package/dist/adapters/node/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +6 -6
- package/dist/adapters/standard/index.d.ts +6 -6
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/adapters/standard-peer/index.d.mts +3 -3
- package/dist/adapters/standard-peer/index.d.ts +3 -3
- package/dist/adapters/websocket/index.d.mts +11 -9
- package/dist/adapters/websocket/index.d.ts +11 -9
- package/dist/adapters/websocket/index.mjs +2 -2
- package/dist/adapters/ws/index.d.mts +7 -7
- package/dist/adapters/ws/index.d.ts +7 -7
- package/dist/adapters/ws/index.mjs +2 -2
- package/dist/helpers/index.d.mts +16 -1
- package/dist/helpers/index.d.ts +16 -1
- package/dist/helpers/index.mjs +11 -1
- package/dist/hibernation/index.d.mts +4 -4
- package/dist/hibernation/index.d.ts +4 -4
- package/dist/index.d.mts +102 -102
- package/dist/index.d.ts +102 -102
- package/dist/index.mjs +33 -30
- package/dist/plugins/index.d.mts +46 -11
- package/dist/plugins/index.d.ts +46 -11
- package/dist/plugins/index.mjs +55 -12
- package/dist/shared/{server.Bmh5xd4n.d.ts → server.7cEtMB30.d.ts} +1 -1
- package/dist/shared/{server.BEFBl-Cb.d.mts → server.B8gYOD5g.d.mts} +2 -2
- package/dist/shared/{server.gqRxT-yN.d.mts → server.BqadksTP.d.mts} +1 -1
- package/dist/shared/{server.BHZCyRuJ.mjs → server.Bxx6tqNe.mjs} +1 -1
- package/dist/shared/{server.DhJj-1X9.d.mts → server.C8_sRzQB.d.mts} +1 -1
- package/dist/shared/{server.BU4WI18A.d.mts → server.ChUyt5-i.d.mts} +3 -3
- package/dist/shared/{server.jMTkVNIb.d.ts → server.ChyoA9XY.d.ts} +1 -1
- package/dist/shared/{server.7jWaIryJ.mjs → server.Ds4HPpvH.mjs} +16 -23
- package/dist/shared/{server.B7b2w3_i.d.ts → server.EfTOZ2Q7.d.ts} +2 -2
- package/dist/shared/{server.BW-nUGgA.mjs → server.TEVCLCFC.mjs} +3 -0
- package/dist/shared/{server.CYNGeoCm.d.mts → server.qKsRrdxW.d.mts} +10 -11
- package/dist/shared/{server.CYNGeoCm.d.ts → server.qKsRrdxW.d.ts} +10 -11
- package/dist/shared/{server.D0H-iaY3.d.ts → server.yoEB3Fx4.d.ts} +3 -3
- package/package.json +25 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isContractProcedure, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
|
|
2
|
-
import { resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, asyncIteratorWithSpan } from '@orpc/shared';
|
|
3
|
-
import { ORPCError,
|
|
1
|
+
import { isContractProcedure, validateORPCError, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
|
|
2
|
+
import { resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, overlayProxy, asyncIteratorWithSpan } from '@orpc/shared';
|
|
3
|
+
import { ORPCError, mapEventIterator } from '@orpc/client';
|
|
4
4
|
import { HibernationEventIterator } from '@orpc/standard-server';
|
|
5
5
|
|
|
6
6
|
const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
|
|
@@ -88,21 +88,6 @@ function createORPCErrorConstructorMap(errors) {
|
|
|
88
88
|
});
|
|
89
89
|
return proxy;
|
|
90
90
|
}
|
|
91
|
-
async function validateORPCError(map, error) {
|
|
92
|
-
const { code, status, message, data, cause, defined } = error;
|
|
93
|
-
const config = map?.[error.code];
|
|
94
|
-
if (!config || fallbackORPCErrorStatus(error.code, config.status) !== error.status) {
|
|
95
|
-
return defined ? new ORPCError(code, { defined: false, status, message, data, cause }) : error;
|
|
96
|
-
}
|
|
97
|
-
if (!config.data) {
|
|
98
|
-
return defined ? error : new ORPCError(code, { defined: true, status, message, data, cause });
|
|
99
|
-
}
|
|
100
|
-
const validated = await config.data["~standard"].validate(error.data);
|
|
101
|
-
if (validated.issues) {
|
|
102
|
-
return defined ? new ORPCError(code, { defined: false, status, message, data, cause }) : error;
|
|
103
|
-
}
|
|
104
|
-
return new ORPCError(code, { defined: true, status, message, data: validated.value, cause });
|
|
105
|
-
}
|
|
106
91
|
|
|
107
92
|
function middlewareOutputFn(output) {
|
|
108
93
|
return { output, context: {} };
|
|
@@ -147,7 +132,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
147
132
|
if (output instanceof HibernationEventIterator) {
|
|
148
133
|
return output;
|
|
149
134
|
}
|
|
150
|
-
return mapEventIterator(
|
|
135
|
+
return overlayProxy(output, mapEventIterator(
|
|
151
136
|
asyncIteratorWithSpan(
|
|
152
137
|
{ name: "consume_event_iterator_output", signal: callerOptions?.signal },
|
|
153
138
|
output
|
|
@@ -156,7 +141,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
156
141
|
value: (v) => v,
|
|
157
142
|
error: (e) => validateError(e)
|
|
158
143
|
}
|
|
159
|
-
);
|
|
144
|
+
));
|
|
160
145
|
}
|
|
161
146
|
return output;
|
|
162
147
|
} catch (e) {
|
|
@@ -179,7 +164,11 @@ async function validateInput(procedure, input) {
|
|
|
179
164
|
data: {
|
|
180
165
|
issues: result.issues
|
|
181
166
|
},
|
|
182
|
-
cause: new ValidationError({
|
|
167
|
+
cause: new ValidationError({
|
|
168
|
+
message: "Input validation failed",
|
|
169
|
+
issues: result.issues,
|
|
170
|
+
data: input
|
|
171
|
+
})
|
|
183
172
|
});
|
|
184
173
|
}
|
|
185
174
|
return result.value;
|
|
@@ -198,7 +187,11 @@ async function validateOutput(procedure, output) {
|
|
|
198
187
|
if (result.issues) {
|
|
199
188
|
throw new ORPCError("INTERNAL_SERVER_ERROR", {
|
|
200
189
|
message: "Output validation failed",
|
|
201
|
-
cause: new ValidationError({
|
|
190
|
+
cause: new ValidationError({
|
|
191
|
+
message: "Output validation failed",
|
|
192
|
+
issues: result.issues,
|
|
193
|
+
data: output
|
|
194
|
+
})
|
|
202
195
|
});
|
|
203
196
|
}
|
|
204
197
|
return result.value;
|
|
@@ -413,4 +406,4 @@ function call(procedure, input, ...rest) {
|
|
|
413
406
|
return createProcedureClient(procedure, options)(input, options);
|
|
414
407
|
}
|
|
415
408
|
|
|
416
|
-
export { LAZY_SYMBOL as L, Procedure as P, createContractedProcedure as a, addMiddleware as b, createProcedureClient as c, isLazy as d, enhanceRouter as e, createAssertedLazyProcedure as f, getRouter as g, createORPCErrorConstructorMap as h, isProcedure as i, getLazyMeta as j, middlewareOutputFn as k, lazy as l, mergeCurrentContext as m, isStartWithMiddlewares as n, mergeMiddlewares as o, call as p, getHiddenRouterContract as q, createAccessibleLazyRouter as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u,
|
|
409
|
+
export { LAZY_SYMBOL as L, Procedure as P, createContractedProcedure as a, addMiddleware as b, createProcedureClient as c, isLazy as d, enhanceRouter as e, createAssertedLazyProcedure as f, getRouter as g, createORPCErrorConstructorMap as h, isProcedure as i, getLazyMeta as j, middlewareOutputFn as k, lazy as l, mergeCurrentContext as m, isStartWithMiddlewares as n, mergeMiddlewares as o, call as p, getHiddenRouterContract as q, createAccessibleLazyRouter as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u, resolveContractProcedures as v, unlazyRouter as w };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Context } from './server.
|
|
2
|
-
import { b as StandardHandleOptions } from './server.
|
|
1
|
+
import { C as Context } from './server.qKsRrdxW.js';
|
|
2
|
+
import { b as StandardHandleOptions } from './server.7cEtMB30.js';
|
|
3
3
|
|
|
4
4
|
type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
|
|
5
5
|
context?: T;
|
|
@@ -3,6 +3,9 @@ import { ORPCError, fallbackContractConfig } from '@orpc/contract';
|
|
|
3
3
|
const STRICT_GET_METHOD_PLUGIN_IS_GET_METHOD_CONTEXT_SYMBOL = Symbol("STRICT_GET_METHOD_PLUGIN_IS_GET_METHOD_CONTEXT");
|
|
4
4
|
class StrictGetMethodPlugin {
|
|
5
5
|
error;
|
|
6
|
+
/**
|
|
7
|
+
* make sure execute before batch plugin to get real method
|
|
8
|
+
*/
|
|
6
9
|
order = 7e6;
|
|
7
10
|
constructor(options = {}) {
|
|
8
11
|
this.error = options.error ?? new ORPCError("METHOD_NOT_SUPPORTED");
|
|
@@ -13,7 +13,6 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
|
13
13
|
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
|
14
14
|
};
|
|
15
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
16
|
|
|
18
17
|
declare const LAZY_SYMBOL: unique symbol;
|
|
19
18
|
interface LazyMeta {
|
|
@@ -64,7 +63,7 @@ interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends
|
|
|
64
63
|
/**
|
|
65
64
|
* This class represents a procedure.
|
|
66
65
|
*
|
|
67
|
-
* @see {@link https://orpc.
|
|
66
|
+
* @see {@link https://orpc.dev/docs/procedure Procedure Docs}
|
|
68
67
|
*/
|
|
69
68
|
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
70
69
|
/**
|
|
@@ -103,7 +102,7 @@ interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstruct
|
|
|
103
102
|
/**
|
|
104
103
|
* A function that represents a middleware.
|
|
105
104
|
*
|
|
106
|
-
* @see {@link https://orpc.
|
|
105
|
+
* @see {@link https://orpc.dev/docs/middleware Middleware Docs}
|
|
107
106
|
*/
|
|
108
107
|
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
109
108
|
(options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
|
|
@@ -138,7 +137,7 @@ type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema
|
|
|
138
137
|
/**
|
|
139
138
|
* Create Server-side client from a procedure.
|
|
140
139
|
*
|
|
141
|
-
* @see {@link https://orpc.
|
|
140
|
+
* @see {@link https://orpc.dev/docs/client/server-side Server-side Client Docs}
|
|
142
141
|
*/
|
|
143
142
|
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
144
143
|
|
|
@@ -146,7 +145,7 @@ declare function createProcedureClient<TInitialContext extends Context, TInputSc
|
|
|
146
145
|
* Represents a router, which defines a hierarchical structure of procedures.
|
|
147
146
|
*
|
|
148
147
|
* @info A procedure is a router too.
|
|
149
|
-
* @see {@link https://orpc.
|
|
148
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
150
149
|
*/
|
|
151
150
|
type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
|
|
152
151
|
[K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
|
|
@@ -157,7 +156,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infe
|
|
|
157
156
|
* Infer all initial context of the router.
|
|
158
157
|
*
|
|
159
158
|
* @info A procedure is a router too.
|
|
160
|
-
* @see {@link https://orpc.
|
|
159
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
161
160
|
*/
|
|
162
161
|
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
|
|
163
162
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
|
@@ -166,7 +165,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
|
|
|
166
165
|
* Infer all current context of the router.
|
|
167
166
|
*
|
|
168
167
|
* @info A procedure is a router too.
|
|
169
|
-
* @see {@link https://orpc.
|
|
168
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
170
169
|
*/
|
|
171
170
|
type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
|
|
172
171
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
|
|
@@ -175,7 +174,7 @@ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any,
|
|
|
175
174
|
* Infer all router inputs
|
|
176
175
|
*
|
|
177
176
|
* @info A procedure is a router too.
|
|
178
|
-
* @see {@link https://orpc.
|
|
177
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
179
178
|
*/
|
|
180
179
|
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
181
180
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
|
@@ -184,11 +183,11 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
|
|
|
184
183
|
* Infer all router outputs
|
|
185
184
|
*
|
|
186
185
|
* @info A procedure is a router too.
|
|
187
|
-
* @see {@link https://orpc.
|
|
186
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
188
187
|
*/
|
|
189
188
|
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
190
189
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
|
191
190
|
};
|
|
192
191
|
|
|
193
|
-
export {
|
|
194
|
-
export type { AnyProcedure as A, Context as C,
|
|
192
|
+
export { isProcedure as E, createProcedureClient as F, Procedure as P, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, middlewareOutputFn as z };
|
|
193
|
+
export type { AnyProcedure as A, ProcedureHandlerOptions as B, Context as C, ProcedureDef as D, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, MergedInitialContext as M, ORPCErrorConstructorMap as O, Router as R, AnyMiddleware as a, AnyRouter as b, Lazy as c, ProcedureClientInterceptorOptions as d, Middleware as e, MergedCurrentContext as f, MapInputMiddleware as g, CreateProcedureClientOptions as h, ProcedureClient as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as v, MiddlewareNextFn as w, MiddlewareOutputFn as x, MiddlewareOptions as y };
|
|
@@ -13,7 +13,6 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
|
|
13
13
|
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
|
14
14
|
};
|
|
15
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
16
|
|
|
18
17
|
declare const LAZY_SYMBOL: unique symbol;
|
|
19
18
|
interface LazyMeta {
|
|
@@ -64,7 +63,7 @@ interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends
|
|
|
64
63
|
/**
|
|
65
64
|
* This class represents a procedure.
|
|
66
65
|
*
|
|
67
|
-
* @see {@link https://orpc.
|
|
66
|
+
* @see {@link https://orpc.dev/docs/procedure Procedure Docs}
|
|
68
67
|
*/
|
|
69
68
|
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
70
69
|
/**
|
|
@@ -103,7 +102,7 @@ interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstruct
|
|
|
103
102
|
/**
|
|
104
103
|
* A function that represents a middleware.
|
|
105
104
|
*
|
|
106
|
-
* @see {@link https://orpc.
|
|
105
|
+
* @see {@link https://orpc.dev/docs/middleware Middleware Docs}
|
|
107
106
|
*/
|
|
108
107
|
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
|
109
108
|
(options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
|
|
@@ -138,7 +137,7 @@ type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema
|
|
|
138
137
|
/**
|
|
139
138
|
* Create Server-side client from a procedure.
|
|
140
139
|
*
|
|
141
|
-
* @see {@link https://orpc.
|
|
140
|
+
* @see {@link https://orpc.dev/docs/client/server-side Server-side Client Docs}
|
|
142
141
|
*/
|
|
143
142
|
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
144
143
|
|
|
@@ -146,7 +145,7 @@ declare function createProcedureClient<TInitialContext extends Context, TInputSc
|
|
|
146
145
|
* Represents a router, which defines a hierarchical structure of procedures.
|
|
147
146
|
*
|
|
148
147
|
* @info A procedure is a router too.
|
|
149
|
-
* @see {@link https://orpc.
|
|
148
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
150
149
|
*/
|
|
151
150
|
type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
|
|
152
151
|
[K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
|
|
@@ -157,7 +156,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infe
|
|
|
157
156
|
* Infer all initial context of the router.
|
|
158
157
|
*
|
|
159
158
|
* @info A procedure is a router too.
|
|
160
|
-
* @see {@link https://orpc.
|
|
159
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
161
160
|
*/
|
|
162
161
|
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
|
|
163
162
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
|
@@ -166,7 +165,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
|
|
|
166
165
|
* Infer all current context of the router.
|
|
167
166
|
*
|
|
168
167
|
* @info A procedure is a router too.
|
|
169
|
-
* @see {@link https://orpc.
|
|
168
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
170
169
|
*/
|
|
171
170
|
type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
|
|
172
171
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
|
|
@@ -175,7 +174,7 @@ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any,
|
|
|
175
174
|
* Infer all router inputs
|
|
176
175
|
*
|
|
177
176
|
* @info A procedure is a router too.
|
|
178
|
-
* @see {@link https://orpc.
|
|
177
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
179
178
|
*/
|
|
180
179
|
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
181
180
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
|
@@ -184,11 +183,11 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
|
|
|
184
183
|
* Infer all router outputs
|
|
185
184
|
*
|
|
186
185
|
* @info A procedure is a router too.
|
|
187
|
-
* @see {@link https://orpc.
|
|
186
|
+
* @see {@link https://orpc.dev/docs/router#utilities Router Utilities Docs}
|
|
188
187
|
*/
|
|
189
188
|
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
190
189
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
|
191
190
|
};
|
|
192
191
|
|
|
193
|
-
export {
|
|
194
|
-
export type { AnyProcedure as A, Context as C,
|
|
192
|
+
export { isProcedure as E, createProcedureClient as F, Procedure as P, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, middlewareOutputFn as z };
|
|
193
|
+
export type { AnyProcedure as A, ProcedureHandlerOptions as B, Context as C, ProcedureDef as D, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, MergedInitialContext as M, ORPCErrorConstructorMap as O, Router as R, AnyMiddleware as a, AnyRouter as b, Lazy as c, ProcedureClientInterceptorOptions as d, Middleware as e, MergedCurrentContext as f, MapInputMiddleware as g, CreateProcedureClientOptions as h, ProcedureClient as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as v, MiddlewareNextFn as w, MiddlewareOutputFn as x, MiddlewareOptions as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
|
2
|
-
import { b as AnyRouter, C as Context, R as Router } from './server.
|
|
3
|
-
import { i as StandardMatcher, h as StandardMatchResult, e as StandardHandlerOptions, f as StandardHandler } from './server.
|
|
2
|
+
import { b as AnyRouter, C as Context, R as Router } from './server.qKsRrdxW.js';
|
|
3
|
+
import { i as StandardMatcher, h as StandardMatchResult, e as StandardHandlerOptions, f as StandardHandler } from './server.7cEtMB30.js';
|
|
4
4
|
import { HTTPPath } from '@orpc/client';
|
|
5
5
|
import { Value } from '@orpc/shared';
|
|
6
|
-
import { T as TraverseContractProcedureCallbackOptions } from './server.
|
|
6
|
+
import { T as TraverseContractProcedureCallbackOptions } from './server.ChyoA9XY.js';
|
|
7
7
|
|
|
8
8
|
interface StandardRPCMatcherOptions {
|
|
9
9
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.dc2afcb",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/middleapi/orpc.git",
|
|
10
10
|
"directory": "packages/server"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
|
-
"unnoq",
|
|
14
13
|
"orpc"
|
|
15
14
|
],
|
|
16
15
|
"exports": {
|
|
@@ -54,6 +53,11 @@
|
|
|
54
53
|
"import": "./dist/adapters/node/index.mjs",
|
|
55
54
|
"default": "./dist/adapters/node/index.mjs"
|
|
56
55
|
},
|
|
56
|
+
"./fastify": {
|
|
57
|
+
"types": "./dist/adapters/fastify/index.d.mts",
|
|
58
|
+
"import": "./dist/adapters/fastify/index.mjs",
|
|
59
|
+
"default": "./dist/adapters/fastify/index.mjs"
|
|
60
|
+
},
|
|
57
61
|
"./aws-lambda": {
|
|
58
62
|
"types": "./dist/adapters/aws-lambda/index.d.mts",
|
|
59
63
|
"import": "./dist/adapters/aws-lambda/index.mjs",
|
|
@@ -101,23 +105,27 @@
|
|
|
101
105
|
}
|
|
102
106
|
},
|
|
103
107
|
"dependencies": {
|
|
104
|
-
"cookie": "^1.
|
|
105
|
-
"@orpc/client": "0.0.0-next.
|
|
106
|
-
"@orpc/
|
|
107
|
-
"@orpc/
|
|
108
|
-
"@orpc/
|
|
109
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
110
|
-
"@orpc/
|
|
111
|
-
"@orpc/standard-server-
|
|
112
|
-
"@orpc/standard-server-
|
|
113
|
-
"@orpc/standard-server-
|
|
108
|
+
"cookie": "^1.1.1",
|
|
109
|
+
"@orpc/client": "0.0.0-next.dc2afcb",
|
|
110
|
+
"@orpc/contract": "0.0.0-next.dc2afcb",
|
|
111
|
+
"@orpc/interop": "0.0.0-next.dc2afcb",
|
|
112
|
+
"@orpc/standard-server-aws-lambda": "0.0.0-next.dc2afcb",
|
|
113
|
+
"@orpc/standard-server": "0.0.0-next.dc2afcb",
|
|
114
|
+
"@orpc/shared": "0.0.0-next.dc2afcb",
|
|
115
|
+
"@orpc/standard-server-fastify": "0.0.0-next.dc2afcb",
|
|
116
|
+
"@orpc/standard-server-fetch": "0.0.0-next.dc2afcb",
|
|
117
|
+
"@orpc/standard-server-node": "0.0.0-next.dc2afcb",
|
|
118
|
+
"@orpc/standard-server-peer": "0.0.0-next.dc2afcb"
|
|
114
119
|
},
|
|
115
120
|
"devDependencies": {
|
|
121
|
+
"@tanstack/router-core": "^1.159.4",
|
|
116
122
|
"@types/ws": "^8.18.1",
|
|
117
|
-
"crossws": "^0.4.
|
|
118
|
-
"
|
|
123
|
+
"crossws": "^0.4.4",
|
|
124
|
+
"fastify": "^5.7.4",
|
|
125
|
+
"next": "^16.1.6",
|
|
119
126
|
"supertest": "^7.1.4",
|
|
120
|
-
"ws": "^8.18.3"
|
|
127
|
+
"ws": "^8.18.3",
|
|
128
|
+
"zod": "^4.3.6"
|
|
121
129
|
},
|
|
122
130
|
"scripts": {
|
|
123
131
|
"build": "unbuild",
|