@orpc/server 2.0.0-beta.32 → 2.0.0-beta.34
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 +44 -29
- package/dist/adapters/aws-lambda/index.d.mts +2 -2
- package/dist/adapters/aws-lambda/index.d.ts +2 -2
- package/dist/adapters/aws-lambda/index.mjs +5 -5
- package/dist/adapters/crossws/index.d.mts +2 -2
- package/dist/adapters/crossws/index.d.ts +2 -2
- package/dist/adapters/crossws/index.mjs +5 -5
- package/dist/adapters/fastify/index.d.mts +2 -2
- package/dist/adapters/fastify/index.d.ts +2 -2
- package/dist/adapters/fastify/index.mjs +5 -5
- package/dist/adapters/fetch/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +6 -6
- package/dist/adapters/message-port/index.d.mts +2 -2
- package/dist/adapters/message-port/index.d.ts +2 -2
- package/dist/adapters/message-port/index.mjs +5 -5
- package/dist/adapters/node/index.d.mts +3 -3
- package/dist/adapters/node/index.d.ts +3 -3
- package/dist/adapters/node/index.mjs +7 -7
- package/dist/adapters/standard/index.d.mts +5 -5
- package/dist/adapters/standard/index.d.ts +5 -5
- package/dist/adapters/standard/index.mjs +4 -4
- package/dist/adapters/standard-peer/index.d.mts +1 -1
- package/dist/adapters/standard-peer/index.d.ts +1 -1
- package/dist/adapters/websocket/index.d.mts +2 -2
- package/dist/adapters/websocket/index.d.ts +2 -2
- package/dist/adapters/websocket/index.mjs +5 -5
- package/dist/extensions/callable.d.mts +3 -3
- package/dist/extensions/callable.d.ts +3 -3
- package/dist/extensions/callable.mjs +2 -2
- package/dist/index.d.mts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.mjs +8 -16
- package/dist/plugins/index.d.mts +5 -4
- package/dist/plugins/index.d.ts +5 -4
- package/dist/plugins/index.mjs +33 -17
- package/dist/shared/{server.Cd4Z1hpV.mjs → server.1ExWFMze.mjs} +2 -2
- package/dist/shared/{server.Cqk3swxs.mjs → server.BNfuzVqH.mjs} +1 -1
- package/dist/shared/{server.DtfwuV6U.d.ts → server.BpmUhems.d.mts} +9 -9
- package/dist/shared/{server.DrN1Pj1-.d.ts → server.BrURRtO7.d.mts} +3 -3
- package/dist/shared/{server.CwrYlF72.d.ts → server.BsujoJoF.d.mts} +12 -23
- package/dist/shared/{server.CwrYlF72.d.mts → server.BsujoJoF.d.ts} +12 -23
- package/dist/shared/{server.CkNnZ5F-.d.mts → server.ByvwIMbH.d.mts} +4 -4
- package/dist/shared/{server.BhHrioCw.d.ts → server.C-hqoApz.d.ts} +2 -2
- package/dist/shared/{server.C2n16pp0.d.ts → server.CAmrY_mX.d.ts} +4 -4
- package/dist/shared/{server.3Ex_8ISY.mjs → server.CDOFCg6A.mjs} +1 -13
- package/dist/shared/{server.D0Ipbmdv.d.mts → server.CGQ3M7fX.d.mts} +2 -2
- package/dist/shared/{server.Dm0os-OP.d.mts → server.CRwPbhLO.d.ts} +9 -9
- package/dist/shared/{server.JbCIPL4P.d.mts → server.D23TTT5i.d.ts} +3 -3
- package/dist/shared/{server.S8BnCR3a.mjs → server.gXC5UaAH.mjs} +1 -1
- package/dist/shared/{server.7G43pSxo.mjs → server.ozO1TILY.mjs} +3 -3
- package/package.json +11 -12
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { toArray, value, isPlainObject, isTypescriptObject, isAsyncIteratorObject, override, wrapAsyncIterator, isCompressibleContentType, isNoTransformCacheControl, parseAcceptEncodingQualities, varyByAcceptEncoding, stringifyJSON, anyAbortSignal, wrapReadableStream, AbortError } from '@orpc/shared';
|
|
2
|
-
import { flattenStandardHeader, parseStandardUrl, generateContentDisposition, mergeStandardHeaders } from '@
|
|
3
|
-
import { isClientPeerSendMessage, ServerPeer, encodePeerMessage } from '@
|
|
2
|
+
import { flattenStandardHeader, parseStandardUrl, generateContentDisposition, mergeStandardHeaders } from '@standard-server/core';
|
|
3
|
+
import { isClientPeerSendMessage, ServerPeer, encodePeerMessage } from '@standard-server/peer';
|
|
4
4
|
import { ORPCError } from '@orpc/client';
|
|
5
|
-
import { toFetchHeaders, toStandardBody, toStandardHeaders } from '@
|
|
6
|
-
export { R as RequestLimitHandlerPlugin } from '../shared/server.
|
|
5
|
+
import { toFetchHeaders, toStandardBody, toStandardHeaders } from '@standard-server/fetch';
|
|
6
|
+
export { R as RequestLimitHandlerPlugin } from '../shared/server.1ExWFMze.mjs';
|
|
7
7
|
|
|
8
8
|
const BATCH_CONTENT_TYPE = "application/vnd.orpc.batch";
|
|
9
9
|
class BatchHandlerPlugin {
|
|
@@ -236,24 +236,20 @@ class CORSHandlerPlugin {
|
|
|
236
236
|
}
|
|
237
237
|
const resHeaders = { ...result.response.headers };
|
|
238
238
|
const origin = flattenStandardHeader(interceptorOptions.request.headers.origin);
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
const allowOrigin = await this.resolveOrigin(this.options.origin, origin, interceptorOptions);
|
|
240
|
+
const timingAllowOrigin = await this.resolveOrigin(this.options.timingOrigin, origin, interceptorOptions);
|
|
241
|
+
if (allowOrigin.value !== void 0) {
|
|
242
|
+
resHeaders["access-control-allow-origin"] = allowOrigin.value;
|
|
243
|
+
}
|
|
244
|
+
if (timingAllowOrigin.value !== void 0) {
|
|
245
|
+
resHeaders["timing-allow-origin"] = timingAllowOrigin.value;
|
|
246
|
+
}
|
|
247
|
+
if (allowOrigin.varies || timingAllowOrigin.varies) {
|
|
246
248
|
const existingVary = flattenStandardHeader(resHeaders.vary);
|
|
247
249
|
if (!existingVary?.split(",").some((v) => v.trim().toLowerCase() === "origin")) {
|
|
248
250
|
resHeaders.vary = existingVary ? `${existingVary}, Origin` : "Origin";
|
|
249
251
|
}
|
|
250
252
|
}
|
|
251
|
-
const allowedTimingOrigins = toArray(await value(this.options.timingOrigin, origin, interceptorOptions));
|
|
252
|
-
if (allowedTimingOrigins.includes("*")) {
|
|
253
|
-
resHeaders["timing-allow-origin"] = "*";
|
|
254
|
-
} else if (origin !== void 0 && allowedTimingOrigins.includes(origin)) {
|
|
255
|
-
resHeaders["timing-allow-origin"] = origin;
|
|
256
|
-
}
|
|
257
253
|
if (this.options.credentials) {
|
|
258
254
|
resHeaders["access-control-allow-credentials"] = "true";
|
|
259
255
|
}
|
|
@@ -295,6 +291,26 @@ class CORSHandlerPlugin {
|
|
|
295
291
|
]
|
|
296
292
|
};
|
|
297
293
|
}
|
|
294
|
+
async resolveOrigin(option, origin, interceptorOptions) {
|
|
295
|
+
if (typeof option === "function") {
|
|
296
|
+
if (origin === void 0) {
|
|
297
|
+
return { value: void 0, varies: true };
|
|
298
|
+
}
|
|
299
|
+
const allowed2 = toArray(await option(origin, interceptorOptions));
|
|
300
|
+
if (allowed2.includes("*")) {
|
|
301
|
+
return { value: "*", varies: true };
|
|
302
|
+
}
|
|
303
|
+
return { value: allowed2.includes(origin) ? origin : void 0, varies: true };
|
|
304
|
+
}
|
|
305
|
+
const allowed = toArray(await option);
|
|
306
|
+
if (allowed.includes("*")) {
|
|
307
|
+
return { value: "*", varies: false };
|
|
308
|
+
}
|
|
309
|
+
if (origin !== void 0 && allowed.includes(origin)) {
|
|
310
|
+
return { value: origin, varies: true };
|
|
311
|
+
}
|
|
312
|
+
return { value: void 0, varies: allowed.length > 0 };
|
|
313
|
+
}
|
|
298
314
|
}
|
|
299
315
|
|
|
300
316
|
class GetMethodCsrfProtectionHandlerPlugin {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { toArray } from '@orpc/shared';
|
|
3
|
-
import { flattenStandardHeader } from '@
|
|
4
|
-
import { toFetchHeaders, toStandardBody } from '@
|
|
3
|
+
import { flattenStandardHeader } from '@standard-server/core';
|
|
4
|
+
import { toFetchHeaders, toStandardBody } from '@standard-server/fetch';
|
|
5
5
|
|
|
6
6
|
class RequestLimitHandlerPlugin {
|
|
7
7
|
name = "~request-limit";
|
|
@@ -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.CDOFCg6A.mjs';
|
|
3
3
|
|
|
4
4
|
class DecoratedProcedure extends Procedure {
|
|
5
5
|
meta(...plugins) {
|
|
@@ -1,10 +1,10 @@
|
|
|
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.BsujoJoF.mjs';
|
|
3
3
|
|
|
4
|
-
type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any
|
|
4
|
+
type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any> | {
|
|
5
5
|
[k: string]: Lazyable<Router<TInitialContext>>;
|
|
6
6
|
};
|
|
7
|
-
type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap
|
|
7
|
+
type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap> : {
|
|
8
8
|
[K in keyof T]: T[K] extends RouterContract ? Lazyable<ContractedRouter<T[K], TInitialContext>> : never;
|
|
9
9
|
};
|
|
10
10
|
type AnyRouter = Router<any>;
|
|
@@ -17,7 +17,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer $>
|
|
|
17
17
|
*
|
|
18
18
|
* @see {@link https://orpc.dev/docs/router#infer-router-initial-contexts | Router - Infer Router Initial Contexts}
|
|
19
19
|
*/
|
|
20
|
-
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any
|
|
20
|
+
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any> ? UInitialContext : {
|
|
21
21
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
@@ -28,7 +28,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
|
|
|
28
28
|
*
|
|
29
29
|
* @see {@link https://orpc.dev/docs/router#infer-router-final-contexts | Router - Infer Router Final Contexts}
|
|
30
30
|
*/
|
|
31
|
-
type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any
|
|
31
|
+
type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any> ? MergedContext<UInitialContext, UInjectedContext> : {
|
|
32
32
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterFinalContexts<U> : never;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
@@ -39,7 +39,7 @@ type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer U
|
|
|
39
39
|
*
|
|
40
40
|
* @see {@link https://orpc.dev/docs/router#infer-router-inputs | Router - Infer Router Inputs}
|
|
41
41
|
*/
|
|
42
|
-
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any
|
|
42
|
+
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
43
43
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -50,7 +50,7 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
|
|
|
50
50
|
*
|
|
51
51
|
* @see {@link https://orpc.dev/docs/router#infer-router-outputs | Router - Infer Router Outputs}
|
|
52
52
|
*/
|
|
53
|
-
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any
|
|
53
|
+
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
54
54
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
@@ -58,7 +58,7 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
|
58
58
|
*
|
|
59
59
|
* @see {@link https://orpc.dev/docs/router#infer-router-error | Router - Infer Router Error}
|
|
60
60
|
*/
|
|
61
|
-
type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap
|
|
61
|
+
type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
|
|
62
62
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterError<U> : never;
|
|
63
63
|
}[keyof T];
|
|
64
64
|
/**
|
|
@@ -66,7 +66,7 @@ type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any,
|
|
|
66
66
|
*
|
|
67
67
|
* @see {@link https://orpc.dev/docs/router#infer-router-errors | Router - Infer Router Errors}
|
|
68
68
|
*/
|
|
69
|
-
type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap
|
|
69
|
+
type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
|
|
70
70
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterErrors<U> : never;
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { OrderablePlugin, Interceptor, Promisable } from '@orpc/shared';
|
|
3
|
-
import { StandardLazyRequest, StandardResponse } from '@
|
|
4
|
-
import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.
|
|
3
|
+
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
4
|
+
import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.BsujoJoF.mjs';
|
|
5
5
|
import { Schema, ErrorMap } from '@orpc/contract';
|
|
6
6
|
|
|
7
7
|
interface StandardHandlerPlugin<T extends Context> extends OrderablePlugin {
|
|
@@ -73,7 +73,7 @@ interface StandardHandlerOptions<TContext extends Context> {
|
|
|
73
73
|
* ClientInterceptor equivalent with createRouterClient.interceptors / createProcedure.interceptors
|
|
74
74
|
* useful for error handling, logging, metrics, etc. (not counting encoding/decoding)
|
|
75
75
|
*/
|
|
76
|
-
clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap
|
|
76
|
+
clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap>[];
|
|
77
77
|
plugins?: StandardHandlerPlugin<TContext>[];
|
|
78
78
|
}
|
|
79
79
|
declare class StandardHandler<T extends Context> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientContext, Client } from '@orpc/client';
|
|
2
2
|
import { ErrorMap, AnyMetaPlugin, ORPCErrorConstructorMap, AnySchema, ProcedureContractDefinition, Meta, InferSchemaOutput, ORPCErrorFromErrorMap, InferSchemaInput } from '@orpc/contract';
|
|
3
3
|
import { MaybeOptionalOptions, Promisable, Interceptor, PromiseWithError, ThrowableError, Value } from '@orpc/shared';
|
|
4
4
|
|
|
@@ -60,7 +60,7 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
|
|
|
60
60
|
context: TCurrentContext;
|
|
61
61
|
input: TInput;
|
|
62
62
|
path: string[];
|
|
63
|
-
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap
|
|
63
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap>;
|
|
64
64
|
signal?: AbortSignal | undefined;
|
|
65
65
|
lastEventId?: string | undefined;
|
|
66
66
|
errors: TErrorConstructorMap;
|
|
@@ -109,32 +109,21 @@ interface ProcedureConfig {
|
|
|
109
109
|
*/
|
|
110
110
|
disableOutputValidation?: boolean | undefined;
|
|
111
111
|
}
|
|
112
|
-
interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
112
|
+
interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TOutputSchema, TErrorMap>, ProcedureConfig {
|
|
113
113
|
__TInitialContext?: (type: TInitialContext) => unknown;
|
|
114
114
|
__TInjectedContext?: (type: TInjectedContext) => unknown;
|
|
115
|
-
__TReturnedError?: () => TReturnedError;
|
|
116
|
-
/**
|
|
117
|
-
* When enabled, errors returned (not thrown) by the handler are passed through as-is,
|
|
118
|
-
* rather than being transformed into inferrable errors.
|
|
119
|
-
*
|
|
120
|
-
* This is intended for the contract-first approach, where the procedure adheres to an
|
|
121
|
-
* external contract and returned errors should not affect the inferred contract types.
|
|
122
|
-
*
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
opaqueReturnedErrors?: boolean | undefined;
|
|
126
115
|
orderedMiddlewares: OrderedMiddleware[];
|
|
127
116
|
handler: ProcedureHandler<any, any, any, any>;
|
|
128
117
|
}
|
|
129
|
-
declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
130
|
-
'~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap
|
|
131
|
-
constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap
|
|
118
|
+
declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
119
|
+
'~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
120
|
+
constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>);
|
|
132
121
|
/**
|
|
133
122
|
* Checks if the given instance satisfies the {@link Procedure} class/interface.
|
|
134
123
|
*/
|
|
135
124
|
static [Symbol.hasInstance](instance: unknown): boolean;
|
|
136
125
|
}
|
|
137
|
-
type AnyProcedure = Procedure<any, any, any, any, any
|
|
126
|
+
type AnyProcedure = Procedure<any, any, any, any, any>;
|
|
138
127
|
|
|
139
128
|
interface LazyDefinition<T> {
|
|
140
129
|
meta: Meta;
|
|
@@ -156,19 +145,19 @@ declare function unlazy<T extends Lazyable<any>>(maybeLazy: T): Promise<{
|
|
|
156
145
|
default: T extends Lazy<infer U> ? U : T;
|
|
157
146
|
}>;
|
|
158
147
|
|
|
159
|
-
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
148
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>;
|
|
160
149
|
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap> extends ProcedureHandlerOptions<TInitialContext, unknown, ORPCErrorConstructorMap<TErrorMap>> {
|
|
161
150
|
}
|
|
162
|
-
type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
163
|
-
type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap,
|
|
151
|
+
type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>>;
|
|
152
|
+
type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext> = {
|
|
164
153
|
path?: string[];
|
|
165
|
-
interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap
|
|
154
|
+
interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap>[];
|
|
166
155
|
} & (object extends TInitialContext ? {
|
|
167
156
|
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
168
157
|
} : {
|
|
169
158
|
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
170
159
|
});
|
|
171
|
-
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap,
|
|
160
|
+
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>;
|
|
172
161
|
|
|
173
162
|
export { Procedure as a, Lazy as h, createProcedureClient as u, unlazy as v };
|
|
174
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, ProcedureConfig as f, AnyMiddleware as g, ProcedureHandler 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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientContext, Client } from '@orpc/client';
|
|
2
2
|
import { ErrorMap, AnyMetaPlugin, ORPCErrorConstructorMap, AnySchema, ProcedureContractDefinition, Meta, InferSchemaOutput, ORPCErrorFromErrorMap, InferSchemaInput } from '@orpc/contract';
|
|
3
3
|
import { MaybeOptionalOptions, Promisable, Interceptor, PromiseWithError, ThrowableError, Value } from '@orpc/shared';
|
|
4
4
|
|
|
@@ -60,7 +60,7 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
|
|
|
60
60
|
context: TCurrentContext;
|
|
61
61
|
input: TInput;
|
|
62
62
|
path: string[];
|
|
63
|
-
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap
|
|
63
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap>;
|
|
64
64
|
signal?: AbortSignal | undefined;
|
|
65
65
|
lastEventId?: string | undefined;
|
|
66
66
|
errors: TErrorConstructorMap;
|
|
@@ -109,32 +109,21 @@ interface ProcedureConfig {
|
|
|
109
109
|
*/
|
|
110
110
|
disableOutputValidation?: boolean | undefined;
|
|
111
111
|
}
|
|
112
|
-
interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
112
|
+
interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TOutputSchema, TErrorMap>, ProcedureConfig {
|
|
113
113
|
__TInitialContext?: (type: TInitialContext) => unknown;
|
|
114
114
|
__TInjectedContext?: (type: TInjectedContext) => unknown;
|
|
115
|
-
__TReturnedError?: () => TReturnedError;
|
|
116
|
-
/**
|
|
117
|
-
* When enabled, errors returned (not thrown) by the handler are passed through as-is,
|
|
118
|
-
* rather than being transformed into inferrable errors.
|
|
119
|
-
*
|
|
120
|
-
* This is intended for the contract-first approach, where the procedure adheres to an
|
|
121
|
-
* external contract and returned errors should not affect the inferred contract types.
|
|
122
|
-
*
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
opaqueReturnedErrors?: boolean | undefined;
|
|
126
115
|
orderedMiddlewares: OrderedMiddleware[];
|
|
127
116
|
handler: ProcedureHandler<any, any, any, any>;
|
|
128
117
|
}
|
|
129
|
-
declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
130
|
-
'~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap
|
|
131
|
-
constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap
|
|
118
|
+
declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
119
|
+
'~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
120
|
+
constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>);
|
|
132
121
|
/**
|
|
133
122
|
* Checks if the given instance satisfies the {@link Procedure} class/interface.
|
|
134
123
|
*/
|
|
135
124
|
static [Symbol.hasInstance](instance: unknown): boolean;
|
|
136
125
|
}
|
|
137
|
-
type AnyProcedure = Procedure<any, any, any, any, any
|
|
126
|
+
type AnyProcedure = Procedure<any, any, any, any, any>;
|
|
138
127
|
|
|
139
128
|
interface LazyDefinition<T> {
|
|
140
129
|
meta: Meta;
|
|
@@ -156,19 +145,19 @@ declare function unlazy<T extends Lazyable<any>>(maybeLazy: T): Promise<{
|
|
|
156
145
|
default: T extends Lazy<infer U> ? U : T;
|
|
157
146
|
}>;
|
|
158
147
|
|
|
159
|
-
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
148
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>;
|
|
160
149
|
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap> extends ProcedureHandlerOptions<TInitialContext, unknown, ORPCErrorConstructorMap<TErrorMap>> {
|
|
161
150
|
}
|
|
162
|
-
type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap
|
|
163
|
-
type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap,
|
|
151
|
+
type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>>;
|
|
152
|
+
type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext> = {
|
|
164
153
|
path?: string[];
|
|
165
|
-
interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap
|
|
154
|
+
interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap>[];
|
|
166
155
|
} & (object extends TInitialContext ? {
|
|
167
156
|
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
168
157
|
} : {
|
|
169
158
|
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
170
159
|
});
|
|
171
|
-
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap,
|
|
160
|
+
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>;
|
|
172
161
|
|
|
173
162
|
export { Procedure as a, Lazy as h, createProcedureClient as u, unlazy as v };
|
|
174
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, ProcedureConfig as f, AnyMiddleware as g, ProcedureHandler 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,10 +1,10 @@
|
|
|
1
1
|
import { RPCSerializer, AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { Value, Promisable } from '@orpc/shared';
|
|
3
|
-
import { StandardMethod, StandardLazyRequest, StandardResponse } from '@
|
|
4
|
-
import { A as AnyProcedure, C as Context } from './server.
|
|
5
|
-
import { A as AnyRouter } from './server.
|
|
3
|
+
import { StandardMethod, StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
4
|
+
import { A as AnyProcedure, C as Context } from './server.BsujoJoF.mjs';
|
|
5
|
+
import { A as AnyRouter } from './server.BpmUhems.mjs';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { c as StandardHandlerHandleOptions, d as StandardHandlerCodec, e as StandardHandlerCodecResolvedProcedure } from './server.
|
|
7
|
+
import { c as StandardHandlerHandleOptions, d as StandardHandlerCodec, e as StandardHandlerCodecResolvedProcedure } from './server.BrURRtO7.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Methods that can invoke procedures by default. Browsers cannot trigger them
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Context } from './server.
|
|
2
|
-
import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.
|
|
1
|
+
import { C as Context } from './server.BsujoJoF.js';
|
|
2
|
+
import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.D23TTT5i.js';
|
|
3
3
|
|
|
4
4
|
interface RequestLimitHandlerPluginOptions {
|
|
5
5
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RPCSerializer, AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { Value, Promisable } from '@orpc/shared';
|
|
3
|
-
import { StandardMethod, StandardLazyRequest, StandardResponse } from '@
|
|
4
|
-
import { A as AnyProcedure, C as Context } from './server.
|
|
5
|
-
import { A as AnyRouter } from './server.
|
|
3
|
+
import { StandardMethod, StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
4
|
+
import { A as AnyProcedure, C as Context } from './server.BsujoJoF.js';
|
|
5
|
+
import { A as AnyRouter } from './server.CRwPbhLO.js';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { c as StandardHandlerHandleOptions, d as StandardHandlerCodec, e as StandardHandlerCodecResolvedProcedure } from './server.
|
|
7
|
+
import { c as StandardHandlerHandleOptions, d as StandardHandlerCodec, e as StandardHandlerCodecResolvedProcedure } from './server.D23TTT5i.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Methods that can invoke procedures by default. Browsers cannot trigger them
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { wrapAsyncIteratorPreservingEventMeta, ORPCError
|
|
1
|
+
import { wrapAsyncIteratorPreservingEventMeta, ORPCError } from '@orpc/client';
|
|
2
2
|
import { createORPCErrorConstructorMap, reconcileORPCError, ValidationError, ProcedureContract } from '@orpc/contract';
|
|
3
3
|
import { getConstructor, isTypescriptObject, resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, override, traceAsyncIterator, traceReadableStream, isPlainObject, mergeTwoLevels } from '@orpc/shared';
|
|
4
4
|
|
|
@@ -169,18 +169,6 @@ async function executeProcedureInternal(procedure, options) {
|
|
|
169
169
|
"handler",
|
|
170
170
|
() => procedure["~orpc"].handler({ ...options, context, input: currentInput }, currentInput)
|
|
171
171
|
);
|
|
172
|
-
if (currentOutput instanceof ORPCError) {
|
|
173
|
-
if (procedure["~orpc"].opaqueReturnedErrors) {
|
|
174
|
-
throw currentOutput;
|
|
175
|
-
}
|
|
176
|
-
if (currentOutput.inferable && !currentOutput.defined) {
|
|
177
|
-
throw currentOutput;
|
|
178
|
-
}
|
|
179
|
-
const error = cloneORPCError(currentOutput);
|
|
180
|
-
error.defined = false;
|
|
181
|
-
error.inferable = true;
|
|
182
|
-
throw error;
|
|
183
|
-
}
|
|
184
172
|
}
|
|
185
173
|
const startOutputIndex = midIndex === 0 ? 0 : orderedMiddlewares[midIndex - 1].outputSchemasLengthAtUse ?? 0;
|
|
186
174
|
const endOutputIndex = midIndex === orderedMiddlewares.length ? outputSchemas.length : orderedMiddlewares[midIndex].outputSchemasLengthAtUse ?? 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Context } from './server.
|
|
2
|
-
import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.
|
|
1
|
+
import { C as Context } from './server.BsujoJoF.mjs';
|
|
2
|
+
import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.BrURRtO7.mjs';
|
|
3
3
|
|
|
4
4
|
interface RequestLimitHandlerPluginOptions {
|
|
5
5
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
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.BsujoJoF.js';
|
|
3
3
|
|
|
4
|
-
type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any
|
|
4
|
+
type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any> | {
|
|
5
5
|
[k: string]: Lazyable<Router<TInitialContext>>;
|
|
6
6
|
};
|
|
7
|
-
type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap
|
|
7
|
+
type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap> : {
|
|
8
8
|
[K in keyof T]: T[K] extends RouterContract ? Lazyable<ContractedRouter<T[K], TInitialContext>> : never;
|
|
9
9
|
};
|
|
10
10
|
type AnyRouter = Router<any>;
|
|
@@ -17,7 +17,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer $>
|
|
|
17
17
|
*
|
|
18
18
|
* @see {@link https://orpc.dev/docs/router#infer-router-initial-contexts | Router - Infer Router Initial Contexts}
|
|
19
19
|
*/
|
|
20
|
-
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any
|
|
20
|
+
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any> ? UInitialContext : {
|
|
21
21
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
@@ -28,7 +28,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
|
|
|
28
28
|
*
|
|
29
29
|
* @see {@link https://orpc.dev/docs/router#infer-router-final-contexts | Router - Infer Router Final Contexts}
|
|
30
30
|
*/
|
|
31
|
-
type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any
|
|
31
|
+
type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any> ? MergedContext<UInitialContext, UInjectedContext> : {
|
|
32
32
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterFinalContexts<U> : never;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
@@ -39,7 +39,7 @@ type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer U
|
|
|
39
39
|
*
|
|
40
40
|
* @see {@link https://orpc.dev/docs/router#infer-router-inputs | Router - Infer Router Inputs}
|
|
41
41
|
*/
|
|
42
|
-
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any
|
|
42
|
+
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
43
43
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -50,7 +50,7 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
|
|
|
50
50
|
*
|
|
51
51
|
* @see {@link https://orpc.dev/docs/router#infer-router-outputs | Router - Infer Router Outputs}
|
|
52
52
|
*/
|
|
53
|
-
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any
|
|
53
|
+
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
54
54
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
@@ -58,7 +58,7 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
|
58
58
|
*
|
|
59
59
|
* @see {@link https://orpc.dev/docs/router#infer-router-error | Router - Infer Router Error}
|
|
60
60
|
*/
|
|
61
|
-
type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap
|
|
61
|
+
type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
|
|
62
62
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterError<U> : never;
|
|
63
63
|
}[keyof T];
|
|
64
64
|
/**
|
|
@@ -66,7 +66,7 @@ type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any,
|
|
|
66
66
|
*
|
|
67
67
|
* @see {@link https://orpc.dev/docs/router#infer-router-errors | Router - Infer Router Errors}
|
|
68
68
|
*/
|
|
69
|
-
type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap
|
|
69
|
+
type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
|
|
70
70
|
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterErrors<U> : never;
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyORPCError } from '@orpc/client';
|
|
2
2
|
import { OrderablePlugin, Interceptor, Promisable } from '@orpc/shared';
|
|
3
|
-
import { StandardLazyRequest, StandardResponse } from '@
|
|
4
|
-
import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.
|
|
3
|
+
import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
|
|
4
|
+
import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.BsujoJoF.js';
|
|
5
5
|
import { Schema, ErrorMap } from '@orpc/contract';
|
|
6
6
|
|
|
7
7
|
interface StandardHandlerPlugin<T extends Context> extends OrderablePlugin {
|
|
@@ -73,7 +73,7 @@ interface StandardHandlerOptions<TContext extends Context> {
|
|
|
73
73
|
* ClientInterceptor equivalent with createRouterClient.interceptors / createProcedure.interceptors
|
|
74
74
|
* useful for error handling, logging, metrics, etc. (not counting encoding/decoding)
|
|
75
75
|
*/
|
|
76
|
-
clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap
|
|
76
|
+
clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap>[];
|
|
77
77
|
plugins?: StandardHandlerPlugin<TContext>[];
|
|
78
78
|
}
|
|
79
79
|
declare class StandardHandler<T extends Context> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createProcedureClient, P as Procedure, L as Lazy, u as unlazy } from './server.
|
|
1
|
+
import { c as createProcedureClient, P as Procedure, L as Lazy, u as unlazy } from './server.CDOFCg6A.mjs';
|
|
2
2
|
import { resolveMetaPlugins, mergeErrorMap, ProcedureContract } from '@orpc/contract';
|
|
3
3
|
import { omit, isTypescriptObject } from '@orpc/shared';
|
|
4
4
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ORPCError, toORPCError, RPCSerializer, COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
2
2
|
import { sortPlugins, getOpenTelemetryConfig, runWithSpan, toArray, matchesHttpPathPrefix, intercept, ORPC_NAME, isAsyncIteratorObject, override, traceAsyncIterator, recordSpanError, pathToHttpPath, normalizeHttpPath, value, parseEmptyableJSON, getOwn } from '@orpc/shared';
|
|
3
|
-
import { flattenStandardHeader, parseStandardUrl } from '@
|
|
4
|
-
import { c as createProcedureClient, u as unlazy, P as Procedure } from './server.
|
|
5
|
-
import { w as walkProcedureContractsSync, g as getRouter, c as createContractProcedure, D as DEFAULT_SUCCESS_STATUS, a as DEFAULT_ERROR_STATUS } from './server.
|
|
3
|
+
import { flattenStandardHeader, parseStandardUrl } from '@standard-server/core';
|
|
4
|
+
import { c as createProcedureClient, u as unlazy, P as Procedure } from './server.CDOFCg6A.mjs';
|
|
5
|
+
import { w as walkProcedureContractsSync, g as getRouter, c as createContractProcedure, D as DEFAULT_SUCCESS_STATUS, a as DEFAULT_ERROR_STATUS } from './server.gXC5UaAH.mjs';
|
|
6
6
|
|
|
7
7
|
class CompositeStandardHandlerPlugin {
|
|
8
8
|
name = "~composite";
|
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.34",
|
|
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,25 +117,24 @@
|
|
|
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
|
-
"@
|
|
124
|
-
"@
|
|
125
|
-
"@
|
|
126
|
-
"@
|
|
127
|
-
"@
|
|
128
|
-
"@
|
|
120
|
+
"@orpc/client": "2.0.0-beta.34",
|
|
121
|
+
"@orpc/contract": "2.0.0-beta.34",
|
|
122
|
+
"@orpc/shared": "2.0.0-beta.34",
|
|
123
|
+
"@standard-server/aws-lambda": "~0.9.0",
|
|
124
|
+
"@standard-server/core": "~0.9.0",
|
|
125
|
+
"@standard-server/fastify": "~0.9.0",
|
|
126
|
+
"@standard-server/fetch": "~0.9.0",
|
|
127
|
+
"@standard-server/node": "~0.9.0",
|
|
128
|
+
"@standard-server/peer": "~0.9.0",
|
|
129
129
|
"cookie": "^2.0.1"
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
132
|
"crossws": "^0.4.6",
|
|
133
133
|
"fastify": "^5.12.1",
|
|
134
134
|
"supertest": "^7.2.2",
|
|
135
|
-
"zod": "^4.4
|
|
135
|
+
"zod": "^4.5.4"
|
|
136
136
|
},
|
|
137
137
|
"scripts": {
|
|
138
|
-
"build": "unbuild",
|
|
139
138
|
"type:check": "tsc -b"
|
|
140
139
|
}
|
|
141
140
|
}
|