@firtoz/router-toolkit 3.0.2 → 3.0.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 +4 -0
- package/package.json +9 -8
- package/src/formAction.ts +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @firtoz/router-toolkit
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@firtoz/router-toolkit)
|
|
4
|
+
[](https://www.npmjs.com/package/@firtoz/router-toolkit)
|
|
5
|
+
[](https://github.com/firtoz/fullstack-toolkit/blob/main/LICENSE)
|
|
6
|
+
|
|
3
7
|
Type-safe React Router 7 framework mode helpers with enhanced fetching, form submission, and state management for React Router 7 framework mode.
|
|
4
8
|
|
|
5
9
|
## Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firtoz/router-toolkit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Type-safe React Router 7 framework mode helpers with enhanced fetching, form submission, and state management",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"module": "./src/index.ts",
|
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"typecheck": "tsc --noEmit",
|
|
30
|
-
"lint": "biome
|
|
29
|
+
"typecheck": "tsc --noEmit -p ./tsconfig.json",
|
|
30
|
+
"lint": "biome check --write src",
|
|
31
|
+
"lint:ci": "biome ci src",
|
|
31
32
|
"format": "biome format src --write",
|
|
32
33
|
"test": "bun test",
|
|
33
34
|
"test:watch": "bun test --watch"
|
|
@@ -54,10 +55,10 @@
|
|
|
54
55
|
"url": "https://github.com/firtoz/fullstack-toolkit/issues"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
|
-
"@firtoz/maybe-error": "^1.3.
|
|
58
|
+
"@firtoz/maybe-error": "^1.3.3",
|
|
58
59
|
"react": "^19.2.0",
|
|
59
|
-
"react-router": "^7.9.
|
|
60
|
-
"zod": "^4.1.
|
|
60
|
+
"react-router": "^7.9.4",
|
|
61
|
+
"zod": "^4.1.12"
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
64
|
"node": ">=18.0.0"
|
|
@@ -71,8 +72,8 @@
|
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@testing-library/react": "^16.3.0",
|
|
73
74
|
"@types/jsdom": "^27.0.0",
|
|
74
|
-
"@types/react": "^19.2.
|
|
75
|
-
"bun-types": "^1.
|
|
75
|
+
"@types/react": "^19.2.2",
|
|
76
|
+
"bun-types": "^1.3.0",
|
|
76
77
|
"jsdom": "^27.0.0"
|
|
77
78
|
}
|
|
78
79
|
}
|
package/src/formAction.ts
CHANGED
|
@@ -34,10 +34,10 @@ import { zfd } from "zod-form-data";
|
|
|
34
34
|
/**
|
|
35
35
|
* Error types that can be returned by formAction
|
|
36
36
|
*/
|
|
37
|
-
export type FormActionError<TError> =
|
|
37
|
+
export type FormActionError<TError, TSchema extends z.ZodTypeAny> =
|
|
38
38
|
| {
|
|
39
39
|
type: "validation";
|
|
40
|
-
error: ReturnType<typeof z.treeifyError<
|
|
40
|
+
error: ReturnType<typeof z.treeifyError<TSchema>>;
|
|
41
41
|
}
|
|
42
42
|
| {
|
|
43
43
|
type: "handler";
|
|
@@ -150,7 +150,7 @@ export const formAction = <
|
|
|
150
150
|
}: FormActionConfig<TSchema, TResult, TError, ActionArgs>) => {
|
|
151
151
|
return async (
|
|
152
152
|
args: ActionArgs,
|
|
153
|
-
): Promise<MaybeError<TResult, FormActionError<TError>>> => {
|
|
153
|
+
): Promise<MaybeError<TResult, FormActionError<TError, TSchema>>> => {
|
|
154
154
|
try {
|
|
155
155
|
const rawFormData = await args.request.formData();
|
|
156
156
|
const formData = await zfd.formData(schema).safeParseAsync(rawFormData);
|