@classic-homes/auth 1.9.0 → 1.14.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-XWJ54R6J.js';
2
+ import './chunk-4SLNFY2N.js';
3
+ import './chunk-PYCXNOMA.js';
@@ -1,5 +1,5 @@
1
- import { authApi } from './chunk-S4Y4XXDN.js';
2
- import { getUserRoles, hasAnyRole } from './chunk-X7KH4DDN.js';
1
+ import { authApi } from './chunk-4SLNFY2N.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-P5ICPWBD.js');
62
+ const { authStore } = await import('./auth.svelte-AIRJEWTG.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-P5ICPWBD.js');
248
+ const { authStore } = await import('./auth.svelte-AIRJEWTG.js');
249
249
  authStore.setAuth(
250
250
  response.accessToken,
251
251
  response.refreshToken,
@@ -1,4 +1,4 @@
1
- import { getConfig, getStorage, isTokenExpired, getFetch, isValidRedirectUrl } from './chunk-X7KH4DDN.js';
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-P5ICPWBD.js');
61
+ const { authStore } = await import('./auth.svelte-AIRJEWTG.js');
62
62
  apply(authStore);
63
63
  } catch {
64
64
  }
@@ -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`, and every `<department>_staff` docs role.
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,6 +1,6 @@
1
- import { authService } from './chunk-ZWCIY6MG.js';
2
- import { authStore, currentUser, isAuthenticated, authActions } from './chunk-OCIQI3ZZ.js';
3
- import { isInitialized, initAuth, getUserRoles } from './chunk-X7KH4DDN.js';
1
+ import { authService } from './chunk-2IEYKV42.js';
2
+ import { authStore, currentUser, isAuthenticated, authActions } from './chunk-XWJ54R6J.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 = {}) {
@@ -1,5 +1,5 @@
1
- import { authApi } from './chunk-S4Y4XXDN.js';
2
- import { isInitialized, getConfig, hasRole, hasAnyRole, hasAllRoles, decodeJWT, getStorage, getDefaultStorage } from './chunk-X7KH4DDN.js';
1
+ import { authApi } from './chunk-4SLNFY2N.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;
@@ -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`/`demo`/
531
- * `stormwater` are staff-tier clones of `agent`; the `<department>_staff` roles
532
- * are grant-on-top docs roles held alongside another role, one per department
533
- * the API lists in `DEPARTMENT_SCOPES`; `employee` is the read-only base staff
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
  *
@@ -1,3 +1,3 @@
1
- export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from '../chunk-ZWCIY6MG.js';
2
- export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from '../chunk-S4Y4XXDN.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';
1
+ export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from '../chunk-2IEYKV42.js';
2
+ export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from '../chunk-4SLNFY2N.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-AVSOQVSW.js';
2
- export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-ZWCIY6MG.js';
3
- export { authActions, authStore, currentUser, isAuthenticated } from './chunk-OCIQI3ZZ.js';
4
- export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from './chunk-S4Y4XXDN.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';
1
+ export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from './chunk-VLDCDFEN.js';
2
+ export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-2IEYKV42.js';
3
+ export { authActions, authStore, currentUser, isAuthenticated } from './chunk-XWJ54R6J.js';
4
+ export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from './chunk-4SLNFY2N.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';
@@ -1,5 +1,5 @@
1
- export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from '../chunk-AVSOQVSW.js';
2
- export { RoleDeniedError, formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials, isRoleDeniedError } from '../chunk-ZWCIY6MG.js';
3
- export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-OCIQI3ZZ.js';
4
- import '../chunk-S4Y4XXDN.js';
5
- export { initAuth, isInitialized } from '../chunk-X7KH4DDN.js';
1
+ export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from '../chunk-VLDCDFEN.js';
2
+ export { RoleDeniedError, formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials, isRoleDeniedError } from '../chunk-2IEYKV42.js';
3
+ export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-XWJ54R6J.js';
4
+ import '../chunk-4SLNFY2N.js';
5
+ export { initAuth, isInitialized } from '../chunk-PYCXNOMA.js';
@@ -1,4 +1,4 @@
1
- import { hasRole, hasAnyRole, hasAllRoles, initAuth, resetConfig, getUserRoles, isTokenExpired, decodeJWT } from '../chunk-X7KH4DDN.js';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/auth",
3
- "version": "1.9.0",
3
+ "version": "1.14.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-OCIQI3ZZ.js';
2
- import './chunk-S4Y4XXDN.js';
3
- import './chunk-X7KH4DDN.js';