@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,12 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# PACE Core Migration Guide
|
|
2
8
|
|
|
3
|
-
> **🔄 Complete Migration Reference** | [← Back to Documentation](../README.md) | [
|
|
9
|
+
> **🔄 Complete Migration Reference** | [← Back to Documentation](../README.md) | [Installation Guide](../getting-started/installation-guide.md)
|
|
4
10
|
|
|
5
|
-
Comprehensive migration guide for upgrading PACE Core across all versions with detailed instructions, breaking changes, and
|
|
11
|
+
Comprehensive migration guide for upgrading PACE Core across all versions with detailed instructions, breaking changes, troubleshooting, and best practices.
|
|
6
12
|
|
|
7
13
|
## Overview
|
|
8
14
|
|
|
9
|
-
This guide covers all PACE Core migrations from version 0.1.0 to the latest version.
|
|
15
|
+
This guide covers all PACE Core migrations from version 0.1.0 to the latest version. It includes:
|
|
16
|
+
|
|
17
|
+
- **Version Upgrades**: Upgrading between major/minor versions
|
|
18
|
+
- **Breaking Changes**: Handling API changes and deprecations
|
|
19
|
+
- **Database Migrations**: Schema updates and data transformations
|
|
20
|
+
- **Configuration Updates**: Environment and build configuration changes
|
|
21
|
+
- **Dependency Updates**: Third-party library compatibility
|
|
22
|
+
- **Troubleshooting**: Common issues and solutions
|
|
10
23
|
|
|
11
24
|
## Quick Reference
|
|
12
25
|
|
|
@@ -19,6 +32,24 @@ This guide covers all PACE Core migrations from version 0.1.0 to the latest vers
|
|
|
19
32
|
| v0.3.x | v0.5.x | ⚠️ Major | 30-45 min | RBAC system, providers |
|
|
20
33
|
| v0.2.x | v0.5.x | ⚠️ Major | 45-60 min | Complete restructure |
|
|
21
34
|
|
|
35
|
+
## Quick Migration Checklist
|
|
36
|
+
|
|
37
|
+
### Before You Start
|
|
38
|
+
- [ ] **Backup your project** - Always backup before major updates
|
|
39
|
+
- [ ] **Check current version** - `npm list @jmruthers/pace-core`
|
|
40
|
+
- [ ] **Review changelog** - Check for breaking changes
|
|
41
|
+
- [ ] **Test in development** - Never migrate directly in production
|
|
42
|
+
|
|
43
|
+
### Essential Tests
|
|
44
|
+
- [ ] **Build succeeds** - `npm run build`
|
|
45
|
+
- [ ] **App starts** - `npm run dev`
|
|
46
|
+
- [ ] **Authentication works** - Login/logout
|
|
47
|
+
- [ ] **Components render** - All UI components display
|
|
48
|
+
- [ ] **Permissions work** - RBAC functions correctly
|
|
49
|
+
- [ ] **Forms work** - Form validation and submission
|
|
50
|
+
- [ ] **Data tables work** - CRUD operations
|
|
51
|
+
- [ ] **Styling correct** - No visual regressions
|
|
52
|
+
|
|
22
53
|
## Current Version Migration (v0.5.x)
|
|
23
54
|
|
|
24
55
|
### Latest Changes in v0.5.x
|
|
@@ -70,26 +101,92 @@ function MyApp() {
|
|
|
70
101
|
}
|
|
71
102
|
```
|
|
72
103
|
|
|
73
|
-
##
|
|
104
|
+
## Breaking Changes
|
|
74
105
|
|
|
75
|
-
### v0.5.
|
|
106
|
+
### v0.5.65+ - Mandatory Inactivity Timeouts
|
|
76
107
|
|
|
77
|
-
**
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
- Performance optimizations
|
|
108
|
+
**Status**: ⚠️ **BREAKING CHANGE**
|
|
109
|
+
**Date**: January 2025
|
|
110
|
+
**Impact**: High - Affects all apps using `UnifiedAuthProvider`
|
|
81
111
|
|
|
82
|
-
|
|
112
|
+
#### What Changed
|
|
83
113
|
|
|
84
|
-
|
|
114
|
+
The `UnifiedAuthProvider` now requires mandatory inactivity timeout configuration. These props were previously optional but are now required for security and TypeScript compliance.
|
|
85
115
|
|
|
86
|
-
|
|
87
|
-
- File Upload & Storage System
|
|
88
|
-
- Inactivity Tracking
|
|
89
|
-
- Public Pages System
|
|
90
|
-
- Organisation Security
|
|
116
|
+
#### Before (Old Code)
|
|
91
117
|
|
|
92
|
-
|
|
118
|
+
```tsx
|
|
119
|
+
// ❌ This will now cause TypeScript errors
|
|
120
|
+
<UnifiedAuthProvider supabaseClient={supabase} appName="my-app">
|
|
121
|
+
<App />
|
|
122
|
+
</UnifiedAuthProvider>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### After (New Code)
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
// ✅ Required configuration
|
|
129
|
+
<UnifiedAuthProvider
|
|
130
|
+
supabaseClient={supabase}
|
|
131
|
+
appName="my-app"
|
|
132
|
+
idleTimeoutMs={30 * 60 * 1000} // Required: 30 minutes
|
|
133
|
+
warnBeforeMs={5 * 60 * 1000} // Required: 5 minutes warning
|
|
134
|
+
onIdleLogout={() => window.location.href = '/login'} // Required
|
|
135
|
+
>
|
|
136
|
+
<App />
|
|
137
|
+
</UnifiedAuthProvider>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Required Props
|
|
141
|
+
|
|
142
|
+
| Prop | Type | Required | Description |
|
|
143
|
+
|------|------|----------|-------------|
|
|
144
|
+
| `idleTimeoutMs` | `number` | ✅ Yes | Idle timeout in milliseconds |
|
|
145
|
+
| `warnBeforeMs` | `number` | ✅ Yes | Warning before logout in milliseconds |
|
|
146
|
+
| `onIdleLogout` | `() => void` | ✅ Yes | Callback when user is logged out |
|
|
147
|
+
|
|
148
|
+
#### Migration Steps
|
|
149
|
+
|
|
150
|
+
1. **Identify all UnifiedAuthProvider instances** in your codebase
|
|
151
|
+
2. **Add the three required props** to each instance
|
|
152
|
+
3. **Choose appropriate timeout values** for your application
|
|
153
|
+
4. **Test the inactivity warning and logout flow**
|
|
154
|
+
|
|
155
|
+
#### Why This Change
|
|
156
|
+
|
|
157
|
+
This breaking change was made for security reasons:
|
|
158
|
+
- Ensures all apps have automatic logout functionality
|
|
159
|
+
- Prevents security vulnerabilities from idle sessions
|
|
160
|
+
- Provides consistent user experience across all apps
|
|
161
|
+
- Improves overall security posture
|
|
162
|
+
|
|
163
|
+
### v2.0.0 - Service Architecture Changes
|
|
164
|
+
|
|
165
|
+
**Status**: ⚠️ **BREAKING CHANGE**
|
|
166
|
+
**Date**: December 2024
|
|
167
|
+
**Impact**: Medium - Affects apps using service architecture
|
|
168
|
+
|
|
169
|
+
#### What Changed
|
|
170
|
+
|
|
171
|
+
The library now uses a service-based architecture with pure TypeScript service classes and React integration through providers and hooks.
|
|
172
|
+
|
|
173
|
+
#### Key Changes
|
|
174
|
+
|
|
175
|
+
- ✅ **New Service Layer**: Pure TypeScript classes for business logic
|
|
176
|
+
- ✅ **Provider Layer**: React context integration for services
|
|
177
|
+
- ✅ **Hook Layer**: Reactive hooks for component integration
|
|
178
|
+
- ✅ **Backward Compatible**: `UnifiedAuthProvider` maintained for compatibility
|
|
179
|
+
|
|
180
|
+
#### Migration
|
|
181
|
+
|
|
182
|
+
The service architecture is now the default. Existing code continues to work without changes:
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
// Works out of the box - uses service architecture internally
|
|
186
|
+
import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Version-Specific Migrations
|
|
93
190
|
|
|
94
191
|
### v0.4.17 - Source Path Fix
|
|
95
192
|
|
|
@@ -200,36 +297,38 @@ export default defineConfig({
|
|
|
200
297
|
})
|
|
201
298
|
```
|
|
202
299
|
|
|
203
|
-
3. **
|
|
300
|
+
3. **Remove old Tailwind dependencies:**
|
|
301
|
+
```bash
|
|
302
|
+
npm uninstall tailwindcss postcss autoprefixer
|
|
303
|
+
npm install @tailwindcss/vite tailwindcss@^4.0.0
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
4. **Test styling:**
|
|
204
307
|
```tsx
|
|
205
|
-
// Test component
|
|
206
308
|
import { Button } from '@jmruthers/pace-core';
|
|
207
309
|
|
|
208
310
|
function TestComponent() {
|
|
209
311
|
return (
|
|
210
|
-
<Button className="bg-main-600 text-main-50">
|
|
312
|
+
<Button variant="primary" className="bg-main-600 text-main-50">
|
|
211
313
|
Test Button
|
|
212
314
|
</Button>
|
|
213
315
|
);
|
|
214
316
|
}
|
|
215
317
|
```
|
|
216
318
|
|
|
217
|
-
### v0.4.15 - Tailwind Scanning
|
|
218
|
-
|
|
219
|
-
**Issue Fixed:** Components appeared unstyled due to missing Tailwind class scanning.
|
|
319
|
+
### v0.4.15 - Tailwind Content Scanning
|
|
220
320
|
|
|
221
|
-
**
|
|
321
|
+
**Change:** Required explicit content scanning for pace-core components.
|
|
222
322
|
|
|
223
323
|
**Migration Steps:**
|
|
224
324
|
|
|
225
|
-
1. **Update
|
|
226
|
-
```bash
|
|
227
|
-
npm install @jmruthers/pace-core@^0.4.15
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
2. **Update Vite configuration:**
|
|
325
|
+
1. **Update Vite configuration:**
|
|
231
326
|
```typescript
|
|
232
327
|
// vite.config.ts
|
|
328
|
+
import { defineConfig } from 'vite'
|
|
329
|
+
import react from '@vitejs/plugin-react'
|
|
330
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
331
|
+
|
|
233
332
|
export default defineConfig({
|
|
234
333
|
plugins: [
|
|
235
334
|
react(),
|
|
@@ -243,442 +342,819 @@ export default defineConfig({
|
|
|
243
342
|
})
|
|
244
343
|
```
|
|
245
344
|
|
|
246
|
-
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
4. **Verify CSS generation:**
|
|
253
|
-
```bash
|
|
254
|
-
# Should generate 800+ CSS rules (not 292)
|
|
255
|
-
npm run build
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### v0.4.14 and Earlier
|
|
259
|
-
|
|
260
|
-
**Legacy Configuration:**
|
|
261
|
-
```typescript
|
|
262
|
-
// Old configuration (v0.4.14 and below)
|
|
263
|
-
export default defineConfig({
|
|
264
|
-
plugins: [
|
|
265
|
-
react(),
|
|
266
|
-
tailwindcss({
|
|
267
|
-
content: [
|
|
268
|
-
'./src/**/*.{js,ts,jsx,tsx}',
|
|
269
|
-
'./node_modules/@jmruthers/pace-core/**/*.{js,ts,jsx,tsx}'
|
|
270
|
-
]
|
|
271
|
-
})
|
|
272
|
-
],
|
|
273
|
-
})
|
|
345
|
+
2. **Verify CSS import:**
|
|
346
|
+
```tsx
|
|
347
|
+
// Ensure this import is first
|
|
348
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
274
349
|
```
|
|
275
350
|
|
|
276
|
-
##
|
|
277
|
-
|
|
278
|
-
### v0.3.x to v0.5.x
|
|
351
|
+
## API Changes Migration
|
|
279
352
|
|
|
280
|
-
|
|
281
|
-
- Provider hierarchy changes
|
|
282
|
-
- RBAC system updates
|
|
283
|
-
- New authentication patterns
|
|
353
|
+
### Component Props Migration
|
|
284
354
|
|
|
285
|
-
**
|
|
355
|
+
**Common prop changes:**
|
|
286
356
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
357
|
+
```tsx
|
|
358
|
+
// Before (v0.x)
|
|
359
|
+
<DataTable
|
|
360
|
+
data={data}
|
|
361
|
+
columns={columns}
|
|
362
|
+
enableSearch={true}
|
|
363
|
+
enablePagination={true}
|
|
364
|
+
/>
|
|
365
|
+
|
|
366
|
+
// After (v1.x)
|
|
367
|
+
<DataTable
|
|
368
|
+
data={data}
|
|
369
|
+
columns={columns}
|
|
370
|
+
features={{
|
|
371
|
+
search: true,
|
|
372
|
+
pagination: true,
|
|
373
|
+
sorting: true,
|
|
374
|
+
filtering: true
|
|
375
|
+
}}
|
|
376
|
+
/>
|
|
290
377
|
```
|
|
291
378
|
|
|
292
|
-
|
|
293
|
-
```tsx
|
|
294
|
-
// Before (v0.3.x)
|
|
295
|
-
<AuthProvider>
|
|
296
|
-
<OrganisationProvider>
|
|
297
|
-
<EventProvider>
|
|
298
|
-
<App />
|
|
299
|
-
</EventProvider>
|
|
300
|
-
</OrganisationProvider>
|
|
301
|
-
</AuthProvider>
|
|
379
|
+
### Hook Changes
|
|
302
380
|
|
|
303
|
-
|
|
304
|
-
<UnifiedAuthProvider supabaseClient={supabase} appName="my-app">
|
|
305
|
-
<OrganisationProvider>
|
|
306
|
-
<EventProvider>
|
|
307
|
-
<App />
|
|
308
|
-
</EventProvider>
|
|
309
|
-
</OrganisationProvider>
|
|
310
|
-
</UnifiedAuthProvider>
|
|
311
|
-
```
|
|
381
|
+
**RBAC hooks moved to separate module:**
|
|
312
382
|
|
|
313
|
-
3. **Update authentication hooks:**
|
|
314
383
|
```tsx
|
|
315
384
|
// Before
|
|
316
|
-
import {
|
|
385
|
+
import { useCan, usePermissions } from '@jmruthers/pace-core';
|
|
317
386
|
|
|
318
387
|
// After
|
|
319
|
-
import {
|
|
388
|
+
import { useCan, usePermissions } from '@jmruthers/pace-core/rbac';
|
|
320
389
|
```
|
|
321
390
|
|
|
322
|
-
|
|
391
|
+
### Import Changes
|
|
392
|
+
|
|
393
|
+
**Consolidated imports:**
|
|
394
|
+
|
|
323
395
|
```tsx
|
|
324
396
|
// Before
|
|
325
|
-
import {
|
|
397
|
+
import { Button } from '@jmruthers/pace-core/components';
|
|
398
|
+
import { useUnifiedAuth } from '@jmruthers/pace-core/hooks';
|
|
326
399
|
|
|
327
400
|
// After
|
|
328
|
-
import {
|
|
401
|
+
import { Button, useUnifiedAuth } from '@jmruthers/pace-core';
|
|
329
402
|
```
|
|
330
403
|
|
|
331
|
-
|
|
404
|
+
## Database Migration
|
|
332
405
|
|
|
333
|
-
|
|
334
|
-
- Complete component restructure
|
|
335
|
-
- New import paths
|
|
336
|
-
- Updated prop interfaces
|
|
406
|
+
### Schema Migration
|
|
337
407
|
|
|
338
|
-
|
|
408
|
+
```sql
|
|
409
|
+
-- Migration script for database schema changes
|
|
410
|
+
-- 001_migrate_users_table.sql
|
|
411
|
+
|
|
412
|
+
-- Add new columns to users table
|
|
413
|
+
ALTER TABLE users
|
|
414
|
+
ADD COLUMN IF NOT EXISTS organisation_id UUID REFERENCES organisations(id),
|
|
415
|
+
ADD COLUMN IF NOT EXISTS role VARCHAR(50) DEFAULT 'user',
|
|
416
|
+
ADD COLUMN IF NOT EXISTS permissions JSONB DEFAULT '[]';
|
|
417
|
+
|
|
418
|
+
-- Create index for performance
|
|
419
|
+
CREATE INDEX IF NOT EXISTS idx_users_organisation_id ON users(organisation_id);
|
|
420
|
+
CREATE INDEX IF NOT EXISTS idx_users_role ON users(role);
|
|
421
|
+
|
|
422
|
+
-- Update existing users with default values
|
|
423
|
+
UPDATE users
|
|
424
|
+
SET
|
|
425
|
+
organisation_id = (SELECT id FROM organisations LIMIT 1),
|
|
426
|
+
role = 'user',
|
|
427
|
+
permissions = '[]'
|
|
428
|
+
WHERE organisation_id IS NULL;
|
|
429
|
+
|
|
430
|
+
-- Add constraints
|
|
431
|
+
ALTER TABLE users
|
|
432
|
+
ALTER COLUMN organisation_id SET NOT NULL,
|
|
433
|
+
ALTER COLUMN role SET NOT NULL;
|
|
434
|
+
```
|
|
339
435
|
|
|
340
|
-
|
|
341
|
-
```tsx
|
|
342
|
-
// Before (v0.2.x)
|
|
343
|
-
import { Button, Card, useAuth } from '@jmruthers/pace-core/components';
|
|
436
|
+
### Data Migration
|
|
344
437
|
|
|
345
|
-
|
|
346
|
-
|
|
438
|
+
```typescript
|
|
439
|
+
// Migration script for data transformation
|
|
440
|
+
async function migrateUserData() {
|
|
441
|
+
const { supabase } = useSupabase();
|
|
442
|
+
|
|
443
|
+
// Get all users
|
|
444
|
+
const { data: users, error } = await supabase
|
|
445
|
+
.from('users')
|
|
446
|
+
.select('*');
|
|
447
|
+
|
|
448
|
+
if (error) {
|
|
449
|
+
console.error('Failed to fetch users:', error);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Transform user data
|
|
454
|
+
const migratedUsers = users.map(user => ({
|
|
455
|
+
...user,
|
|
456
|
+
// Convert old permission format to new format
|
|
457
|
+
permissions: user.permissions?.map((permission: string) =>
|
|
458
|
+
permission.replace('_', ':')
|
|
459
|
+
) || [],
|
|
460
|
+
// Add default role if missing
|
|
461
|
+
role: user.role || 'user',
|
|
462
|
+
// Add organisation if missing
|
|
463
|
+
organisation_id: user.organisation_id || 'default-org-id',
|
|
464
|
+
}));
|
|
465
|
+
|
|
466
|
+
// Update users in batches
|
|
467
|
+
const batchSize = 100;
|
|
468
|
+
for (let i = 0; i < migratedUsers.length; i += batchSize) {
|
|
469
|
+
const batch = migratedUsers.slice(i, i + batchSize);
|
|
470
|
+
|
|
471
|
+
const { error: updateError } = await supabase
|
|
472
|
+
.from('users')
|
|
473
|
+
.upsert(batch);
|
|
474
|
+
|
|
475
|
+
if (updateError) {
|
|
476
|
+
console.error(`Failed to update batch ${i / batchSize + 1}:`, updateError);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
console.log('User data migration completed');
|
|
481
|
+
}
|
|
347
482
|
```
|
|
348
483
|
|
|
349
|
-
|
|
350
|
-
```tsx
|
|
351
|
-
// Check component documentation for prop changes
|
|
352
|
-
// Most components maintain backward compatibility
|
|
353
|
-
```
|
|
484
|
+
### RLS Policy Migration
|
|
354
485
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
486
|
+
```sql
|
|
487
|
+
-- Migration script for RLS policies
|
|
488
|
+
-- 002_migrate_rls_policies.sql
|
|
489
|
+
|
|
490
|
+
-- Drop old policies
|
|
491
|
+
DROP POLICY IF EXISTS "Users can view their own data" ON users;
|
|
492
|
+
DROP POLICY IF EXISTS "Users can update their own data" ON users;
|
|
493
|
+
|
|
494
|
+
-- Create new policies with organisation isolation
|
|
495
|
+
CREATE POLICY "Users can view their own organisation's data" ON users
|
|
496
|
+
FOR SELECT USING (
|
|
497
|
+
organisation_id = auth.jwt() ->> 'organisation_id'
|
|
498
|
+
);
|
|
359
499
|
|
|
360
|
-
|
|
500
|
+
CREATE POLICY "Users can update their own data" ON users
|
|
501
|
+
FOR UPDATE USING (
|
|
502
|
+
id = auth.uid() AND
|
|
503
|
+
organisation_id = auth.jwt() ->> 'organisation_id'
|
|
504
|
+
);
|
|
361
505
|
|
|
362
|
-
|
|
506
|
+
CREATE POLICY "Users can insert their own data" ON users
|
|
507
|
+
FOR INSERT WITH CHECK (
|
|
508
|
+
organisation_id = auth.jwt() ->> 'organisation_id'
|
|
509
|
+
);
|
|
363
510
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
511
|
+
-- Apply similar policies to other tables
|
|
512
|
+
-- events table
|
|
513
|
+
CREATE POLICY "Users can view their organisation's events" ON events
|
|
514
|
+
FOR SELECT USING (
|
|
515
|
+
organisation_id = auth.jwt() ->> 'organisation_id'
|
|
516
|
+
);
|
|
369
517
|
|
|
370
|
-
|
|
518
|
+
CREATE POLICY "Users can manage their organisation's events" ON events
|
|
519
|
+
FOR ALL USING (
|
|
520
|
+
organisation_id = auth.jwt() ->> 'organisation_id'
|
|
521
|
+
);
|
|
522
|
+
```
|
|
371
523
|
|
|
372
|
-
|
|
373
|
-
|---------|--------|--------|-------|
|
|
374
|
-
| v0.5.0 | Hook location | `useRBAC` | `useCan` from `/rbac` |
|
|
375
|
-
| v0.4.0 | Permission format | `"read users"` | `"read:users"` |
|
|
376
|
-
| v0.3.0 | Scope format | `{ userId, orgId }` | `{ organisationId }` |
|
|
524
|
+
## Configuration Migration
|
|
377
525
|
|
|
378
|
-
###
|
|
526
|
+
### Environment Variables Migration
|
|
379
527
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
| v0.3.0 | Prop interfaces | Legacy props | Updated interfaces |
|
|
384
|
-
| v0.2.0 | Component names | Old names | New naming convention |
|
|
528
|
+
```bash
|
|
529
|
+
# Migration script for environment variables
|
|
530
|
+
# old.env -> new.env
|
|
385
531
|
|
|
386
|
-
|
|
532
|
+
# Old environment variables
|
|
533
|
+
VITE_AUTH_URL=https://old-auth.example.com
|
|
534
|
+
VITE_API_KEY=old-api-key
|
|
535
|
+
VITE_DEBUG_MODE=true
|
|
387
536
|
|
|
388
|
-
|
|
537
|
+
# New environment variables
|
|
538
|
+
VITE_SUPABASE_URL=https://your-project.supabase.co
|
|
539
|
+
VITE_SUPABASE_ANON_KEY=your-anon-key
|
|
540
|
+
VITE_APP_ENV=development
|
|
541
|
+
VITE_DEBUG=false
|
|
389
542
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
CREATE TABLE rbac_apps (
|
|
394
|
-
id UUID PRIMARY KEY,
|
|
395
|
-
name TEXT NOT NULL,
|
|
396
|
-
requires_event BOOLEAN DEFAULT false
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
CREATE TABLE rbac_page_permissions (
|
|
400
|
-
id UUID PRIMARY KEY,
|
|
401
|
-
app_id UUID REFERENCES rbac_apps(id),
|
|
402
|
-
page_name TEXT NOT NULL,
|
|
403
|
-
operation TEXT NOT NULL,
|
|
404
|
-
required_permissions TEXT[] NOT NULL
|
|
405
|
-
);
|
|
406
|
-
|
|
407
|
-
-- Migration from old system
|
|
408
|
-
INSERT INTO rbac_apps (id, name, requires_event)
|
|
409
|
-
VALUES ('your-app-id', 'Your App Name', false);
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
**Code Migration:**
|
|
413
|
-
```tsx
|
|
414
|
-
// Before (Legacy RBAC)
|
|
415
|
-
import { useRBAC } from '@jmruthers/pace-core';
|
|
543
|
+
# Migration script
|
|
544
|
+
#!/bin/bash
|
|
545
|
+
# migrate-env.sh
|
|
416
546
|
|
|
417
|
-
|
|
418
|
-
const { hasPermission } = useRBAC();
|
|
419
|
-
const canEdit = hasPermission('edit', 'users');
|
|
420
|
-
}
|
|
547
|
+
echo "Migrating environment variables..."
|
|
421
548
|
|
|
422
|
-
|
|
423
|
-
|
|
549
|
+
# Backup old environment file
|
|
550
|
+
cp .env .env.backup
|
|
424
551
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
552
|
+
# Create new environment file
|
|
553
|
+
cat > .env << EOF
|
|
554
|
+
# Supabase Configuration
|
|
555
|
+
VITE_SUPABASE_URL=${VITE_SUPABASE_URL:-https://your-project.supabase.co}
|
|
556
|
+
VITE_SUPABASE_ANON_KEY=${VITE_SUPABASE_ANON_KEY:-your-anon-key}
|
|
430
557
|
|
|
431
|
-
|
|
558
|
+
# Application Configuration
|
|
559
|
+
VITE_APP_ENV=${VITE_APP_ENV:-development}
|
|
560
|
+
VITE_DEBUG=${VITE_DEBUG:-false}
|
|
432
561
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
hasPermission('read', 'users')
|
|
437
|
-
hasPermission('edit', 'organisations')
|
|
438
|
-
```
|
|
562
|
+
# Feature Flags
|
|
563
|
+
VITE_FEATURE_ANALYTICS=${VITE_FEATURE_ANALYTICS:-false}
|
|
564
|
+
VITE_FEATURE_BETA=${VITE_FEATURE_BETA:-false}
|
|
439
565
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
566
|
+
# Monitoring
|
|
567
|
+
VITE_SENTRY_DSN=${VITE_SENTRY_DSN:-}
|
|
568
|
+
VITE_ANALYTICS_ID=${VITE_ANALYTICS_ID:-}
|
|
569
|
+
EOF
|
|
570
|
+
|
|
571
|
+
echo "Environment migration completed"
|
|
445
572
|
```
|
|
446
573
|
|
|
447
|
-
|
|
574
|
+
### Build Configuration Migration
|
|
448
575
|
|
|
449
|
-
|
|
576
|
+
```typescript
|
|
577
|
+
// Migration script for build configuration
|
|
578
|
+
// vite.config.old.ts -> vite.config.ts
|
|
450
579
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
580
|
+
// Old configuration
|
|
581
|
+
export default defineConfig({
|
|
582
|
+
plugins: [react()],
|
|
583
|
+
build: {
|
|
584
|
+
outDir: 'build',
|
|
585
|
+
sourcemap: true,
|
|
586
|
+
},
|
|
587
|
+
define: {
|
|
588
|
+
global: 'globalThis',
|
|
589
|
+
},
|
|
590
|
+
});
|
|
461
591
|
|
|
462
|
-
//
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
592
|
+
// New configuration
|
|
593
|
+
export default defineConfig({
|
|
594
|
+
plugins: [react()],
|
|
595
|
+
build: {
|
|
596
|
+
target: 'es2015',
|
|
597
|
+
outDir: 'dist',
|
|
598
|
+
sourcemap: false, // Disable in production
|
|
599
|
+
minify: 'terser',
|
|
600
|
+
rollupOptions: {
|
|
601
|
+
output: {
|
|
602
|
+
manualChunks: {
|
|
603
|
+
vendor: ['react', 'react-dom'],
|
|
604
|
+
paceCore: ['@jmruthers/pace-core'],
|
|
605
|
+
supabase: ['@supabase/supabase-js'],
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
terserOptions: {
|
|
610
|
+
compress: {
|
|
611
|
+
drop_console: true,
|
|
612
|
+
drop_debugger: true,
|
|
613
|
+
},
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
define: {
|
|
617
|
+
__DEV__: JSON.stringify(process.env.NODE_ENV === 'development'),
|
|
618
|
+
},
|
|
619
|
+
optimizeDeps: {
|
|
620
|
+
include: ['@jmruthers/pace-core'],
|
|
621
|
+
},
|
|
622
|
+
});
|
|
470
623
|
```
|
|
471
624
|
|
|
472
|
-
###
|
|
625
|
+
### Package.json Migration
|
|
473
626
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
//
|
|
477
|
-
// No manual setup required
|
|
478
|
-
<OrganisationProvider>
|
|
479
|
-
<YourApp />
|
|
480
|
-
</OrganisationProvider>
|
|
627
|
+
```json
|
|
628
|
+
// Migration script for package.json dependencies
|
|
629
|
+
// package.json.old -> package.json
|
|
481
630
|
|
|
482
|
-
|
|
483
|
-
|
|
631
|
+
{
|
|
632
|
+
"name": "my-app",
|
|
633
|
+
"version": "2.0.0",
|
|
634
|
+
"dependencies": {
|
|
635
|
+
// Old dependencies
|
|
636
|
+
"@jmruthers/pace-core": "^1.5.0",
|
|
637
|
+
"react": "^17.0.2",
|
|
638
|
+
"react-dom": "^17.0.2",
|
|
639
|
+
|
|
640
|
+
// New dependencies
|
|
641
|
+
"@jmruthers/pace-core": "^2.0.0",
|
|
642
|
+
"react": "^18.2.0",
|
|
643
|
+
"react-dom": "^18.2.0",
|
|
644
|
+
"@supabase/supabase-js": "^2.38.0",
|
|
645
|
+
"zod": "^3.22.0"
|
|
646
|
+
},
|
|
647
|
+
"devDependencies": {
|
|
648
|
+
// Old dev dependencies
|
|
649
|
+
"@types/react": "^17.0.0",
|
|
650
|
+
"@types/react-dom": "^17.0.0",
|
|
651
|
+
|
|
652
|
+
// New dev dependencies
|
|
653
|
+
"@types/react": "^18.2.0",
|
|
654
|
+
"@types/react-dom": "^18.2.0",
|
|
655
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
656
|
+
"vite": "^4.4.0",
|
|
657
|
+
"typescript": "^5.0.0"
|
|
658
|
+
},
|
|
659
|
+
"scripts": {
|
|
660
|
+
// Old scripts
|
|
661
|
+
"start": "react-scripts start",
|
|
662
|
+
"build": "react-scripts build",
|
|
663
|
+
"test": "react-scripts test",
|
|
664
|
+
|
|
665
|
+
// New scripts
|
|
666
|
+
"dev": "vite",
|
|
667
|
+
"build": "vite build",
|
|
668
|
+
"preview": "vite preview",
|
|
669
|
+
"test": "vitest",
|
|
670
|
+
"type-check": "tsc --noEmit"
|
|
671
|
+
}
|
|
672
|
+
}
|
|
484
673
|
```
|
|
485
674
|
|
|
486
|
-
##
|
|
487
|
-
|
|
488
|
-
### Styling Issues After Upgrade
|
|
675
|
+
## Migration Tools and Utilities
|
|
489
676
|
|
|
490
|
-
|
|
677
|
+
### Migration Helper Functions
|
|
491
678
|
|
|
492
|
-
**Solutions:**
|
|
493
|
-
1. **Check Vite configuration:**
|
|
494
679
|
```typescript
|
|
495
|
-
//
|
|
496
|
-
export
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
680
|
+
// utils/migrationHelpers.ts
|
|
681
|
+
export class MigrationHelpers {
|
|
682
|
+
// Check if migration is needed
|
|
683
|
+
static needsMigration(currentVersion: string, targetVersion: string): boolean {
|
|
684
|
+
const current = this.parseVersion(currentVersion);
|
|
685
|
+
const target = this.parseVersion(targetVersion);
|
|
686
|
+
|
|
687
|
+
return current.major < target.major ||
|
|
688
|
+
(current.major === target.major && current.minor < target.minor);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// Parse version string
|
|
692
|
+
static parseVersion(version: string) {
|
|
693
|
+
const [major, minor, patch] = version.split('.').map(Number);
|
|
694
|
+
return { major, minor, patch };
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Migrate component props
|
|
698
|
+
static migrateComponentProps(oldProps: any, componentName: string) {
|
|
699
|
+
const migrations = {
|
|
700
|
+
Button: {
|
|
701
|
+
type: 'variant',
|
|
702
|
+
size: 'md',
|
|
703
|
+
loading: false,
|
|
704
|
+
},
|
|
705
|
+
DataTable: {
|
|
706
|
+
data: 'rows',
|
|
707
|
+
columns: 'columns',
|
|
708
|
+
pagination: 'enablePagination',
|
|
709
|
+
},
|
|
710
|
+
Form: {
|
|
711
|
+
onSubmit: 'onSubmit',
|
|
712
|
+
validation: 'schema',
|
|
713
|
+
},
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
const migration = migrations[componentName];
|
|
717
|
+
if (!migration) return oldProps;
|
|
718
|
+
|
|
719
|
+
const newProps = { ...oldProps };
|
|
720
|
+
|
|
721
|
+
Object.entries(migration).forEach(([oldKey, newKey]) => {
|
|
722
|
+
if (oldProps[oldKey] !== undefined) {
|
|
723
|
+
newProps[newKey] = oldProps[oldKey];
|
|
724
|
+
delete newProps[oldKey];
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
return newProps;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// Migrate permission format
|
|
732
|
+
static migratePermissionFormat(permission: string): string {
|
|
733
|
+
return permission.replace('_', ':');
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// Migrate user data
|
|
737
|
+
static migrateUserData(user: any) {
|
|
738
|
+
return {
|
|
739
|
+
...user,
|
|
740
|
+
permissions: user.permissions?.map(this.migratePermissionFormat) || [],
|
|
741
|
+
role: user.role || 'user',
|
|
742
|
+
organisation_id: user.organisation_id || 'default',
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// Generate migration report
|
|
747
|
+
static generateMigrationReport(changes: any[]) {
|
|
748
|
+
return {
|
|
749
|
+
timestamp: new Date().toISOString(),
|
|
750
|
+
changes,
|
|
751
|
+
summary: {
|
|
752
|
+
total: changes.length,
|
|
753
|
+
breaking: changes.filter(c => c.breaking).length,
|
|
754
|
+
nonBreaking: changes.filter(c => !c.breaking).length,
|
|
755
|
+
},
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
507
759
|
```
|
|
508
760
|
|
|
509
|
-
|
|
510
|
-
```bash
|
|
511
|
-
rm -rf dist .vite node_modules
|
|
512
|
-
npm install
|
|
513
|
-
npm run build
|
|
514
|
-
```
|
|
761
|
+
### Migration Validation
|
|
515
762
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
763
|
+
```typescript
|
|
764
|
+
// utils/migrationValidation.ts
|
|
765
|
+
export class MigrationValidation {
|
|
766
|
+
// Validate component usage
|
|
767
|
+
static validateComponentUsage(componentName: string, props: any) {
|
|
768
|
+
const validations = {
|
|
769
|
+
Button: {
|
|
770
|
+
required: ['children'],
|
|
771
|
+
optional: ['variant', 'size', 'loading', 'disabled', 'onClick'],
|
|
772
|
+
deprecated: ['type'],
|
|
773
|
+
},
|
|
774
|
+
DataTable: {
|
|
775
|
+
required: ['data', 'columns'],
|
|
776
|
+
optional: ['pagination', 'sorting', 'filtering'],
|
|
777
|
+
deprecated: ['rows'],
|
|
778
|
+
},
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
const validation = validations[componentName];
|
|
782
|
+
if (!validation) return { valid: true, warnings: [] };
|
|
783
|
+
|
|
784
|
+
const warnings = [];
|
|
785
|
+
|
|
786
|
+
// Check for deprecated props
|
|
787
|
+
validation.deprecated.forEach(prop => {
|
|
788
|
+
if (props[prop] !== undefined) {
|
|
789
|
+
warnings.push(`Prop '${prop}' is deprecated in ${componentName}`);
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
// Check for missing required props
|
|
794
|
+
validation.required.forEach(prop => {
|
|
795
|
+
if (props[prop] === undefined) {
|
|
796
|
+
warnings.push(`Required prop '${prop}' is missing in ${componentName}`);
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
return {
|
|
801
|
+
valid: warnings.length === 0,
|
|
802
|
+
warnings,
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// Validate hook usage
|
|
807
|
+
static validateHookUsage(hookName: string, args: any[]) {
|
|
808
|
+
const validations = {
|
|
809
|
+
useUnifiedAuth: {
|
|
810
|
+
args: 0,
|
|
811
|
+
description: 'No arguments required',
|
|
812
|
+
},
|
|
813
|
+
useRBAC: {
|
|
814
|
+
args: 0,
|
|
815
|
+
description: 'No arguments required',
|
|
816
|
+
},
|
|
817
|
+
useEvents: {
|
|
818
|
+
args: 0,
|
|
819
|
+
description: 'No arguments required',
|
|
820
|
+
},
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
const validation = validations[hookName];
|
|
824
|
+
if (!validation) return { valid: true, warnings: [] };
|
|
825
|
+
|
|
826
|
+
const warnings = [];
|
|
827
|
+
|
|
828
|
+
if (args.length !== validation.args) {
|
|
829
|
+
warnings.push(`${hookName} expects ${validation.args} arguments, got ${args.length}`);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
return {
|
|
833
|
+
valid: warnings.length === 0,
|
|
834
|
+
warnings,
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// Validate configuration
|
|
839
|
+
static validateConfiguration(config: any) {
|
|
840
|
+
const required = [
|
|
841
|
+
'VITE_SUPABASE_URL',
|
|
842
|
+
'VITE_SUPABASE_ANON_KEY',
|
|
843
|
+
];
|
|
844
|
+
|
|
845
|
+
const warnings = [];
|
|
846
|
+
|
|
847
|
+
required.forEach(key => {
|
|
848
|
+
if (!config[key]) {
|
|
849
|
+
warnings.push(`Required environment variable '${key}' is missing`);
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
return {
|
|
854
|
+
valid: warnings.length === 0,
|
|
855
|
+
warnings,
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
}
|
|
520
859
|
```
|
|
521
860
|
|
|
522
|
-
|
|
861
|
+
## Common Migration Issues
|
|
523
862
|
|
|
524
|
-
|
|
863
|
+
### Styling Issues
|
|
525
864
|
|
|
526
|
-
**
|
|
527
|
-
1. **Update import paths:**
|
|
528
|
-
```tsx
|
|
529
|
-
// Old
|
|
530
|
-
import { Button } from '@jmruthers/pace-core/components';
|
|
865
|
+
**Problem**: Components appear unstyled after update
|
|
531
866
|
|
|
532
|
-
|
|
867
|
+
**Solution**:
|
|
868
|
+
```tsx
|
|
869
|
+
// Ensure CSS import is first
|
|
870
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
533
871
|
import { Button } from '@jmruthers/pace-core';
|
|
534
872
|
```
|
|
535
873
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
874
|
+
### Build Errors
|
|
875
|
+
|
|
876
|
+
**Problem**: Build fails with Tailwind errors
|
|
877
|
+
|
|
878
|
+
**Solution**:
|
|
879
|
+
```bash
|
|
880
|
+
# Clear all caches
|
|
881
|
+
rm -rf node_modules package-lock.json
|
|
882
|
+
npm install
|
|
883
|
+
|
|
884
|
+
# Check Tailwind config
|
|
885
|
+
npm run build -- --debug
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
### TypeScript Errors
|
|
889
|
+
|
|
890
|
+
**Problem**: Type errors after update
|
|
891
|
+
|
|
892
|
+
**Solution**:
|
|
893
|
+
```bash
|
|
894
|
+
# Update TypeScript types
|
|
895
|
+
npm install @types/react@latest @types/react-dom@latest
|
|
540
896
|
|
|
541
|
-
|
|
542
|
-
|
|
897
|
+
# Regenerate types
|
|
898
|
+
npm run type-check
|
|
543
899
|
```
|
|
544
900
|
|
|
545
901
|
### Authentication Issues
|
|
546
902
|
|
|
547
|
-
**Problem
|
|
903
|
+
**Problem**: Login not working after update
|
|
548
904
|
|
|
549
|
-
**
|
|
550
|
-
1. **Update provider hierarchy:**
|
|
905
|
+
**Solution**:
|
|
551
906
|
```tsx
|
|
552
|
-
//
|
|
907
|
+
// Check provider hierarchy
|
|
553
908
|
<UnifiedAuthProvider supabaseClient={supabase} appName="my-app">
|
|
554
909
|
<OrganisationProvider>
|
|
555
910
|
<EventProvider>
|
|
556
|
-
<
|
|
911
|
+
<YourApp />
|
|
557
912
|
</EventProvider>
|
|
558
913
|
</OrganisationProvider>
|
|
559
914
|
</UnifiedAuthProvider>
|
|
560
915
|
```
|
|
561
916
|
|
|
562
|
-
|
|
563
|
-
```tsx
|
|
564
|
-
// Use useUnifiedAuth
|
|
565
|
-
const { user, signIn, signOut } = useUnifiedAuth();
|
|
566
|
-
```
|
|
917
|
+
## Migration Best Practices
|
|
567
918
|
|
|
568
|
-
###
|
|
919
|
+
### Migration Checklist
|
|
569
920
|
|
|
570
|
-
|
|
921
|
+
- [ ] Review breaking changes documentation
|
|
922
|
+
- [ ] Create migration plan
|
|
923
|
+
- [ ] Set up staging environment
|
|
924
|
+
- [ ] Backup current data
|
|
925
|
+
- [ ] Test migration in staging
|
|
926
|
+
- [ ] Update dependencies
|
|
927
|
+
- [ ] Migrate configuration
|
|
928
|
+
- [ ] Update code for new APIs
|
|
929
|
+
- [ ] Test all functionality
|
|
930
|
+
- [ ] Deploy to production
|
|
931
|
+
- [ ] Monitor for issues
|
|
932
|
+
- [ ] Clean up old code
|
|
571
933
|
|
|
572
|
-
|
|
573
|
-
1. **Update permission format:**
|
|
574
|
-
```tsx
|
|
575
|
-
// Old format
|
|
576
|
-
hasPermission('read', 'users')
|
|
934
|
+
### Migration Strategy
|
|
577
935
|
|
|
578
|
-
|
|
579
|
-
|
|
936
|
+
```typescript
|
|
937
|
+
// Migration strategy implementation
|
|
938
|
+
export class MigrationStrategy {
|
|
939
|
+
static async executeMigration(fromVersion: string, toVersion: string) {
|
|
940
|
+
console.log(`Starting migration from ${fromVersion} to ${toVersion}`);
|
|
941
|
+
|
|
942
|
+
// 1. Pre-migration checks
|
|
943
|
+
const preChecks = await this.performPreChecks();
|
|
944
|
+
if (!preChecks.success) {
|
|
945
|
+
throw new Error(`Pre-migration checks failed: ${preChecks.errors.join(', ')}`);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// 2. Backup current state
|
|
949
|
+
const backup = await this.createBackup();
|
|
950
|
+
console.log('Backup created:', backup.location);
|
|
951
|
+
|
|
952
|
+
// 3. Update dependencies
|
|
953
|
+
await this.updateDependencies(toVersion);
|
|
954
|
+
|
|
955
|
+
// 4. Migrate configuration
|
|
956
|
+
await this.migrateConfiguration();
|
|
957
|
+
|
|
958
|
+
// 5. Migrate code
|
|
959
|
+
await this.migrateCode();
|
|
960
|
+
|
|
961
|
+
// 6. Migrate data
|
|
962
|
+
await this.migrateData();
|
|
963
|
+
|
|
964
|
+
// 7. Post-migration validation
|
|
965
|
+
const validation = await this.validateMigration();
|
|
966
|
+
if (!validation.success) {
|
|
967
|
+
console.error('Migration validation failed:', validation.errors);
|
|
968
|
+
await this.rollback(backup);
|
|
969
|
+
throw new Error('Migration failed validation');
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
console.log('Migration completed successfully');
|
|
973
|
+
return { success: true, backup };
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
static async performPreChecks() {
|
|
977
|
+
const checks = [
|
|
978
|
+
this.checkDependencies(),
|
|
979
|
+
this.checkConfiguration(),
|
|
980
|
+
this.checkDataIntegrity(),
|
|
981
|
+
];
|
|
982
|
+
|
|
983
|
+
const results = await Promise.all(checks);
|
|
984
|
+
const errors = results.flatMap(r => r.errors || []);
|
|
985
|
+
|
|
986
|
+
return {
|
|
987
|
+
success: errors.length === 0,
|
|
988
|
+
errors,
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
static async createBackup() {
|
|
993
|
+
// Implementation for creating backup
|
|
994
|
+
return {
|
|
995
|
+
location: '/backups/migration-backup-' + Date.now(),
|
|
996
|
+
timestamp: new Date().toISOString(),
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
static async rollback(backup: any) {
|
|
1001
|
+
console.log('Rolling back to backup:', backup.location);
|
|
1002
|
+
// Implementation for rollback
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
580
1005
|
```
|
|
581
1006
|
|
|
582
|
-
|
|
583
|
-
```tsx
|
|
584
|
-
// Always include organisation context
|
|
585
|
-
const canEdit = await hasPermission('update:users', {
|
|
586
|
-
organisationId: currentOrg.id
|
|
587
|
-
});
|
|
588
|
-
```
|
|
1007
|
+
### Rollback Strategy
|
|
589
1008
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
1009
|
+
```typescript
|
|
1010
|
+
// Rollback strategy implementation
|
|
1011
|
+
export class RollbackStrategy {
|
|
1012
|
+
static async rollbackMigration(backup: any) {
|
|
1013
|
+
console.log('Starting rollback process...');
|
|
1014
|
+
|
|
1015
|
+
try {
|
|
1016
|
+
// 1. Restore database
|
|
1017
|
+
await this.restoreDatabase(backup.database);
|
|
1018
|
+
|
|
1019
|
+
// 2. Restore configuration
|
|
1020
|
+
await this.restoreConfiguration(backup.config);
|
|
1021
|
+
|
|
1022
|
+
// 3. Restore code
|
|
1023
|
+
await this.restoreCode(backup.code);
|
|
1024
|
+
|
|
1025
|
+
// 4. Restore dependencies
|
|
1026
|
+
await this.restoreDependencies(backup.dependencies);
|
|
1027
|
+
|
|
1028
|
+
// 5. Validate rollback
|
|
1029
|
+
const validation = await this.validateRollback();
|
|
1030
|
+
|
|
1031
|
+
if (validation.success) {
|
|
1032
|
+
console.log('Rollback completed successfully');
|
|
1033
|
+
return { success: true };
|
|
1034
|
+
} else {
|
|
1035
|
+
throw new Error('Rollback validation failed');
|
|
1036
|
+
}
|
|
1037
|
+
} catch (error) {
|
|
1038
|
+
console.error('Rollback failed:', error);
|
|
1039
|
+
throw error;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
static async validateRollback() {
|
|
1044
|
+
// Implementation for rollback validation
|
|
1045
|
+
return { success: true };
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
595
1048
|
```
|
|
596
1049
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
**Problem:** Build fails after upgrade.
|
|
1050
|
+
## Emergency Rollback
|
|
600
1051
|
|
|
601
|
-
**Solutions:**
|
|
602
|
-
1. **Update peer dependencies:**
|
|
603
1052
|
```bash
|
|
604
|
-
|
|
605
|
-
npm install @
|
|
606
|
-
|
|
1053
|
+
# Rollback to previous version
|
|
1054
|
+
npm install @jmruthers/pace-core@0.4.16
|
|
1055
|
+
|
|
1056
|
+
# Or specific working version
|
|
1057
|
+
npm install @jmruthers/pace-core@0.4.15
|
|
1058
|
+
|
|
1059
|
+
# Clear caches
|
|
1060
|
+
rm -rf node_modules package-lock.json
|
|
1061
|
+
npm install
|
|
607
1062
|
```
|
|
608
1063
|
|
|
609
|
-
|
|
1064
|
+
## Getting Help
|
|
1065
|
+
|
|
1066
|
+
### If Migration Fails
|
|
1067
|
+
|
|
1068
|
+
1. **Check the logs** - Look for specific error messages
|
|
1069
|
+
2. **Revert changes** - Go back to working version
|
|
1070
|
+
3. **Check documentation** - Look for migration guides
|
|
1071
|
+
4. **Search issues** - Check GitHub issues
|
|
1072
|
+
5. **Ask for help** - Create detailed issue report
|
|
1073
|
+
|
|
1074
|
+
### Debug Information
|
|
1075
|
+
|
|
1076
|
+
When asking for help, include:
|
|
1077
|
+
|
|
610
1078
|
```bash
|
|
611
|
-
|
|
612
|
-
|
|
1079
|
+
# Version information
|
|
1080
|
+
npm list @jmruthers/pace-core
|
|
1081
|
+
node --version
|
|
1082
|
+
npm --version
|
|
613
1083
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
"moduleResolution": "node"
|
|
620
|
-
}
|
|
621
|
-
}
|
|
1084
|
+
# Build output
|
|
1085
|
+
npm run build 2>&1 | tee build.log
|
|
1086
|
+
|
|
1087
|
+
# Error details
|
|
1088
|
+
# Include full error messages and stack traces
|
|
622
1089
|
```
|
|
623
1090
|
|
|
624
|
-
##
|
|
1091
|
+
## Version History
|
|
1092
|
+
|
|
1093
|
+
### v0.5.54 (Latest)
|
|
1094
|
+
|
|
1095
|
+
**Changes:**
|
|
1096
|
+
- File reference system improvements
|
|
1097
|
+
- Enhanced error handling
|
|
1098
|
+
- Performance optimizations
|
|
1099
|
+
|
|
1100
|
+
**Migration:** No action required - fully backward compatible.
|
|
1101
|
+
|
|
1102
|
+
### v0.5.0 - v0.5.53
|
|
625
1103
|
|
|
626
|
-
|
|
1104
|
+
**New Features:**
|
|
1105
|
+
- File Upload & Storage System
|
|
1106
|
+
- Inactivity Tracking
|
|
1107
|
+
- Public Pages System
|
|
1108
|
+
- Organisation Security
|
|
627
1109
|
|
|
628
|
-
-
|
|
629
|
-
- [ ] Document current version
|
|
630
|
-
- [ ] Test current functionality
|
|
631
|
-
- [ ] Check for custom configurations
|
|
1110
|
+
**Migration:** No breaking changes - all features are additive.
|
|
632
1111
|
|
|
633
|
-
###
|
|
1112
|
+
### v0.4.17
|
|
1113
|
+
- ⚠️ Source path fixes for Tailwind scanning
|
|
634
1114
|
|
|
635
|
-
|
|
636
|
-
-
|
|
637
|
-
- [ ] Update component usage
|
|
638
|
-
- [ ] Update configuration files
|
|
639
|
-
- [ ] Run type checking
|
|
640
|
-
- [ ] Test build process
|
|
1115
|
+
### v0.4.16
|
|
1116
|
+
- ⚠️ CSS-first approach for Tailwind v4
|
|
641
1117
|
|
|
642
|
-
###
|
|
1118
|
+
### v0.4.15
|
|
1119
|
+
- ⚠️ Tailwind content scanning requirements
|
|
643
1120
|
|
|
644
|
-
|
|
645
|
-
- [ ] Verify styling
|
|
646
|
-
- [ ] Check authentication
|
|
647
|
-
- [ ] Test RBAC permissions
|
|
648
|
-
- [ ] Performance testing
|
|
649
|
-
- [ ] Update documentation
|
|
1121
|
+
## Checking for Breaking Changes
|
|
650
1122
|
|
|
651
|
-
|
|
1123
|
+
### Before Upgrading
|
|
652
1124
|
|
|
653
|
-
|
|
1125
|
+
1. **Check this file** for breaking changes in your target version
|
|
1126
|
+
2. **Review migration guides** for each breaking change
|
|
1127
|
+
3. **Test in development environment** before production
|
|
1128
|
+
4. **Update TypeScript** to catch type errors early
|
|
654
1129
|
|
|
655
|
-
|
|
656
|
-
- **[API Reference](../api-reference/)** - Complete API documentation
|
|
657
|
-
- **[Examples](../getting-started/examples/)** - Working code examples
|
|
658
|
-
- **[GitHub Issues](https://github.com/jmruthers/pace-core/issues)** - Bug reports
|
|
1130
|
+
### Finding Your Current Version
|
|
659
1131
|
|
|
660
|
-
|
|
1132
|
+
```bash
|
|
1133
|
+
npm list @jmruthers/pace-core
|
|
1134
|
+
```
|
|
661
1135
|
|
|
662
|
-
|
|
1136
|
+
Or check your `package.json`:
|
|
1137
|
+
```json
|
|
1138
|
+
{
|
|
1139
|
+
"dependencies": {
|
|
1140
|
+
"@jmruthers/pace-core": "^0.5.65"
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
```
|
|
663
1144
|
|
|
664
|
-
|
|
665
|
-
2. **Review troubleshooting section** for common issues
|
|
666
|
-
3. **Test with minimal example** to isolate problems
|
|
667
|
-
4. **Check GitHub issues** for similar problems
|
|
668
|
-
5. **Create new issue** with detailed information
|
|
1145
|
+
## Staying Updated
|
|
669
1146
|
|
|
670
|
-
|
|
1147
|
+
To stay informed about breaking changes:
|
|
671
1148
|
|
|
672
|
-
- **
|
|
673
|
-
- **
|
|
674
|
-
- **
|
|
675
|
-
- **
|
|
1149
|
+
- 📢 **Check this file** before each upgrade
|
|
1150
|
+
- 📢 **Review release notes** on GitHub
|
|
1151
|
+
- 📢 **Subscribe to notifications** for major versions
|
|
1152
|
+
- 📢 **Follow migration guides** step-by-step
|
|
676
1153
|
|
|
677
|
-
|
|
1154
|
+
---
|
|
678
1155
|
|
|
679
|
-
|
|
1156
|
+
**Remember**: Always test breaking changes in a development environment before deploying to production.
|
|
680
1157
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
- **[API Reference](../api-reference/)** - Complete documentation
|
|
1158
|
+
**Last Updated**: January 2025
|
|
1159
|
+
**Current Stable Version**: v0.5.65+
|
|
1160
|
+
**Next Major Version**: v1.0.0 (TBD)
|