@orpc/server 1.5.2 → 1.6.0
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 +1 -1
- package/dist/adapters/aws-lambda/index.mjs +2 -2
- package/dist/adapters/bun-ws/index.mjs +2 -2
- package/dist/adapters/crossws/index.mjs +2 -2
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/message-port/index.mjs +2 -2
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/adapters/websocket/index.mjs +2 -2
- package/dist/adapters/ws/index.mjs +2 -2
- package/dist/hibernation/index.d.mts +4 -4
- package/dist/hibernation/index.d.ts +4 -4
- package/dist/hibernation/index.mjs +3 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/plugins/index.mjs +9 -3
- package/dist/shared/{server.CHvOkcM3.mjs → server.CB8Snncu.mjs} +1 -1
- package/dist/shared/{server.DG7Tamti.mjs → server.DLJzqnSX.mjs} +3 -2
- package/package.json +10 -10
package/README.md
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
31
31
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
32
32
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
33
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
33
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
34
34
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
35
35
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
36
36
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
@@ -6,9 +6,9 @@ import '@orpc/standard-server/batch';
|
|
6
6
|
import '@orpc/client';
|
7
7
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
8
8
|
import '@orpc/contract';
|
9
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
9
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
10
10
|
import '@orpc/client/standard';
|
11
|
-
import '../../shared/server.
|
11
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
12
12
|
|
13
13
|
class AwsLambdaHandler {
|
14
14
|
constructor(standardHandler, options = {}) {
|
@@ -4,9 +4,9 @@ import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.D
|
|
4
4
|
import '@orpc/client';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
10
10
|
|
11
11
|
class experimental_BunWsHandler {
|
12
12
|
constructor(standardHandler) {
|
@@ -4,9 +4,9 @@ import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.D
|
|
4
4
|
import '@orpc/client';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
10
10
|
|
11
11
|
class experimental_CrosswsHandler {
|
12
12
|
constructor(standardHandler) {
|
@@ -4,11 +4,11 @@ import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fe
|
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
9
|
import '@orpc/standard-server/batch';
|
10
10
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
11
|
-
import '../../shared/server.
|
11
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
12
12
|
|
13
13
|
class BodyLimitPlugin {
|
14
14
|
maxBodySize;
|
@@ -5,9 +5,9 @@ import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.D
|
|
5
5
|
import '@orpc/client';
|
6
6
|
import '@orpc/standard-server';
|
7
7
|
import '@orpc/contract';
|
8
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
8
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
9
9
|
import '@orpc/client/standard';
|
10
|
-
import '../../shared/server.
|
10
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
11
11
|
|
12
12
|
class experimental_MessagePortHandler {
|
13
13
|
constructor(standardHandler) {
|
@@ -4,11 +4,11 @@ import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-serv
|
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
9
|
import '@orpc/standard-server/batch';
|
10
10
|
import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
|
11
|
-
import '../../shared/server.
|
11
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
12
12
|
|
13
13
|
class BodyLimitPlugin {
|
14
14
|
maxBodySize;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.
|
1
|
+
export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.CB8Snncu.mjs';
|
2
2
|
import '@orpc/client/standard';
|
3
3
|
import '@orpc/client';
|
4
4
|
import '@orpc/shared';
|
5
5
|
import '@orpc/standard-server';
|
6
|
-
import '../../shared/server.
|
6
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
7
7
|
import '@orpc/contract';
|
@@ -4,9 +4,9 @@ import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.D
|
|
4
4
|
import '@orpc/client';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
10
10
|
|
11
11
|
class experimental_WebsocketHandler {
|
12
12
|
#peers = /* @__PURE__ */ new WeakMap();
|
@@ -4,9 +4,9 @@ import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.D
|
|
4
4
|
import '@orpc/client';
|
5
5
|
import '@orpc/standard-server';
|
6
6
|
import '@orpc/contract';
|
7
|
-
import { b as StandardRPCHandler } from '../../shared/server.
|
7
|
+
import { b as StandardRPCHandler } from '../../shared/server.CB8Snncu.mjs';
|
8
8
|
import '@orpc/client/standard';
|
9
|
-
import '../../shared/server.
|
9
|
+
import '../../shared/server.DLJzqnSX.mjs';
|
10
10
|
|
11
11
|
class experimental_WsHandler {
|
12
12
|
constructor(standardHandler) {
|
@@ -24,9 +24,9 @@ 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 experimental_encodeHibernationRPCEvent(id:
|
27
|
+
declare function experimental_encodeHibernationRPCEvent(id: string, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
|
28
28
|
|
29
|
-
interface
|
29
|
+
interface experimental_HibernationPluginContext {
|
30
30
|
iterator?: experimental_HibernationEventIterator<any>;
|
31
31
|
}
|
32
32
|
/**
|
@@ -35,10 +35,10 @@ interface experimental_HibernationContext {
|
|
35
35
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
36
36
|
*/
|
37
37
|
declare class experimental_HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
38
|
-
readonly
|
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
43
|
export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
|
44
|
-
export type { experimental_EncodeHibernationRPCEventOptions,
|
44
|
+
export type { experimental_EncodeHibernationRPCEventOptions, experimental_HibernationPluginContext };
|
@@ -24,9 +24,9 @@ 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 experimental_encodeHibernationRPCEvent(id:
|
27
|
+
declare function experimental_encodeHibernationRPCEvent(id: string, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
|
28
28
|
|
29
|
-
interface
|
29
|
+
interface experimental_HibernationPluginContext {
|
30
30
|
iterator?: experimental_HibernationEventIterator<any>;
|
31
31
|
}
|
32
32
|
/**
|
@@ -35,10 +35,10 @@ interface experimental_HibernationContext {
|
|
35
35
|
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
|
36
36
|
*/
|
37
37
|
declare class experimental_HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
38
|
-
readonly
|
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
43
|
export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
|
44
|
-
export type { experimental_EncodeHibernationRPCEventOptions,
|
44
|
+
export type { experimental_EncodeHibernationRPCEventOptions, experimental_HibernationPluginContext };
|
@@ -22,7 +22,7 @@ function experimental_encodeHibernationRPCEvent(id, payload, options = {}) {
|
|
22
22
|
}
|
23
23
|
|
24
24
|
class experimental_HibernationPlugin {
|
25
|
-
|
25
|
+
CONTEXT_SYMBOL = Symbol("ORPC_HIBERNATION_CONTEXT");
|
26
26
|
order = 2e6;
|
27
27
|
// make sure execute after the batch plugin
|
28
28
|
init(options, _router) {
|
@@ -33,7 +33,7 @@ class experimental_HibernationPlugin {
|
|
33
33
|
const result = await options2.next({
|
34
34
|
...options2,
|
35
35
|
context: {
|
36
|
-
[this.
|
36
|
+
[this.CONTEXT_SYMBOL]: hibernationContext,
|
37
37
|
...options2.context
|
38
38
|
}
|
39
39
|
});
|
@@ -49,7 +49,7 @@ class experimental_HibernationPlugin {
|
|
49
49
|
};
|
50
50
|
});
|
51
51
|
options.clientInterceptors.unshift(async (options2) => {
|
52
|
-
const hibernationContext = options2.context[this.
|
52
|
+
const hibernationContext = options2.context[this.CONTEXT_SYMBOL];
|
53
53
|
if (!hibernationContext) {
|
54
54
|
throw new TypeError("[HibernationPlugin] Hibernation context has been corrupted or modified by another plugin or interceptor");
|
55
55
|
}
|
package/dist/index.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientPromiseResult } from '@orpc/client';
|
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, EnhanceRouteOptions, AnyContractRouter, AnyContractProcedure, Schema, ContractRouter, ContractProcedureDef, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta } from '@orpc/contract';
|
4
4
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
@@ -510,7 +510,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
510
510
|
/**
|
511
511
|
* Sets or overrides the config.
|
512
512
|
*
|
513
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
513
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
514
514
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
515
515
|
*/
|
516
516
|
$config(config: BuilderConfig): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
@@ -782,7 +782,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
782
782
|
/**
|
783
783
|
* Sets or overrides the config.
|
784
784
|
*
|
785
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
785
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
786
786
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
787
787
|
*/
|
788
788
|
$config(config: BuilderConfig): Implementer<TContract, TInitialContext, TCurrentContext>;
|
@@ -815,7 +815,7 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
815
815
|
* ```
|
816
816
|
*
|
817
817
|
*/
|
818
|
-
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never
|
818
|
+
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
819
819
|
|
820
820
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
|
821
821
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientPromiseResult } from '@orpc/client';
|
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, EnhanceRouteOptions, AnyContractRouter, AnyContractProcedure, Schema, ContractRouter, ContractProcedureDef, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta } from '@orpc/contract';
|
4
4
|
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
|
@@ -510,7 +510,7 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
|
|
510
510
|
/**
|
511
511
|
* Sets or overrides the config.
|
512
512
|
*
|
513
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
513
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
514
514
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
515
515
|
*/
|
516
516
|
$config(config: BuilderConfig): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
@@ -782,7 +782,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
|
|
782
782
|
/**
|
783
783
|
* Sets or overrides the config.
|
784
784
|
*
|
785
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
785
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
786
786
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
787
787
|
*/
|
788
788
|
$config(config: BuilderConfig): Implementer<TContract, TInitialContext, TCurrentContext>;
|
@@ -815,7 +815,7 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
815
815
|
* ```
|
816
816
|
*
|
817
817
|
*/
|
818
|
-
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never
|
818
|
+
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
819
819
|
|
820
820
|
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
|
821
821
|
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
package/dist/index.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter, fallbackContractConfig } from '@orpc/contract';
|
2
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, w as resolveContractProcedures, t as traverseContractProcedures, x as unlazyRouter, v as validateORPCError } from './shared/server.
|
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.DLJzqnSX.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, w as resolveContractProcedures, t as traverseContractProcedures, x as unlazyRouter, v as validateORPCError } from './shared/server.DLJzqnSX.mjs';
|
5
5
|
import { toORPCError } from '@orpc/client';
|
6
6
|
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
7
7
|
import { resolveMaybeOptionalOptions } from '@orpc/shared';
|
@@ -151,7 +151,7 @@ class Builder {
|
|
151
151
|
/**
|
152
152
|
* Sets or overrides the config.
|
153
153
|
*
|
154
|
-
* @see {@link https://orpc.unnoq.com/docs/
|
154
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side#middlewares-order Middlewares Order Docs}
|
155
155
|
* @see {@link https://orpc.unnoq.com/docs/best-practices/dedupe-middleware#configuration Dedupe Middleware Docs}
|
156
156
|
*/
|
157
157
|
$config(config) {
|
package/dist/plugins/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { value, isAsyncIteratorObject } from '@orpc/shared';
|
1
|
+
import { value, isAsyncIteratorObject, 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 { ORPCError } from '@orpc/client';
|
@@ -192,7 +192,7 @@ class ResponseHeadersPlugin {
|
|
192
192
|
if (!result.matched) {
|
193
193
|
return result;
|
194
194
|
}
|
195
|
-
const responseHeaders = result.response.headers;
|
195
|
+
const responseHeaders = clone(result.response.headers);
|
196
196
|
for (const [key, value] of resHeaders) {
|
197
197
|
if (Array.isArray(responseHeaders[key])) {
|
198
198
|
responseHeaders[key].push(value);
|
@@ -202,7 +202,13 @@ class ResponseHeadersPlugin {
|
|
202
202
|
responseHeaders[key] = value;
|
203
203
|
}
|
204
204
|
}
|
205
|
-
return
|
205
|
+
return {
|
206
|
+
...result,
|
207
|
+
response: {
|
208
|
+
...result.response,
|
209
|
+
headers: responseHeaders
|
210
|
+
}
|
211
|
+
};
|
206
212
|
});
|
207
213
|
}
|
208
214
|
}
|
@@ -2,7 +2,7 @@ import { toHttpPath, StandardRPCJsonSerializer, StandardRPCSerializer } from '@o
|
|
2
2
|
import { ORPCError, toORPCError } from '@orpc/client';
|
3
3
|
import { toArray, intercept, parseEmptyableJSON, NullProtoObj } 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.DLJzqnSX.mjs';
|
6
6
|
|
7
7
|
class CompositeStandardHandlerPlugin {
|
8
8
|
plugins;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { isContractProcedure, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
|
2
|
+
import { value, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
2
3
|
import { fallbackORPCErrorStatus, ORPCError } from '@orpc/client';
|
3
|
-
import { value, intercept } from '@orpc/shared';
|
4
4
|
|
5
5
|
const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
|
6
6
|
function lazy(loader, meta = {}) {
|
@@ -361,7 +361,8 @@ function createContractedProcedure(procedure, contract) {
|
|
361
361
|
});
|
362
362
|
}
|
363
363
|
function call(procedure, input, ...rest) {
|
364
|
-
|
364
|
+
const options = resolveMaybeOptionalOptions(rest);
|
365
|
+
return createProcedureClient(procedure, options)(input, options);
|
365
366
|
}
|
366
367
|
|
367
368
|
export { LAZY_SYMBOL as L, Procedure as P, createContractedProcedure as a, addMiddleware as b, createProcedureClient as c, isLazy as d, enhanceRouter as e, createAssertedLazyProcedure as f, getRouter as g, createORPCErrorConstructorMap as h, isProcedure as i, getLazyMeta as j, middlewareOutputFn as k, lazy as l, mergeCurrentContext as m, isStartWithMiddlewares as n, mergeMiddlewares as o, call as p, getHiddenRouterContract as q, createAccessibleLazyRouter as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u, validateORPCError as v, resolveContractProcedures as w, unlazyRouter as x };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.6.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -91,19 +91,19 @@
|
|
91
91
|
}
|
92
92
|
},
|
93
93
|
"dependencies": {
|
94
|
-
"@orpc/client": "1.
|
95
|
-
"@orpc/
|
96
|
-
"@orpc/
|
97
|
-
"@orpc/standard-server-
|
98
|
-
"@orpc/standard-server-
|
99
|
-
"@orpc/standard-server
|
100
|
-
"@orpc/
|
101
|
-
"@orpc/standard-server-
|
94
|
+
"@orpc/client": "1.6.0",
|
95
|
+
"@orpc/contract": "1.6.0",
|
96
|
+
"@orpc/shared": "1.6.0",
|
97
|
+
"@orpc/standard-server-fetch": "1.6.0",
|
98
|
+
"@orpc/standard-server-node": "1.6.0",
|
99
|
+
"@orpc/standard-server": "1.6.0",
|
100
|
+
"@orpc/standard-server-aws-lambda": "1.6.0",
|
101
|
+
"@orpc/standard-server-peer": "1.6.0"
|
102
102
|
},
|
103
103
|
"devDependencies": {
|
104
104
|
"@types/ws": "^8.18.1",
|
105
105
|
"crossws": "^0.4.1",
|
106
|
-
"next": "^15.3.
|
106
|
+
"next": "^15.3.4",
|
107
107
|
"supertest": "^7.1.0",
|
108
108
|
"ws": "^8.18.1"
|
109
109
|
},
|