@classic-homes/auth 1.2.0 → 1.5.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/dist/auth.svelte-YNXMXION.js +3 -0
- package/dist/{chunk-FTHQBYF2.js → chunk-GVNUEBEP.js} +3 -3
- package/dist/{chunk-GKS5EDOT.js → chunk-NCVJ2HGP.js} +3 -3
- package/dist/{chunk-7OXE7SAW.js → chunk-O6GYC4PA.js} +4 -4
- package/dist/{chunk-VFEGS6FR.js → chunk-X7KH4DDN.js} +2 -0
- package/dist/{chunk-LMFSLTIV.js → chunk-ZJYMNGGH.js} +2 -2
- package/dist/core/index.d.ts +9 -4
- package/dist/core/index.js +3 -3
- package/dist/index.js +5 -5
- package/dist/svelte/index.js +5 -5
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/auth.svelte-MGVCAICX.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { authService } from './chunk-
|
|
2
|
-
import { authStore, currentUser, isAuthenticated, authActions } from './chunk-
|
|
3
|
-
import { isInitialized, initAuth, getUserRoles } from './chunk-
|
|
1
|
+
import { authService } from './chunk-O6GYC4PA.js';
|
|
2
|
+
import { authStore, currentUser, isAuthenticated, authActions } from './chunk-ZJYMNGGH.js';
|
|
3
|
+
import { isInitialized, initAuth, getUserRoles } from './chunk-X7KH4DDN.js';
|
|
4
4
|
|
|
5
5
|
// src/svelte/guards/auth-guard.ts
|
|
6
6
|
function checkAuth(options = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getConfig, getStorage, getFetch, isValidRedirectUrl } from './chunk-
|
|
1
|
+
import { getConfig, getStorage, getFetch, isValidRedirectUrl } from './chunk-X7KH4DDN.js';
|
|
2
2
|
|
|
3
3
|
// src/core/client.ts
|
|
4
4
|
var isRefreshing = false;
|
|
@@ -77,7 +77,7 @@ function updateStoredTokens(accessToken, refreshToken) {
|
|
|
77
77
|
parsed.accessToken = accessToken;
|
|
78
78
|
parsed.refreshToken = refreshToken;
|
|
79
79
|
storage.setItem(storageKey, JSON.stringify(parsed));
|
|
80
|
-
import('./auth.svelte-
|
|
80
|
+
import('./auth.svelte-YNXMXION.js').then(({ authStore }) => {
|
|
81
81
|
authStore.updateTokens(accessToken, refreshToken);
|
|
82
82
|
}).catch(() => {
|
|
83
83
|
});
|
|
@@ -92,7 +92,7 @@ function clearStoredAuth() {
|
|
|
92
92
|
async function expireSession() {
|
|
93
93
|
clearStoredAuth();
|
|
94
94
|
try {
|
|
95
|
-
const { authStore } = await import('./auth.svelte-
|
|
95
|
+
const { authStore } = await import('./auth.svelte-YNXMXION.js');
|
|
96
96
|
authStore.handleSessionExpired();
|
|
97
97
|
} catch {
|
|
98
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { authApi } from './chunk-
|
|
2
|
-
import { getUserRoles, hasAnyRole } from './chunk-
|
|
1
|
+
import { authApi } from './chunk-NCVJ2HGP.js';
|
|
2
|
+
import { getUserRoles, hasAnyRole } from './chunk-X7KH4DDN.js';
|
|
3
3
|
|
|
4
4
|
// src/core/guards.ts
|
|
5
5
|
function isMfaChallengeResponse(response) {
|
|
@@ -59,7 +59,7 @@ var AuthService = class {
|
|
|
59
59
|
}
|
|
60
60
|
if (options?.autoSetAuth !== false && !isMfaChallengeResponse(response)) {
|
|
61
61
|
try {
|
|
62
|
-
const { authStore } = await import('./auth.svelte-
|
|
62
|
+
const { authStore } = await import('./auth.svelte-YNXMXION.js');
|
|
63
63
|
authStore.setAuth(
|
|
64
64
|
response.accessToken,
|
|
65
65
|
response.refreshToken,
|
|
@@ -245,7 +245,7 @@ var AuthService = class {
|
|
|
245
245
|
}
|
|
246
246
|
if (options?.autoSetAuth !== false) {
|
|
247
247
|
try {
|
|
248
|
-
const { authStore } = await import('./auth.svelte-
|
|
248
|
+
const { authStore } = await import('./auth.svelte-YNXMXION.js');
|
|
249
249
|
authStore.setAuth(
|
|
250
250
|
response.accessToken,
|
|
251
251
|
response.refreshToken,
|
|
@@ -171,6 +171,7 @@ var ROLE_NAMES = [
|
|
|
171
171
|
"marketing_staff",
|
|
172
172
|
"purchasing_staff",
|
|
173
173
|
"sales_staff",
|
|
174
|
+
"stormwater_staff",
|
|
174
175
|
"warranty_staff",
|
|
175
176
|
"employee",
|
|
176
177
|
"user",
|
|
@@ -204,6 +205,7 @@ var ROLE_HIERARCHY = {
|
|
|
204
205
|
marketing_staff: 2,
|
|
205
206
|
purchasing_staff: 2,
|
|
206
207
|
sales_staff: 2,
|
|
208
|
+
stormwater_staff: 2,
|
|
207
209
|
warranty_staff: 2,
|
|
208
210
|
manager: 3,
|
|
209
211
|
admin: 4
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { authApi } from './chunk-
|
|
2
|
-
import { isInitialized, getConfig, hasRole, hasAnyRole, hasAllRoles, decodeJWT, getStorage, getDefaultStorage } from './chunk-
|
|
1
|
+
import { authApi } from './chunk-NCVJ2HGP.js';
|
|
2
|
+
import { isInitialized, getConfig, hasRole, hasAnyRole, hasAllRoles, decodeJWT, getStorage, getDefaultStorage } from './chunk-X7KH4DDN.js';
|
|
3
3
|
|
|
4
4
|
// src/svelte/stores/auth.svelte.ts
|
|
5
5
|
var STORAGE_VERSION = 2;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -469,11 +469,16 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
|
|
|
469
469
|
*
|
|
470
470
|
* Mirrors `ROLE_NAMES` in the API. `builder`/`customer_service`/`demo`/
|
|
471
471
|
* `stormwater` are staff-tier clones of `agent`; the `<department>_staff` roles
|
|
472
|
-
* are grant-on-top docs roles held alongside another role
|
|
473
|
-
*
|
|
474
|
-
*
|
|
472
|
+
* are grant-on-top docs roles held alongside another role, one per department
|
|
473
|
+
* the API lists in `DEPARTMENT_SCOPES`; `employee` is the read-only base staff
|
|
474
|
+
* floor (default for Authentik SSO); `vendor`/`customer`/`subcontractor` are
|
|
475
|
+
* clones of `user`, row-scoped to their own homes.
|
|
476
|
+
*
|
|
477
|
+
* `stormwater` and `stormwater_staff` are two different roles: the first is the
|
|
478
|
+
* field app's clone of `agent`, the second is that department's docs role.
|
|
479
|
+
* Someone on the stormwater team who also reads the docs holds both.
|
|
475
480
|
*/
|
|
476
|
-
declare const ROLE_NAMES: readonly ["admin", "manager", "agent", "builder", "customer_service", "demo", "stormwater", "accounting_staff", "architecture_staff", "construction_staff", "crl_staff", "design_staff", "hr_staff", "it_staff", "landdev_staff", "marketing_staff", "purchasing_staff", "sales_staff", "warranty_staff", "employee", "user", "vendor", "customer", "subcontractor", "guest"];
|
|
481
|
+
declare const ROLE_NAMES: readonly ["admin", "manager", "agent", "builder", "customer_service", "demo", "stormwater", "accounting_staff", "architecture_staff", "construction_staff", "crl_staff", "design_staff", "hr_staff", "it_staff", "landdev_staff", "marketing_staff", "purchasing_staff", "sales_staff", "stormwater_staff", "warranty_staff", "employee", "user", "vendor", "customer", "subcontractor", "guest"];
|
|
477
482
|
/**
|
|
478
483
|
* A known role name.
|
|
479
484
|
*
|
package/dist/core/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from '../chunk-
|
|
2
|
-
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from '../chunk-
|
|
3
|
-
export { ROLE_HIERARCHY, ROLE_NAMES, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, extractClaims, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isInitialized, isTokenExpired, resetConfig } from '../chunk-
|
|
1
|
+
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from '../chunk-O6GYC4PA.js';
|
|
2
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from '../chunk-NCVJ2HGP.js';
|
|
3
|
+
export { ROLE_HIERARCHY, ROLE_NAMES, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, extractClaims, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isInitialized, isTokenExpired, resetConfig } from '../chunk-X7KH4DDN.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from './chunk-
|
|
2
|
-
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-
|
|
3
|
-
export { authActions, authStore, currentUser, isAuthenticated } from './chunk-
|
|
4
|
-
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from './chunk-
|
|
5
|
-
export { ROLE_HIERARCHY, ROLE_NAMES, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, extractClaims, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isInitialized, isTokenExpired, resetConfig } from './chunk-
|
|
1
|
+
export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from './chunk-GVNUEBEP.js';
|
|
2
|
+
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-O6GYC4PA.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from './chunk-ZJYMNGGH.js';
|
|
4
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from './chunk-NCVJ2HGP.js';
|
|
5
|
+
export { ROLE_HIERARCHY, ROLE_NAMES, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, extractClaims, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isInitialized, isTokenExpired, resetConfig } from './chunk-X7KH4DDN.js';
|
package/dist/svelte/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from '../chunk-
|
|
2
|
-
export { RoleDeniedError, formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials, isRoleDeniedError } from '../chunk-
|
|
3
|
-
export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
export { initAuth, isInitialized } from '../chunk-
|
|
1
|
+
export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from '../chunk-GVNUEBEP.js';
|
|
2
|
+
export { RoleDeniedError, formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials, isRoleDeniedError } from '../chunk-O6GYC4PA.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-ZJYMNGGH.js';
|
|
4
|
+
import '../chunk-NCVJ2HGP.js';
|
|
5
|
+
export { initAuth, isInitialized } from '../chunk-X7KH4DDN.js';
|
package/dist/testing/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasRole, hasAnyRole, hasAllRoles, initAuth, resetConfig, getUserRoles, isTokenExpired, decodeJWT } from '../chunk-
|
|
1
|
+
import { hasRole, hasAnyRole, hasAllRoles, initAuth, resetConfig, getUserRoles, isTokenExpired, decodeJWT } from '../chunk-X7KH4DDN.js';
|
|
2
2
|
|
|
3
3
|
// src/testing/fixtures/users.ts
|
|
4
4
|
var mockUser = {
|
package/package.json
CHANGED