@jmruthers/pace-core 0.5.135 → 0.5.136
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-C7GaRZye.d.ts → DataTable-CWAZZcXC.d.ts} +1 -1
- package/dist/{DataTable-A36PJG6N.js → DataTable-CYOHOX3O.js} +25 -13
- package/dist/{PublicLoadingSpinner-CUAnTvcg.d.ts → EventLogo-801uofbR.d.ts} +51 -135
- package/dist/UnifiedAuthProvider-5E5TUNMS.js +17 -0
- package/dist/{UnifiedAuthProvider-BVKmQd9u.d.ts → UnifiedAuthProvider-DJxGTftH.d.ts} +1 -1
- package/dist/{api-TNIBJWLM.js → api-45XYYO2A.js} +4 -3
- package/dist/{audit-T36HM7IM.js → audit-64X3VJXB.js} +3 -2
- package/dist/{chunk-CTJRBUX2.js → chunk-2TWNJ46Y.js} +2 -2
- package/dist/{chunk-UJI6WSMD.js → chunk-444EZN6N.js} +3 -3
- package/dist/chunk-444EZN6N.js.map +1 -0
- package/dist/{chunk-3CG5L6RN.js → chunk-4MT5BGGL.js} +90 -73
- package/dist/chunk-4MT5BGGL.js.map +1 -0
- package/dist/{chunk-PYUXFQJ3.js → chunk-56XJ3TU6.js} +2 -2
- package/dist/chunk-56XJ3TU6.js.map +1 -0
- package/dist/chunk-5DPZ5EAT.js +60 -0
- package/dist/chunk-5DPZ5EAT.js.map +1 -0
- package/dist/{chunk-66C4BSAY.js → chunk-ANBQRTPX.js} +9 -2
- package/dist/chunk-ANBQRTPX.js.map +1 -0
- package/dist/chunk-APIBCTL2.js +670 -0
- package/dist/chunk-APIBCTL2.js.map +1 -0
- package/dist/{chunk-GKHF54DI.js → chunk-BESYRHQM.js} +10 -4
- package/dist/chunk-BESYRHQM.js.map +1 -0
- package/dist/{chunk-WP5I5GLN.js → chunk-BVYWGZVV.js} +112 -97
- package/dist/chunk-BVYWGZVV.js.map +1 -0
- package/dist/{chunk-GEVIB2UB.js → chunk-ERISIBYU.js} +14 -5
- package/dist/chunk-ERISIBYU.js.map +1 -0
- package/dist/{chunk-CQZU6TFE.js → chunk-FHWWBIHA.js} +100 -62
- package/dist/chunk-FHWWBIHA.js.map +1 -0
- package/dist/{chunk-O3NWNXDY.js → chunk-FMUCXFII.js} +2 -2
- package/dist/chunk-FMUCXFII.js.map +1 -0
- package/dist/{chunk-GVDR7WNV.js → chunk-HJGGOMQ6.js} +194 -518
- package/dist/chunk-HJGGOMQ6.js.map +1 -0
- package/dist/{chunk-BDZUMRBD.js → chunk-K2WWTH7O.js} +13 -6
- package/dist/chunk-K2WWTH7O.js.map +1 -0
- package/dist/{chunk-BYXRHAIF.js → chunk-L6PGMCMD.js} +23 -14
- package/dist/chunk-L6PGMCMD.js.map +1 -0
- package/dist/chunk-LMC26NLJ.js +84 -0
- package/dist/chunk-LMC26NLJ.js.map +1 -0
- package/dist/{chunk-M6DDYFUD.js → chunk-LS353YLY.js} +19 -16
- package/dist/chunk-LS353YLY.js.map +1 -0
- package/dist/{chunk-ZYZCRSBD.js → chunk-LTV3XIJJ.js} +16 -11
- package/dist/chunk-LTV3XIJJ.js.map +1 -0
- package/dist/{chunk-HMNOSGVA.js → chunk-NOHEVYVX.js} +377 -666
- package/dist/chunk-NOHEVYVX.js.map +1 -0
- package/dist/{chunk-JCQZ6LA7.js → chunk-Q5QRDWKI.js} +9 -3
- package/dist/chunk-Q5QRDWKI.js.map +1 -0
- package/dist/chunk-S5OFRT4M.js +94 -0
- package/dist/chunk-S5OFRT4M.js.map +1 -0
- package/dist/{chunk-3DBFLLLU.js → chunk-SBVILCCA.js} +14 -9
- package/dist/chunk-SBVILCCA.js.map +1 -0
- package/dist/{chunk-TGIY2AR2.js → chunk-SL2YQDR6.js} +4 -3
- package/dist/{chunk-TGIY2AR2.js.map → chunk-SL2YQDR6.js.map} +1 -1
- package/dist/{chunk-VZ5OR6HD.js → chunk-TVYPTYOY.js} +55 -179
- package/dist/chunk-TVYPTYOY.js.map +1 -0
- package/dist/{chunk-ZV77RZMU.js → chunk-XARJS7CD.js} +2 -2
- package/dist/chunk-XDNLUEXI.js +138 -0
- package/dist/chunk-XDNLUEXI.js.map +1 -0
- package/dist/{chunk-F64FFPOZ.js → chunk-YLKIDTUK.js} +26 -20
- package/dist/chunk-YLKIDTUK.js.map +1 -0
- package/dist/{chunk-5F3NDPJV.js → chunk-ZZ2SS7NI.js} +10 -5
- package/dist/chunk-ZZ2SS7NI.js.map +1 -0
- package/dist/components.d.ts +7 -287
- package/dist/components.js +26 -157
- package/dist/components.js.map +1 -1
- package/dist/{file-reference-C9isKNPn.d.ts → file-reference-C6Gkn77H.d.ts} +1 -1
- package/dist/{formatting-DFcCxUEk.d.ts → formatting-CvUXy2mF.d.ts} +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +22 -16
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +101 -9
- package/dist/index.js +43 -31
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +5 -4
- package/dist/rbac/index.js +13 -12
- package/dist/styles/index.js +2 -1
- package/dist/theming/runtime.d.ts +2 -19
- package/dist/theming/runtime.js +2 -1
- package/dist/{types-D5rqZQXk.d.ts → types-Dfz9dmVH.d.ts} +12 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/{useInactivityTracker-MRUU55XI.js → useInactivityTracker-TO6ZOF35.js} +3 -2
- package/dist/{usePublicRouteParams-Dyt1tzI9.d.ts → usePublicRouteParams-B7PabvuH.d.ts} +1 -1
- package/dist/utils.d.ts +195 -232
- package/dist/utils.js +173 -331
- package/dist/utils.js.map +1 -1
- package/dist/{validation-DnhrNMju.d.ts → validation-8npbysjg.d.ts} +26 -8
- package/dist/validation.d.ts +261 -10
- package/dist/validation.js +82 -440
- package/dist/validation.js.map +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +6 -6
- 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 +6 -6
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +7 -7
- 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 +4 -4
- 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 +29 -4
- package/docs/api/interfaces/DataAccessRecord.md +9 -9
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +18 -18
- package/docs/api/interfaces/DataTableColumn.md +61 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +14 -14
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +152 -0
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +8 -8
- package/docs/api/interfaces/FileDisplayProps.md +15 -15
- 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 +10 -10
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- package/docs/api/interfaces/NavigationGuardProps.md +10 -10
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +7 -7
- 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 +27 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +4 -4
- package/docs/api/interfaces/PageAccessRecord.md +8 -8
- package/docs/api/interfaces/PagePermissionContextType.md +8 -8
- package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
- package/docs/api/interfaces/PagePermissionProviderProps.md +7 -7
- package/docs/api/interfaces/PaletteData.md +4 -4
- package/docs/api/interfaces/PermissionEnforcerProps.md +11 -11
- package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
- 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 +8 -8
- package/docs/api/interfaces/RoleBasedRouterProps.md +10 -10
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +10 -10
- package/docs/api/interfaces/RouteConfig.md +10 -10
- package/docs/api/interfaces/SecureDataContextType.md +9 -9
- package/docs/api/interfaces/SecureDataProviderProps.md +8 -8
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +21 -0
- 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 +53 -53
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +9 -9
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +8 -8
- package/docs/api/interfaces/UsePublicEventOptions.md +3 -3
- package/docs/api/interfaces/UsePublicEventReturn.md +5 -5
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +4 -4
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +9 -9
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +4 -4
- package/docs/api/interfaces/UseResolvedScopeReturn.md +4 -4
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +514 -212
- package/docs/api-reference/components.md +106 -26
- package/docs/architecture/README.md +0 -2
- package/docs/implementation-guides/data-tables.md +277 -13
- package/docs/implementation-guides/forms.md +1 -16
- package/docs/implementation-guides/permission-enforcement.md +8 -2
- package/examples/README.md +30 -14
- package/examples/STRUCTURE.md +125 -0
- package/examples/components/DataTable/HierarchicalActionsExample.tsx +421 -0
- package/examples/components/DataTable/HierarchicalExample.tsx +475 -0
- package/examples/components/DataTable/InitialPageSizeExample.tsx +177 -0
- package/examples/components/DataTable/PerformanceExample.tsx +506 -0
- package/examples/components/DataTable/index.ts +13 -0
- package/examples/components/Dialog/BasicHtmlTest.tsx +55 -0
- package/examples/components/Dialog/DebugHtmlExample.tsx +68 -0
- package/examples/components/Dialog/HtmlDialogExample.tsx +202 -0
- package/examples/components/Dialog/ScrollableDialogExample.tsx +290 -0
- package/examples/components/Dialog/SimpleHtmlTest.tsx +61 -0
- package/examples/components/Dialog/SmartDialogExample.tsx +322 -0
- package/examples/components/Dialog/index.ts +15 -0
- package/examples/components/index.ts +11 -0
- package/examples/features/index.ts +12 -0
- package/examples/{public-pages → features/public-pages}/CorrectPublicPageImplementation.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicEventPage.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicPageApp.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicPageUsageExample.tsx +1 -1
- package/examples/index.ts +11 -3
- package/package.json +30 -10
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/DataTable/DataTable.test.tsx +1 -1
- package/src/components/DataTable/DataTable.tsx +1 -30
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +562 -0
- package/src/components/DataTable/__tests__/styles.test.ts +2 -2
- package/src/components/DataTable/components/ActionButtons.tsx +0 -15
- package/src/components/DataTable/components/DataTableCore.tsx +4 -185
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +1 -1
- package/src/components/DataTable/components/DataTableModals.tsx +1 -27
- package/src/components/DataTable/components/EditableRow.tsx +1 -1
- package/src/components/DataTable/components/ImportModal.tsx +2 -14
- package/src/components/DataTable/components/PaginationControls.tsx +1 -1
- package/src/components/DataTable/components/UnifiedTableBody.tsx +109 -82
- package/src/components/DataTable/components/__tests__/ActionButtons.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +1 -1
- package/src/components/DataTable/examples/GroupingAggregationExample.tsx +273 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +1 -1
- package/src/components/DataTable/examples/__tests__/HierarchicalActionsExample.test.tsx +1 -1
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +2 -23
- package/src/components/DataTable/index.ts +4 -0
- package/src/components/DataTable/styles.ts +1 -1
- package/src/components/DataTable/types.ts +13 -0
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +1 -1
- package/src/components/DataTable/utils/aggregationUtils.ts +161 -0
- package/src/components/DataTable/utils/exportUtils.ts +1 -1
- package/src/components/DataTable/utils/flexibleImport.ts +1 -11
- package/src/components/DataTable/utils/index.ts +1 -0
- package/src/components/DataTable/utils/paginationUtils.ts +1 -1
- package/src/components/Dialog/Dialog.tsx +2 -2
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +35 -7
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +5 -4
- package/src/components/EventSelector/EventSelector.tsx +3 -2
- package/src/components/FileDisplay/FileDisplay.tsx +2 -36
- package/src/components/FileUpload/FileUpload.test.tsx +2 -2
- package/src/components/FileUpload/FileUpload.tsx +2 -2
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Form/Form.test.tsx +4 -509
- package/src/components/Form/Form.tsx +1 -1
- package/src/components/Form/FormField.tsx +1 -1
- package/src/components/Form/index.ts +0 -12
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoginForm/LoginForm.tsx +1 -1
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -3
- package/src/components/NavigationMenu/NavigationMenu.tsx +9 -8
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +4 -3
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +14 -12
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +0 -16
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +0 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +0 -9
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +35 -3
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +13 -12
- package/src/components/PasswordReset/PasswordChangeForm.tsx +1 -1
- package/src/components/PasswordReset/index.ts +0 -2
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +35 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +3 -2
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +1 -1
- package/src/components/PublicLayout/PublicLoadingSpinner.tsx +1 -1
- package/src/components/PublicLayout/PublicPageContextChecker.tsx +44 -43
- package/src/components/PublicLayout/PublicPageFooter.tsx +1 -1
- package/src/components/PublicLayout/PublicPageHeader.tsx +1 -15
- package/src/components/PublicLayout/PublicPageProvider.tsx +3 -2
- package/src/components/PublicLayout/__tests__/PublicPageContextChecker.test.tsx +2 -0
- package/src/components/PublicLayout/index.ts +4 -2
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/{SessionRestorationLoader.tsx → SessionRestorationLoader/SessionRestorationLoader.tsx} +3 -2
- package/src/components/SessionRestorationLoader/index.ts +3 -0
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/index.ts +4 -10
- package/src/hooks/__tests__/hooks.integration.test.tsx +37 -22
- package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +33 -17
- package/src/hooks/__tests__/useDataTablePerformance.unit.test.ts +28 -3
- package/src/hooks/__tests__/useFileDisplay.unit.test.ts +36 -9
- package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +26 -2
- package/src/hooks/__tests__/usePerformanceMonitor.unit.test.ts +19 -6
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +17 -4
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +17 -4
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +26 -6
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +16 -6
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +3 -3
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +17 -3
- package/src/hooks/public/usePublicEvent.ts +7 -6
- package/src/hooks/public/usePublicEventLogo.ts +7 -4
- package/src/hooks/public/usePublicFileDisplay.ts +6 -150
- package/src/hooks/useComponentPerformance.ts +4 -1
- package/src/hooks/useDataTablePerformance.ts +4 -3
- package/src/hooks/useEventTheme.test.ts +18 -5
- package/src/hooks/useEventTheme.ts +4 -1
- package/src/hooks/useEvents.ts +2 -0
- package/src/hooks/useFileDisplay.ts +9 -8
- package/src/hooks/useFileReference.ts +4 -1
- package/src/hooks/useFileUrl.ts +4 -1
- package/src/hooks/useInactivityTracker.ts +5 -4
- package/src/hooks/useOrganisationSecurity.test.ts +33 -12
- package/src/hooks/useOrganisationSecurity.ts +8 -7
- package/src/hooks/usePerformanceMonitor.ts +6 -3
- package/src/hooks/usePermissionCache.ts +13 -6
- package/src/hooks/useSecureDataAccess.test.ts +2 -2
- package/src/hooks/useSecureDataAccess.ts +9 -8
- package/src/hooks/useSessionRestoration.ts +4 -1
- package/src/hooks/useStorage.ts +4 -1
- package/src/index.ts +16 -7
- package/src/providers/services/AuthServiceProvider.tsx +3 -2
- package/src/providers/services/EventServiceProvider.tsx +2 -1
- package/src/providers/services/InactivityServiceProvider.tsx +2 -1
- package/src/providers/services/OrganisationServiceProvider.tsx +2 -1
- package/src/providers/services/UnifiedAuthProvider.tsx +4 -3
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +22 -2
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +24 -2
- package/src/rbac/__tests__/cache-invalidation.test.ts +20 -6
- package/src/rbac/api.ts +5 -2
- package/src/rbac/audit-enhanced.ts +6 -6
- package/src/rbac/audit.test.ts +60 -38
- package/src/rbac/audit.ts +8 -8
- package/src/rbac/cache-invalidation.ts +7 -4
- package/src/rbac/components/EnhancedNavigationMenu.tsx +11 -5
- package/src/rbac/components/NavigationGuard.tsx +7 -3
- package/src/rbac/components/NavigationProvider.tsx +6 -3
- package/src/rbac/components/PagePermissionGuard.tsx +28 -16
- package/src/rbac/components/PagePermissionProvider.tsx +4 -1
- package/src/rbac/components/PermissionEnforcer.tsx +9 -3
- package/src/rbac/components/RoleBasedRouter.tsx +3 -1
- package/src/rbac/components/SecureDataProvider.tsx +7 -3
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +87 -61
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +83 -33
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +36 -13
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +2 -2
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +22 -8
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +19 -6
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +43 -17
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +42 -17
- package/src/rbac/engine.ts +15 -7
- package/src/rbac/hooks/usePermissions.ts +7 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +2 -2
- package/src/rbac/hooks/useResolvedScope.ts +10 -7
- package/src/rbac/permissions.ts +5 -2
- package/src/rbac/security.test.ts +27 -16
- package/src/rbac/security.ts +5 -4
- package/src/services/AuthService.ts +22 -21
- package/src/services/EventService.ts +12 -12
- package/src/services/InactivityService.ts +5 -4
- package/src/services/OrganisationService.ts +26 -25
- package/src/services/__tests__/AuthService.test.ts +51 -19
- package/src/services/__tests__/EventService.test.ts +37 -5
- package/src/services/__tests__/InactivityService.test.ts +38 -4
- package/src/services/__tests__/OrganisationService.test.ts +3 -8
- package/src/services/base/BaseService.ts +3 -1
- package/src/theming/__tests__/runtime.test.ts +21 -12
- package/src/theming/parseEventColours.ts +5 -19
- package/src/theming/runtime.ts +8 -4
- package/src/types/validation.ts +2 -29
- package/src/utils/__tests__/appConfig.unit.test.ts +1 -1
- package/src/utils/__tests__/audit.unit.test.ts +1 -1
- package/src/utils/__tests__/auth-utils.unit.test.ts +1 -1
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +19 -19
- package/src/utils/__tests__/cn.unit.test.ts +1 -1
- package/src/utils/__tests__/debugLogger.test.ts +1 -1
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +1 -1
- package/src/utils/__tests__/dynamicUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/formatting.unit.test.ts +1 -1
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +1 -1
- package/src/utils/__tests__/logger.unit.test.ts +1 -1
- package/src/utils/__tests__/organisationContext.unit.test.ts +1 -1
- package/src/utils/__tests__/performanceBenchmark.test.ts +1 -1
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionTypes.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/sanitization.unit.test.ts +1 -1
- package/src/utils/__tests__/schemaUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/secureDataAccess.unit.test.ts +1 -1
- package/src/utils/__tests__/secureErrors.unit.test.ts +33 -15
- package/src/utils/__tests__/secureStorage.unit.test.ts +1 -1
- package/src/utils/__tests__/security.unit.test.ts +40 -18
- package/src/utils/__tests__/securityMonitor.unit.test.ts +1 -1
- package/src/utils/__tests__/sessionTracking.unit.test.ts +40 -29
- package/src/utils/__tests__/validationUtils.unit.test.ts +19 -6
- package/src/utils/{appIdResolver.test.ts → app/appIdResolver.test.ts} +28 -30
- package/src/utils/{appIdResolver.ts → app/appIdResolver.ts} +8 -5
- package/src/utils/{appNameResolver.test.ts → app/appNameResolver.test.ts} +1 -1
- package/src/utils/{appNameResolver.ts → app/appNameResolver.ts} +5 -1
- package/src/utils/{organisationContext.ts → context/organisationContext.ts} +6 -3
- package/src/utils/{sessionTracking.ts → context/sessionTracking.ts} +11 -12
- package/src/utils/{logger.ts → core/logger.ts} +4 -2
- package/src/utils/{deviceFingerprint.ts → device/deviceFingerprint.ts} +1 -1
- package/src/utils/{lazyLoad.tsx → dynamic/lazyLoad.tsx} +2 -2
- package/src/utils/{file-reference.test.ts → file-reference/__tests__/file-reference.test.ts} +5 -5
- package/src/utils/{file-reference.ts → file-reference/index.ts} +20 -38
- package/src/utils/index.ts +32 -54
- package/src/utils/{secureErrors.ts → security/secureErrors.ts} +6 -3
- package/src/utils/{security.ts → security/security.ts} +5 -2
- package/src/utils/storage/__tests__/helpers.unit.test.ts +1 -4
- package/src/utils/storage/helpers.ts +15 -8
- package/src/{components/Dialog/utils/__tests__/safeHtml.unit.test.ts → utils/validation/__tests__/htmlSanitization.unit.test.ts} +9 -15
- package/src/{validation → utils/validation}/csrf.ts +1 -1
- package/src/{components/Dialog/utils/safeHtml.ts → utils/validation/htmlSanitization.ts} +9 -10
- package/src/utils/validation/index.ts +79 -0
- package/src/utils/{sanitization.ts → validation/sanitization.ts} +71 -2
- package/src/{validation/schemaUtils.ts → utils/validation/schema.ts} +11 -6
- package/src/{validation → utils/validation}/sqlInjectionProtection.ts +2 -0
- package/src/utils/{validationUtils.ts → validation/validationUtils.ts} +4 -1
- package/src/validation/index.ts +3 -34
- package/dist/UnifiedAuthProvider-CQDZRJIS.js +0 -16
- package/dist/chunk-24MKLB7U.js +0 -81
- package/dist/chunk-24MKLB7U.js.map +0 -1
- package/dist/chunk-3CG5L6RN.js.map +0 -1
- package/dist/chunk-3DBFLLLU.js.map +0 -1
- package/dist/chunk-5F3NDPJV.js.map +0 -1
- package/dist/chunk-66C4BSAY.js.map +0 -1
- package/dist/chunk-BDZUMRBD.js.map +0 -1
- package/dist/chunk-BYXRHAIF.js.map +0 -1
- package/dist/chunk-CDQ3PX7L.js +0 -18
- package/dist/chunk-CDQ3PX7L.js.map +0 -1
- package/dist/chunk-CQZU6TFE.js.map +0 -1
- package/dist/chunk-F64FFPOZ.js.map +0 -1
- package/dist/chunk-GEVIB2UB.js.map +0 -1
- package/dist/chunk-GKHF54DI.js.map +0 -1
- package/dist/chunk-GVDR7WNV.js.map +0 -1
- package/dist/chunk-HMNOSGVA.js.map +0 -1
- package/dist/chunk-JCQZ6LA7.js.map +0 -1
- package/dist/chunk-M6DDYFUD.js.map +0 -1
- package/dist/chunk-O3NWNXDY.js.map +0 -1
- package/dist/chunk-PYUXFQJ3.js.map +0 -1
- package/dist/chunk-UJI6WSMD.js.map +0 -1
- package/dist/chunk-VZ5OR6HD.js.map +0 -1
- package/dist/chunk-WP5I5GLN.js.map +0 -1
- package/dist/chunk-ZYZCRSBD.js.map +0 -1
- package/src/components/Dialog/README.md +0 -804
- package/src/components/Form/FormErrorSummary.tsx +0 -113
- package/src/components/Form/FormFieldset.tsx +0 -127
- package/src/components/Form/FormLiveRegion.tsx +0 -198
- package/src/components/PasswordReset/PasswordResetForm.test.tsx +0 -597
- package/src/components/PasswordReset/PasswordResetForm.tsx +0 -201
- package/src/components/PublicLayout/PublicPageDebugger.tsx +0 -104
- package/src/components/PublicLayout/PublicPageDiagnostic.tsx +0 -162
- package/src/components/PublicLayout/__tests__/PublicPageDebugger.test.tsx +0 -185
- package/src/examples/CorrectPublicPageImplementation.tsx +0 -304
- package/src/examples/PublicEventPage.tsx +0 -287
- package/src/examples/PublicPageApp.tsx +0 -321
- package/src/examples/PublicPageUsageExample.tsx +0 -218
- package/src/utils/schemaUtils.ts +0 -37
- package/src/validation/__tests__/common.unit.test.ts +0 -101
- package/src/validation/__tests__/csrf.unit.test.ts +0 -365
- package/src/validation/__tests__/passwordSchema.unit.test.ts +0 -203
- package/src/validation/__tests__/sanitization.unit.test.ts +0 -250
- package/src/validation/__tests__/schemaUtils.unit.test.ts +0 -451
- package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +0 -462
- package/src/validation/__tests__/user.unit.test.ts +0 -440
- package/src/validation/sanitization.ts +0 -96
- /package/dist/{DataTable-A36PJG6N.js.map → DataTable-CYOHOX3O.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-CQDZRJIS.js.map → UnifiedAuthProvider-5E5TUNMS.js.map} +0 -0
- /package/dist/{api-TNIBJWLM.js.map → api-45XYYO2A.js.map} +0 -0
- /package/dist/{audit-T36HM7IM.js.map → audit-64X3VJXB.js.map} +0 -0
- /package/dist/{chunk-CTJRBUX2.js.map → chunk-2TWNJ46Y.js.map} +0 -0
- /package/dist/{chunk-ZV77RZMU.js.map → chunk-XARJS7CD.js.map} +0 -0
- /package/dist/{useInactivityTracker-MRUU55XI.js.map → useInactivityTracker-TO6ZOF35.js.map} +0 -0
- /package/examples/{public-pages → features/public-pages}/index.ts +0 -0
- /package/examples/{RBAC → features/rbac}/CompleteRBACExample.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/EventBasedApp.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/PermissionExample.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/index.ts +0 -0
- /package/src/utils/{appConfig.ts → app/appConfig.ts} +0 -0
- /package/src/utils/{appNameResolver.simple.test.ts → app/appNameResolver.simple.test.ts} +0 -0
- /package/src/utils/{audit.ts → audit/audit.ts} +0 -0
- /package/src/utils/{organisationContext.test.ts → context/organisationContext.test.ts} +0 -0
- /package/src/utils/{cn.ts → core/cn.ts} +0 -0
- /package/src/utils/{debugLogger.ts → core/debugLogger.ts} +0 -0
- /package/src/utils/{dynamicUtils.ts → dynamic/dynamicUtils.ts} +0 -0
- /package/src/utils/{formatDate.test.ts → formatting/formatDate.test.ts} +0 -0
- /package/src/utils/{formatting.ts → formatting/formatting.ts} +0 -0
- /package/src/utils/{bundleAnalysis.ts → performance/bundleAnalysis.ts} +0 -0
- /package/src/utils/{performanceBenchmark.ts → performance/performanceBenchmark.ts} +0 -0
- /package/src/utils/{performanceBudgets.ts → performance/performanceBudgets.ts} +0 -0
- /package/src/utils/{permissionTypes.ts → permissions/permissionTypes.ts} +0 -0
- /package/src/utils/{permissionUtils.test.ts → permissions/permissionUtils.test.ts} +0 -0
- /package/src/utils/{permissionUtils.ts → permissions/permissionUtils.ts} +0 -0
- /package/src/utils/{auth-utils.ts → security/auth-utils.ts} +0 -0
- /package/src/utils/{secureDataAccess.test.ts → security/secureDataAccess.test.ts} +0 -0
- /package/src/utils/{secureDataAccess.ts → security/secureDataAccess.ts} +0 -0
- /package/src/utils/{secureStorage.ts → security/secureStorage.ts} +0 -0
- /package/src/utils/{securityMonitor.ts → security/securityMonitor.ts} +0 -0
- /package/src/{validation → utils/validation}/common.ts +0 -0
- /package/src/{validation → utils/validation}/passwordSchema.ts +0 -0
- /package/src/{validation → utils/validation}/user.ts +0 -0
- /package/src/utils/{validation.ts → validation/validation.ts} +0 -0
|
@@ -12,6 +12,20 @@ import { getAppId, getAppIds, CachedAppIdResolver } from './appIdResolver';
|
|
|
12
12
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
13
13
|
import type { Database } from '../types/database';
|
|
14
14
|
|
|
15
|
+
// Mock the Logger module
|
|
16
|
+
vi.mock('../core/logger', () => {
|
|
17
|
+
const mockLoggerInstance = {
|
|
18
|
+
error: vi.fn(),
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
createLogger: vi.fn(() => mockLoggerInstance),
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Get the mock instance after mock is set up
|
|
26
|
+
import { createLogger } from '../core/logger';
|
|
27
|
+
const getMockLogger = () => createLogger('test');
|
|
28
|
+
|
|
15
29
|
// Mock Supabase client
|
|
16
30
|
const createMockSupabaseClient = () => {
|
|
17
31
|
const queryBuilder = {
|
|
@@ -44,6 +58,8 @@ describe('App ID Resolver', () => {
|
|
|
44
58
|
vi.clearAllMocks();
|
|
45
59
|
mockSupabase = createMockSupabaseClient();
|
|
46
60
|
mockQueryBuilder = mockSupabase.queryBuilder;
|
|
61
|
+
const logger = getMockLogger();
|
|
62
|
+
vi.mocked(logger.error).mockClear();
|
|
47
63
|
});
|
|
48
64
|
|
|
49
65
|
describe('getAppId', () => {
|
|
@@ -79,35 +95,29 @@ describe('App ID Resolver', () => {
|
|
|
79
95
|
error: { message: 'Database error' }
|
|
80
96
|
});
|
|
81
97
|
|
|
82
|
-
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
83
|
-
|
|
84
98
|
const result = await getAppId(mockSupabase as any, 'MY_APP');
|
|
85
99
|
|
|
86
100
|
expect(result).toBeNull();
|
|
87
|
-
|
|
101
|
+
const logger = getMockLogger();
|
|
102
|
+
expect(vi.mocked(logger.error)).toHaveBeenCalledWith(
|
|
88
103
|
'Failed to resolve app ID for app name:',
|
|
89
104
|
'MY_APP',
|
|
90
105
|
{ message: 'Database error' }
|
|
91
106
|
);
|
|
92
|
-
|
|
93
|
-
consoleSpy.mockRestore();
|
|
94
107
|
});
|
|
95
108
|
|
|
96
109
|
it('handles exceptions gracefully', async () => {
|
|
97
110
|
mockQueryBuilder.single.mockRejectedValue(new Error('Network error'));
|
|
98
111
|
|
|
99
|
-
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
100
|
-
|
|
101
112
|
const result = await getAppId(mockSupabase as any, 'MY_APP');
|
|
102
113
|
|
|
103
114
|
expect(result).toBeNull();
|
|
104
|
-
|
|
115
|
+
const logger = getMockLogger();
|
|
116
|
+
expect(vi.mocked(logger.error)).toHaveBeenCalledWith(
|
|
105
117
|
'Error resolving app ID for app name:',
|
|
106
118
|
'MY_APP',
|
|
107
119
|
expect.any(Error)
|
|
108
120
|
);
|
|
109
|
-
|
|
110
|
-
consoleSpy.mockRestore();
|
|
111
121
|
});
|
|
112
122
|
|
|
113
123
|
it('handles null/undefined app name', async () => {
|
|
@@ -199,18 +209,15 @@ describe('App ID Resolver', () => {
|
|
|
199
209
|
mockQueryBuilder.or.mockReturnValue(mockChain);
|
|
200
210
|
mockQueryBuilder.eq.mockReturnValue(mockChain);
|
|
201
211
|
|
|
202
|
-
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
203
|
-
|
|
204
212
|
const result = await getAppIds(mockSupabase as any, ['MY_APP', 'ANOTHER_APP']);
|
|
205
213
|
|
|
206
214
|
expect(result).toEqual({});
|
|
207
|
-
|
|
215
|
+
const logger = getMockLogger();
|
|
216
|
+
expect(vi.mocked(logger.error)).toHaveBeenCalledWith(
|
|
208
217
|
'Failed to resolve app IDs for app names:',
|
|
209
218
|
['MY_APP', 'ANOTHER_APP'],
|
|
210
219
|
{ message: 'Database error' }
|
|
211
220
|
);
|
|
212
|
-
|
|
213
|
-
consoleSpy.mockRestore();
|
|
214
221
|
});
|
|
215
222
|
|
|
216
223
|
it('handles exceptions gracefully', async () => {
|
|
@@ -224,18 +231,15 @@ describe('App ID Resolver', () => {
|
|
|
224
231
|
mockQueryBuilder.or.mockReturnValue(mockChain);
|
|
225
232
|
mockQueryBuilder.eq.mockReturnValue(mockChain);
|
|
226
233
|
|
|
227
|
-
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
228
|
-
|
|
229
234
|
const result = await getAppIds(mockSupabase as any, ['MY_APP', 'ANOTHER_APP']);
|
|
230
235
|
|
|
231
236
|
expect(result).toEqual({});
|
|
232
|
-
|
|
237
|
+
const logger = getMockLogger();
|
|
238
|
+
expect(vi.mocked(logger.error)).toHaveBeenCalledWith(
|
|
233
239
|
'Error resolving app IDs for app names:',
|
|
234
240
|
['MY_APP', 'ANOTHER_APP'],
|
|
235
241
|
expect.any(Error)
|
|
236
242
|
);
|
|
237
|
-
|
|
238
|
-
consoleSpy.mockRestore();
|
|
239
243
|
});
|
|
240
244
|
|
|
241
245
|
it('handles null/undefined app names array', async () => {
|
|
@@ -304,18 +308,15 @@ describe('App ID Resolver', () => {
|
|
|
304
308
|
error: { message: 'Database error' }
|
|
305
309
|
});
|
|
306
310
|
|
|
307
|
-
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
308
|
-
|
|
309
311
|
const result = await resolver.getAppId(mockSupabase as any, 'MY_APP');
|
|
310
312
|
|
|
311
313
|
expect(result).toBeNull();
|
|
312
|
-
|
|
314
|
+
const logger = getMockLogger();
|
|
315
|
+
expect(vi.mocked(logger.error)).toHaveBeenCalledWith(
|
|
313
316
|
'Failed to resolve app ID for app name:',
|
|
314
317
|
'MY_APP',
|
|
315
318
|
{ message: 'Database error' }
|
|
316
319
|
);
|
|
317
|
-
|
|
318
|
-
consoleSpy.mockRestore();
|
|
319
320
|
});
|
|
320
321
|
|
|
321
322
|
it('clears cache correctly', async () => {
|
|
@@ -412,18 +413,15 @@ describe('App ID Resolver', () => {
|
|
|
412
413
|
it('handles network timeouts', async () => {
|
|
413
414
|
mockQueryBuilder.single.mockRejectedValue(new Error('Request timeout'));
|
|
414
415
|
|
|
415
|
-
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
416
|
-
|
|
417
416
|
const result = await getAppId(mockSupabase as any, 'MY_APP');
|
|
418
417
|
|
|
419
418
|
expect(result).toBeNull();
|
|
420
|
-
|
|
419
|
+
const logger = getMockLogger();
|
|
420
|
+
expect(vi.mocked(logger.error)).toHaveBeenCalledWith(
|
|
421
421
|
'Error resolving app ID for app name:',
|
|
422
422
|
'MY_APP',
|
|
423
423
|
expect.any(Error)
|
|
424
424
|
);
|
|
425
|
-
|
|
426
|
-
consoleSpy.mockRestore();
|
|
427
425
|
});
|
|
428
426
|
|
|
429
427
|
it('handles malformed responses', async () => {
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
11
|
-
import type { Database } from '
|
|
11
|
+
import type { Database } from '../../types/database';
|
|
12
|
+
import { createLogger } from '../core/logger';
|
|
13
|
+
|
|
14
|
+
const log = createLogger('AppIdResolver');
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Resolves an app name to its corresponding app ID
|
|
@@ -30,13 +33,13 @@ export async function getAppId(
|
|
|
30
33
|
.single();
|
|
31
34
|
|
|
32
35
|
if (error) {
|
|
33
|
-
|
|
36
|
+
log.error('Failed to resolve app ID for app name:', appName, error);
|
|
34
37
|
return null;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
return (data as { id: string } | null)?.id || null;
|
|
38
41
|
} catch (error) {
|
|
39
|
-
|
|
42
|
+
log.error('Error resolving app ID for app name:', appName, error);
|
|
40
43
|
return null;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -64,7 +67,7 @@ export async function getAppIds(
|
|
|
64
67
|
.eq('is_active', true);
|
|
65
68
|
|
|
66
69
|
if (error) {
|
|
67
|
-
|
|
70
|
+
log.error('Failed to resolve app IDs for app names:', appNames, error);
|
|
68
71
|
return {};
|
|
69
72
|
}
|
|
70
73
|
|
|
@@ -88,7 +91,7 @@ export async function getAppIds(
|
|
|
88
91
|
|
|
89
92
|
return result;
|
|
90
93
|
} catch (error) {
|
|
91
|
-
|
|
94
|
+
log.error('Error resolving app IDs for app names:', appNames, error);
|
|
92
95
|
return {};
|
|
93
96
|
}
|
|
94
97
|
}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* Priority: package.json > environment variables > fallback
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { createLogger } from '../core/logger';
|
|
7
|
+
|
|
8
|
+
const log = createLogger('AppNameResolver');
|
|
9
|
+
|
|
6
10
|
interface PackageJson {
|
|
7
11
|
name: string;
|
|
8
12
|
[key: string]: any;
|
|
@@ -49,7 +53,7 @@ export function getAppNameFromPackageJson(): string | null {
|
|
|
49
53
|
}
|
|
50
54
|
} catch (error) {
|
|
51
55
|
// package.json not found or not readable
|
|
52
|
-
|
|
56
|
+
log.warn('Could not read app name from package.json:', error);
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
12
|
+
import { createLogger } from '../core/logger';
|
|
13
|
+
|
|
14
|
+
const log = createLogger('organisationContext');
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Set organisation context in the database session
|
|
@@ -45,14 +48,14 @@ export async function setOrganisationContext(
|
|
|
45
48
|
if (error) {
|
|
46
49
|
// Function might not exist yet - this is expected during migration
|
|
47
50
|
// Silent fail - will fall back to client-side filtering
|
|
48
|
-
|
|
51
|
+
log.debug('RPC function not available or failed, continuing without database context');
|
|
49
52
|
} else {
|
|
50
|
-
|
|
53
|
+
log.debug('Organisation context set in database successfully');
|
|
51
54
|
}
|
|
52
55
|
} catch (error) {
|
|
53
56
|
// Handle any other errors gracefully
|
|
54
57
|
// Silent fail - will fall back to client-side filtering
|
|
55
|
-
|
|
58
|
+
log.debug('Failed to set database context, continuing without it:', error);
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
+
import { createLogger } from '../core/logger';
|
|
3
|
+
|
|
4
|
+
const log = createLogger('SessionTracking');
|
|
2
5
|
|
|
3
6
|
// Define the tracking parameters locally since old RBAC types are removed
|
|
4
7
|
interface TrackUserSessionParams {
|
|
@@ -33,13 +36,13 @@ export function useSessionTracking(supabaseClient: SupabaseClient, appName?: str
|
|
|
33
36
|
.single();
|
|
34
37
|
|
|
35
38
|
if (error || !data) {
|
|
36
|
-
|
|
39
|
+
log.warn('App not found or inactive:', appName);
|
|
37
40
|
return undefined;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
return data.id;
|
|
41
44
|
} catch (error) {
|
|
42
|
-
|
|
45
|
+
log.error('Failed to resolve app ID:', error);
|
|
43
46
|
return undefined;
|
|
44
47
|
}
|
|
45
48
|
};
|
|
@@ -51,7 +54,7 @@ export function useSessionTracking(supabaseClient: SupabaseClient, appName?: str
|
|
|
51
54
|
try {
|
|
52
55
|
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
53
56
|
if (!user) {
|
|
54
|
-
|
|
57
|
+
log.warn('No authenticated user found for session tracking');
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -73,12 +76,10 @@ export function useSessionTracking(supabaseClient: SupabaseClient, appName?: str
|
|
|
73
76
|
});
|
|
74
77
|
|
|
75
78
|
if (error) {
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
console.log('Event switch session tracked successfully');
|
|
79
|
+
log.error('Failed to track event switch session:', error);
|
|
79
80
|
}
|
|
80
81
|
} catch (error) {
|
|
81
|
-
|
|
82
|
+
log.error('Failed to track event switch:', error);
|
|
82
83
|
}
|
|
83
84
|
};
|
|
84
85
|
|
|
@@ -89,7 +90,7 @@ export function useSessionTracking(supabaseClient: SupabaseClient, appName?: str
|
|
|
89
90
|
try {
|
|
90
91
|
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
91
92
|
if (!user) {
|
|
92
|
-
|
|
93
|
+
log.warn('No authenticated user found for session tracking');
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -110,12 +111,10 @@ export function useSessionTracking(supabaseClient: SupabaseClient, appName?: str
|
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
if (error) {
|
|
113
|
-
|
|
114
|
-
} else {
|
|
115
|
-
console.log('Session expiration tracked successfully');
|
|
114
|
+
log.error('Failed to track session expiration:', error);
|
|
116
115
|
}
|
|
117
116
|
} catch (error) {
|
|
118
|
-
|
|
117
|
+
log.error('Failed to track session expiration:', error);
|
|
119
118
|
}
|
|
120
119
|
};
|
|
121
120
|
|
|
@@ -41,10 +41,12 @@ export class Logger {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Check if we're in development mode
|
|
44
|
+
* Check if we're in development or test mode
|
|
45
|
+
* Allows logging in both development and test environments
|
|
45
46
|
*/
|
|
46
47
|
private static get isDevelopment(): boolean {
|
|
47
|
-
|
|
48
|
+
const mode = import.meta.env.MODE;
|
|
49
|
+
return mode === 'development' || mode === 'test';
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Suspense, ComponentType, lazy } from 'react';
|
|
2
|
-
import { LoadingSpinner } from '
|
|
2
|
+
import { LoadingSpinner } from '../../components/LoadingSpinner/LoadingSpinner';
|
|
3
3
|
|
|
4
4
|
interface LazyLoadOptions {
|
|
5
5
|
fallback?: React.ReactNode;
|
|
@@ -39,6 +39,6 @@ export function createLazyComponent<T extends ComponentType<any>>(
|
|
|
39
39
|
* Lazy-loaded DataTable component
|
|
40
40
|
*/
|
|
41
41
|
export const LazyDataTable = createLazyComponent(
|
|
42
|
-
() => import('
|
|
42
|
+
() => import('../../components/DataTable').then(module => ({ default: module.DataTable })),
|
|
43
43
|
'DataTable'
|
|
44
44
|
);
|
package/src/utils/{file-reference.test.ts → file-reference/__tests__/file-reference.test.ts}
RENAMED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { vi } from 'vitest';
|
|
7
|
-
import { FileReferenceServiceImpl, createFileReferenceService, uploadFileWithReference } from '
|
|
8
|
-
import { FileCategory } from '
|
|
9
|
-
import { createMockSupabaseClient } from '
|
|
7
|
+
import { FileReferenceServiceImpl, createFileReferenceService, uploadFileWithReference } from '../index';
|
|
8
|
+
import { FileCategory } from '../../../types/file-reference';
|
|
9
|
+
import { createMockSupabaseClient } from '../../../__tests__/helpers/test-utils';
|
|
10
10
|
|
|
11
11
|
// Mock dependencies
|
|
12
|
-
import * as organisationContext from '
|
|
13
|
-
import * as storageHelpers from '
|
|
12
|
+
import * as organisationContext from '../../context/organisationContext';
|
|
13
|
+
import * as storageHelpers from '../../storage/helpers';
|
|
14
14
|
|
|
15
15
|
const mockSetOrganisationContext = vi.fn();
|
|
16
16
|
const mockUploadFile = vi.fn();
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
FileReferenceService,
|
|
9
9
|
FileUploadResult,
|
|
10
10
|
FileCategory
|
|
11
|
-
} from '
|
|
12
|
-
import { uploadFile, getPublicUrl, getSignedUrl, deleteFile, extractFileMetadata } from '
|
|
13
|
-
import { setOrganisationContext } from '
|
|
14
|
-
import { invalidateFileDisplayCache } from '
|
|
11
|
+
} from '../../types/file-reference';
|
|
12
|
+
import { uploadFile, getPublicUrl, getSignedUrl, deleteFile, extractFileMetadata } from '../storage/helpers';
|
|
13
|
+
import { setOrganisationContext } from '../context/organisationContext';
|
|
14
|
+
import { invalidateFileDisplayCache } from '../../hooks/useFileDisplay';
|
|
15
|
+
import { createLogger } from '../core/logger';
|
|
16
|
+
|
|
17
|
+
const log = createLogger('FileReferenceService');
|
|
15
18
|
|
|
16
19
|
export class FileReferenceServiceImpl implements FileReferenceService {
|
|
17
20
|
constructor(private supabase: SupabaseClient) {}
|
|
@@ -121,7 +124,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
121
124
|
|
|
122
125
|
return fileRef as FileReference;
|
|
123
126
|
} catch (error) {
|
|
124
|
-
|
|
127
|
+
log.error('Error creating file reference:', error);
|
|
125
128
|
throw error;
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -145,7 +148,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
145
148
|
|
|
146
149
|
return data as FileReference;
|
|
147
150
|
} catch (error) {
|
|
148
|
-
|
|
151
|
+
log.error('Error getting file reference:', error);
|
|
149
152
|
throw error;
|
|
150
153
|
}
|
|
151
154
|
}
|
|
@@ -178,7 +181,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
178
181
|
return await this.getSignedUrl(table_name, record_id, organisation_id);
|
|
179
182
|
}
|
|
180
183
|
} catch (error) {
|
|
181
|
-
|
|
184
|
+
log.error('Error getting file URL:', error);
|
|
182
185
|
throw error;
|
|
183
186
|
}
|
|
184
187
|
}
|
|
@@ -211,7 +214,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
211
214
|
|
|
212
215
|
return signedUrlResult?.url || null;
|
|
213
216
|
} catch (error) {
|
|
214
|
-
|
|
217
|
+
log.error('Error getting signed URL:', error);
|
|
215
218
|
throw error;
|
|
216
219
|
}
|
|
217
220
|
}
|
|
@@ -231,7 +234,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
231
234
|
|
|
232
235
|
return data as FileReference;
|
|
233
236
|
} catch (error) {
|
|
234
|
-
|
|
237
|
+
log.error('Error updating file reference:', error);
|
|
235
238
|
throw error;
|
|
236
239
|
}
|
|
237
240
|
}
|
|
@@ -260,7 +263,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
260
263
|
|
|
261
264
|
return true;
|
|
262
265
|
} catch (error) {
|
|
263
|
-
|
|
266
|
+
log.error('Error deleting file reference:', error);
|
|
264
267
|
throw error;
|
|
265
268
|
}
|
|
266
269
|
}
|
|
@@ -296,7 +299,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
296
299
|
|
|
297
300
|
return (fullData || []) as FileReference[];
|
|
298
301
|
} catch (error) {
|
|
299
|
-
|
|
302
|
+
log.error('Error listing file references:', error);
|
|
300
303
|
throw error;
|
|
301
304
|
}
|
|
302
305
|
}
|
|
@@ -316,7 +319,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
316
319
|
|
|
317
320
|
return data || 0;
|
|
318
321
|
} catch (error) {
|
|
319
|
-
|
|
322
|
+
log.error('Error getting file count:', error);
|
|
320
323
|
throw error;
|
|
321
324
|
}
|
|
322
325
|
}
|
|
@@ -339,7 +342,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
339
342
|
|
|
340
343
|
return data[0] as FileReference;
|
|
341
344
|
} catch (error) {
|
|
342
|
-
|
|
345
|
+
log.error('Error getting file reference by ID:', error);
|
|
343
346
|
throw error;
|
|
344
347
|
}
|
|
345
348
|
}
|
|
@@ -354,12 +357,6 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
354
357
|
// CRITICAL: Use RPC function to get files by category - this correctly filters on file_metadata->>'category'
|
|
355
358
|
// NOTE: We MUST use RPC function. Direct queries with .eq('category', ...) will FAIL with HTTP 406
|
|
356
359
|
// because there is NO 'category' column. The category is stored in the JSONB file_metadata field.
|
|
357
|
-
console.log('[FileReferenceService.getFilesByCategory] Calling RPC function:', {
|
|
358
|
-
table_name,
|
|
359
|
-
record_id,
|
|
360
|
-
category,
|
|
361
|
-
organisation_id
|
|
362
|
-
});
|
|
363
360
|
const { data, error } = await this.supabase
|
|
364
361
|
.rpc('data_file_reference_by_category_list', {
|
|
365
362
|
p_table_name: table_name,
|
|
@@ -370,7 +367,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
370
367
|
|
|
371
368
|
if (error) {
|
|
372
369
|
// Provide clear error message about category filtering
|
|
373
|
-
|
|
370
|
+
log.error('RPC ERROR getting files by category:', {
|
|
374
371
|
error,
|
|
375
372
|
errorCode: error.code,
|
|
376
373
|
errorMessage: error.message,
|
|
@@ -387,14 +384,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
387
384
|
// RPC returns partial data with: id, file_path, file_metadata, is_public, created_at
|
|
388
385
|
// We have table_name, record_id, organisation_id from function parameters
|
|
389
386
|
// We can construct FileReference objects directly without another query (avoiding RLS issues)
|
|
390
|
-
console.log('[FileReferenceService.getFilesByCategory] RPC response received:', {
|
|
391
|
-
dataLength: data?.length || 0,
|
|
392
|
-
data: data ? data.slice(0, 2) : null, // Log first 2 items for debugging
|
|
393
|
-
fullDataAvailable: data?.every((item: any) => item.id && item.file_path && item.file_metadata)
|
|
394
|
-
});
|
|
395
|
-
|
|
396
387
|
if (!data || data.length === 0) {
|
|
397
|
-
console.log('[FileReferenceService.getFilesByCategory] No data from RPC, returning empty array');
|
|
398
388
|
return [];
|
|
399
389
|
}
|
|
400
390
|
|
|
@@ -406,7 +396,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
406
396
|
const fileCategory = item.file_metadata?.category;
|
|
407
397
|
const matches = fileCategory === category;
|
|
408
398
|
if (!matches) {
|
|
409
|
-
|
|
399
|
+
log.warn('File category mismatch in RPC response:', {
|
|
410
400
|
fileId: item.id,
|
|
411
401
|
expectedCategory: category,
|
|
412
402
|
actualCategory: fileCategory
|
|
@@ -431,17 +421,9 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
431
421
|
return fileRef;
|
|
432
422
|
});
|
|
433
423
|
|
|
434
|
-
console.log('[FileReferenceService.getFilesByCategory] Constructed file references from RPC response:', {
|
|
435
|
-
count: fileReferences.length,
|
|
436
|
-
firstFileId: fileReferences[0]?.id,
|
|
437
|
-
firstFilePath: fileReferences[0]?.file_path,
|
|
438
|
-
firstFileIsPublic: fileReferences[0]?.is_public,
|
|
439
|
-
firstFileHasAllRequiredFields: !!(fileReferences[0]?.id && fileReferences[0]?.file_path && fileReferences[0]?.file_metadata && fileReferences[0]?.table_name && fileReferences[0]?.record_id && fileReferences[0]?.organisation_id)
|
|
440
|
-
});
|
|
441
|
-
|
|
442
424
|
return fileReferences;
|
|
443
425
|
} catch (error) {
|
|
444
|
-
|
|
426
|
+
log.error('Error getting files by category:', error);
|
|
445
427
|
throw error;
|
|
446
428
|
}
|
|
447
429
|
}
|
|
@@ -449,7 +431,7 @@ export class FileReferenceServiceImpl implements FileReferenceService {
|
|
|
449
431
|
async uploadMultipleFiles(
|
|
450
432
|
options: FileUploadOptions,
|
|
451
433
|
files: File[]
|
|
452
|
-
): Promise<import('
|
|
434
|
+
): Promise<import('../../types/file-reference').BulkUploadResult> {
|
|
453
435
|
const success: FileReference[] = [];
|
|
454
436
|
const failed: { file: File; error: string }[] = [];
|
|
455
437
|
const results: Array<{ file: File; result: FileUploadResult | null; error?: string }> = [];
|