nuxt-precognition 0.0.8 → 0.0.9
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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/package.json +3 -2
- package/dist/runtime/playWithTypes.d.ts +0 -2
- package/dist/runtime/playWithTypes.js +0 -41
package/README.md
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -54,7 +54,8 @@ import type {ClientStatusHandlers} from '${resolver.resolve("./runtime/types/for
|
|
|
54
54
|
interface NuxtPrecognition {
|
|
55
55
|
$precognition: {
|
|
56
56
|
errorParsers: ValidationErrorParser[],
|
|
57
|
-
statusHandlers: ClientStatusHandlers
|
|
57
|
+
statusHandlers: ClientStatusHandlers,
|
|
58
|
+
assertSuccessfulPrecognitiveResponses: (ctx: { options: { headers?: HeadersInit }, response: Response }) => void
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
|
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.9",
|
|
5
5
|
"description": "Nuxt module implementing Precognition protocol (inspired by official Laravel Precognition) for backend precognitive validation.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "sot1986",
|
|
@@ -69,5 +69,6 @@
|
|
|
69
69
|
"vitest": "^1.6.0",
|
|
70
70
|
"vue-tsc": "^2.0.17",
|
|
71
71
|
"zod": "^3.23.8"
|
|
72
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
|
|
73
74
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const model = {
|
|
2
|
-
id: "1",
|
|
3
|
-
name: "John Doe",
|
|
4
|
-
age: 30,
|
|
5
|
-
address: {
|
|
6
|
-
street: "123 Main St",
|
|
7
|
-
city: "Anytown"
|
|
8
|
-
},
|
|
9
|
-
tags: ["developer", "blogger"],
|
|
10
|
-
websites: [
|
|
11
|
-
{
|
|
12
|
-
url: "https://example.com",
|
|
13
|
-
description: "My personal blog",
|
|
14
|
-
followers: 1e3
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
favorites: [
|
|
18
|
-
{ site: "https://favorite.com" },
|
|
19
|
-
{ site: "https://another-favorite.com" }
|
|
20
|
-
]
|
|
21
|
-
};
|
|
22
|
-
export function getKeyValue(obj, key) {
|
|
23
|
-
const firstKey = key.split(".")[0];
|
|
24
|
-
if (key === firstKey) {
|
|
25
|
-
return obj[firstKey];
|
|
26
|
-
}
|
|
27
|
-
if (typeof firstKey !== "string") {
|
|
28
|
-
throw new TypeError(`Key must be a string, received: ${typeof firstKey}`);
|
|
29
|
-
}
|
|
30
|
-
if (!(firstKey in obj)) {
|
|
31
|
-
throw new Error(`Key "${firstKey}" does not exist in the object.`);
|
|
32
|
-
}
|
|
33
|
-
if (typeof obj[firstKey] !== "object") {
|
|
34
|
-
throw new TypeError(`Value at key "${firstKey}" is not an object or is null.`);
|
|
35
|
-
}
|
|
36
|
-
if (!obj[firstKey]) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const restKey = key.slice(firstKey.length + 1);
|
|
40
|
-
return getKeyValue(obj[firstKey], restKey);
|
|
41
|
-
}
|