@jmruthers/pace-core 0.5.76 → 0.5.78
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 +8 -0
- package/dist/{RBACService-C4udt_Zp.d.ts → AuthService-Df3IozMG.d.ts} +10 -118
- package/dist/{DataTable-ntgmhO2W.d.ts → DataTable-BE0OXZKQ.d.ts} +9 -2
- package/dist/{DataTable-4GAVPIEG.js → DataTable-ETGVF4Y5.js} +50 -13
- package/dist/{PublicLoadingSpinner-BiNER8F5.d.ts → PublicLoadingSpinner-CnUaz0vG.d.ts} +5 -2
- package/dist/{UnifiedAuthProvider-Bj6YCf7c.d.ts → UnifiedAuthProvider-B391Aqum.d.ts} +42 -45
- package/dist/{UnifiedAuthProvider-3NKDOSOK.js → UnifiedAuthProvider-P5SOJAQ6.js} +4 -5
- package/dist/{api-DDMUKIUD.js → api-KG4A2X7P.js} +9 -3
- package/dist/{audit-6TOCAMKO.js → audit-65VNHEV2.js} +2 -2
- package/dist/{chunk-K34IM5CT.js → chunk-2OGV6IRV.js} +196 -626
- package/dist/chunk-2OGV6IRV.js.map +1 -0
- package/dist/{chunk-NTNILOBC.js → chunk-5BO3MI5Y.js} +4 -4
- package/dist/{chunk-XLZ7U46Z.js → chunk-CVMVPYAL.js} +9 -60
- package/dist/chunk-CVMVPYAL.js.map +1 -0
- package/dist/{chunk-URUTVZ7N.js → chunk-FL4ZCQLD.js} +2 -2
- package/dist/{chunk-LW7MMEAQ.js → chunk-FT2M4R4F.js} +2 -2
- package/dist/{chunk-5BSLGBYI.js → chunk-JCQZ6LA7.js} +2 -8
- package/dist/{chunk-5BSLGBYI.js.map → chunk-JCQZ6LA7.js.map} +1 -1
- package/dist/{chunk-KHJS6VIA.js → chunk-LRQ6RBJC.js} +157 -112
- package/dist/chunk-LRQ6RBJC.js.map +1 -0
- package/dist/{chunk-WN6XJWOS.js → chunk-MNJXXD6C.js} +274 -743
- package/dist/chunk-MNJXXD6C.js.map +1 -0
- package/dist/{chunk-KK73ZB4E.js → chunk-PTR5PMPE.js} +153 -132
- package/dist/chunk-PTR5PMPE.js.map +1 -0
- package/dist/{chunk-B2WTCLCV.js → chunk-Q7APDV6H.js} +18 -8
- package/dist/chunk-Q7APDV6H.js.map +1 -0
- package/dist/{chunk-A4FUBC7B.js → chunk-QGVSOUJ2.js} +2 -4
- package/dist/{chunk-A4FUBC7B.js.map → chunk-QGVSOUJ2.js.map} +1 -1
- package/dist/{chunk-FGMFQSHX.js → chunk-S63MFSY6.js} +500 -551
- package/dist/chunk-S63MFSY6.js.map +1 -0
- package/dist/{chunk-AFGTSUAD.js → chunk-VSOKOFRF.js} +4 -4
- package/dist/chunk-WUXCWRL6.js +20 -0
- package/dist/chunk-WUXCWRL6.js.map +1 -0
- package/dist/{chunk-Y6TXWPJO.js → chunk-YVVGHRGI.js} +105 -31
- package/dist/chunk-YVVGHRGI.js.map +1 -0
- package/dist/{chunk-M5IWZRBT.js → chunk-ZMNXIJP4.js} +2187 -981
- package/dist/chunk-ZMNXIJP4.js.map +1 -0
- package/dist/components.d.ts +6 -6
- package/dist/components.js +14 -18
- package/dist/components.js.map +1 -1
- package/dist/{database-C3Szpi5J.d.ts → database-BXAfr2Y_.d.ts} +18 -0
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +8 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +19 -27
- package/dist/index.js +21 -29
- package/dist/index.js.map +1 -1
- package/dist/{organisation-BtshODVF.d.ts → organisation-D6qRDtbF.d.ts} +1 -1
- package/dist/providers.d.ts +7 -21
- package/dist/providers.js +3 -10
- package/dist/rbac/index.d.ts +71 -221
- package/dist/rbac/index.js +15 -16
- package/dist/{types-CGX9Vyf5.d.ts → types-BDg1mAGG.d.ts} +36 -6
- package/dist/types.d.ts +3 -3
- package/dist/types.js +61 -18
- package/dist/types.js.map +1 -1
- package/dist/{unified-CM7T0aTK.d.ts → unified-DQ4VcT7H.d.ts} +1 -1
- package/dist/{usePublicRouteParams-B-CumWRc.d.ts → usePublicRouteParams-BlgwXweB.d.ts} +3 -3
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +52 -9
- package/dist/utils.js.map +1 -1
- package/docs/CONTENT_AUDIT_REPORT.md +253 -0
- package/docs/DOCUMENTATION_AUDIT.md +172 -0
- package/docs/README.md +142 -147
- package/docs/STYLE_GUIDE.md +37 -0
- package/docs/api/classes/ColumnFactory.md +17 -17
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +4 -4
- package/docs/api/classes/MissingUserContextError.md +4 -4
- package/docs/api/classes/OrganisationContextRequiredError.md +4 -4
- package/docs/api/classes/PermissionDeniedError.md +5 -5
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +8 -8
- package/docs/api/classes/RBACCache.md +35 -5
- package/docs/api/classes/RBACEngine.md +49 -20
- package/docs/api/classes/RBACError.md +4 -4
- package/docs/api/classes/RBACNotInitializedError.md +4 -4
- 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 +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +11 -0
- package/docs/api/interfaces/DataTableAction.md +65 -29
- package/docs/api/interfaces/DataTableColumn.md +36 -23
- package/docs/api/interfaces/DataTableProps.md +80 -38
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventLogoProps.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 +11 -11
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- 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 +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 +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +16 -3
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +2 -2
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- 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 +94 -521
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +16 -16
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.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 +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +251 -269
- package/docs/api-reference/components.md +193 -0
- package/docs/api-reference/hooks.md +265 -0
- package/docs/api-reference/providers.md +6 -0
- package/docs/api-reference/types.md +6 -0
- package/docs/api-reference/utilities.md +207 -0
- package/docs/architecture/README.md +6 -0
- package/docs/{database-schema-requirements.md → architecture/database-schema-requirements.md} +6 -0
- package/docs/architecture/rbac-security-architecture.md +258 -0
- package/docs/architecture/services.md +9 -1
- package/docs/best-practices/README.md +6 -0
- package/docs/best-practices/accessibility.md +6 -0
- package/docs/{common-patterns.md → best-practices/common-patterns.md} +6 -0
- package/docs/best-practices/deployment.md +6 -0
- package/docs/best-practices/performance.md +475 -2
- package/docs/best-practices/security.md +6 -0
- package/docs/best-practices/testing.md +6 -0
- package/docs/core-concepts/authentication.md +6 -0
- package/docs/core-concepts/events.md +6 -0
- package/docs/core-concepts/organisations.md +6 -0
- package/docs/core-concepts/permissions.md +6 -0
- package/docs/core-concepts/rbac-system.md +8 -0
- package/docs/documentation-index.md +121 -182
- package/docs/{consuming-app-vite-config.md → getting-started/consuming-app-vite-config.md} +6 -0
- package/docs/getting-started/documentation-index.md +40 -0
- package/docs/getting-started/examples/README.md +878 -35
- package/docs/{faq.md → getting-started/faq.md} +7 -1
- package/docs/getting-started/installation-guide.md +6 -0
- package/docs/{quick-reference.md → getting-started/quick-reference.md} +6 -0
- package/docs/implementation-guides/app-layout.md +6 -0
- package/docs/implementation-guides/authentication.md +1021 -0
- package/docs/implementation-guides/component-styling.md +6 -0
- package/docs/implementation-guides/data-tables.md +1264 -2076
- package/docs/implementation-guides/dynamic-colors.md +6 -0
- package/docs/implementation-guides/event-theming-summary.md +6 -0
- package/docs/{file-reference-system.md → implementation-guides/file-reference-system.md} +6 -0
- package/docs/implementation-guides/file-upload-storage.md +6 -0
- package/docs/implementation-guides/forms.md +6 -0
- package/docs/implementation-guides/inactivity-tracking.md +6 -0
- package/docs/implementation-guides/navigation.md +6 -0
- package/docs/implementation-guides/organisation-security.md +6 -0
- package/docs/implementation-guides/permission-enforcement.md +6 -0
- package/docs/implementation-guides/public-pages-advanced.md +6 -0
- package/docs/implementation-guides/public-pages.md +6 -0
- package/docs/migration/MIGRATION_GUIDE.md +827 -351
- package/docs/migration/README.md +7 -1
- package/docs/migration/organisation-context-timing-fix.md +6 -0
- package/docs/migration/rbac-migration.md +44 -1
- package/docs/migration/service-architecture.md +6 -0
- package/docs/migration/v0.4.15-tailwind-scanning.md +6 -0
- package/docs/migration/v0.4.16-css-first-approach.md +6 -0
- package/docs/migration/v0.4.17-source-path-fix.md +6 -0
- package/docs/rbac/README-rbac-rls-integration.md +6 -0
- package/docs/rbac/README.md +6 -0
- package/docs/rbac/advanced-patterns.md +6 -0
- package/docs/rbac/api-reference.md +7 -1
- package/docs/rbac/breaking-changes-v3.md +222 -0
- package/docs/rbac/examples/rbac-rls-integration-example.md +6 -0
- package/docs/rbac/examples.md +6 -0
- package/docs/rbac/getting-started.md +6 -0
- package/docs/rbac/migration-guide.md +260 -0
- package/docs/rbac/quick-start.md +70 -13
- package/docs/rbac/rbac-rls-integration.md +6 -0
- package/docs/rbac/super-admin-guide.md +6 -0
- package/docs/rbac/troubleshooting.md +6 -0
- package/docs/security/README.md +6 -0
- package/docs/security/checklist.md +6 -0
- package/docs/styles/README.md +7 -1
- package/docs/{usage.md → styles/usage.md} +6 -0
- package/docs/testing/README.md +6 -0
- package/docs/{visual-testing.md → testing/visual-testing.md} +6 -0
- package/docs/troubleshooting/README.md +387 -5
- package/docs/troubleshooting/cake-page-permission-guard-issue-summary.md +6 -0
- package/docs/troubleshooting/common-issues.md +6 -0
- package/docs/troubleshooting/database-view-compatibility.md +6 -0
- package/docs/troubleshooting/organisation-context-setup.md +6 -0
- package/docs/troubleshooting/react-hooks-issue-analysis.md +6 -0
- package/docs/troubleshooting/styling-issues.md +6 -0
- package/docs/troubleshooting/tailwind-content-scanning.md +6 -0
- package/package.json +1 -1
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -1
- package/src/__tests__/helpers/test-providers.tsx +3 -53
- package/src/components/DataTable/DataTable.test.tsx +319 -0
- package/src/components/DataTable/DataTable.tsx +32 -11
- package/src/components/DataTable/__tests__/{DataTable.comprehensive.test.tsx → DataTable.comprehensive.test.tsx.skip} +6 -4
- package/src/components/DataTable/__tests__/{DataTable.test.tsx → DataTable.test.tsx.skip} +6 -4
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +31 -9
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +601 -0
- package/src/components/DataTable/__tests__/keyboard.test.tsx +615 -0
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +639 -0
- package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx.skip +330 -0
- package/src/components/DataTable/components/AccessDeniedPage.tsx +2 -2
- package/src/components/DataTable/components/ActionButtons.tsx +88 -104
- package/src/components/DataTable/components/DataTableCore.tsx +309 -337
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +4 -2
- package/src/components/DataTable/components/DataTableModals.tsx +22 -1
- package/src/components/DataTable/components/EditableRow.tsx +69 -84
- package/src/components/DataTable/components/EmptyState.tsx +5 -1
- package/src/components/DataTable/components/ImportModal.tsx +65 -36
- package/src/components/DataTable/components/PaginationControls.tsx +40 -100
- package/src/components/DataTable/components/UnifiedTableBody.tsx +125 -148
- package/src/components/DataTable/context/DataTableContext.tsx +1 -1
- package/src/components/DataTable/core/ColumnFactory.ts +5 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +12 -10
- package/src/components/DataTable/examples/HierarchicalExample.tsx +1 -1
- package/src/components/DataTable/examples/InitialPageSizeExample.tsx +1 -0
- package/src/components/DataTable/examples/PerformanceExample.tsx +1 -0
- package/src/components/DataTable/hooks/__tests__/useColumnOrderPersistence.test.ts +1 -5
- package/src/components/DataTable/hooks/__tests__/useColumnVisibilityPersistence.test.ts +167 -0
- package/src/components/DataTable/hooks/index.ts +7 -0
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +32 -15
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +102 -0
- package/src/components/DataTable/hooks/useDataTableConfiguration.ts +89 -0
- package/src/components/DataTable/hooks/useDataTableDataPipeline.ts +117 -0
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +71 -27
- package/src/components/DataTable/hooks/useDataTableState.ts +39 -11
- package/src/components/DataTable/hooks/useEffectiveColumnOrder.ts +33 -0
- package/src/components/DataTable/hooks/useHierarchicalState.ts +15 -1
- package/src/components/DataTable/hooks/useKeyboardNavigation.ts +447 -0
- package/src/components/DataTable/hooks/useServerSideDataEffect.ts +94 -0
- package/src/components/DataTable/hooks/useTableColumns.ts +10 -7
- package/src/components/DataTable/hooks/useTableHandlers.ts +174 -0
- package/src/components/DataTable/index.ts +12 -3
- package/src/components/DataTable/types.ts +129 -9
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +159 -22
- package/src/components/DataTable/utils/__tests__/flexibleImport.test.ts +111 -0
- package/src/components/DataTable/utils/__tests__/rowUtils.test.ts +15 -29
- package/src/components/DataTable/utils/a11yUtils.ts +244 -0
- package/src/components/DataTable/utils/debugTools.ts +609 -0
- package/src/components/DataTable/utils/exportUtils.ts +114 -16
- package/src/components/DataTable/utils/flexibleImport.ts +202 -32
- package/src/components/DataTable/utils/hierarchicalUtils.ts +1 -1
- package/src/components/DataTable/utils/index.ts +2 -0
- package/src/components/DataTable/utils/paginationUtils.ts +350 -0
- package/src/components/DataTable/utils/rowUtils.ts +6 -5
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -24
- package/src/components/NavigationMenu/NavigationMenu.tsx +19 -8
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +1 -23
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +56 -6
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +137 -13
- package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +1 -1
- package/src/components/Select/Select.tsx +1 -0
- package/src/components/examples/PermissionExample.tsx +173 -0
- package/src/examples/CorrectPublicPageImplementation.tsx +301 -0
- package/src/examples/PublicEventPage.tsx +274 -0
- package/src/examples/PublicPageApp.tsx +308 -0
- package/src/examples/PublicPageUsageExample.tsx +216 -0
- package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +12 -1
- package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +129 -17
- package/src/hooks/__tests__/useRBAC.unit.test.ts +151 -846
- package/src/hooks/useOrganisationPermissions.test.ts +42 -18
- package/src/hooks/useOrganisationPermissions.ts +12 -6
- package/src/hooks/useOrganisationSecurity.test.ts +138 -85
- package/src/hooks/useOrganisationSecurity.ts +41 -10
- package/src/index.ts +0 -1
- package/src/providers/AuthProvider.simplified.tsx +880 -0
- package/src/providers/UnifiedAuthProvider.test.simple.tsx +8 -8
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +29 -19
- package/src/providers/index.ts +0 -1
- package/src/providers/services/EventServiceProvider.tsx +19 -15
- package/src/providers/services/InactivityServiceProvider.tsx +19 -15
- package/src/providers/services/OrganisationServiceProvider.tsx +19 -15
- package/src/providers/services/UnifiedAuthProvider.tsx +156 -127
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +1 -1
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +3 -3
- package/src/rbac/README.md +1 -1
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +25 -27
- package/src/rbac/__tests__/auth-rbac-security.integration.test.tsx +313 -0
- package/src/rbac/__tests__/engine.comprehensive.test.ts +114 -348
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +28 -110
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +33 -85
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +2 -2
- package/src/rbac/adapters.tsx +26 -69
- package/src/rbac/api.test.ts +90 -27
- package/src/rbac/api.ts +61 -10
- package/src/rbac/audit.test.ts +33 -38
- package/src/rbac/audit.ts +21 -6
- package/src/rbac/cache.ts +33 -1
- package/src/rbac/components/NavigationGuard.tsx +11 -11
- package/src/rbac/components/NavigationProvider.test.tsx +11 -5
- package/src/rbac/components/NavigationProvider.tsx +37 -13
- package/src/rbac/components/PagePermissionGuard.tsx +111 -50
- package/src/rbac/components/PagePermissionProvider.tsx +5 -5
- package/src/rbac/components/PermissionEnforcer.tsx +11 -11
- package/src/rbac/components/RoleBasedRouter.tsx +5 -5
- package/src/rbac/components/SecureDataProvider.tsx +5 -5
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +8 -8
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +14 -14
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +12 -12
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +6 -6
- package/src/rbac/engine.test.simple.ts +19 -13
- package/src/rbac/engine.test.ts +1 -0
- package/src/rbac/engine.ts +330 -766
- package/src/rbac/errors.ts +156 -0
- package/src/rbac/hooks/usePermissions.ts +32 -10
- package/src/rbac/hooks/useRBAC.test.ts +126 -512
- package/src/rbac/hooks/useRBAC.ts +147 -193
- package/src/rbac/hooks/useResolvedScope.ts +12 -0
- package/src/rbac/index.ts +7 -4
- package/src/rbac/security.ts +109 -18
- package/src/rbac/types.ts +12 -1
- package/src/services/AuthService.ts +2 -15
- package/src/services/EventService.ts +43 -46
- package/src/services/OrganisationService.ts +51 -31
- package/src/services/__tests__/AuthService.test.ts +1 -1
- package/src/services/__tests__/EventService.test.ts +1 -1
- package/src/services/__tests__/OrganisationService.test.ts +1 -1
- package/src/services/base/BaseService.ts +8 -0
- package/src/styles/base.css +208 -0
- package/src/styles/semantic.css +24 -0
- package/src/types/database.generated.ts +7347 -0
- package/src/types/database.ts +20 -0
- package/src/utils/logger.ts +179 -0
- package/src/utils/organisationContext.ts +11 -4
- package/src/utils/storage/__tests__/helpers.unit.test.ts +6 -2
- package/dist/appNameResolver-UURKN7NF.js +0 -22
- package/dist/audit-6TOCAMKO.js.map +0 -1
- package/dist/chunk-B2WTCLCV.js.map +0 -1
- package/dist/chunk-FGMFQSHX.js.map +0 -1
- package/dist/chunk-K34IM5CT.js.map +0 -1
- package/dist/chunk-KHJS6VIA.js.map +0 -1
- package/dist/chunk-KK73ZB4E.js.map +0 -1
- package/dist/chunk-M5IWZRBT.js.map +0 -1
- package/dist/chunk-ULBI5JGB.js +0 -109
- package/dist/chunk-ULBI5JGB.js.map +0 -1
- package/dist/chunk-WN6XJWOS.js.map +0 -1
- package/dist/chunk-XLZ7U46Z.js.map +0 -1
- package/dist/chunk-Y6TXWPJO.js.map +0 -1
- package/docs/DOCUMENTATION_CHECKLIST.md +0 -281
- package/docs/TERMINOLOGY.md +0 -231
- package/docs/api/interfaces/RBACContextType.md +0 -468
- package/docs/api/interfaces/RBACProviderProps.md +0 -107
- package/docs/best-practices/performance-expansion.md +0 -473
- package/docs/breaking-changes.md +0 -179
- package/docs/consuming-app-example.md +0 -290
- package/docs/documentation-templates.md +0 -539
- package/docs/examples/navigation-menu-auth-fix.md +0 -344
- package/docs/getting-started/examples/basic-auth-app.md +0 -520
- package/docs/getting-started/examples/full-featured-app.md +0 -616
- package/docs/getting-started/quick-start.md +0 -376
- package/docs/implementation-guides/datatable-filtering.md +0 -313
- package/docs/implementation-guides/datatable-rbac-usage.md +0 -317
- package/docs/implementation-guides/hierarchical-datatable.md +0 -850
- package/docs/implementation-guides/large-datasets.md +0 -281
- package/docs/implementation-guides/performance.md +0 -403
- package/docs/migration/quick-migration-guide.md +0 -320
- package/docs/migration-guide.md +0 -193
- package/docs/migration-guides/unified-auth-provider-mandatory-timeouts.md +0 -226
- package/docs/performance/README.md +0 -551
- package/docs/style-guide.md +0 -964
- package/docs/troubleshooting/authentication-issues.md +0 -334
- package/docs/troubleshooting/debugging.md +0 -1117
- package/docs/troubleshooting/migration.md +0 -918
- package/src/__tests__/hooks/usePermissions.test.ts +0 -261
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +0 -574
- package/src/hooks/__tests__/ServiceHooks.test.tsx +0 -613
- package/src/hooks/services/__tests__/useServiceHooks.test.tsx +0 -137
- package/src/hooks/services/usePermissions.ts +0 -70
- package/src/hooks/services/useRBACService.ts +0 -30
- package/src/hooks/usePermissionCheck.ts +0 -150
- package/src/providers/__tests__/ServiceProviders.test.tsx +0 -477
- package/src/providers/services/RBACServiceProvider.tsx +0 -79
- package/src/rbac/__tests__/integration.authflow.test.tsx +0 -119
- package/src/rbac/__tests__/integration.navigation.test.tsx +0 -69
- package/src/rbac/__tests__/integration.securedata.test.tsx +0 -92
- package/src/rbac/__tests__/integration.smoke.test.tsx +0 -73
- package/src/rbac/providers/RBACProvider.tsx +0 -645
- package/src/rbac/providers/__tests__/RBACProvider.integration.test.tsx +0 -688
- package/src/rbac/providers/__tests__/RBACProvider.test.tsx +0 -1186
- package/src/rbac/providers/index.ts +0 -11
- package/src/services/RBACService.ts +0 -522
- package/src/services/__tests__/RBACService.test.ts +0 -492
- package/src/services/interfaces/IRBACService.ts +0 -62
- package/src/utils/appNameResolver.test 2.ts +0 -494
- /package/dist/{DataTable-4GAVPIEG.js.map → DataTable-ETGVF4Y5.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-3NKDOSOK.js.map → UnifiedAuthProvider-P5SOJAQ6.js.map} +0 -0
- /package/dist/{api-DDMUKIUD.js.map → api-KG4A2X7P.js.map} +0 -0
- /package/dist/{appNameResolver-UURKN7NF.js.map → audit-65VNHEV2.js.map} +0 -0
- /package/dist/{chunk-NTNILOBC.js.map → chunk-5BO3MI5Y.js.map} +0 -0
- /package/dist/{chunk-URUTVZ7N.js.map → chunk-FL4ZCQLD.js.map} +0 -0
- /package/dist/{chunk-LW7MMEAQ.js.map → chunk-FT2M4R4F.js.map} +0 -0
- /package/dist/{chunk-AFGTSUAD.js.map → chunk-VSOKOFRF.js.map} +0 -0
- /package/docs/{app.css.example → styles/app.css.example} +0 -0
package/docs/rbac/quick-start.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# RBAC Quick Start
|
|
2
8
|
|
|
3
9
|
> **📚 RBAC System** | [← Back to Documentation](../../README.md) | [RBAC Overview](./README.md) | [Examples](./examples.md)
|
|
@@ -17,10 +23,11 @@ A simple user management app that demonstrates:
|
|
|
17
23
|
|
|
18
24
|
## 🚨 Critical Rules (Follow These or It Won't Work)
|
|
19
25
|
|
|
20
|
-
1. **
|
|
21
|
-
2. **
|
|
22
|
-
3. **Always
|
|
23
|
-
4. **
|
|
26
|
+
1. **ALWAYS call `setupRBAC()` first** - This is MANDATORY and must be called before any RBAC features
|
|
27
|
+
2. **Never make direct database queries** to `rbac_apps`, `rbac_global_roles`, or other RBAC tables
|
|
28
|
+
3. **Always use `PagePermissionGuard`** for page-level permissions (not manual permission checks)
|
|
29
|
+
4. **Always set up providers correctly** in the exact order shown
|
|
30
|
+
5. **Use the exact app name** from your environment variable (must match database exactly)
|
|
24
31
|
|
|
25
32
|
## 🚀 Step-by-Step Implementation
|
|
26
33
|
|
|
@@ -195,7 +202,50 @@ if (!supabaseUrl || !supabaseAnonKey) {
|
|
|
195
202
|
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
|
196
203
|
```
|
|
197
204
|
|
|
198
|
-
### 8.
|
|
205
|
+
### 8. Initialize RBAC (MANDATORY - NEW STEP!)
|
|
206
|
+
|
|
207
|
+
**CRITICAL**: You MUST call `setupRBAC()` before using any RBAC features. Create `src/lib/rbac-setup.ts`:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
// src/lib/rbac-setup.ts
|
|
211
|
+
import { setupRBAC } from '@jmruthers/pace-core/rbac'
|
|
212
|
+
import { supabase } from './supabase'
|
|
213
|
+
|
|
214
|
+
// ⚠️ REQUIRED: Initialize RBAC before using any RBAC features
|
|
215
|
+
setupRBAC(supabase)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Then import this in your main entry point:**
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// src/main.tsx
|
|
222
|
+
import React from 'react'
|
|
223
|
+
import ReactDOM from 'react-dom/client'
|
|
224
|
+
import './lib/rbac-setup' // ⚠️ Import setup BEFORE App
|
|
225
|
+
import App from './App'
|
|
226
|
+
|
|
227
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
228
|
+
<React.StrictMode>
|
|
229
|
+
<App />
|
|
230
|
+
</React.StrictMode>
|
|
231
|
+
)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Or in your App.tsx (alternative approach):**
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
// src/App.tsx
|
|
238
|
+
import React from 'react'
|
|
239
|
+
import { setupRBAC } from '@jmruthers/pace-core/rbac'
|
|
240
|
+
import { supabase } from './lib/supabase'
|
|
241
|
+
|
|
242
|
+
// ⚠️ REQUIRED: Call setupRBAC before anything else
|
|
243
|
+
setupRBAC(supabase)
|
|
244
|
+
|
|
245
|
+
// ... rest of your app
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 9. App Setup (CRITICAL)
|
|
199
249
|
|
|
200
250
|
Create `src/App.tsx` with this EXACT structure:
|
|
201
251
|
|
|
@@ -208,26 +258,23 @@ import {
|
|
|
208
258
|
OrganisationProvider,
|
|
209
259
|
EventProvider
|
|
210
260
|
} from '@jmruthers/pace-core/providers'
|
|
211
|
-
import { setRBACAppName } from '@jmruthers/pace-core/utils'
|
|
212
261
|
import { supabase } from './lib/supabase'
|
|
213
262
|
import { Dashboard } from './pages/Dashboard'
|
|
214
263
|
import { Users } from './pages/Users'
|
|
215
264
|
import { Login } from './pages/Login'
|
|
216
265
|
|
|
217
|
-
// CRITICAL:
|
|
266
|
+
// CRITICAL: App name for RBAC resolution
|
|
218
267
|
const APP_NAME = import.meta.env.VITE_APP_NAME
|
|
219
268
|
|
|
220
269
|
if (!APP_NAME) {
|
|
221
270
|
throw new Error('VITE_APP_NAME environment variable is required')
|
|
222
271
|
}
|
|
223
272
|
|
|
224
|
-
// CRITICAL: Set the app name globally for RBAC
|
|
225
|
-
setRBACAppName(APP_NAME)
|
|
226
|
-
|
|
227
273
|
function App() {
|
|
228
274
|
return (
|
|
229
275
|
<UnifiedAuthProvider
|
|
230
276
|
supabaseClient={supabase}
|
|
277
|
+
appName={APP_NAME}
|
|
231
278
|
>
|
|
232
279
|
<OrganisationProvider>
|
|
233
280
|
<EventProvider>
|
|
@@ -247,7 +294,7 @@ function App() {
|
|
|
247
294
|
export default App
|
|
248
295
|
```
|
|
249
296
|
|
|
250
|
-
###
|
|
297
|
+
### 10. Create Login Page
|
|
251
298
|
|
|
252
299
|
Create `src/pages/Login.tsx`:
|
|
253
300
|
|
|
@@ -343,7 +390,7 @@ export function Login() {
|
|
|
343
390
|
}
|
|
344
391
|
```
|
|
345
392
|
|
|
346
|
-
###
|
|
393
|
+
### 11. Create Dashboard Page
|
|
347
394
|
|
|
348
395
|
Create `src/pages/Dashboard.tsx`:
|
|
349
396
|
|
|
@@ -417,7 +464,7 @@ export function Dashboard() {
|
|
|
417
464
|
}
|
|
418
465
|
```
|
|
419
466
|
|
|
420
|
-
###
|
|
467
|
+
### 12. Create Users Page
|
|
421
468
|
|
|
422
469
|
Create `src/pages/Users.tsx`:
|
|
423
470
|
|
|
@@ -522,6 +569,16 @@ Your RBAC setup is working correctly if:
|
|
|
522
569
|
|
|
523
570
|
## 🚨 Troubleshooting
|
|
524
571
|
|
|
572
|
+
### Issue: "RBACNotInitializedError"
|
|
573
|
+
|
|
574
|
+
**Cause**: Forgot to call `setupRBAC()`.
|
|
575
|
+
|
|
576
|
+
**Solution**:
|
|
577
|
+
```typescript
|
|
578
|
+
import { setupRBAC } from '@jmruthers/pace-core/rbac'
|
|
579
|
+
setupRBAC(supabase) // Must be called BEFORE rendering app
|
|
580
|
+
```
|
|
581
|
+
|
|
525
582
|
### Issue: "Access Denied" on all pages
|
|
526
583
|
|
|
527
584
|
**Check these in order:**
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# RBAC-RLS Integration: Dynamic Permission Enforcement
|
|
2
8
|
|
|
3
9
|
This document explains how to use the new RBAC-RLS integration system that allows dynamic permission enforcement based on configurable RBAC settings instead of hardcoded RLS policies.
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Super Admin Access Guide
|
|
2
8
|
|
|
3
9
|
This comprehensive guide shows consuming apps how to properly implement super admin access, including practical examples and best practices.
|
package/docs/security/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Security Checklist
|
|
2
8
|
|
|
3
9
|
> **🔒 Production Security** | [Security Best Practices](./README.md) | [RBAC Security](../rbac/README.md) | [Authentication Security](../core-concepts/authentication.md)
|
package/docs/styles/README.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# PACE Core Styling Guide
|
|
2
8
|
|
|
3
9
|
This guide explains how to properly style PACE Core components using our two-file CSS architecture with Tailwind v4 and native utilities.
|
|
4
10
|
|
|
5
|
-
> **🎨 New to PACE Core?** Start with the [
|
|
11
|
+
> **🎨 New to PACE Core?** Start with the [Getting started roadmap](../getting-started/documentation-index.md) to see the post-install checklist.
|
|
6
12
|
|
|
7
13
|
## Overview
|
|
8
14
|
|
package/docs/testing/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
# Troubleshooting Guide
|
|
4
8
|
|
|
5
|
-
[← Back to Documentation](../README.md) | [
|
|
9
|
+
> **🆘 Complete Troubleshooting Reference** | [← Back to Documentation](../README.md) | [Installation Guide](../getting-started/installation-guide.md)
|
|
6
10
|
|
|
7
|
-
Comprehensive troubleshooting guide for PACE Core applications. Find solutions to common problems
|
|
11
|
+
Comprehensive troubleshooting guide for PACE Core applications. Find solutions to common problems, learn debugging techniques, and get help when you need it.
|
|
8
12
|
|
|
9
13
|
## 📋 Table of Contents
|
|
10
14
|
|
|
@@ -494,4 +498,382 @@ function DebugInfo() {
|
|
|
494
498
|
5. **Test in incognito mode** to rule out extensions
|
|
495
499
|
6. **Try a minimal reproduction** in a new project
|
|
496
500
|
|
|
497
|
-
|
|
501
|
+
## 🔍 Advanced Debugging Techniques
|
|
502
|
+
|
|
503
|
+
### React Developer Tools
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
// Enable React DevTools in development
|
|
507
|
+
if (process.env.NODE_ENV === 'development') {
|
|
508
|
+
// React DevTools will automatically connect
|
|
509
|
+
console.log('React DevTools enabled');
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// Custom hook for debugging component renders
|
|
513
|
+
function useDebugRender(componentName: string, props?: any) {
|
|
514
|
+
useEffect(() => {
|
|
515
|
+
console.log(`${componentName} rendered with props:`, props);
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
useEffect(() => {
|
|
519
|
+
console.log(`${componentName} mounted`);
|
|
520
|
+
return () => console.log(`${componentName} unmounted`);
|
|
521
|
+
}, []);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Usage in components
|
|
525
|
+
function MyComponent({ data, loading }) {
|
|
526
|
+
useDebugRender('MyComponent', { data, loading });
|
|
527
|
+
|
|
528
|
+
if (loading) return <div>Loading...</div>;
|
|
529
|
+
return <div>{data}</div>;
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Custom Debug Hooks
|
|
534
|
+
|
|
535
|
+
```typescript
|
|
536
|
+
// hooks/useDebug.ts
|
|
537
|
+
import { useEffect, useRef } from 'react';
|
|
538
|
+
|
|
539
|
+
export function useDebugValue<T>(value: T, label: string) {
|
|
540
|
+
const prevValue = useRef<T>();
|
|
541
|
+
|
|
542
|
+
useEffect(() => {
|
|
543
|
+
if (prevValue.current !== value) {
|
|
544
|
+
console.log(`${label} changed:`, {
|
|
545
|
+
previous: prevValue.current,
|
|
546
|
+
current: value,
|
|
547
|
+
});
|
|
548
|
+
prevValue.current = value;
|
|
549
|
+
}
|
|
550
|
+
}, [value, label]);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export function useDebugEffect(effect: () => void, deps: any[], label: string) {
|
|
554
|
+
useEffect(() => {
|
|
555
|
+
console.log(`${label} effect triggered with deps:`, deps);
|
|
556
|
+
effect();
|
|
557
|
+
}, deps);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export function useDebugCallback<T extends (...args: any[]) => any>(
|
|
561
|
+
callback: T,
|
|
562
|
+
deps: any[],
|
|
563
|
+
label: string
|
|
564
|
+
): T {
|
|
565
|
+
const prevDeps = useRef<any[]>();
|
|
566
|
+
|
|
567
|
+
useEffect(() => {
|
|
568
|
+
if (JSON.stringify(prevDeps.current) !== JSON.stringify(deps)) {
|
|
569
|
+
console.log(`${label} callback dependencies changed:`, deps);
|
|
570
|
+
prevDeps.current = deps;
|
|
571
|
+
}
|
|
572
|
+
}, [deps, label]);
|
|
573
|
+
|
|
574
|
+
return callback;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Usage
|
|
578
|
+
function MyComponent({ userId }) {
|
|
579
|
+
useDebugValue(userId, 'userId');
|
|
580
|
+
|
|
581
|
+
const handleClick = useDebugCallback(
|
|
582
|
+
() => console.log('Button clicked'),
|
|
583
|
+
[userId],
|
|
584
|
+
'handleClick'
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
useDebugEffect(() => {
|
|
588
|
+
console.log('Effect running for userId:', userId);
|
|
589
|
+
}, [userId], 'userIdEffect');
|
|
590
|
+
|
|
591
|
+
return <button onClick={handleClick}>Click me</button>;
|
|
592
|
+
}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Authentication Debugging
|
|
596
|
+
|
|
597
|
+
```typescript
|
|
598
|
+
// Debug authentication state
|
|
599
|
+
function AuthDebugger() {
|
|
600
|
+
const { user, session, loading, error } = useUnifiedAuth();
|
|
601
|
+
|
|
602
|
+
useEffect(() => {
|
|
603
|
+
console.log('Auth Debug Info:', {
|
|
604
|
+
user: user ? { id: user.id, email: user.email } : null,
|
|
605
|
+
session: session ? { expires_at: session.expires_at } : null,
|
|
606
|
+
loading,
|
|
607
|
+
error: error?.message
|
|
608
|
+
});
|
|
609
|
+
}, [user, session, loading, error]);
|
|
610
|
+
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// Debug RBAC permissions
|
|
615
|
+
function RBACDebugger() {
|
|
616
|
+
const { hasPermission, isLoading, error } = useCan();
|
|
617
|
+
|
|
618
|
+
useEffect(() => {
|
|
619
|
+
console.log('RBAC Debug Info:', {
|
|
620
|
+
isLoading,
|
|
621
|
+
error: error?.message,
|
|
622
|
+
permissions: {
|
|
623
|
+
canReadUsers: hasPermission('read:users'),
|
|
624
|
+
canWriteUsers: hasPermission('write:users'),
|
|
625
|
+
canDeleteUsers: hasPermission('delete:users')
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
}, [hasPermission, isLoading, error]);
|
|
629
|
+
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### Component Debugging
|
|
635
|
+
|
|
636
|
+
```typescript
|
|
637
|
+
// Debug component props and state
|
|
638
|
+
function ComponentDebugger({ children, ...props }) {
|
|
639
|
+
const [state, setState] = useState({});
|
|
640
|
+
|
|
641
|
+
useEffect(() => {
|
|
642
|
+
console.log('Component Debug:', {
|
|
643
|
+
props,
|
|
644
|
+
state,
|
|
645
|
+
timestamp: new Date().toISOString()
|
|
646
|
+
});
|
|
647
|
+
}, [props, state]);
|
|
648
|
+
|
|
649
|
+
return children;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// Usage
|
|
653
|
+
<ComponentDebugger>
|
|
654
|
+
<DataTable data={data} columns={columns} />
|
|
655
|
+
</ComponentDebugger>
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### Performance Debugging
|
|
659
|
+
|
|
660
|
+
```typescript
|
|
661
|
+
// Debug performance issues
|
|
662
|
+
function PerformanceDebugger() {
|
|
663
|
+
useEffect(() => {
|
|
664
|
+
const observer = new PerformanceObserver((list) => {
|
|
665
|
+
for (const entry of list.getEntries()) {
|
|
666
|
+
if (entry.duration > 100) { // Log slow operations
|
|
667
|
+
console.warn('Slow operation detected:', {
|
|
668
|
+
name: entry.name,
|
|
669
|
+
duration: entry.duration,
|
|
670
|
+
startTime: entry.startTime
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
observer.observe({ entryTypes: ['measure', 'navigation'] });
|
|
677
|
+
|
|
678
|
+
return () => observer.disconnect();
|
|
679
|
+
}, []);
|
|
680
|
+
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// Debug render performance
|
|
685
|
+
function RenderDebugger({ children }) {
|
|
686
|
+
const renderStart = performance.now();
|
|
687
|
+
|
|
688
|
+
useEffect(() => {
|
|
689
|
+
const renderEnd = performance.now();
|
|
690
|
+
const renderTime = renderEnd - renderStart;
|
|
691
|
+
|
|
692
|
+
if (renderTime > 16) { // More than one frame
|
|
693
|
+
console.warn('Slow render detected:', {
|
|
694
|
+
renderTime,
|
|
695
|
+
component: children.type?.name || 'Unknown'
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
return children;
|
|
701
|
+
}
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
### Network Debugging
|
|
705
|
+
|
|
706
|
+
```typescript
|
|
707
|
+
// Debug API calls
|
|
708
|
+
function NetworkDebugger() {
|
|
709
|
+
useEffect(() => {
|
|
710
|
+
const originalFetch = window.fetch;
|
|
711
|
+
|
|
712
|
+
window.fetch = async (...args) => {
|
|
713
|
+
const start = performance.now();
|
|
714
|
+
console.log('API Call Started:', args[0]);
|
|
715
|
+
|
|
716
|
+
try {
|
|
717
|
+
const response = await originalFetch(...args);
|
|
718
|
+
const end = performance.now();
|
|
719
|
+
|
|
720
|
+
console.log('API Call Completed:', {
|
|
721
|
+
url: args[0],
|
|
722
|
+
status: response.status,
|
|
723
|
+
duration: end - start
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
return response;
|
|
727
|
+
} catch (error) {
|
|
728
|
+
const end = performance.now();
|
|
729
|
+
|
|
730
|
+
console.error('API Call Failed:', {
|
|
731
|
+
url: args[0],
|
|
732
|
+
error: error.message,
|
|
733
|
+
duration: end - start
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
throw error;
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
return () => {
|
|
741
|
+
window.fetch = originalFetch;
|
|
742
|
+
};
|
|
743
|
+
}, []);
|
|
744
|
+
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
### Error Boundary Debugging
|
|
750
|
+
|
|
751
|
+
```typescript
|
|
752
|
+
// Enhanced error boundary with debugging
|
|
753
|
+
class DebugErrorBoundary extends React.Component {
|
|
754
|
+
constructor(props) {
|
|
755
|
+
super(props);
|
|
756
|
+
this.state = { hasError: false, error: null, errorInfo: null };
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
static getDerivedStateFromError(error) {
|
|
760
|
+
return { hasError: true };
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
componentDidCatch(error, errorInfo) {
|
|
764
|
+
console.error('Error Boundary Caught Error:', {
|
|
765
|
+
error: error.message,
|
|
766
|
+
stack: error.stack,
|
|
767
|
+
componentStack: errorInfo.componentStack,
|
|
768
|
+
timestamp: new Date().toISOString()
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
this.setState({
|
|
772
|
+
error,
|
|
773
|
+
errorInfo
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
render() {
|
|
778
|
+
if (this.state.hasError) {
|
|
779
|
+
return (
|
|
780
|
+
<div className="p-4 border border-red-500 bg-red-50">
|
|
781
|
+
<h2 className="text-red-800 font-bold">Something went wrong</h2>
|
|
782
|
+
<details className="mt-2">
|
|
783
|
+
<summary className="cursor-pointer text-red-700">
|
|
784
|
+
Error Details (Click to expand)
|
|
785
|
+
</summary>
|
|
786
|
+
<pre className="mt-2 text-xs text-red-600 whitespace-pre-wrap">
|
|
787
|
+
{this.state.error && this.state.error.toString()}
|
|
788
|
+
{this.state.errorInfo.componentStack}
|
|
789
|
+
</pre>
|
|
790
|
+
</details>
|
|
791
|
+
</div>
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
return this.props.children;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
### Debug Information Template
|
|
801
|
+
|
|
802
|
+
```tsx
|
|
803
|
+
// Add this to your app for comprehensive debugging
|
|
804
|
+
function DebugInfo() {
|
|
805
|
+
const auth = useUnifiedAuth();
|
|
806
|
+
const org = useOrganisation();
|
|
807
|
+
const events = useEvents();
|
|
808
|
+
const { hasPermission } = useCan();
|
|
809
|
+
|
|
810
|
+
return (
|
|
811
|
+
<div style={{
|
|
812
|
+
position: 'fixed',
|
|
813
|
+
top: 0,
|
|
814
|
+
right: 0,
|
|
815
|
+
background: 'white',
|
|
816
|
+
padding: '10px',
|
|
817
|
+
border: '1px solid black',
|
|
818
|
+
zIndex: 9999,
|
|
819
|
+
fontSize: '12px',
|
|
820
|
+
maxWidth: '300px',
|
|
821
|
+
maxHeight: '400px',
|
|
822
|
+
overflow: 'auto'
|
|
823
|
+
}}>
|
|
824
|
+
<h4>Debug Info</h4>
|
|
825
|
+
<pre>{JSON.stringify({
|
|
826
|
+
auth: {
|
|
827
|
+
user: auth.user?.id,
|
|
828
|
+
loading: auth.loading,
|
|
829
|
+
error: auth.error?.message
|
|
830
|
+
},
|
|
831
|
+
org: {
|
|
832
|
+
current: org.selectedOrganisation?.id,
|
|
833
|
+
loading: org.loading,
|
|
834
|
+
error: org.error?.message
|
|
835
|
+
},
|
|
836
|
+
events: {
|
|
837
|
+
current: events.selectedEvent?.id,
|
|
838
|
+
loading: events.loading,
|
|
839
|
+
error: events.error?.message
|
|
840
|
+
},
|
|
841
|
+
permissions: {
|
|
842
|
+
canReadUsers: hasPermission('read:users'),
|
|
843
|
+
canWriteUsers: hasPermission('write:users')
|
|
844
|
+
}
|
|
845
|
+
}, null, 2)}</pre>
|
|
846
|
+
</div>
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
### Debugging Checklist
|
|
852
|
+
|
|
853
|
+
#### Before Debugging
|
|
854
|
+
- [ ] Check browser console for errors
|
|
855
|
+
- [ ] Verify environment variables are set
|
|
856
|
+
- [ ] Confirm all dependencies are installed
|
|
857
|
+
- [ ] Check network connectivity
|
|
858
|
+
- [ ] Verify Supabase configuration
|
|
859
|
+
|
|
860
|
+
#### During Debugging
|
|
861
|
+
- [ ] Enable debug mode in providers
|
|
862
|
+
- [ ] Add console.log statements strategically
|
|
863
|
+
- [ ] Use React DevTools to inspect components
|
|
864
|
+
- [ ] Check Network tab for failed requests
|
|
865
|
+
- [ ] Monitor performance metrics
|
|
866
|
+
|
|
867
|
+
#### After Debugging
|
|
868
|
+
- [ ] Remove debug code before production
|
|
869
|
+
- [ ] Document the solution for future reference
|
|
870
|
+
- [ ] Update error handling if needed
|
|
871
|
+
- [ ] Consider adding monitoring for similar issues
|
|
872
|
+
|
|
873
|
+
## Related Documentation
|
|
874
|
+
|
|
875
|
+
- [Common Issues](./common-issues.md) - Specific problem solutions
|
|
876
|
+
- [Styling Issues](./styling-issues.md) - Component styling problems
|
|
877
|
+
- [Authentication Guide](../implementation-guides/authentication.md) - Auth troubleshooting
|
|
878
|
+
- [Performance Guide](../best-practices/performance.md) - Performance debugging
|
|
879
|
+
- [API Reference](../api-reference/) - Component documentation
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Organisation Context Setup Troubleshooting
|
|
2
8
|
|
|
3
9
|
This guide helps you resolve the `unrecognized configuration parameter "app.organisation_id"` error that occurs when using PACE Core with Supabase.
|