@devcoffee/nuxt-core 1.6.0 → 1.6.2
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 +24 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/app/plugins/formatters.d.ts +5 -0
- package/dist/runtime/app/plugins/formatters.js +13 -9
- package/dist/runtime/server/core/helpers.d.ts +2 -1
- package/dist/runtime/server/core/helpers.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.6.2
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.6.1...v1.6.2)
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- Preserve refresh token on token refresh ([bec49ab](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/bec49ab))
|
|
10
|
+
|
|
11
|
+
### ❤️ Contributors
|
|
12
|
+
|
|
13
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
14
|
+
|
|
15
|
+
## v1.6.1
|
|
16
|
+
|
|
17
|
+
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.6.0...v1.6.1)
|
|
18
|
+
|
|
19
|
+
### 🩹 Fixes
|
|
20
|
+
|
|
21
|
+
- Enhance Nuxt app integration by adding $formatters to NuxtApp interface ([e4e3bec](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/e4e3bec))
|
|
22
|
+
|
|
23
|
+
### ❤️ Contributors
|
|
24
|
+
|
|
25
|
+
- Hieu Nguyen <hieu.nguyen@devcoffee.tech>
|
|
26
|
+
|
|
3
27
|
## v1.6.0
|
|
4
28
|
|
|
5
29
|
[compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.5.1...v1.6.0)
|
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.6.
|
|
5
|
+
const version = "1.6.2";
|
|
6
6
|
|
|
7
7
|
const defaultLocale = "vi-VN";
|
|
8
8
|
const defaultLanguage = "vi";
|
|
@@ -108,13 +108,17 @@ export default defineNuxtPlugin((_nuxtApp) => {
|
|
|
108
108
|
}
|
|
109
109
|
return asDateTimeString(date, true);
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
return {
|
|
112
|
+
provide: {
|
|
113
|
+
formatters: {
|
|
114
|
+
toPad,
|
|
115
|
+
toFormattedSize,
|
|
116
|
+
asPhoneText,
|
|
117
|
+
asDateString,
|
|
118
|
+
asTimeString,
|
|
119
|
+
asDateTimeString,
|
|
120
|
+
asRelativeTimeString
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
120
124
|
});
|
|
@@ -194,10 +194,11 @@ export declare function authorizationCodeGrant(authorizeParams: {
|
|
|
194
194
|
* Ensures the token type is properly capitalized.
|
|
195
195
|
*
|
|
196
196
|
* @param input - The raw token endpoint response.
|
|
197
|
+
* @param fallbackRefreshToken - Existing refresh token to preserve when a refresh response omits rotation.
|
|
197
198
|
* @returns A normalized token set containing access, id, and refresh tokens along with expiry.
|
|
198
199
|
* @since 1.0.0
|
|
199
200
|
*/
|
|
200
|
-
export declare function constructTokenSet(input: TokenEndpointResponse): {
|
|
201
|
+
export declare function constructTokenSet(input: TokenEndpointResponse, fallbackRefreshToken?: string): {
|
|
201
202
|
tokenType: string;
|
|
202
203
|
idToken: any;
|
|
203
204
|
accessToken: any;
|
|
@@ -311,7 +311,7 @@ async function refreshTokenGrant(refreshToken, opts) {
|
|
|
311
311
|
const config = await getOpenIdConfiguration(wellKnownUrl, discoveryOption);
|
|
312
312
|
return refreshTokenGrantFromOidc(config, refreshToken);
|
|
313
313
|
}
|
|
314
|
-
export function constructTokenSet(input) {
|
|
314
|
+
export function constructTokenSet(input, fallbackRefreshToken) {
|
|
315
315
|
let tokenType = input.token_type;
|
|
316
316
|
if (tokenType.toUpperCase() === "BEARER") {
|
|
317
317
|
tokenType = "Bearer";
|
|
@@ -320,7 +320,7 @@ export function constructTokenSet(input) {
|
|
|
320
320
|
tokenType,
|
|
321
321
|
idToken: input.id_token,
|
|
322
322
|
accessToken: input.access_token,
|
|
323
|
-
refreshToken: input.refresh_token,
|
|
323
|
+
refreshToken: input.refresh_token ?? fallbackRefreshToken,
|
|
324
324
|
scopes: (input.scope || "").split(" "),
|
|
325
325
|
expiresAt: Date.now() + (input.expires_in || 0) * 1e3
|
|
326
326
|
};
|
|
@@ -405,7 +405,7 @@ export async function refreshTokenIfNeeded(session, opts) {
|
|
|
405
405
|
sessionUpdate = {
|
|
406
406
|
auth: {
|
|
407
407
|
status: session.auth.status,
|
|
408
|
-
tokenSet: constructTokenSet(tokenSet)
|
|
408
|
+
tokenSet: constructTokenSet(tokenSet, refreshToken)
|
|
409
409
|
},
|
|
410
410
|
user: session.user
|
|
411
411
|
};
|