@orpc/server 1.0.0-beta.7 → 1.0.3
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 +13 -17
- package/dist/adapters/fetch/index.d.mts +15 -4
- package/dist/adapters/fetch/index.d.ts +15 -4
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/node/index.d.mts +15 -4
- package/dist/adapters/node/index.d.ts +15 -4
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.d.mts +4 -4
- package/dist/adapters/standard/index.d.ts +4 -4
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/index.d.mts +543 -6
- package/dist/index.d.ts +543 -6
- package/dist/index.mjs +114 -6
- package/dist/plugins/index.d.mts +33 -2
- package/dist/plugins/index.d.ts +33 -2
- package/dist/shared/{server.BuLPHTX1.d.mts → server.CN0534_m.d.mts} +2 -2
- package/dist/shared/{server.DMhSfHk1.d.ts → server.CjlA3NKP.d.ts} +2 -2
- package/dist/shared/{server.D_vpYits.d.ts → server.CuD15qZB.d.ts} +2 -2
- package/dist/shared/{server.CaWivVk3.d.ts → server.D5fBlF9j.d.ts} +1 -1
- package/dist/shared/{server.C37gDhSZ.mjs → server.DG7Tamti.mjs} +3 -0
- package/dist/shared/{server.BVHsfJ99.d.mts → server.DPWk5pjW.d.mts} +51 -3
- package/dist/shared/{server.BVHsfJ99.d.ts → server.DPWk5pjW.d.ts} +51 -3
- package/dist/shared/{server.B1oIHH_j.d.mts → server.DY7OKEoj.d.mts} +1 -1
- package/dist/shared/{server.Dwnm6cSk.d.mts → server.DjgtLwKi.d.mts} +2 -2
- package/dist/shared/{server.DFuJLDuo.mjs → server.qf03T-Xn.mjs} +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
@@ -21,28 +21,24 @@
|
|
21
21
|
|
22
22
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
23
23
|
|
24
|
-
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
24
|
+
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
25
25
|
|
26
26
|
---
|
27
27
|
|
28
28
|
## Highlights
|
29
29
|
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
- **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
|
43
|
-
- **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
|
44
|
-
- **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
|
45
|
-
- **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
|
30
|
+
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
31
|
+
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
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.
|
34
|
+
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
35
|
+
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
36
|
+
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
37
|
+
- **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
|
38
|
+
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
|
39
|
+
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
|
40
|
+
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
|
41
|
+
- **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
|
46
42
|
|
47
43
|
## Documentation
|
48
44
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DPWk5pjW.mjs';
|
2
2
|
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.DY7OKEoj.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DjgtLwKi.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.CN0534_m.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -45,12 +45,23 @@ interface BodyLimitPluginOptions {
|
|
45
45
|
*/
|
46
46
|
maxBodySize: number;
|
47
47
|
}
|
48
|
+
/**
|
49
|
+
* The Body Limit Plugin restricts the size of the request body for the Fetch Server.
|
50
|
+
*
|
51
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/body-limit Body Limit Plugin Docs}
|
52
|
+
*/
|
48
53
|
declare class BodyLimitPlugin<T extends Context> implements FetchHandlerPlugin<T> {
|
49
54
|
private readonly maxBodySize;
|
50
55
|
constructor(options: BodyLimitPluginOptions);
|
51
56
|
initRuntimeAdapter(options: FetchHandlerOptions<T>): void;
|
52
57
|
}
|
53
58
|
|
59
|
+
/**
|
60
|
+
* RPC Handler for Fetch Server
|
61
|
+
*
|
62
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
63
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/fetch-server Fetch Server Integration Docs}
|
64
|
+
*/
|
54
65
|
declare class RPCHandler<T extends Context> extends FetchHandler<T> {
|
55
66
|
constructor(router: Router<any, T>, options?: NoInfer<FetchHandlerOptions<T> & StandardRPCHandlerOptions<T>>);
|
56
67
|
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DPWk5pjW.js';
|
2
2
|
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { ToFetchResponseOptions } from '@orpc/standard-server-fetch';
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.D5fBlF9j.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.CjlA3NKP.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.CuD15qZB.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -45,12 +45,23 @@ interface BodyLimitPluginOptions {
|
|
45
45
|
*/
|
46
46
|
maxBodySize: number;
|
47
47
|
}
|
48
|
+
/**
|
49
|
+
* The Body Limit Plugin restricts the size of the request body for the Fetch Server.
|
50
|
+
*
|
51
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/body-limit Body Limit Plugin Docs}
|
52
|
+
*/
|
48
53
|
declare class BodyLimitPlugin<T extends Context> implements FetchHandlerPlugin<T> {
|
49
54
|
private readonly maxBodySize;
|
50
55
|
constructor(options: BodyLimitPluginOptions);
|
51
56
|
initRuntimeAdapter(options: FetchHandlerOptions<T>): void;
|
52
57
|
}
|
53
58
|
|
59
|
+
/**
|
60
|
+
* RPC Handler for Fetch Server
|
61
|
+
*
|
62
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
63
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/fetch-server Fetch Server Integration Docs}
|
64
|
+
*/
|
54
65
|
declare class RPCHandler<T extends Context> extends FetchHandler<T> {
|
55
66
|
constructor(router: Router<any, T>, options?: NoInfer<FetchHandlerOptions<T> & StandardRPCHandlerOptions<T>>);
|
56
67
|
}
|
@@ -3,11 +3,11 @@ import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
3
3
|
import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fetch';
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
5
5
|
import '@orpc/contract';
|
6
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
6
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.qf03T-Xn.mjs';
|
7
7
|
import '@orpc/client/standard';
|
8
8
|
import '@orpc/standard-server/batch';
|
9
9
|
import '../../shared/server.BW-nUGgA.mjs';
|
10
|
-
import '../../shared/server.
|
10
|
+
import '../../shared/server.DG7Tamti.mjs';
|
11
11
|
|
12
12
|
class BodyLimitPlugin {
|
13
13
|
maxBodySize;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DPWk5pjW.mjs';
|
2
2
|
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@orpc/standard-server-node';
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.DY7OKEoj.mjs';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.DjgtLwKi.mjs';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.CN0534_m.mjs';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -44,12 +44,23 @@ interface BodyLimitPluginOptions {
|
|
44
44
|
*/
|
45
45
|
maxBodySize: number;
|
46
46
|
}
|
47
|
+
/**
|
48
|
+
* The Body Limit Plugin restricts the size of the request body for the Node.js HTTP Server.
|
49
|
+
*
|
50
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/body-limit Body Limit Plugin Docs}
|
51
|
+
*/
|
47
52
|
declare class BodyLimitPlugin<T extends Context> implements NodeHttpHandlerPlugin<T> {
|
48
53
|
private readonly maxBodySize;
|
49
54
|
constructor(options: BodyLimitPluginOptions);
|
50
55
|
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
51
56
|
}
|
52
57
|
|
58
|
+
/**
|
59
|
+
* RPC Handler for Node.js HTTP Server
|
60
|
+
*
|
61
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
62
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/node Node Integration Docs}
|
63
|
+
*/
|
53
64
|
declare class RPCHandler<T extends Context> extends NodeHttpHandler<T> {
|
54
65
|
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T> & NodeHttpHandlerOptions<T>>);
|
55
66
|
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { C as Context, R as Router } from '../../shared/server.
|
1
|
+
import { C as Context, R as Router } from '../../shared/server.DPWk5pjW.js';
|
2
2
|
import { Interceptor, ThrowableError, MaybeOptionalOptions } from '@orpc/shared';
|
3
3
|
import { SendStandardResponseOptions, NodeHttpRequest, NodeHttpResponse } from '@orpc/standard-server-node';
|
4
|
-
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.
|
5
|
-
import { F as FriendlyStandardHandleOptions } from '../../shared/server.
|
6
|
-
import { S as StandardRPCHandlerOptions } from '../../shared/server.
|
4
|
+
import { a as StandardHandlerPlugin, C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, i as StandardHandler } from '../../shared/server.D5fBlF9j.js';
|
5
|
+
import { F as FriendlyStandardHandleOptions } from '../../shared/server.CjlA3NKP.js';
|
6
|
+
import { S as StandardRPCHandlerOptions } from '../../shared/server.CuD15qZB.js';
|
7
7
|
import '@orpc/client';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/standard-server';
|
@@ -44,12 +44,23 @@ interface BodyLimitPluginOptions {
|
|
44
44
|
*/
|
45
45
|
maxBodySize: number;
|
46
46
|
}
|
47
|
+
/**
|
48
|
+
* The Body Limit Plugin restricts the size of the request body for the Node.js HTTP Server.
|
49
|
+
*
|
50
|
+
* @see {@link https://orpc.unnoq.com/docs/plugins/body-limit Body Limit Plugin Docs}
|
51
|
+
*/
|
47
52
|
declare class BodyLimitPlugin<T extends Context> implements NodeHttpHandlerPlugin<T> {
|
48
53
|
private readonly maxBodySize;
|
49
54
|
constructor(options: BodyLimitPluginOptions);
|
50
55
|
initRuntimeAdapter(options: NodeHttpHandlerOptions<T>): void;
|
51
56
|
}
|
52
57
|
|
58
|
+
/**
|
59
|
+
* RPC Handler for Node.js HTTP Server
|
60
|
+
*
|
61
|
+
* @see {@link https://orpc.unnoq.com/docs/rpc-handler RPC Handler Docs}
|
62
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/node Node Integration Docs}
|
63
|
+
*/
|
53
64
|
declare class RPCHandler<T extends Context> extends NodeHttpHandler<T> {
|
54
65
|
constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T> & NodeHttpHandlerOptions<T>>);
|
55
66
|
}
|
@@ -3,11 +3,11 @@ import { toArray, intercept, resolveMaybeOptionalOptions } from '@orpc/shared';
|
|
3
3
|
import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
|
4
4
|
import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.BVwwTHyO.mjs';
|
5
5
|
import '@orpc/contract';
|
6
|
-
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.
|
6
|
+
import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.qf03T-Xn.mjs';
|
7
7
|
import '@orpc/client/standard';
|
8
8
|
import '@orpc/standard-server/batch';
|
9
9
|
import '../../shared/server.BW-nUGgA.mjs';
|
10
|
-
import '../../shared/server.
|
10
|
+
import '../../shared/server.DG7Tamti.mjs';
|
11
11
|
|
12
12
|
class BodyLimitPlugin {
|
13
13
|
maxBodySize;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.
|
2
|
-
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.
|
1
|
+
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.DY7OKEoj.mjs';
|
2
|
+
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.DY7OKEoj.mjs';
|
3
3
|
import { ORPCError, HTTPPath } from '@orpc/client';
|
4
4
|
import { StandardRPCSerializer } from '@orpc/client/standard';
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
6
|
-
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.
|
7
|
-
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.
|
6
|
+
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.DPWk5pjW.mjs';
|
7
|
+
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.CN0534_m.mjs';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.
|
2
|
-
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.
|
1
|
+
import { c as StandardCodec, d as StandardParams, e as StandardMatcher, f as StandardMatchResult } from '../../shared/server.D5fBlF9j.js';
|
2
|
+
export { C as CompositeStandardHandlerPlugin, g as StandardHandleOptions, h as StandardHandleResult, i as StandardHandler, S as StandardHandlerInterceptorOptions, b as StandardHandlerOptions, a as StandardHandlerPlugin } from '../../shared/server.D5fBlF9j.js';
|
3
3
|
import { ORPCError, HTTPPath } from '@orpc/client';
|
4
4
|
import { StandardRPCSerializer } from '@orpc/client/standard';
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
6
|
-
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.
|
7
|
-
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.
|
6
|
+
import { h as AnyProcedure, f as AnyRouter } from '../../shared/server.DPWk5pjW.js';
|
7
|
+
export { a as StandardRPCHandler, S as StandardRPCHandlerOptions } from '../../shared/server.CuD15qZB.js';
|
8
8
|
import '@orpc/contract';
|
9
9
|
import '@orpc/shared';
|
10
10
|
|
@@ -1,8 +1,8 @@
|
|
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.qf03T-Xn.mjs';
|
2
2
|
import '@orpc/client/standard';
|
3
3
|
import '@orpc/shared';
|
4
4
|
import '@orpc/standard-server/batch';
|
5
5
|
import '@orpc/client';
|
6
6
|
import '../../shared/server.BW-nUGgA.mjs';
|
7
7
|
import '@orpc/contract';
|
8
|
-
import '../../shared/server.
|
8
|
+
import '../../shared/server.DG7Tamti.mjs';
|