@classic-homes/auth 1.22.2 → 1.23.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.
- package/dist/auth.svelte-T4LKTTDZ.js +3 -0
- package/dist/{chunk-UJAJO5QJ.js → chunk-2CYGQUUY.js} +4 -1
- package/dist/{chunk-2LRLMSOH.js → chunk-DFCBWKCU.js} +4 -4
- package/dist/{chunk-SUW4DKKS.js → chunk-ETKDIPD2.js} +2 -2
- package/dist/{chunk-LA5DFBWP.js → chunk-KSOYQYUZ.js} +2 -2
- package/dist/{chunk-SY6DG527.js → chunk-NLG6NSE4.js} +3 -3
- package/dist/core/index.d.ts +4 -2
- 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-PT27BLWR.js +0 -3
|
@@ -181,6 +181,7 @@ var ROLE_NAMES = [
|
|
|
181
181
|
"stormwater_staff",
|
|
182
182
|
"warranty_staff",
|
|
183
183
|
"hotsheet_editor",
|
|
184
|
+
"office_admin",
|
|
184
185
|
"employee",
|
|
185
186
|
"user",
|
|
186
187
|
"vendor",
|
|
@@ -195,7 +196,8 @@ var ROLE_HIERARCHY = {
|
|
|
195
196
|
customer: 1,
|
|
196
197
|
subcontractor: 1,
|
|
197
198
|
// Staff tier (2): the read-only `employee` floor, the field-app clones of
|
|
198
|
-
// `agent`, every `<department>_staff` docs role,
|
|
199
|
+
// `agent`, every `<department>_staff` docs role, `hotsheet_editor` and
|
|
200
|
+
// `office_admin`.
|
|
199
201
|
employee: 2,
|
|
200
202
|
agent: 2,
|
|
201
203
|
builder: 2,
|
|
@@ -216,6 +218,7 @@ var ROLE_HIERARCHY = {
|
|
|
216
218
|
stormwater_staff: 2,
|
|
217
219
|
warranty_staff: 2,
|
|
218
220
|
hotsheet_editor: 2,
|
|
221
|
+
office_admin: 2,
|
|
219
222
|
manager: 3,
|
|
220
223
|
admin: 4
|
|
221
224
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { authApi } from './chunk-
|
|
2
|
-
import { getUserRoles, hasAnyRole } from './chunk-
|
|
1
|
+
import { authApi } from './chunk-ETKDIPD2.js';
|
|
2
|
+
import { getUserRoles, hasAnyRole } from './chunk-2CYGQUUY.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-T4LKTTDZ.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-T4LKTTDZ.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-
|
|
1
|
+
import { getConfig, getStorage, isTokenExpired, getFetch, isValidRedirectUrl } from './chunk-2CYGQUUY.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-T4LKTTDZ.js');
|
|
62
62
|
apply(authStore);
|
|
63
63
|
} catch {
|
|
64
64
|
}
|
|
@@ -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-ETKDIPD2.js';
|
|
2
|
+
import { isInitialized, getConfig, hasRole, hasAnyRole, hasAllRoles, decodeJWT, getStorage, getDefaultStorage } from './chunk-2CYGQUUY.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-
|
|
2
|
-
import { authStore, currentUser, isAuthenticated, authActions } from './chunk-
|
|
3
|
-
import { isInitialized, initAuth, getUserRoles } from './chunk-
|
|
1
|
+
import { authService } from './chunk-DFCBWKCU.js';
|
|
2
|
+
import { authStore, currentUser, isAuthenticated, authActions } from './chunk-KSOYQYUZ.js';
|
|
3
|
+
import { isInitialized, initAuth, getUserRoles } from './chunk-2CYGQUUY.js';
|
|
4
4
|
|
|
5
5
|
// src/svelte/guards/auth-guard.ts
|
|
6
6
|
function checkAuth(options = {}) {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -532,7 +532,9 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
|
|
|
532
532
|
* `<department>_staff` roles are grant-on-top docs roles held alongside another
|
|
533
533
|
* role, one per department the API lists in `DEPARTMENT_SCOPES`;
|
|
534
534
|
* `hotsheet_editor` is a grant-on-top role for the Hotsheet hub's write
|
|
535
|
-
* surface; `
|
|
535
|
+
* surface; `office_admin` is a grant-on-top role for the office
|
|
536
|
+
* administrative assistant (home closing & financing fields, permits, walks,
|
|
537
|
+
* lenders); `employee` is the read-only base staff
|
|
536
538
|
* floor (default for Authentik SSO); `vendor`/`customer`/`subcontractor` are
|
|
537
539
|
* clones of `user`, row-scoped to their own homes.
|
|
538
540
|
*
|
|
@@ -540,7 +542,7 @@ declare function extractClaims<T extends string>(token: string, claims: T[]): Pi
|
|
|
540
542
|
* field app's clone of `agent`, the second is that department's docs role.
|
|
541
543
|
* Someone on the stormwater team who also reads the docs holds both.
|
|
542
544
|
*/
|
|
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"];
|
|
545
|
+
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"];
|
|
544
546
|
/**
|
|
545
547
|
* A known role name.
|
|
546
548
|
*
|
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-DFCBWKCU.js';
|
|
2
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from '../chunk-ETKDIPD2.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-2CYGQUUY.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-NLG6NSE4.js';
|
|
2
|
+
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-DFCBWKCU.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from './chunk-KSOYQYUZ.js';
|
|
4
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, initCrossTabSync, refreshSession, updateStoredTokens } from './chunk-ETKDIPD2.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-2CYGQUUY.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-NLG6NSE4.js';
|
|
2
|
+
export { RoleDeniedError, formatUserRoles, getAvatarFallback, getDisplayName, getGreeting, getUserEmail, getUserInitials, isRoleDeniedError } from '../chunk-DFCBWKCU.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from '../chunk-KSOYQYUZ.js';
|
|
4
|
+
import '../chunk-ETKDIPD2.js';
|
|
5
|
+
export { initAuth, isInitialized } from '../chunk-2CYGQUUY.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-2CYGQUUY.js';
|
|
2
2
|
|
|
3
3
|
// src/testing/fixtures/users.ts
|
|
4
4
|
var mockUser = {
|
package/package.json
CHANGED