@orpc/server 2.0.0-beta.3 → 2.0.0-beta.4
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 +8 -7
- package/dist/adapters/crossws/index.d.mts +2 -2
- package/dist/adapters/crossws/index.d.ts +2 -2
- package/dist/adapters/fetch/index.d.mts +2 -2
- package/dist/adapters/fetch/index.d.ts +2 -2
- package/dist/adapters/message-port/index.d.mts +2 -2
- package/dist/adapters/message-port/index.d.ts +2 -2
- package/dist/adapters/node/index.d.mts +2 -2
- package/dist/adapters/node/index.d.ts +2 -2
- package/dist/adapters/standard/index.d.mts +3 -3
- package/dist/adapters/standard/index.d.ts +3 -3
- 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/plugins/index.d.mts +35 -4
- package/dist/plugins/index.d.ts +35 -4
- package/dist/plugins/index.mjs +53 -1
- package/dist/shared/{server.B_U9y00a.d.mts → server.Cj5lgPuG.d.mts} +1 -1
- package/dist/shared/{server.EOHJ3NJr.d.ts → server.DBANIheG.d.ts} +1 -1
- package/dist/shared/{server.BB_Ik9Ph.d.mts → server.DJIkub_t.d.mts} +1 -1
- package/dist/shared/{server.T9F3bzZx.d.ts → server.d_2NS3g5.d.ts} +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -37,18 +37,19 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
37
37
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): Integrate with [Valibot](https://valibot.dev/).
|
|
38
38
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): Integrate with [ArkType](https://arktype.io/).
|
|
39
39
|
|
|
40
|
-
**Framework & ecosystem integrations**
|
|
41
|
-
|
|
42
|
-
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
43
|
-
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
44
|
-
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
45
|
-
|
|
46
40
|
**Built-in features**
|
|
47
41
|
|
|
48
42
|
- [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher): Pub/Sub.
|
|
49
43
|
- [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting.
|
|
50
44
|
- [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
|
|
51
45
|
|
|
46
|
+
**Framework & ecosystem integrations**
|
|
47
|
+
|
|
48
|
+
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
49
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
50
|
+
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
51
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
52
|
+
|
|
52
53
|
**Observability**
|
|
53
54
|
|
|
54
55
|
- [@orpc/opentelemetry](https://www.npmjs.com/package/@orpc/opentelemetry): Instrument your API with [OpenTelemetry](https://opentelemetry.io/).
|
|
@@ -150,7 +151,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
150
151
|
<a href="https://github.com/theoludwig?ref=orpc" target="_blank" rel="noopener" title="Théo LUDWIG"><img src="https://avatars.githubusercontent.com/u/25207499?u=a6a9653725a2f574c07893748806668e0598cdbe&v=4" width="32" height="32" alt="Théo LUDWIG" /></a>
|
|
151
152
|
<a href="https://github.com/abhay-ramesh?ref=orpc" target="_blank" rel="noopener" title="Abhay Ramesh"><img src="https://avatars.githubusercontent.com/u/66196314?u=c5c2b0327b26606c2efcfaf17046ab18c3d25c57&v=4" width="32" height="32" alt="Abhay Ramesh" /></a>
|
|
152
153
|
<a href="https://github.com/shr-ink?ref=orpc" target="_blank" rel="noopener" title="shr.ink oü"><img src="https://avatars.githubusercontent.com/u/139700438?v=4" width="32" height="32" alt="shr.ink oü" /></a>
|
|
153
|
-
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=
|
|
154
|
+
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=505e54608466ab53754f702973687b04c6424c1f&v=4" width="32" height="32" alt="0x4e32" /></a>
|
|
154
155
|
<a href="https://github.com/yzuyr?ref=orpc" target="_blank" rel="noopener" title="Ryuz"><img src="https://avatars.githubusercontent.com/u/196539378?u=d38374588d219b6748b16406982f6559411466d4&v=4" width="32" height="32" alt="Ryuz" /></a>
|
|
155
156
|
<a href="https://github.com/happyboy2022?ref=orpc" target="_blank" rel="noopener" title="happyboy"><img src="https://avatars.githubusercontent.com/u/103669586?u=65b49c4b893ed3703909fbb3a7a22313f3f9c121&v=4" width="32" height="32" alt="happyboy" /></a>
|
|
156
157
|
<a href="https://github.com/YiCChi?ref=orpc" target="_blank" rel="noopener" title="yicchi"><img src="https://avatars.githubusercontent.com/u/86967274?u=6c2756f09fe15dd94d572f560e979cd157982852&v=4" width="32" height="32" alt="yicchi" /></a>
|
|
@@ -2,10 +2,10 @@ import { MaybeOptionalOptions } from '@orpc/shared';
|
|
|
2
2
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
3
3
|
import { Message, Peer } from 'crossws';
|
|
4
4
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
5
|
-
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
+
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
6
6
|
import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.mjs';
|
|
7
7
|
import { R as Router } from '../../shared/server.BsNNjG5J.mjs';
|
|
8
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
8
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.Cj5lgPuG.mjs';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
import '@orpc/contract';
|
|
11
11
|
import '@standardserver/core';
|
|
@@ -2,10 +2,10 @@ import { MaybeOptionalOptions } from '@orpc/shared';
|
|
|
2
2
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
3
3
|
import { Message, Peer } from 'crossws';
|
|
4
4
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
5
|
-
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
+
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DBANIheG.js';
|
|
6
6
|
import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.js';
|
|
7
7
|
import { R as Router } from '../../shared/server.Pa0F03f_.js';
|
|
8
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
8
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.d_2NS3g5.js';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
import '@orpc/contract';
|
|
11
11
|
import '@standardserver/core';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@standardserver/fetch';
|
|
4
|
-
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
4
|
+
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
5
5
|
import { FriendlyStandardHandlerHandleOptions } from '../standard/index.mjs';
|
|
6
6
|
import { R as Router } from '../../shared/server.BsNNjG5J.mjs';
|
|
7
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
7
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.Cj5lgPuG.mjs';
|
|
8
8
|
import '@orpc/client';
|
|
9
9
|
import '@orpc/contract';
|
|
10
10
|
import '@standardserver/core';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
2
2
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
3
|
import { ToFetchResponseOptions } from '@standardserver/fetch';
|
|
4
|
-
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
4
|
+
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DBANIheG.js';
|
|
5
5
|
import { FriendlyStandardHandlerHandleOptions } from '../standard/index.js';
|
|
6
6
|
import { R as Router } from '../../shared/server.Pa0F03f_.js';
|
|
7
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
7
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.d_2NS3g5.js';
|
|
8
8
|
import '@orpc/client';
|
|
9
9
|
import '@orpc/contract';
|
|
10
10
|
import '@standardserver/core';
|
|
@@ -2,10 +2,10 @@ import { SupportedMessagePort } from '@orpc/client/message-port';
|
|
|
2
2
|
import { Value, Promisable, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
3
|
import { ServerPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
4
4
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
5
|
-
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
+
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
6
6
|
import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.mjs';
|
|
7
7
|
import { R as Router } from '../../shared/server.BsNNjG5J.mjs';
|
|
8
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
8
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.Cj5lgPuG.mjs';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
import '@orpc/contract';
|
|
11
11
|
import '@standardserver/core';
|
|
@@ -2,10 +2,10 @@ import { SupportedMessagePort } from '@orpc/client/message-port';
|
|
|
2
2
|
import { Value, Promisable, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
3
|
import { ServerPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
4
4
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
5
|
-
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
5
|
+
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DBANIheG.js';
|
|
6
6
|
import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.js';
|
|
7
7
|
import { R as Router } from '../../shared/server.Pa0F03f_.js';
|
|
8
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
8
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.d_2NS3g5.js';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
import '@orpc/contract';
|
|
11
11
|
import '@standardserver/core';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@standardserver/node';
|
|
2
2
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
3
3
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
|
4
|
-
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
4
|
+
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
5
5
|
import { FriendlyStandardHandlerHandleOptions } from '../standard/index.mjs';
|
|
6
6
|
import compression from '@orpc/interop/compression';
|
|
7
7
|
import { R as Router } from '../../shared/server.BsNNjG5J.mjs';
|
|
8
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
8
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.Cj5lgPuG.mjs';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
import '@orpc/contract';
|
|
11
11
|
import '@standardserver/core';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@standardserver/node';
|
|
2
2
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
3
3
|
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
|
|
4
|
-
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
4
|
+
import { e as StandardHandlerPlugin, b as StandardHandlerHandleOptions, S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DBANIheG.js';
|
|
5
5
|
import { FriendlyStandardHandlerHandleOptions } from '../standard/index.js';
|
|
6
6
|
import compression from '@orpc/interop/compression';
|
|
7
7
|
import { R as Router } from '../../shared/server.Pa0F03f_.js';
|
|
8
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
8
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.d_2NS3g5.js';
|
|
9
9
|
import '@orpc/client';
|
|
10
10
|
import '@orpc/contract';
|
|
11
11
|
import '@standardserver/core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as StandardHandlerHandleOptions } from '../../shared/server.
|
|
2
|
-
export { C as CompositeStandardHandlerPlugin, O as OtelHandlerPlugin, S as StandardHandler, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure,
|
|
3
|
-
export { a as RPCHandlerCodec, R as RPCHandlerCodecOptions, b as RPCMatcher, c as RPCMatcherOptions } from '../../shared/server.
|
|
1
|
+
import { b as StandardHandlerHandleOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
2
|
+
export { C as CompositeStandardHandlerPlugin, O as OtelHandlerPlugin, S as StandardHandler, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure, h as StandardHandlerHandleResult, i as StandardHandlerInterceptor, g as StandardHandlerInterceptorOptions, a as StandardHandlerOptions, e as StandardHandlerPlugin, j as StandardHandlerRoutingInterceptor, f as StandardHandlerRoutingInterceptorOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
3
|
+
export { a as RPCHandlerCodec, R as RPCHandlerCodecOptions, b as RPCMatcher, c as RPCMatcherOptions } from '../../shared/server.Cj5lgPuG.mjs';
|
|
4
4
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
5
5
|
export { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from '@standardserver/core';
|
|
6
6
|
import '@orpc/client';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as StandardHandlerHandleOptions } from '../../shared/server.
|
|
2
|
-
export { C as CompositeStandardHandlerPlugin, O as OtelHandlerPlugin, S as StandardHandler, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure,
|
|
3
|
-
export { a as RPCHandlerCodec, R as RPCHandlerCodecOptions, b as RPCMatcher, c as RPCMatcherOptions } from '../../shared/server.
|
|
1
|
+
import { b as StandardHandlerHandleOptions } from '../../shared/server.DBANIheG.js';
|
|
2
|
+
export { C as CompositeStandardHandlerPlugin, O as OtelHandlerPlugin, S as StandardHandler, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure, h as StandardHandlerHandleResult, i as StandardHandlerInterceptor, g as StandardHandlerInterceptorOptions, a as StandardHandlerOptions, e as StandardHandlerPlugin, j as StandardHandlerRoutingInterceptor, f as StandardHandlerRoutingInterceptorOptions } from '../../shared/server.DBANIheG.js';
|
|
3
|
+
export { a as RPCHandlerCodec, R as RPCHandlerCodecOptions, b as RPCMatcher, c as RPCMatcherOptions } from '../../shared/server.d_2NS3g5.js';
|
|
4
4
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
5
5
|
export { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from '@standardserver/core';
|
|
6
6
|
import '@orpc/client';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
2
|
import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
|
|
3
3
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
4
|
-
import { b as StandardHandlerHandleOptions, S as StandardHandler } from '../../shared/server.
|
|
4
|
+
import { b as StandardHandlerHandleOptions, S as StandardHandler } from '../../shared/server.DJIkub_t.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
2
|
import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
|
|
3
3
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
4
|
-
import { b as StandardHandlerHandleOptions, S as StandardHandler } from '../../shared/server.
|
|
4
|
+
import { b as StandardHandlerHandleOptions, S as StandardHandler } from '../../shared/server.DBANIheG.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
3
3
|
import { C as Context } from '../../shared/server.BL22TloH.mjs';
|
|
4
|
-
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
4
|
+
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DJIkub_t.mjs';
|
|
5
5
|
import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.mjs';
|
|
6
6
|
import { R as Router } from '../../shared/server.BsNNjG5J.mjs';
|
|
7
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
7
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.Cj5lgPuG.mjs';
|
|
8
8
|
import '@orpc/client';
|
|
9
9
|
import '@orpc/contract';
|
|
10
10
|
import '@standardserver/core';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MaybeOptionalOptions } from '@orpc/shared';
|
|
2
2
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
3
3
|
import { C as Context } from '../../shared/server.BL22TloH.js';
|
|
4
|
-
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.
|
|
4
|
+
import { S as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DBANIheG.js';
|
|
5
5
|
import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.js';
|
|
6
6
|
import { R as Router } from '../../shared/server.Pa0F03f_.js';
|
|
7
|
-
import { R as RPCHandlerCodecOptions } from '../../shared/server.
|
|
7
|
+
import { R as RPCHandlerCodecOptions } from '../../shared/server.d_2NS3g5.js';
|
|
8
8
|
import '@orpc/client';
|
|
9
9
|
import '@orpc/contract';
|
|
10
10
|
import '@standardserver/core';
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
1
|
+
import { Value, Promisable, ThrowableError } from '@orpc/shared';
|
|
2
2
|
import { StandardLazyRequest, StandardHeaders } from '@standardserver/core';
|
|
3
3
|
import { C as Context } from '../shared/server.BL22TloH.mjs';
|
|
4
|
-
import { e as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions } from '../shared/server.
|
|
4
|
+
import { e as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.DJIkub_t.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
|
|
@@ -162,5 +162,36 @@ declare class ResponseHeadersHandlerPlugin<T extends ResponseHeadersHandlerPlugi
|
|
|
162
162
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
interface RethrowHandlerPluginOptions<T extends Context> {
|
|
166
|
+
/**
|
|
167
|
+
* Decide which errors should be rethrown.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const rethrowPlugin = new RethrowHandlerPlugin({
|
|
172
|
+
* filter: (error) => {
|
|
173
|
+
* // Rethrow all non-ORPCError errors
|
|
174
|
+
* return !(error instanceof ORPCError)
|
|
175
|
+
* }
|
|
176
|
+
* })
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
filter: (error: ThrowableError, options: StandardHandlerInterceptorOptions<T>) => boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The plugin can bypass oRPC's built-in error handling
|
|
183
|
+
* and rethrow matching errors directly to your framework's error handling mechanism
|
|
184
|
+
* (e.g., NestJS exception filters, Express error middleware).
|
|
185
|
+
*
|
|
186
|
+
* @see {@link https://orpc.dev/docs/plugins/rethrow Rethrow Plugin Documentation}
|
|
187
|
+
*/
|
|
188
|
+
declare class RethrowHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
189
|
+
name: string;
|
|
190
|
+
private readonly filter;
|
|
191
|
+
private readonly CONTEXT_SYMBOL;
|
|
192
|
+
constructor(options: RethrowHandlerPluginOptions<T>);
|
|
193
|
+
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { BatchHandlerPlugin, CORSHandlerPlugin, CSRFGuardHandlerPlugin, RequestHeadersHandlerPlugin, ResponseHeadersHandlerPlugin, RethrowHandlerPlugin };
|
|
197
|
+
export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, RequestHeadersHandlerPluginContext, ResponseHeadersHandlerPluginContext, RethrowHandlerPluginOptions };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
1
|
+
import { Value, Promisable, ThrowableError } from '@orpc/shared';
|
|
2
2
|
import { StandardLazyRequest, StandardHeaders } from '@standardserver/core';
|
|
3
3
|
import { C as Context } from '../shared/server.BL22TloH.js';
|
|
4
|
-
import { e as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions } from '../shared/server.
|
|
4
|
+
import { e as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.DBANIheG.js';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
|
|
@@ -162,5 +162,36 @@ declare class ResponseHeadersHandlerPlugin<T extends ResponseHeadersHandlerPlugi
|
|
|
162
162
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
interface RethrowHandlerPluginOptions<T extends Context> {
|
|
166
|
+
/**
|
|
167
|
+
* Decide which errors should be rethrown.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const rethrowPlugin = new RethrowHandlerPlugin({
|
|
172
|
+
* filter: (error) => {
|
|
173
|
+
* // Rethrow all non-ORPCError errors
|
|
174
|
+
* return !(error instanceof ORPCError)
|
|
175
|
+
* }
|
|
176
|
+
* })
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
filter: (error: ThrowableError, options: StandardHandlerInterceptorOptions<T>) => boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The plugin can bypass oRPC's built-in error handling
|
|
183
|
+
* and rethrow matching errors directly to your framework's error handling mechanism
|
|
184
|
+
* (e.g., NestJS exception filters, Express error middleware).
|
|
185
|
+
*
|
|
186
|
+
* @see {@link https://orpc.dev/docs/plugins/rethrow Rethrow Plugin Documentation}
|
|
187
|
+
*/
|
|
188
|
+
declare class RethrowHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
189
|
+
name: string;
|
|
190
|
+
private readonly filter;
|
|
191
|
+
private readonly CONTEXT_SYMBOL;
|
|
192
|
+
constructor(options: RethrowHandlerPluginOptions<T>);
|
|
193
|
+
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { BatchHandlerPlugin, CORSHandlerPlugin, CSRFGuardHandlerPlugin, RequestHeadersHandlerPlugin, ResponseHeadersHandlerPlugin, RethrowHandlerPlugin };
|
|
197
|
+
export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, RequestHeadersHandlerPluginContext, ResponseHeadersHandlerPluginContext, RethrowHandlerPluginOptions };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -302,4 +302,56 @@ class ResponseHeadersHandlerPlugin {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
class RethrowHandlerPlugin {
|
|
306
|
+
name = "~rethrow";
|
|
307
|
+
filter;
|
|
308
|
+
CONTEXT_SYMBOL = Symbol("ORPC_RETHROW_HANDLER_PLUGIN_CONTEXT");
|
|
309
|
+
constructor(options) {
|
|
310
|
+
this.filter = options.filter;
|
|
311
|
+
}
|
|
312
|
+
init(options) {
|
|
313
|
+
const routingInterceptor = async (options2) => {
|
|
314
|
+
const pluginContext = {};
|
|
315
|
+
const result = await options2.next({
|
|
316
|
+
...options2,
|
|
317
|
+
context: {
|
|
318
|
+
...options2.context,
|
|
319
|
+
[this.CONTEXT_SYMBOL]: pluginContext
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
if (pluginContext.error) {
|
|
323
|
+
throw pluginContext.error.value;
|
|
324
|
+
}
|
|
325
|
+
return result;
|
|
326
|
+
};
|
|
327
|
+
const interceptor = async (options2) => {
|
|
328
|
+
const pluginContext = options2.context[this.CONTEXT_SYMBOL];
|
|
329
|
+
if (!pluginContext) {
|
|
330
|
+
throw new TypeError("[RethrowHandlerPlugin] Rethrow handler context has been corrupted or modified by another plugin or interceptor");
|
|
331
|
+
}
|
|
332
|
+
try {
|
|
333
|
+
return await options2.next();
|
|
334
|
+
} catch (error) {
|
|
335
|
+
if (this.filter(error, options2)) {
|
|
336
|
+
pluginContext.error = { value: error };
|
|
337
|
+
}
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
return {
|
|
342
|
+
...options,
|
|
343
|
+
routingInterceptors: [
|
|
344
|
+
...toArray(options.routingInterceptors),
|
|
345
|
+
routingInterceptor
|
|
346
|
+
// rethrow as early as possible and keep it close to `interceptor` to avoid a corrupted or modified context
|
|
347
|
+
],
|
|
348
|
+
interceptors: [
|
|
349
|
+
interceptor,
|
|
350
|
+
// catch as many errors as possible
|
|
351
|
+
...toArray(options.interceptors)
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export { BatchHandlerPlugin, CORSHandlerPlugin, RequestHeadersHandlerPlugin, ResponseHeadersHandlerPlugin, RethrowHandlerPlugin };
|
|
@@ -4,7 +4,7 @@ import { StandardMethod, StandardLazyRequest, StandardResponse } from '@standard
|
|
|
4
4
|
import { A as AnyProcedure, C as Context } from './server.BL22TloH.mjs';
|
|
5
5
|
import { A as AnyRouter } from './server.BsNNjG5J.mjs';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { b as StandardHandlerHandleOptions, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure } from './server.
|
|
7
|
+
import { b as StandardHandlerHandleOptions, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure } from './server.DJIkub_t.mjs';
|
|
8
8
|
|
|
9
9
|
interface RPCMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -101,4 +101,4 @@ interface StandardHandlerCodec<T extends Context> {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export { CompositeStandardHandlerPlugin as C, OtelHandlerPlugin as O, StandardHandler as S };
|
|
104
|
-
export type { StandardHandlerOptions as a, StandardHandlerHandleOptions as b, StandardHandlerCodec as c, StandardHandlerCodecResolvedProcedure as d, StandardHandlerPlugin as e, StandardHandlerRoutingInterceptorOptions as f,
|
|
104
|
+
export type { StandardHandlerOptions as a, StandardHandlerHandleOptions as b, StandardHandlerCodec as c, StandardHandlerCodecResolvedProcedure as d, StandardHandlerPlugin as e, StandardHandlerRoutingInterceptorOptions as f, StandardHandlerInterceptorOptions as g, StandardHandlerHandleResult as h, StandardHandlerInterceptor as i, StandardHandlerRoutingInterceptor as j };
|
|
@@ -101,4 +101,4 @@ interface StandardHandlerCodec<T extends Context> {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export { CompositeStandardHandlerPlugin as C, OtelHandlerPlugin as O, StandardHandler as S };
|
|
104
|
-
export type { StandardHandlerOptions as a, StandardHandlerHandleOptions as b, StandardHandlerCodec as c, StandardHandlerCodecResolvedProcedure as d, StandardHandlerPlugin as e, StandardHandlerRoutingInterceptorOptions as f,
|
|
104
|
+
export type { StandardHandlerOptions as a, StandardHandlerHandleOptions as b, StandardHandlerCodec as c, StandardHandlerCodecResolvedProcedure as d, StandardHandlerPlugin as e, StandardHandlerRoutingInterceptorOptions as f, StandardHandlerInterceptorOptions as g, StandardHandlerHandleResult as h, StandardHandlerInterceptor as i, StandardHandlerRoutingInterceptor as j };
|
|
@@ -4,7 +4,7 @@ import { StandardMethod, StandardLazyRequest, StandardResponse } from '@standard
|
|
|
4
4
|
import { A as AnyProcedure, C as Context } from './server.BL22TloH.js';
|
|
5
5
|
import { A as AnyRouter } from './server.Pa0F03f_.js';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { b as StandardHandlerHandleOptions, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure } from './server.
|
|
7
|
+
import { b as StandardHandlerHandleOptions, c as StandardHandlerCodec, d as StandardHandlerCodecResolvedProcedure } from './server.DBANIheG.js';
|
|
8
8
|
|
|
9
9
|
interface RPCMatcherOptions {
|
|
10
10
|
/**
|
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.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
"@standardserver/node": "^0.0.25",
|
|
91
91
|
"@standardserver/peer": "^0.0.25",
|
|
92
92
|
"cookie": "^1.1.1",
|
|
93
|
-
"@orpc/
|
|
94
|
-
"@orpc/interop": "2.0.0-beta.
|
|
95
|
-
"@orpc/
|
|
96
|
-
"@orpc/
|
|
93
|
+
"@orpc/client": "2.0.0-beta.4",
|
|
94
|
+
"@orpc/interop": "2.0.0-beta.4",
|
|
95
|
+
"@orpc/contract": "2.0.0-beta.4",
|
|
96
|
+
"@orpc/shared": "2.0.0-beta.4"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"crossws": "^0.4.6",
|