@jmruthers/pace-core 0.6.5 → 0.6.7
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 +104 -0
- package/README.md +5 -403
- package/audit-tool/00-dependencies.cjs +394 -0
- package/audit-tool/audits/01-pace-core-compliance.cjs +556 -0
- package/audit-tool/audits/02-project-structure.cjs +255 -0
- package/audit-tool/audits/03-architecture.cjs +196 -0
- package/audit-tool/audits/04-code-quality.cjs +149 -0
- package/audit-tool/audits/05-styling.cjs +224 -0
- package/audit-tool/audits/06-security-rbac.cjs +544 -0
- package/audit-tool/audits/07-api-tech-stack.cjs +301 -0
- package/audit-tool/audits/08-testing-documentation.cjs +202 -0
- package/audit-tool/audits/09-operations.cjs +208 -0
- package/audit-tool/index.cjs +291 -0
- package/audit-tool/utils/code-utils.cjs +218 -0
- package/audit-tool/utils/file-utils.cjs +230 -0
- package/audit-tool/utils/report-utils.cjs +241 -0
- package/core-usage-manifest.json +93 -0
- package/cursor-rules/00-standards-overview.mdc +156 -0
- package/cursor-rules/01-pace-core-compliance.mdc +586 -0
- package/cursor-rules/02-project-structure.mdc +42 -4
- package/cursor-rules/{03-solid-principles.mdc → 03-architecture.mdc} +126 -10
- package/cursor-rules/04-code-quality.mdc +419 -0
- package/cursor-rules/{08-markup-quality.mdc → 05-styling.mdc} +104 -34
- package/cursor-rules/06-security-rbac.mdc +518 -0
- package/cursor-rules/07-api-tech-stack.mdc +377 -0
- package/cursor-rules/08-testing-documentation.mdc +324 -0
- package/cursor-rules/09-operations.mdc +365 -0
- package/dist/{AuthService-Cb34EQs3.d.ts → AuthService-DmfO5rGS.d.ts} +10 -0
- package/dist/DataTable-7PMH7XN7.js +15 -0
- package/dist/{DataTable-BMRU8a1j.d.ts → DataTable-DRUIgtUH.d.ts} +1 -1
- package/dist/{PublicPageProvider-QTFVrL-Z.d.ts → PublicPageProvider-DlsCaR5v.d.ts} +33 -72
- package/dist/UnifiedAuthProvider-ZT6TIGM7.js +7 -0
- package/dist/api-Y4MQWOFW.js +4 -0
- package/dist/audit-MYQXYZFU.js +3 -0
- package/dist/{chunk-DGUM43GV.js → chunk-3RG5ZIWI.js} +1 -4
- package/dist/{chunk-QXHPKYJV.js → chunk-4SXLQIZO.js} +1 -26
- package/dist/{chunk-UPPMRMYG.js → chunk-5X4QLXRG.js} +73 -151
- package/dist/chunk-6F3IILHI.js +62 -0
- package/dist/{chunk-E66EQZE6.js → chunk-6GLLNA6U.js} +3 -9
- package/dist/{chunk-ZSAAAMVR.js → chunk-6QYDGKQY.js} +1 -4
- package/dist/{chunk-FMUCXFII.js → chunk-7ILTDCL2.js} +9 -5
- package/dist/{chunk-M43Y4SSO.js → chunk-A3W6LW53.js} +15 -13
- package/dist/{chunk-63FOKYGO.js → chunk-AHU7G2R5.js} +2 -11
- package/dist/{chunk-HU2C6SSC.js → chunk-BM4CQ5P3.js} +606 -559
- package/dist/chunk-C7NSAPTL.js +1 -0
- package/dist/{chunk-J36DSWQK.js → chunk-FEJLJNWA.js} +7 -41
- package/dist/{chunk-IHB5DR3H.js → chunk-FTCRZOG2.js} +188 -387
- package/dist/{chunk-G37KK66H.js → chunk-FYHN4DD5.js} +60 -19
- package/dist/chunk-GHYHJTYV.js +994 -0
- package/dist/{chunk-VBXEHIUJ.js → chunk-HF6O3O37.js} +6 -88
- package/dist/{chunk-FFQEQTNW.js → chunk-IUBRCBSY.js} +134 -45
- package/dist/{chunk-6COVEUS7.js → chunk-JGWDVX64.js} +983 -1034
- package/dist/{chunk-RGAWHO7N.js → chunk-L4XMVJKY.js} +77 -222
- package/dist/chunk-MBADTM7L.js +64 -0
- package/dist/{chunk-M7MPQISP.js → chunk-OJ4SKRSV.js} +3 -16
- package/dist/{chunk-IVOFDYWT.js → chunk-Q7Q7V5NV.js} +2109 -1604
- package/dist/{chunk-JGRYX5UX.js → chunk-S7DKJPLT.js} +29 -58
- package/dist/{chunk-PWLANIRT.js → chunk-TTRFSOKR.js} +1 -7
- package/dist/{chunk-5DRSZLL2.js → chunk-UH3NTO3F.js} +1 -6
- package/dist/{chunk-NTM7ZSB6.js → chunk-VBCS3DUA.js} +261 -168
- package/dist/{chunk-EFN2EIMK.js → chunk-ZFYPMX46.js} +271 -87
- package/dist/{chunk-L4OXEN46.js → chunk-ZKAWKYT4.js} +10 -24
- package/dist/components.d.ts +7 -5
- package/dist/components.js +46 -257
- package/dist/{database.generated-CzIvgcPu.d.ts → database.generated-CcnC_DRc.d.ts} +4795 -3691
- package/dist/eslint-rules/index.cjs +35 -0
- package/{src/eslint-rules/pace-core-compliance.cjs → dist/eslint-rules/rules/01-pace-core-compliance.cjs} +234 -235
- package/dist/eslint-rules/rules/04-code-quality.cjs +290 -0
- package/dist/eslint-rules/rules/05-styling.cjs +61 -0
- package/dist/eslint-rules/rules/06-security-rbac.cjs +806 -0
- package/dist/eslint-rules/rules/07-api-tech-stack.cjs +263 -0
- package/dist/eslint-rules/rules/08-testing.cjs +94 -0
- package/dist/eslint-rules/utils/helpers.cjs +42 -0
- package/dist/eslint-rules/utils/manifest-loader.cjs +75 -0
- package/dist/hooks.d.ts +6 -6
- package/dist/hooks.js +62 -172
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/index.d.ts +12 -11
- package/dist/index.js +67 -660
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +8 -35
- package/dist/rbac/eslint-rules.d.ts +46 -44
- package/dist/rbac/eslint-rules.js +7 -4
- package/dist/rbac/index.d.ts +109 -586
- package/dist/rbac/index.js +14 -207
- package/dist/styles/index.js +2 -12
- package/dist/theming/runtime.d.ts +14 -1
- package/dist/theming/runtime.js +3 -19
- package/dist/{timezone-CHhWg6b4.d.ts → timezone-BZe_eUxx.d.ts} +175 -1
- package/dist/{types-CkbwOr4Y.d.ts → types-DXstZpNI.d.ts} +4 -17
- package/dist/types-t9H8qKRw.d.ts +55 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +7 -94
- package/dist/{usePublicRouteParams-ClnV4tnv.d.ts → usePublicRouteParams-MamNgwqe.d.ts} +20 -20
- package/dist/utils.d.ts +24 -117
- package/dist/utils.js +54 -392
- package/docs/README.md +17 -7
- package/docs/api/README.md +4 -402
- package/docs/api/modules.md +301 -871
- package/docs/api-reference/components.md +21 -21
- package/docs/api-reference/deprecated.md +31 -6
- package/docs/api-reference/hooks.md +80 -80
- package/docs/api-reference/rpc-functions.md +78 -3
- package/docs/api-reference/types.md +1 -1
- package/docs/api-reference/utilities.md +1 -1
- package/docs/architecture/README.md +1 -1
- package/docs/core-concepts/events.md +3 -3
- package/docs/core-concepts/organisations.md +6 -6
- package/docs/core-concepts/permissions.md +6 -6
- package/docs/documentation-index.md +12 -18
- package/docs/getting-started/cursor-rules.md +3 -23
- package/docs/getting-started/dependencies.md +650 -0
- package/docs/getting-started/documentation-index.md +1 -1
- package/docs/getting-started/examples/README.md +4 -4
- package/docs/getting-started/examples/full-featured-app.md +1 -1
- package/docs/getting-started/faq.md +2 -2
- package/docs/getting-started/installation-guide.md +20 -7
- package/docs/getting-started/quick-reference.md +4 -4
- package/docs/getting-started/quick-start.md +23 -12
- package/docs/implementation-guides/authentication.md +15 -15
- package/docs/implementation-guides/component-styling.md +1 -1
- package/docs/implementation-guides/data-tables.md +126 -33
- package/docs/implementation-guides/datatable-rbac-usage.md +1 -1
- package/docs/implementation-guides/dynamic-colors.md +3 -3
- package/docs/implementation-guides/file-upload-storage.md +2 -2
- package/docs/implementation-guides/hierarchical-datatable.md +40 -60
- package/docs/implementation-guides/inactivity-tracking.md +3 -3
- package/docs/implementation-guides/large-datasets.md +3 -2
- package/docs/implementation-guides/organisation-security.md +2 -2
- package/docs/implementation-guides/performance.md +2 -2
- package/docs/implementation-guides/permission-enforcement.md +5 -1
- package/docs/migration/V0.3.44_organisation-context-timing-fix.md +1 -1
- package/docs/migration/V0.4.0_rbac-migration.md +6 -6
- package/docs/rbac/MIGRATION_GUIDE.md +819 -0
- package/docs/rbac/RBAC_CONTRACT.md +724 -0
- package/docs/rbac/README.md +17 -8
- package/docs/rbac/advanced-patterns.md +6 -6
- package/docs/rbac/api-reference.md +20 -20
- package/docs/rbac/edge-functions-guide.md +376 -0
- package/docs/rbac/event-based-apps.md +3 -3
- package/docs/rbac/examples.md +41 -41
- package/docs/rbac/getting-started.md +37 -37
- package/docs/rbac/performance.md +1 -1
- package/docs/rbac/quick-start.md +52 -52
- package/docs/rbac/secure-client-protection.md +1 -35
- package/docs/rbac/troubleshooting.md +1 -1
- package/docs/security/README.md +5 -5
- package/docs/standards/0-standards-overview.md +220 -0
- package/docs/standards/1-pace-core-compliance-standards.md +986 -0
- package/docs/standards/2-project-structure-standards.md +949 -0
- package/docs/standards/3-architecture-standards.md +606 -0
- package/docs/standards/4-code-quality-standards.md +728 -0
- package/docs/standards/5-styling-standards.md +348 -0
- package/docs/standards/{07-rbac-and-rls-standard.md → 6-security-rbac-standards.md} +269 -66
- package/docs/standards/7-api-tech-stack-standards.md +662 -0
- package/docs/standards/8-testing-documentation-standards.md +401 -0
- package/docs/standards/9-operations-standards.md +1102 -0
- package/docs/standards/README.md +185 -57
- package/docs/troubleshooting/README.md +4 -4
- package/docs/troubleshooting/common-issues.md +2 -2
- package/docs/troubleshooting/debugging.md +9 -9
- package/docs/troubleshooting/migration.md +4 -4
- package/docs/troubleshooting/organisation-context-setup.md +42 -19
- package/eslint-config-pace-core.cjs +33 -6
- package/package.json +35 -23
- package/scripts/install-cursor-rules.cjs +25 -6
- package/scripts/install-eslint-config.cjs +284 -0
- package/src/__tests__/fixtures/supabase.ts +1 -1
- package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +3 -3
- package/src/__tests__/helpers/__tests__/optimized-test-setup.test.ts +1 -1
- package/src/__tests__/helpers/__tests__/supabaseMock.test.ts +1 -1
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -2
- package/src/__tests__/helpers/__tests__/test-utils.test.tsx +13 -13
- package/src/__tests__/helpers/component-test-utils.tsx +1 -1
- package/src/__tests__/helpers/supabaseMock.ts +2 -2
- package/src/__tests__/integration/UserProfile.test.tsx +14 -14
- package/src/__tests__/public-recipe-view.test.ts +38 -9
- package/src/__tests__/rbac/PagePermissionGuard.test.tsx +6 -6
- package/src/__tests__/templates/accessibility.test.template.tsx +9 -9
- package/src/__tests__/templates/component.test.template.tsx +18 -15
- package/src/components/Button/Button.tsx +5 -1
- package/src/components/Calendar/Calendar.tsx +201 -47
- package/src/components/ContextSelector/ContextSelector.tsx +106 -119
- package/src/components/DataTable/AUDIT_REPORT.md +293 -0
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +10 -2
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +10 -4
- package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +9 -9
- package/src/components/DataTable/components/ColumnFilter.tsx +63 -74
- package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +43 -41
- package/src/components/DataTable/components/DataTableCore.tsx +186 -13
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +9 -11
- package/src/components/DataTable/components/DataTableLayout.tsx +35 -21
- package/src/components/DataTable/components/EditFields.tsx +23 -3
- package/src/components/DataTable/components/EditableRow.tsx +12 -9
- package/src/components/DataTable/components/EmptyState.tsx +10 -9
- package/src/components/DataTable/components/FilterRow.tsx +2 -4
- package/src/components/DataTable/components/ImportModal.tsx +124 -126
- package/src/components/DataTable/components/LoadingState.tsx +5 -6
- package/src/components/DataTable/components/RowComponent.tsx +12 -0
- package/src/components/DataTable/components/SortIndicator.tsx +50 -0
- package/src/components/DataTable/components/__tests__/COVERAGE_NOTE.md +4 -4
- package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +23 -82
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +37 -9
- package/src/components/DataTable/components/__tests__/EmptyState.test.tsx +7 -4
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +12 -4
- package/src/components/DataTable/components/__tests__/LoadingState.test.tsx +41 -27
- package/src/components/DataTable/components/hooks/usePermissionTracking.ts +0 -4
- package/src/components/DataTable/components/index.ts +2 -1
- package/src/components/DataTable/hooks/__tests__/useDataTableState.test.ts +51 -47
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +24 -21
- package/src/components/DataTable/hooks/useDataTableState.ts +125 -9
- package/src/components/DataTable/hooks/useTableColumns.ts +40 -2
- package/src/components/DataTable/hooks/useTableHandlers.ts +11 -0
- package/src/components/DataTable/types.ts +5 -18
- package/src/components/DataTable/utils/a11yUtils.ts +17 -0
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +2 -1
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +11 -15
- package/src/components/DateTimeField/DateTimeField.tsx +10 -9
- package/src/components/Dialog/Dialog.test.tsx +128 -104
- package/src/components/Dialog/Dialog.tsx +742 -24
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +77 -79
- package/src/components/FileDisplay/FileDisplay.test.tsx +4 -2
- package/src/components/FileDisplay/FileDisplay.tsx +23 -17
- package/src/components/FileUpload/FileUpload.test.tsx +52 -14
- package/src/components/FileUpload/FileUpload.tsx +112 -130
- package/src/components/Form/Form.test.tsx +6 -8
- package/src/components/Form/Form.tsx +365 -4
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +14 -13
- package/src/components/NavigationMenu/useNavigationFiltering.ts +11 -21
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +6 -4
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +11 -15
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +108 -61
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +27 -3
- package/src/components/Progress/Progress.tsx +2 -4
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +8 -8
- package/src/components/Select/Select.tsx +109 -98
- package/src/components/Select/types.ts +4 -1
- package/src/components/UserMenu/UserMenu.tsx +9 -6
- package/src/hooks/__tests__/ServiceHooks.test.tsx +16 -16
- package/src/hooks/__tests__/hooks.integration.test.tsx +55 -57
- package/src/hooks/__tests__/useAppConfig.unit.test.ts +129 -67
- package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +97 -97
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +149 -67
- package/src/hooks/__tests__/usePublicEvent.test.ts +149 -79
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +158 -109
- package/src/hooks/__tests__/useSessionDraft.test.ts +163 -0
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +10 -5
- package/src/hooks/public/usePublicEvent.ts +67 -195
- package/src/hooks/public/usePublicEventLogo.test.ts +70 -17
- package/src/hooks/public/usePublicEventLogo.ts +24 -14
- package/src/hooks/public/usePublicFileDisplay.ts +2 -2
- package/src/hooks/public/usePublicRouteParams.ts +5 -5
- package/src/hooks/useAppConfig.ts +28 -26
- package/src/hooks/useEventTheme.test.ts +217 -239
- package/src/hooks/useEventTheme.ts +16 -28
- package/src/hooks/useFileDisplay.ts +2 -2
- package/src/hooks/useOrganisationPermissions.ts +5 -7
- package/src/hooks/useQueryCache.ts +0 -1
- package/src/hooks/useSessionDraft.ts +380 -0
- package/src/hooks/useSessionRestoration.ts +3 -1
- package/src/icons/index.ts +27 -0
- package/src/index.ts +5 -0
- package/src/providers/OrganisationProvider.tsx +23 -14
- package/src/providers/UnifiedAuthProvider.smoke.test.tsx +21 -21
- package/src/providers/__tests__/AuthProvider.test.tsx +21 -21
- package/src/providers/__tests__/EventProvider.test.tsx +61 -61
- package/src/providers/__tests__/InactivityProvider.test.tsx +56 -56
- package/src/providers/__tests__/OrganisationProvider.test.tsx +75 -75
- package/src/providers/__tests__/ProviderLifecycle.test.tsx +37 -37
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +103 -103
- package/src/providers/services/EventServiceProvider.tsx +1 -24
- package/src/providers/services/UnifiedAuthProvider.tsx +5 -48
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +7 -7
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +13 -10
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +7 -457
- package/src/rbac/__tests__/auth-rbac.e2e.test.tsx +33 -7
- package/src/rbac/adapters.tsx +7 -295
- package/src/rbac/api.test.ts +44 -56
- package/src/rbac/api.ts +10 -17
- package/src/rbac/cache-invalidation.ts +0 -1
- package/src/rbac/compliance/index.ts +10 -0
- package/src/rbac/compliance/pattern-detector.ts +553 -0
- package/src/rbac/compliance/runtime-compliance.ts +22 -0
- package/src/rbac/components/AccessDenied.tsx +150 -0
- package/src/rbac/components/NavigationGuard.tsx +12 -20
- package/src/rbac/components/PagePermissionGuard.tsx +4 -24
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +21 -8
- package/src/rbac/components/index.ts +3 -41
- package/src/rbac/eslint-rules.js +1 -1
- package/src/rbac/hooks/index.ts +0 -3
- package/src/rbac/hooks/permissions/index.ts +0 -3
- package/src/rbac/hooks/permissions/useAccessLevel.ts +4 -8
- package/src/rbac/hooks/usePermissions.ts +0 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +57 -47
- package/src/rbac/hooks/useResolvedScope.ts +58 -140
- package/src/rbac/hooks/useResourcePermissions.test.ts +124 -38
- package/src/rbac/hooks/useResourcePermissions.ts +139 -48
- package/src/rbac/hooks/useRoleManagement.test.ts +65 -22
- package/src/rbac/hooks/useRoleManagement.ts +147 -19
- package/src/rbac/hooks/useSecureSupabase.ts +4 -8
- package/src/rbac/index.ts +7 -9
- package/src/rbac/utils/contextValidator.ts +9 -7
- package/src/services/AuthService.ts +130 -18
- package/src/services/EventService.ts +4 -97
- package/src/services/InactivityService.ts +16 -0
- package/src/services/OrganisationService.ts +7 -44
- package/src/services/__tests__/OrganisationService.test.ts +26 -8
- package/src/services/base/BaseService.ts +0 -3
- package/src/styles/core.css +7 -0
- package/src/theming/__tests__/parseEventColours.test.ts +9 -3
- package/src/theming/parseEventColours.ts +22 -10
- package/src/types/database.generated.ts +4733 -3809
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +42 -39
- package/src/utils/__tests__/organisationContext.unit.test.ts +9 -10
- package/src/utils/context/organisationContext.test.ts +13 -28
- package/src/utils/context/organisationContext.ts +21 -52
- package/src/utils/dynamic/dynamicUtils.ts +1 -1
- package/src/utils/file-reference/index.ts +39 -15
- package/src/utils/formatting/formatDateTime.test.ts +3 -2
- package/src/utils/google-places/loadGoogleMapsScript.ts +29 -4
- package/src/utils/index.ts +4 -1
- package/src/utils/persistence/__tests__/keyDerivation.test.ts +135 -0
- package/src/utils/persistence/__tests__/sensitiveFieldDetection.test.ts +123 -0
- package/src/utils/persistence/keyDerivation.ts +304 -0
- package/src/utils/persistence/sensitiveFieldDetection.ts +212 -0
- package/src/utils/security/secureStorage.ts +5 -5
- package/src/utils/storage/README.md +1 -1
- package/src/utils/storage/helpers.ts +3 -3
- package/src/utils/supabase/createBaseClient.ts +147 -0
- package/src/utils/timezone/timezone.test.ts +1 -2
- package/src/utils/timezone/timezone.ts +1 -1
- package/src/utils/validation/csrf.ts +4 -4
- package/cursor-rules/00-pace-core-compliance.mdc +0 -331
- package/cursor-rules/01-standards-compliance.mdc +0 -244
- package/cursor-rules/04-testing-standards.mdc +0 -268
- package/cursor-rules/05-bug-reports-and-features.mdc +0 -246
- package/cursor-rules/06-code-quality.mdc +0 -309
- package/cursor-rules/07-tech-stack-compliance.mdc +0 -214
- package/cursor-rules/CHANGELOG.md +0 -119
- package/cursor-rules/README.md +0 -192
- package/dist/DataTable-AOVNCPTX.js +0 -175
- package/dist/DataTable-AOVNCPTX.js.map +0 -1
- package/dist/UnifiedAuthProvider-4SBX4LU5.js +0 -18
- package/dist/UnifiedAuthProvider-4SBX4LU5.js.map +0 -1
- package/dist/api-O6HTBX5Y.js +0 -52
- package/dist/api-O6HTBX5Y.js.map +0 -1
- package/dist/audit-V53FV5AG.js +0 -17
- package/dist/audit-V53FV5AG.js.map +0 -1
- package/dist/chunk-5DRSZLL2.js.map +0 -1
- package/dist/chunk-63FOKYGO.js.map +0 -1
- package/dist/chunk-6COVEUS7.js.map +0 -1
- package/dist/chunk-AFVQODI2.js +0 -263
- package/dist/chunk-AFVQODI2.js.map +0 -1
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-E66EQZE6.js.map +0 -1
- package/dist/chunk-EFN2EIMK.js.map +0 -1
- package/dist/chunk-FFQEQTNW.js.map +0 -1
- package/dist/chunk-FMUCXFII.js.map +0 -1
- package/dist/chunk-G37KK66H.js.map +0 -1
- package/dist/chunk-G7QEZTYQ.js +0 -2053
- package/dist/chunk-G7QEZTYQ.js.map +0 -1
- package/dist/chunk-HU2C6SSC.js.map +0 -1
- package/dist/chunk-IHB5DR3H.js.map +0 -1
- package/dist/chunk-IVOFDYWT.js.map +0 -1
- package/dist/chunk-J36DSWQK.js.map +0 -1
- package/dist/chunk-JGRYX5UX.js.map +0 -1
- package/dist/chunk-KQCRWDSA.js +0 -1
- package/dist/chunk-KQCRWDSA.js.map +0 -1
- package/dist/chunk-L4OXEN46.js.map +0 -1
- package/dist/chunk-LMC26NLJ.js +0 -84
- package/dist/chunk-LMC26NLJ.js.map +0 -1
- package/dist/chunk-M43Y4SSO.js.map +0 -1
- package/dist/chunk-M7MPQISP.js.map +0 -1
- package/dist/chunk-NTM7ZSB6.js.map +0 -1
- package/dist/chunk-PWLANIRT.js.map +0 -1
- package/dist/chunk-QXHPKYJV.js.map +0 -1
- package/dist/chunk-RGAWHO7N.js.map +0 -1
- package/dist/chunk-UPPMRMYG.js.map +0 -1
- package/dist/chunk-VBXEHIUJ.js.map +0 -1
- package/dist/chunk-ZSAAAMVR.js.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/contextValidator-5OGXSPKS.js +0 -9
- package/dist/contextValidator-5OGXSPKS.js.map +0 -1
- package/dist/eslint-rules/pace-core-compliance.cjs +0 -510
- package/dist/hooks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/providers.js.map +0 -1
- package/dist/rbac/eslint-rules.js.map +0 -1
- package/dist/rbac/index.js.map +0 -1
- package/dist/styles/index.js.map +0 -1
- package/dist/theming/runtime.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/docs/best-practices/README.md +0 -472
- package/docs/best-practices/accessibility.md +0 -601
- package/docs/best-practices/common-patterns.md +0 -516
- package/docs/best-practices/deployment.md +0 -1103
- package/docs/best-practices/performance.md +0 -1328
- package/docs/best-practices/security.md +0 -940
- package/docs/best-practices/testing.md +0 -1034
- package/docs/rbac/compliance/compliance-guide.md +0 -544
- package/docs/standards/01-architecture-standard.md +0 -44
- package/docs/standards/02-api-and-rpc-standard.md +0 -39
- package/docs/standards/03-component-standard.md +0 -32
- package/docs/standards/04-code-style-standard.md +0 -32
- package/docs/standards/05-security-standard.md +0 -44
- package/docs/standards/06-testing-and-docs-standard.md +0 -29
- package/docs/standards/pace-core-compliance.md +0 -432
- package/scripts/audit/core/checks/accessibility.cjs +0 -197
- package/scripts/audit/core/checks/api-usage.cjs +0 -191
- package/scripts/audit/core/checks/bundle.cjs +0 -142
- package/scripts/audit/core/checks/compliance.cjs +0 -2706
- package/scripts/audit/core/checks/config.cjs +0 -54
- package/scripts/audit/core/checks/coverage.cjs +0 -84
- package/scripts/audit/core/checks/dependencies.cjs +0 -994
- package/scripts/audit/core/checks/documentation.cjs +0 -268
- package/scripts/audit/core/checks/environment.cjs +0 -116
- package/scripts/audit/core/checks/error-handling.cjs +0 -340
- package/scripts/audit/core/checks/forms.cjs +0 -172
- package/scripts/audit/core/checks/heuristics.cjs +0 -68
- package/scripts/audit/core/checks/hooks.cjs +0 -334
- package/scripts/audit/core/checks/imports.cjs +0 -244
- package/scripts/audit/core/checks/performance.cjs +0 -325
- package/scripts/audit/core/checks/routes.cjs +0 -117
- package/scripts/audit/core/checks/state.cjs +0 -130
- package/scripts/audit/core/checks/structure.cjs +0 -65
- package/scripts/audit/core/checks/style.cjs +0 -584
- package/scripts/audit/core/checks/testing.cjs +0 -122
- package/scripts/audit/core/checks/typescript.cjs +0 -61
- package/scripts/audit/core/scanner.cjs +0 -199
- package/scripts/audit/core/utils.cjs +0 -137
- package/scripts/audit/index.cjs +0 -223
- package/scripts/audit/reporters/console.cjs +0 -151
- package/scripts/audit/reporters/json.cjs +0 -54
- package/scripts/audit/reporters/markdown.cjs +0 -124
- package/scripts/audit-consuming-app.cjs +0 -86
- package/src/components/DataTable/components/DataTableBody.tsx +0 -454
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +0 -156
- package/src/components/DataTable/components/ExpandButton.tsx +0 -113
- package/src/components/DataTable/components/GroupHeader.tsx +0 -54
- package/src/components/DataTable/components/ViewRowModal.tsx +0 -68
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +0 -525
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +0 -462
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +0 -393
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +0 -476
- package/src/components/DataTable/components/__tests__/VirtualizedDataTable.test.tsx +0 -128
- package/src/components/DataTable/core/DataTableContext.tsx +0 -216
- package/src/components/DataTable/core/__tests__/DataTableContext.test.tsx +0 -136
- package/src/components/DataTable/hooks/__tests__/useColumnReordering.test.ts +0 -570
- package/src/components/DataTable/hooks/useColumnReordering.ts +0 -123
- package/src/components/DataTable/utils/debugTools.ts +0 -514
- package/src/eslint-rules/pace-core-compliance.js +0 -638
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +0 -555
- package/src/rbac/components/EnhancedNavigationMenu.tsx +0 -293
- package/src/rbac/components/NavigationProvider.test.tsx +0 -481
- package/src/rbac/components/NavigationProvider.tsx +0 -345
- package/src/rbac/components/PagePermissionProvider.test.tsx +0 -476
- package/src/rbac/components/PagePermissionProvider.tsx +0 -279
- package/src/rbac/components/PermissionEnforcer.tsx +0 -312
- package/src/rbac/components/RoleBasedRouter.tsx +0 -440
- package/src/rbac/components/SecureDataProvider.test.tsx +0 -543
- package/src/rbac/components/SecureDataProvider.tsx +0 -339
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +0 -620
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +0 -726
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +0 -661
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +0 -881
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +0 -783
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +0 -645
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +0 -659
- package/src/rbac/hooks/permissions/useCachedPermissions.ts +0 -79
- package/src/rbac/hooks/permissions/useHasAllPermissions.ts +0 -90
- package/src/rbac/hooks/permissions/useHasAnyPermission.ts +0 -90
package/dist/rbac/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { U as UUID, g as PermissionCacheKey, h as AuditEventSource, i as RBACAuditEvent, a as PermissionCheck, S as Scope, A as AccessLevel, b as PermissionMap, j as RBACAppContext, k as RBACRoleContext,
|
|
1
|
+
import { U as UUID, g as PermissionCacheKey, h as AuditEventSource, i as RBACAuditEvent, a as PermissionCheck, S as Scope, A as AccessLevel, b as PermissionMap, j as RBACAppContext, k as RBACRoleContext, l as UserRBACContext, P as Permission } from '../types-BeoeWV5I.js';
|
|
2
2
|
export { E as EventAppRole, G as GlobalRole, I as InvalidScopeError, M as MissingUserContextError, O as Operation, e as OrganisationContextRequiredError, c as OrganisationRole, d as PermissionDeniedError, R as RBACError, f as RBACNotInitializedError } from '../types-BeoeWV5I.js';
|
|
3
3
|
export { A as AccessLevelContext, s as AuditEventType, P as PermissionSource, d as RBACAccessValidateParams, e as RBACAccessValidateResult, q as RBACAuditLogParams, r as RBACAuditLogResult, t as RBACContext, w as RBACErrorCode, v as RBACFunctionResponse, f as RBACPageAccessCheckParams, R as RBACPermissionCheckParams, a as RBACPermissionCheckResult, b as RBACPermissionsGetParams, c as RBACPermissionsGetResult, u as RBACResult, g as RBACRoleGrantParams, h as RBACRoleGrantResult, i as RBACRoleRevokeParams, j as RBACRoleRevokeResult, m as RBACRoleValidateParams, n as RBACRoleValidateResult, k as RBACRolesListParams, l as RBACRolesListResult, o as RBACSessionTrackParams, p as RBACSessionTrackResult, x as RPCFunction, S as SessionType } from '../functions-DHebl8-F.js';
|
|
4
4
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
5
|
-
import { D as Database } from '../database.generated-
|
|
5
|
+
import { D as Database } from '../database.generated-CcnC_DRc.js';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
-
import React__default
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { a as NavigationItem } from '../types-t9H8qKRw.js';
|
|
8
9
|
import '../core-CUElvH_C.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -842,63 +843,6 @@ declare class RBACEngine {
|
|
|
842
843
|
*/
|
|
843
844
|
declare function createRBACEngine(supabase: SupabaseClient<Database>, securityConfig?: Partial<RBACSecurityConfig>): RBACEngine;
|
|
844
845
|
|
|
845
|
-
interface PagePermissionContextType {
|
|
846
|
-
/** Check if user has permission for a page */
|
|
847
|
-
hasPagePermission: (pageName: string, operation: string, pageId?: string, scope?: Scope) => boolean;
|
|
848
|
-
/** Get all page permissions for current user */
|
|
849
|
-
getPagePermissions: () => Record<string, string[]>;
|
|
850
|
-
/** Check if page permission checking is enabled */
|
|
851
|
-
isEnabled: boolean;
|
|
852
|
-
/** Check if strict mode is enabled */
|
|
853
|
-
isStrictMode: boolean;
|
|
854
|
-
/** Check if audit logging is enabled */
|
|
855
|
-
isAuditLogEnabled: boolean;
|
|
856
|
-
/** Get page access history */
|
|
857
|
-
getPageAccessHistory: () => PageAccessRecord[];
|
|
858
|
-
/** Clear page access history */
|
|
859
|
-
clearPageAccessHistory: () => void;
|
|
860
|
-
}
|
|
861
|
-
interface PageAccessRecord {
|
|
862
|
-
pageName: string;
|
|
863
|
-
operation: string;
|
|
864
|
-
userId: UUID;
|
|
865
|
-
scope: Scope;
|
|
866
|
-
allowed: boolean;
|
|
867
|
-
timestamp: string;
|
|
868
|
-
pageId?: string;
|
|
869
|
-
}
|
|
870
|
-
interface PagePermissionProviderProps {
|
|
871
|
-
/** Child components */
|
|
872
|
-
children: React__default.ReactNode;
|
|
873
|
-
/** Enable strict mode to prevent bypassing (default: true) */
|
|
874
|
-
strictMode?: boolean;
|
|
875
|
-
/** Enable audit logging (default: true) */
|
|
876
|
-
auditLog?: boolean;
|
|
877
|
-
/** Callback when page access is attempted */
|
|
878
|
-
onPageAccess?: (pageName: string, operation: string, allowed: boolean, record: PageAccessRecord) => void;
|
|
879
|
-
/** Callback when strict mode violation occurs */
|
|
880
|
-
onStrictModeViolation?: (pageName: string, operation: string, record: PageAccessRecord) => void;
|
|
881
|
-
/** Maximum number of access records to keep in history */
|
|
882
|
-
maxHistorySize?: number;
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* PagePermissionProvider - Manages page-level permissions across the app
|
|
886
|
-
*
|
|
887
|
-
* This provider ensures that all pages are properly protected and provides
|
|
888
|
-
* centralized page permission management with strict enforcement.
|
|
889
|
-
*
|
|
890
|
-
* @param props - Provider props
|
|
891
|
-
* @returns React element with page permission context
|
|
892
|
-
*/
|
|
893
|
-
declare function PagePermissionProvider({ children, strictMode, auditLog, onPageAccess, onStrictModeViolation, maxHistorySize }: PagePermissionProviderProps): react_jsx_runtime.JSX.Element;
|
|
894
|
-
/**
|
|
895
|
-
* Hook to use page permission context
|
|
896
|
-
*
|
|
897
|
-
* @returns Page permission context
|
|
898
|
-
* @throws Error if used outside of PagePermissionProvider
|
|
899
|
-
*/
|
|
900
|
-
declare function usePagePermissions(): PagePermissionContextType;
|
|
901
|
-
|
|
902
846
|
interface PagePermissionGuardProps {
|
|
903
847
|
/** Name of the page being protected */
|
|
904
848
|
pageName: string;
|
|
@@ -923,281 +867,6 @@ interface PagePermissionGuardProps {
|
|
|
923
867
|
}
|
|
924
868
|
declare const PagePermissionGuard: React__default.MemoExoticComponent<({ pageName, operation, children, fallback, strictMode, auditLog, pageId, scope, onDenied, loading }: PagePermissionGuardProps) => string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null>;
|
|
925
869
|
|
|
926
|
-
interface DataAccessRecord {
|
|
927
|
-
table: string;
|
|
928
|
-
operation: string;
|
|
929
|
-
userId: UUID;
|
|
930
|
-
scope: Scope;
|
|
931
|
-
allowed: boolean;
|
|
932
|
-
timestamp: string;
|
|
933
|
-
query?: string;
|
|
934
|
-
filters?: Record<string, any>;
|
|
935
|
-
}
|
|
936
|
-
interface SecureDataContextType {
|
|
937
|
-
/** Check if data access is allowed for a table and operation */
|
|
938
|
-
isDataAccessAllowed: (table: string, operation: string, scope?: Scope) => boolean;
|
|
939
|
-
/** Get all data access permissions for current user */
|
|
940
|
-
getDataAccessPermissions: () => Record<string, string[]>;
|
|
941
|
-
/** Check if secure data access is enabled */
|
|
942
|
-
isEnabled: boolean;
|
|
943
|
-
/** Check if strict mode is enabled */
|
|
944
|
-
isStrictMode: boolean;
|
|
945
|
-
/** Check if audit logging is enabled */
|
|
946
|
-
isAuditLogEnabled: boolean;
|
|
947
|
-
/** Get data access history */
|
|
948
|
-
getDataAccessHistory: () => DataAccessRecord[];
|
|
949
|
-
/** Clear data access history */
|
|
950
|
-
clearDataAccessHistory: () => void;
|
|
951
|
-
/** Validate data access attempt */
|
|
952
|
-
validateDataAccess: (table: string, operation: string, scope?: Scope) => boolean;
|
|
953
|
-
}
|
|
954
|
-
interface SecureDataProviderProps {
|
|
955
|
-
/** Child components */
|
|
956
|
-
children: React__default.ReactNode;
|
|
957
|
-
/** Enable strict mode to prevent bypassing (default: true) */
|
|
958
|
-
strictMode?: boolean;
|
|
959
|
-
/** Enable audit logging (default: true) */
|
|
960
|
-
auditLog?: boolean;
|
|
961
|
-
/** Callback when data access is attempted */
|
|
962
|
-
onDataAccess?: (table: string, operation: string, allowed: boolean, record: DataAccessRecord) => void;
|
|
963
|
-
/** Callback when strict mode violation occurs */
|
|
964
|
-
onStrictModeViolation?: (table: string, operation: string, record: DataAccessRecord) => void;
|
|
965
|
-
/** Maximum number of access records to keep in history */
|
|
966
|
-
maxHistorySize?: number;
|
|
967
|
-
/** Enable RLS enforcement (default: true) */
|
|
968
|
-
enforceRLS?: boolean;
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* SecureDataProvider - Prevents direct Supabase access and enforces secure data patterns
|
|
972
|
-
*
|
|
973
|
-
* This provider ensures that all data access goes through the secure RBAC system
|
|
974
|
-
* and prevents apps from bypassing data access controls.
|
|
975
|
-
*
|
|
976
|
-
* @param props - Provider props
|
|
977
|
-
* @returns React element with secure data context
|
|
978
|
-
*/
|
|
979
|
-
declare function SecureDataProvider({ children, strictMode, auditLog, onDataAccess, onStrictModeViolation, maxHistorySize, enforceRLS }: SecureDataProviderProps): react_jsx_runtime.JSX.Element;
|
|
980
|
-
/**
|
|
981
|
-
* Hook to use secure data context
|
|
982
|
-
*
|
|
983
|
-
* @returns Secure data context
|
|
984
|
-
* @throws Error if used outside of SecureDataProvider
|
|
985
|
-
*/
|
|
986
|
-
declare function useSecureData(): SecureDataContextType;
|
|
987
|
-
|
|
988
|
-
interface PermissionEnforcerProps {
|
|
989
|
-
/** Permissions required for access */
|
|
990
|
-
permissions: Permission[];
|
|
991
|
-
/** Operation being performed */
|
|
992
|
-
operation: string;
|
|
993
|
-
/** Content to render when user has permission */
|
|
994
|
-
children: React__default.ReactNode;
|
|
995
|
-
/** Content to render when user lacks permission */
|
|
996
|
-
fallback?: React__default.ReactNode;
|
|
997
|
-
/** Enable strict mode to prevent bypassing (default: true) */
|
|
998
|
-
strictMode?: boolean;
|
|
999
|
-
/** Force audit logging for this operation (default: true) */
|
|
1000
|
-
auditLog?: boolean;
|
|
1001
|
-
/** Custom scope for permission checking */
|
|
1002
|
-
scope?: Scope;
|
|
1003
|
-
/** Callback when access is denied */
|
|
1004
|
-
onDenied?: (permissions: Permission[], operation: string) => void;
|
|
1005
|
-
/** Loading state content */
|
|
1006
|
-
loading?: React__default.ReactNode;
|
|
1007
|
-
/** Require all permissions (AND) or any permission (OR) */
|
|
1008
|
-
requireAll?: boolean;
|
|
1009
|
-
}
|
|
1010
|
-
/**
|
|
1011
|
-
* PermissionEnforcer - Enforces permissions for operations
|
|
1012
|
-
*
|
|
1013
|
-
* This component ensures that users can only perform operations they have permission for.
|
|
1014
|
-
* It integrates with the existing RBAC system and provides strict enforcement to
|
|
1015
|
-
* prevent apps from bypassing permission checks.
|
|
1016
|
-
*
|
|
1017
|
-
* @param props - Component props
|
|
1018
|
-
* @returns React element with permission enforcement
|
|
1019
|
-
*/
|
|
1020
|
-
declare function PermissionEnforcer({ permissions, operation, children, fallback, strictMode, auditLog, scope, onDenied, loading, requireAll }: PermissionEnforcerProps): react_jsx_runtime.JSX.Element;
|
|
1021
|
-
|
|
1022
|
-
interface RouteConfig {
|
|
1023
|
-
/** Route path */
|
|
1024
|
-
path: string;
|
|
1025
|
-
/** React component to render */
|
|
1026
|
-
component: React__default.ComponentType;
|
|
1027
|
-
/** Permissions required for this route */
|
|
1028
|
-
permissions: Permission[];
|
|
1029
|
-
/** If true, this route is public and doesn't require permission checks */
|
|
1030
|
-
public?: boolean;
|
|
1031
|
-
/** Roles that can access this route */
|
|
1032
|
-
roles?: string[];
|
|
1033
|
-
/** Minimum access level required */
|
|
1034
|
-
accessLevel?: AccessLevel;
|
|
1035
|
-
/** Page ID for permission checking */
|
|
1036
|
-
pageId?: string;
|
|
1037
|
-
/** Enable strict mode for this route */
|
|
1038
|
-
strictMode?: boolean;
|
|
1039
|
-
/** Route metadata */
|
|
1040
|
-
meta?: {
|
|
1041
|
-
title?: string;
|
|
1042
|
-
description?: string;
|
|
1043
|
-
requiresAuth?: boolean;
|
|
1044
|
-
hidden?: boolean;
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
interface RouteAccessRecord {
|
|
1048
|
-
route: string;
|
|
1049
|
-
permissions: Permission[];
|
|
1050
|
-
userId: UUID;
|
|
1051
|
-
scope: Scope;
|
|
1052
|
-
allowed: boolean;
|
|
1053
|
-
timestamp: string;
|
|
1054
|
-
pageId?: string;
|
|
1055
|
-
roles?: string[];
|
|
1056
|
-
accessLevel?: AccessLevel;
|
|
1057
|
-
}
|
|
1058
|
-
interface RoleBasedRouterContextType {
|
|
1059
|
-
/** Get all accessible routes for current user */
|
|
1060
|
-
getAccessibleRoutes: () => RouteConfig[];
|
|
1061
|
-
/** Check if user can access a specific route */
|
|
1062
|
-
canAccessRoute: (path: string) => boolean;
|
|
1063
|
-
/** Get route configuration for a path */
|
|
1064
|
-
getRouteConfig: (path: string) => RouteConfig | null;
|
|
1065
|
-
/** Get route access history */
|
|
1066
|
-
getRouteAccessHistory: () => RouteAccessRecord[];
|
|
1067
|
-
/** Clear route access history */
|
|
1068
|
-
clearRouteAccessHistory: () => void;
|
|
1069
|
-
/** Check if strict mode is enabled */
|
|
1070
|
-
isStrictMode: boolean;
|
|
1071
|
-
/** Check if audit logging is enabled */
|
|
1072
|
-
isAuditLogEnabled: boolean;
|
|
1073
|
-
}
|
|
1074
|
-
interface RoleBasedRouterProps {
|
|
1075
|
-
/** Route configuration */
|
|
1076
|
-
routes: RouteConfig[];
|
|
1077
|
-
/** Fallback route for unauthorized access */
|
|
1078
|
-
fallbackRoute?: string;
|
|
1079
|
-
/** Child components */
|
|
1080
|
-
children: React__default.ReactNode;
|
|
1081
|
-
/** Enable strict mode to prevent bypassing (default: true) */
|
|
1082
|
-
strictMode?: boolean;
|
|
1083
|
-
/** Enable audit logging (default: true) */
|
|
1084
|
-
auditLog?: boolean;
|
|
1085
|
-
/** Callback when route access is attempted */
|
|
1086
|
-
onRouteAccess?: (route: string, allowed: boolean, record: RouteAccessRecord) => void;
|
|
1087
|
-
/** Callback when strict mode violation occurs */
|
|
1088
|
-
onStrictModeViolation?: (route: string, record: RouteAccessRecord) => void;
|
|
1089
|
-
/** Maximum number of access records to keep in history */
|
|
1090
|
-
maxHistorySize?: number;
|
|
1091
|
-
/** Custom unauthorized component */
|
|
1092
|
-
unauthorizedComponent?: React__default.ComponentType<{
|
|
1093
|
-
route: string;
|
|
1094
|
-
reason: string;
|
|
1095
|
-
}>;
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* RoleBasedRouter - Centralized routing control with role-based protection
|
|
1099
|
-
*
|
|
1100
|
-
* This component ensures that all routes are properly protected and provides
|
|
1101
|
-
* centralized routing control to prevent apps from bypassing route protection.
|
|
1102
|
-
*
|
|
1103
|
-
* @param props - Router props
|
|
1104
|
-
* @returns React element with role-based routing
|
|
1105
|
-
*/
|
|
1106
|
-
declare function RoleBasedRouter({ routes, fallbackRoute, children, strictMode, auditLog, onRouteAccess, onStrictModeViolation, maxHistorySize, unauthorizedComponent: UnauthorizedComponent }: RoleBasedRouterProps): react_jsx_runtime.JSX.Element;
|
|
1107
|
-
/**
|
|
1108
|
-
* Hook to use role-based router context
|
|
1109
|
-
*
|
|
1110
|
-
* @returns Role-based router context
|
|
1111
|
-
* @throws Error if used outside of RoleBasedRouter
|
|
1112
|
-
*/
|
|
1113
|
-
declare function useRoleBasedRouter(): RoleBasedRouterContextType;
|
|
1114
|
-
|
|
1115
|
-
interface NavigationItem {
|
|
1116
|
-
/** Unique identifier for the navigation item */
|
|
1117
|
-
id: string;
|
|
1118
|
-
/** Display label for the navigation item */
|
|
1119
|
-
label: string;
|
|
1120
|
-
/** Navigation path/URL */
|
|
1121
|
-
path: string;
|
|
1122
|
-
/** Permissions required for this navigation item */
|
|
1123
|
-
permissions: Permission[];
|
|
1124
|
-
/** Roles that can access this navigation item */
|
|
1125
|
-
roles?: string[];
|
|
1126
|
-
/** Minimum access level required */
|
|
1127
|
-
accessLevel?: 'viewer' | 'participant' | 'planner' | 'admin' | 'super';
|
|
1128
|
-
/** Page ID for permission checking */
|
|
1129
|
-
pageId?: string;
|
|
1130
|
-
/** Enable strict mode for this navigation item */
|
|
1131
|
-
strictMode?: boolean;
|
|
1132
|
-
/** Navigation item metadata */
|
|
1133
|
-
meta?: {
|
|
1134
|
-
icon?: string;
|
|
1135
|
-
description?: string;
|
|
1136
|
-
hidden?: boolean;
|
|
1137
|
-
order?: number;
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
interface NavigationAccessRecord {
|
|
1141
|
-
navigationItem: string;
|
|
1142
|
-
permissions: Permission[];
|
|
1143
|
-
userId: UUID;
|
|
1144
|
-
scope: Scope;
|
|
1145
|
-
allowed: boolean;
|
|
1146
|
-
timestamp: string;
|
|
1147
|
-
pageId?: string;
|
|
1148
|
-
roles?: string[];
|
|
1149
|
-
accessLevel?: string;
|
|
1150
|
-
}
|
|
1151
|
-
interface NavigationContextType {
|
|
1152
|
-
/** Check if user has permission for a navigation item */
|
|
1153
|
-
hasNavigationPermission: (item: NavigationItem) => boolean;
|
|
1154
|
-
/** Get all navigation permissions for current user */
|
|
1155
|
-
getNavigationPermissions: () => Record<string, string[]>;
|
|
1156
|
-
/** Get filtered navigation items based on permissions */
|
|
1157
|
-
getFilteredNavigationItems: (items: NavigationItem[]) => NavigationItem[];
|
|
1158
|
-
/** Check if navigation permission checking is enabled */
|
|
1159
|
-
isEnabled: boolean;
|
|
1160
|
-
/** Check if strict mode is enabled */
|
|
1161
|
-
isStrictMode: boolean;
|
|
1162
|
-
/** Check if audit logging is enabled */
|
|
1163
|
-
isAuditLogEnabled: boolean;
|
|
1164
|
-
/** Get navigation access history */
|
|
1165
|
-
getNavigationAccessHistory: () => NavigationAccessRecord[];
|
|
1166
|
-
/** Clear navigation access history */
|
|
1167
|
-
clearNavigationAccessHistory: () => void;
|
|
1168
|
-
}
|
|
1169
|
-
interface NavigationProviderProps {
|
|
1170
|
-
/** Child components */
|
|
1171
|
-
children: React__default.ReactNode;
|
|
1172
|
-
/** Enable strict mode to prevent bypassing (default: true) */
|
|
1173
|
-
strictMode?: boolean;
|
|
1174
|
-
/** Enable audit logging (default: true) */
|
|
1175
|
-
auditLog?: boolean;
|
|
1176
|
-
/** Callback when navigation access is attempted */
|
|
1177
|
-
onNavigationAccess?: (item: NavigationItem, allowed: boolean, record: NavigationAccessRecord) => void;
|
|
1178
|
-
/** Callback when strict mode violation occurs */
|
|
1179
|
-
onStrictModeViolation?: (item: NavigationItem, record: NavigationAccessRecord) => void;
|
|
1180
|
-
/** Maximum number of access records to keep in history */
|
|
1181
|
-
maxHistorySize?: number;
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* NavigationProvider - Manages navigation-level permissions across the app
|
|
1185
|
-
*
|
|
1186
|
-
* This provider ensures that all navigation items are properly protected and provides
|
|
1187
|
-
* centralized navigation permission management with strict enforcement.
|
|
1188
|
-
*
|
|
1189
|
-
* @param props - Provider props
|
|
1190
|
-
* @returns React element with navigation permission context
|
|
1191
|
-
*/
|
|
1192
|
-
declare function NavigationProvider({ children, strictMode, auditLog, onNavigationAccess, onStrictModeViolation, maxHistorySize }: NavigationProviderProps): react_jsx_runtime.JSX.Element;
|
|
1193
|
-
/**
|
|
1194
|
-
* Hook to use navigation permission context
|
|
1195
|
-
*
|
|
1196
|
-
* @returns Navigation permission context
|
|
1197
|
-
* @throws Error if used outside of NavigationProvider
|
|
1198
|
-
*/
|
|
1199
|
-
declare function useNavigationPermissions(): NavigationContextType;
|
|
1200
|
-
|
|
1201
870
|
interface NavigationGuardProps {
|
|
1202
871
|
/** Navigation item being protected */
|
|
1203
872
|
navigationItem: NavigationItem;
|
|
@@ -1230,44 +899,72 @@ interface NavigationGuardProps {
|
|
|
1230
899
|
*/
|
|
1231
900
|
declare function NavigationGuard({ navigationItem, children, fallback, strictMode, auditLog, scope, onDenied, loading, requireAll }: NavigationGuardProps): react_jsx_runtime.JSX.Element;
|
|
1232
901
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
902
|
+
/**
|
|
903
|
+
* @file Access Denied Component
|
|
904
|
+
* @package @jmruthers/pace-core
|
|
905
|
+
* @module RBAC/Components/AccessDenied
|
|
906
|
+
* @since 2.0.0
|
|
907
|
+
*
|
|
908
|
+
* Standard access denied component for consistent error messaging across all PACE apps.
|
|
909
|
+
* This component provides a uniform user experience when users lack permissions.
|
|
910
|
+
*
|
|
911
|
+
* Features:
|
|
912
|
+
* - Consistent styling and behavior across all apps
|
|
913
|
+
* - Configurable message and actions
|
|
914
|
+
* - Accessibility compliant
|
|
915
|
+
* - Responsive design
|
|
916
|
+
*
|
|
917
|
+
* @example
|
|
918
|
+
* ```tsx
|
|
919
|
+
* // Basic usage
|
|
920
|
+
* <AccessDenied />
|
|
921
|
+
*
|
|
922
|
+
* // With custom message
|
|
923
|
+
* <AccessDenied message="You don't have permission to view this page." />
|
|
924
|
+
*
|
|
925
|
+
* // With custom actions
|
|
926
|
+
* <AccessDenied
|
|
927
|
+
* onGoBack={() => navigate('/dashboard')}
|
|
928
|
+
* onSignOut={handleSignOut}
|
|
929
|
+
* />
|
|
930
|
+
* ```
|
|
931
|
+
*
|
|
932
|
+
* @accessibility
|
|
933
|
+
* - Proper ARIA labels and roles
|
|
934
|
+
* - High contrast support
|
|
935
|
+
* - Screen reader friendly
|
|
936
|
+
* - Keyboard navigation support
|
|
937
|
+
*
|
|
938
|
+
* @dependencies
|
|
939
|
+
* - React 19+
|
|
940
|
+
* - pace-core Button component
|
|
941
|
+
*/
|
|
942
|
+
interface AccessDeniedProps {
|
|
943
|
+
/** Custom error message */
|
|
944
|
+
message?: string;
|
|
945
|
+
/** Resource or page name that was denied */
|
|
946
|
+
resource?: string;
|
|
947
|
+
/** Operation that was denied */
|
|
948
|
+
operation?: string;
|
|
949
|
+
/** Callback when "Go Back" is clicked */
|
|
950
|
+
onGoBack?: () => void;
|
|
951
|
+
/** Callback when "Sign Out" is clicked */
|
|
952
|
+
onSignOut?: () => void;
|
|
953
|
+
/** Custom class names */
|
|
1245
954
|
className?: string;
|
|
1246
|
-
/**
|
|
1247
|
-
|
|
1248
|
-
/** Custom className for active navigation items */
|
|
1249
|
-
activeItemClassName?: string;
|
|
1250
|
-
/** Custom className for disabled navigation items */
|
|
1251
|
-
disabledItemClassName?: string;
|
|
1252
|
-
/** Show/hide navigation items that user doesn't have permission for */
|
|
1253
|
-
hideUnauthorizedItems?: boolean;
|
|
1254
|
-
/** Custom render function for navigation items */
|
|
1255
|
-
renderItem?: (item: NavigationItem, isAuthorized: boolean) => React__default.ReactNode;
|
|
1256
|
-
/** Current active path for highlighting */
|
|
1257
|
-
activePath?: string;
|
|
1258
|
-
/** Navigation item click handler */
|
|
1259
|
-
onItemClick?: (item: NavigationItem) => void;
|
|
955
|
+
/** Show sign out button */
|
|
956
|
+
showSignOut?: boolean;
|
|
1260
957
|
}
|
|
1261
958
|
/**
|
|
1262
|
-
*
|
|
959
|
+
* Standard access denied component
|
|
1263
960
|
*
|
|
1264
|
-
* This component
|
|
1265
|
-
*
|
|
961
|
+
* This component is displayed when users lack the necessary permissions.
|
|
962
|
+
* It provides clear messaging and actionable next steps.
|
|
1266
963
|
*
|
|
1267
|
-
* @param props - Component
|
|
1268
|
-
* @returns
|
|
964
|
+
* @param props - Component configuration
|
|
965
|
+
* @returns JSX.Element - The rendered access denied page
|
|
1269
966
|
*/
|
|
1270
|
-
declare function
|
|
967
|
+
declare function AccessDenied({ message, resource, operation, onGoBack, onSignOut, className, showSignOut }: AccessDeniedProps): react_jsx_runtime.JSX.Element;
|
|
1271
968
|
|
|
1272
969
|
/**
|
|
1273
970
|
* @file RBAC Hook
|
|
@@ -1301,6 +998,8 @@ interface UseResolvedScopeOptions {
|
|
|
1301
998
|
selectedOrganisationId: string | null;
|
|
1302
999
|
/** Selected event ID */
|
|
1303
1000
|
selectedEventId: string | null;
|
|
1001
|
+
/** Selected event organisation ID (from selectedEvent.organisation_id) - allows immediate context without querying */
|
|
1002
|
+
selectedEventOrganisationId?: string | null;
|
|
1304
1003
|
}
|
|
1305
1004
|
interface UseResolvedScopeReturn {
|
|
1306
1005
|
/** Resolved scope, or null if not yet resolved */
|
|
@@ -1334,7 +1033,7 @@ interface UseResolvedScopeReturn {
|
|
|
1334
1033
|
* const permission = useCan(userId, resolvedScope, permission);
|
|
1335
1034
|
* ```
|
|
1336
1035
|
*/
|
|
1337
|
-
declare function useResolvedScope({ supabase, selectedOrganisationId, selectedEventId }: UseResolvedScopeOptions): UseResolvedScopeReturn;
|
|
1036
|
+
declare function useResolvedScope({ supabase, selectedOrganisationId, selectedEventId, selectedEventOrganisationId }: UseResolvedScopeOptions): UseResolvedScopeReturn;
|
|
1338
1037
|
|
|
1339
1038
|
/**
|
|
1340
1039
|
* @file useResourcePermissions Hook
|
|
@@ -1496,38 +1195,6 @@ declare function useAccessLevel(userId: UUID, scope: Scope): {
|
|
|
1496
1195
|
refetch: () => Promise<void>;
|
|
1497
1196
|
};
|
|
1498
1197
|
|
|
1499
|
-
/**
|
|
1500
|
-
* Hook to get cached permissions with TTL management
|
|
1501
|
-
*
|
|
1502
|
-
* @param userId - User ID
|
|
1503
|
-
* @param scope - Scope for permission checking
|
|
1504
|
-
* @returns Cached permission state and methods
|
|
1505
|
-
*
|
|
1506
|
-
* @example
|
|
1507
|
-
* ```tsx
|
|
1508
|
-
* function MyComponent() {
|
|
1509
|
-
* const { permissions, isLoading, error, invalidateCache } = useCachedPermissions(userId, scope);
|
|
1510
|
-
*
|
|
1511
|
-
* if (isLoading) return <div>Loading cached permissions...</div>;
|
|
1512
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
1513
|
-
*
|
|
1514
|
-
* return (
|
|
1515
|
-
* <div>
|
|
1516
|
-
* {permissions['read:users'] && <UserList />}
|
|
1517
|
-
* <button onClick={invalidateCache}>Refresh Permissions</button>
|
|
1518
|
-
* </div>
|
|
1519
|
-
* );
|
|
1520
|
-
* }
|
|
1521
|
-
* ```
|
|
1522
|
-
*/
|
|
1523
|
-
declare function useCachedPermissions(userId: UUID, scope: Scope): {
|
|
1524
|
-
permissions: PermissionMap;
|
|
1525
|
-
isLoading: boolean;
|
|
1526
|
-
error: Error | null;
|
|
1527
|
-
invalidateCache: () => void;
|
|
1528
|
-
refetch: () => Promise<void>;
|
|
1529
|
-
};
|
|
1530
|
-
|
|
1531
1198
|
/**
|
|
1532
1199
|
* Hook to check if user can perform an action
|
|
1533
1200
|
*
|
|
@@ -1565,70 +1232,6 @@ precomputedSuperAdmin?: boolean | null, appName?: string): {
|
|
|
1565
1232
|
refetch: () => Promise<void>;
|
|
1566
1233
|
};
|
|
1567
1234
|
|
|
1568
|
-
/**
|
|
1569
|
-
* Hook to check if user has all of the specified permissions
|
|
1570
|
-
*
|
|
1571
|
-
* @param userId - User ID
|
|
1572
|
-
* @param scope - Scope for permission checking
|
|
1573
|
-
* @param permissions - Array of permissions to check
|
|
1574
|
-
* @param useCache - Whether to use cached results
|
|
1575
|
-
* @returns Whether user has all of the permissions
|
|
1576
|
-
*
|
|
1577
|
-
* @example
|
|
1578
|
-
* ```tsx
|
|
1579
|
-
* function MyComponent() {
|
|
1580
|
-
* const { hasAll, isLoading, error } = useHasAllPermissions(
|
|
1581
|
-
* userId,
|
|
1582
|
-
* scope,
|
|
1583
|
-
* ['read:users', 'create:users', 'update:users']
|
|
1584
|
-
* );
|
|
1585
|
-
*
|
|
1586
|
-
* if (isLoading) return <div>Checking permissions...</div>;
|
|
1587
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
1588
|
-
*
|
|
1589
|
-
* return hasAll ? <FullUserManagementPanel /> : <div>Insufficient permissions</div>;
|
|
1590
|
-
* }
|
|
1591
|
-
* ```
|
|
1592
|
-
*/
|
|
1593
|
-
declare function useHasAllPermissions(userId: UUID, scope: Scope, permissions: Permission[], useCache?: boolean): {
|
|
1594
|
-
hasAll: boolean;
|
|
1595
|
-
isLoading: boolean;
|
|
1596
|
-
error: Error | null;
|
|
1597
|
-
refetch: () => Promise<void>;
|
|
1598
|
-
};
|
|
1599
|
-
|
|
1600
|
-
/**
|
|
1601
|
-
* Hook to check if user has any of the specified permissions
|
|
1602
|
-
*
|
|
1603
|
-
* @param userId - User ID
|
|
1604
|
-
* @param scope - Scope for permission checking
|
|
1605
|
-
* @param permissions - Array of permissions to check
|
|
1606
|
-
* @param useCache - Whether to use cached results
|
|
1607
|
-
* @returns Whether user has any of the permissions
|
|
1608
|
-
*
|
|
1609
|
-
* @example
|
|
1610
|
-
* ```tsx
|
|
1611
|
-
* function MyComponent() {
|
|
1612
|
-
* const { hasAny, isLoading, error } = useHasAnyPermission(
|
|
1613
|
-
* userId,
|
|
1614
|
-
* scope,
|
|
1615
|
-
* ['read:users', 'create:users']
|
|
1616
|
-
* );
|
|
1617
|
-
*
|
|
1618
|
-
* if (isLoading) return <div>Checking permissions...</div>;
|
|
1619
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
1620
|
-
*
|
|
1621
|
-
* return hasAny ? <UserManagementPanel /> : <div>No user permissions</div>;
|
|
1622
|
-
* }
|
|
1623
|
-
* ```
|
|
1624
|
-
*/
|
|
1625
|
-
declare function useHasAnyPermission(userId: UUID, scope: Scope, permissions: Permission[], useCache?: boolean): {
|
|
1626
|
-
hasAny: boolean;
|
|
1627
|
-
isLoading: boolean;
|
|
1628
|
-
error: Error | null;
|
|
1629
|
-
refetch: () => Promise<void>;
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
1235
|
/**
|
|
1633
1236
|
* Hook to check multiple permissions at once
|
|
1634
1237
|
*
|
|
@@ -1979,95 +1582,16 @@ declare function useSecureSupabase(baseClient?: SupabaseClient<Database> | null)
|
|
|
1979
1582
|
* @module RBAC/Adapters
|
|
1980
1583
|
* @since 1.0.0
|
|
1981
1584
|
*
|
|
1982
|
-
* This module provides adapters for different frameworks and server runtimes.
|
|
1983
|
-
*/
|
|
1984
|
-
|
|
1985
|
-
/**
|
|
1986
|
-
* Permission Guard Component
|
|
1585
|
+
* This module provides server-side adapters for different frameworks and server runtimes.
|
|
1987
1586
|
*
|
|
1988
|
-
*
|
|
1989
|
-
*
|
|
1587
|
+
* NOTE: React components (PermissionGuard, AccessLevelGuard) have been removed.
|
|
1588
|
+
* Use PagePermissionGuard from @jmruthers/pace-core/rbac for all client-side permission enforcement.
|
|
1589
|
+
* Use useAccessLevel hook + conditional rendering for access level checks.
|
|
1990
1590
|
*
|
|
1991
|
-
*
|
|
1992
|
-
*
|
|
1993
|
-
* // With explicit userId and scope
|
|
1994
|
-
* <PermissionGuard
|
|
1995
|
-
* userId="user-123"
|
|
1996
|
-
* scope={{ organisationId: 'org-456' }}
|
|
1997
|
-
* permission="update:events"
|
|
1998
|
-
* pageId="page-789"
|
|
1999
|
-
* fallback={<AccessDenied />}
|
|
2000
|
-
* >
|
|
2001
|
-
* <AdminPanel />
|
|
2002
|
-
* </PermissionGuard>
|
|
2003
|
-
*
|
|
2004
|
-
* // With context inference (requires auth context)
|
|
2005
|
-
* <PermissionGuard
|
|
2006
|
-
* permission="update:events"
|
|
2007
|
-
* scope={{ organisationId: 'org-456' }}
|
|
2008
|
-
* fallback={<AccessDenied />}
|
|
2009
|
-
* >
|
|
2010
|
-
* <AdminPanel />
|
|
2011
|
-
* </PermissionGuard>
|
|
2012
|
-
* ```
|
|
1591
|
+
* Server adapters are provided for server-side route protection (Next.js, Express, etc.).
|
|
1592
|
+
* These are optional utilities for server-side applications.
|
|
2013
1593
|
*/
|
|
2014
|
-
|
|
2015
|
-
userId?: UUID;
|
|
2016
|
-
scope: {
|
|
2017
|
-
organisationId: UUID;
|
|
2018
|
-
eventId?: string;
|
|
2019
|
-
appId?: UUID;
|
|
2020
|
-
};
|
|
2021
|
-
permission: Permission;
|
|
2022
|
-
pageId?: UUID;
|
|
2023
|
-
children: ReactNode;
|
|
2024
|
-
fallback?: ReactNode;
|
|
2025
|
-
onDenied?: () => void;
|
|
2026
|
-
loading?: ReactNode;
|
|
2027
|
-
strictMode?: boolean;
|
|
2028
|
-
auditLog?: boolean;
|
|
2029
|
-
enforceAudit?: boolean;
|
|
2030
|
-
}): React__default.ReactNode;
|
|
2031
|
-
/**
|
|
2032
|
-
* Access Level Guard Component
|
|
2033
|
-
*
|
|
2034
|
-
* A React component that conditionally renders children based on access level.
|
|
2035
|
-
* Can auto-infer userId from context if not provided.
|
|
2036
|
-
*
|
|
2037
|
-
* @example
|
|
2038
|
-
* ```tsx
|
|
2039
|
-
* // With explicit userId and scope
|
|
2040
|
-
* <AccessLevelGuard
|
|
2041
|
-
* userId="user-123"
|
|
2042
|
-
* scope={{ organisationId: 'org-456' }}
|
|
2043
|
-
* minLevel="admin"
|
|
2044
|
-
* fallback={<AccessDenied />}
|
|
2045
|
-
* >
|
|
2046
|
-
* <AdminPanel />
|
|
2047
|
-
* </AccessLevelGuard>
|
|
2048
|
-
*
|
|
2049
|
-
* // With context inference (requires auth context)
|
|
2050
|
-
* <AccessLevelGuard
|
|
2051
|
-
* minLevel="admin"
|
|
2052
|
-
* scope={{ organisationId: 'org-456' }}
|
|
2053
|
-
* fallback={<AccessDenied />}
|
|
2054
|
-
* >
|
|
2055
|
-
* <AdminPanel />
|
|
2056
|
-
* </AccessLevelGuard>
|
|
2057
|
-
* ```
|
|
2058
|
-
*/
|
|
2059
|
-
declare function AccessLevelGuard({ userId, scope, minLevel, children, fallback, loading, }: {
|
|
2060
|
-
userId?: UUID;
|
|
2061
|
-
scope: {
|
|
2062
|
-
organisationId: UUID;
|
|
2063
|
-
eventId?: string;
|
|
2064
|
-
appId?: UUID;
|
|
2065
|
-
};
|
|
2066
|
-
minLevel: 'viewer' | 'participant' | 'planner' | 'admin' | 'super';
|
|
2067
|
-
children: ReactNode;
|
|
2068
|
-
fallback?: ReactNode;
|
|
2069
|
-
loading?: ReactNode;
|
|
2070
|
-
}): React__default.ReactNode;
|
|
1594
|
+
|
|
2071
1595
|
/**
|
|
2072
1596
|
* Permission Guard for Server Handlers
|
|
2073
1597
|
*
|
|
@@ -2217,34 +1741,6 @@ declare function createRBACExpressMiddleware(config: {
|
|
|
2217
1741
|
json: (data: object) => void;
|
|
2218
1742
|
};
|
|
2219
1743
|
}, next: () => void) => Promise<void>;
|
|
2220
|
-
/**
|
|
2221
|
-
* Check if a user has a permission (synchronous cache check only)
|
|
2222
|
-
*
|
|
2223
|
-
* @param userId - User ID
|
|
2224
|
-
* @param scope - Permission scope
|
|
2225
|
-
* @param permission - Permission to check
|
|
2226
|
-
* @param pageId - Optional page ID
|
|
2227
|
-
* @returns True if permission is cached and granted
|
|
2228
|
-
*/
|
|
2229
|
-
declare function hasPermissionCached(userId: UUID, scope: {
|
|
2230
|
-
organisationId: UUID;
|
|
2231
|
-
eventId?: string;
|
|
2232
|
-
appId?: UUID;
|
|
2233
|
-
}, _permission: Permission, _pageId?: UUID): boolean;
|
|
2234
|
-
/**
|
|
2235
|
-
* Check if a user has any of the specified permissions (synchronous cache check only)
|
|
2236
|
-
*
|
|
2237
|
-
* @param userId - User ID
|
|
2238
|
-
* @param scope - Permission scope
|
|
2239
|
-
* @param permissions - Array of permissions to check
|
|
2240
|
-
* @param pageId - Optional page ID
|
|
2241
|
-
* @returns True if any permission is cached and granted
|
|
2242
|
-
*/
|
|
2243
|
-
declare function hasAnyPermissionCached(userId: UUID, scope: {
|
|
2244
|
-
organisationId: UUID;
|
|
2245
|
-
eventId?: string;
|
|
2246
|
-
appId?: UUID;
|
|
2247
|
-
}, permissions: Permission[], pageId?: UUID): boolean;
|
|
2248
1744
|
|
|
2249
1745
|
/**
|
|
2250
1746
|
* RBAC Main API Functions
|
|
@@ -2351,13 +1847,6 @@ precomputedSuperAdmin?: boolean | null): Promise<boolean>;
|
|
|
2351
1847
|
* @returns Promise resolving to permission result
|
|
2352
1848
|
*/
|
|
2353
1849
|
declare function isPermittedCached(input: PermissionCheck, appName?: string): Promise<boolean>;
|
|
2354
|
-
/**
|
|
2355
|
-
* Check if a user has a specific permission (alias for isPermitted)
|
|
2356
|
-
*
|
|
2357
|
-
* @param input - Permission check parameters
|
|
2358
|
-
* @returns Promise<boolean> - True if user has permission
|
|
2359
|
-
*/
|
|
2360
|
-
declare function hasPermission(input: PermissionCheck): Promise<boolean>;
|
|
2361
1850
|
/**
|
|
2362
1851
|
* Check if user has any of the specified permissions
|
|
2363
1852
|
*
|
|
@@ -2582,6 +2071,39 @@ declare function getSetupIssues(): SetupIssue[];
|
|
|
2582
2071
|
*/
|
|
2583
2072
|
declare function validateRBACSetup(): ComplianceResult;
|
|
2584
2073
|
|
|
2074
|
+
/**
|
|
2075
|
+
* Pattern Detector for RBAC Compliance
|
|
2076
|
+
* @package @jmruthers/pace-core
|
|
2077
|
+
* @module RBAC/Compliance/PatternDetector
|
|
2078
|
+
* @since 1.0.0
|
|
2079
|
+
*
|
|
2080
|
+
* This module provides static and runtime pattern detection for RBAC violations.
|
|
2081
|
+
* It detects direct RPC calls, direct table queries, and other non-standard patterns.
|
|
2082
|
+
*/
|
|
2083
|
+
interface PatternViolation {
|
|
2084
|
+
type: 'direct-rpc-call' | 'direct-table-query' | 'bypass-pattern' | 'custom-component' | 'hardcoded-role-check' | 'custom-permission-utility' | 'ui-only-access-control' | 'permission-bypass-comment' | 'resource-permission-string-literal' | 'permission-wrapper-function';
|
|
2085
|
+
file?: string;
|
|
2086
|
+
line?: number;
|
|
2087
|
+
message: string;
|
|
2088
|
+
recommendation: string;
|
|
2089
|
+
}
|
|
2090
|
+
interface PatternDetectionResult {
|
|
2091
|
+
violations: PatternViolation[];
|
|
2092
|
+
isCompliant: boolean;
|
|
2093
|
+
summary: {
|
|
2094
|
+
directRpcCalls: number;
|
|
2095
|
+
directTableQueries: number;
|
|
2096
|
+
bypassPatterns: number;
|
|
2097
|
+
customComponents: number;
|
|
2098
|
+
hardcodedRoleChecks: number;
|
|
2099
|
+
customPermissionUtilities: number;
|
|
2100
|
+
uiOnlyAccessControl: number;
|
|
2101
|
+
permissionBypassComments: number;
|
|
2102
|
+
resourcePermissionStringLiterals: number;
|
|
2103
|
+
permissionWrapperFunctions: number;
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2585
2107
|
/**
|
|
2586
2108
|
* Runtime Compliance Checking
|
|
2587
2109
|
* @package @jmruthers/pace-core
|
|
@@ -2601,6 +2123,7 @@ interface RuntimeComplianceResult {
|
|
|
2601
2123
|
available: boolean;
|
|
2602
2124
|
message?: string;
|
|
2603
2125
|
};
|
|
2126
|
+
patternDetection?: PatternDetectionResult;
|
|
2604
2127
|
}
|
|
2605
2128
|
/**
|
|
2606
2129
|
* Check runtime compliance
|
|
@@ -2687,4 +2210,4 @@ declare function getDirectSupabaseAuthFixes(): QuickFix;
|
|
|
2687
2210
|
*/
|
|
2688
2211
|
declare function getQuickFixes(issueType: string, details?: Record<string, any>): QuickFix[];
|
|
2689
2212
|
|
|
2690
|
-
export { ALL_PERMISSIONS,
|
|
2213
|
+
export { ALL_PERMISSIONS, AccessDenied, type AccessDeniedProps, AccessLevel, type AllPermissions, CACHE_PATTERNS, type ComplianceResult, type DatabaseComplianceResult, type DatabaseIssue, EVENT_APP_PERMISSIONS, type EventAppRoleData, GLOBAL_PERMISSIONS, type GrantEventAppRoleParams, type LogLevel, NavigationGuard, type NavigationGuardProps, ORGANISATION_PERMISSIONS, PAGE_PERMISSIONS, PagePermissionGuard, type PagePermissionGuardProps, Permission, PermissionCheck, PermissionMap, type QuickFix, RBACAuditManager, RBACCache, type RBACConfig, RBACEngine, type RBACLogger, type RBACPerformanceMetrics, type ResourcePermissions, type RevokeEventAppRoleParams, type RoleManagementResult, type RuntimeComplianceResult, SECURE_CLIENT_SYMBOL, Scope, SecureSupabaseClient, type SetupIssue, UUID, type UseResolvedScopeOptions, type UseResolvedScopeReturn, type UseResourcePermissionsOptions, checkRuntimeCompliance, clearInFlightRequests, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, disablePerformanceMonitoring, emitAuditEvent, enablePerformanceMonitoring, fromSupabaseClient, getAccessLevel, getCustomAuthCodeFixes, getDirectSupabaseAuthFixes, getDuplicateConfigFixes, getGlobalAuditManager, getInFlightRequestCount, getPerformanceMetrics, getPerformanceSummary, getPermissionMap, getQuickFixes, getRBACConfig, getRBACLogger, getRoleContext, getSetupIssues, getUnprotectedPageFixes, hasAllPermissions, hasAnyPermission, isDebugMode, isDevelopmentMode, isPerformanceMonitoringEnabled, isPermitted, isPermittedCached, isRBACInitialized, isSecureClient, isValidPermission, rbacCache, recordAuditEvent, recordPermissionCheck, resetPerformanceMetrics, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCan, useMultiplePermissions, usePermissions, useRBAC, useResolvedScope, useResourcePermissions, useRoleManagement, useSecureSupabase, validateAndWarn, validateDatabaseConfiguration, validateRBACSetup, warnIfInsecureClient, withAccessLevelGuard, withPermissionGuard, withRoleGuard };
|