@orpc/server 2.0.0-beta.44 → 2.0.0-beta.46
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 +100 -62
- package/dist/adapters/aws-lambda/index.d.mts +1 -0
- package/dist/adapters/aws-lambda/index.d.ts +1 -0
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/crossws/index.mjs +3 -3
- package/dist/adapters/fastify/index.mjs +3 -3
- package/dist/adapters/fetch/index.d.mts +2 -2
- package/dist/adapters/fetch/index.d.ts +2 -2
- package/dist/adapters/fetch/index.mjs +3 -3
- package/dist/adapters/message-port/index.d.mts +1 -1
- package/dist/adapters/message-port/index.d.ts +1 -1
- package/dist/adapters/message-port/index.mjs +3 -3
- package/dist/adapters/node/index.d.mts +1 -1
- package/dist/adapters/node/index.d.ts +1 -1
- package/dist/adapters/node/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +8 -7
- package/dist/adapters/standard/index.d.ts +8 -7
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/adapters/websocket/index.mjs +3 -3
- package/dist/extensions/callable.mjs +2 -2
- package/dist/helpers/index.mjs +2 -8
- package/dist/index.d.mts +18 -33
- package/dist/index.d.ts +18 -33
- package/dist/index.mjs +12 -10
- package/dist/plugins/index.d.mts +57 -32
- package/dist/plugins/index.d.ts +57 -32
- package/dist/plugins/index.mjs +189 -48
- package/dist/shared/{server.DJNkZPfD.d.ts → server.9B1jEm5a.d.mts} +6 -16
- package/dist/shared/{server.FEqy7Hrj.mjs → server.BB464y-6.mjs} +6 -4
- package/dist/shared/{server.DD1roZl9.d.mts → server.BC5BIu02.d.mts} +1 -1
- package/dist/shared/{server.UG_xdTub.d.mts → server.BSYGskId.d.ts} +3 -3
- package/dist/shared/{server.DFEuNUt4.d.ts → server.BvG3boBj.d.mts} +3 -3
- package/dist/shared/{server.BllfVJLm.d.mts → server.CTV_mC2P.d.mts} +2 -2
- package/dist/shared/{server.BgvqVW_v.mjs → server.CYbIpHbH.mjs} +17 -5
- package/dist/shared/{server.COfbQ0D8.d.ts → server.CgBF3Vj1.d.ts} +2 -2
- package/dist/shared/{server.B34dZrzY.mjs → server.Chq5FpXf.mjs} +4 -10
- package/dist/shared/{server.BEdOJs6S.d.mts → server.DFPxP2v3.d.mts} +11 -8
- package/dist/shared/{server.BEdOJs6S.d.ts → server.DFPxP2v3.d.ts} +11 -8
- package/dist/shared/{server.CVO0hWyj.d.mts → server.DOg7ke6y.d.ts} +6 -16
- package/dist/shared/{server.DZeVx8K9.d.ts → server.Dz7j9BEh.d.ts} +1 -1
- package/dist/shared/{server.AVQWL-DI.mjs → server.sBQSgqK3.mjs} +1 -1
- package/package.json +12 -12
|
@@ -12,16 +12,19 @@ type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
|
|
|
12
12
|
output: TOutput;
|
|
13
13
|
context: TOutContext;
|
|
14
14
|
}>;
|
|
15
|
-
type MiddlewareNextOptions<TOutContext extends Context> = object extends TOutContext ? {
|
|
16
|
-
context?: TOutContext;
|
|
15
|
+
type MiddlewareNextOptions<TOutContext extends Context> = (object extends TOutContext ? {
|
|
16
|
+
context?: TOutContext | undefined;
|
|
17
17
|
} : {
|
|
18
18
|
context: TOutContext;
|
|
19
|
+
}) & {
|
|
20
|
+
/** Overrides the signal for the rest of the chain. */
|
|
21
|
+
signal?: AbortSignal | undefined;
|
|
19
22
|
};
|
|
20
23
|
interface MiddlewareNext<TOutput> {
|
|
21
24
|
<T extends Context = object>(...rest: MaybeOptionalOptions<MiddlewareNextOptions<T>>): MiddlewareResult<T, TOutput>;
|
|
22
25
|
}
|
|
23
26
|
type MiddlewareDoneOptions<TOutContext, TOutput> = (object extends TOutContext ? {
|
|
24
|
-
context?: TOutContext;
|
|
27
|
+
context?: TOutContext | undefined;
|
|
25
28
|
} : {
|
|
26
29
|
context: TOutContext;
|
|
27
30
|
}) & {
|
|
@@ -150,14 +153,14 @@ interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TEr
|
|
|
150
153
|
}
|
|
151
154
|
type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>>;
|
|
152
155
|
type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext> = {
|
|
153
|
-
path?: string[];
|
|
154
|
-
interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap>[];
|
|
156
|
+
path?: string[] | undefined;
|
|
157
|
+
interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap>[] | undefined;
|
|
155
158
|
} & (object extends TInitialContext ? {
|
|
156
|
-
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]
|
|
159
|
+
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]> | undefined;
|
|
157
160
|
} : {
|
|
158
161
|
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
159
162
|
});
|
|
160
163
|
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext = object>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap>>, ...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
161
164
|
|
|
162
|
-
export { Procedure as a, Lazy as
|
|
163
|
-
export type { AnyProcedure as A, Context as C, Lazyable as L, MergedContext as M, OrderedMiddleware as O, ProcedureClientOptions as P, ProcedureClient as b, ProcedureClientInterceptor as c, Middleware as d, MergedInitialContext as e,
|
|
165
|
+
export { Procedure as a, Lazy as f, createProcedureClient as u, unlazy as v };
|
|
166
|
+
export type { AnyProcedure as A, Context as C, Lazyable as L, MergedContext as M, OrderedMiddleware as O, ProcedureClientOptions as P, ProcedureClient as b, ProcedureClientInterceptor as c, Middleware as d, MergedInitialContext as e, ProcedureHandler as g, ProcedureConfig as h, AnyMiddleware as i, LazyDefinition as j, MiddlewareDefinition as k, MiddlewareDone as l, MiddlewareDoneOptions as m, MiddlewareNext as n, MiddlewareNextOptions as o, MiddlewareOptions as p, MiddlewareResult as q, ProcedureClientInterceptorOptions as r, ProcedureDefinition as s, ProcedureHandlerOptions as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { OrderablePlugin, Value, Promisable, Interceptor } from '@orpc/shared';
|
|
3
3
|
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
4
|
-
import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.
|
|
4
|
+
import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.DFPxP2v3.js';
|
|
5
5
|
import { Schema, ErrorMap } from '@orpc/contract';
|
|
6
6
|
|
|
7
7
|
interface StandardHandlerPlugin<T extends Context> extends OrderablePlugin {
|
|
@@ -27,12 +27,6 @@ interface StandardHandlerPlugin<T extends Context> extends OrderablePlugin {
|
|
|
27
27
|
*/
|
|
28
28
|
init?(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
29
29
|
}
|
|
30
|
-
declare class CompositeStandardHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
31
|
-
readonly name = "~composite";
|
|
32
|
-
protected readonly plugins: StandardHandlerPlugin<T>[];
|
|
33
|
-
constructor(plugins?: StandardHandlerPlugin<T>[]);
|
|
34
|
-
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
35
|
-
}
|
|
36
30
|
|
|
37
31
|
interface StandardHandlerHandleOptions<T extends Context> {
|
|
38
32
|
prefix?: `/${string}` | undefined;
|
|
@@ -73,19 +67,19 @@ interface StandardHandlerOptions<TContext extends Context> {
|
|
|
73
67
|
* - batch plugins - separate one request into multiple and call multiple next
|
|
74
68
|
* - openapi spec plugin - to intercept a request and early response
|
|
75
69
|
*/
|
|
76
|
-
routingInterceptors?: StandardHandlerRoutingInterceptor<TContext>[];
|
|
70
|
+
routingInterceptors?: StandardHandlerRoutingInterceptor<TContext>[] | undefined;
|
|
77
71
|
/**
|
|
78
72
|
* interceptor run after routing and before error handler,
|
|
79
73
|
* useful for error handling, logging, metrics, etc.
|
|
80
74
|
*/
|
|
81
|
-
interceptors?: StandardHandlerInterceptor<TContext>[];
|
|
75
|
+
interceptors?: StandardHandlerInterceptor<TContext>[] | undefined;
|
|
82
76
|
/**
|
|
83
77
|
*
|
|
84
78
|
* ClientInterceptor equivalent with createRouterClient.interceptors / createProcedure.interceptors
|
|
85
79
|
* useful for error handling, logging, metrics, etc. (not counting encoding/decoding)
|
|
86
80
|
*/
|
|
87
|
-
clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap>[];
|
|
88
|
-
plugins?: StandardHandlerPlugin<TContext>[];
|
|
81
|
+
clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap>[] | undefined;
|
|
82
|
+
plugins?: StandardHandlerPlugin<TContext>[] | undefined;
|
|
89
83
|
}
|
|
90
84
|
declare class StandardHandler<T extends Context> {
|
|
91
85
|
private readonly codec;
|
|
@@ -95,10 +89,6 @@ declare class StandardHandler<T extends Context> {
|
|
|
95
89
|
constructor(codec: StandardHandlerCodec<T>, options: StandardHandlerOptions<T>);
|
|
96
90
|
handle(request: StandardLazyRequest, options: StandardHandlerHandleOptions<T>): Promise<StandardHandlerHandleResult>;
|
|
97
91
|
}
|
|
98
|
-
declare class TracingHandlerPlugin implements StandardHandlerPlugin<any> {
|
|
99
|
-
name: string;
|
|
100
|
-
init(options: StandardHandlerOptions<any>): StandardHandlerOptions<any>;
|
|
101
|
-
}
|
|
102
92
|
|
|
103
93
|
interface StandardHandlerCodecResolvedProcedure {
|
|
104
94
|
path: string[];
|
|
@@ -111,5 +101,5 @@ interface StandardHandlerCodec<T extends Context> {
|
|
|
111
101
|
encodeError(error: AnyORPCError, procedure: AnyProcedure, path: string[], options: ResolvedStandardHandlerHandleOptions<T>): Promisable<StandardResponse>;
|
|
112
102
|
}
|
|
113
103
|
|
|
114
|
-
export {
|
|
104
|
+
export { StandardHandler as S };
|
|
115
105
|
export type { ResolvedStandardHandlerHandleOptions as R, StandardHandlerHandleOptions as a, StandardHandlerPlugin as b, StandardHandlerOptions as c, StandardHandlerRoutingInterceptorOptions as d, StandardHandlerInterceptorOptions as e, StandardHandlerCodec as f, StandardHandlerCodecResolvedProcedure as g, StandardHandlerHandleResult as h, StandardHandlerInterceptor as i, StandardHandlerRoutingInterceptor as j };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RouterContract, ProcedureContract, ORPCErrorFromErrorMap, ThrowableError, InferSchemaInput, InferSchemaOutput } from '@orpc/contract';
|
|
2
|
-
import { C as Context, a as Procedure, L as Lazyable, M as MergedContext } from './server.
|
|
2
|
+
import { C as Context, a as Procedure, L as Lazyable, M as MergedContext } from './server.DFPxP2v3.js';
|
|
3
3
|
|
|
4
4
|
type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any> | {
|
|
5
5
|
[k: string]: Lazyable<Router<TInitialContext>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveMetaPlugins, mergeErrorMap, getHiddenMetaPlugins } from '@orpc/contract';
|
|
2
|
-
import { P as Procedure } from './server.
|
|
2
|
+
import { P as Procedure } from './server.BB464y-6.mjs';
|
|
3
3
|
|
|
4
4
|
class DecoratedProcedure extends Procedure {
|
|
5
5
|
meta(...plugins) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.46",
|
|
5
5
|
"description": "Build typesafe APIs with oRPC: RPC and OpenAPI support, middleware, and adapters for Node.js, Bun, Deno, Fetch, Fastify, WebSocket, AWS Lambda, and more",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -117,23 +117,23 @@
|
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@orpc/client": "2.0.0-beta.
|
|
121
|
-
"@orpc/contract": "2.0.0-beta.
|
|
122
|
-
"@orpc/shared": "2.0.0-beta.
|
|
123
|
-
"@standard-server/aws-lambda": "~0.
|
|
124
|
-
"@standard-server/core": "~0.
|
|
125
|
-
"@standard-server/fastify": "~0.
|
|
126
|
-
"@standard-server/fetch": "~0.
|
|
127
|
-
"@standard-server/node": "~0.
|
|
128
|
-
"@standard-server/peer": "~0.
|
|
120
|
+
"@orpc/client": "2.0.0-beta.46",
|
|
121
|
+
"@orpc/contract": "2.0.0-beta.46",
|
|
122
|
+
"@orpc/shared": "2.0.0-beta.46",
|
|
123
|
+
"@standard-server/aws-lambda": "~0.11.0",
|
|
124
|
+
"@standard-server/core": "~0.11.0",
|
|
125
|
+
"@standard-server/fastify": "~0.11.0",
|
|
126
|
+
"@standard-server/fetch": "~0.11.0",
|
|
127
|
+
"@standard-server/node": "~0.11.0",
|
|
128
|
+
"@standard-server/peer": "~0.11.0",
|
|
129
129
|
"cookie": "^2.0.1"
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
132
|
"crossws": "^0.4.15",
|
|
133
|
-
"fastify": "^5.12.
|
|
133
|
+
"fastify": "^5.12.7",
|
|
134
134
|
"supertest": "^7.3.1",
|
|
135
135
|
"ws": "^8.22.0",
|
|
136
|
-
"zod": "^4.6.
|
|
136
|
+
"zod": "^4.6.7"
|
|
137
137
|
},
|
|
138
138
|
"scripts": {
|
|
139
139
|
"type:check": "tsc -b"
|