@orpc/server 0.0.0-next.eb3d98a → 0.0.0-next.ebd6d63
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 +7 -2
- package/dist/adapters/aws-lambda/index.d.mts +5 -5
- package/dist/adapters/aws-lambda/index.d.ts +5 -5
- package/dist/adapters/aws-lambda/index.mjs +3 -3
- package/dist/adapters/bun-ws/index.d.mts +5 -5
- package/dist/adapters/bun-ws/index.d.ts +5 -5
- package/dist/adapters/bun-ws/index.mjs +10 -10
- package/dist/adapters/crossws/index.d.mts +5 -5
- package/dist/adapters/crossws/index.d.ts +5 -5
- package/dist/adapters/crossws/index.mjs +5 -7
- package/dist/adapters/fetch/index.d.mts +54 -9
- package/dist/adapters/fetch/index.d.ts +54 -9
- package/dist/adapters/fetch/index.mjs +74 -4
- package/dist/adapters/message-port/index.d.mts +5 -5
- package/dist/adapters/message-port/index.d.ts +5 -5
- package/dist/adapters/message-port/index.mjs +5 -7
- package/dist/adapters/node/index.d.mts +30 -9
- package/dist/adapters/node/index.d.ts +30 -9
- package/dist/adapters/node/index.mjs +69 -13
- 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 +9 -5
- package/dist/adapters/standard-peer/index.d.ts +9 -5
- package/dist/adapters/standard-peer/index.mjs +1 -1
- package/dist/adapters/websocket/index.d.mts +9 -7
- package/dist/adapters/websocket/index.d.ts +9 -7
- package/dist/adapters/websocket/index.mjs +5 -7
- package/dist/adapters/ws/index.d.mts +5 -5
- package/dist/adapters/ws/index.d.ts +5 -5
- package/dist/adapters/ws/index.mjs +5 -7
- package/dist/helpers/index.d.mts +20 -1
- package/dist/helpers/index.d.ts +20 -1
- package/dist/helpers/index.mjs +17 -1
- package/dist/hibernation/index.d.mts +11 -11
- package/dist/hibernation/index.d.ts +11 -11
- package/dist/hibernation/index.mjs +8 -8
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +5 -5
- package/dist/plugins/index.d.mts +5 -2
- package/dist/plugins/index.d.ts +5 -2
- package/dist/plugins/index.mjs +68 -57
- package/dist/shared/{server.CYNGeoCm.d.mts → server.B4BGqy3Y.d.mts} +2 -3
- package/dist/shared/{server.CYNGeoCm.d.ts → server.B4BGqy3Y.d.ts} +2 -3
- package/dist/shared/{server.CIL9uKTN.mjs → server.Bxx6tqNe.mjs} +64 -39
- package/dist/shared/{server.D0H-iaY3.d.ts → server.COL12UTb.d.ts} +3 -3
- package/dist/shared/{server.BEFBl-Cb.d.mts → server.CVKCo60T.d.mts} +2 -2
- package/dist/shared/{server.jMTkVNIb.d.ts → server.Cb6yD7DZ.d.ts} +1 -1
- package/dist/shared/{server.BU4WI18A.d.mts → server.Ck-gOLzq.d.mts} +3 -3
- package/dist/shared/{server.gqRxT-yN.d.mts → server.DBCUJijK.d.mts} +1 -1
- package/dist/shared/{server.B7b2w3_i.d.ts → server.DNtJ-p60.d.ts} +2 -2
- package/dist/shared/{server.Bmh5xd4n.d.ts → server.DPIFWpxG.d.ts} +1 -1
- package/dist/shared/{server.NeumLVdS.mjs → server.Ds4HPpvH.mjs} +105 -66
- package/dist/shared/{server.DhJj-1X9.d.mts → server.DzV1hr3z.d.mts} +1 -1
- package/dist/shared/{server.BW-nUGgA.mjs → server.TEVCLCFC.mjs} +3 -0
- package/dist/shared/server.UVMTOWrk.mjs +26 -0
- package/package.json +12 -11
- package/dist/shared/server.C6Q5sqYw.mjs +0 -20
package/dist/helpers/index.mjs
CHANGED
|
@@ -50,6 +50,12 @@ function getCookie(headers, name, options = {}) {
|
|
|
50
50
|
}
|
|
51
51
|
return parse(cookieHeader, options)[name];
|
|
52
52
|
}
|
|
53
|
+
function deleteCookie(headers, name, options = {}) {
|
|
54
|
+
return setCookie(headers, name, "", {
|
|
55
|
+
...options,
|
|
56
|
+
maxAge: 0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
53
59
|
|
|
54
60
|
const PBKDF2_CONFIG = {
|
|
55
61
|
name: "PBKDF2",
|
|
@@ -178,5 +184,15 @@ async function unsign(signedValue, secret) {
|
|
|
178
184
|
);
|
|
179
185
|
return isValid ? value : void 0;
|
|
180
186
|
}
|
|
187
|
+
function getSignedValue(signedValue) {
|
|
188
|
+
if (typeof signedValue !== "string") {
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
const lastDotIndex = signedValue.lastIndexOf(".");
|
|
192
|
+
if (lastDotIndex === -1) {
|
|
193
|
+
return void 0;
|
|
194
|
+
}
|
|
195
|
+
return signedValue.slice(0, lastDotIndex);
|
|
196
|
+
}
|
|
181
197
|
|
|
182
|
-
export { decodeBase64url, decrypt, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
|
|
198
|
+
export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
|
2
|
-
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { C as Context, R as Router } from '../shared/server.
|
|
2
|
+
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DBCUJijK.mjs';
|
|
3
|
+
import { HibernationEventIterator } from '@orpc/standard-server';
|
|
4
|
+
export { HibernationEventIterator, HibernationEventIteratorCallback } from '@orpc/standard-server';
|
|
5
|
+
import { C as Context, R as Router } from '../shared/server.B4BGqy3Y.mjs';
|
|
6
6
|
import '@orpc/client';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
import '@orpc/shared';
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
|
|
11
11
|
/**
|
|
12
12
|
* The type of event, each type corresponds a different operation
|
|
13
13
|
*
|
|
@@ -24,21 +24,21 @@ interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonS
|
|
|
24
24
|
*
|
|
25
25
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
26
26
|
*/
|
|
27
|
-
declare function
|
|
27
|
+
declare function encodeHibernationRPCEvent(id: string, payload: unknown, options?: EncodeHibernationRPCEventOptions): string;
|
|
28
28
|
|
|
29
|
-
interface
|
|
30
|
-
iterator?:
|
|
29
|
+
interface HibernationPluginContext {
|
|
30
|
+
iterator?: HibernationEventIterator<any>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Enable Hibernation APIs
|
|
34
34
|
*
|
|
35
35
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
36
36
|
*/
|
|
37
|
-
declare class
|
|
37
|
+
declare class HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
38
38
|
readonly CONTEXT_SYMBOL: symbol;
|
|
39
39
|
order: number;
|
|
40
40
|
init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export {
|
|
44
|
-
export type {
|
|
43
|
+
export { HibernationPlugin, encodeHibernationRPCEvent };
|
|
44
|
+
export type { EncodeHibernationRPCEventOptions, HibernationPluginContext };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
|
|
2
|
-
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { C as Context, R as Router } from '../shared/server.
|
|
2
|
+
import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DPIFWpxG.js';
|
|
3
|
+
import { HibernationEventIterator } from '@orpc/standard-server';
|
|
4
|
+
export { HibernationEventIterator, HibernationEventIteratorCallback } from '@orpc/standard-server';
|
|
5
|
+
import { C as Context, R as Router } from '../shared/server.B4BGqy3Y.js';
|
|
6
6
|
import '@orpc/client';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
import '@orpc/shared';
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
|
|
11
11
|
/**
|
|
12
12
|
* The type of event, each type corresponds a different operation
|
|
13
13
|
*
|
|
@@ -24,21 +24,21 @@ interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonS
|
|
|
24
24
|
*
|
|
25
25
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
26
26
|
*/
|
|
27
|
-
declare function
|
|
27
|
+
declare function encodeHibernationRPCEvent(id: string, payload: unknown, options?: EncodeHibernationRPCEventOptions): string;
|
|
28
28
|
|
|
29
|
-
interface
|
|
30
|
-
iterator?:
|
|
29
|
+
interface HibernationPluginContext {
|
|
30
|
+
iterator?: HibernationEventIterator<any>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Enable Hibernation APIs
|
|
34
34
|
*
|
|
35
35
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
|
36
36
|
*/
|
|
37
|
-
declare class
|
|
37
|
+
declare class HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
38
38
|
readonly CONTEXT_SYMBOL: symbol;
|
|
39
39
|
order: number;
|
|
40
40
|
init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export {
|
|
44
|
-
export type {
|
|
43
|
+
export { HibernationPlugin, encodeHibernationRPCEvent };
|
|
44
|
+
export type { EncodeHibernationRPCEventOptions, HibernationPluginContext };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { toORPCError } from '@orpc/client';
|
|
2
2
|
import { StandardRPCJsonSerializer } from '@orpc/client/standard';
|
|
3
3
|
import { stringifyJSON } from '@orpc/shared';
|
|
4
|
-
import { getEventMeta,
|
|
5
|
-
export {
|
|
4
|
+
import { getEventMeta, HibernationEventIterator } from '@orpc/standard-server';
|
|
5
|
+
export { HibernationEventIterator } from '@orpc/standard-server';
|
|
6
6
|
import { MessageType } from '@orpc/standard-server-peer';
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function encodeHibernationRPCEvent(id, payload, options = {}) {
|
|
9
9
|
const { event = "message", ...rest } = options;
|
|
10
10
|
const serializer = new StandardRPCJsonSerializer(rest);
|
|
11
11
|
const data = event === "error" ? toORPCError(payload).toJSON() : payload;
|
|
@@ -21,7 +21,7 @@ function experimental_encodeHibernationRPCEvent(id, payload, options = {}) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class HibernationPlugin {
|
|
25
25
|
CONTEXT_SYMBOL = Symbol("ORPC_HIBERNATION_CONTEXT");
|
|
26
26
|
order = 2e6;
|
|
27
27
|
// make sure execute after the batch plugin
|
|
@@ -33,8 +33,8 @@ class experimental_HibernationPlugin {
|
|
|
33
33
|
const result = await options2.next({
|
|
34
34
|
...options2,
|
|
35
35
|
context: {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
...options2.context,
|
|
37
|
+
[this.CONTEXT_SYMBOL]: hibernationContext
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
if (!result.matched || !hibernationContext.iterator) {
|
|
@@ -54,7 +54,7 @@ class experimental_HibernationPlugin {
|
|
|
54
54
|
throw new TypeError("[HibernationPlugin] Hibernation context has been corrupted or modified by another plugin or interceptor");
|
|
55
55
|
}
|
|
56
56
|
const output = await options2.next();
|
|
57
|
-
if (output instanceof
|
|
57
|
+
if (output instanceof HibernationEventIterator) {
|
|
58
58
|
hibernationContext.iterator = output;
|
|
59
59
|
}
|
|
60
60
|
return output;
|
|
@@ -62,4 +62,4 @@ class experimental_HibernationPlugin {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export {
|
|
65
|
+
export { HibernationPlugin, encodeHibernationRPCEvent };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientOptions, ClientPromiseResult } from '@orpc/client';
|
|
2
2
|
export { ClientContext, HTTPMethod, HTTPPath, ORPCError, isDefinedError, safe } from '@orpc/client';
|
|
3
3
|
import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErrorMap, Meta, MergedErrorMap, Route, Schema, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure } from '@orpc/contract';
|
|
4
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
|
4
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
|
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
|
6
|
-
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
-
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.
|
|
8
|
-
export {
|
|
9
|
-
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.
|
|
10
|
-
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.
|
|
6
|
+
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
+
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.B4BGqy3Y.mjs';
|
|
8
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.B4BGqy3Y.mjs';
|
|
9
|
+
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.DzV1hr3z.mjs';
|
|
10
|
+
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.DzV1hr3z.mjs';
|
|
11
11
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
|
12
12
|
|
|
13
13
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientOptions, ClientPromiseResult } from '@orpc/client';
|
|
2
2
|
export { ClientContext, HTTPMethod, HTTPPath, ORPCError, isDefinedError, safe } from '@orpc/client';
|
|
3
3
|
import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErrorMap, Meta, MergedErrorMap, Route, Schema, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure } from '@orpc/contract';
|
|
4
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
|
4
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
|
|
5
5
|
import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
|
|
6
|
-
export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
-
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.
|
|
8
|
-
export {
|
|
9
|
-
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.
|
|
10
|
-
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.
|
|
6
|
+
export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
7
|
+
import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.B4BGqy3Y.js';
|
|
8
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.B4BGqy3Y.js';
|
|
9
|
+
import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.Cb6yD7DZ.js';
|
|
10
|
+
export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.Cb6yD7DZ.js';
|
|
11
11
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
|
12
12
|
|
|
13
13
|
type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter, fallbackContractConfig } from '@orpc/contract';
|
|
2
|
-
export { ValidationError, eventIterator, type } from '@orpc/contract';
|
|
3
|
-
import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.
|
|
4
|
-
export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn,
|
|
2
|
+
export { ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
|
|
3
|
+
import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.Ds4HPpvH.mjs';
|
|
4
|
+
export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, v as resolveContractProcedures, t as traverseContractProcedures, w as unlazyRouter } from './shared/server.Ds4HPpvH.mjs';
|
|
5
5
|
import { toORPCError } from '@orpc/client';
|
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
|
7
7
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
8
|
-
export { EventPublisher, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
8
|
+
export { AsyncIteratorClass, EventPublisher, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
9
9
|
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
|
10
10
|
|
|
11
11
|
const DEFAULT_CONFIG = {
|
|
@@ -21,7 +21,7 @@ function fallbackConfig(key, value) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function decorateMiddleware(middleware) {
|
|
24
|
-
const decorated = (...args) => middleware(...args);
|
|
24
|
+
const decorated = ((...args) => middleware(...args));
|
|
25
25
|
decorated.mapInput = (mapInput) => {
|
|
26
26
|
const mapped = decorateMiddleware(
|
|
27
27
|
(options, input, ...rest) => middleware(options, mapInput(input), ...rest)
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
2
|
import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
|
|
3
3
|
import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
|
|
4
|
-
import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
5
|
-
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.
|
|
4
|
+
import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DBCUJijK.mjs';
|
|
5
|
+
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.B4BGqy3Y.mjs';
|
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
|
7
7
|
import { ORPCError } from '@orpc/client';
|
|
8
8
|
|
|
@@ -160,6 +160,9 @@ interface StrictGetMethodPluginOptions {
|
|
|
160
160
|
*/
|
|
161
161
|
declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
162
162
|
private readonly error;
|
|
163
|
+
/**
|
|
164
|
+
* make sure execute before batch plugin to get real method
|
|
165
|
+
*/
|
|
163
166
|
order: number;
|
|
164
167
|
constructor(options?: StrictGetMethodPluginOptions);
|
|
165
168
|
init(options: StandardHandlerOptions<T>): void;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
2
|
import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
|
|
3
3
|
import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
|
|
4
|
-
import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.
|
|
5
|
-
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.
|
|
4
|
+
import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DPIFWpxG.js';
|
|
5
|
+
import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.B4BGqy3Y.js';
|
|
6
6
|
import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
|
|
7
7
|
import { ORPCError } from '@orpc/client';
|
|
8
8
|
|
|
@@ -160,6 +160,9 @@ interface StrictGetMethodPluginOptions {
|
|
|
160
160
|
*/
|
|
161
161
|
declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
162
162
|
private readonly error;
|
|
163
|
+
/**
|
|
164
|
+
* make sure execute before batch plugin to get real method
|
|
165
|
+
*/
|
|
163
166
|
order: number;
|
|
164
167
|
constructor(options?: StrictGetMethodPluginOptions);
|
|
165
168
|
init(options: StandardHandlerOptions<T>): void;
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { value, isAsyncIteratorObject, clone } from '@orpc/shared';
|
|
1
|
+
import { runWithSpan, value, setSpanError, isAsyncIteratorObject, AsyncIteratorClass, clone } from '@orpc/shared';
|
|
2
2
|
import { flattenHeader } from '@orpc/standard-server';
|
|
3
3
|
import { parseBatchRequest, toBatchResponse } from '@orpc/standard-server/batch';
|
|
4
4
|
import { toFetchHeaders } from '@orpc/standard-server-fetch';
|
|
5
5
|
import { ORPCError } from '@orpc/client';
|
|
6
|
-
export { S as StrictGetMethodPlugin } from '../shared/server.
|
|
6
|
+
export { S as StrictGetMethodPlugin } from '../shared/server.TEVCLCFC.mjs';
|
|
7
7
|
import '@orpc/contract';
|
|
8
8
|
|
|
9
9
|
class BatchHandlerPlugin {
|
|
@@ -33,65 +33,76 @@ class BatchHandlerPlugin {
|
|
|
33
33
|
}
|
|
34
34
|
let isParsing = false;
|
|
35
35
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return options2.next({ ...options2, request: { ...mapped, body: () => Promise.resolve(mapped.body) } }).then(({ response: response2, matched }) => {
|
|
54
|
-
if (matched) {
|
|
55
|
-
if (response2.body instanceof Blob || response2.body instanceof FormData || isAsyncIteratorObject(response2.body)) {
|
|
56
|
-
return {
|
|
57
|
-
index,
|
|
58
|
-
status: 500,
|
|
59
|
-
headers: {},
|
|
60
|
-
body: "Batch responses do not support file/blob, or event-iterator. Please call this procedure separately outside of the batch request."
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return { ...response2, index };
|
|
36
|
+
return await runWithSpan({ name: "handle_batch_request" }, async (span) => {
|
|
37
|
+
const mode = xHeader === "buffered" ? "buffered" : "streaming";
|
|
38
|
+
isParsing = true;
|
|
39
|
+
const parsed = parseBatchRequest({ ...options2.request, body: await options2.request.body() });
|
|
40
|
+
isParsing = false;
|
|
41
|
+
span?.setAttribute("batch.mode", mode);
|
|
42
|
+
span?.setAttribute("batch.size", parsed.length);
|
|
43
|
+
const maxSize = await value(this.maxSize, options2);
|
|
44
|
+
if (parsed.length > maxSize) {
|
|
45
|
+
const message = "Batch request size exceeds the maximum allowed size";
|
|
46
|
+
setSpanError(span, message);
|
|
47
|
+
return {
|
|
48
|
+
matched: true,
|
|
49
|
+
response: {
|
|
50
|
+
status: 413,
|
|
51
|
+
headers: {},
|
|
52
|
+
body: message
|
|
64
53
|
}
|
|
65
|
-
|
|
66
|
-
}).catch(() => {
|
|
67
|
-
return { index, status: 500, headers: {}, body: "Internal server error" };
|
|
68
|
-
});
|
|
54
|
+
};
|
|
69
55
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
56
|
+
const responses = parsed.map(
|
|
57
|
+
(request, index) => {
|
|
58
|
+
const mapped = this.mapRequestItem(request, options2);
|
|
59
|
+
return options2.next({ ...options2, request: { ...mapped, body: () => Promise.resolve(mapped.body) } }).then(({ response: response2, matched }) => {
|
|
60
|
+
span?.addEvent(`response.${index}.${matched ? "success" : "not_matched"}`);
|
|
61
|
+
if (matched) {
|
|
62
|
+
if (response2.body instanceof Blob || response2.body instanceof FormData || isAsyncIteratorObject(response2.body)) {
|
|
63
|
+
return {
|
|
64
|
+
index,
|
|
65
|
+
status: 500,
|
|
66
|
+
headers: {},
|
|
67
|
+
body: "Batch responses do not support file/blob, or event-iterator. Please call this procedure separately outside of the batch request."
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { ...response2, index };
|
|
71
|
+
}
|
|
72
|
+
return { index, status: 404, headers: {}, body: "No procedure matched" };
|
|
73
|
+
}).catch((err) => {
|
|
74
|
+
Promise.reject(err);
|
|
75
|
+
return { index, status: 500, headers: {}, body: "Internal server error" };
|
|
76
|
+
});
|
|
88
77
|
}
|
|
89
|
-
|
|
78
|
+
);
|
|
79
|
+
await Promise.race(responses);
|
|
80
|
+
const status = await value(this.successStatus, responses, options2);
|
|
81
|
+
const headers = await value(this.headers, responses, options2);
|
|
82
|
+
const promises = [...responses];
|
|
83
|
+
const response = await toBatchResponse({
|
|
84
|
+
status,
|
|
85
|
+
headers,
|
|
86
|
+
mode,
|
|
87
|
+
body: new AsyncIteratorClass(
|
|
88
|
+
async () => {
|
|
89
|
+
const handling = promises.filter((p) => p !== void 0);
|
|
90
|
+
if (handling.length <= 0) {
|
|
91
|
+
return { done: true, value: void 0 };
|
|
92
|
+
}
|
|
93
|
+
const value2 = await Promise.race(handling);
|
|
94
|
+
promises[value2.index] = void 0;
|
|
95
|
+
return { done: false, value: value2 };
|
|
96
|
+
},
|
|
97
|
+
async () => {
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
matched: true,
|
|
103
|
+
response
|
|
104
|
+
};
|
|
90
105
|
});
|
|
91
|
-
return {
|
|
92
|
-
matched: true,
|
|
93
|
-
response
|
|
94
|
-
};
|
|
95
106
|
} catch (cause) {
|
|
96
107
|
if (isParsing) {
|
|
97
108
|
return {
|
|
@@ -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 {
|
|
@@ -190,5 +189,5 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
|
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 {
|
|
@@ -190,5 +189,5 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
|
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import { toHttpPath, StandardRPCJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
|
|
2
2
|
import { ORPCError, toORPCError } from '@orpc/client';
|
|
3
|
-
import { toArray, intercept, parseEmptyableJSON, NullProtoObj, value } from '@orpc/shared';
|
|
3
|
+
import { toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, parseEmptyableJSON, NullProtoObj, value } from '@orpc/shared';
|
|
4
4
|
import { flattenHeader } from '@orpc/standard-server';
|
|
5
|
-
import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.
|
|
5
|
+
import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.Ds4HPpvH.mjs';
|
|
6
6
|
|
|
7
7
|
class CompositeStandardHandlerPlugin {
|
|
8
8
|
plugins;
|
|
@@ -39,49 +39,74 @@ class StandardHandler {
|
|
|
39
39
|
this.rootInterceptors,
|
|
40
40
|
{ ...options, request, prefix },
|
|
41
41
|
async (interceptorOptions) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
return runWithSpan(
|
|
43
|
+
{ name: `${request.method} ${request.url.pathname}` },
|
|
44
|
+
async (span) => {
|
|
45
|
+
let step;
|
|
46
|
+
try {
|
|
47
|
+
return await intercept(
|
|
48
|
+
this.interceptors,
|
|
49
|
+
interceptorOptions,
|
|
50
|
+
async ({ request: request2, context, prefix: prefix2 }) => {
|
|
51
|
+
const method = request2.method;
|
|
52
|
+
const url = request2.url;
|
|
53
|
+
const pathname = prefix2 ? url.pathname.replace(prefix2, "") : url.pathname;
|
|
54
|
+
const match = await runWithSpan(
|
|
55
|
+
{ name: "find_procedure" },
|
|
56
|
+
() => this.matcher.match(method, `/${pathname.replace(/^\/|\/$/g, "")}`)
|
|
57
|
+
);
|
|
58
|
+
if (!match) {
|
|
59
|
+
return { matched: false, response: void 0 };
|
|
60
|
+
}
|
|
61
|
+
span?.updateName(`${ORPC_NAME}.${match.path.join("/")}`);
|
|
62
|
+
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
63
|
+
span?.setAttribute("rpc.method", match.path.join("."));
|
|
64
|
+
step = "decode_input";
|
|
65
|
+
let input = await runWithSpan(
|
|
66
|
+
{ name: "decode_input" },
|
|
67
|
+
() => this.codec.decode(request2, match.params, match.procedure)
|
|
68
|
+
);
|
|
69
|
+
step = void 0;
|
|
70
|
+
if (isAsyncIteratorObject(input)) {
|
|
71
|
+
input = asyncIteratorWithSpan(
|
|
72
|
+
{ name: "consume_event_iterator_input", signal: request2.signal },
|
|
73
|
+
input
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const client = createProcedureClient(match.procedure, {
|
|
77
|
+
context,
|
|
78
|
+
path: match.path,
|
|
79
|
+
interceptors: this.clientInterceptors
|
|
80
|
+
});
|
|
81
|
+
step = "call_procedure";
|
|
82
|
+
const output = await client(input, {
|
|
83
|
+
signal: request2.signal,
|
|
84
|
+
lastEventId: flattenHeader(request2.headers["last-event-id"])
|
|
85
|
+
});
|
|
86
|
+
step = void 0;
|
|
87
|
+
const response = this.codec.encode(output, match.procedure);
|
|
88
|
+
return {
|
|
89
|
+
matched: true,
|
|
90
|
+
response
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
if (step !== "call_procedure") {
|
|
96
|
+
setSpanError(span, e);
|
|
54
97
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
isDecoding = true;
|
|
61
|
-
const input = await this.codec.decode(request2, match.params, match.procedure);
|
|
62
|
-
isDecoding = false;
|
|
63
|
-
const output = await client(input, {
|
|
64
|
-
signal: request2.signal,
|
|
65
|
-
lastEventId: flattenHeader(request2.headers["last-event-id"])
|
|
66
|
-
});
|
|
67
|
-
const response = this.codec.encode(output, match.procedure);
|
|
98
|
+
const error = step === "decode_input" && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
|
|
99
|
+
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
100
|
+
cause: e
|
|
101
|
+
}) : toORPCError(e);
|
|
102
|
+
const response = this.codec.encodeError(error);
|
|
68
103
|
return {
|
|
69
104
|
matched: true,
|
|
70
105
|
response
|
|
71
106
|
};
|
|
72
107
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const error = isDecoding && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
|
|
76
|
-
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
77
|
-
cause: e
|
|
78
|
-
}) : toORPCError(e);
|
|
79
|
-
const response = this.codec.encodeError(error);
|
|
80
|
-
return {
|
|
81
|
-
matched: true,
|
|
82
|
-
response
|
|
83
|
-
};
|
|
84
|
-
}
|
|
108
|
+
}
|
|
109
|
+
);
|
|
85
110
|
}
|
|
86
111
|
);
|
|
87
112
|
}
|
|
@@ -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.B4BGqy3Y.js';
|
|
3
|
+
import { i as StandardMatcher, h as StandardMatchResult, e as StandardHandlerOptions, f as StandardHandler } from './server.DPIFWpxG.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.Cb6yD7DZ.js';
|
|
7
7
|
|
|
8
8
|
interface StandardRPCMatcherOptions {
|
|
9
9
|
/**
|