@devcoffee/nuxt-core 1.2.0 → 1.2.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/CHANGELOG.md +47 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +31 -21
- package/dist/runtime/server/core/helpers.js +9 -1
- package/package.json +6 -2
- package/dist/runtime/server/tsconfig.json +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.2.4
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.3...v1.2.4)
|
|
6
|
+
|
|
7
|
+
### 🏡 Chore
|
|
8
|
+
|
|
9
|
+
- Exclude dist/runtime/server/tsconfig.json from published package ([6d6e02f](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/6d6e02f))
|
|
10
|
+
|
|
11
|
+
### ❤️ Contributors
|
|
12
|
+
|
|
13
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
14
|
+
|
|
15
|
+
## v1.2.3
|
|
16
|
+
|
|
17
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.2...v1.2.3)
|
|
18
|
+
|
|
19
|
+
## v1.2.2
|
|
20
|
+
|
|
21
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.1...v1.2.2)
|
|
22
|
+
|
|
23
|
+
### 🩹 Fixes
|
|
24
|
+
|
|
25
|
+
- Ensure sanitizeError function returns H3Error type consistently ([de54a04](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/de54a04))
|
|
26
|
+
|
|
27
|
+
### 🏡 Chore
|
|
28
|
+
|
|
29
|
+
- Add publishConfig access public for scoped npm package ([3c080be](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/3c080be))
|
|
30
|
+
|
|
31
|
+
### ❤️ Contributors
|
|
32
|
+
|
|
33
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
34
|
+
|
|
35
|
+
## v1.2.1
|
|
36
|
+
|
|
37
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.0...v1.2.1)
|
|
38
|
+
|
|
39
|
+
### 🩹 Fixes
|
|
40
|
+
|
|
41
|
+
- Resolve session double encryption issue by decrypting tokenSet in validateSession and updating getSession usage in updateSession ([6ed8fb6](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/6ed8fb6))
|
|
42
|
+
- Populate nodeReferences and sharedReferences in prepare:types hook ([83b41e2](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/83b41e2))
|
|
43
|
+
- Include devcoffee-nitro-core.d.ts in server TypeScript project via nitro:config hook ([20b35e0](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/20b35e0))
|
|
44
|
+
- **typecheck:** Exclude test, playground, and eslint config from tsconfig.app.json ([9d9c857](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/9d9c857))
|
|
45
|
+
|
|
46
|
+
### ❤️ Contributors
|
|
47
|
+
|
|
48
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
49
|
+
|
|
3
50
|
## v1.2.0
|
|
4
51
|
|
|
5
52
|
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.1.1...v1.2.0)
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
2
|
-
import { defineNuxtModule, useLogger, createResolver, addServerImports, addServerImportsDir, addServerPlugin, addImportsDir, addPlugin, addRouteMiddleware,
|
|
2
|
+
import { defineNuxtModule, useLogger, createResolver, addTemplate, addServerImports, addServerImportsDir, addServerPlugin, addImportsDir, addPlugin, addRouteMiddleware, addServerHandler } from '@nuxt/kit';
|
|
3
3
|
import { deepMerge, pick } from '../dist/runtime/utils.js';
|
|
4
4
|
|
|
5
|
-
const version = "1.2.
|
|
5
|
+
const version = "1.2.4";
|
|
6
6
|
|
|
7
7
|
const defaultLocale = "vi-VN";
|
|
8
8
|
const defaultLanguage = "vi";
|
|
@@ -140,6 +140,25 @@ const _module = defineNuxtModule({
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
_nuxt.options.alias["#devcoffee-core"] = resolver.resolve("./runtime");
|
|
143
|
+
const globalTypes = addTemplate({
|
|
144
|
+
filename: "types/devcoffee-global.d.ts",
|
|
145
|
+
src: resolver.resolve("./runtime/types/global.env.d.ts")
|
|
146
|
+
});
|
|
147
|
+
const nuxtTypes = addTemplate({
|
|
148
|
+
filename: "types/devcoffee-nuxt-core.d.ts",
|
|
149
|
+
src: resolver.resolve("./runtime/types/nuxt.d.ts")
|
|
150
|
+
});
|
|
151
|
+
const nitroTypes = addTemplate({
|
|
152
|
+
filename: "types/devcoffee-nitro-core.d.ts",
|
|
153
|
+
src: resolver.resolve("./runtime/types/nitro.d.ts")
|
|
154
|
+
});
|
|
155
|
+
_nuxt.options.nitro = deepMerge(_nuxt.options.nitro || {}, {
|
|
156
|
+
typescript: {
|
|
157
|
+
tsConfig: {
|
|
158
|
+
include: [globalTypes.dst]
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
143
162
|
addServerImports([
|
|
144
163
|
{
|
|
145
164
|
from: resolver.resolve("./runtime/server/core/nuxtAuthtsHandler"),
|
|
@@ -185,29 +204,20 @@ const _module = defineNuxtModule({
|
|
|
185
204
|
addRouteMiddleware([{ name: "authts", path: resolver.resolve("./runtime/app/middleware/authts"), global: true }], {
|
|
186
205
|
prepend: true
|
|
187
206
|
});
|
|
188
|
-
const globalTypes = addTemplate({
|
|
189
|
-
filename: "types/devcoffee-global.d.ts",
|
|
190
|
-
src: resolver.resolve("./runtime/types/global.env.d.ts")
|
|
191
|
-
});
|
|
192
|
-
_nuxt.options.nitro = deepMerge(_nuxt.options.nitro || {}, {
|
|
193
|
-
typescript: {
|
|
194
|
-
tsConfig: {
|
|
195
|
-
include: [globalTypes.dst]
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
const nuxtTypes = addTemplate({
|
|
200
|
-
filename: "types/devcoffee-nuxt-core.d.ts",
|
|
201
|
-
src: resolver.resolve("./runtime/types/nuxt.d.ts")
|
|
202
|
-
});
|
|
203
|
-
const nitroTypes = addTemplate({
|
|
204
|
-
filename: "types/devcoffee-nitro-core.d.ts",
|
|
205
|
-
src: resolver.resolve("./runtime/types/nitro.d.ts")
|
|
206
|
-
});
|
|
207
207
|
_nuxt.hook("prepare:types", (opts) => {
|
|
208
208
|
opts.references.push({ path: globalTypes.dst });
|
|
209
209
|
opts.references.push({ path: nuxtTypes.dst });
|
|
210
210
|
opts.references.push({ path: nitroTypes.dst });
|
|
211
|
+
opts.nodeReferences.push({ path: globalTypes.dst });
|
|
212
|
+
opts.nodeReferences.push({ path: nitroTypes.dst });
|
|
213
|
+
opts.sharedReferences.push({ path: globalTypes.dst });
|
|
214
|
+
opts.sharedReferences.push({ path: globalTypes.dst });
|
|
215
|
+
});
|
|
216
|
+
_nuxt.hook("nitro:config", (nitroConfig) => {
|
|
217
|
+
nitroConfig.typescript ??= {};
|
|
218
|
+
nitroConfig.typescript.tsConfig ??= {};
|
|
219
|
+
nitroConfig.typescript.tsConfig.include ??= [];
|
|
220
|
+
nitroConfig.typescript.tsConfig.include.push(nitroTypes.dst);
|
|
211
221
|
});
|
|
212
222
|
if (_nuxt.options?.devtools) {
|
|
213
223
|
addCustomTab({
|
|
@@ -115,6 +115,14 @@ export async function validateSession(sessionCookieId, opts) {
|
|
|
115
115
|
await removeSessionData(opts.storageName, deleteSessionKey);
|
|
116
116
|
}
|
|
117
117
|
await setSessionData(opts.storageName, sessionKey, session, opts.expiresIn / 1e3 | 0);
|
|
118
|
+
if (session.auth?.tokenSet && session.auth.tokenSet.encrypted === true) {
|
|
119
|
+
if (opts.secret) {
|
|
120
|
+
const decrypted = decryptTokenSet(session.auth.tokenSet, opts.secret);
|
|
121
|
+
session.auth.tokenSet = decrypted ?? void 0;
|
|
122
|
+
} else {
|
|
123
|
+
session.auth.tokenSet = void 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
118
126
|
return session;
|
|
119
127
|
}
|
|
120
128
|
export async function updateSession(sessionId, input, opts) {
|
|
@@ -124,7 +132,7 @@ export async function updateSession(sessionId, input, opts) {
|
|
|
124
132
|
input,
|
|
125
133
|
["id", "issuedAt", "expiresAt"]
|
|
126
134
|
);
|
|
127
|
-
let session = await
|
|
135
|
+
let session = await getSession(sessionId, opts);
|
|
128
136
|
if (!session) {
|
|
129
137
|
throw createError({
|
|
130
138
|
status: 500,
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devcoffee/nuxt-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"author": "Hieu Nguyen <hieunguyen@devcoffee.tech>",
|
|
5
8
|
"description": "Nuxt 4 module providing OpenID Connect / OAuth 2.0 authorization code grant with PKCE, server-side session management via Nitro, client-side auth state composables, and universal route protection middleware.",
|
|
6
9
|
"keywords": [
|
|
@@ -58,7 +61,8 @@
|
|
|
58
61
|
"test:e2e:ui": "cross-env NODE_OPTIONS=--no-deprecation PLAYWRIGHT_HEADLESS=false vitest run test/e2e",
|
|
59
62
|
"test:all": "cross-env NODE_OPTIONS=--no-deprecation vitest run",
|
|
60
63
|
"test:watch": "cross-env NODE_OPTIONS=--no-deprecation vitest watch test/unit",
|
|
61
|
-
"test:types": "vue-tsc --noEmit"
|
|
64
|
+
"test:types": "vue-tsc --noEmit",
|
|
65
|
+
"typecheck": "vue-tsc --noEmit -p .nuxt/tsconfig.app.json"
|
|
62
66
|
},
|
|
63
67
|
"dependencies": {
|
|
64
68
|
"@nuxt/kit": "^4.1.3",
|