@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
|
@@ -1,473 +0,0 @@
|
|
|
1
|
-
# Performance Optimization - Advanced Topics
|
|
2
|
-
|
|
3
|
-
> **📚 Best Practices**: Advanced Performance | [← Back](./README.md) | [Basic Performance](./performance.md)
|
|
4
|
-
|
|
5
|
-
Advanced performance optimization strategies for building high-performance PACE Core applications.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
**Last Updated**: 2025-02-08 | **Version**: v0.5.65+
|
|
10
|
-
|
|
11
|
-
## Table of Contents
|
|
12
|
-
|
|
13
|
-
1. [Bundle Optimization](#bundle-optimization)
|
|
14
|
-
2. [React Rendering Optimization](#react-rendering-optimization)
|
|
15
|
-
3. [Memory Management](#memory-management)
|
|
16
|
-
4. [Network Optimization](#network-optimization)
|
|
17
|
-
5. [Code Splitting Strategies](#code-splitting-strategies)
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Bundle Optimization
|
|
22
|
-
|
|
23
|
-
### Tree Shaking
|
|
24
|
-
|
|
25
|
-
**Goal**: Minimize bundle size by eliminating unused code.
|
|
26
|
-
|
|
27
|
-
**Implementation**:
|
|
28
|
-
```typescript
|
|
29
|
-
// ✅ Good - Named exports for tree shaking
|
|
30
|
-
export { Button } from './Button';
|
|
31
|
-
export { Card } from './Card';
|
|
32
|
-
export { DataTable } from './DataTable';
|
|
33
|
-
|
|
34
|
-
// ❌ Bad - Default exports reduce tree shaking
|
|
35
|
-
export default { Button, Card, DataTable };
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Verify Tree Shaking**:
|
|
39
|
-
```bash
|
|
40
|
-
# Check bundle size
|
|
41
|
-
npm run build
|
|
42
|
-
npx vite-bundle-visualizer
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Dynamic Imports
|
|
46
|
-
|
|
47
|
-
**Use Case**: Load components only when needed.
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
import React, { Suspense, lazy } from 'react';
|
|
51
|
-
|
|
52
|
-
// Lazy load heavy components
|
|
53
|
-
const DataTable = lazy(() => import('@jmruthers/pace-core').then(m => ({ default: m.DataTable })));
|
|
54
|
-
const ChartEditor = lazy(() => import('./components/ChartEditor'));
|
|
55
|
-
|
|
56
|
-
function App() {
|
|
57
|
-
return (
|
|
58
|
-
<Suspense fallback={<LoadingSpinner />}>
|
|
59
|
-
<DataTable data={data} columns={columns} />
|
|
60
|
-
</Suspense>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Analysis Tools
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# Install analyzer
|
|
69
|
-
npm install -D vite-bundle-visualizer
|
|
70
|
-
|
|
71
|
-
# Analyze bundle
|
|
72
|
-
npx vite-bundle-visualizer dist/stats.html
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## React Rendering Optimization
|
|
78
|
-
|
|
79
|
-
### Component Memoization Strategies
|
|
80
|
-
|
|
81
|
-
#### 1. React.memo for Expensive Components
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
import React from 'react';
|
|
85
|
-
import { Card } from '@jmruthers/pace-core';
|
|
86
|
-
|
|
87
|
-
interface UserCardProps {
|
|
88
|
-
user: User;
|
|
89
|
-
onEdit: (userId: string) => void;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Memoize expensive components
|
|
93
|
-
const UserCard = React.memo(({ user, onEdit }: UserCardProps) => {
|
|
94
|
-
return (
|
|
95
|
-
<Card>
|
|
96
|
-
<h3>{user.name}</h3>
|
|
97
|
-
<p>{user.email}</p>
|
|
98
|
-
<button onClick={() => onEdit(user.id)}>Edit</button>
|
|
99
|
-
</Card>
|
|
100
|
-
);
|
|
101
|
-
}, (prevProps, nextProps) => {
|
|
102
|
-
// Custom comparison function
|
|
103
|
-
return prevProps.user.id === nextProps.user.id &&
|
|
104
|
-
prevProps.user.name === nextProps.user.name;
|
|
105
|
-
});
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
#### 2. useMemo for Expensive Calculations
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
import { useMemo } from 'react';
|
|
112
|
-
|
|
113
|
-
function EventCalendar({ events }) {
|
|
114
|
-
const eventsByDate = useMemo(() => {
|
|
115
|
-
return events.reduce((groups, event) => {
|
|
116
|
-
const date = event.date.split('T')[0];
|
|
117
|
-
if (!groups[date]) groups[date] = [];
|
|
118
|
-
groups[date].push(event);
|
|
119
|
-
return groups;
|
|
120
|
-
}, {});
|
|
121
|
-
}, [events]);
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<div>
|
|
125
|
-
{Object.entries(eventsByDate).map(([date, eventsList]) => (
|
|
126
|
-
<DateGroup key={date} date={date} events={eventsList} />
|
|
127
|
-
))}
|
|
128
|
-
</div>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### 3. useCallback for Event Handlers
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
import { useCallback } from 'react';
|
|
137
|
-
|
|
138
|
-
function EventManager({ events, setSelectedEvent }) {
|
|
139
|
-
const handleEventClick = useCallback((eventId: string) => {
|
|
140
|
-
const event = events.find(e => e.id === eventId);
|
|
141
|
-
setSelectedEvent(event);
|
|
142
|
-
}, [events, setSelectedEvent]);
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<div>
|
|
146
|
-
{events.map(event => (
|
|
147
|
-
<EventCard
|
|
148
|
-
key={event.id}
|
|
149
|
-
event={event}
|
|
150
|
-
onClick={() => handleEventClick(event.id)}
|
|
151
|
-
/>
|
|
152
|
-
))}
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Memory Management
|
|
161
|
-
|
|
162
|
-
### Preventing Memory Leaks
|
|
163
|
-
|
|
164
|
-
#### 1. Clean Up Effects
|
|
165
|
-
|
|
166
|
-
```tsx
|
|
167
|
-
import { useEffect, useRef } from 'react';
|
|
168
|
-
|
|
169
|
-
function DataFetcher({ userId }) {
|
|
170
|
-
const abortController = useRef(new AbortController());
|
|
171
|
-
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
const fetchData = async () => {
|
|
174
|
-
try {
|
|
175
|
-
const response = await fetch(`/api/users/${userId}`, {
|
|
176
|
-
signal: abortController.current.signal
|
|
177
|
-
});
|
|
178
|
-
// Handle response
|
|
179
|
-
} catch (error) {
|
|
180
|
-
if (error.name !== 'AbortError') {
|
|
181
|
-
console.error('Failed to fetch data:', error);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
fetchData();
|
|
187
|
-
|
|
188
|
-
return () => {
|
|
189
|
-
// Clean up on unmount
|
|
190
|
-
abortController.current.abort();
|
|
191
|
-
};
|
|
192
|
-
}, [userId]);
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
#### 2. Remove Event Listeners
|
|
197
|
-
|
|
198
|
-
```tsx
|
|
199
|
-
import { useEffect, useRef } from 'react';
|
|
200
|
-
|
|
201
|
-
function ResizableComponent() {
|
|
202
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
203
|
-
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
const handleResize = () => {
|
|
206
|
-
// Handle resize
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const container = containerRef.current;
|
|
210
|
-
window.addEventListener('resize', handleResize);
|
|
211
|
-
|
|
212
|
-
return () => {
|
|
213
|
-
// Clean up event listener
|
|
214
|
-
window.removeEventListener('resize', handleResize);
|
|
215
|
-
};
|
|
216
|
-
}, []);
|
|
217
|
-
|
|
218
|
-
return <div ref={containerRef}>Content</div>;
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Memory Monitoring
|
|
223
|
-
|
|
224
|
-
```tsx
|
|
225
|
-
function useMemoryMonitor() {
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
if (!('memory' in performance)) return;
|
|
228
|
-
|
|
229
|
-
const monitor = setInterval(() => {
|
|
230
|
-
const memory = (performance as any).memory;
|
|
231
|
-
console.log({
|
|
232
|
-
used: `${(memory.usedJSHeapSize / 1048576).toFixed(2)} MB`,
|
|
233
|
-
total: `${(memory.totalJSHeapSize / 1048576).toFixed(2)} MB`,
|
|
234
|
-
limit: `${(memory.jsHeapSizeLimit / 1048576).toFixed(2)} MB`,
|
|
235
|
-
});
|
|
236
|
-
}, 5000);
|
|
237
|
-
|
|
238
|
-
return () => clearInterval(monitor);
|
|
239
|
-
}, []);
|
|
240
|
-
}
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
---
|
|
244
|
-
|
|
245
|
-
## Network Optimization
|
|
246
|
-
|
|
247
|
-
### 1. Request Debouncing
|
|
248
|
-
|
|
249
|
-
```tsx
|
|
250
|
-
import { useState, useEffect } from 'react';
|
|
251
|
-
import { useDebounce } from '@jmruthers/pace-core';
|
|
252
|
-
|
|
253
|
-
function SearchableDataTable({ data }) {
|
|
254
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
255
|
-
const debouncedQuery = useDebounce(searchQuery, 300);
|
|
256
|
-
|
|
257
|
-
useEffect(() => {
|
|
258
|
-
if (debouncedQuery) {
|
|
259
|
-
// Perform search
|
|
260
|
-
const results = data.filter(item =>
|
|
261
|
-
item.name.toLowerCase().includes(debouncedQuery.toLowerCase())
|
|
262
|
-
);
|
|
263
|
-
setFilteredData(results);
|
|
264
|
-
}
|
|
265
|
-
}, [debouncedQuery, data]);
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### 2. Request Caching
|
|
270
|
-
|
|
271
|
-
```tsx
|
|
272
|
-
import { useState, useEffect, useRef } from 'react';
|
|
273
|
-
|
|
274
|
-
function useCachedFetch<T>(url: string, cacheKey: string) {
|
|
275
|
-
const cache = useRef(new Map<string, T>());
|
|
276
|
-
const [data, setData] = useState<T | null>(null);
|
|
277
|
-
const [loading, setLoading] = useState(false);
|
|
278
|
-
|
|
279
|
-
useEffect(() => {
|
|
280
|
-
if (cache.current.has(cacheKey)) {
|
|
281
|
-
setData(cache.current.get(cacheKey)!);
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
setLoading(true);
|
|
286
|
-
fetch(url)
|
|
287
|
-
.then(res => res.json())
|
|
288
|
-
.then(data => {
|
|
289
|
-
cache.current.set(cacheKey, data);
|
|
290
|
-
setData(data);
|
|
291
|
-
})
|
|
292
|
-
.finally(() => setLoading(false));
|
|
293
|
-
}, [url, cacheKey]);
|
|
294
|
-
|
|
295
|
-
return { data, loading };
|
|
296
|
-
}
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### 3. Batch API Requests
|
|
300
|
-
|
|
301
|
-
```tsx
|
|
302
|
-
async function batchFetchUsers(userIds: string[]) {
|
|
303
|
-
const chunks = [];
|
|
304
|
-
const chunkSize = 50;
|
|
305
|
-
|
|
306
|
-
for (let i = 0; i < userIds.length; i += chunkSize) {
|
|
307
|
-
chunks.push(userIds.slice(i, i + chunkSize));
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const promises = chunks.map(chunk =>
|
|
311
|
-
fetch('/api/users/batch', {
|
|
312
|
-
method: 'POST',
|
|
313
|
-
headers: { 'Content-Type': 'application/json' },
|
|
314
|
-
body: JSON.stringify({ userIds: chunk })
|
|
315
|
-
}).then(res => res.json())
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
const results = await Promise.all(promises);
|
|
319
|
-
return results.flat();
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
## Code Splitting Strategies
|
|
326
|
-
|
|
327
|
-
### 1. Route-Based Code Splitting
|
|
328
|
-
|
|
329
|
-
```tsx
|
|
330
|
-
import { lazy, Suspense } from 'react';
|
|
331
|
-
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
332
|
-
|
|
333
|
-
// Lazy load route components
|
|
334
|
-
const Dashboard = lazy(() => import('./pages/Dashboard'));
|
|
335
|
-
const Users = lazy(() => import('./pages/Users'));
|
|
336
|
-
const Events = lazy(() => import('./pages/Events'));
|
|
337
|
-
|
|
338
|
-
function App() {
|
|
339
|
-
return (
|
|
340
|
-
<BrowserRouter>
|
|
341
|
-
<Suspense fallback={<LoadingSpinner />}>
|
|
342
|
-
<Routes>
|
|
343
|
-
<Route path="/" element={<Dashboard />} />
|
|
344
|
-
<Route path="/users" element={<Users />} />
|
|
345
|
-
<Route path="/events" element={<Events />} />
|
|
346
|
-
</Routes>
|
|
347
|
-
</Suspense>
|
|
348
|
-
</BrowserRouter>
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### 2. Component-Based Code Splitting
|
|
354
|
-
|
|
355
|
-
```tsx
|
|
356
|
-
import { lazy, Suspense } from 'react';
|
|
357
|
-
import { Card } from '@jmruthers/pace-core';
|
|
358
|
-
|
|
359
|
-
// Lazy load heavy components
|
|
360
|
-
const DataTable = lazy(() => import('@jmruthers/pace-core').then(m => ({ default: m.DataTable })));
|
|
361
|
-
const ChartEditor = lazy(() => import('./components/ChartEditor'));
|
|
362
|
-
|
|
363
|
-
function AnalyticsPage() {
|
|
364
|
-
return (
|
|
365
|
-
<div>
|
|
366
|
-
<Card>
|
|
367
|
-
<Suspense fallback={<div>Loading table...</div>}>
|
|
368
|
-
<DataTable data={data} columns={columns} />
|
|
369
|
-
</Suspense>
|
|
370
|
-
</Card>
|
|
371
|
-
<Card>
|
|
372
|
-
<Suspense fallback={<div>Loading chart...</div>}>
|
|
373
|
-
<ChartEditor />
|
|
374
|
-
</Suspense>
|
|
375
|
-
</Card>
|
|
376
|
-
</div>
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### 3. Feature-Based Code Splitting
|
|
382
|
-
|
|
383
|
-
```tsx
|
|
384
|
-
// Split by feature
|
|
385
|
-
const AdminTools = lazy(() => import('./features/AdminTools'));
|
|
386
|
-
const UserManagement = lazy(() => import('./features/UserManagement'));
|
|
387
|
-
|
|
388
|
-
function App() {
|
|
389
|
-
const { hasPermission } = useCan();
|
|
390
|
-
|
|
391
|
-
return (
|
|
392
|
-
<div>
|
|
393
|
-
{hasPermission('admin:access') && (
|
|
394
|
-
<Suspense fallback={<LoadingSpinner />}>
|
|
395
|
-
<AdminTools />
|
|
396
|
-
</Suspense>
|
|
397
|
-
)}
|
|
398
|
-
|
|
399
|
-
<Suspense fallback={<LoadingSpinner />}>
|
|
400
|
-
<UserManagement />
|
|
401
|
-
</Suspense>
|
|
402
|
-
</div>
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
## Performance Monitoring
|
|
410
|
-
|
|
411
|
-
### Real-Time Metrics
|
|
412
|
-
|
|
413
|
-
```tsx
|
|
414
|
-
import { useEffect } from 'react';
|
|
415
|
-
|
|
416
|
-
function usePerformanceMetrics() {
|
|
417
|
-
useEffect(() => {
|
|
418
|
-
// Track Core Web Vitals
|
|
419
|
-
const observer = new PerformanceObserver((list) => {
|
|
420
|
-
for (const entry of list.getEntries()) {
|
|
421
|
-
console.log({
|
|
422
|
-
name: entry.name,
|
|
423
|
-
value: entry.value,
|
|
424
|
-
type: entry.entryType
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
// Observe paint timing
|
|
430
|
-
observer.observe({ entryTypes: ['paint'] });
|
|
431
|
-
|
|
432
|
-
// Observe navigation timing
|
|
433
|
-
observer.observe({ entryTypes: ['navigation'] });
|
|
434
|
-
|
|
435
|
-
return () => observer.disconnect();
|
|
436
|
-
}, []);
|
|
437
|
-
}
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
### Custom Metrics
|
|
441
|
-
|
|
442
|
-
```tsx
|
|
443
|
-
function trackCustomMetric(name: string, duration: number) {
|
|
444
|
-
if (typeof window !== 'undefined' && 'performance' in window) {
|
|
445
|
-
const metric = {
|
|
446
|
-
name,
|
|
447
|
-
duration,
|
|
448
|
-
timestamp: Date.now()
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
// Store in localStorage for analysis
|
|
452
|
-
const metrics = JSON.parse(localStorage.getItem('metrics') || '[]');
|
|
453
|
-
metrics.push(metric);
|
|
454
|
-
localStorage.setItem('metrics', JSON.stringify(metrics.slice(-100)));
|
|
455
|
-
|
|
456
|
-
// Or send to analytics
|
|
457
|
-
// analytics.track('performance', metric);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
---
|
|
463
|
-
|
|
464
|
-
## Related Documentation
|
|
465
|
-
|
|
466
|
-
- [Performance Best Practices](./performance.md) - Basic performance guidelines
|
|
467
|
-
- [DataTable Performance](./implementation-guides/performance.md) - DataTable-specific optimizations
|
|
468
|
-
- [Security Best Practices](./security.md) - Security considerations
|
|
469
|
-
- [Deployment Best Practices](./deployment.md) - Production deployment
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
**Next Steps**: Review your application's performance, identify bottlenecks, and implement these optimizations.
|
package/docs/breaking-changes.md
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# PACE Core Breaking Changes
|
|
2
|
-
|
|
3
|
-
> **📢 Important**: This document tracks all breaking changes in PACE Core.
|
|
4
|
-
> **Check this file** before upgrading to a new major version.
|
|
5
|
-
|
|
6
|
-
## Recent Breaking Changes
|
|
7
|
-
|
|
8
|
-
### v0.5.65+ - Mandatory Inactivity Timeouts
|
|
9
|
-
|
|
10
|
-
**Status**: ⚠️ **BREAKING CHANGE**
|
|
11
|
-
**Date**: January 2025
|
|
12
|
-
**Impact**: High - Affects all apps using `UnifiedAuthProvider`
|
|
13
|
-
|
|
14
|
-
#### What Changed
|
|
15
|
-
|
|
16
|
-
The `UnifiedAuthProvider` now requires mandatory inactivity timeout configuration. These props were previously optional but are now required for security and TypeScript compliance.
|
|
17
|
-
|
|
18
|
-
#### Before (Old Code)
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
// ❌ This will now cause TypeScript errors
|
|
22
|
-
<UnifiedAuthProvider supabaseClient={supabase} appName="my-app">
|
|
23
|
-
<App />
|
|
24
|
-
</UnifiedAuthProvider>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
#### After (New Code)
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
// ✅ Required configuration
|
|
31
|
-
<UnifiedAuthProvider
|
|
32
|
-
supabaseClient={supabase}
|
|
33
|
-
appName="my-app"
|
|
34
|
-
idleTimeoutMs={30 * 60 * 1000} // Required: 30 minutes
|
|
35
|
-
warnBeforeMs={5 * 60 * 1000} // Required: 5 minutes warning
|
|
36
|
-
onIdleLogout={() => window.location.href = '/login'} // Required
|
|
37
|
-
>
|
|
38
|
-
<App />
|
|
39
|
-
</UnifiedAuthProvider>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
#### Required Props
|
|
43
|
-
|
|
44
|
-
| Prop | Type | Required | Description |
|
|
45
|
-
|------|------|----------|-------------|
|
|
46
|
-
| `idleTimeoutMs` | `number` | ✅ Yes | Idle timeout in milliseconds |
|
|
47
|
-
| `warnBeforeMs` | `number` | ✅ Yes | Warning before logout in milliseconds |
|
|
48
|
-
| `onIdleLogout` | `() => void` | ✅ Yes | Callback when user is logged out |
|
|
49
|
-
|
|
50
|
-
#### Migration Steps
|
|
51
|
-
|
|
52
|
-
1. **Identify all UnifiedAuthProvider instances** in your codebase
|
|
53
|
-
2. **Add the three required props** to each instance
|
|
54
|
-
3. **Choose appropriate timeout values** for your application
|
|
55
|
-
4. **Test the inactivity warning and logout flow**
|
|
56
|
-
|
|
57
|
-
#### Migration Guide
|
|
58
|
-
|
|
59
|
-
See the complete [Migration Guide](./migration-guides/unified-auth-provider-mandatory-timeouts.md) for detailed instructions.
|
|
60
|
-
|
|
61
|
-
#### Why This Change
|
|
62
|
-
|
|
63
|
-
This breaking change was made for security reasons:
|
|
64
|
-
- Ensures all apps have automatic logout functionality
|
|
65
|
-
- Prevents security vulnerabilities from idle sessions
|
|
66
|
-
- Provides consistent user experience across all apps
|
|
67
|
-
- Improves overall security posture
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
### v2.0.0 - Service Architecture Changes
|
|
72
|
-
|
|
73
|
-
**Status**: ⚠️ **BREAKING CHANGE**
|
|
74
|
-
**Date**: December 2024
|
|
75
|
-
**Impact**: Medium - Affects apps using service architecture
|
|
76
|
-
|
|
77
|
-
#### What Changed
|
|
78
|
-
|
|
79
|
-
The library now uses a service-based architecture with pure TypeScript service classes and React integration through providers and hooks.
|
|
80
|
-
|
|
81
|
-
#### Key Changes
|
|
82
|
-
|
|
83
|
-
- ✅ **New Service Layer**: Pure TypeScript classes for business logic
|
|
84
|
-
- ✅ **Provider Layer**: React context integration for services
|
|
85
|
-
- ✅ **Hook Layer**: Reactive hooks for component integration
|
|
86
|
-
- ✅ **Backward Compatible**: `UnifiedAuthProvider` maintained for compatibility
|
|
87
|
-
|
|
88
|
-
#### Migration
|
|
89
|
-
|
|
90
|
-
The service architecture is now the default. Existing code continues to work without changes:
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
// Works out of the box - uses service architecture internally
|
|
94
|
-
import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
See [Service Architecture Guide](./architecture/services.md) for details.
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## Version History
|
|
102
|
-
|
|
103
|
-
### v0.5.65+
|
|
104
|
-
- ⚠️ Mandatory inactivity timeouts in UnifiedAuthProvider
|
|
105
|
-
- ⚠️ Breaking TypeScript interface changes
|
|
106
|
-
|
|
107
|
-
### v2.0.0
|
|
108
|
-
- ⚠️ Service architecture introduced (backward compatible)
|
|
109
|
-
- ⚠️ New provider patterns available
|
|
110
|
-
|
|
111
|
-
### v0.4.17
|
|
112
|
-
- ⚠️ Source path fixes for Tailwind scanning
|
|
113
|
-
- Migration guide: [v0.4.17 Source Path Fix](./migration/v0.4.17-source-path-fix.md)
|
|
114
|
-
|
|
115
|
-
### v0.4.16
|
|
116
|
-
- ⚠️ CSS-first approach for Tailwind v4
|
|
117
|
-
- Migration guide: [CSS-First Migration](./migration/v0.4.16-css-first-approach.md)
|
|
118
|
-
|
|
119
|
-
### v0.4.15
|
|
120
|
-
- ⚠️ Tailwind content scanning requirements
|
|
121
|
-
- Migration guide: [Tailwind Scanning](./migration/v0.4.15-tailwind-scanning.md)
|
|
122
|
-
|
|
123
|
-
## Checking for Breaking Changes
|
|
124
|
-
|
|
125
|
-
### Before Upgrading
|
|
126
|
-
|
|
127
|
-
1. **Check this file** for breaking changes in your target version
|
|
128
|
-
2. **Review migration guides** for each breaking change
|
|
129
|
-
3. **Test in development environment** before production
|
|
130
|
-
4. **Update TypeScript** to catch type errors early
|
|
131
|
-
|
|
132
|
-
### Finding Your Current Version
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
npm list @jmruthers/pace-core
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Or check your `package.json`:
|
|
139
|
-
```json
|
|
140
|
-
{
|
|
141
|
-
"dependencies": {
|
|
142
|
-
"@jmruthers/pace-core": "^0.5.65"
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## Migration Resources
|
|
148
|
-
|
|
149
|
-
- [Unified Migration Guide](./migration/MIGRATION_GUIDE.md)
|
|
150
|
-
- [Service Architecture Migration](./migration/service-architecture.md)
|
|
151
|
-
- [RBAC Migration](./migration/rbac-migration.md)
|
|
152
|
-
- [All Migration Guides](./migration/)
|
|
153
|
-
|
|
154
|
-
## Getting Help
|
|
155
|
-
|
|
156
|
-
If you encounter issues during migration:
|
|
157
|
-
|
|
158
|
-
1. Check the specific migration guide for your breaking change
|
|
159
|
-
2. Review [Troubleshooting](./troubleshooting/common-issues.md)
|
|
160
|
-
3. See [Common Issues](./troubleshooting/common-issues.md)
|
|
161
|
-
4. File an issue with version and error details
|
|
162
|
-
|
|
163
|
-
## Staying Updated
|
|
164
|
-
|
|
165
|
-
To stay informed about breaking changes:
|
|
166
|
-
|
|
167
|
-
- 📢 **Check this file** before each upgrade
|
|
168
|
-
- 📢 **Review release notes** on GitHub
|
|
169
|
-
- 📢 **Subscribe to notifications** for major versions
|
|
170
|
-
- 📢 **Follow migration guides** step-by-step
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
**Remember**: Always test breaking changes in a development environment before deploying to production.
|
|
175
|
-
|
|
176
|
-
**Last Updated**: January 2025
|
|
177
|
-
**Current Stable Version**: v0.5.65+
|
|
178
|
-
**Next Major Version**: v1.0.0 (TBD)
|
|
179
|
-
|