@orpc/react 1.0.0-beta.6 → 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/hooks/index.d.mts +7 -1
- package/dist/hooks/index.d.ts +7 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/package.json +6 -6
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
|
|
package/dist/hooks/index.d.mts
CHANGED
@@ -58,6 +58,12 @@ interface UseServerActionErrorResult<TInput, TOutput, TError> extends UseServerA
|
|
58
58
|
status: 'error';
|
59
59
|
executedAt: Date;
|
60
60
|
}
|
61
|
+
/**
|
62
|
+
* Use a Server Action Hook
|
63
|
+
*
|
64
|
+
* @see {@link https://orpc.unnoq.com/docs/server-action#useserveraction-hook Server Action Hook Docs}
|
65
|
+
*/
|
61
66
|
declare function useServerAction<TInput, TOutput, TError extends ORPCErrorJSON<any, any>>(action: ActionableClient<TInput, TOutput, TError>, options?: NoInfer<UseServerActionOptions<TInput, TOutput, UnactionableError<TError>>>): UseServerActionIdleResult<TInput, TOutput, UnactionableError<TError>> | UseServerActionSuccessResult<TInput, TOutput, UnactionableError<TError>> | UseServerActionErrorResult<TInput, TOutput, UnactionableError<TError>> | UseServerActionPendingResult<TInput, TOutput, UnactionableError<TError>>;
|
62
67
|
|
63
|
-
export {
|
68
|
+
export { useServerAction };
|
69
|
+
export type { UseServerActionErrorResult, UseServerActionExecuteOptions, UseServerActionExecuteRest, UseServerActionIdleResult, UseServerActionOptions, UseServerActionPendingResult, UseServerActionResultBase, UseServerActionSuccessResult };
|
package/dist/hooks/index.d.ts
CHANGED
@@ -58,6 +58,12 @@ interface UseServerActionErrorResult<TInput, TOutput, TError> extends UseServerA
|
|
58
58
|
status: 'error';
|
59
59
|
executedAt: Date;
|
60
60
|
}
|
61
|
+
/**
|
62
|
+
* Use a Server Action Hook
|
63
|
+
*
|
64
|
+
* @see {@link https://orpc.unnoq.com/docs/server-action#useserveraction-hook Server Action Hook Docs}
|
65
|
+
*/
|
61
66
|
declare function useServerAction<TInput, TOutput, TError extends ORPCErrorJSON<any, any>>(action: ActionableClient<TInput, TOutput, TError>, options?: NoInfer<UseServerActionOptions<TInput, TOutput, UnactionableError<TError>>>): UseServerActionIdleResult<TInput, TOutput, UnactionableError<TError>> | UseServerActionSuccessResult<TInput, TOutput, UnactionableError<TError>> | UseServerActionErrorResult<TInput, TOutput, UnactionableError<TError>> | UseServerActionPendingResult<TInput, TOutput, UnactionableError<TError>>;
|
62
67
|
|
63
|
-
export {
|
68
|
+
export { useServerAction };
|
69
|
+
export type { UseServerActionErrorResult, UseServerActionExecuteOptions, UseServerActionExecuteRest, UseServerActionIdleResult, UseServerActionOptions, UseServerActionPendingResult, UseServerActionResultBase, UseServerActionSuccessResult };
|
package/dist/index.d.mts
CHANGED
@@ -6,6 +6,13 @@ interface FormAction {
|
|
6
6
|
(form: FormData): Promise<void>;
|
7
7
|
}
|
8
8
|
declare const orpcErrorToNextHttpFallbackInterceptor: Interceptor<any, any, any>;
|
9
|
+
/**
|
10
|
+
* Create a server action accept a form data and deserialize with bracket notation.
|
11
|
+
*
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/server-action#createformaction-utility Create Form Action Utility Docs}
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/bracket-notation Bracket Notation Docs}
|
14
|
+
*/
|
9
15
|
declare function createFormAction<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>>>): FormAction;
|
10
16
|
|
11
|
-
export {
|
17
|
+
export { createFormAction, orpcErrorToNextHttpFallbackInterceptor };
|
18
|
+
export type { FormAction };
|
package/dist/index.d.ts
CHANGED
@@ -6,6 +6,13 @@ interface FormAction {
|
|
6
6
|
(form: FormData): Promise<void>;
|
7
7
|
}
|
8
8
|
declare const orpcErrorToNextHttpFallbackInterceptor: Interceptor<any, any, any>;
|
9
|
+
/**
|
10
|
+
* Create a server action accept a form data and deserialize with bracket notation.
|
11
|
+
*
|
12
|
+
* @see {@link https://orpc.unnoq.com/docs/server-action#createformaction-utility Create Form Action Utility Docs}
|
13
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/bracket-notation Bracket Notation Docs}
|
14
|
+
*/
|
9
15
|
declare function createFormAction<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>>>): FormAction;
|
10
16
|
|
11
|
-
export {
|
17
|
+
export { createFormAction, orpcErrorToNextHttpFallbackInterceptor };
|
18
|
+
export type { FormAction };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.3",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -34,11 +34,11 @@
|
|
34
34
|
"react": ">=18.0.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@orpc/client": "1.0.
|
38
|
-
"@orpc/contract": "1.0.
|
39
|
-
"@orpc/openapi-client": "1.0.
|
40
|
-
"@orpc/
|
41
|
-
"@orpc/
|
37
|
+
"@orpc/client": "1.0.3",
|
38
|
+
"@orpc/contract": "1.0.3",
|
39
|
+
"@orpc/openapi-client": "1.0.3",
|
40
|
+
"@orpc/shared": "1.0.3",
|
41
|
+
"@orpc/server": "1.0.3"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
44
|
"react": "^19.1.0",
|