@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/dist/rbac/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SupabaseClient
|
|
2
|
-
import { D as Database } from '../database-
|
|
1
|
+
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
+
import { D as Database } from '../database-BXAfr2Y_.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import React__default, { ReactNode } from 'react';
|
|
5
|
-
import { c as AccessLevel$1 } from '../unified-CM7T0aTK.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* RBAC (Role-Based Access Control) Types - Build Contract Compliant
|
|
@@ -29,7 +28,7 @@ type PermissionCheck = {
|
|
|
29
28
|
permission: Permission;
|
|
30
29
|
pageId?: UUID | string;
|
|
31
30
|
};
|
|
32
|
-
type PermissionMap = Record<
|
|
31
|
+
type PermissionMap = Record<Permission, boolean> & Partial<Record<'*', boolean>>;
|
|
33
32
|
type GlobalRole = 'super_admin';
|
|
34
33
|
type OrganisationRole = 'supporter' | 'member' | 'leader' | 'org_admin';
|
|
35
34
|
type EventAppRole = 'viewer' | 'participant' | 'planner' | 'event_admin';
|
|
@@ -51,6 +50,15 @@ interface RBACAuditEvent {
|
|
|
51
50
|
metadata: Record<string, any>;
|
|
52
51
|
created_at: string;
|
|
53
52
|
}
|
|
53
|
+
interface RBACAppContext {
|
|
54
|
+
appId: UUID;
|
|
55
|
+
hasAccess: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface RBACRoleContext {
|
|
58
|
+
globalRole: GlobalRole | null;
|
|
59
|
+
organisationRole: OrganisationRole | null;
|
|
60
|
+
eventAppRole: EventAppRole | null;
|
|
61
|
+
}
|
|
54
62
|
interface PermissionCacheKey {
|
|
55
63
|
userId: UUID;
|
|
56
64
|
organisationId?: UUID;
|
|
@@ -295,7 +303,19 @@ declare class RBACCache {
|
|
|
295
303
|
*/
|
|
296
304
|
onInvalidate(callback: (pattern: string) => void): () => void;
|
|
297
305
|
/**
|
|
298
|
-
* Generate cache key for permission check
|
|
306
|
+
* Generate cache key for permission check (simplified signature)
|
|
307
|
+
*
|
|
308
|
+
* @param userId - User ID
|
|
309
|
+
* @param permission - Permission string
|
|
310
|
+
* @param organisationId - Organisation ID (optional)
|
|
311
|
+
* @param eventId - Event ID (optional)
|
|
312
|
+
* @param appId - App ID (optional)
|
|
313
|
+
* @param pageId - Page ID (optional)
|
|
314
|
+
* @returns String cache key
|
|
315
|
+
*/
|
|
316
|
+
static generateKey(userId: UUID, permission: string, organisationId?: UUID, eventId?: string, appId?: UUID, pageId?: UUID | string): string;
|
|
317
|
+
/**
|
|
318
|
+
* Generate cache key for permission check (object signature)
|
|
299
319
|
*
|
|
300
320
|
* @param key - Permission cache key object
|
|
301
321
|
* @returns String cache key
|
|
@@ -538,25 +558,33 @@ declare function emitAuditEvent(event: AuditEventPayload): Promise<void>;
|
|
|
538
558
|
*/
|
|
539
559
|
interface SecurityContext {
|
|
540
560
|
userId: UUID;
|
|
541
|
-
organisationId
|
|
561
|
+
organisationId?: UUID;
|
|
542
562
|
ipAddress?: string;
|
|
543
563
|
userAgent?: string;
|
|
544
564
|
timestamp: Date;
|
|
545
565
|
}
|
|
546
566
|
|
|
547
567
|
/**
|
|
548
|
-
* RBAC Core Engine
|
|
568
|
+
* RBAC Core Engine - Simplified Version
|
|
549
569
|
* @package @jmruthers/pace-core
|
|
550
570
|
* @module RBAC/Engine
|
|
551
|
-
* @since
|
|
571
|
+
* @since 2.0.0
|
|
552
572
|
*
|
|
553
|
-
* This
|
|
573
|
+
* This is a drastically simplified version that delegates permission checking to a single RPC function.
|
|
574
|
+
* All the complex grant collection logic has been moved to the database for better performance and security.
|
|
575
|
+
*
|
|
576
|
+
* BREAKING CHANGES FROM v1:
|
|
577
|
+
* - No more client-side grant collection
|
|
578
|
+
* - No more complex permission resolution algorithm
|
|
579
|
+
* - Single RPC call for all permission checks
|
|
580
|
+
* - Caching is still supported for performance
|
|
554
581
|
*/
|
|
555
582
|
|
|
556
583
|
/**
|
|
557
|
-
* RBAC Engine
|
|
584
|
+
* Simplified RBAC Engine
|
|
558
585
|
*
|
|
559
|
-
*
|
|
586
|
+
* Delegates all permission checks to the database via a single RPC function.
|
|
587
|
+
* This reduces complexity, improves performance, and enhances security.
|
|
560
588
|
*/
|
|
561
589
|
declare class RBACEngine {
|
|
562
590
|
private supabase;
|
|
@@ -565,14 +593,18 @@ declare class RBACEngine {
|
|
|
565
593
|
/**
|
|
566
594
|
* Check if a user has a specific permission
|
|
567
595
|
*
|
|
596
|
+
* This method now delegates to the database RPC function for all the heavy lifting.
|
|
597
|
+
*
|
|
568
598
|
* @param input - Permission check input
|
|
569
|
-
* @param securityContext -
|
|
599
|
+
* @param securityContext - Security context for validation (required)
|
|
570
600
|
* @returns Promise resolving to permission result
|
|
571
601
|
*/
|
|
572
|
-
isPermitted(input: PermissionCheck, securityContext
|
|
602
|
+
isPermitted(input: PermissionCheck, securityContext: SecurityContext): Promise<boolean>;
|
|
573
603
|
/**
|
|
574
604
|
* Get user's access level in a scope
|
|
575
605
|
*
|
|
606
|
+
* This is derived from roles, not permissions.
|
|
607
|
+
*
|
|
576
608
|
* @param input - Access level input
|
|
577
609
|
* @returns Promise resolving to access level
|
|
578
610
|
*/
|
|
@@ -583,6 +615,9 @@ declare class RBACEngine {
|
|
|
583
615
|
/**
|
|
584
616
|
* Get user's permission map for a scope
|
|
585
617
|
*
|
|
618
|
+
* This builds a map of page IDs to allowed operations.
|
|
619
|
+
* Uses the simplified RPC for each permission check.
|
|
620
|
+
*
|
|
586
621
|
* @param input - Permission map input
|
|
587
622
|
* @returns Promise resolving to permission map
|
|
588
623
|
*/
|
|
@@ -590,107 +625,27 @@ declare class RBACEngine {
|
|
|
590
625
|
userId: UUID;
|
|
591
626
|
scope: Scope;
|
|
592
627
|
}): Promise<PermissionMap>;
|
|
628
|
+
resolveAppContext(input: {
|
|
629
|
+
userId: UUID;
|
|
630
|
+
appName: string;
|
|
631
|
+
}): Promise<RBACAppContext | null>;
|
|
632
|
+
getRoleContext(input: {
|
|
633
|
+
userId: UUID;
|
|
634
|
+
scope: Scope;
|
|
635
|
+
}): Promise<RBACRoleContext>;
|
|
593
636
|
/**
|
|
594
637
|
* Check if user is super admin
|
|
595
638
|
*
|
|
596
|
-
* Directly queries the rbac_global_roles table to check for super_admin role.
|
|
597
|
-
* This is consistent with how other RPC functions (rbac_permissions_get, etc.) check
|
|
598
|
-
* for super admin status - they all use direct queries to the rbac_global_roles table.
|
|
599
|
-
*
|
|
600
639
|
* @param userId - User ID
|
|
601
640
|
* @returns Promise resolving to super admin status
|
|
602
641
|
*/
|
|
603
642
|
private checkSuperAdmin;
|
|
604
|
-
/**
|
|
605
|
-
* Get app configuration including requires_event setting
|
|
606
|
-
*
|
|
607
|
-
* @param appId - App ID
|
|
608
|
-
* @returns Promise resolving to app configuration
|
|
609
|
-
*/
|
|
610
|
-
getAppConfig(appId: UUID): Promise<{
|
|
611
|
-
requires_event: boolean;
|
|
612
|
-
} | null>;
|
|
613
|
-
/**
|
|
614
|
-
* Resolve organisation ID from event ID
|
|
615
|
-
*
|
|
616
|
-
* @param eventId - Event ID
|
|
617
|
-
* @returns Promise resolving to organisation ID
|
|
618
|
-
*/
|
|
619
|
-
private resolveOrganisationFromEvent;
|
|
620
|
-
/**
|
|
621
|
-
* Validate context requirements based on app configuration
|
|
622
|
-
*
|
|
623
|
-
* @param scope - Permission scope
|
|
624
|
-
* @param appId - Optional app ID
|
|
625
|
-
* @returns Promise resolving to validated scope with resolved organisation ID
|
|
626
|
-
*/
|
|
627
|
-
private validateContextRequirements;
|
|
628
|
-
/**
|
|
629
|
-
* Collect active grants for a user in a scope
|
|
630
|
-
*
|
|
631
|
-
* @param userId - User ID
|
|
632
|
-
* @param scope - Permission scope
|
|
633
|
-
* @param pageId - Optional page ID
|
|
634
|
-
* @returns Promise resolving to grants array
|
|
635
|
-
*
|
|
636
|
-
* PRECEDENCE ORDER (closest scope first): page → eventApp → organisation → global
|
|
637
|
-
*/
|
|
638
|
-
private collectActiveGrants;
|
|
639
|
-
/**
|
|
640
|
-
* Check page-specific permissions
|
|
641
|
-
*
|
|
642
|
-
* @param userId - User ID
|
|
643
|
-
* @param pageId - Page ID
|
|
644
|
-
* @param permission - Permission to check
|
|
645
|
-
* @param scope - Permission scope
|
|
646
|
-
* @returns Promise resolving to page permission result
|
|
647
|
-
*/
|
|
648
|
-
private checkPagePermissions;
|
|
649
|
-
/**
|
|
650
|
-
* Get organisation role for a user
|
|
651
|
-
*
|
|
652
|
-
* @param userId - User ID
|
|
653
|
-
* @param organisationId - Organisation ID
|
|
654
|
-
* @returns Promise resolving to organisation role
|
|
655
|
-
*/
|
|
656
|
-
private getOrganisationRole;
|
|
657
|
-
/**
|
|
658
|
-
* Get event-app role for a user
|
|
659
|
-
*
|
|
660
|
-
* @param userId - User ID
|
|
661
|
-
* @param eventId - Event ID
|
|
662
|
-
* @param appId - App ID
|
|
663
|
-
* @returns Promise resolving to event-app role
|
|
664
|
-
*/
|
|
665
|
-
private getEventAppRole;
|
|
666
|
-
/**
|
|
667
|
-
* Get permission for organisation role
|
|
668
|
-
*
|
|
669
|
-
* @param role - Organisation role
|
|
670
|
-
* @returns Permission string
|
|
671
|
-
*/
|
|
672
|
-
private getPermissionForOrgRole;
|
|
673
|
-
/**
|
|
674
|
-
* Get permission for event-app role
|
|
675
|
-
*
|
|
676
|
-
* @param role - Event-app role
|
|
677
|
-
* @returns Permission string
|
|
678
|
-
*/
|
|
679
|
-
private getPermissionForEventRole;
|
|
680
|
-
/**
|
|
681
|
-
* Check if a permission matches another permission
|
|
682
|
-
*
|
|
683
|
-
* @param grantPermission - Permission from grant
|
|
684
|
-
* @param requestedPermission - Requested permission
|
|
685
|
-
* @returns True if permissions match
|
|
686
|
-
*/
|
|
687
|
-
private permissionMatches;
|
|
688
643
|
/**
|
|
689
644
|
* Resolve a page ID to UUID if it's a page name
|
|
690
645
|
*
|
|
691
646
|
* @param pageId - Page ID (UUID) or page name (string)
|
|
692
647
|
* @param appId - App ID to look up the page
|
|
693
|
-
* @returns Resolved page ID (UUID) or original pageId
|
|
648
|
+
* @returns Resolved page ID (UUID) or original pageId
|
|
694
649
|
*/
|
|
695
650
|
private resolvePageId;
|
|
696
651
|
}
|
|
@@ -1133,69 +1088,13 @@ declare function EnhancedNavigationMenu({ items, strictMode, auditLog, onNavigat
|
|
|
1133
1088
|
* @module RBAC/Hooks
|
|
1134
1089
|
* @since 0.3.0
|
|
1135
1090
|
*
|
|
1136
|
-
* A React hook that provides access to the
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
* - Real-time role detection (global, organisation, event-app)
|
|
1141
|
-
* - Permission checking with database validation
|
|
1142
|
-
* - Hierarchical permission resolution
|
|
1143
|
-
* - Loading states and error handling
|
|
1144
|
-
* - Type-safe permission operations
|
|
1145
|
-
* - Automatic context detection
|
|
1146
|
-
*
|
|
1147
|
-
* @example
|
|
1148
|
-
* ```tsx
|
|
1149
|
-
* import { useRBAC } from '@jmruthers/pace-core/rbac';
|
|
1150
|
-
*
|
|
1151
|
-
* function MyComponent() {
|
|
1152
|
-
* const {
|
|
1153
|
-
* globalRole,
|
|
1154
|
-
* organisationRole,
|
|
1155
|
-
* eventAppRole,
|
|
1156
|
-
* hasPermission,
|
|
1157
|
-
* isSuperAdmin,
|
|
1158
|
-
* isLoading,
|
|
1159
|
-
* error
|
|
1160
|
-
* } = useRBAC();
|
|
1161
|
-
*
|
|
1162
|
-
* if (isLoading) return <div>Loading permissions...</div>;
|
|
1163
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
1164
|
-
*
|
|
1165
|
-
* return (
|
|
1166
|
-
* <div>
|
|
1167
|
-
* {isSuperAdmin && <AdminPanel />}
|
|
1168
|
-
* {hasPermission('read', 'dashboard') && <Dashboard />}
|
|
1169
|
-
* {hasPermission('create', 'events') && <CreateEventButton />}
|
|
1170
|
-
* </div>
|
|
1171
|
-
* );
|
|
1172
|
-
* }
|
|
1173
|
-
* ```
|
|
1174
|
-
*
|
|
1175
|
-
* @accessibility
|
|
1176
|
-
* - No direct accessibility concerns (hook)
|
|
1177
|
-
* - Enables accessible permission-based UI rendering
|
|
1178
|
-
* - Supports screen reader friendly conditional content
|
|
1179
|
-
*
|
|
1180
|
-
* @security
|
|
1181
|
-
* - Database-backed permission validation
|
|
1182
|
-
* - Hierarchical permission resolution
|
|
1183
|
-
* - Organisation context enforcement
|
|
1184
|
-
* - Real-time permission updates
|
|
1185
|
-
*
|
|
1186
|
-
* @performance
|
|
1187
|
-
* - Optimized with useMemo and useCallback
|
|
1188
|
-
* - Permission caching
|
|
1189
|
-
* - Minimal re-renders
|
|
1190
|
-
* - Lazy loading of permissions
|
|
1191
|
-
*
|
|
1192
|
-
* @dependencies
|
|
1193
|
-
* - React 18+ - Hooks and effects
|
|
1194
|
-
* - @supabase/supabase-js - Database integration
|
|
1195
|
-
* - RBAC types - Type definitions
|
|
1091
|
+
* A React hook that provides access to the RBAC (Role-Based Access Control) system
|
|
1092
|
+
* through the hardened RBAC engine API. The hook defers all permission and role
|
|
1093
|
+
* resolution to the shared engine to ensure consistent security behaviour across
|
|
1094
|
+
* applications.
|
|
1196
1095
|
*/
|
|
1197
1096
|
|
|
1198
|
-
declare function useRBAC
|
|
1097
|
+
declare function useRBAC(pageId?: string): UserRBACContext;
|
|
1199
1098
|
|
|
1200
1099
|
/**
|
|
1201
1100
|
* @file useResolvedScope Hook
|
|
@@ -1481,63 +1380,6 @@ declare function useCachedPermissions(userId: UUID, scope: Scope): {
|
|
|
1481
1380
|
refetch: () => Promise<void>;
|
|
1482
1381
|
};
|
|
1483
1382
|
|
|
1484
|
-
interface AppConfig {
|
|
1485
|
-
supports_direct_access: boolean;
|
|
1486
|
-
requires_event: boolean;
|
|
1487
|
-
}
|
|
1488
|
-
interface UserEventAccess {
|
|
1489
|
-
event_id: string;
|
|
1490
|
-
event_name: string;
|
|
1491
|
-
event_description?: string | null;
|
|
1492
|
-
start_date: string;
|
|
1493
|
-
end_date: string;
|
|
1494
|
-
event_status: string;
|
|
1495
|
-
app_id: string;
|
|
1496
|
-
access_level: string;
|
|
1497
|
-
granted_at: string;
|
|
1498
|
-
organisation_id: string;
|
|
1499
|
-
}
|
|
1500
|
-
interface RBACContextType {
|
|
1501
|
-
permissions: Record<string, boolean>;
|
|
1502
|
-
roles: string[];
|
|
1503
|
-
accessLevel: AccessLevel$1;
|
|
1504
|
-
rbacLoading: boolean;
|
|
1505
|
-
rbacError: Error | null;
|
|
1506
|
-
selectedEventId: string | null;
|
|
1507
|
-
appConfig: AppConfig | null;
|
|
1508
|
-
userEventAccess: UserEventAccess[];
|
|
1509
|
-
eventAccessLoading: boolean;
|
|
1510
|
-
selectedOrganisationId: string | null;
|
|
1511
|
-
requireOrganisationContext: () => string;
|
|
1512
|
-
hasPermission: (permission: string, orgId?: string) => boolean;
|
|
1513
|
-
hasAnyPermission: (permissions: string[], orgId?: string) => boolean;
|
|
1514
|
-
hasAllPermissions: (permissions: string[], orgId?: string) => boolean;
|
|
1515
|
-
hasRole: (role: string) => boolean;
|
|
1516
|
-
hasAccessLevel: (level: AccessLevel$1) => boolean;
|
|
1517
|
-
canAccess: (resource: string, action: string, orgId?: string) => boolean;
|
|
1518
|
-
validatePermission: (permission: string, orgId?: string) => Promise<boolean>;
|
|
1519
|
-
validateAccess: (resource: string, action: string, orgId?: string) => Promise<boolean>;
|
|
1520
|
-
refreshPermissions: (eventId?: string, orgId?: string) => Promise<void>;
|
|
1521
|
-
setSelectedEventId: (eventId: string | null) => void;
|
|
1522
|
-
loadUserEventAccess: (orgId?: string) => Promise<void>;
|
|
1523
|
-
getUserEventAccess: (eventId: string) => UserEventAccess | undefined;
|
|
1524
|
-
rbacEnabled: boolean;
|
|
1525
|
-
rbacContext?: any;
|
|
1526
|
-
}
|
|
1527
|
-
declare const useRBAC: () => RBACContextType;
|
|
1528
|
-
interface RBACProviderProps {
|
|
1529
|
-
children: React__default.ReactNode;
|
|
1530
|
-
supabaseClient?: SupabaseClient;
|
|
1531
|
-
user: User | null;
|
|
1532
|
-
session: Session | null;
|
|
1533
|
-
appName: string;
|
|
1534
|
-
enableRBAC?: boolean;
|
|
1535
|
-
persistState?: boolean;
|
|
1536
|
-
enablePersistence?: boolean;
|
|
1537
|
-
requireOrganisationContext?: boolean;
|
|
1538
|
-
}
|
|
1539
|
-
declare function RBACProvider({ children, supabaseClient, user, session, appName, enableRBAC, persistState, enablePersistence, requireOrganisationContext: _requireOrganisationContext, }: RBACProviderProps): react_jsx_runtime.JSX.Element;
|
|
1540
|
-
|
|
1541
1383
|
/**
|
|
1542
1384
|
* RBAC Adapters
|
|
1543
1385
|
* @package @jmruthers/pace-core
|
|
@@ -1867,6 +1709,14 @@ declare function getPermissionMap(input: {
|
|
|
1867
1709
|
userId: UUID;
|
|
1868
1710
|
scope: Scope;
|
|
1869
1711
|
}): Promise<PermissionMap>;
|
|
1712
|
+
declare function resolveAppContext(input: {
|
|
1713
|
+
userId: UUID;
|
|
1714
|
+
appName: string;
|
|
1715
|
+
}): Promise<RBACAppContext | null>;
|
|
1716
|
+
declare function getRoleContext(input: {
|
|
1717
|
+
userId: UUID;
|
|
1718
|
+
scope: Scope;
|
|
1719
|
+
}): Promise<RBACRoleContext>;
|
|
1870
1720
|
/**
|
|
1871
1721
|
* Check if user has a specific permission
|
|
1872
1722
|
*
|
|
@@ -2108,4 +1958,4 @@ declare const ALL_PERMISSIONS: {
|
|
|
2108
1958
|
};
|
|
2109
1959
|
type AllPermissions = typeof ALL_PERMISSIONS;
|
|
2110
1960
|
|
|
2111
|
-
export { ALL_PERMISSIONS, type AccessLevel, AccessLevelGuard, type AllPermissions, CACHE_PATTERNS, type DataAccessRecord, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, type EnhancedNavigationMenuProps, type EventAppRole, GLOBAL_PERMISSIONS, type GlobalRole, InvalidScopeError, type LogLevel, MissingUserContextError, type NavigationAccessRecord, type NavigationContextType, NavigationGuard, type NavigationGuardProps, type NavigationItem, NavigationProvider, type NavigationProviderProps, ORGANISATION_PERMISSIONS, type Operation, OrganisationContextRequiredError, type OrganisationRole, PAGE_PERMISSIONS, type PageAccessRecord, type PagePermissionContextType, PagePermissionGuard, type PagePermissionGuardProps, PagePermissionProvider, type PagePermissionProviderProps, type Permission, type PermissionCheck, PermissionDeniedError, PermissionEnforcer, type PermissionEnforcerProps, PermissionGuard, type PermissionMap, RBACAuditManager, RBACCache, type RBACConfig,
|
|
1961
|
+
export { ALL_PERMISSIONS, type AccessLevel, AccessLevelGuard, type AllPermissions, CACHE_PATTERNS, type DataAccessRecord, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, type EnhancedNavigationMenuProps, type EventAppRole, GLOBAL_PERMISSIONS, type GlobalRole, InvalidScopeError, type LogLevel, MissingUserContextError, type NavigationAccessRecord, type NavigationContextType, NavigationGuard, type NavigationGuardProps, type NavigationItem, NavigationProvider, type NavigationProviderProps, ORGANISATION_PERMISSIONS, type Operation, OrganisationContextRequiredError, type OrganisationRole, PAGE_PERMISSIONS, type PageAccessRecord, type PagePermissionContextType, PagePermissionGuard, type PagePermissionGuardProps, PagePermissionProvider, type PagePermissionProviderProps, type Permission, type PermissionCheck, PermissionDeniedError, PermissionEnforcer, type PermissionEnforcerProps, PermissionGuard, type PermissionMap, RBACAuditManager, RBACCache, type RBACConfig, RBACEngine, RBACError, type RBACLogger, RBACNotInitializedError, RoleBasedRouter, type RoleBasedRouterContextType, type RoleBasedRouterProps, type RouteAccessRecord, type RouteConfig, type Scope, type SecureDataContextType, SecureDataProvider, type SecureDataProviderProps, SecureSupabaseClient, type UUID, type UseResolvedScopeOptions, type UseResolvedScopeReturn, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, emitAuditEvent, fromSupabaseClient, getAccessLevel, getGlobalAuditManager, getPermissionMap, getPermissionsForRole, getRBACConfig, getRBACLogger, getRoleContext, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPermitted, isPermittedCached, isValidPermission, rbacCache, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useRoleBasedRouter, useSecureData, withAccessLevelGuard, withPermissionGuard, withRoleGuard };
|
package/dist/rbac/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
PagePermissionProvider,
|
|
13
13
|
PermissionEnforcer,
|
|
14
14
|
PermissionGuard,
|
|
15
|
-
RBACProvider,
|
|
16
15
|
RoleBasedRouter,
|
|
17
16
|
SecureDataProvider,
|
|
18
17
|
SecureSupabaseClient,
|
|
@@ -26,13 +25,12 @@ import {
|
|
|
26
25
|
isValidPermission,
|
|
27
26
|
useNavigationPermissions,
|
|
28
27
|
usePagePermissions,
|
|
29
|
-
useRBAC as useRBAC2,
|
|
30
28
|
useRoleBasedRouter,
|
|
31
29
|
useSecureData,
|
|
32
30
|
withAccessLevelGuard,
|
|
33
31
|
withPermissionGuard,
|
|
34
32
|
withRoleGuard
|
|
35
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-2OGV6IRV.js";
|
|
36
34
|
import {
|
|
37
35
|
useAccessLevel,
|
|
38
36
|
useCachedPermissions,
|
|
@@ -43,7 +41,7 @@ import {
|
|
|
43
41
|
usePermissions,
|
|
44
42
|
useRBAC,
|
|
45
43
|
useResolvedScope
|
|
46
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-LRQ6RBJC.js";
|
|
47
45
|
import {
|
|
48
46
|
CACHE_PATTERNS,
|
|
49
47
|
RBACCache,
|
|
@@ -54,6 +52,7 @@ import {
|
|
|
54
52
|
getPermissionMap,
|
|
55
53
|
getRBACConfig,
|
|
56
54
|
getRBACLogger,
|
|
55
|
+
getRoleContext,
|
|
57
56
|
hasAllPermissions,
|
|
58
57
|
hasAnyPermission,
|
|
59
58
|
hasPermission,
|
|
@@ -62,23 +61,23 @@ import {
|
|
|
62
61
|
isPermitted,
|
|
63
62
|
isPermittedCached,
|
|
64
63
|
rbacCache,
|
|
64
|
+
resolveAppContext,
|
|
65
65
|
setupRBAC
|
|
66
|
-
} from "../chunk-
|
|
66
|
+
} from "../chunk-S63MFSY6.js";
|
|
67
67
|
import {
|
|
68
68
|
RBACAuditManager,
|
|
69
69
|
createAuditManager,
|
|
70
70
|
emitAuditEvent,
|
|
71
71
|
getGlobalAuditManager,
|
|
72
72
|
setGlobalAuditManager
|
|
73
|
-
} from "../chunk-
|
|
74
|
-
import "../chunk-
|
|
75
|
-
import "../chunk-
|
|
76
|
-
import "../chunk-
|
|
77
|
-
import "../chunk-
|
|
78
|
-
import "../chunk-
|
|
79
|
-
import "../chunk-
|
|
80
|
-
import "../chunk-
|
|
81
|
-
import "../chunk-XLZ7U46Z.js";
|
|
73
|
+
} from "../chunk-Q7APDV6H.js";
|
|
74
|
+
import "../chunk-5BO3MI5Y.js";
|
|
75
|
+
import "../chunk-FT2M4R4F.js";
|
|
76
|
+
import "../chunk-FL4ZCQLD.js";
|
|
77
|
+
import "../chunk-QGVSOUJ2.js";
|
|
78
|
+
import "../chunk-MNJXXD6C.js";
|
|
79
|
+
import "../chunk-JCQZ6LA7.js";
|
|
80
|
+
import "../chunk-CVMVPYAL.js";
|
|
82
81
|
import "../chunk-PLDDJCW6.js";
|
|
83
82
|
export {
|
|
84
83
|
ALL_PERMISSIONS,
|
|
@@ -98,7 +97,6 @@ export {
|
|
|
98
97
|
RBACAuditManager,
|
|
99
98
|
RBACCache,
|
|
100
99
|
RBACEngine,
|
|
101
|
-
RBACProvider,
|
|
102
100
|
RoleBasedRouter,
|
|
103
101
|
SecureDataProvider,
|
|
104
102
|
SecureSupabaseClient,
|
|
@@ -116,6 +114,7 @@ export {
|
|
|
116
114
|
getPermissionsForRole,
|
|
117
115
|
getRBACConfig,
|
|
118
116
|
getRBACLogger,
|
|
117
|
+
getRoleContext,
|
|
119
118
|
hasAllPermissions,
|
|
120
119
|
hasAnyPermission,
|
|
121
120
|
hasAnyPermissionCached,
|
|
@@ -127,6 +126,7 @@ export {
|
|
|
127
126
|
isPermittedCached,
|
|
128
127
|
isValidPermission,
|
|
129
128
|
rbacCache,
|
|
129
|
+
resolveAppContext,
|
|
130
130
|
setGlobalAuditManager,
|
|
131
131
|
setupRBAC,
|
|
132
132
|
useAccessLevel,
|
|
@@ -139,7 +139,6 @@ export {
|
|
|
139
139
|
usePagePermissions,
|
|
140
140
|
usePermissions,
|
|
141
141
|
useRBAC,
|
|
142
|
-
useRBAC2 as useRBACProvider,
|
|
143
142
|
useResolvedScope,
|
|
144
143
|
useRoleBasedRouter,
|
|
145
144
|
useSecureData,
|
|
@@ -17,13 +17,21 @@ declare module '@tanstack/react-table' {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Base data record type - all DataTable data must extend this
|
|
21
|
+
* This is a marker type that allows any object to be used as a data record
|
|
22
|
+
* Individual implementations should define more specific types
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
interface DataRecord {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Row ID type - always a string
|
|
29
|
+
*/
|
|
30
|
+
type RowId = string;
|
|
23
31
|
/**
|
|
24
32
|
* Row identifier function type
|
|
25
33
|
*/
|
|
26
|
-
type GetRowId<TData extends DataRecord> = (row: TData, index: number) =>
|
|
34
|
+
type GetRowId<TData extends DataRecord> = (row: TData, index: number) => RowId;
|
|
27
35
|
/**
|
|
28
36
|
* Hierarchical configuration for DataTable
|
|
29
37
|
*/
|
|
@@ -170,6 +178,8 @@ interface DataTableColumn<TData extends DataRecord = DataRecord> extends Omit<Co
|
|
|
170
178
|
id?: string;
|
|
171
179
|
/** Accessor key for data */
|
|
172
180
|
accessorKey?: string;
|
|
181
|
+
/** Alternative accessor key used while editing */
|
|
182
|
+
editAccessorKey?: string;
|
|
173
183
|
/** Custom header label for the column */
|
|
174
184
|
header: string;
|
|
175
185
|
/** Whether this column should be searchable in global filter */
|
|
@@ -187,7 +197,9 @@ interface DataTableColumn<TData extends DataRecord = DataRecord> extends Omit<Co
|
|
|
187
197
|
/** Enable virtual scrolling for this column */
|
|
188
198
|
virtualizable?: boolean;
|
|
189
199
|
/** Custom cell renderer with memoization */
|
|
190
|
-
memoizedCell?: React__default.ComponentType<
|
|
200
|
+
memoizedCell?: React__default.ComponentType<{
|
|
201
|
+
row: TData;
|
|
202
|
+
}>;
|
|
191
203
|
/** Field type for editing (text, select, date, etc.) */
|
|
192
204
|
fieldType?: 'text' | 'select' | 'date' | 'number' | 'boolean';
|
|
193
205
|
/** Options for select fields */
|
|
@@ -216,6 +228,10 @@ interface DataTableColumn<TData extends DataRecord = DataRecord> extends Omit<Co
|
|
|
216
228
|
/**
|
|
217
229
|
* Action definition for row-level operations
|
|
218
230
|
*/
|
|
231
|
+
/**
|
|
232
|
+
* Boolean condition or predicate evaluated against a row
|
|
233
|
+
*/
|
|
234
|
+
type ActionCondition<TData extends DataRecord> = boolean | ((row: TData) => boolean);
|
|
219
235
|
interface DataTableAction<TData extends DataRecord> {
|
|
220
236
|
/** Display label for the action */
|
|
221
237
|
label: string;
|
|
@@ -228,9 +244,11 @@ interface DataTableAction<TData extends DataRecord> {
|
|
|
228
244
|
/** Visual variant */
|
|
229
245
|
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost';
|
|
230
246
|
/** Whether action is disabled */
|
|
231
|
-
disabled?:
|
|
247
|
+
disabled?: ActionCondition<TData>;
|
|
232
248
|
/** Whether action is hidden (for RBAC) */
|
|
233
249
|
hidden?: boolean;
|
|
250
|
+
/** Explicit visibility override */
|
|
251
|
+
visible?: ActionCondition<TData>;
|
|
234
252
|
/** Test ID for testing */
|
|
235
253
|
testId?: string;
|
|
236
254
|
/** Whether this action should only show for parent rows (hierarchical mode) */
|
|
@@ -249,6 +267,12 @@ interface DataTableAction<TData extends DataRecord> {
|
|
|
249
267
|
parentLabel?: string;
|
|
250
268
|
/** Label for child rows (overrides label when showForChild is true) */
|
|
251
269
|
childLabel?: string;
|
|
270
|
+
/** Whether the action should be shown while the row is in edit mode */
|
|
271
|
+
showInEditMode?: boolean;
|
|
272
|
+
/** Whether the action should be hidden while the row is in view mode */
|
|
273
|
+
hideInViewMode?: boolean;
|
|
274
|
+
/** Whether the action should explicitly render while in view mode */
|
|
275
|
+
showInViewMode?: boolean;
|
|
252
276
|
}
|
|
253
277
|
/**
|
|
254
278
|
* Toolbar button definition
|
|
@@ -295,7 +319,7 @@ interface EmptyStateConfig {
|
|
|
295
319
|
* Unified feature configuration for DataTable
|
|
296
320
|
* All features are disabled by default and must be explicitly enabled
|
|
297
321
|
*/
|
|
298
|
-
interface
|
|
322
|
+
interface DataTableFeatureFlags {
|
|
299
323
|
/** Enable global search functionality */
|
|
300
324
|
search: boolean;
|
|
301
325
|
/** Enable pagination controls */
|
|
@@ -327,6 +351,12 @@ interface DataTableFeatureConfig {
|
|
|
327
351
|
/** Enable hierarchical parent/child rows */
|
|
328
352
|
hierarchical: boolean;
|
|
329
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Consumer-facing feature configuration. All properties are optional and will be
|
|
356
|
+
* merged with {@link defaultDataTableFeatures} at runtime to keep the public API
|
|
357
|
+
* ergonomic while maintaining strict internal guarantees.
|
|
358
|
+
*/
|
|
359
|
+
type DataTableFeatureConfig = Partial<DataTableFeatureFlags>;
|
|
330
360
|
/**
|
|
331
361
|
* RBAC configuration for DataTable - MANDATORY for all DataTables
|
|
332
362
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { U as User, S as Session, A as AuthError, a as UserPermissions, P as PermissionError, b as PermissionString, c as AccessLevel, d as AuthErrorCode } from './unified-
|
|
2
|
-
export { D as DataRecord, t as DataTableAction, u as DataTableColumn,
|
|
1
|
+
import { U as User, S as Session, A as AuthError, a as UserPermissions, P as PermissionError, b as PermissionString, c as AccessLevel, d as AuthErrorCode } from './unified-DQ4VcT7H.js';
|
|
2
|
+
export { D as DataRecord, t as DataTableAction, u as DataTableColumn, E as Event, s as EventContextType, r as EventTheme, q as PermissionContext, e as PermissionErrorCode, p as PermissionMap, R as RequestId, g as SessionToken, T as ThemeColors, f as UserId, j as createPermissionString, k as createRequestId, i as createSessionToken, h as createUserId, n as isPermissionString, o as isRequestId, m as isSessionToken, l as isUserId } from './unified-DQ4VcT7H.js';
|
|
3
3
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
4
|
-
export { D as Database } from './database-
|
|
4
|
+
export { D as Database } from './database-BXAfr2Y_.js';
|
|
5
5
|
export { C as ChangePasswordFormValues, t as ContactFormData, F as FormData, m as LoginFormData, L as LoginFormValues, P as PasswordResetFormValues, q as ProfileFormData, o as RegistrationFormData, R as RegistrationFormValues, S as SecureLoginFormValues, k as SecurePasswordResetFormValues, j as SecureRegistrationFormValues, U as UserProfileFormValues, V as ValidationError, a as ValidationResult, g as changePasswordSchema, w as combineSchemas, i as contactFormSchema, d as dateSchema, e as emailSchema, l as loginSchema, n as nameSchema, f as passwordResetSchema, b as passwordSchema, p as phoneSchema, v as pickSchema, r as registrationSchema, c as secureLoginSchema, s as securePasswordSchema, u as urlSchema, h as userProfileSchema } from './validation-D8VcbTzC.js';
|
|
6
6
|
export { b as FileCategory, a as FileMetadata, F as FileReference, d as FileReferenceService, c as FileUploadOptions, e as FileUploadResult, S as StorageUploadOptions } from './file-reference-9xUOnwyt.js';
|
|
7
7
|
import 'zod';
|