@classic-homes/auth 1.9.0 → 1.14.1
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-64QCTV2B.js +3 -0
- package/dist/{chunk-OCIQI3ZZ.js → chunk-B6MOGO74.js} +2 -2
- package/dist/{chunk-S4Y4XXDN.js → chunk-LFNG4XAP.js} +3 -3
- package/dist/{chunk-X7KH4DDN.js → chunk-PYCXNOMA.js} +3 -1
- package/dist/{chunk-ZWCIY6MG.js → chunk-S5LHUKA5.js} +4 -4
- package/dist/{chunk-AVSOQVSW.js → chunk-WHNMH73M.js} +3 -3
- package/dist/core/index.d.ts +7 -5
- 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-P5ICPWBD.js +0 -3
|
@@ -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-LFNG4XAP.js';
|
|
2
|
+
import { isInitialized, getConfig, hasRole, hasAnyRole, hasAllRoles, decodeJWT, getStorage, getDefaultStorage } from './chunk-PYCXNOMA.js';
|
|
3
3
|
|
|
4
4
|
// src/svelte/stores/auth.svelte.ts
|
|
5
5
|
var STORAGE_VERSION = 2;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getConfig, getStorage, isTokenExpired, getFetch, isValidRedirectUrl } from './chunk-
|
|
1
|
+
import { getConfig, getStorage, isTokenExpired, getFetch, isValidRedirectUrl } from './chunk-PYCXNOMA.js';
|
|
2
2
|
|
|
3
3
|
// src/core/client.ts
|
|
4
4
|
var DEFAULT_REFRESH_RETRY_DELAYS = [1e3, 3e3];
|
|
@@ -58,7 +58,7 @@ function writeStoredTokens(accessToken, refreshToken) {
|
|
|
58
58
|
}
|
|
59
59
|
async function syncSvelteStore(apply) {
|
|
60
60
|
try {
|
|
61
|
-
const { authStore } = await import('./auth.svelte-
|
|
61
|
+
const { authStore } = await import('./auth.svelte-64QCTV2B.js');
|
|
62
62
|
apply(authStore);
|
|
63
63
|
} catch {
|
|
64
64
|
}
|
|
@@ -445,7 +445,7 @@ var authApi = {
|
|
|
445
445
|
*/
|
|
446
446
|
async getProfile(customFetch) {
|
|
447
447
|
const response = await api.get("/auth/profile", true, customFetch);
|
|
448
|
-
return response;
|
|
448
|
+
return extractData(response);
|
|
449
449
|
},
|
|
450
450
|
/**
|
|
451
451
|
* Update the current user's profile.
|
|
@@ -173,6 +173,7 @@ var ROLE_NAMES = [
|
|
|
173
173
|
"sales_staff",
|
|
174
174
|
"stormwater_staff",
|
|
175
175
|
"warranty_staff",
|
|
176
|
+
"hotsheet_editor",
|
|
176
177
|
"employee",
|
|
177
178
|
"user",
|
|
178
179
|
"vendor",
|
|
@@ -187,7 +188,7 @@ var ROLE_HIERARCHY = {
|
|
|
187
188
|
customer: 1,
|
|
188
189
|
subcontractor: 1,
|
|
189
190
|
// Staff tier (2): the read-only `employee` floor, the field-app clones of
|
|
190
|
-
// `agent`,
|
|
191
|
+
// `agent`, every `<department>_staff` docs role, and `hotsheet_editor`.
|
|
191
192
|
employee: 2,
|
|
192
193
|
agent: 2,
|
|
193
194
|
builder: 2,
|
|
@@ -207,6 +208,7 @@ var ROLE_HIERARCHY = {
|
|
|
207
208
|
sales_staff: 2,
|
|
208
209
|
stormwater_staff: 2,
|
|
209
210
|
warranty_staff: 2,
|
|
211
|
+
hotsheet_editor: 2,
|
|
210
212
|
manager: 3,
|
|
211
213
|
admin: 4
|
|
212
214
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { authApi } from './chunk-
|
|
2
|
-
import { getUserRoles, hasAnyRole } from './chunk-
|
|
1
|
+
import { authApi } from './chunk-LFNG4XAP.js';
|
|
2
|
+
import { getUserRoles, hasAnyRole } from './chunk-PYCXNOMA.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-64QCTV2B.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-64QCTV2B.js');
|
|
249
249
|
authStore.setAuth(
|
|
250
250
|
response.accessToken,
|
|
251
251
|
response.refreshToken,
|
|
@@ -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-S5LHUKA5.js';
|
|
2
|
+
import { authStore, currentUser, isAuthenticated, authActions } from './chunk-B6MOGO74.js';
|
|
3
|
+
import { isInitialized, initAuth, getUserRoles } from './chunk-PYCXNOMA.js';
|
|
4
4
|
|
|
5
5
|
// src/svelte/guards/auth-guard.ts
|
|
6
6
|
function checkAuth(options = {}) {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -527,10 +527,12 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
|
|
|
527
527
|
* the first match, which is what makes the result deterministic when several
|
|
528
528
|
* roles share a tier (e.g. `agent` + `builder`).
|
|
529
529
|
*
|
|
530
|
-
* Mirrors `ROLE_NAMES` in the API. `builder`/`customer_service`/`
|
|
531
|
-
*
|
|
532
|
-
* are grant-on-top docs roles held alongside another
|
|
533
|
-
* the API lists in `DEPARTMENT_SCOPES`;
|
|
530
|
+
* Mirrors `ROLE_NAMES` in the API. `builder`/`customer_service`/`stormwater`
|
|
531
|
+
* are staff-tier clones of `agent` and `demo` a read-only one; the
|
|
532
|
+
* `<department>_staff` roles are grant-on-top docs roles held alongside another
|
|
533
|
+
* role, one per department the API lists in `DEPARTMENT_SCOPES`;
|
|
534
|
+
* `hotsheet_editor` is a grant-on-top role for the Hotsheet hub's write
|
|
535
|
+
* surface; `employee` is the read-only base staff
|
|
534
536
|
* floor (default for Authentik SSO); `vendor`/`customer`/`subcontractor` are
|
|
535
537
|
* clones of `user`, row-scoped to their own homes.
|
|
536
538
|
*
|
|
@@ -538,7 +540,7 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
|
|
|
538
540
|
* field app's clone of `agent`, the second is that department's docs role.
|
|
539
541
|
* Someone on the stormwater team who also reads the docs holds both.
|
|
540
542
|
*/
|
|
541
|
-
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"];
|
|
543
|
+
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", "hotsheet_editor", "employee", "user", "vendor", "customer", "subcontractor", "guest"];
|
|
542
544
|
/**
|
|
543
545
|
* A known role name.
|
|
544
546
|
*
|
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, initCrossTabSync, refreshSession, 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-S5LHUKA5.js';
|
|
2
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from '../chunk-LFNG4XAP.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-PYCXNOMA.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, initCrossTabSync, refreshSession, 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-WHNMH73M.js';
|
|
2
|
+
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-S5LHUKA5.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from './chunk-B6MOGO74.js';
|
|
4
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from './chunk-LFNG4XAP.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-PYCXNOMA.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-WHNMH73M.js';
|
|
2
|
+
export { RoleDeniedError, formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials, isRoleDeniedError } from '../chunk-S5LHUKA5.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-B6MOGO74.js';
|
|
4
|
+
import '../chunk-LFNG4XAP.js';
|
|
5
|
+
export { initAuth, isInitialized } from '../chunk-PYCXNOMA.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-PYCXNOMA.js';
|
|
2
2
|
|
|
3
3
|
// src/testing/fixtures/users.ts
|
|
4
4
|
var mockUser = {
|
package/package.json
CHANGED