@classic-homes/auth 0.1.28 → 0.1.30

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.
@@ -1,3 +1,3 @@
1
- export { authActions, authStore, currentUser, isAuthenticated } from './chunk-U2YM3E3Q.js';
2
- import './chunk-MI4B4ZRK.js';
1
+ export { authActions, authStore, currentUser, isAuthenticated } from './chunk-FSUP2LAZ.js';
2
+ import './chunk-LYTYYOPU.js';
3
3
  import './chunk-DCGC6CNV.js';
@@ -1,4 +1,4 @@
1
- import { authStore } from './chunk-U2YM3E3Q.js';
1
+ import { authStore } from './chunk-FSUP2LAZ.js';
2
2
 
3
3
  // src/svelte/guards/auth-guard.ts
4
4
  function checkAuth(options = {}) {
@@ -1,4 +1,4 @@
1
- import { authApi } from './chunk-MI4B4ZRK.js';
1
+ import { authApi } from './chunk-LYTYYOPU.js';
2
2
  import { decodeJWT, isInitialized, getConfig, getStorage, getDefaultStorage } from './chunk-DCGC6CNV.js';
3
3
 
4
4
  // src/svelte/stores/auth.svelte.ts
@@ -53,7 +53,7 @@ function updateStoredTokens(accessToken, refreshToken) {
53
53
  parsed.accessToken = accessToken;
54
54
  parsed.refreshToken = refreshToken;
55
55
  storage.setItem(storageKey, JSON.stringify(parsed));
56
- import('./auth.svelte-PKMR4LYT.js').then(({ authStore }) => {
56
+ import('./auth.svelte-CIDAK774.js').then(({ authStore }) => {
57
57
  authStore.updateTokens(accessToken, refreshToken);
58
58
  }).catch(() => {
59
59
  });
@@ -84,8 +84,9 @@ async function refreshAccessToken() {
84
84
  const apiResponse = await response.json();
85
85
  const data = apiResponse.data;
86
86
  const tokens = data && typeof data === "object" && "data" in data ? data.data : data;
87
- if (tokens?.accessToken && tokens?.refreshToken) {
88
- updateStoredTokens(tokens.accessToken, tokens.refreshToken);
87
+ if (tokens?.accessToken) {
88
+ const newRefreshToken = tokens.refreshToken ?? refreshToken;
89
+ updateStoredTokens(tokens.accessToken, newRefreshToken);
89
90
  onTokenRefreshed(tokens.accessToken);
90
91
  return true;
91
92
  }
@@ -1,4 +1,4 @@
1
- import { authApi } from './chunk-MI4B4ZRK.js';
1
+ import { authApi } from './chunk-LYTYYOPU.js';
2
2
 
3
3
  // src/core/guards.ts
4
4
  function isMfaChallengeResponse(response) {
@@ -29,7 +29,7 @@ var AuthService = class {
29
29
  const response = await authApi.login(credentials);
30
30
  if (options?.autoSetAuth !== false && !isMfaChallengeResponse(response)) {
31
31
  try {
32
- const { authStore } = await import('./auth.svelte-PKMR4LYT.js');
32
+ const { authStore } = await import('./auth.svelte-CIDAK774.js');
33
33
  authStore.setAuth(
34
34
  response.accessToken,
35
35
  response.refreshToken,
@@ -204,7 +204,7 @@ var AuthService = class {
204
204
  const response = await authApi.verifyMFAChallenge(data);
205
205
  if (options?.autoSetAuth !== false) {
206
206
  try {
207
- const { authStore } = await import('./auth.svelte-PKMR4LYT.js');
207
+ const { authStore } = await import('./auth.svelte-CIDAK774.js');
208
208
  authStore.setAuth(
209
209
  response.accessToken,
210
210
  response.refreshToken,
@@ -1,3 +1,3 @@
1
- export { AuthService, authService, getAvailableMethods, getMfaToken, isLoginSuccessResponse, isMfaChallengeResponse } from '../chunk-MY664247.js';
2
- export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from '../chunk-MI4B4ZRK.js';
1
+ export { AuthService, authService, getAvailableMethods, getMfaToken, isLoginSuccessResponse, isMfaChallengeResponse } from '../chunk-N5DUPSOL.js';
2
+ export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from '../chunk-LYTYYOPU.js';
3
3
  export { decodeJWT, extractClaims, getConfig, getDefaultStorage, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, initAuth, isInitialized, isTokenExpired, resetConfig } from '../chunk-DCGC6CNV.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { AuthService, authService, getAvailableMethods, getMfaToken, isLoginSuccessResponse, isMfaChallengeResponse } from './chunk-MY664247.js';
2
- export { checkAuth, createAuthGuard, protectedLoad, requireAuth, requirePermission, requireRole } from './chunk-IO2LIH4I.js';
3
- export { authActions, authStore, currentUser, isAuthenticated } from './chunk-U2YM3E3Q.js';
4
- export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from './chunk-MI4B4ZRK.js';
1
+ export { AuthService, authService, getAvailableMethods, getMfaToken, isLoginSuccessResponse, isMfaChallengeResponse } from './chunk-N5DUPSOL.js';
2
+ export { checkAuth, createAuthGuard, protectedLoad, requireAuth, requirePermission, requireRole } from './chunk-3LY565CA.js';
3
+ export { authActions, authStore, currentUser, isAuthenticated } from './chunk-FSUP2LAZ.js';
4
+ export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from './chunk-LYTYYOPU.js';
5
5
  export { decodeJWT, extractClaims, getConfig, getDefaultStorage, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, initAuth, isInitialized, isTokenExpired, resetConfig } from './chunk-DCGC6CNV.js';
@@ -1,4 +1,4 @@
1
- export { checkAuth, createAuthGuard, protectedLoad, requireAuth, requirePermission, requireRole } from '../chunk-IO2LIH4I.js';
2
- export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-U2YM3E3Q.js';
3
- import '../chunk-MI4B4ZRK.js';
1
+ export { checkAuth, createAuthGuard, protectedLoad, requireAuth, requirePermission, requireRole } from '../chunk-3LY565CA.js';
2
+ export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-FSUP2LAZ.js';
3
+ import '../chunk-LYTYYOPU.js';
4
4
  import '../chunk-DCGC6CNV.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/auth",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Authentication services and Svelte bindings for Classic Theme apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",