@jmruthers/pace-core 0.5.117 → 0.5.118
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/{chunk-XN2LYHDI.js → chunk-7OTQLFVI.js} +25 -6
- package/dist/{chunk-XN2LYHDI.js.map → chunk-7OTQLFVI.js.map} +1 -1
- package/dist/{chunk-IZXS7RZK.js → chunk-HIWXXDXO.js} +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.js +2 -2
- package/dist/rbac/index.js +2 -2
- 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 +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/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/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/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 +2 -2
- package/package.json +1 -1
- package/src/hooks/useSecureDataAccess.ts +43 -5
- /package/dist/{chunk-IZXS7RZK.js.map → chunk-HIWXXDXO.js.map} +0 -0
package/docs/api/modules.md
CHANGED
package/package.json
CHANGED
|
@@ -507,15 +507,53 @@ export function useSecureDataAccess(): SecureDataAccessReturn {
|
|
|
507
507
|
'app_cake_delivery_upsert'
|
|
508
508
|
];
|
|
509
509
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
510
|
+
// Build secureParams with correct parameter order
|
|
511
|
+
// For functions that require p_event_id as first parameter, ensure it's first
|
|
512
|
+
const secureParams: Record<string, any> = {};
|
|
513
|
+
|
|
514
|
+
// Functions where p_event_id is the FIRST required parameter (no default)
|
|
515
|
+
const functionsWithEventIdFirst = [
|
|
516
|
+
'data_cake_meals_list',
|
|
517
|
+
'data_cake_units_list'
|
|
518
|
+
];
|
|
519
|
+
|
|
520
|
+
// Add p_user_id explicitly for functions that need it (even though it has a default)
|
|
521
|
+
// This ensures parameter matching works correctly
|
|
522
|
+
if (user?.id) {
|
|
523
|
+
secureParams.p_user_id = user.id;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Add organisation_id parameter
|
|
527
|
+
secureParams[paramName] = organisationId;
|
|
514
528
|
|
|
515
529
|
// Add p_event_id if function needs it and event is selected
|
|
530
|
+
// CRITICAL: This must be added AFTER organisation_id but BEFORE caller params
|
|
531
|
+
// to ensure it's not overwritten. For data_cake_items_list, p_event_id is the 3rd param.
|
|
516
532
|
if (functionsNeedingEventId.includes(functionName) && selectedEvent?.event_id) {
|
|
517
533
|
secureParams.p_event_id = selectedEvent.event_id;
|
|
518
534
|
}
|
|
535
|
+
|
|
536
|
+
// Add any other params passed by caller (limit, offset, etc.)
|
|
537
|
+
// NOTE: This will NOT overwrite p_event_id if caller passes it, but we want to ensure
|
|
538
|
+
// our value takes precedence if event is selected
|
|
539
|
+
Object.assign(secureParams, params);
|
|
540
|
+
|
|
541
|
+
// Ensure p_event_id is set if needed (after Object.assign, so it overrides caller params)
|
|
542
|
+
if (functionsNeedingEventId.includes(functionName) && selectedEvent?.event_id) {
|
|
543
|
+
secureParams.p_event_id = selectedEvent.event_id;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Debug logging for items list to help diagnose issues
|
|
547
|
+
if (functionName === 'data_cake_items_list') {
|
|
548
|
+
console.log('[useSecureDataAccess] Calling data_cake_items_list with params:', {
|
|
549
|
+
p_user_id: secureParams.p_user_id,
|
|
550
|
+
p_organisation_id: secureParams.organisation_id || secureParams.p_organisation_id,
|
|
551
|
+
p_event_id: secureParams.p_event_id,
|
|
552
|
+
hasEvent: !!selectedEvent?.event_id,
|
|
553
|
+
eventId: selectedEvent?.event_id,
|
|
554
|
+
allParams: secureParams
|
|
555
|
+
});
|
|
556
|
+
}
|
|
519
557
|
|
|
520
558
|
const { data, error } = await supabase!.rpc(functionName, secureParams);
|
|
521
559
|
|
|
@@ -529,7 +567,7 @@ export function useSecureDataAccess(): SecureDataAccessReturn {
|
|
|
529
567
|
});
|
|
530
568
|
|
|
531
569
|
return data as T;
|
|
532
|
-
}, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase, selectedEvent?.event_id]);
|
|
570
|
+
}, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase, selectedEvent?.event_id, user?.id]);
|
|
533
571
|
|
|
534
572
|
// NEW: Phase 1 - Enhanced Security Features
|
|
535
573
|
const [dataAccessHistory, setDataAccessHistory] = useState<DataAccessRecord[]>([]);
|
|
File without changes
|