@jmruthers/pace-core 0.5.108 → 0.5.109
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/CHANGELOG.md +75 -177
- package/dist/{AuthService-1D2ifNfa.d.ts → AuthService-DrHrvXNZ.d.ts} +8 -1
- package/dist/{DataTable-WFCHVWTY.js → DataTable-5HITILXS.js} +7 -7
- package/dist/{UnifiedAuthProvider-XU4BHFXZ.js → UnifiedAuthProvider-A7I23UCN.js} +3 -3
- package/dist/{api-KG4A2X7P.js → api-5I3E47G2.js} +2 -2
- package/dist/{chunk-DMNMZKWS.js → chunk-2W4WKJVF.js} +4 -4
- package/dist/{chunk-MOMYOQMC.js → chunk-3TKTL5AZ.js} +13 -13
- package/dist/{chunk-X4FRXJV6.js → chunk-AUXS7XSO.js} +57 -6
- package/dist/{chunk-X4FRXJV6.js.map → chunk-AUXS7XSO.js.map} +1 -1
- package/dist/{chunk-LT6RKRA7.js → chunk-D6MEKC27.js} +2 -2
- package/dist/{chunk-KBG34SVL.js → chunk-EYSXQ756.js} +2 -2
- package/dist/{chunk-ZXY5NTJB.js → chunk-EZ64QG2I.js} +2 -2
- package/dist/{chunk-S63MFSY6.js → chunk-F6TSYCKP.js} +4 -2
- package/dist/{chunk-S63MFSY6.js.map → chunk-F6TSYCKP.js.map} +1 -1
- package/dist/chunk-GZRXOUBE.js +176 -0
- package/dist/chunk-GZRXOUBE.js.map +1 -0
- package/dist/{chunk-B3QX32P5.js → chunk-P72NKAT5.js} +41 -24
- package/dist/chunk-P72NKAT5.js.map +1 -0
- package/dist/{chunk-VJ7MPS2K.js → chunk-S4D3Z723.js} +6 -6
- package/dist/{chunk-IMZGJ2X7.js → chunk-UW2DE6JX.js} +4 -4
- package/dist/{chunk-QDDUU625.js → chunk-WWNOVFDC.js} +4 -4
- package/dist/{chunk-GVRSXXAA.js → chunk-YFMENCR4.js} +3 -3
- package/dist/components.js +9 -9
- package/dist/{database-BXAfr2Y_.d.ts → database-C6jy7EOu.d.ts} +21 -9
- package/dist/{formatting-BiEv5oEk.d.ts → formatting-B1jSqgl-.d.ts} +16 -1
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +7 -7
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +4 -3
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +1 -1
- package/dist/rbac/index.js +8 -8
- package/dist/types.d.ts +2 -2
- package/dist/{usePublicRouteParams-CnM-IK2I.d.ts → usePublicRouteParams-BdF8bZgs.d.ts} +1 -1
- package/dist/utils.d.ts +2 -15
- package/dist/utils.js +4 -145
- package/dist/utils.js.map +1 -1
- package/dist/validation.d.ts +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +3 -3
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +37 -3
- package/docs/api-reference/hooks.md +53 -0
- package/docs/api-reference/providers.md +60 -0
- package/docs/core-concepts/authentication.md +2 -0
- package/docs/implementation-guides/authentication.md +1 -0
- package/docs/security/README.md +59 -0
- package/package.json +1 -1
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +2 -2
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +48 -16
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +2 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +9 -9
- package/src/index.ts +3 -0
- package/src/providers/services/AuthServiceProvider.tsx +4 -3
- package/src/providers/services/UnifiedAuthProvider.tsx +1 -1
- package/src/rbac/engine.ts +2 -0
- package/src/services/AuthService.ts +79 -1
- package/src/services/__tests__/AuthService.test.ts +184 -0
- package/src/types/database.ts +21 -9
- package/src/types/rbac-functions.ts +2 -1
- package/src/utils/__tests__/sessionTracking.unit.test.ts +6 -171
- package/src/utils/sessionTracking.ts +7 -81
- package/dist/chunk-B3QX32P5.js.map +0 -1
- package/dist/chunk-NFPV7MRN.js +0 -94
- package/dist/chunk-NFPV7MRN.js.map +0 -1
- package/src/providers/AuthProvider.simplified.tsx +0 -974
- package/dist/{DataTable-WFCHVWTY.js.map → DataTable-5HITILXS.js.map} +0 -0
- package/dist/{UnifiedAuthProvider-XU4BHFXZ.js.map → UnifiedAuthProvider-A7I23UCN.js.map} +0 -0
- package/dist/{api-KG4A2X7P.js.map → api-5I3E47G2.js.map} +0 -0
- package/dist/{chunk-DMNMZKWS.js.map → chunk-2W4WKJVF.js.map} +0 -0
- package/dist/{chunk-MOMYOQMC.js.map → chunk-3TKTL5AZ.js.map} +0 -0
- package/dist/{chunk-LT6RKRA7.js.map → chunk-D6MEKC27.js.map} +0 -0
- package/dist/{chunk-KBG34SVL.js.map → chunk-EYSXQ756.js.map} +0 -0
- package/dist/{chunk-ZXY5NTJB.js.map → chunk-EZ64QG2I.js.map} +0 -0
- package/dist/{chunk-VJ7MPS2K.js.map → chunk-S4D3Z723.js.map} +0 -0
- package/dist/{chunk-IMZGJ2X7.js.map → chunk-UW2DE6JX.js.map} +0 -0
- package/dist/{chunk-QDDUU625.js.map → chunk-WWNOVFDC.js.map} +0 -0
- package/dist/{chunk-GVRSXXAA.js.map → chunk-YFMENCR4.js.map} +0 -0
- package/dist/{validation-D8VcbTzC.d.ts → validation-DnhrNMju.d.ts} +2 -2
package/dist/providers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-D6MEKC27.js";
|
|
2
2
|
import {
|
|
3
3
|
AuthServiceContext,
|
|
4
4
|
AuthServiceProvider,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useInactivityService,
|
|
15
15
|
useOrganisationService,
|
|
16
16
|
useUnifiedAuth
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-AUXS7XSO.js";
|
|
18
18
|
import "./chunk-BDZUMRBD.js";
|
|
19
19
|
import "./chunk-SMJZMKYN.js";
|
|
20
20
|
import "./chunk-PLDDJCW6.js";
|
package/dist/rbac/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
-
import { D as Database } from '../database-
|
|
2
|
+
import { D as Database } from '../database-C6jy7EOu.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import React__default, { ReactNode } from 'react';
|
|
5
5
|
|
package/dist/rbac/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
withAccessLevelGuard,
|
|
31
31
|
withPermissionGuard,
|
|
32
32
|
withRoleGuard
|
|
33
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-3TKTL5AZ.js";
|
|
34
34
|
import {
|
|
35
35
|
useAccessLevel,
|
|
36
36
|
useCachedPermissions,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
usePermissions,
|
|
42
42
|
useRBAC,
|
|
43
43
|
useResolvedScope
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-WWNOVFDC.js";
|
|
45
45
|
import {
|
|
46
46
|
CACHE_PATTERNS,
|
|
47
47
|
RBACCache,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
rbacCache,
|
|
64
64
|
resolveAppContext,
|
|
65
65
|
setupRBAC
|
|
66
|
-
} from "../chunk-
|
|
66
|
+
} from "../chunk-F6TSYCKP.js";
|
|
67
67
|
import {
|
|
68
68
|
RBACAuditManager,
|
|
69
69
|
createAuditManager,
|
|
@@ -71,11 +71,11 @@ import {
|
|
|
71
71
|
getGlobalAuditManager,
|
|
72
72
|
setGlobalAuditManager
|
|
73
73
|
} from "../chunk-Q7APDV6H.js";
|
|
74
|
-
import "../chunk-
|
|
75
|
-
import "../chunk-
|
|
76
|
-
import "../chunk-
|
|
77
|
-
import "../chunk-
|
|
78
|
-
import "../chunk-
|
|
74
|
+
import "../chunk-YFMENCR4.js";
|
|
75
|
+
import "../chunk-EZ64QG2I.js";
|
|
76
|
+
import "../chunk-EYSXQ756.js";
|
|
77
|
+
import "../chunk-D6MEKC27.js";
|
|
78
|
+
import "../chunk-AUXS7XSO.js";
|
|
79
79
|
import "../chunk-JCQZ6LA7.js";
|
|
80
80
|
import "../chunk-BDZUMRBD.js";
|
|
81
81
|
import "../chunk-SMJZMKYN.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { U as User, S as Session, A as AuthError, a as UserPermissions, P as PermissionError, b as PermissionString, c as AccessLevel, d as AuthErrorCode } from './unified-DQ4VcT7H.js';
|
|
2
2
|
export { D as DataRecord, t as DataTableAction, u as DataTableColumn, E as Event, s as EventContextType, r as EventTheme, q as PermissionContext, e as PermissionErrorCode, p as PermissionMap, R as RequestId, g as SessionToken, T as ThemeColors, f as UserId, j as createPermissionString, k as createRequestId, i as createSessionToken, h as createUserId, n as isPermissionString, o as isRequestId, m as isSessionToken, l as isUserId } from './unified-DQ4VcT7H.js';
|
|
3
3
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
4
|
-
export { D as Database } from './database-
|
|
5
|
-
export { C as ChangePasswordFormValues, t as ContactFormData, F as FormData, m as LoginFormData, L as LoginFormValues, P as PasswordResetFormValues, q as ProfileFormData, o as RegistrationFormData, R as RegistrationFormValues, S as SecureLoginFormValues, k as SecurePasswordResetFormValues, j as SecureRegistrationFormValues, U as UserProfileFormValues, V as ValidationError, a as ValidationResult, g as changePasswordSchema, w as combineSchemas, i as contactFormSchema, d as dateSchema, e as emailSchema, l as loginSchema, n as nameSchema, f as passwordResetSchema, b as passwordSchema, p as phoneSchema, v as pickSchema, r as registrationSchema, c as secureLoginSchema, s as securePasswordSchema, u as urlSchema, h as userProfileSchema } from './validation-
|
|
4
|
+
export { D as Database } from './database-C6jy7EOu.js';
|
|
5
|
+
export { C as ChangePasswordFormValues, t as ContactFormData, F as FormData, m as LoginFormData, L as LoginFormValues, P as PasswordResetFormValues, q as ProfileFormData, o as RegistrationFormData, R as RegistrationFormValues, S as SecureLoginFormValues, k as SecurePasswordResetFormValues, j as SecureRegistrationFormValues, U as UserProfileFormValues, V as ValidationError, a as ValidationResult, g as changePasswordSchema, w as combineSchemas, i as contactFormSchema, d as dateSchema, e as emailSchema, l as loginSchema, n as nameSchema, f as passwordResetSchema, b as passwordSchema, p as phoneSchema, v as pickSchema, r as registrationSchema, c as secureLoginSchema, s as securePasswordSchema, u as urlSchema, h as userProfileSchema } from './validation-DnhrNMju.js';
|
|
6
6
|
export { S as SessionRestorationState } from './auth-DReDSLq9.js';
|
|
7
7
|
export { g as BucketInfo, B as BulkUploadResult, b as FileCategory, a as FileMetadata, F as FileReference, d as FileReferenceService, f as FileReferenceWithUrl, c as FileUploadOptions, e as FileUploadResult, h as FileUrlInfo, S as StorageUploadOptions, U as UploadProgress } from './file-reference-C9isKNPn.js';
|
|
8
8
|
import 'zod';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as OrganisationRole, c as OrganisationPermission, S as SuperAdminContext } from './organisation-D6qRDtbF.js';
|
|
2
2
|
import { E as Event } from './unified-DQ4VcT7H.js';
|
|
3
3
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
4
|
-
import { D as Database } from './database-
|
|
4
|
+
import { D as Database } from './database-C6jy7EOu.js';
|
|
5
5
|
import { b as FileCategory, F as FileReference } from './file-reference-C9isKNPn.js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppConfig, S as SecureDataAccess, a as cn, j as formatCompactNumber, e as formatCurrency, f as formatDate, k as formatFileSize, h as formatNumber, i as formatPercent, g as getAppConfig, d as getCurrentAppId, b as getCurrentAppName, s as setAppConfig } from './formatting-
|
|
1
|
+
export { A as AppConfig, S as SecureDataAccess, a as cn, j as formatCompactNumber, e as formatCurrency, f as formatDate, k as formatFileSize, h as formatNumber, i as formatPercent, g as getAppConfig, d as getCurrentAppId, b as getCurrentAppName, s as setAppConfig, u as useSessionTracking } from './formatting-B1jSqgl-.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export { u as useComponentPerformance } from './useComponentPerformance-DE9l5RkL.js';
|
|
4
4
|
import * as date_fns from 'date-fns';
|
|
@@ -478,19 +478,6 @@ declare class SecurityMonitor {
|
|
|
478
478
|
}
|
|
479
479
|
declare const securityMonitor: SecurityMonitor;
|
|
480
480
|
|
|
481
|
-
/**
|
|
482
|
-
* Hook for tracking user sessions and event interactions using the new RBAC system
|
|
483
|
-
* @param supabaseClient - Supabase client instance
|
|
484
|
-
* @param appName - Optional application name for tracking
|
|
485
|
-
* @returns Object containing tracking functions
|
|
486
|
-
*/
|
|
487
|
-
declare function useSessionTracking(supabaseClient: SupabaseClient, appName?: string): {
|
|
488
|
-
trackLogin: (eventId?: string) => Promise<void>;
|
|
489
|
-
trackEventSwitch: (eventId: string) => Promise<void>;
|
|
490
|
-
trackLogout: () => Promise<void>;
|
|
491
|
-
trackSessionExpired: () => Promise<void>;
|
|
492
|
-
};
|
|
493
|
-
|
|
494
481
|
/**
|
|
495
482
|
* @file Audit Logger - General Utility
|
|
496
483
|
*
|
|
@@ -610,4 +597,4 @@ declare function getOrganisationContext(supabase: SupabaseClient): Promise<strin
|
|
|
610
597
|
*/
|
|
611
598
|
declare function isOrganisationContextAvailable(supabase: SupabaseClient): Promise<boolean>;
|
|
612
599
|
|
|
613
|
-
export { CSP_DIRECTIVES, DebugLogger, LazyDataTable, PERFORMANCE_BUDGETS, PERFORMANCE_THRESHOLDS, type PerformanceMetrics$1 as PerformanceMetrics, PermissionType, RateLimiter, type SanitizationOptions, type SecurityEvent$1 as SecurityEvent, auditLog, auditLogger, bundleAnalyzer, clearOrganisationContext, combineSchemas, createLazyComponent, createLazyUtility, createPerformanceBenchmark, deepMerge, emailSchema, generateCSPHeader, generateDeviceFingerprint, getAppNameFromBuildTime, getAppNameFromEnvironment, getAppNameFromGlobal, getAppNameFromPackageJson, getCurrentAppNameWithFallback, getOrganisationContext, getSecurityHeaders, hasAllPermissions, hasAnyPermission, hasPermission, isEmpty, isObject, isOrganisationContextAvailable, isStrongPassword, isValidDate, isValidEmail, isValidUrl, isWithinRange, lazyCSVUtils, lazyChartUtils, lazyDateUtils, lazyFormUtils, lazyLodash, loadCSVUtils, loadChartUtils, loadDateUtils, loadFormUtils, loadLodash, logAuditEvent, logAuthEvent, logPermissionEvent, logSecurityEvent, matchesPattern, measureRenderPerformance, nameSchema, parsePermission, passwordSchema, performanceBudgetMonitor, phoneSchema, pickSchema, sanitizeEmail, sanitizeFileName, sanitizeFormData, sanitizePhoneNumber, sanitizeSqlInput, sanitizeUrl, sanitizeUserInput, sanitizeUserInput_deprecated, securityMonitor, setOrganisationContext, setRBACAppName, trackDynamicImport, transformPermissionMapToBoolean, urlSchema,
|
|
600
|
+
export { CSP_DIRECTIVES, DebugLogger, LazyDataTable, PERFORMANCE_BUDGETS, PERFORMANCE_THRESHOLDS, type PerformanceMetrics$1 as PerformanceMetrics, PermissionType, RateLimiter, type SanitizationOptions, type SecurityEvent$1 as SecurityEvent, auditLog, auditLogger, bundleAnalyzer, clearOrganisationContext, combineSchemas, createLazyComponent, createLazyUtility, createPerformanceBenchmark, deepMerge, emailSchema, generateCSPHeader, generateDeviceFingerprint, getAppNameFromBuildTime, getAppNameFromEnvironment, getAppNameFromGlobal, getAppNameFromPackageJson, getCurrentAppNameWithFallback, getOrganisationContext, getSecurityHeaders, hasAllPermissions, hasAnyPermission, hasPermission, isEmpty, isObject, isOrganisationContextAvailable, isStrongPassword, isValidDate, isValidEmail, isValidUrl, isWithinRange, lazyCSVUtils, lazyChartUtils, lazyDateUtils, lazyFormUtils, lazyLodash, loadCSVUtils, loadChartUtils, loadDateUtils, loadFormUtils, loadLodash, logAuditEvent, logAuthEvent, logPermissionEvent, logSecurityEvent, matchesPattern, measureRenderPerformance, nameSchema, parsePermission, passwordSchema, performanceBudgetMonitor, phoneSchema, pickSchema, sanitizeEmail, sanitizeFileName, sanitizeFormData, sanitizePhoneNumber, sanitizeSqlInput, sanitizeUrl, sanitizeUserInput, sanitizeUserInput_deprecated, securityMonitor, setOrganisationContext, setRBACAppName, trackDynamicImport, transformPermissionMapToBoolean, urlSchema, usernameSchema, validateDeviceFingerprint, validateImportPattern, validateSecurityHeaders, validateUserInput };
|
package/dist/utils.js
CHANGED
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
getAppConfig,
|
|
9
9
|
getCurrentAppId,
|
|
10
10
|
getCurrentAppName,
|
|
11
|
-
setAppConfig
|
|
12
|
-
|
|
11
|
+
setAppConfig,
|
|
12
|
+
useSessionTracking
|
|
13
|
+
} from "./chunk-GZRXOUBE.js";
|
|
13
14
|
import {
|
|
14
15
|
LoadingSpinner
|
|
15
16
|
} from "./chunk-CDQ3PX7L.js";
|
|
@@ -594,7 +595,7 @@ function createLazyComponent(importFn, componentName, options = {}) {
|
|
|
594
595
|
return WrappedComponent;
|
|
595
596
|
}
|
|
596
597
|
var LazyDataTable = createLazyComponent(
|
|
597
|
-
() => import("./DataTable-
|
|
598
|
+
() => import("./DataTable-5HITILXS.js").then((module) => ({ default: module.DataTable })),
|
|
598
599
|
"DataTable"
|
|
599
600
|
);
|
|
600
601
|
|
|
@@ -694,148 +695,6 @@ var SecurityMonitor = class {
|
|
|
694
695
|
};
|
|
695
696
|
var securityMonitor = new SecurityMonitor();
|
|
696
697
|
|
|
697
|
-
// src/utils/sessionTracking.ts
|
|
698
|
-
function useSessionTracking(supabaseClient, appName) {
|
|
699
|
-
const resolveAppId = async () => {
|
|
700
|
-
if (!appName) return void 0;
|
|
701
|
-
try {
|
|
702
|
-
const { data, error } = await supabaseClient.from("rbac_apps").select("id").eq("name", appName).eq("is_active", true).single();
|
|
703
|
-
if (error || !data) {
|
|
704
|
-
console.warn("App not found or inactive:", appName);
|
|
705
|
-
return void 0;
|
|
706
|
-
}
|
|
707
|
-
return data.id;
|
|
708
|
-
} catch (error) {
|
|
709
|
-
console.error("Failed to resolve app ID:", error);
|
|
710
|
-
return void 0;
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
const trackLogin = async (eventId) => {
|
|
714
|
-
try {
|
|
715
|
-
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
716
|
-
if (!user) {
|
|
717
|
-
console.warn("No authenticated user found for session tracking");
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
const appId = await resolveAppId();
|
|
721
|
-
const params = {
|
|
722
|
-
p_session_type: "login",
|
|
723
|
-
p_event_id: eventId,
|
|
724
|
-
p_app_id: appId
|
|
725
|
-
};
|
|
726
|
-
const { error } = await supabaseClient.rpc("rbac_session_track", {
|
|
727
|
-
p_user_id: user?.id,
|
|
728
|
-
p_session_type: params.p_session_type,
|
|
729
|
-
p_event_id: params.p_event_id,
|
|
730
|
-
p_app_id: params.p_app_id,
|
|
731
|
-
p_ip_address: params.ip_address,
|
|
732
|
-
p_user_agent: params.user_agent
|
|
733
|
-
});
|
|
734
|
-
if (error) {
|
|
735
|
-
console.error("Failed to track login session:", error);
|
|
736
|
-
} else {
|
|
737
|
-
console.log("Login session tracked successfully");
|
|
738
|
-
}
|
|
739
|
-
} catch (error) {
|
|
740
|
-
console.error("Failed to track login:", error);
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
const trackEventSwitch = async (eventId) => {
|
|
744
|
-
try {
|
|
745
|
-
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
746
|
-
if (!user) {
|
|
747
|
-
console.warn("No authenticated user found for session tracking");
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
const appId = await resolveAppId();
|
|
751
|
-
const params = {
|
|
752
|
-
p_session_type: "event_switch",
|
|
753
|
-
p_event_id: eventId,
|
|
754
|
-
p_app_id: appId
|
|
755
|
-
};
|
|
756
|
-
const { error } = await supabaseClient.rpc("rbac_session_track", {
|
|
757
|
-
p_user_id: user?.id,
|
|
758
|
-
p_session_type: params.p_session_type,
|
|
759
|
-
p_event_id: params.p_event_id,
|
|
760
|
-
p_app_id: params.p_app_id,
|
|
761
|
-
p_ip_address: params.ip_address,
|
|
762
|
-
p_user_agent: params.user_agent
|
|
763
|
-
});
|
|
764
|
-
if (error) {
|
|
765
|
-
console.error("Failed to track event switch session:", error);
|
|
766
|
-
} else {
|
|
767
|
-
console.log("Event switch session tracked successfully");
|
|
768
|
-
}
|
|
769
|
-
} catch (error) {
|
|
770
|
-
console.error("Failed to track event switch:", error);
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
const trackLogout = async () => {
|
|
774
|
-
try {
|
|
775
|
-
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
776
|
-
if (!user) {
|
|
777
|
-
console.warn("No authenticated user found for session tracking");
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
const appId = await resolveAppId();
|
|
781
|
-
const params = {
|
|
782
|
-
p_session_type: "logout",
|
|
783
|
-
p_app_id: appId
|
|
784
|
-
};
|
|
785
|
-
const { error } = await supabaseClient.rpc("rbac_session_track", {
|
|
786
|
-
p_user_id: user?.id,
|
|
787
|
-
p_session_type: params.p_session_type,
|
|
788
|
-
p_event_id: params.p_event_id,
|
|
789
|
-
p_app_id: params.p_app_id,
|
|
790
|
-
p_ip_address: params.ip_address,
|
|
791
|
-
p_user_agent: params.user_agent
|
|
792
|
-
});
|
|
793
|
-
if (error) {
|
|
794
|
-
console.error("Failed to track logout session:", error);
|
|
795
|
-
} else {
|
|
796
|
-
console.log("Logout session tracked successfully");
|
|
797
|
-
}
|
|
798
|
-
} catch (error) {
|
|
799
|
-
console.error("Failed to track logout:", error);
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
const trackSessionExpired = async () => {
|
|
803
|
-
try {
|
|
804
|
-
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
805
|
-
if (!user) {
|
|
806
|
-
console.warn("No authenticated user found for session tracking");
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
const appId = await resolveAppId();
|
|
810
|
-
const params = {
|
|
811
|
-
p_session_type: "session_expired",
|
|
812
|
-
p_app_id: appId
|
|
813
|
-
};
|
|
814
|
-
const { error } = await supabaseClient.rpc("rbac_session_track", {
|
|
815
|
-
p_user_id: user?.id,
|
|
816
|
-
p_session_type: params.p_session_type,
|
|
817
|
-
p_event_id: params.p_event_id,
|
|
818
|
-
p_app_id: params.p_app_id,
|
|
819
|
-
p_ip_address: params.ip_address,
|
|
820
|
-
p_user_agent: params.user_agent
|
|
821
|
-
});
|
|
822
|
-
if (error) {
|
|
823
|
-
console.error("Failed to track session expiration:", error);
|
|
824
|
-
} else {
|
|
825
|
-
console.log("Session expiration tracked successfully");
|
|
826
|
-
}
|
|
827
|
-
} catch (error) {
|
|
828
|
-
console.error("Failed to track session expiration:", error);
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
return {
|
|
832
|
-
trackLogin,
|
|
833
|
-
trackEventSwitch,
|
|
834
|
-
trackLogout,
|
|
835
|
-
trackSessionExpired
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
|
|
839
698
|
// src/utils/audit.ts
|
|
840
699
|
var AuditLogger = class {
|
|
841
700
|
constructor() {
|