@devcoffee/nuxt-core 1.4.1 → 1.4.3
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 +231 -206
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/server/core/helpers.d.ts +5 -0
- package/dist/runtime/server/core/helpers.js +28 -1
- package/dist/runtime/server/core/nuxtAuthtsHandler.js +9 -3
- package/dist/runtime/server/plugins/authts.js +12 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,220 +1,245 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v1.4.
|
|
3
|
+
## v1.4.3
|
|
4
4
|
|
|
5
|
-
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.4.
|
|
5
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.4.2...v1.4.3)
|
|
6
6
|
|
|
7
7
|
### 🩹 Fixes
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Enhance refreshTokenIfNeeded to support sessionCreateOptions for improved session handling ([609a4a4](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/609a4a4))
|
|
10
|
+
- Update release script to include changelogen for better version management ([853cfbb](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/853cfbb))
|
|
10
11
|
|
|
11
12
|
### ❤️ Contributors
|
|
12
13
|
|
|
13
14
|
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
14
15
|
|
|
15
|
-
## v1.4.
|
|
16
|
-
|
|
17
|
-
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.
|
|
18
|
-
|
|
19
|
-
###
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
###
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
### ❤️ Contributors
|
|
75
|
-
|
|
76
|
-
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
77
|
-
|
|
78
|
-
## v1.2.
|
|
79
|
-
|
|
80
|
-
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
[
|
|
85
|
-
|
|
86
|
-
###
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
###
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
###
|
|
142
|
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
[
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
- **
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
- Update
|
|
204
|
-
-
|
|
205
|
-
- **test:**
|
|
206
|
-
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
-
|
|
216
|
-
|
|
217
|
-
|
|
16
|
+
## v1.4.2
|
|
17
|
+
|
|
18
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.4.1...v1.4.2)
|
|
19
|
+
|
|
20
|
+
### 🩹 Fixes
|
|
21
|
+
|
|
22
|
+
- Handle user info fetch failures gracefully in auth handlers ([9111fd1](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/9111fd1))
|
|
23
|
+
|
|
24
|
+
### ❤️ Contributors
|
|
25
|
+
|
|
26
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
27
|
+
|
|
28
|
+
## v1.4.1
|
|
29
|
+
|
|
30
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.4.0...v1.4.1)
|
|
31
|
+
|
|
32
|
+
### 🩹 Fixes
|
|
33
|
+
|
|
34
|
+
- Normalize expiresIn to seconds across all session consumers ([2c197ab](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/2c197ab))
|
|
35
|
+
|
|
36
|
+
### ❤️ Contributors
|
|
37
|
+
|
|
38
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
39
|
+
|
|
40
|
+
## v1.4.0
|
|
41
|
+
|
|
42
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.3.0...v1.4.0)
|
|
43
|
+
|
|
44
|
+
### 🚀 Enhancements
|
|
45
|
+
|
|
46
|
+
- Implement writeSessionCookie function and integrate it into NuxtForwardRequestHandler and authts plugin ([e761f6c](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/e761f6c))
|
|
47
|
+
|
|
48
|
+
### 🩹 Fixes
|
|
49
|
+
|
|
50
|
+
- Drop return from proxyRequest in NuxtForwardRequestHandler to prevent ERR_HTTP_HEADERS_SENT ([fd3b91c](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/fd3b91c))
|
|
51
|
+
- Prevent sending headers after response has been finalized in beforeResponse hook ([444a012](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/444a012))
|
|
52
|
+
- Update version to 1.3.2 in package.json and package-lock.json ([e6ab449](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/e6ab449))
|
|
53
|
+
|
|
54
|
+
### 💅 Refactors
|
|
55
|
+
|
|
56
|
+
- Remove redundant signSessionId checks from authts.sec03.test.ts ([18686f4](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/18686f4))
|
|
57
|
+
|
|
58
|
+
### ❤️ Contributors
|
|
59
|
+
|
|
60
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
61
|
+
|
|
62
|
+
## v1.3.0
|
|
63
|
+
|
|
64
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.5...v1.3.0)
|
|
65
|
+
|
|
66
|
+
### 🚀 Enhancements
|
|
67
|
+
|
|
68
|
+
- Enhance locale and timezone handling with session support in formatters plugin ([c36f621](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/c36f621))
|
|
69
|
+
|
|
70
|
+
### 🩹 Fixes
|
|
71
|
+
|
|
72
|
+
- Harden useAuthContext composable and logging infrastructure ([2a89ebf](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/2a89ebf))
|
|
73
|
+
- Correct sessionCookieId reference in validateSession call in authts.ts tests ([2c8b343](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/2c8b343))
|
|
74
|
+
|
|
75
|
+
### ❤️ Contributors
|
|
76
|
+
|
|
77
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
78
|
+
|
|
79
|
+
## v1.2.5
|
|
80
|
+
|
|
81
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.4...v1.2.5)
|
|
82
|
+
|
|
83
|
+
### 🩹 Fixes
|
|
84
|
+
|
|
85
|
+
- Update sourcemap configuration to reflect NODE_ENV for server and client ([4ded743](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/4ded743))
|
|
86
|
+
|
|
87
|
+
### ❤️ Contributors
|
|
88
|
+
|
|
89
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
90
|
+
|
|
91
|
+
## v1.2.4
|
|
92
|
+
|
|
93
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.3...v1.2.4)
|
|
94
|
+
|
|
95
|
+
### 🏡 Chore
|
|
96
|
+
|
|
97
|
+
- Exclude dist/runtime/server/tsconfig.json from published package ([6d6e02f](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/6d6e02f))
|
|
98
|
+
|
|
99
|
+
### ❤️ Contributors
|
|
100
|
+
|
|
101
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
102
|
+
|
|
103
|
+
## v1.2.3
|
|
104
|
+
|
|
105
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.2...v1.2.3)
|
|
106
|
+
|
|
107
|
+
## v1.2.2
|
|
108
|
+
|
|
109
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.1...v1.2.2)
|
|
110
|
+
|
|
111
|
+
### 🩹 Fixes
|
|
112
|
+
|
|
113
|
+
- Ensure sanitizeError function returns H3Error type consistently ([de54a04](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/de54a04))
|
|
114
|
+
|
|
115
|
+
### 🏡 Chore
|
|
116
|
+
|
|
117
|
+
- Add publishConfig access public for scoped npm package ([3c080be](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/3c080be))
|
|
118
|
+
|
|
119
|
+
### ❤️ Contributors
|
|
120
|
+
|
|
121
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
122
|
+
|
|
123
|
+
## v1.2.1
|
|
124
|
+
|
|
125
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.2.0...v1.2.1)
|
|
126
|
+
|
|
127
|
+
### 🩹 Fixes
|
|
128
|
+
|
|
129
|
+
- 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))
|
|
130
|
+
- Populate nodeReferences and sharedReferences in prepare:types hook ([83b41e2](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/83b41e2))
|
|
131
|
+
- Include devcoffee-nitro-core.d.ts in server TypeScript project via nitro:config hook ([20b35e0](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/20b35e0))
|
|
132
|
+
- **typecheck:** Exclude test, playground, and eslint config from tsconfig.app.json ([9d9c857](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/9d9c857))
|
|
133
|
+
|
|
134
|
+
### ❤️ Contributors
|
|
135
|
+
|
|
136
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
137
|
+
|
|
138
|
+
## v1.2.0
|
|
139
|
+
|
|
140
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.1.1...v1.2.0)
|
|
141
|
+
|
|
142
|
+
### 🚀 Enhancements
|
|
143
|
+
|
|
144
|
+
- **quick-260328-uf7:** Create admin-board test fixture ([45dae18](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/45dae18))
|
|
145
|
+
- **quick-260328-uf7:** Add admin-board OIDC e2e test ([20bf504](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/20bf504))
|
|
146
|
+
|
|
147
|
+
### 🩹 Fixes
|
|
148
|
+
|
|
149
|
+
- **types:** Explicitly type module export as NuxtModule for better type inference ([33e140e](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/33e140e))
|
|
150
|
+
- **types:** Resolve TypeScript errors in middleware and plugins ([df23475](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/df23475))
|
|
151
|
+
- Resolve #devcoffee-core subpath import warnings in build ([#19](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/19))
|
|
152
|
+
- Eliminate duplicate Redis sessions on SSR first load and refactor event.context.session ([#20](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/20))
|
|
153
|
+
- Rotate session on logout and remove console.log debug statement ([fbe129f](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/fbe129f))
|
|
154
|
+
- Resolve autoFetchUser SSR divergence on first render ([1f15ac7](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/1f15ac7))
|
|
155
|
+
- **lint:** Remove unused destructure aliases in SSR session mapping ([cfe7884](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/cfe7884))
|
|
156
|
+
|
|
157
|
+
### 📖 Documentation
|
|
158
|
+
|
|
159
|
+
- **quick:** Create plan for admin-board OIDC e2e test ([ce8c611](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/ce8c611))
|
|
160
|
+
- **quick-260328-uf7:** Complete admin-board OIDC e2e plan ([23c0945](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/23c0945))
|
|
161
|
+
|
|
162
|
+
### ✅ Tests
|
|
163
|
+
|
|
164
|
+
- Update deleteSession tests to reflect renewSession LOGOUT behavior ([b444baa](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/b444baa))
|
|
165
|
+
|
|
166
|
+
### ❤️ Contributors
|
|
167
|
+
|
|
168
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
169
|
+
- Hiếu Nguyễn ([@coolkg1412](https://github.com/coolkg1412))
|
|
170
|
+
|
|
171
|
+
## v1.1.1
|
|
172
|
+
|
|
173
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.0...v1.1.1)
|
|
174
|
+
|
|
175
|
+
### 💅 Refactors
|
|
176
|
+
|
|
177
|
+
- Sort storage adapter imports in helpers.ts; remove unused moduleText in forward handler test ([20f3496](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/20f3496))
|
|
178
|
+
|
|
179
|
+
### 🏡 Chore
|
|
180
|
+
|
|
181
|
+
- Complete v1.0 milestone — archive roadmap, requirements, retrospective ([2cb5067](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/2cb5067))
|
|
182
|
+
- Delete REQUIREMENTS.md — archived to milestones/v1.0-REQUIREMENTS.md ([48ce751](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/48ce751))
|
|
183
|
+
- Archive phase directories from v1.0 milestone ([1f3ced8](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/1f3ced8))
|
|
184
|
+
|
|
185
|
+
### ❤️ Contributors
|
|
186
|
+
|
|
187
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
188
|
+
|
|
189
|
+
## v1.1.0
|
|
190
|
+
|
|
191
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.0.2...v1.1.0)
|
|
192
|
+
|
|
193
|
+
### 🚀 Enhancements
|
|
194
|
+
|
|
195
|
+
- Add support for ignored authentication path regex patterns ([#5](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/5))
|
|
196
|
+
- **04:** Adapter foundation — http/utils/storage/oidc barrel adapters (ADPT-01–04) ([3c44a78](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/3c44a78))
|
|
197
|
+
- **09:** Add E2E test coverage using Playwright ([#14](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/14))
|
|
198
|
+
- **docs:** Phase 10 — README.md and GUIDELINE.md for consumers and contributors ([#15](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/15))
|
|
199
|
+
- **11:** Distributed token refresh mutex — atomic Redis NX lock for multi-instance deployments ([f7e2d72](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/f7e2d72))
|
|
200
|
+
|
|
201
|
+
### 🩹 Fixes
|
|
202
|
+
|
|
203
|
+
- TypeScript ([#4](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/4))
|
|
204
|
+
- Update index page test to check for non-null response ([aba39bf](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/aba39bf))
|
|
205
|
+
- **lint:** Auto-fix prettier formatting and replace dynamic delete in omit() ([89d987a](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/89d987a))
|
|
206
|
+
- **test:** Update SEC-03 source-text assertion to match prettier-formatted multiline call ([55f92d7](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/55f92d7))
|
|
207
|
+
- **types:** Resolve TypeScript strict-mode errors across app layer and server core ([b089812](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/b089812))
|
|
208
|
+
- **types:** Cast cookieOpts input before omit to resolve TS key narrowing error ([93dbb50](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/93dbb50))
|
|
209
|
+
- **types:** Include global.d.ts in Nitro server tsconfig to resolve DeepPartial on server layer ([24700e2](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/24700e2))
|
|
210
|
+
|
|
211
|
+
### 💅 Refactors
|
|
212
|
+
|
|
213
|
+
- Flatten utils paths (utils/utils.ts → utils.ts) ([45d8997](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/45d8997))
|
|
214
|
+
- **test:** Migrate test imports to @/ alias and fix tsconfig/vitest paths ([1f73e73](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/1f73e73))
|
|
215
|
+
- **utils:** Consolidate utility exports and fix module import paths ([d9e2fdc](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/d9e2fdc))
|
|
216
|
+
- **module:** Remove redundant typescript tsConfig includes covered by prepare:types hook ([9ced2c5](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/9ced2c5))
|
|
217
|
+
|
|
218
|
+
### 📖 Documentation
|
|
219
|
+
|
|
220
|
+
- **10:** Research phase for README.md and GUIDELINE.md documentation ([31d5ab0](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/31d5ab0))
|
|
221
|
+
- Resolve debug eslint-ts-type-errors ([0653761](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/0653761))
|
|
222
|
+
- Update debug knowledge base with eslint-ts-type-errors ([2dc0cc1](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/2dc0cc1))
|
|
223
|
+
|
|
224
|
+
### 🏡 Chore
|
|
225
|
+
|
|
226
|
+
- Authorize for devecoffee ([#2](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/2))
|
|
227
|
+
- The base UI and common Components ([#3](https://github.com/coolkg1412/devcoffee-nuxt-core/pull/3))
|
|
228
|
+
- Update docs ([b708e93](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/b708e93))
|
|
229
|
+
- Suppress DEP0155 deprecation warning in test scripts ([6fdb696](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/6fdb696))
|
|
230
|
+
- **test:** Split test scripts and enable headed E2E mode ([207c3d5](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/207c3d5))
|
|
231
|
+
- Bump `compatibilityDate` ([2654eb2](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/2654eb2))
|
|
232
|
+
|
|
233
|
+
### ✅ Tests
|
|
234
|
+
|
|
235
|
+
- **api:** Mark BUG-03 deprecation tests as todo until implemented ([69cd623](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/69cd623))
|
|
236
|
+
- Update import aliases and trim stale todo tests for BUG-03 ([f7c5cff](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/f7c5cff))
|
|
237
|
+
|
|
238
|
+
### ❤️ Contributors
|
|
239
|
+
|
|
240
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
241
|
+
- Hiếu Nguyễn ([@coolkg1412](https://github.com/coolkg1412))
|
|
242
|
+
|
|
218
243
|
## v1.0.2
|
|
219
244
|
|
|
220
245
|
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.0.1...v1.0.2)
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { addCustomTab } from '@nuxt/devtools-kit';
|
|
|
2
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.4.
|
|
5
|
+
const version = "1.4.3";
|
|
6
6
|
|
|
7
7
|
const defaultLocale = "vi-VN";
|
|
8
8
|
const defaultLanguage = "vi";
|
|
@@ -198,6 +198,11 @@ export declare function refreshTokenIfNeeded(session: SessionContext, opts: {
|
|
|
198
198
|
clientSecret: string;
|
|
199
199
|
tokenRefreshBufferMs: number;
|
|
200
200
|
distributedLock?: boolean;
|
|
201
|
+
sessionCreateOptions?: {
|
|
202
|
+
storageName: string;
|
|
203
|
+
storagePrefix: string;
|
|
204
|
+
secret: string;
|
|
205
|
+
};
|
|
201
206
|
}): Promise<any>;
|
|
202
207
|
/**
|
|
203
208
|
* Fetch user profile information from the OpenID Provider using the access token.
|
|
@@ -344,7 +344,34 @@ export async function refreshTokenIfNeeded(session, opts) {
|
|
|
344
344
|
const lockKey = `${opts.cache.prefix}:refresh-lock:${session.id}`;
|
|
345
345
|
const acquired = await tryAcquireLock(lockStorage, lockKey, 10, opts.distributedLock ?? false);
|
|
346
346
|
if (!acquired) {
|
|
347
|
-
logger.debug('[refreshTokenIfNeeded] refresh lock held for session "%s" \u2014
|
|
347
|
+
logger.debug('[refreshTokenIfNeeded] refresh lock held for session "%s" \u2014 waiting...', session.id);
|
|
348
|
+
if (opts.sessionCreateOptions) {
|
|
349
|
+
const { storageName, storagePrefix, secret } = opts.sessionCreateOptions;
|
|
350
|
+
let attempts = 0;
|
|
351
|
+
const maxAttempts = 50;
|
|
352
|
+
while (attempts < maxAttempts) {
|
|
353
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
354
|
+
const lockExists = await lockStorage.hasItem(lockKey);
|
|
355
|
+
if (!lockExists) {
|
|
356
|
+
const updatedSession = await getSession(session.id, { storageName, storagePrefix, secret });
|
|
357
|
+
if (updatedSession?.auth?.tokenSet) {
|
|
358
|
+
const newExpiresAt = updatedSession.auth.tokenSet.expiresAt;
|
|
359
|
+
const isStillExpired = Boolean(newExpiresAt - opts.tokenRefreshBufferMs < Date.now());
|
|
360
|
+
if (!isStillExpired) {
|
|
361
|
+
logger.debug("[refreshTokenIfNeeded] session refreshed by another request, proceeding.");
|
|
362
|
+
return {
|
|
363
|
+
auth: { status: updatedSession.auth.status, tokenSet: updatedSession.auth.tokenSet },
|
|
364
|
+
user: updatedSession.user
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
attempts++;
|
|
370
|
+
}
|
|
371
|
+
logger.warn('[refreshTokenIfNeeded] Timeout waiting for refresh lock for session "%s"', session.id);
|
|
372
|
+
} else {
|
|
373
|
+
logger.warn("[refreshTokenIfNeeded] sessionCreateOptions not provided, cannot wait for concurrent refresh");
|
|
374
|
+
}
|
|
348
375
|
return { auth: { status: session.auth.status, tokenSet: session.auth.tokenSet }, user: session.user };
|
|
349
376
|
}
|
|
350
377
|
logger.info('Refreshing access token for session "%s"', session.id);
|
|
@@ -100,10 +100,16 @@ export default function NuxtAuthtsHandler(options) {
|
|
|
100
100
|
let cachedUser = await cacheStorage2.getItem(userInfoCacheKey);
|
|
101
101
|
if (!cachedUser) {
|
|
102
102
|
logger.debug("Re-fetch user info");
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
try {
|
|
104
|
+
cachedUser = await nuxtAuthOptions.userInfo(session.user, { tokenSet: session.auth.tokenSet });
|
|
105
|
+
await cacheStorage2.setItem(userInfoCacheKey, cachedUser, { ttl: openid.autoFetchUserTtl });
|
|
106
|
+
} catch (err) {
|
|
107
|
+
logger.warn("userInfo fetch failed, using session user fallback: %s", err.message);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (cachedUser) {
|
|
111
|
+
refetchSessionData.user = cachedUser;
|
|
105
112
|
}
|
|
106
|
-
refetchSessionData.user = cachedUser;
|
|
107
113
|
}
|
|
108
114
|
if (Object.keys(refetchSessionData).length > 0) {
|
|
109
115
|
session = await updateSession(session.id, refetchSessionData, {
|
|
@@ -44,7 +44,12 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
44
44
|
clientId,
|
|
45
45
|
clientSecret,
|
|
46
46
|
tokenRefreshBufferMs,
|
|
47
|
-
distributedLock
|
|
47
|
+
distributedLock,
|
|
48
|
+
sessionCreateOptions: {
|
|
49
|
+
storageName,
|
|
50
|
+
storagePrefix,
|
|
51
|
+
secret
|
|
52
|
+
}
|
|
48
53
|
});
|
|
49
54
|
if (Object.keys(sessionUpdate).length > 0) {
|
|
50
55
|
session = await updateSession(session.id, sessionUpdate, { storageName, storagePrefix, expiresIn, secret });
|
|
@@ -57,8 +62,12 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
57
62
|
logger.debug("refetch user info sessionid=%s", sessionCookieId);
|
|
58
63
|
const userInfoFn = useNitroApp()._sessionUserInfo;
|
|
59
64
|
if (userInfoFn && session.auth.tokenSet) {
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
try {
|
|
66
|
+
cachedUser = await userInfoFn(session.user, { tokenSet: session.auth.tokenSet });
|
|
67
|
+
await cacheStorage.setItem(userInfoCacheKey, cachedUser, { ttl: autoFetchUserTtl });
|
|
68
|
+
} catch (err) {
|
|
69
|
+
logger.warn("userInfo fetch failed, using session user fallback: %s", err.message);
|
|
70
|
+
}
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
if (cachedUser) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devcoffee/nuxt-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"cleanup": "nuxi cleanup && nuxi cleanup playground",
|
|
54
54
|
"dev:build": "nuxi build playground",
|
|
55
55
|
"prepack": "nuxt-module-build build",
|
|
56
|
-
"release": "npm run lint && npm run test:all && npm run prepack && npm publish && git push --follow-tags",
|
|
56
|
+
"release": "npm run lint && npm run test:all && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
57
57
|
"lint": "eslint",
|
|
58
58
|
"lint:fix": "eslint --fix",
|
|
59
59
|
"test": "cross-env NODE_OPTIONS=--no-deprecation vitest run test/unit",
|