@jmruthers/pace-core 0.5.108 → 0.5.110
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 +93 -173
- package/dist/{AuthService-1D2ifNfa.d.ts → AuthService-DrHrvXNZ.d.ts} +8 -1
- package/dist/{DataTable-WFCHVWTY.js → DataTable-D3BK2FCN.js} +7 -7
- package/dist/{UnifiedAuthProvider-XU4BHFXZ.js → UnifiedAuthProvider-A7I23UCN.js} +3 -3
- package/dist/{api-KG4A2X7P.js → api-PIE4JRFS.js} +2 -2
- package/dist/{chunk-DMNMZKWS.js → chunk-2W4WKJVF.js} +4 -4
- package/dist/{chunk-B3QX32P5.js → chunk-3J5N2T2N.js} +85 -28
- package/dist/chunk-3J5N2T2N.js.map +1 -0
- package/dist/{chunk-MOMYOQMC.js → chunk-7GBEBJLR.js} +29 -37
- package/dist/chunk-7GBEBJLR.js.map +1 -0
- 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-VJ7MPS2K.js → chunk-AWK2FAUN.js} +6 -6
- 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-GZRXOUBE.js +176 -0
- package/dist/chunk-GZRXOUBE.js.map +1 -0
- package/dist/{chunk-QDDUU625.js → chunk-HADXAZT3.js} +4 -4
- package/dist/{chunk-IMZGJ2X7.js → chunk-HGZSO43Y.js} +4 -4
- package/dist/{chunk-S63MFSY6.js → chunk-XRSP3H52.js} +15 -8
- package/dist/chunk-XRSP3H52.js.map +1 -0
- 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 +35 -23
- 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 +9 -8
- 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 +19 -8
- package/docs/api/interfaces/RBACLogger.md +5 -5
- 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 +55 -20
- 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/documentation-index.md +0 -2
- package/docs/implementation-guides/authentication.md +1 -0
- package/docs/rbac/README.md +114 -38
- package/docs/rbac/api-reference.md +63 -16
- package/docs/rbac/getting-started.md +16 -16
- package/docs/rbac/quick-start.md +110 -35
- package/docs/rbac/troubleshooting.md +125 -2
- package/docs/security/README.md +59 -0
- package/package.json +1 -1
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +38 -4
- package/src/components/NavigationMenu/NavigationMenu.tsx +71 -6
- 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/api.test.ts +2 -2
- package/src/rbac/api.ts +2 -1
- package/src/rbac/components/PagePermissionGuard.tsx +21 -38
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +1 -1
- package/src/rbac/config.ts +2 -0
- package/src/rbac/engine.ts +17 -5
- package/src/rbac/security.ts +1 -1
- 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-MOMYOQMC.js.map +0 -1
- package/dist/chunk-NFPV7MRN.js +0 -94
- package/dist/chunk-NFPV7MRN.js.map +0 -1
- package/dist/chunk-S63MFSY6.js.map +0 -1
- package/docs/rbac/breaking-changes-v3.md +0 -222
- package/docs/rbac/migration-guide.md +0 -260
- package/src/providers/AuthProvider.simplified.tsx +0 -974
- package/dist/{DataTable-WFCHVWTY.js.map → DataTable-D3BK2FCN.js.map} +0 -0
- package/dist/{UnifiedAuthProvider-XU4BHFXZ.js.map → UnifiedAuthProvider-A7I23UCN.js.map} +0 -0
- package/dist/{api-KG4A2X7P.js.map → api-PIE4JRFS.js.map} +0 -0
- package/dist/{chunk-DMNMZKWS.js.map → chunk-2W4WKJVF.js.map} +0 -0
- package/dist/{chunk-VJ7MPS2K.js.map → chunk-AWK2FAUN.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-QDDUU625.js.map → chunk-HADXAZT3.js.map} +0 -0
- package/dist/{chunk-IMZGJ2X7.js.map → chunk-HGZSO43Y.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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_OrganisationProvider,
|
|
3
3
|
usePublicPageContext
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2W4WKJVF.js";
|
|
5
5
|
import {
|
|
6
6
|
init_useOrganisations,
|
|
7
7
|
useEvents,
|
|
8
8
|
useOrganisations
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EZ64QG2I.js";
|
|
10
10
|
import {
|
|
11
11
|
useUnifiedAuth
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AUXS7XSO.js";
|
|
13
13
|
import {
|
|
14
14
|
applyPalette,
|
|
15
15
|
clearPalette,
|
|
@@ -96,7 +96,7 @@ var useOrganisationSecurity = () => {
|
|
|
96
96
|
const targetOrgId = orgId || selectedOrganisation?.id;
|
|
97
97
|
if (!targetOrgId || !user) return false;
|
|
98
98
|
try {
|
|
99
|
-
const { isPermitted } = await import("./api-
|
|
99
|
+
const { isPermitted } = await import("./api-PIE4JRFS.js");
|
|
100
100
|
const scope = {
|
|
101
101
|
organisationId: targetOrgId,
|
|
102
102
|
eventId: user.user_metadata?.eventId || user.app_metadata?.eventId,
|
|
@@ -119,7 +119,7 @@ var useOrganisationSecurity = () => {
|
|
|
119
119
|
const targetOrgId = orgId || selectedOrganisation?.id;
|
|
120
120
|
if (!targetOrgId || !user) return [];
|
|
121
121
|
try {
|
|
122
|
-
const { getPermissionMap } = await import("./api-
|
|
122
|
+
const { getPermissionMap } = await import("./api-PIE4JRFS.js");
|
|
123
123
|
const scope = {
|
|
124
124
|
organisationId: targetOrgId,
|
|
125
125
|
eventId: user.user_metadata?.eventId || user.app_metadata?.eventId,
|
|
@@ -706,4 +706,4 @@ export {
|
|
|
706
706
|
generatePublicRoutePath,
|
|
707
707
|
extractEventCodeFromPath
|
|
708
708
|
};
|
|
709
|
-
//# sourceMappingURL=chunk-
|
|
709
|
+
//# sourceMappingURL=chunk-AWK2FAUN.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
init_InactivityServiceProvider,
|
|
5
5
|
init_OrganisationServiceProvider,
|
|
6
6
|
init_UnifiedAuthProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AUXS7XSO.js";
|
|
8
8
|
|
|
9
9
|
// src/providers/index.ts
|
|
10
10
|
init_UnifiedAuthProvider();
|
|
@@ -12,4 +12,4 @@ init_EventServiceProvider();
|
|
|
12
12
|
init_OrganisationServiceProvider();
|
|
13
13
|
init_InactivityServiceProvider();
|
|
14
14
|
init_AuthServiceProvider();
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-D6MEKC27.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
UnifiedAuthProvider,
|
|
3
3
|
init_UnifiedAuthProvider,
|
|
4
4
|
useUnifiedAuth
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AUXS7XSO.js";
|
|
6
6
|
import {
|
|
7
7
|
__esm,
|
|
8
8
|
__export
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
UnifiedAuthProvider_exports,
|
|
25
25
|
init_UnifiedAuthProvider2 as init_UnifiedAuthProvider
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-EYSXQ756.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
init_useOrganisationService,
|
|
4
4
|
useEventService2 as useEventService,
|
|
5
5
|
useOrganisationService2 as useOrganisationService
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AUXS7XSO.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./chunk-PLDDJCW6.js";
|
|
@@ -57,4 +57,4 @@ export {
|
|
|
57
57
|
init_useOrganisations,
|
|
58
58
|
useEvents
|
|
59
59
|
};
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-EZ64QG2I.js.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// src/utils/sessionTracking.ts
|
|
2
|
+
function useSessionTracking(supabaseClient, appName) {
|
|
3
|
+
const resolveAppId = async () => {
|
|
4
|
+
if (!appName) return void 0;
|
|
5
|
+
try {
|
|
6
|
+
const { data, error } = await supabaseClient.from("rbac_apps").select("id").eq("name", appName).eq("is_active", true).single();
|
|
7
|
+
if (error || !data) {
|
|
8
|
+
console.warn("App not found or inactive:", appName);
|
|
9
|
+
return void 0;
|
|
10
|
+
}
|
|
11
|
+
return data.id;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error("Failed to resolve app ID:", error);
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const trackEventSwitch = async (eventId) => {
|
|
18
|
+
try {
|
|
19
|
+
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
20
|
+
if (!user) {
|
|
21
|
+
console.warn("No authenticated user found for session tracking");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const appId = await resolveAppId();
|
|
25
|
+
const params = {
|
|
26
|
+
p_session_type: "event_switch",
|
|
27
|
+
p_event_id: eventId,
|
|
28
|
+
p_app_id: appId
|
|
29
|
+
};
|
|
30
|
+
const { error } = await supabaseClient.rpc("rbac_session_track", {
|
|
31
|
+
p_user_id: user?.id,
|
|
32
|
+
p_session_type: params.p_session_type,
|
|
33
|
+
p_event_id: params.p_event_id,
|
|
34
|
+
p_app_id: params.p_app_id,
|
|
35
|
+
p_ip_address: params.ip_address,
|
|
36
|
+
p_user_agent: params.user_agent
|
|
37
|
+
});
|
|
38
|
+
if (error) {
|
|
39
|
+
console.error("Failed to track event switch session:", error);
|
|
40
|
+
} else {
|
|
41
|
+
console.log("Event switch session tracked successfully");
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("Failed to track event switch:", error);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const trackSessionExpired = async () => {
|
|
48
|
+
try {
|
|
49
|
+
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
50
|
+
if (!user) {
|
|
51
|
+
console.warn("No authenticated user found for session tracking");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const appId = await resolveAppId();
|
|
55
|
+
const params = {
|
|
56
|
+
p_session_type: "session_expired",
|
|
57
|
+
p_app_id: appId
|
|
58
|
+
};
|
|
59
|
+
const { error } = await supabaseClient.rpc("rbac_session_track", {
|
|
60
|
+
p_user_id: user?.id,
|
|
61
|
+
p_session_type: params.p_session_type,
|
|
62
|
+
p_event_id: params.p_event_id,
|
|
63
|
+
p_app_id: params.p_app_id,
|
|
64
|
+
p_ip_address: params.ip_address,
|
|
65
|
+
p_user_agent: params.user_agent
|
|
66
|
+
});
|
|
67
|
+
if (error) {
|
|
68
|
+
console.error("Failed to track session expiration:", error);
|
|
69
|
+
} else {
|
|
70
|
+
console.log("Session expiration tracked successfully");
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error("Failed to track session expiration:", error);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
trackEventSwitch,
|
|
78
|
+
trackSessionExpired
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/utils/appConfig.ts
|
|
83
|
+
var currentAppConfig = null;
|
|
84
|
+
function setAppConfig(config) {
|
|
85
|
+
currentAppConfig = config;
|
|
86
|
+
}
|
|
87
|
+
function getAppConfig() {
|
|
88
|
+
if (!currentAppConfig) {
|
|
89
|
+
const appName = import.meta.env.REACT_APP_NAME || "PACE";
|
|
90
|
+
return {
|
|
91
|
+
appName,
|
|
92
|
+
appId: appName
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return currentAppConfig;
|
|
96
|
+
}
|
|
97
|
+
function getCurrentAppName() {
|
|
98
|
+
return getAppConfig().appName;
|
|
99
|
+
}
|
|
100
|
+
function getCurrentAppId() {
|
|
101
|
+
return getAppConfig().appId;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/utils/formatting.ts
|
|
105
|
+
function formatDate(date) {
|
|
106
|
+
const dateObj = typeof date === "string" || typeof date === "number" ? new Date(date) : date;
|
|
107
|
+
return dateObj.toLocaleDateString(void 0, {
|
|
108
|
+
year: "numeric",
|
|
109
|
+
month: "short",
|
|
110
|
+
day: "numeric"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function formatCurrency(value, currencyCode = "USD", locale = "en-US") {
|
|
114
|
+
return new Intl.NumberFormat(locale, {
|
|
115
|
+
style: "currency",
|
|
116
|
+
currency: currencyCode
|
|
117
|
+
}).format(value);
|
|
118
|
+
}
|
|
119
|
+
function formatNumber(value, options = {}, locale = "en-US") {
|
|
120
|
+
return new Intl.NumberFormat(locale, options).format(value);
|
|
121
|
+
}
|
|
122
|
+
function formatPercent(value, locale = "en-US", decimalsOrOptions) {
|
|
123
|
+
let decimals;
|
|
124
|
+
if (typeof decimalsOrOptions === "number") {
|
|
125
|
+
decimals = decimalsOrOptions;
|
|
126
|
+
} else if (decimalsOrOptions && typeof decimalsOrOptions === "object") {
|
|
127
|
+
if (decimalsOrOptions.preserveDecimals) {
|
|
128
|
+
const valueStr = value.toString();
|
|
129
|
+
const decimalIndex = valueStr.indexOf(".");
|
|
130
|
+
if (decimalIndex !== -1) {
|
|
131
|
+
const detectedDecimals = valueStr.length - decimalIndex - 1;
|
|
132
|
+
const maxDecimals = decimalsOrOptions.maxDecimals ?? 10;
|
|
133
|
+
decimals = Math.min(detectedDecimals, maxDecimals);
|
|
134
|
+
} else {
|
|
135
|
+
decimals = 0;
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
decimals = decimalsOrOptions.decimals ?? 1;
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
decimals = 1;
|
|
142
|
+
}
|
|
143
|
+
return new Intl.NumberFormat(locale, {
|
|
144
|
+
style: "percent",
|
|
145
|
+
minimumFractionDigits: decimals,
|
|
146
|
+
maximumFractionDigits: decimals
|
|
147
|
+
}).format(value / 100);
|
|
148
|
+
}
|
|
149
|
+
function formatCompactNumber(value, locale = "en-US") {
|
|
150
|
+
return new Intl.NumberFormat(locale, {
|
|
151
|
+
notation: "compact",
|
|
152
|
+
compactDisplay: "short"
|
|
153
|
+
}).format(value);
|
|
154
|
+
}
|
|
155
|
+
function formatFileSize(bytes) {
|
|
156
|
+
if (bytes === 0) return "0 Bytes";
|
|
157
|
+
const k = 1024;
|
|
158
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
|
|
159
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
160
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
useSessionTracking,
|
|
165
|
+
setAppConfig,
|
|
166
|
+
getAppConfig,
|
|
167
|
+
getCurrentAppName,
|
|
168
|
+
getCurrentAppId,
|
|
169
|
+
formatDate,
|
|
170
|
+
formatCurrency,
|
|
171
|
+
formatNumber,
|
|
172
|
+
formatPercent,
|
|
173
|
+
formatCompactNumber,
|
|
174
|
+
formatFileSize
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=chunk-GZRXOUBE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/sessionTracking.ts","../src/utils/appConfig.ts","../src/utils/formatting.ts"],"sourcesContent":["import type { SupabaseClient } from '@supabase/supabase-js';\n\n// Define the tracking parameters locally since old RBAC types are removed\ninterface TrackUserSessionParams {\n p_session_type: 'event_switch' | 'session_expired';\n p_event_id?: string;\n p_app_id?: string;\n ip_address?: string;\n user_agent?: string;\n}\n\n/**\n * Hook for manual session tracking (event switches and session expiration).\n * \n * Note: Login and logout tracking is automatically handled by UnifiedAuthProvider.\n * You should only use this hook for tracking event switches or session expirations.\n * \n * @param supabaseClient - Supabase client instance\n * @param appName - Optional application name for tracking\n * @returns Object containing tracking functions for event switches and session expiration\n */\nexport function useSessionTracking(supabaseClient: SupabaseClient, appName?: string) {\n // Resolve app name to app_id\n const resolveAppId = async (): Promise<string | undefined> => {\n if (!appName) return undefined;\n \n try {\n const { data, error } = await supabaseClient\n .from('rbac_apps')\n .select('id')\n .eq('name', appName)\n .eq('is_active', true)\n .single();\n \n if (error || !data) {\n console.warn('App not found or inactive:', appName);\n return undefined;\n }\n \n return data.id;\n } catch (error) {\n console.error('Failed to resolve app ID:', error);\n return undefined;\n }\n };\n /**\n * Track an event switch\n * @param eventId - ID of the event being switched to\n */\n const trackEventSwitch = async (eventId: string) => {\n try {\n const { data: { user } } = await supabaseClient.auth.getUser();\n if (!user) {\n console.warn('No authenticated user found for session tracking');\n return;\n }\n\n const appId = await resolveAppId();\n\n const params: TrackUserSessionParams = {\n p_session_type: 'event_switch',\n p_event_id: eventId,\n p_app_id: appId\n };\n\n const { error } = await supabaseClient.rpc('rbac_session_track', {\n p_user_id: user?.id,\n p_session_type: params.p_session_type,\n p_event_id: params.p_event_id,\n p_app_id: params.p_app_id,\n p_ip_address: params.ip_address,\n p_user_agent: params.user_agent\n });\n \n if (error) {\n console.error('Failed to track event switch session:', error);\n } else {\n console.log('Event switch session tracked successfully');\n }\n } catch (error) {\n console.error('Failed to track event switch:', error);\n }\n };\n\n /**\n * Track a session expiration\n */\n const trackSessionExpired = async () => {\n try {\n const { data: { user } } = await supabaseClient.auth.getUser();\n if (!user) {\n console.warn('No authenticated user found for session tracking');\n return;\n }\n\n const appId = await resolveAppId();\n\n const params: TrackUserSessionParams = {\n p_session_type: 'session_expired',\n p_app_id: appId\n };\n\n const { error } = await supabaseClient.rpc('rbac_session_track', {\n p_user_id: user?.id,\n p_session_type: params.p_session_type,\n p_event_id: params.p_event_id,\n p_app_id: params.p_app_id,\n p_ip_address: params.ip_address,\n p_user_agent: params.user_agent\n });\n \n if (error) {\n console.error('Failed to track session expiration:', error);\n } else {\n console.log('Session expiration tracked successfully');\n }\n } catch (error) {\n console.error('Failed to track session expiration:', error);\n }\n };\n\n return {\n trackEventSwitch,\n trackSessionExpired\n };\n} ","\n/**\n * Application configuration utilities\n */\n\nexport interface AppConfig {\n appName: string;\n appId: string;\n}\n\nlet currentAppConfig: AppConfig | null = null;\n\n/**\n * Set the current application configuration\n */\nexport function setAppConfig(config: AppConfig) {\n currentAppConfig = config;\n}\n\n/**\n * Get the current application configuration\n */\nexport function getAppConfig(): AppConfig {\n if (!currentAppConfig) {\n // Fallback to environment or default\n const appName = import.meta.env.REACT_APP_NAME || 'PACE';\n return {\n appName,\n appId: appName\n };\n }\n return currentAppConfig;\n}\n\n/**\n * Get the current app name\n */\nexport function getCurrentAppName(): string {\n return getAppConfig().appName;\n}\n\n/**\n * Get the current app ID\n */\nexport function getCurrentAppId(): string {\n return getAppConfig().appId;\n}\n","/**\n * Utility functions for formatting data in the application\n */\n\n/**\n * Format a date as a readable string\n */\nexport function formatDate(date: Date | string | number): string {\n const dateObj = typeof date === 'string' || typeof date === 'number' \n ? new Date(date) \n : date;\n \n return dateObj.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric'\n });\n}\n\n/**\n * Format a number as a currency\n */\nexport function formatCurrency(value: number, currencyCode = 'USD', locale = 'en-US'): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyCode,\n }).format(value);\n}\n\n/**\n * Format a number with custom options\n */\nexport function formatNumber(\n value: number,\n options: Intl.NumberFormatOptions = {},\n locale = 'en-US'\n): string {\n return new Intl.NumberFormat(locale, options).format(value);\n}\n\n/**\n * Format a number as a percentage.\n * \n * The third parameter can be either:\n * - A number for fixed decimal places (backward compatible): `formatPercent(0.81, 'en-US', 2)`\n * - An options object with:\n * - `decimals`: Fixed number of decimal places (default: 1)\n * - `preserveDecimals`: Auto-detect and preserve decimal places from the input value\n * - `maxDecimals`: Maximum decimal places when preserving (default: 10)\n * \n * @param value - The percentage value as a decimal (e.g., 0.81 for 0.81%)\n * @param locale - The locale string (default: 'en-US')\n * @param decimalsOrOptions - Either a number for fixed decimals, or an options object with:\n * - `decimals` - Fixed number of decimal places (default: 1)\n * - `preserveDecimals` - Auto-detect and preserve decimal places from the input value\n * - `maxDecimals` - Maximum decimal places when preserving (default: 10)\n * @returns Formatted percentage string (e.g., \"0.81%\", \"81%\")\n * \n * @example\n * ```ts\n * // Fixed decimals (default behavior)\n * formatPercent(0.5) // '0.5%'\n * formatPercent(0.81, 'en-US', 1) // '0.8%' (loses precision)\n * \n * // Preserve decimal places dynamically\n * formatPercent(0.81, 'en-US', { preserveDecimals: true }) // '0.81%'\n * formatPercent(0.8123, 'en-US', { preserveDecimals: true, maxDecimals: 2 }) // '0.81%'\n * ```\n */\nexport function formatPercent(\n value: number,\n locale: string = 'en-US',\n decimalsOrOptions?: number | {\n decimals?: number;\n preserveDecimals?: boolean;\n maxDecimals?: number;\n }\n): string {\n let decimals: number;\n\n // Backward compatibility: if decimalsOrOptions is a number, use it directly\n if (typeof decimalsOrOptions === 'number') {\n decimals = decimalsOrOptions;\n } else if (decimalsOrOptions && typeof decimalsOrOptions === 'object') {\n // New options object: check if we should preserve decimals\n if (decimalsOrOptions.preserveDecimals) {\n const valueStr = value.toString();\n const decimalIndex = valueStr.indexOf('.');\n \n if (decimalIndex !== -1) {\n const detectedDecimals = valueStr.length - decimalIndex - 1;\n const maxDecimals = decimalsOrOptions.maxDecimals ?? 10;\n decimals = Math.min(detectedDecimals, maxDecimals);\n } else {\n decimals = 0;\n }\n } else {\n decimals = decimalsOrOptions.decimals ?? 1;\n }\n } else {\n decimals = 1;\n }\n\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(value / 100);\n}\n\n/**\n * Format a large number with abbreviations (K, M, B)\n */\nexport function formatCompactNumber(value: number, locale = 'en-US'): string {\n return new Intl.NumberFormat(locale, {\n notation: 'compact',\n compactDisplay: 'short'\n }).format(value);\n}\n\n/**\n * Format a file size in bytes to a human-readable string\n */\nexport function formatFileSize(bytes: number): string {\n if (bytes === 0) return '0 Bytes';\n \n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];\n const i = Math.floor(Math.log(bytes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O;AAExB,QAAM,IAAI;AACV,QAAM,QAAQ,CAAC,SAAS,MAAM,MAAM,MAAM,MAAM,IAAI;AACpD,QAAM,IAAI,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,CAAC;AAElD,SAAO,YAAY,QAAQ,KAAK,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,MAAM,MAAM,CAAC;AACxE;","names":[]}
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
isPermitted,
|
|
7
7
|
isPermittedCached,
|
|
8
8
|
resolveAppContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XRSP3H52.js";
|
|
10
10
|
import {
|
|
11
11
|
init_useOrganisations,
|
|
12
12
|
useEvents,
|
|
13
13
|
useOrganisations
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EZ64QG2I.js";
|
|
15
15
|
import {
|
|
16
16
|
init_UnifiedAuthProvider,
|
|
17
17
|
useUnifiedAuth
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-AUXS7XSO.js";
|
|
19
19
|
import {
|
|
20
20
|
getCurrentAppName
|
|
21
21
|
} from "./chunk-JCQZ6LA7.js";
|
|
@@ -729,4 +729,4 @@ export {
|
|
|
729
729
|
useHasAllPermissions,
|
|
730
730
|
useCachedPermissions
|
|
731
731
|
};
|
|
732
|
-
//# sourceMappingURL=chunk-
|
|
732
|
+
//# sourceMappingURL=chunk-HADXAZT3.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCan,
|
|
3
3
|
useResolvedScope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HADXAZT3.js";
|
|
5
5
|
import {
|
|
6
6
|
toast,
|
|
7
7
|
useDataTablePerformance
|
|
8
8
|
} from "./chunk-4OX5PXHX.js";
|
|
9
9
|
import {
|
|
10
10
|
init_UnifiedAuthProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EYSXQ756.js";
|
|
12
12
|
import {
|
|
13
13
|
useUnifiedAuth
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AUXS7XSO.js";
|
|
15
15
|
import {
|
|
16
16
|
cn
|
|
17
17
|
} from "./chunk-PYUXFQJ3.js";
|
|
@@ -12703,4 +12703,4 @@ lodash/lodash.js:
|
|
|
12703
12703
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
12704
12704
|
*)
|
|
12705
12705
|
*/
|
|
12706
|
-
//# sourceMappingURL=chunk-
|
|
12706
|
+
//# sourceMappingURL=chunk-HGZSO43Y.js.map
|
|
@@ -746,7 +746,8 @@ var DEFAULT_SECURITY_CONFIG = {
|
|
|
746
746
|
enableInputValidation: true,
|
|
747
747
|
enableRateLimiting: true,
|
|
748
748
|
enableAuditLogging: true,
|
|
749
|
-
maxPermissionChecksPerMinute:
|
|
749
|
+
maxPermissionChecksPerMinute: 1e3,
|
|
750
|
+
// Increased from 100 to 1000 for normal app usage
|
|
750
751
|
suspiciousActivityThreshold: 10
|
|
751
752
|
};
|
|
752
753
|
var RBACSecurityMiddleware = class {
|
|
@@ -871,9 +872,13 @@ var RBACSecurityMiddleware = class {
|
|
|
871
872
|
|
|
872
873
|
// src/rbac/engine.ts
|
|
873
874
|
var RBACEngine = class {
|
|
874
|
-
constructor(supabase) {
|
|
875
|
+
constructor(supabase, securityConfig) {
|
|
875
876
|
this.supabase = supabase;
|
|
876
|
-
|
|
877
|
+
const mergedSecurityConfig = {
|
|
878
|
+
...DEFAULT_SECURITY_CONFIG,
|
|
879
|
+
...securityConfig
|
|
880
|
+
};
|
|
881
|
+
this.securityMiddleware = new RBACSecurityMiddleware(mergedSecurityConfig);
|
|
877
882
|
initializeCacheInvalidation(supabase);
|
|
878
883
|
}
|
|
879
884
|
/**
|
|
@@ -1181,7 +1186,9 @@ var RBACEngine = class {
|
|
|
1181
1186
|
p_user_id: userId,
|
|
1182
1187
|
p_organisation_id: scope.organisationId || null,
|
|
1183
1188
|
p_event_id: scope.eventId || null,
|
|
1184
|
-
p_app_id: scope.appId || null
|
|
1189
|
+
p_app_id: scope.appId || null,
|
|
1190
|
+
p_page_id: null
|
|
1191
|
+
// Optional: can filter to specific page if needed
|
|
1185
1192
|
});
|
|
1186
1193
|
if (error) {
|
|
1187
1194
|
console.error("[RBACEngine] Failed to load role context:", error);
|
|
@@ -1252,8 +1259,8 @@ var RBACEngine = class {
|
|
|
1252
1259
|
}
|
|
1253
1260
|
}
|
|
1254
1261
|
};
|
|
1255
|
-
function createRBACEngine(supabase) {
|
|
1256
|
-
return new RBACEngine(supabase);
|
|
1262
|
+
function createRBACEngine(supabase, securityConfig) {
|
|
1263
|
+
return new RBACEngine(supabase, securityConfig);
|
|
1257
1264
|
}
|
|
1258
1265
|
|
|
1259
1266
|
// src/rbac/config.ts
|
|
@@ -1347,7 +1354,7 @@ function setupRBAC(supabase, config) {
|
|
|
1347
1354
|
...config
|
|
1348
1355
|
};
|
|
1349
1356
|
createRBACConfig(fullConfig);
|
|
1350
|
-
globalEngine = createRBACEngine(supabase);
|
|
1357
|
+
globalEngine = createRBACEngine(supabase, config?.security);
|
|
1351
1358
|
const auditManager = createAuditManager(supabase);
|
|
1352
1359
|
setGlobalAuditManager(auditManager);
|
|
1353
1360
|
logger.info("RBAC system initialized successfully");
|
|
@@ -1519,4 +1526,4 @@ export {
|
|
|
1519
1526
|
invalidateAppCache,
|
|
1520
1527
|
clearCache
|
|
1521
1528
|
};
|
|
1522
|
-
//# sourceMappingURL=chunk-
|
|
1529
|
+
//# sourceMappingURL=chunk-XRSP3H52.js.map
|