@holo-js/adapter-nuxt 0.3.18 → 0.3.20
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/dist/module.json +1 -1
- package/dist/runtime/plugins/init.js +7 -5
- package/dist/runtime/server/error.js +4 -2
- package/package.json +14 -14
package/dist/module.json
CHANGED
|
@@ -6,10 +6,10 @@ import { createNuxtAuthorizationError } from "../authorization-error.js";
|
|
|
6
6
|
import { initializeHoloAdapterProject } from "@holo-js/core";
|
|
7
7
|
import { useRuntimeConfig } from "nitropack/runtime/config";
|
|
8
8
|
import { defineNitroPlugin } from "nitropack/runtime/plugin";
|
|
9
|
-
export default defineNitroPlugin(
|
|
9
|
+
export default defineNitroPlugin((nitroApp) => {
|
|
10
10
|
const config = useRuntimeConfig();
|
|
11
11
|
configureHoloRuntimeConfig(config);
|
|
12
|
-
const project =
|
|
12
|
+
const project = initializeHoloAdapterProject(config.holo.projectRoot?.trim() || process.cwd(), {
|
|
13
13
|
envName: config.holo.appEnv,
|
|
14
14
|
preferCache: process.env.NODE_ENV === "production",
|
|
15
15
|
processEnv: process.env,
|
|
@@ -18,12 +18,14 @@ export default defineNitroPlugin(async (nitroApp) => {
|
|
|
18
18
|
createError: createNuxtAuthorizationError
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
nitroApp.hooks.hook("request", async () => {
|
|
22
|
+
await project;
|
|
23
|
+
});
|
|
23
24
|
nitroApp.hooks.hook("close", async () => {
|
|
24
25
|
try {
|
|
25
|
-
await project.runtime.shutdown();
|
|
26
|
+
await (await project).runtime.shutdown();
|
|
26
27
|
} catch {
|
|
28
|
+
return;
|
|
27
29
|
}
|
|
28
30
|
});
|
|
29
31
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { send, setHeader, setResponseStatus } from "h3";
|
|
2
2
|
import { isValidationException } from "@holo-js/validation";
|
|
3
|
+
import { serializeRateLimitError } from "@holo-js/adapter-shared/server-errors";
|
|
3
4
|
import {
|
|
4
5
|
applyFormFailureRedirect,
|
|
5
6
|
shouldRedirectFormFailure
|
|
@@ -15,10 +16,10 @@ function findValidationException(error) {
|
|
|
15
16
|
}
|
|
16
17
|
export default async function handleValidationError(error, event) {
|
|
17
18
|
const validationError = findValidationException(error);
|
|
18
|
-
|
|
19
|
+
const payload = validationError?.toJSON() ?? serializeRateLimitError(error);
|
|
20
|
+
if (!payload) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
|
-
const payload = validationError.toJSON();
|
|
22
23
|
if (shouldRedirectFormFailure(event)) {
|
|
23
24
|
const failure = { ...payload };
|
|
24
25
|
const response = {};
|
|
@@ -28,5 +29,6 @@ export default async function handleValidationError(error, event) {
|
|
|
28
29
|
}
|
|
29
30
|
setResponseStatus(event, payload.status);
|
|
30
31
|
setHeader(event, "content-type", "application/json; charset=utf-8");
|
|
32
|
+
if (payload.retryAfterSeconds !== void 0) setHeader(event, "Retry-After", payload.retryAfterSeconds);
|
|
31
33
|
await send(event, JSON.stringify(payload), "application/json");
|
|
32
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/adapter-nuxt",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "Holo-JS Framework - Nuxt adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"test": "vitest --run"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@holo-js/adapter-shared": "^0.3.
|
|
41
|
+
"@holo-js/adapter-shared": "^0.3.20",
|
|
42
42
|
"@nuxt/kit": "^4.4.4",
|
|
43
|
-
"@holo-js/config": "^0.3.
|
|
44
|
-
"@holo-js/core": "^0.3.
|
|
45
|
-
"@holo-js/db": "^0.3.
|
|
46
|
-
"@holo-js/validation": "^0.3.
|
|
43
|
+
"@holo-js/config": "^0.3.20",
|
|
44
|
+
"@holo-js/core": "^0.3.20",
|
|
45
|
+
"@holo-js/db": "^0.3.20",
|
|
46
|
+
"@holo-js/validation": "^0.3.20",
|
|
47
47
|
"h3": "^1.15.11",
|
|
48
48
|
"nitropack": "^2.13.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@holo-js/broadcast": "^0.3.
|
|
52
|
-
"@holo-js/forms": "^0.3.
|
|
53
|
-
"@holo-js/realtime": "^0.3.
|
|
54
|
-
"@holo-js/storage": "^0.3.
|
|
55
|
-
"@holo-js/storage-s3": "^0.3.
|
|
51
|
+
"@holo-js/broadcast": "^0.3.20",
|
|
52
|
+
"@holo-js/forms": "^0.3.20",
|
|
53
|
+
"@holo-js/realtime": "^0.3.20",
|
|
54
|
+
"@holo-js/storage": "^0.3.20",
|
|
55
|
+
"@holo-js/storage-s3": "^0.3.20"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@holo-js/broadcast": {
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@holo-js/broadcast": "^0.3.
|
|
76
|
-
"@holo-js/realtime": "^0.3.
|
|
77
|
-
"@holo-js/storage-s3": "^0.3.
|
|
75
|
+
"@holo-js/broadcast": "^0.3.20",
|
|
76
|
+
"@holo-js/realtime": "^0.3.20",
|
|
77
|
+
"@holo-js/storage-s3": "^0.3.20",
|
|
78
78
|
"@nuxt/module-builder": "^1.0.2",
|
|
79
79
|
"@types/node": "^22.10.2",
|
|
80
80
|
"nuxt": "^4.4.4",
|