@jmruthers/pace-core 0.5.156 → 0.5.158
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/{DataTable-6G3KTRE2.js → DataTable-J33RZUVQ.js} +3 -3
- package/dist/{chunk-I63KPRGZ.js → chunk-KMPFOZJU.js} +54 -6
- package/dist/chunk-KMPFOZJU.js.map +1 -0
- package/dist/{chunk-2EVK2UBQ.js → chunk-M4IQISCX.js} +21 -4
- package/dist/chunk-M4IQISCX.js.map +1 -0
- package/dist/{chunk-XXFXL7A5.js → chunk-PCSNCMVD.js} +2 -2
- package/dist/{chunk-RF6SUNXB.js → chunk-YBBFFGBX.js} +2 -2
- package/dist/components.js +3 -3
- package/dist/index.js +4 -4
- package/dist/rbac/index.js +2 -2
- package/dist/utils.js +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/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.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 +1 -1
- 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/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.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/GrantEventAppRoleParams.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/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.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/SessionRestorationLoaderProps.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/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.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/UseResourcePermissionsOptions.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 +8 -8
- package/package.json +1 -1
- package/src/components/NavigationMenu/NavigationMenu.tsx +23 -1
- package/src/rbac/hooks/usePermissions.ts +58 -3
- package/dist/chunk-2EVK2UBQ.js.map +0 -1
- package/dist/chunk-I63KPRGZ.js.map +0 -1
- /package/dist/{DataTable-6G3KTRE2.js.map → DataTable-J33RZUVQ.js.map} +0 -0
- /package/dist/{chunk-XXFXL7A5.js.map → chunk-PCSNCMVD.js.map} +0 -0
- /package/dist/{chunk-RF6SUNXB.js.map → chunk-YBBFFGBX.js.map} +0 -0
package/docs/api/modules.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[@jmruthers/pace-core - v0.5.
|
|
1
|
+
[@jmruthers/pace-core - v0.5.158](README.md) / Exports
|
|
2
2
|
|
|
3
|
-
# @jmruthers/pace-core - v0.5.
|
|
3
|
+
# @jmruthers/pace-core - v0.5.158
|
|
4
4
|
|
|
5
5
|
**`File`**
|
|
6
6
|
|
|
@@ -6673,7 +6673,7 @@ function MyComponent() {
|
|
|
6673
6673
|
|
|
6674
6674
|
#### Defined in
|
|
6675
6675
|
|
|
6676
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6676
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:275](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L275)
|
|
6677
6677
|
|
|
6678
6678
|
___
|
|
6679
6679
|
|
|
@@ -6723,7 +6723,7 @@ function MyComponent() {
|
|
|
6723
6723
|
|
|
6724
6724
|
#### Defined in
|
|
6725
6725
|
|
|
6726
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6726
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:471](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L471)
|
|
6727
6727
|
|
|
6728
6728
|
___
|
|
6729
6729
|
|
|
@@ -6780,7 +6780,7 @@ function MyComponent() {
|
|
|
6780
6780
|
|
|
6781
6781
|
#### Defined in
|
|
6782
6782
|
|
|
6783
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6783
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:546](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L546)
|
|
6784
6784
|
|
|
6785
6785
|
___
|
|
6786
6786
|
|
|
@@ -6831,7 +6831,7 @@ function MyComponent() {
|
|
|
6831
6831
|
|
|
6832
6832
|
#### Defined in
|
|
6833
6833
|
|
|
6834
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6834
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:629](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L629)
|
|
6835
6835
|
|
|
6836
6836
|
___
|
|
6837
6837
|
|
|
@@ -6882,7 +6882,7 @@ function MyComponent() {
|
|
|
6882
6882
|
|
|
6883
6883
|
#### Defined in
|
|
6884
6884
|
|
|
6885
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6885
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:715](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L715)
|
|
6886
6886
|
|
|
6887
6887
|
___
|
|
6888
6888
|
|
|
@@ -6933,7 +6933,7 @@ function MyComponent() {
|
|
|
6933
6933
|
|
|
6934
6934
|
#### Defined in
|
|
6935
6935
|
|
|
6936
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6936
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:800](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L800)
|
|
6937
6937
|
|
|
6938
6938
|
___
|
|
6939
6939
|
|
package/package.json
CHANGED
|
@@ -594,9 +594,31 @@ export const NavigationMenu = React.forwardRef<
|
|
|
594
594
|
}
|
|
595
595
|
}, [filterByPermissions, stableScope.organisationId, stableScope.eventId, stableScope.appId, userId]);
|
|
596
596
|
|
|
597
|
+
// Log when stableScope changes to verify usePermissions receives updates
|
|
598
|
+
React.useEffect(() => {
|
|
599
|
+
if (filterByPermissions && stableScope.organisationId) {
|
|
600
|
+
logger.warn('NavigationMenu', 'Calling usePermissions with stableScope', {
|
|
601
|
+
organisationId: stableScope.organisationId,
|
|
602
|
+
eventId: stableScope.eventId,
|
|
603
|
+
appId: stableScope.appId,
|
|
604
|
+
hasAppId: !!stableScope.appId
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}, [filterByPermissions, stableScope.organisationId, stableScope.eventId, stableScope.appId]);
|
|
608
|
+
|
|
609
|
+
// Create a stable scope reference that React can properly track
|
|
610
|
+
// This ensures usePermissions detects changes when appId changes from undefined to a value
|
|
611
|
+
const stableScopeForPermissions = React.useMemo(() => {
|
|
612
|
+
return {
|
|
613
|
+
organisationId: stableScope.organisationId || '',
|
|
614
|
+
eventId: stableScope.eventId,
|
|
615
|
+
appId: stableScope.appId
|
|
616
|
+
};
|
|
617
|
+
}, [stableScope.organisationId, stableScope.eventId, stableScope.appId]);
|
|
618
|
+
|
|
597
619
|
const { permissions: permissionMap, hasAnyPermission, isLoading: permissionsLoading, error: permissionsError } = usePermissions(
|
|
598
620
|
userId as any,
|
|
599
|
-
|
|
621
|
+
stableScopeForPermissions as any
|
|
600
622
|
);
|
|
601
623
|
|
|
602
624
|
// Debug logging for permission map state
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This module provides React hooks for RBAC functionality.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
10
|
+
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
11
11
|
import {
|
|
12
12
|
UUID,
|
|
13
13
|
Scope,
|
|
@@ -52,6 +52,19 @@ export function usePermissions(userId: UUID, scope: Scope) {
|
|
|
52
52
|
const [isLoading, setIsLoading] = useState(true);
|
|
53
53
|
const [error, setError] = useState<Error | null>(null);
|
|
54
54
|
const isFetchingRef = useRef(false);
|
|
55
|
+
const logger = getRBACLogger();
|
|
56
|
+
|
|
57
|
+
// Log when scope changes to verify React detects the change
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
logger.warn('[usePermissions] Scope changed', {
|
|
60
|
+
userId,
|
|
61
|
+
organisationId: scope.organisationId,
|
|
62
|
+
eventId: scope.eventId,
|
|
63
|
+
appId: scope.appId,
|
|
64
|
+
hasAppId: !!scope.appId,
|
|
65
|
+
hasOrganisationId: !!scope.organisationId
|
|
66
|
+
});
|
|
67
|
+
}, [scope.organisationId, scope.eventId, scope.appId, userId]);
|
|
55
68
|
|
|
56
69
|
// Add timeout for missing organisation context (3 seconds)
|
|
57
70
|
useEffect(() => {
|
|
@@ -73,6 +86,15 @@ export function usePermissions(userId: UUID, scope: Scope) {
|
|
|
73
86
|
const fetchPermissions = async () => {
|
|
74
87
|
// Prevent multiple simultaneous fetches
|
|
75
88
|
if (isFetchingRef.current) {
|
|
89
|
+
const logger = getRBACLogger();
|
|
90
|
+
logger.warn('[usePermissions] Skipping fetch - already fetching', {
|
|
91
|
+
userId,
|
|
92
|
+
scope: {
|
|
93
|
+
organisationId: scope.organisationId,
|
|
94
|
+
eventId: scope.eventId,
|
|
95
|
+
appId: scope.appId
|
|
96
|
+
}
|
|
97
|
+
});
|
|
76
98
|
return;
|
|
77
99
|
}
|
|
78
100
|
|
|
@@ -92,6 +114,30 @@ export function usePermissions(userId: UUID, scope: Scope) {
|
|
|
92
114
|
return;
|
|
93
115
|
}
|
|
94
116
|
|
|
117
|
+
// CRITICAL: getPermissionMap requires appId to fetch pages and permissions
|
|
118
|
+
// If appId is missing, it returns an empty map
|
|
119
|
+
// Wait for appId to be available before fetching
|
|
120
|
+
if (!scope.appId) {
|
|
121
|
+
logger.warn('[usePermissions] Waiting for appId before fetching permissions', {
|
|
122
|
+
userId,
|
|
123
|
+
organisationId: scope.organisationId,
|
|
124
|
+
eventId: scope.eventId,
|
|
125
|
+
hasAppId: false
|
|
126
|
+
});
|
|
127
|
+
setIsLoading(true);
|
|
128
|
+
setError(null);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
logger.warn('[usePermissions] Fetching permissions', {
|
|
132
|
+
userId,
|
|
133
|
+
scope: {
|
|
134
|
+
organisationId: scope.organisationId,
|
|
135
|
+
eventId: scope.eventId,
|
|
136
|
+
appId: scope.appId
|
|
137
|
+
},
|
|
138
|
+
hasAppId: !!scope.appId
|
|
139
|
+
});
|
|
140
|
+
|
|
95
141
|
try {
|
|
96
142
|
isFetchingRef.current = true;
|
|
97
143
|
setIsLoading(true);
|
|
@@ -100,13 +146,22 @@ export function usePermissions(userId: UUID, scope: Scope) {
|
|
|
100
146
|
// Fetch new permissions - don't clear old ones until we have new ones
|
|
101
147
|
const permissionMap = await getPermissionMap({ userId, scope });
|
|
102
148
|
|
|
149
|
+
logger.warn('[usePermissions] Permissions fetched successfully', {
|
|
150
|
+
permissionCount: Object.keys(permissionMap).length,
|
|
151
|
+
hasWildcard: !!permissionMap['*'],
|
|
152
|
+
scope: {
|
|
153
|
+
organisationId: scope.organisationId,
|
|
154
|
+
eventId: scope.eventId,
|
|
155
|
+
appId: scope.appId
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
103
159
|
// Only update permissions if fetch was successful
|
|
104
160
|
setPermissions(permissionMap);
|
|
105
161
|
} catch (err) {
|
|
106
162
|
// On error, keep existing permissions but set error state
|
|
107
163
|
// This prevents the UI from losing all items when there's a transient error
|
|
108
|
-
|
|
109
|
-
logger.error('Failed to fetch permissions:', err);
|
|
164
|
+
logger.error('[usePermissions] Failed to fetch permissions:', err);
|
|
110
165
|
setError(err instanceof Error ? err : new Error('Failed to fetch permissions'));
|
|
111
166
|
// Don't clear permissions on error - keep what we had
|
|
112
167
|
} finally {
|