nuxt-precognition 0.0.4 → 0.0.6
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 +7 -4
- package/dist/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Find and replace all on all files (CMD+SHIFT+F):
|
|
|
16
16
|
|
|
17
17
|
This is a new version of [nuxt-laravel-precognition](https://www.npmjs.com/package/nuxt-laravel-precognition). It offers same features, but being not dependent on Laravel.
|
|
18
18
|
|
|
19
|
-
Instead of supporting only _$fetch_ and _Laravel_, it works with simple promises,
|
|
19
|
+
Instead of supporting only _$fetch_ and _Laravel_, it works with simple promises, targeting any backend that implements the base Precognition protocol. These promises will receive the form `payload` and protocol `Headers`.
|
|
20
20
|
|
|
21
21
|
#### Example
|
|
22
22
|
```ts
|
|
@@ -31,7 +31,10 @@ const form = useForm(
|
|
|
31
31
|
)
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
This module comes with native __Nitro__ integration, but will work with other backend as
|
|
34
|
+
This module comes with native __Nitro__ integration, but will work with other backend as well.
|
|
35
|
+
|
|
36
|
+
Are you using only __Lambda__? You are covered will [Lambda Precognition](https://www.npmjs.com/package/lambda-precognition)!!
|
|
37
|
+
|
|
35
38
|
It supports any validation library (_who said [__Zod__](https://zod.dev/)??_) server or client side. You will need only to configure specific `Error parsers`.
|
|
36
39
|
|
|
37
40
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
@@ -92,7 +95,7 @@ export default defineNuxtPlugin(() => {
|
|
|
92
95
|
```
|
|
93
96
|
From now on, everytime the `useForm` will catch the error, it will run our parses, and capture and assign any validation errors.
|
|
94
97
|
|
|
95
|
-
If you want to reuse same options over multiple pages, you can create your __custom composable__ by `useForm.create` factory function.
|
|
98
|
+
If you want to reuse the same options over multiple pages, you can create your __custom composable__ by `useForm.create` factory function.
|
|
96
99
|
|
|
97
100
|
### How about server side
|
|
98
101
|
Same idea, creating a nitro plugin:
|
|
@@ -124,7 +127,7 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
124
127
|
})
|
|
125
128
|
})
|
|
126
129
|
```
|
|
127
|
-
If you don't like hooking on every
|
|
130
|
+
If you don't like hooking on every request, you can create your custom eventHandler by `definePrecognitiveEventHandler.create` factory function.
|
|
128
131
|
|
|
129
132
|
Make your validation logic inside the `onRequest` handler of the `definePrecognitiveEventHandler`.
|
|
130
133
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-precognition",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"description": "Nuxt module implementing Precognition protocol (inspired by official Laravel Precognition) for backend precognitive validation.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "sot1986",
|