@classic-homes/auth 1.46.0 → 1.47.0

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.
@@ -0,0 +1,3 @@
1
+ export { authActions, authStore, currentUser, isAuthenticated } from './chunk-HWV4ZEZM.js';
2
+ import './chunk-4Q3R4TTI.js';
3
+ import './chunk-TANYGU4O.js';
@@ -1,4 +1,4 @@
1
- import { isInitialized, getConfig, getUserRoles, clearAccessSubject, getStorage, isTokenExpired, getFetch, isAccessProbeActive, isValidRedirectUrl, ACCESS_DEBUG_HEADER, ACCESS_REDACTED_HEADER, ACCESS_REDACTED_TRUNCATED_HEADER, parseRedactedHeader, reportAccess, requirementFromDenial, decodeJWT } from './chunk-EFS272S3.js';
1
+ import { isInitialized, getConfig, getUserRoles, clearAccessSubject, getStorage, isTokenExpired, getFetch, isAccessProbeActive, isValidRedirectUrl, ACCESS_DEBUG_HEADER, ACCESS_REDACTED_HEADER, ACCESS_REDACTED_TRUNCATED_HEADER, parseRedactedHeader, reportAccess, requirementFromDenial, decodeJWT } from './chunk-TANYGU4O.js';
2
2
 
3
3
  // src/core/sso-state.ts
4
4
  var SSO_CLIENT_STATE_PARAM = "client_state";
@@ -236,7 +236,7 @@ function writeStoredTokens(accessToken, refreshToken) {
236
236
  }
237
237
  async function syncSvelteStore(apply) {
238
238
  try {
239
- const { authStore } = await import('./auth.svelte-IWSWWF6U.js');
239
+ const { authStore } = await import('./auth.svelte-CPTJUC3O.js');
240
240
  apply(authStore);
241
241
  } catch {
242
242
  }
@@ -1,5 +1,5 @@
1
- import { authApi, InvalidAuthResponseError, RoleDeniedError } from './chunk-7SFVHDFP.js';
2
- import { getUserRoles } from './chunk-EFS272S3.js';
1
+ import { authApi, InvalidAuthResponseError, RoleDeniedError } from './chunk-4Q3R4TTI.js';
2
+ import { getUserRoles } from './chunk-TANYGU4O.js';
3
3
 
4
4
  // src/core/guards.ts
5
5
  function isMfaChallengeResponse(response) {
@@ -19,7 +19,7 @@ function getAvailableMethods(response) {
19
19
  async function setStoreAuth(response) {
20
20
  let store;
21
21
  try {
22
- store = (await import('./auth.svelte-IWSWWF6U.js')).authStore;
22
+ store = (await import('./auth.svelte-CPTJUC3O.js')).authStore;
23
23
  } catch {
24
24
  return;
25
25
  }
@@ -1,5 +1,5 @@
1
- import { InvalidAuthResponseError, bumpSessionGeneration, authApi } from './chunk-7SFVHDFP.js';
2
- import { onAccessSubjectChange, isInitialized, getConfig, isValidSSOLogoutUrl, hasRole, hasAnyRole, hasAllRoles, effectiveSubject, reportDecision, decodeJWT, getStorage, getDefaultStorage } from './chunk-EFS272S3.js';
1
+ import { InvalidAuthResponseError, bumpSessionGeneration, authApi } from './chunk-4Q3R4TTI.js';
2
+ import { onAccessSubjectChange, isInitialized, getConfig, isValidSSOLogoutUrl, hasRole, hasAnyRole, hasAllRoles, effectiveSubject, reportDecision, decodeJWT, getStorage, getDefaultStorage } from './chunk-TANYGU4O.js';
3
3
 
4
4
  // src/svelte/stores/auth.svelte.ts
5
5
  var STORAGE_VERSION = 2;
@@ -1,6 +1,6 @@
1
- import { authService } from './chunk-BGQVBSXN.js';
2
- import { authStore, currentUser, isAuthenticated, authActions } from './chunk-Q4Q3CJVC.js';
3
- import { evaluateAccess, effectiveSubject, isAccessProbeActive, reportDecision, isInitialized, initAuth } from './chunk-EFS272S3.js';
1
+ import { authService } from './chunk-GAN4LIB2.js';
2
+ import { authStore, currentUser, isAuthenticated, authActions } from './chunk-HWV4ZEZM.js';
3
+ import { evaluateAccess, effectiveSubject, isAccessProbeActive, reportDecision, isInitialized, initAuth } from './chunk-TANYGU4O.js';
4
4
 
5
5
  // src/svelte/guards/auth-guard.ts
6
6
  function checkAuth(options = {}) {
@@ -332,6 +332,8 @@ var ROLE_NAMES = [
332
332
  "warranty_staff",
333
333
  "hotsheet_editor",
334
334
  "office_admin",
335
+ "area_manager",
336
+ "project_manager",
335
337
  "employee",
336
338
  "user",
337
339
  "vendor",
@@ -347,7 +349,7 @@ var ROLE_HIERARCHY = {
347
349
  subcontractor: 1,
348
350
  // Staff tier (2): the read-only `employee` floor, the field-app clones of
349
351
  // `agent`, every `<department>_staff` docs role, `hotsheet_editor` and
350
- // `office_admin`.
352
+ // `office_admin`, `area_manager`, `project_manager`.
351
353
  employee: 2,
352
354
  agent: 2,
353
355
  builder: 2,
@@ -369,6 +371,8 @@ var ROLE_HIERARCHY = {
369
371
  warranty_staff: 2,
370
372
  hotsheet_editor: 2,
371
373
  office_admin: 2,
374
+ area_manager: 2,
375
+ project_manager: 2,
372
376
  manager: 3,
373
377
  admin: 4
374
378
  };
@@ -616,7 +616,9 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
616
616
  * `hotsheet_editor` is a grant-on-top role for the Hotsheet hub's write
617
617
  * surface; `office_admin` is a grant-on-top role for the office
618
618
  * administrative assistant (home closing & financing fields, permits, walks,
619
- * lenders); `employee` is the read-only base staff
619
+ * lenders); `area_manager` / `project_manager` are grant-on-top roles for
620
+ * the construction managers who sign up to attend walks (one person may hold
621
+ * both); `employee` is the read-only base staff
620
622
  * floor (default for Authentik SSO); `vendor`/`customer`/`subcontractor` are
621
623
  * clones of `user`, row-scoped to their own homes.
622
624
  *
@@ -624,7 +626,7 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
624
626
  * field app's clone of `agent`, the second is that department's docs role.
625
627
  * Someone on the stormwater team who also reads the docs holds both.
626
628
  */
627
- 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", "office_admin", "employee", "user", "vendor", "customer", "subcontractor", "guest"];
629
+ 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", "office_admin", "area_manager", "project_manager", "employee", "user", "vendor", "customer", "subcontractor", "guest"];
628
630
  /**
629
631
  * A known role name.
630
632
  *
@@ -1,3 +1,3 @@
1
- export { AuthService, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse } from '../chunk-BGQVBSXN.js';
2
- export { ApiError, InvalidAuthResponseError, MFAChallengeEmailError, RoleDeniedError, SSO_CLIENT_STATE_PARAM, SSO_CLIENT_STATE_TTL_MS, SessionChangedError, api, apiRequest, authApi, clearStoredAuth, consumeSsoClientState, createSsoClientState, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, isApiError, isRoleDeniedError, isSessionChangedError, refreshSession, updateStoredTokens, verifySsoClientState } from '../chunk-7SFVHDFP.js';
3
- export { ACCESS_DEBUG_HEADER, ACCESS_REDACTED_HEADER, ACCESS_REDACTED_TRUNCATED_HEADER, ROLE_HIERARCHY, ROLE_NAMES, clearAccessSubject, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, effectiveSubject, evaluateAccess, extractClaims, getAccessSubjectOverride, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isAccessProbeActive, isInitialized, isTokenExpired, onAccessSubjectChange, parseRedactedHeader, reportAccess, reportDecision, requirementFromDenial, resetConfig, setAccessProbe, setAccessSubject } from '../chunk-EFS272S3.js';
1
+ export { AuthService, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse } from '../chunk-GAN4LIB2.js';
2
+ export { ApiError, InvalidAuthResponseError, MFAChallengeEmailError, RoleDeniedError, SSO_CLIENT_STATE_PARAM, SSO_CLIENT_STATE_TTL_MS, SessionChangedError, api, apiRequest, authApi, clearStoredAuth, consumeSsoClientState, createSsoClientState, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, isApiError, isRoleDeniedError, isSessionChangedError, refreshSession, updateStoredTokens, verifySsoClientState } from '../chunk-4Q3R4TTI.js';
3
+ export { ACCESS_DEBUG_HEADER, ACCESS_REDACTED_HEADER, ACCESS_REDACTED_TRUNCATED_HEADER, ROLE_HIERARCHY, ROLE_NAMES, clearAccessSubject, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, effectiveSubject, evaluateAccess, extractClaims, getAccessSubjectOverride, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isAccessProbeActive, isInitialized, isTokenExpired, onAccessSubjectChange, parseRedactedHeader, reportAccess, reportDecision, requirementFromDenial, resetConfig, setAccessProbe, setAccessSubject } from '../chunk-TANYGU4O.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-TJRFP24M.js';
2
- export { AuthService, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse } from './chunk-BGQVBSXN.js';
3
- export { authActions, authStore, currentUser, isAuthenticated } from './chunk-Q4Q3CJVC.js';
4
- export { ApiError, InvalidAuthResponseError, MFAChallengeEmailError, RoleDeniedError, SSO_CLIENT_STATE_PARAM, SSO_CLIENT_STATE_TTL_MS, SessionChangedError, api, apiRequest, authApi, clearStoredAuth, consumeSsoClientState, createSsoClientState, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, isApiError, isRoleDeniedError, isSessionChangedError, refreshSession, updateStoredTokens, verifySsoClientState } from './chunk-7SFVHDFP.js';
5
- export { ACCESS_DEBUG_HEADER, ACCESS_REDACTED_HEADER, ACCESS_REDACTED_TRUNCATED_HEADER, ROLE_HIERARCHY, ROLE_NAMES, clearAccessSubject, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, effectiveSubject, evaluateAccess, extractClaims, getAccessSubjectOverride, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isAccessProbeActive, isInitialized, isTokenExpired, onAccessSubjectChange, parseRedactedHeader, reportAccess, reportDecision, requirementFromDenial, resetConfig, setAccessProbe, setAccessSubject } from './chunk-EFS272S3.js';
1
+ export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from './chunk-NRVZY2B3.js';
2
+ export { AuthService, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse } from './chunk-GAN4LIB2.js';
3
+ export { authActions, authStore, currentUser, isAuthenticated } from './chunk-HWV4ZEZM.js';
4
+ export { ApiError, InvalidAuthResponseError, MFAChallengeEmailError, RoleDeniedError, SSO_CLIENT_STATE_PARAM, SSO_CLIENT_STATE_TTL_MS, SessionChangedError, api, apiRequest, authApi, clearStoredAuth, consumeSsoClientState, createSsoClientState, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, isApiError, isRoleDeniedError, isSessionChangedError, refreshSession, updateStoredTokens, verifySsoClientState } from './chunk-4Q3R4TTI.js';
5
+ export { ACCESS_DEBUG_HEADER, ACCESS_REDACTED_HEADER, ACCESS_REDACTED_TRUNCATED_HEADER, ROLE_HIERARCHY, ROLE_NAMES, clearAccessSubject, computePrimaryRole, createMemoryStorage, createSessionStorage, decodeJWT, effectiveSubject, evaluateAccess, extractClaims, getAccessSubjectOverride, getConfig, getDefaultStorage, getEffectiveLevel, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, getUserRoles, hasAllRoles, hasAnyRole, hasRole, initAuth, isAccessProbeActive, isInitialized, isTokenExpired, onAccessSubjectChange, parseRedactedHeader, reportAccess, reportDecision, requirementFromDenial, resetConfig, setAccessProbe, setAccessSubject } from './chunk-TANYGU4O.js';
@@ -1,5 +1,5 @@
1
- export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from '../chunk-TJRFP24M.js';
2
- export { formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials } from '../chunk-BGQVBSXN.js';
3
- export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-Q4Q3CJVC.js';
4
- export { InvalidAuthResponseError, RoleDeniedError, SessionChangedError, isRoleDeniedError, isSessionChangedError } from '../chunk-7SFVHDFP.js';
5
- export { initAuth, isInitialized } from '../chunk-EFS272S3.js';
1
+ export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from '../chunk-NRVZY2B3.js';
2
+ export { formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials } from '../chunk-GAN4LIB2.js';
3
+ export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-HWV4ZEZM.js';
4
+ export { InvalidAuthResponseError, RoleDeniedError, SessionChangedError, isRoleDeniedError, isSessionChangedError } from '../chunk-4Q3R4TTI.js';
5
+ export { initAuth, isInitialized } from '../chunk-TANYGU4O.js';
@@ -1,4 +1,4 @@
1
- import { hasRole, hasAnyRole, hasAllRoles, initAuth, resetConfig, getUserRoles, isTokenExpired, decodeJWT } from '../chunk-EFS272S3.js';
1
+ import { hasRole, hasAnyRole, hasAllRoles, initAuth, resetConfig, getUserRoles, isTokenExpired, decodeJWT } from '../chunk-TANYGU4O.js';
2
2
 
3
3
  // src/testing/fixtures/users.ts
4
4
  var mockUser = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/auth",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "description": "Authentication services and Svelte bindings for Classic Theme apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,3 +0,0 @@
1
- export { authActions, authStore, currentUser, isAuthenticated } from './chunk-Q4Q3CJVC.js';
2
- import './chunk-7SFVHDFP.js';
3
- import './chunk-EFS272S3.js';