@jmruthers/pace-core 0.5.193 → 0.6.2
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 +62 -0
- package/README.md +7 -1
- package/cursor-rules/00-pace-core-compliance.mdc +299 -0
- package/cursor-rules/01-standards-compliance.mdc +244 -0
- package/cursor-rules/02-project-structure.mdc +200 -0
- package/cursor-rules/03-solid-principles.mdc +222 -0
- package/cursor-rules/04-testing-standards.mdc +268 -0
- package/cursor-rules/05-bug-reports-and-features.mdc +246 -0
- package/cursor-rules/06-code-quality.mdc +309 -0
- package/cursor-rules/07-tech-stack-compliance.mdc +214 -0
- package/cursor-rules/08-markup-quality.mdc +452 -0
- package/cursor-rules/CHANGELOG.md +119 -0
- package/cursor-rules/README.md +192 -0
- package/dist/{AuthService-DjnJHDtC.d.ts → AuthService-BPvc3Ka0.d.ts} +54 -0
- package/dist/{DataTable-Be6dH_dR.d.ts → DataTable-BMRU8a1j.d.ts} +34 -2
- package/dist/{DataTable-5FU7IESH.js → DataTable-TPTKCX4D.js} +10 -9
- package/dist/{PublicPageProvider-C0Sm_e5k.d.ts → PublicPageProvider-DC6kCaqf.d.ts} +385 -261
- package/dist/{UnifiedAuthProvider-RGJTDE2C.js → UnifiedAuthProvider-CH6Z342H.js} +3 -3
- package/dist/{UnifiedAuthProvider-185Ih4dj.d.ts → UnifiedAuthProvider-CVcTjx-d.d.ts} +29 -0
- package/dist/{api-N774RPUA.js → api-MVVQZLJI.js} +2 -2
- package/dist/{chunk-KNC55RTG.js → chunk-24UVZUZG.js} +90 -54
- package/dist/chunk-24UVZUZG.js.map +1 -0
- package/dist/{chunk-HWIIPPNI.js → chunk-2UOI2FG5.js} +20 -20
- package/dist/chunk-2UOI2FG5.js.map +1 -0
- package/dist/{chunk-E3SPN4VZ 5.js → chunk-3XC4CPTD.js} +4345 -3986
- package/dist/chunk-3XC4CPTD.js.map +1 -0
- package/dist/{chunk-7EQTDTTJ.js → chunk-6J4GEEJR.js} +172 -45
- package/dist/chunk-6J4GEEJR.js.map +1 -0
- package/dist/{chunk-6C4YBBJM 5.js → chunk-6SOIHG6Z.js} +1 -1
- package/dist/chunk-6SOIHG6Z.js.map +1 -0
- package/dist/{chunk-7FLMSG37.js → chunk-EHMR7VYL.js} +25 -25
- package/dist/chunk-EHMR7VYL.js.map +1 -0
- package/dist/{chunk-I7PSE6JW.js → chunk-F2IMUDXZ.js} +2 -75
- package/dist/chunk-F2IMUDXZ.js.map +1 -0
- package/dist/{chunk-QWWZ5CAQ.js → chunk-FFQEQTNW.js} +7 -9
- package/dist/chunk-FFQEQTNW.js.map +1 -0
- package/dist/chunk-FMUCXFII.js +76 -0
- package/dist/chunk-FMUCXFII.js.map +1 -0
- package/dist/{chunk-HW3OVDUF.js → chunk-J36DSWQK.js} +1 -1
- package/dist/{chunk-HW3OVDUF.js.map → chunk-J36DSWQK.js.map} +1 -1
- package/dist/{chunk-SQGMNID3.js → chunk-L4OXEN46.js} +4 -5
- package/dist/chunk-L4OXEN46.js.map +1 -0
- package/dist/{chunk-R77UEZ4E 3.js → chunk-M43Y4SSO.js} +1 -1
- package/dist/chunk-M43Y4SSO.js.map +1 -0
- package/dist/{chunk-IIELH4DL.js → chunk-MMZ7JXPU.js} +60 -223
- package/dist/chunk-MMZ7JXPU.js.map +1 -0
- package/dist/{chunk-NOAYCWCX 5.js → chunk-NECFR5MM.js} +394 -312
- package/dist/chunk-NECFR5MM.js.map +1 -0
- package/dist/{chunk-BC4IJKSL.js → chunk-SFZUDBL5.js} +40 -4
- package/dist/chunk-SFZUDBL5.js.map +1 -0
- package/dist/{chunk-XNXXZ43G.js → chunk-XWQCNGTQ.js} +748 -364
- package/dist/chunk-XWQCNGTQ.js.map +1 -0
- package/dist/components.d.ts +6 -6
- package/dist/components.js +15 -12
- package/dist/components.js.map +1 -1
- package/dist/{functions-D_kgHktt.d.ts → functions-DHebl8-F.d.ts} +1 -1
- package/dist/hooks.d.ts +59 -126
- package/dist/hooks.js +19 -28
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +63 -16
- package/dist/index.js +23 -24
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +21 -3
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +146 -115
- package/dist/rbac/index.js +8 -11
- package/dist/theming/runtime.d.ts +1 -13
- package/dist/theming/runtime.js +1 -1
- package/dist/{timezone-_pgH8qrY.d.ts → timezone-CHhWg6b4.d.ts} +3 -10
- package/dist/{types-UU913iLA.d.ts → types-BeoeWV5I.d.ts} +8 -0
- package/dist/{types-CEpcvwwF.d.ts → types-CkbwOr4Y.d.ts} +6 -0
- package/dist/types.d.ts +2 -2
- package/dist/{usePublicRouteParams-TZe0gy-4.d.ts → usePublicRouteParams-1oMokgLF.d.ts} +34 -4
- package/dist/{useToast-C8gR5ir4.d.ts → useToast-AyaT-x7p.d.ts} +2 -2
- package/dist/utils.d.ts +4 -5
- package/dist/utils.js +15 -15
- package/dist/utils.js.map +1 -1
- package/docs/api/README.md +7 -1
- package/docs/api/classes/ColumnFactory.md +8 -8
- package/docs/api/classes/InvalidScopeError.md +4 -4
- package/docs/api/classes/Logger.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +4 -4
- package/docs/api/classes/OrganisationContextRequiredError.md +4 -4
- package/docs/api/classes/PermissionDeniedError.md +4 -4
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +4 -4
- package/docs/api/classes/RBACNotInitializedError.md +4 -4
- package/docs/api/classes/SecureSupabaseClient.md +18 -15
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +1 -1
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AddressFieldProps.md +1 -1
- package/docs/api/interfaces/AddressFieldRef.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +4 -4
- package/docs/api/interfaces/AutocompleteOptions.md +1 -1
- package/docs/api/interfaces/AvatarProps.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +9 -2
- package/docs/api/interfaces/ButtonProps.md +7 -4
- package/docs/api/interfaces/CalendarProps.md +8 -5
- package/docs/api/interfaces/CardProps.md +8 -5
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/ComplianceResult.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +9 -9
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +24 -21
- package/docs/api/interfaces/DataTableColumn.md +31 -31
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
- package/docs/api/interfaces/DatabaseIssue.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/ErrorBoundaryProps.md +147 -0
- package/docs/api/interfaces/ErrorBoundaryProviderProps.md +36 -0
- package/docs/api/interfaces/ErrorBoundaryState.md +75 -0
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +8 -8
- 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 +26 -23
- package/docs/api/interfaces/FooterProps.md +10 -8
- package/docs/api/interfaces/FormFieldProps.md +10 -10
- package/docs/api/interfaces/FormProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +7 -4
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoggerConfig.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +14 -11
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +11 -11
- package/docs/api/interfaces/NavigationMenuProps.md +15 -15
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- 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 +30 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +6 -4
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/ParsedAddress.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +7 -26
- package/docs/api/interfaces/PublicPageFooterProps.md +9 -9
- package/docs/api/interfaces/PublicPageHeaderProps.md +10 -10
- package/docs/api/interfaces/PublicPageLayoutProps.md +7 -20
- package/docs/api/interfaces/QuickFix.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +9 -9
- package/docs/api/interfaces/SecureDataProviderProps.md +8 -8
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +3 -3
- package/docs/api/interfaces/SetupIssue.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/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +3 -3
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +4 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +58 -55
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +15 -13
- package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
- package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +11 -9
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +8 -8
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +6 -6
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +9 -6
- package/docs/api/interfaces/UsePublicEventOptions.md +3 -3
- package/docs/api/interfaces/UsePublicEventReturn.md +8 -5
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +4 -4
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +12 -9
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +10 -7
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +14 -11
- package/docs/api/interfaces/UserMenuProps.md +8 -6
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +575 -634
- package/docs/architecture/database-schema-requirements.md +161 -0
- package/docs/core-concepts/rbac-system.md +3 -3
- package/docs/documentation-index.md +2 -4
- package/docs/getting-started/cursor-rules.md +263 -0
- package/docs/getting-started/installation-guide.md +6 -1
- package/docs/getting-started/quick-start.md +6 -1
- package/docs/migration/DOCUMENTATION_STRUCTURE.md +441 -0
- package/docs/migration/MIGRATION_GUIDE.md +6 -28
- package/docs/migration/README.md +52 -6
- package/docs/migration/V0.5.190_TO_V0.6.1_MIGRATION.md +1153 -0
- package/docs/migration/V0.6.0_REACT_19_MIGRATION.md +227 -0
- package/docs/migration/database-changes-december-2025.md +3 -3
- package/docs/rbac/event-based-apps.md +1 -1
- package/docs/rbac/getting-started.md +1 -1
- package/docs/rbac/quick-start.md +1 -1
- package/docs/standards/README.md +40 -0
- package/docs/troubleshooting/migration.md +4 -4
- package/examples/PublicPages/PublicEventPage.tsx +1 -1
- package/package.json +12 -6
- package/scripts/audit/core/checks/accessibility.cjs +197 -0
- package/scripts/audit/core/checks/api-usage.cjs +191 -0
- package/scripts/audit/core/checks/bundle.cjs +142 -0
- package/scripts/{check-pace-core-compliance.cjs → audit/core/checks/compliance.cjs} +737 -691
- package/scripts/audit/core/checks/config.cjs +54 -0
- package/scripts/audit/core/checks/coverage.cjs +84 -0
- package/scripts/audit/core/checks/dependencies.cjs +454 -0
- package/scripts/audit/core/checks/documentation.cjs +203 -0
- package/scripts/audit/core/checks/environment.cjs +128 -0
- package/scripts/audit/core/checks/error-handling.cjs +299 -0
- package/scripts/audit/core/checks/forms.cjs +172 -0
- package/scripts/audit/core/checks/heuristics.cjs +68 -0
- package/scripts/audit/core/checks/hooks.cjs +334 -0
- package/scripts/audit/core/checks/imports.cjs +244 -0
- package/scripts/audit/core/checks/performance.cjs +325 -0
- package/scripts/audit/core/checks/routes.cjs +117 -0
- package/scripts/audit/core/checks/state.cjs +130 -0
- package/scripts/audit/core/checks/structure.cjs +65 -0
- package/scripts/audit/core/checks/style.cjs +584 -0
- package/scripts/audit/core/checks/testing.cjs +122 -0
- package/scripts/audit/core/checks/typescript.cjs +61 -0
- package/scripts/audit/core/scanner.cjs +199 -0
- package/scripts/audit/core/utils.cjs +137 -0
- package/scripts/audit/index.cjs +223 -0
- package/scripts/audit/reporters/console.cjs +151 -0
- package/scripts/audit/reporters/json.cjs +54 -0
- package/scripts/audit/reporters/markdown.cjs +124 -0
- package/scripts/audit-consuming-app.cjs +86 -0
- package/scripts/build-docs/build-decision.js +240 -0
- package/scripts/build-docs/cache-utils.js +105 -0
- package/scripts/build-docs/content-normalization.js +150 -0
- package/scripts/build-docs/file-utils.js +105 -0
- package/scripts/build-docs/git-utils.js +86 -0
- package/scripts/build-docs/hash-utils.js +116 -0
- package/scripts/build-docs/typedoc-runner.js +220 -0
- package/scripts/build-docs-incremental.js +77 -913
- package/scripts/install-cursor-rules.cjs +236 -0
- package/scripts/utils/command-runner.js +16 -11
- package/scripts/validate-formats.js +61 -56
- package/scripts/validate-master.js +74 -69
- package/scripts/validate-pre-publish.js +70 -65
- package/src/__tests__/helpers/test-providers.tsx +1 -1
- package/src/__tests__/helpers/test-utils.tsx +1 -1
- package/src/__tests__/hooks/usePermissions.test.ts +2 -2
- package/src/components/Alert/Alert.test.tsx +12 -18
- package/src/components/Alert/Alert.tsx +5 -7
- package/src/components/Avatar/Avatar.test.tsx +4 -4
- package/src/components/Badge/Badge.tsx +16 -4
- package/src/components/Button/Button.tsx +27 -4
- package/src/components/Calendar/Calendar.tsx +9 -3
- package/src/components/Card/Card.tsx +4 -0
- package/src/components/Checkbox/Checkbox.test.tsx +12 -12
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/DataTable/DataTable.test.tsx +57 -93
- package/src/components/DataTable/DataTable.tsx +40 -6
- package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +5 -6
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +29 -7
- package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx +12 -12
- package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +2 -3
- package/src/components/DataTable/components/AccessDeniedPage.tsx +17 -26
- package/src/components/DataTable/components/ActionButtons.tsx +10 -7
- package/src/components/DataTable/components/BulkOperationsDropdown.tsx +2 -2
- package/src/components/DataTable/components/ColumnFilter.tsx +10 -0
- package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +12 -0
- package/src/components/DataTable/components/DataTableBody.tsx +8 -0
- package/src/components/DataTable/components/DataTableCore.tsx +200 -561
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +11 -0
- package/src/components/DataTable/components/DataTableLayout.tsx +559 -0
- package/src/components/DataTable/components/DataTableModals.tsx +9 -1
- package/src/components/DataTable/components/DataTableToolbar.tsx +8 -0
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +12 -0
- package/src/components/DataTable/components/EditFields.tsx +307 -0
- package/src/components/DataTable/components/EditableRow.tsx +9 -1
- package/src/components/DataTable/components/EmptyState.tsx +10 -0
- package/src/components/DataTable/components/FilterRow.tsx +12 -0
- package/src/components/DataTable/components/GroupHeader.tsx +12 -0
- package/src/components/DataTable/components/GroupingDropdown.tsx +12 -0
- package/src/components/DataTable/components/ImportModal.tsx +7 -0
- package/src/components/DataTable/components/LoadingState.tsx +6 -0
- package/src/components/DataTable/components/PaginationControls.tsx +16 -1
- package/src/components/DataTable/components/RowComponent.tsx +391 -0
- package/src/components/DataTable/components/UnifiedTableBody.tsx +62 -852
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +16 -4
- package/src/components/DataTable/components/__tests__/AccessDeniedPage.test.tsx +4 -2
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +23 -23
- package/src/components/DataTable/components/__tests__/EditableRow.test.tsx +11 -11
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +36 -36
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +27 -27
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +39 -39
- package/src/components/DataTable/components/__tests__/UnifiedTableBody.test.tsx +33 -33
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +29 -29
- package/src/components/DataTable/components/cellValueUtils.ts +40 -0
- package/src/components/DataTable/components/hooks/useImportModalFocus.ts +53 -0
- package/src/components/DataTable/components/hooks/usePermissionTracking.ts +126 -0
- package/src/components/DataTable/context/DataTableContext.tsx +50 -0
- package/src/components/DataTable/core/ColumnFactory.ts +31 -0
- package/src/components/DataTable/core/DataTableContext.tsx +32 -1
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +10 -0
- package/src/components/DataTable/hooks/useColumnReordering.ts +14 -2
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +10 -0
- package/src/components/DataTable/hooks/useDataTableDataPipeline.ts +16 -0
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +124 -32
- package/src/components/DataTable/hooks/useDataTableState.ts +35 -1
- package/src/components/DataTable/hooks/useEffectiveColumnOrder.ts +12 -0
- package/src/components/DataTable/hooks/useKeyboardNavigation.ts +2 -2
- package/src/components/DataTable/hooks/useServerSideDataEffect.ts +11 -0
- package/src/components/DataTable/hooks/useTableColumns.ts +8 -0
- package/src/components/DataTable/hooks/useTableHandlers.ts +14 -0
- package/src/components/DataTable/styles.ts +6 -6
- package/src/components/DataTable/types.ts +6 -10
- package/src/components/DataTable/utils/a11yUtils.ts +7 -0
- package/src/components/DataTable/utils/debugTools.ts +18 -113
- package/src/components/DataTable/utils/errorHandling.ts +12 -0
- package/src/components/DataTable/utils/exportUtils.ts +9 -0
- package/src/components/DataTable/utils/flexibleImport.ts +12 -48
- package/src/components/DataTable/utils/paginationUtils.ts +8 -0
- package/src/components/DataTable/utils/performanceUtils.ts +5 -1
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +8 -14
- package/src/components/Dialog/Dialog.tsx +8 -7
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +180 -1
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +46 -6
- package/src/components/ErrorBoundary/ErrorBoundaryContext.tsx +129 -0
- package/src/components/ErrorBoundary/index.ts +27 -2
- package/src/components/EventSelector/EventSelector.tsx +4 -1
- package/src/components/FileDisplay/FileDisplay.test.tsx +2 -2
- package/src/components/FileDisplay/FileDisplay.tsx +32 -18
- package/src/components/FileUpload/FileUpload.tsx +22 -2
- package/src/components/Footer/Footer.test.tsx +16 -16
- package/src/components/Footer/Footer.tsx +15 -12
- package/src/components/Form/Form.test.tsx +36 -15
- package/src/components/Form/Form.tsx +31 -26
- package/src/components/Header/Header.tsx +22 -11
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +40 -40
- package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +1 -1
- package/src/components/Input/Input.test.tsx +2 -2
- package/src/components/Input/Input.tsx +36 -34
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoadingSpinner/LoadingSpinner.test.tsx +4 -4
- package/src/components/LoadingSpinner/LoadingSpinner.tsx +1 -1
- package/src/components/LoginForm/LoginForm.test.tsx +42 -42
- package/src/components/LoginForm/LoginForm.tsx +12 -8
- package/src/components/NavigationMenu/NavigationMenu.tsx +15 -514
- package/src/components/NavigationMenu/types.ts +56 -0
- package/src/components/NavigationMenu/useNavigationFiltering.ts +390 -0
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +3 -0
- package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +1 -1
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +54 -52
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +33 -12
- package/src/components/PaceAppLayout/README.md +1 -1
- package/src/components/PaceAppLayout/test-setup.tsx +1 -2
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +4 -1
- package/src/components/PasswordChange/PasswordChangeForm.test.tsx +33 -33
- package/src/components/PasswordChange/PasswordChangeForm.tsx +10 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +3 -9
- package/src/components/PublicLayout/PublicPageLayout.tsx +3 -6
- package/src/components/PublicLayout/PublicPageProvider.tsx +4 -0
- package/src/components/Select/Select.tsx +95 -438
- package/src/components/Select/context.ts +23 -0
- package/src/components/Select/hooks/useSelectEvents.ts +87 -0
- package/src/components/Select/hooks/useSelectSearch.ts +91 -0
- package/src/components/Select/hooks/useSelectState.ts +104 -0
- package/src/components/Select/index.ts +9 -1
- package/src/components/Select/types.ts +123 -0
- package/src/components/Select/utils/text.ts +26 -0
- package/src/components/SessionRestorationLoader/SessionRestorationLoader.tsx +5 -6
- package/src/components/Switch/Switch.tsx +4 -4
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +27 -29
- package/src/components/Toast/Toast.tsx +5 -1
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/UserMenu/UserMenu.test.tsx +24 -11
- package/src/components/UserMenu/UserMenu.tsx +22 -19
- package/src/components/index.ts +2 -2
- package/src/hooks/__tests__/hooks.integration.test.tsx +80 -55
- package/src/hooks/__tests__/index.unit.test.ts +2 -5
- package/src/hooks/__tests__/useStorage.unit.test.ts +36 -36
- package/src/hooks/index.ts +1 -2
- package/src/hooks/public/usePublicEvent.ts +5 -1
- package/src/hooks/public/usePublicEventLogo.ts +5 -1
- package/src/hooks/public/usePublicFileDisplay.ts +4 -0
- package/src/hooks/public/usePublicRouteParams.ts +5 -1
- package/src/hooks/services/useAuth.ts +32 -0
- package/src/hooks/services/useCurrentEvent.ts +6 -0
- package/src/hooks/services/useCurrentOrganisation.ts +6 -0
- package/src/hooks/useDataTableState.ts +8 -18
- package/src/hooks/useDebounce.ts +9 -0
- package/src/hooks/useEventTheme.ts +6 -0
- package/src/hooks/useFileDisplay.ts +4 -0
- package/src/hooks/useFileReference.ts +25 -7
- package/src/hooks/useFileUrl.ts +11 -1
- package/src/hooks/useFocusManagement.ts +16 -2
- package/src/hooks/useFocusTrap.ts +7 -4
- package/src/hooks/useFormDialog.ts +8 -7
- package/src/hooks/useInactivityTracker.ts +4 -1
- package/src/hooks/useKeyboardShortcuts.ts +4 -0
- package/src/hooks/useOrganisationPermissions.ts +4 -0
- package/src/hooks/useOrganisationSecurity.ts +4 -0
- package/src/hooks/usePerformanceMonitor.ts +4 -0
- package/src/hooks/usePermissionCache.ts +8 -1
- package/src/hooks/useQueryCache.ts +12 -1
- package/src/hooks/useSessionRestoration.ts +4 -0
- package/src/hooks/useStorage.ts +4 -0
- package/src/hooks/useToast.ts +3 -3
- package/src/index.ts +2 -1
- package/src/providers/__tests__/OrganisationProvider.test.tsx +115 -49
- package/src/providers/__tests__/ProviderLifecycle.test.tsx +21 -6
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +10 -10
- package/src/providers/services/AuthServiceProvider.tsx +18 -0
- package/src/providers/services/EventServiceProvider.tsx +18 -0
- package/src/providers/services/InactivityServiceProvider.tsx +18 -0
- package/src/providers/services/OrganisationServiceProvider.tsx +18 -0
- package/src/providers/services/UnifiedAuthProvider.tsx +58 -22
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +33 -7
- package/src/rbac/README.md +1 -1
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +26 -26
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +4 -5
- package/src/rbac/adapters.tsx +14 -5
- package/src/rbac/api.ts +100 -67
- package/src/rbac/components/EnhancedNavigationMenu.tsx +1 -1
- package/src/rbac/components/NavigationGuard.tsx +1 -1
- package/src/rbac/components/NavigationProvider.tsx +5 -2
- package/src/rbac/components/PagePermissionGuard.tsx +158 -18
- package/src/rbac/components/PagePermissionProvider.tsx +1 -1
- package/src/rbac/components/PermissionEnforcer.tsx +1 -1
- package/src/rbac/components/RoleBasedRouter.tsx +6 -2
- package/src/rbac/components/SecureDataProvider.test.tsx +84 -49
- package/src/rbac/components/SecureDataProvider.tsx +21 -6
- package/src/rbac/components/__tests__/PagePermissionGuard.race-condition.test.tsx +24 -14
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +7 -0
- package/src/rbac/components/__tests__/PagePermissionGuard.verification.test.tsx +14 -6
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +15 -4
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +148 -24
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +81 -15
- package/src/rbac/engine.ts +38 -14
- package/src/rbac/hooks/permissions/index.ts +7 -0
- package/src/rbac/hooks/permissions/useAccessLevel.ts +105 -0
- package/src/rbac/hooks/permissions/useCachedPermissions.ts +79 -0
- package/src/rbac/hooks/permissions/useCan.ts +347 -0
- package/src/rbac/hooks/permissions/useHasAllPermissions.ts +90 -0
- package/src/rbac/hooks/permissions/useHasAnyPermission.ts +90 -0
- package/src/rbac/hooks/permissions/useMultiplePermissions.ts +93 -0
- package/src/rbac/hooks/permissions/usePermissions.ts +253 -0
- package/src/rbac/hooks/useCan.test.ts +71 -64
- package/src/rbac/hooks/usePermissions.ts +14 -995
- package/src/rbac/hooks/useResourcePermissions.test.ts +54 -18
- package/src/rbac/hooks/useResourcePermissions.ts +14 -4
- package/src/rbac/hooks/useSecureSupabase.ts +33 -13
- package/src/rbac/permissions.ts +0 -30
- package/src/rbac/secureClient.ts +212 -61
- package/src/rbac/types.ts +8 -0
- package/src/theming/__tests__/parseEventColours.test.ts +6 -9
- package/src/theming/parseEventColours.ts +5 -19
- package/src/types/vitest-globals.d.ts +51 -26
- package/src/utils/__mocks__/supabaseMock.ts +1 -3
- package/src/utils/__tests__/formatting.unit.test.ts +4 -4
- package/src/utils/__tests__/index.unit.test.ts +2 -2
- package/src/utils/audit/audit.ts +0 -3
- package/src/utils/core/cn.ts +1 -1
- package/src/utils/file-reference/index.ts +53 -1
- package/src/utils/formatting/formatting.ts +8 -18
- package/src/utils/index.ts +0 -1
- package/src/utils/security/secureDataAccess.test.ts +31 -20
- package/src/utils/security/secureDataAccess.ts +4 -3
- package/dist/chunk-6C4YBBJM.js +0 -628
- package/dist/chunk-6C4YBBJM.js.map +0 -1
- package/dist/chunk-7D4SUZUM.js 2.map +0 -1
- package/dist/chunk-7EQTDTTJ.js 2.map +0 -1
- package/dist/chunk-7EQTDTTJ.js.map +0 -1
- package/dist/chunk-7FLMSG37.js 2.map +0 -1
- package/dist/chunk-7FLMSG37.js.map +0 -1
- package/dist/chunk-BC4IJKSL.js.map +0 -1
- package/dist/chunk-E3SPN4VZ.js +0 -12917
- package/dist/chunk-E3SPN4VZ.js.map +0 -1
- package/dist/chunk-E66EQZE6 5.js +0 -37
- package/dist/chunk-E66EQZE6.js 2.map +0 -1
- package/dist/chunk-HWIIPPNI.js.map +0 -1
- package/dist/chunk-I7PSE6JW 5.js +0 -191
- package/dist/chunk-I7PSE6JW.js 2.map +0 -1
- package/dist/chunk-I7PSE6JW.js.map +0 -1
- package/dist/chunk-IIELH4DL.js.map +0 -1
- package/dist/chunk-KNC55RTG.js 5.map +0 -1
- package/dist/chunk-KNC55RTG.js.map +0 -1
- package/dist/chunk-KQCRWDSA.js 5.map +0 -1
- package/dist/chunk-LFNCN2SP.js +0 -412
- package/dist/chunk-LFNCN2SP.js 2.map +0 -1
- package/dist/chunk-LFNCN2SP.js.map +0 -1
- package/dist/chunk-LMC26NLJ 2.js +0 -84
- package/dist/chunk-NOAYCWCX.js +0 -4993
- package/dist/chunk-NOAYCWCX.js.map +0 -1
- package/dist/chunk-QWWZ5CAQ.js 3.map +0 -1
- package/dist/chunk-QWWZ5CAQ.js.map +0 -1
- package/dist/chunk-QXHPKYJV 3.js +0 -113
- package/dist/chunk-R77UEZ4E.js +0 -68
- package/dist/chunk-R77UEZ4E.js.map +0 -1
- package/dist/chunk-SQGMNID3.js.map +0 -1
- package/dist/chunk-VBXEHIUJ.js 6.map +0 -1
- package/dist/chunk-XNXXZ43G.js.map +0 -1
- package/dist/chunk-ZSAAAMVR 6.js +0 -25
- package/dist/components.js 5.map +0 -1
- package/dist/styles/index 2.js +0 -12
- package/dist/styles/index.js 5.map +0 -1
- package/dist/theming/runtime 5.js +0 -19
- package/dist/theming/runtime.js 5.map +0 -1
- package/docs/api/classes/ErrorBoundary.md +0 -144
- package/docs/migration/quick-migration-guide.md +0 -356
- package/docs/migration/service-architecture.md +0 -281
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +0 -680
- package/src/hooks/useSecureDataAccess.test.ts +0 -559
- package/src/hooks/useSecureDataAccess.ts +0 -666
- /package/dist/{DataTable-5FU7IESH.js.map → DataTable-TPTKCX4D.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-RGJTDE2C.js.map → UnifiedAuthProvider-CH6Z342H.js.map} +0 -0
- /package/dist/{api-N774RPUA.js.map → api-MVVQZLJI.js.map} +0 -0
- /package/docs/migration/{organisation-context-timing-fix.md → V0.3.44_organisation-context-timing-fix.md} +0 -0
- /package/docs/migration/{rbac-migration.md → V0.4.0_rbac-migration.md} +0 -0
- /package/docs/migration/{person-scoped-profiles-migration-guide.md → V0.5.190_person-scoped-profiles-migration-guide.md} +0 -0
- /package/examples/{rbac → RBAC}/CompleteRBACExample.tsx +0 -0
- /package/examples/{rbac → RBAC}/EventBasedApp.tsx +0 -0
- /package/examples/{rbac → RBAC}/PermissionExample.tsx +0 -0
- /package/examples/{rbac → RBAC}/index.ts +0 -0
|
@@ -0,0 +1,1153 @@
|
|
|
1
|
+
# Migration Guide: v0.5.190 → v0.6.1
|
|
2
|
+
|
|
3
|
+
**Version:** 0.6.1
|
|
4
|
+
**Previous Version:** 0.5.190
|
|
5
|
+
**Migration Date:** January 2025
|
|
6
|
+
**Breaking Changes:** Yes
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This comprehensive migration guide covers all changes between pace-core v0.5.190 and v0.6.1. This upgrade includes major breaking changes including React 19 upgrade, database schema changes, and new features.
|
|
11
|
+
|
|
12
|
+
**⚠️ CRITICAL**: This migration requires:
|
|
13
|
+
1. React 19 upgrade (breaking)
|
|
14
|
+
2. Database migrations (breaking)
|
|
15
|
+
3. Code updates for table name changes (breaking)
|
|
16
|
+
4. TypeScript type regeneration
|
|
17
|
+
|
|
18
|
+
**Estimated Migration Time:** 2-4 hours depending on codebase size
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Table of Contents
|
|
23
|
+
|
|
24
|
+
1. [Quick Start Checklist](#quick-start-checklist)
|
|
25
|
+
2. [Breaking Changes](#breaking-changes)
|
|
26
|
+
- [React 19 Upgrade](#1-react-19-upgrade-breaking)
|
|
27
|
+
- [Database Schema Changes](#2-database-schema-changes-breaking)
|
|
28
|
+
- [Table Naming Standardization](#21-table-naming-standardization)
|
|
29
|
+
- [Person-Scoped Profiles Migration](#22-person-scoped-profiles-migration)
|
|
30
|
+
3. [New Features](#new-features)
|
|
31
|
+
- [useFormDialog Hook](#useformdialog-hook)
|
|
32
|
+
- [DateTimeField Component](#datetimefield-component)
|
|
33
|
+
- [DatePickerWithTimezone Component](#datepickerwithtimezone-component)
|
|
34
|
+
- [Timezone Utilities](#timezone-utilities)
|
|
35
|
+
- [Location Utilities](#location-utilities)
|
|
36
|
+
4. [Step-by-Step Migration](#step-by-step-migration)
|
|
37
|
+
5. [Code Examples](#code-examples)
|
|
38
|
+
6. [Testing Checklist](#testing-checklist)
|
|
39
|
+
7. [Troubleshooting](#troubleshooting)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Quick Start Checklist
|
|
44
|
+
|
|
45
|
+
Use this checklist to track your migration progress:
|
|
46
|
+
|
|
47
|
+
### Pre-Migration
|
|
48
|
+
- [ ] Backup your project and database
|
|
49
|
+
- [ ] Review this entire migration guide
|
|
50
|
+
- [ ] Identify all database queries in your codebase
|
|
51
|
+
- [ ] Identify all React component patterns that may need updates
|
|
52
|
+
- [ ] Test current version in development environment
|
|
53
|
+
|
|
54
|
+
### Phase 1: Dependencies
|
|
55
|
+
- [ ] Upgrade React to 19.2.3+
|
|
56
|
+
- [ ] Upgrade React DOM to 19.2.3+
|
|
57
|
+
- [ ] Upgrade @types/react to 19.2.7+
|
|
58
|
+
- [ ] Upgrade @types/react-dom to 19.2.3+
|
|
59
|
+
- [ ] Upgrade @vitejs/plugin-react to 5.1.2+
|
|
60
|
+
- [ ] Install babel-plugin-react-compiler (optional but recommended)
|
|
61
|
+
- [ ] Update pace-core to 0.6.1
|
|
62
|
+
|
|
63
|
+
### Phase 2: Database Migrations
|
|
64
|
+
- [ ] Apply person-scoped profiles migration (`20251205211120_migrate_profiles_to_person_scoped.sql`)
|
|
65
|
+
- [ ] Apply table naming standardization migration (`20251206111258_standardize_table_naming_app_entity.sql`)
|
|
66
|
+
- [ ] Verify all migrations applied successfully
|
|
67
|
+
- [ ] Regenerate TypeScript database types
|
|
68
|
+
|
|
69
|
+
### Phase 3: Code Updates
|
|
70
|
+
- [ ] Update all table name references (`organisations` → `core_organisations`, etc.)
|
|
71
|
+
- [ ] Remove `organisation_id` filters from profile table queries
|
|
72
|
+
- [ ] Update `pace_contact` queries to use `person_id` instead of `member_id`
|
|
73
|
+
- [ ] Update React component code for React 19 compatibility
|
|
74
|
+
- [ ] Configure React Compiler in vite.config.ts
|
|
75
|
+
- [ ] Fix TypeScript errors
|
|
76
|
+
|
|
77
|
+
### Phase 4: Testing
|
|
78
|
+
- [ ] Run type checking (`npm run type-check`)
|
|
79
|
+
- [ ] Run build (`npm run build`)
|
|
80
|
+
- [ ] Test all database queries
|
|
81
|
+
- [ ] Test authentication flows
|
|
82
|
+
- [ ] Test profile management
|
|
83
|
+
- [ ] Test file uploads
|
|
84
|
+
- [ ] Test navigation and permissions
|
|
85
|
+
- [ ] Test cross-organisation scenarios
|
|
86
|
+
- [ ] Run full test suite
|
|
87
|
+
|
|
88
|
+
### Phase 5: Deployment
|
|
89
|
+
- [ ] Deploy to staging environment
|
|
90
|
+
- [ ] Perform full regression testing
|
|
91
|
+
- [ ] Deploy to production
|
|
92
|
+
- [ ] Monitor for errors
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Breaking Changes
|
|
97
|
+
|
|
98
|
+
### 1. React 19 Upgrade (BREAKING)
|
|
99
|
+
|
|
100
|
+
**Impact:** High - All consuming apps must upgrade to React 19
|
|
101
|
+
|
|
102
|
+
#### What Changed
|
|
103
|
+
|
|
104
|
+
- **React**: `^18.3.1` → `^19.2.3`
|
|
105
|
+
- **React DOM**: `^18.3.1` → `^19.2.3`
|
|
106
|
+
- **@types/react**: `^18.3.17` → `^19.2.7`
|
|
107
|
+
- **@types/react-dom**: `^18.3.5` → `^19.2.3`
|
|
108
|
+
- **@vitejs/plugin-react**: `^4.5.1` → `^5.1.2`
|
|
109
|
+
- **React Compiler**: Added `babel-plugin-react-compiler@^1.0.0` (optional but recommended)
|
|
110
|
+
|
|
111
|
+
#### Quick Summary
|
|
112
|
+
|
|
113
|
+
- All consuming apps must upgrade to React 19.2.3+
|
|
114
|
+
- React Compiler should be configured for optimal performance
|
|
115
|
+
- TypeScript types are stricter, especially for `child.props` access
|
|
116
|
+
- Error handling behavior has changed
|
|
117
|
+
|
|
118
|
+
**📖 For complete React 19 migration instructions, see:** [React 19 Migration Guide](./V0.6.0_REACT_19_MIGRATION.md)
|
|
119
|
+
|
|
120
|
+
The dedicated React 19 migration guide includes:
|
|
121
|
+
- Step-by-step dependency updates
|
|
122
|
+
- Vite configuration changes
|
|
123
|
+
- TypeScript type updates
|
|
124
|
+
- React Compiler setup
|
|
125
|
+
- Troubleshooting common issues
|
|
126
|
+
- Testing checklist
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 2. Database Schema Changes (BREAKING)
|
|
131
|
+
|
|
132
|
+
**Impact:** High - All database queries must be updated
|
|
133
|
+
|
|
134
|
+
There are two major database schema changes that affect consuming applications:
|
|
135
|
+
|
|
136
|
+
#### 2.1. Table Naming Standardization
|
|
137
|
+
|
|
138
|
+
**Migration:** `20251206111258_standardize_table_naming_app_entity.sql`
|
|
139
|
+
**Date:** 2025-12-06
|
|
140
|
+
|
|
141
|
+
All tables have been renamed to follow the `app_entity` naming convention:
|
|
142
|
+
- **Core infrastructure tables** → `core_*` prefix
|
|
143
|
+
- **Application-specific tables** → `{app}_*` prefix (e.g., `cake_*`, `trac_*`, `medi_*`)
|
|
144
|
+
- **Shared PACE tables** → `core_*` prefix
|
|
145
|
+
|
|
146
|
+
##### Core Table Renames
|
|
147
|
+
|
|
148
|
+
| Old Name | New Name |
|
|
149
|
+
|----------|----------|
|
|
150
|
+
| `organisations` | `core_organisations` |
|
|
151
|
+
| `event` | `core_events` |
|
|
152
|
+
| `file_references` | `core_file_references` |
|
|
153
|
+
| `pace_person` | `core_person` |
|
|
154
|
+
| `pace_member` | `core_member` |
|
|
155
|
+
| `pace_contact` | `core_contact` |
|
|
156
|
+
| `pace_address` | `core_address` |
|
|
157
|
+
| `pace_phone` | `core_phone` |
|
|
158
|
+
| `pace_consent` | `core_consent` |
|
|
159
|
+
| `pace_identification` | `core_identification` |
|
|
160
|
+
| `pace_qualification` | `core_qualification` |
|
|
161
|
+
| All other `pace_*` tables | `core_*` |
|
|
162
|
+
|
|
163
|
+
##### View Changes
|
|
164
|
+
|
|
165
|
+
| Old Name | New Name | Notes |
|
|
166
|
+
|----------|----------|-------|
|
|
167
|
+
| `organisation_memberships` | **DROPPED** | Merged into `core_organisation_memberships` |
|
|
168
|
+
| `user_organisation_memberships` | **DROPPED** | Merged into `core_organisation_memberships` |
|
|
169
|
+
| - | `core_organisation_memberships` | **NEW** - Unified membership view |
|
|
170
|
+
|
|
171
|
+
##### Code Updates Required
|
|
172
|
+
|
|
173
|
+
**Before:**
|
|
174
|
+
```typescript
|
|
175
|
+
// ❌ This will fail - table name changed
|
|
176
|
+
const { data } = await supabase
|
|
177
|
+
.from('organisations')
|
|
178
|
+
.select('*');
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**After:**
|
|
182
|
+
```typescript
|
|
183
|
+
// ✅ Use new table name
|
|
184
|
+
const { data } = await supabase
|
|
185
|
+
.from('core_organisations')
|
|
186
|
+
.select('*');
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Before:**
|
|
190
|
+
```typescript
|
|
191
|
+
// ❌ This will fail - view dropped
|
|
192
|
+
const { data } = await supabase
|
|
193
|
+
.from('organisation_memberships')
|
|
194
|
+
.select('*')
|
|
195
|
+
.eq('organisation_id', orgId);
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**After:**
|
|
199
|
+
```typescript
|
|
200
|
+
// ✅ Use new unified view
|
|
201
|
+
const { data } = await supabase
|
|
202
|
+
.from('core_organisation_memberships')
|
|
203
|
+
.select('*')
|
|
204
|
+
.eq('organisation_id', orgId);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Before:**
|
|
208
|
+
```typescript
|
|
209
|
+
// ❌ This will fail - table names changed
|
|
210
|
+
const { data } = await supabase
|
|
211
|
+
.from('pace_person')
|
|
212
|
+
.select('*, pace_member(*), organisations(*)')
|
|
213
|
+
.eq('id', personId);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**After:**
|
|
217
|
+
```typescript
|
|
218
|
+
// ✅ Use new table names
|
|
219
|
+
const { data } = await supabase
|
|
220
|
+
.from('core_person')
|
|
221
|
+
.select('*, core_member(*), core_organisations(*)')
|
|
222
|
+
.eq('id', personId);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Before:**
|
|
226
|
+
```typescript
|
|
227
|
+
// ❌ This will fail - table name changed
|
|
228
|
+
const { data } = await supabase
|
|
229
|
+
.from('file_references')
|
|
230
|
+
.select('*')
|
|
231
|
+
.eq('table_name', 'pace_person')
|
|
232
|
+
.eq('record_id', personId);
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**After:**
|
|
236
|
+
```typescript
|
|
237
|
+
// ✅ Use new table names
|
|
238
|
+
const { data } = await supabase
|
|
239
|
+
.from('core_file_references')
|
|
240
|
+
.select('*')
|
|
241
|
+
.eq('table_name', 'core_person') // Also update table_name values
|
|
242
|
+
.eq('record_id', personId);
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Important**: The `table_name` column in `core_file_references` has been updated to use new table names. If you're querying by `table_name`, ensure you use the new names:
|
|
246
|
+
- `'pace_person'` → `'core_person'`
|
|
247
|
+
- `'event'` → `'core_events'`
|
|
248
|
+
- `'pace_member'` → `'core_member'`
|
|
249
|
+
- `'pace_contact'` → `'core_contact'`
|
|
250
|
+
- etc.
|
|
251
|
+
|
|
252
|
+
##### Search and Replace Strategy
|
|
253
|
+
|
|
254
|
+
Use your IDE's search and replace to update table names:
|
|
255
|
+
|
|
256
|
+
1. **Search for old table names:**
|
|
257
|
+
- `'organisations'` → `'core_organisations'`
|
|
258
|
+
- `'event'` → `'core_events'`
|
|
259
|
+
- `'pace_person'` → `'core_person'`
|
|
260
|
+
- `'pace_member'` → `'core_member'`
|
|
261
|
+
- `'pace_contact'` → `'core_contact'`
|
|
262
|
+
- etc.
|
|
263
|
+
|
|
264
|
+
2. **Update view references:**
|
|
265
|
+
- `'organisation_memberships'` → `'core_organisation_memberships'`
|
|
266
|
+
- `'user_organisation_memberships'` → `'core_organisation_memberships'`
|
|
267
|
+
|
|
268
|
+
3. **Update file reference table_name values:**
|
|
269
|
+
- `'pace_person'` → `'core_person'`
|
|
270
|
+
- `'event'` → `'core_events'`
|
|
271
|
+
- etc.
|
|
272
|
+
|
|
273
|
+
#### 2.2. Person-Scoped Profiles Migration
|
|
274
|
+
|
|
275
|
+
**Migration:** `20251205211120_migrate_profiles_to_person_scoped.sql` + related migrations
|
|
276
|
+
**Date:** 2025-12-05
|
|
277
|
+
|
|
278
|
+
Profiles have been migrated from **organisation-scoped** to **person-scoped**:
|
|
279
|
+
- **One membership profile** (`core_member`) per person (regardless of organisation)
|
|
280
|
+
- **One medical profile** (`medi_profile`) per person
|
|
281
|
+
- **Multiple contact profiles** (`core_contact`) per person
|
|
282
|
+
|
|
283
|
+
##### Key Changes
|
|
284
|
+
|
|
285
|
+
1. **Removed `organisation_id`** from:
|
|
286
|
+
- `core_member` (was `pace_member`)
|
|
287
|
+
- `medi_profile`
|
|
288
|
+
- `core_contact` (was `pace_contact`)
|
|
289
|
+
- Related tables: `medi_condition`, `medi_diet`, `medi_action_plan`, `core_consent`, `core_identification`, `core_qualification`
|
|
290
|
+
|
|
291
|
+
2. **Removed `member_id`** from `core_contact` (now uses `person_id` directly)
|
|
292
|
+
|
|
293
|
+
3. **Added unique constraint** on `core_member.person_id` (one membership per person)
|
|
294
|
+
|
|
295
|
+
##### Code Updates Required
|
|
296
|
+
|
|
297
|
+
**Before:**
|
|
298
|
+
```typescript
|
|
299
|
+
// ❌ This will fail - organisation_id column no longer exists
|
|
300
|
+
const { data } = await supabase
|
|
301
|
+
.from('pace_member')
|
|
302
|
+
.select('*')
|
|
303
|
+
.eq('person_id', personId)
|
|
304
|
+
.eq('organisation_id', orgId);
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**After:**
|
|
308
|
+
```typescript
|
|
309
|
+
// ✅ No organisation_id needed - one profile per person
|
|
310
|
+
const { data } = await supabase
|
|
311
|
+
.from('core_member')
|
|
312
|
+
.select('*')
|
|
313
|
+
.eq('person_id', personId);
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Before:**
|
|
317
|
+
```typescript
|
|
318
|
+
// ❌ This will fail - member_id column no longer exists
|
|
319
|
+
const { data } = await supabase
|
|
320
|
+
.from('pace_contact')
|
|
321
|
+
.select('*')
|
|
322
|
+
.eq('member_id', memberId);
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**After:**
|
|
326
|
+
```typescript
|
|
327
|
+
// ✅ Use person_id instead
|
|
328
|
+
const { data } = await supabase
|
|
329
|
+
.from('core_contact')
|
|
330
|
+
.select('*')
|
|
331
|
+
.eq('person_id', personId);
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Before:**
|
|
335
|
+
```typescript
|
|
336
|
+
// ❌ This will fail - organisation_id required
|
|
337
|
+
await supabase
|
|
338
|
+
.from('pace_member')
|
|
339
|
+
.insert({
|
|
340
|
+
person_id: personId,
|
|
341
|
+
organisation_id: orgId, // ❌ Column doesn't exist
|
|
342
|
+
membership_number: '12345'
|
|
343
|
+
});
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**After:**
|
|
347
|
+
```typescript
|
|
348
|
+
// ✅ No organisation_id needed
|
|
349
|
+
await supabase
|
|
350
|
+
.from('core_member')
|
|
351
|
+
.insert({
|
|
352
|
+
person_id: personId,
|
|
353
|
+
membership_number: '12345'
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
##### Getting Organisation Members
|
|
358
|
+
|
|
359
|
+
**Before:**
|
|
360
|
+
```typescript
|
|
361
|
+
// ❌ This pattern no longer works
|
|
362
|
+
const { data } = await supabase
|
|
363
|
+
.from('pace_member')
|
|
364
|
+
.select('*')
|
|
365
|
+
.eq('organisation_id', orgId);
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**After:**
|
|
369
|
+
```typescript
|
|
370
|
+
// ✅ Get members via organisation roles
|
|
371
|
+
const { data: orgMembers } = await supabase
|
|
372
|
+
.from('rbac_organisation_roles')
|
|
373
|
+
.select(`
|
|
374
|
+
organisation_id,
|
|
375
|
+
user_id,
|
|
376
|
+
core_person!inner(
|
|
377
|
+
id,
|
|
378
|
+
core_member(*)
|
|
379
|
+
)
|
|
380
|
+
`)
|
|
381
|
+
.eq('organisation_id', orgId)
|
|
382
|
+
.eq('status', 'active');
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**For detailed person-scoped profiles migration instructions, see:** [Person-Scoped Profiles Migration Guide](./V0.5.190_person-scoped-profiles-migration-guide.md)
|
|
386
|
+
|
|
387
|
+
**For detailed database changes, see:** [Database Changes December 2025](./database-changes-december-2025.md)
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## New Features
|
|
392
|
+
|
|
393
|
+
### useFormDialog Hook
|
|
394
|
+
|
|
395
|
+
**New in:** Unreleased (0.6.1)
|
|
396
|
+
|
|
397
|
+
Generic React hook for managing form dialog state (open/close, form data, reset behavior). Supports both controlled and uncontrolled usage patterns with type-safe form data management.
|
|
398
|
+
|
|
399
|
+
**Usage:**
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
import { useFormDialog } from '@jmruthers/pace-core';
|
|
403
|
+
|
|
404
|
+
function MyComponent() {
|
|
405
|
+
const formDialog = useFormDialog<FormData>({
|
|
406
|
+
defaultValues: { name: '', email: '' }
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
return (
|
|
410
|
+
<>
|
|
411
|
+
<Button onClick={() => formDialog.open()}>Open Form</Button>
|
|
412
|
+
<Dialog open={formDialog.isOpen} onOpenChange={formDialog.setOpen}>
|
|
413
|
+
<DialogContent>
|
|
414
|
+
<Form form={form} onSubmit={formDialog.handleSubmit}>
|
|
415
|
+
{/* Form fields */}
|
|
416
|
+
</Form>
|
|
417
|
+
</DialogContent>
|
|
418
|
+
</Dialog>
|
|
419
|
+
</>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### DateTimeField Component
|
|
425
|
+
|
|
426
|
+
**New in:** Unreleased (0.6.1)
|
|
427
|
+
|
|
428
|
+
Form input component for datetime values with automatic UTC ↔ timezone conversion.
|
|
429
|
+
|
|
430
|
+
**Features:**
|
|
431
|
+
- Supports both ISO string and Date object values
|
|
432
|
+
- Automatic timezone conversion
|
|
433
|
+
- Prevents unwanted conversions during user editing
|
|
434
|
+
- Shows timezone information when not UTC
|
|
435
|
+
- Accessible form field with proper labels
|
|
436
|
+
|
|
437
|
+
**Usage:**
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
import { DateTimeField, Form, useZodForm } from '@jmruthers/pace-core';
|
|
441
|
+
|
|
442
|
+
function MyForm() {
|
|
443
|
+
const form = useZodForm({
|
|
444
|
+
schema: z.object({
|
|
445
|
+
eventDate: z.string().datetime()
|
|
446
|
+
})
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
return (
|
|
450
|
+
<Form form={form}>
|
|
451
|
+
<FormField
|
|
452
|
+
control={form.control}
|
|
453
|
+
name="eventDate"
|
|
454
|
+
render={({ field }) => (
|
|
455
|
+
<DateTimeField
|
|
456
|
+
label="Event Date & Time"
|
|
457
|
+
value={field.value}
|
|
458
|
+
onChange={field.onChange}
|
|
459
|
+
timezone="America/New_York"
|
|
460
|
+
/>
|
|
461
|
+
)}
|
|
462
|
+
/>
|
|
463
|
+
</Form>
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### DatePickerWithTimezone Component
|
|
469
|
+
|
|
470
|
+
**New in:** Unreleased (0.6.1)
|
|
471
|
+
|
|
472
|
+
Date picker component with timezone information display.
|
|
473
|
+
|
|
474
|
+
**Features:**
|
|
475
|
+
- Calendar date selection with timezone context
|
|
476
|
+
- Shows "Local" when timezone matches user timezone
|
|
477
|
+
- Optional "Done" button
|
|
478
|
+
- Accessible date selection
|
|
479
|
+
|
|
480
|
+
**Usage:**
|
|
481
|
+
|
|
482
|
+
```tsx
|
|
483
|
+
import { DatePickerWithTimezone } from '@jmruthers/pace-core';
|
|
484
|
+
|
|
485
|
+
function MyComponent() {
|
|
486
|
+
const [date, setDate] = useState<Date | undefined>();
|
|
487
|
+
|
|
488
|
+
return (
|
|
489
|
+
<DatePickerWithTimezone
|
|
490
|
+
date={date}
|
|
491
|
+
onDateChange={setDate}
|
|
492
|
+
timezone="America/New_York"
|
|
493
|
+
showDoneButton
|
|
494
|
+
/>
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Timezone Utilities
|
|
500
|
+
|
|
501
|
+
**New in:** Unreleased (0.6.1)
|
|
502
|
+
|
|
503
|
+
Comprehensive timezone conversion and formatting utilities.
|
|
504
|
+
|
|
505
|
+
**Available Utilities:**
|
|
506
|
+
|
|
507
|
+
```tsx
|
|
508
|
+
import {
|
|
509
|
+
formatInTimeZone,
|
|
510
|
+
getTimezoneAbbreviation,
|
|
511
|
+
formatTimeInTimeZone,
|
|
512
|
+
getUserTimeZone,
|
|
513
|
+
toZonedTime,
|
|
514
|
+
fromZonedTime,
|
|
515
|
+
roundToNearestMinutes,
|
|
516
|
+
getTimeZoneDifference,
|
|
517
|
+
formatDateTimeForDisplay,
|
|
518
|
+
formatDateOnlyForDisplay,
|
|
519
|
+
formatDateTimeForTable,
|
|
520
|
+
formatDateTimeForMap
|
|
521
|
+
} from '@jmruthers/pace-core/utils/timezone';
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**Usage Examples:**
|
|
525
|
+
|
|
526
|
+
```tsx
|
|
527
|
+
import { formatInTimeZone, getUserTimeZone, toZonedTime } from '@jmruthers/pace-core/utils/timezone';
|
|
528
|
+
|
|
529
|
+
// Format date in specific timezone
|
|
530
|
+
const formatted = formatInTimeZone(
|
|
531
|
+
new Date(),
|
|
532
|
+
'America/New_York',
|
|
533
|
+
'MMM dd, yyyy HH:mm'
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
// Get user's timezone
|
|
537
|
+
const userTz = getUserTimeZone(); // e.g., "America/New_York"
|
|
538
|
+
|
|
539
|
+
// Convert UTC to timezone
|
|
540
|
+
const localTime = toZonedTime(new Date(), 'America/New_York');
|
|
541
|
+
|
|
542
|
+
// Format for display
|
|
543
|
+
const display = formatDateTimeForDisplay(
|
|
544
|
+
new Date().toISOString(),
|
|
545
|
+
'America/New_York'
|
|
546
|
+
);
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Location Utilities
|
|
550
|
+
|
|
551
|
+
**New in:** Unreleased (0.6.1)
|
|
552
|
+
|
|
553
|
+
Geographic coordinate handling utilities.
|
|
554
|
+
|
|
555
|
+
**Available Utilities:**
|
|
556
|
+
|
|
557
|
+
```tsx
|
|
558
|
+
import {
|
|
559
|
+
formatCoordinates,
|
|
560
|
+
hasValidCoordinates,
|
|
561
|
+
areCoordinatesEqual,
|
|
562
|
+
getGoogleMapsUrl
|
|
563
|
+
} from '@jmruthers/pace-core/utils/location';
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
**Usage Examples:**
|
|
567
|
+
|
|
568
|
+
```tsx
|
|
569
|
+
import { formatCoordinates, getGoogleMapsUrl } from '@jmruthers/pace-core/utils/location';
|
|
570
|
+
|
|
571
|
+
// Format coordinates
|
|
572
|
+
const formatted = formatCoordinates({ lat: 40.7128, lng: -74.0060 });
|
|
573
|
+
// Returns: "40.712800, -74.006000"
|
|
574
|
+
|
|
575
|
+
// Generate Google Maps URL
|
|
576
|
+
const mapsUrl = getGoogleMapsUrl({ lat: 40.7128, lng: -74.0060 });
|
|
577
|
+
// Returns: "https://www.google.com/maps/search/?api=1&query=40.712800,-74.006000"
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## Step-by-Step Migration
|
|
583
|
+
|
|
584
|
+
### Step 1: Backup Everything
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
# Backup your project
|
|
588
|
+
git commit -am "Pre-migration backup"
|
|
589
|
+
|
|
590
|
+
# Backup your database (if using Supabase CLI)
|
|
591
|
+
supabase db dump > backup.sql
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Step 2: Update Dependencies
|
|
595
|
+
|
|
596
|
+
**📖 For React 19 dependency updates, see [React 19 Migration Guide](./V0.6.0_REACT_19_MIGRATION.md#step-1-update-react-dependencies).**
|
|
597
|
+
|
|
598
|
+
```bash
|
|
599
|
+
# Update React and related dependencies (see React 19 guide for details)
|
|
600
|
+
npm install react@^19.2.3 react-dom@^19.2.3
|
|
601
|
+
npm install -D @types/react@^19.2.7 @types/react-dom@^19.2.3
|
|
602
|
+
npm install -D @vitejs/plugin-react@^5.1.2
|
|
603
|
+
npm install -D babel-plugin-react-compiler@latest
|
|
604
|
+
|
|
605
|
+
# Update pace-core
|
|
606
|
+
npm install @jmruthers/pace-core@0.6.1
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### Step 3: Apply Database Migrations
|
|
610
|
+
|
|
611
|
+
Apply the following migrations in order:
|
|
612
|
+
|
|
613
|
+
1. **Person-Scoped Profiles Migration:**
|
|
614
|
+
```bash
|
|
615
|
+
# Apply migration
|
|
616
|
+
supabase migration up 20251205211120_migrate_profiles_to_person_scoped
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
2. **Table Naming Standardization:**
|
|
620
|
+
```bash
|
|
621
|
+
# Apply migration
|
|
622
|
+
supabase migration up 20251206111258_standardize_table_naming_app_entity
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
**Note:** If you're using Supabase hosted, apply these migrations through the Supabase dashboard or CLI.
|
|
626
|
+
|
|
627
|
+
### Step 4: Regenerate TypeScript Types
|
|
628
|
+
|
|
629
|
+
```bash
|
|
630
|
+
# Regenerate database types
|
|
631
|
+
npx supabase gen types typescript --project-id <your-project-id> > src/types/database.generated.ts
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### Step 5: Update Vite Configuration for React 19
|
|
635
|
+
|
|
636
|
+
**📖 See [React 19 Migration Guide](./V0.6.0_REACT_19_MIGRATION.md#step-4-configure-react-compiler-in-vite) for detailed Vite configuration instructions.**
|
|
637
|
+
|
|
638
|
+
Quick summary: Update your `vite.config.ts` to include React Compiler configuration. The React 19 migration guide includes complete setup instructions.
|
|
639
|
+
|
|
640
|
+
### Step 6: Update Code
|
|
641
|
+
|
|
642
|
+
#### 6.1. Update Table Names
|
|
643
|
+
|
|
644
|
+
Search and replace all table name references:
|
|
645
|
+
|
|
646
|
+
```bash
|
|
647
|
+
# Use your IDE's search and replace or:
|
|
648
|
+
# Find: 'organisations'
|
|
649
|
+
# Replace: 'core_organisations'
|
|
650
|
+
|
|
651
|
+
# Find: 'event'
|
|
652
|
+
# Replace: 'core_events'
|
|
653
|
+
|
|
654
|
+
# Find: 'pace_person'
|
|
655
|
+
# Replace: 'core_person'
|
|
656
|
+
|
|
657
|
+
# Find: 'pace_member'
|
|
658
|
+
# Replace: 'core_member'
|
|
659
|
+
|
|
660
|
+
# Find: 'pace_contact'
|
|
661
|
+
# Replace: 'core_contact'
|
|
662
|
+
|
|
663
|
+
# Find: 'organisation_memberships'
|
|
664
|
+
# Replace: 'core_organisation_memberships'
|
|
665
|
+
|
|
666
|
+
# Find: 'user_organisation_memberships'
|
|
667
|
+
# Replace: 'core_organisation_memberships'
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
#### 6.2. Remove Organisation ID Filters
|
|
671
|
+
|
|
672
|
+
Search for and remove `organisation_id` filters from profile table queries:
|
|
673
|
+
|
|
674
|
+
```typescript
|
|
675
|
+
// Find patterns like:
|
|
676
|
+
.eq('organisation_id', orgId)
|
|
677
|
+
|
|
678
|
+
// In queries to:
|
|
679
|
+
// - core_member
|
|
680
|
+
// - medi_profile
|
|
681
|
+
// - core_contact
|
|
682
|
+
// - core_consent
|
|
683
|
+
// - core_identification
|
|
684
|
+
// - core_qualification
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
#### 6.3. Update Contact Queries
|
|
688
|
+
|
|
689
|
+
Update `pace_contact` queries to use `person_id` instead of `member_id`:
|
|
690
|
+
|
|
691
|
+
```typescript
|
|
692
|
+
// Find:
|
|
693
|
+
.eq('member_id', memberId)
|
|
694
|
+
|
|
695
|
+
// Replace with:
|
|
696
|
+
.eq('person_id', personId)
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
#### 6.4. Update React Component Code for React 19
|
|
700
|
+
|
|
701
|
+
**📖 See [React 19 Migration Guide](./V0.6.0_REACT_19_MIGRATION.md#step-5-update-typescript-types) for detailed React 19 TypeScript updates.**
|
|
702
|
+
|
|
703
|
+
If you have components that access `child.props`, you'll need to add type assertions. The React 19 migration guide includes complete examples and patterns.
|
|
704
|
+
|
|
705
|
+
### Step 7: Fix TypeScript Errors
|
|
706
|
+
|
|
707
|
+
```bash
|
|
708
|
+
# Run type checking
|
|
709
|
+
npm run type-check
|
|
710
|
+
|
|
711
|
+
# Fix all TypeScript errors
|
|
712
|
+
# Common fixes:
|
|
713
|
+
# - Update table name types
|
|
714
|
+
# - Add type assertions for child.props
|
|
715
|
+
# - Update import paths if needed
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### Step 8: Test Your Application
|
|
719
|
+
|
|
720
|
+
```bash
|
|
721
|
+
# Run build
|
|
722
|
+
npm run build
|
|
723
|
+
|
|
724
|
+
# Run tests
|
|
725
|
+
npm run test
|
|
726
|
+
|
|
727
|
+
# Start dev server
|
|
728
|
+
npm run dev
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
## Code Examples
|
|
734
|
+
|
|
735
|
+
### Example 1: Organisation Query
|
|
736
|
+
|
|
737
|
+
**Before:**
|
|
738
|
+
```typescript
|
|
739
|
+
const { data: organisations } = await supabase
|
|
740
|
+
.from('organisations')
|
|
741
|
+
.select('*')
|
|
742
|
+
.eq('is_active', true);
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
**After:**
|
|
746
|
+
```typescript
|
|
747
|
+
const { data: organisations } = await supabase
|
|
748
|
+
.from('core_organisations')
|
|
749
|
+
.select('*')
|
|
750
|
+
.eq('is_active', true);
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### Example 2: Event Query with Joins
|
|
754
|
+
|
|
755
|
+
**Before:**
|
|
756
|
+
```typescript
|
|
757
|
+
const { data: events } = await supabase
|
|
758
|
+
.from('event')
|
|
759
|
+
.select(`
|
|
760
|
+
*,
|
|
761
|
+
organisations(*)
|
|
762
|
+
`)
|
|
763
|
+
.eq('organisation_id', orgId);
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
**After:**
|
|
767
|
+
```typescript
|
|
768
|
+
const { data: events } = await supabase
|
|
769
|
+
.from('core_events')
|
|
770
|
+
.select(`
|
|
771
|
+
*,
|
|
772
|
+
core_organisations(*)
|
|
773
|
+
`)
|
|
774
|
+
.eq('organisation_id', orgId);
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
### Example 3: Person with Member Profile
|
|
778
|
+
|
|
779
|
+
**Before:**
|
|
780
|
+
```typescript
|
|
781
|
+
const { data: person } = await supabase
|
|
782
|
+
.from('pace_person')
|
|
783
|
+
.select(`
|
|
784
|
+
*,
|
|
785
|
+
pace_member(*)
|
|
786
|
+
`)
|
|
787
|
+
.eq('id', personId)
|
|
788
|
+
.eq('organisation_id', orgId) // ❌ organisation_id no longer exists
|
|
789
|
+
.single();
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
**After:**
|
|
793
|
+
```typescript
|
|
794
|
+
const { data: person } = await supabase
|
|
795
|
+
.from('core_person')
|
|
796
|
+
.select(`
|
|
797
|
+
*,
|
|
798
|
+
core_member(*)
|
|
799
|
+
`)
|
|
800
|
+
.eq('id', personId)
|
|
801
|
+
.single(); // ✅ No organisation_id needed
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### Example 4: Organisation Memberships
|
|
805
|
+
|
|
806
|
+
**Before:**
|
|
807
|
+
```typescript
|
|
808
|
+
const { data: memberships } = await supabase
|
|
809
|
+
.from('organisation_memberships')
|
|
810
|
+
.select('*')
|
|
811
|
+
.eq('organisation_id', orgId)
|
|
812
|
+
.eq('user_id', userId);
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
**After:**
|
|
816
|
+
```typescript
|
|
817
|
+
const { data: memberships } = await supabase
|
|
818
|
+
.from('core_organisation_memberships')
|
|
819
|
+
.select('*')
|
|
820
|
+
.eq('organisation_id', orgId)
|
|
821
|
+
.eq('user_id', userId);
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
### Example 5: File References
|
|
825
|
+
|
|
826
|
+
**Before:**
|
|
827
|
+
```typescript
|
|
828
|
+
const { data: files } = await supabase
|
|
829
|
+
.from('file_references')
|
|
830
|
+
.select('*')
|
|
831
|
+
.eq('table_name', 'pace_person')
|
|
832
|
+
.eq('record_id', personId);
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
**After:**
|
|
836
|
+
```typescript
|
|
837
|
+
const { data: files } = await supabase
|
|
838
|
+
.from('core_file_references')
|
|
839
|
+
.select('*')
|
|
840
|
+
.eq('table_name', 'core_person') // Updated table_name value
|
|
841
|
+
.eq('record_id', personId);
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
### Example 6: Getting Member Profile
|
|
845
|
+
|
|
846
|
+
**Before:**
|
|
847
|
+
```typescript
|
|
848
|
+
async function getMemberProfile(personId: string, orgId: string) {
|
|
849
|
+
const { data } = await supabase
|
|
850
|
+
.from('pace_member')
|
|
851
|
+
.select('*')
|
|
852
|
+
.eq('person_id', personId)
|
|
853
|
+
.eq('organisation_id', orgId) // ❌
|
|
854
|
+
.single();
|
|
855
|
+
return data;
|
|
856
|
+
}
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
**After:**
|
|
860
|
+
```typescript
|
|
861
|
+
async function getMemberProfile(personId: string) {
|
|
862
|
+
// ✅ No organisation_id needed - one profile per person
|
|
863
|
+
const { data } = await supabase
|
|
864
|
+
.from('core_member')
|
|
865
|
+
.select('*')
|
|
866
|
+
.eq('person_id', personId)
|
|
867
|
+
.single();
|
|
868
|
+
return data;
|
|
869
|
+
}
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
### Example 7: Getting Contacts
|
|
873
|
+
|
|
874
|
+
**Before:**
|
|
875
|
+
```typescript
|
|
876
|
+
async function getContacts(memberId: string) {
|
|
877
|
+
const { data } = await supabase
|
|
878
|
+
.from('pace_contact')
|
|
879
|
+
.select('*')
|
|
880
|
+
.eq('member_id', memberId) // ❌
|
|
881
|
+
.eq('organisation_id', orgId); // ❌
|
|
882
|
+
return data;
|
|
883
|
+
}
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
**After:**
|
|
887
|
+
```typescript
|
|
888
|
+
async function getContacts(personId: string) {
|
|
889
|
+
// ✅ Use person_id directly
|
|
890
|
+
const { data } = await supabase
|
|
891
|
+
.from('core_contact')
|
|
892
|
+
.select('*')
|
|
893
|
+
.eq('person_id', personId);
|
|
894
|
+
return data;
|
|
895
|
+
}
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
### Example 8: React Component with child.props
|
|
899
|
+
|
|
900
|
+
**Before:**
|
|
901
|
+
```tsx
|
|
902
|
+
React.Children.map(children, (child) => {
|
|
903
|
+
if (React.isValidElement(child)) {
|
|
904
|
+
const variant = child.props.variant; // ❌ Type error in React 19
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
**After:**
|
|
910
|
+
```tsx
|
|
911
|
+
React.Children.map(children, (child) => {
|
|
912
|
+
if (React.isValidElement(child)) {
|
|
913
|
+
const props = child.props as { variant?: string; [key: string]: unknown };
|
|
914
|
+
const variant = props.variant; // ✅ Type-safe
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
---
|
|
920
|
+
|
|
921
|
+
## Testing Checklist
|
|
922
|
+
|
|
923
|
+
### Database Queries
|
|
924
|
+
- [ ] Test organisation queries with new table names
|
|
925
|
+
- [ ] Test event queries with new table names
|
|
926
|
+
- [ ] Test person/profile queries (person-scoped)
|
|
927
|
+
- [ ] Test file reference queries
|
|
928
|
+
- [ ] Test organisation membership queries
|
|
929
|
+
- [ ] Test cross-organisation scenarios
|
|
930
|
+
|
|
931
|
+
### React Components
|
|
932
|
+
- [ ] All components render correctly
|
|
933
|
+
- [ ] No TypeScript errors
|
|
934
|
+
- [ ] Error boundaries work correctly
|
|
935
|
+
- [ ] React Compiler is working (check DevTools)
|
|
936
|
+
|
|
937
|
+
### Authentication
|
|
938
|
+
- [ ] Login works
|
|
939
|
+
- [ ] Logout works
|
|
940
|
+
- [ ] Session restoration works
|
|
941
|
+
- [ ] Organisation switching works
|
|
942
|
+
|
|
943
|
+
### Permissions
|
|
944
|
+
- [ ] RBAC permission checks work
|
|
945
|
+
- [ ] Navigation filtering works
|
|
946
|
+
- [ ] Page permission guards work
|
|
947
|
+
|
|
948
|
+
### Forms
|
|
949
|
+
- [ ] Form validation works
|
|
950
|
+
- [ ] Form submission works
|
|
951
|
+
- [ ] New DateTimeField component works (if using)
|
|
952
|
+
|
|
953
|
+
### Data Tables
|
|
954
|
+
- [ ] Data tables render correctly
|
|
955
|
+
- [ ] Sorting works
|
|
956
|
+
- [ ] Filtering works
|
|
957
|
+
- [ ] Pagination works
|
|
958
|
+
|
|
959
|
+
### File Uploads
|
|
960
|
+
- [ ] File uploads work
|
|
961
|
+
- [ ] File references use new table names
|
|
962
|
+
- [ ] File display works
|
|
963
|
+
|
|
964
|
+
### Performance
|
|
965
|
+
- [ ] No performance regressions
|
|
966
|
+
- [ ] React Compiler optimizations working
|
|
967
|
+
- [ ] No memory leaks
|
|
968
|
+
|
|
969
|
+
---
|
|
970
|
+
|
|
971
|
+
## Troubleshooting
|
|
972
|
+
|
|
973
|
+
### Issue 1: "relation does not exist"
|
|
974
|
+
|
|
975
|
+
**Error:**
|
|
976
|
+
```
|
|
977
|
+
relation "organisations" does not exist
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
**Solution:**
|
|
981
|
+
Update table name to `core_organisations`:
|
|
982
|
+
```typescript
|
|
983
|
+
// ❌ Old
|
|
984
|
+
.from('organisations')
|
|
985
|
+
|
|
986
|
+
// ✅ New
|
|
987
|
+
.from('core_organisations')
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
### Issue 2: "column does not exist"
|
|
991
|
+
|
|
992
|
+
**Error:**
|
|
993
|
+
```
|
|
994
|
+
column "organisation_id" does not exist in table "core_member"
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
**Solution:**
|
|
998
|
+
Remove `organisation_id` filters from profile table queries:
|
|
999
|
+
```typescript
|
|
1000
|
+
// ❌ Old
|
|
1001
|
+
.from('core_member')
|
|
1002
|
+
.eq('organisation_id', orgId) // ❌ Column doesn't exist
|
|
1003
|
+
|
|
1004
|
+
// ✅ New
|
|
1005
|
+
.from('core_member')
|
|
1006
|
+
.eq('person_id', personId) // ✅ Person-scoped
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
### Issue 3: View not found
|
|
1010
|
+
|
|
1011
|
+
**Error:**
|
|
1012
|
+
```
|
|
1013
|
+
relation "organisation_memberships" does not exist
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
**Solution:**
|
|
1017
|
+
Use the new unified view:
|
|
1018
|
+
```typescript
|
|
1019
|
+
// ❌ Old
|
|
1020
|
+
.from('organisation_memberships')
|
|
1021
|
+
|
|
1022
|
+
// ✅ New
|
|
1023
|
+
.from('core_organisation_memberships')
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
### Issue 4: File reference table_name mismatch
|
|
1027
|
+
|
|
1028
|
+
**Error:**
|
|
1029
|
+
```
|
|
1030
|
+
No file references found (table_name mismatch)
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
**Solution:**
|
|
1034
|
+
Update `table_name` values to use new table names:
|
|
1035
|
+
```typescript
|
|
1036
|
+
// ❌ Old
|
|
1037
|
+
.eq('table_name', 'pace_person')
|
|
1038
|
+
|
|
1039
|
+
// ✅ New
|
|
1040
|
+
.eq('table_name', 'core_person')
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
### Issue 5: TypeScript errors with child.props
|
|
1044
|
+
|
|
1045
|
+
**Error:**
|
|
1046
|
+
```
|
|
1047
|
+
Property 'variant' does not exist on type 'unknown'
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
**Solution:**
|
|
1051
|
+
Add type assertion:
|
|
1052
|
+
```typescript
|
|
1053
|
+
const props = child.props as { variant?: string; [key: string]: unknown };
|
|
1054
|
+
const variant = props.variant;
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
### Issue 6: React Compiler not working
|
|
1058
|
+
|
|
1059
|
+
**Symptoms:**
|
|
1060
|
+
- No "Memo ✨" badges in React DevTools
|
|
1061
|
+
- Performance not improved
|
|
1062
|
+
|
|
1063
|
+
**Solution:**
|
|
1064
|
+
1. Verify `babel-plugin-react-compiler` is installed
|
|
1065
|
+
2. Check `vite.config.ts` has the compiler configured
|
|
1066
|
+
3. Restart your dev server
|
|
1067
|
+
4. Check React DevTools for "Memo ✨" badges
|
|
1068
|
+
|
|
1069
|
+
### Issue 7: Test failures after React 19 upgrade
|
|
1070
|
+
|
|
1071
|
+
**Solution:**
|
|
1072
|
+
1. Update `@testing-library/react` to latest version
|
|
1073
|
+
2. Check for StrictMode-related test issues
|
|
1074
|
+
3. Verify error boundaries still work correctly
|
|
1075
|
+
4. Update test mocks if needed
|
|
1076
|
+
|
|
1077
|
+
---
|
|
1078
|
+
|
|
1079
|
+
## Additional Resources
|
|
1080
|
+
|
|
1081
|
+
### Documentation
|
|
1082
|
+
- [React 19 Migration Guide](./V0.6.0_REACT_19_MIGRATION.md)
|
|
1083
|
+
- [Database Changes December 2025](./database-changes-december-2025.md)
|
|
1084
|
+
- [Person-Scoped Profiles Migration Guide](./V0.5.190_person-scoped-profiles-migration-guide.md)
|
|
1085
|
+
- [RBAC Migration Guide](./V0.4.0_rbac-migration.md)
|
|
1086
|
+
|
|
1087
|
+
### External Resources
|
|
1088
|
+
- [React 19 Upgrade Guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide)
|
|
1089
|
+
- [React Compiler Documentation](https://react.dev/learn/react-compiler)
|
|
1090
|
+
|
|
1091
|
+
### Support
|
|
1092
|
+
|
|
1093
|
+
If you encounter issues migrating:
|
|
1094
|
+
|
|
1095
|
+
1. **Check Migration Status**: Verify all migrations are applied
|
|
1096
|
+
2. **Verify Types**: Regenerate TypeScript types from current schema
|
|
1097
|
+
3. **Review RLS**: Ensure RLS policies are correctly applied
|
|
1098
|
+
4. **Check Logs**: Review Supabase logs for errors
|
|
1099
|
+
5. **Search Codebase**: Use search to find all references to old table names
|
|
1100
|
+
|
|
1101
|
+
---
|
|
1102
|
+
|
|
1103
|
+
## Summary
|
|
1104
|
+
|
|
1105
|
+
**Key Takeaways:**
|
|
1106
|
+
|
|
1107
|
+
1. **React 19 Upgrade:**
|
|
1108
|
+
- Must upgrade to React 19.2.3+
|
|
1109
|
+
- Configure React Compiler for optimal performance
|
|
1110
|
+
- Update TypeScript types for `child.props`
|
|
1111
|
+
|
|
1112
|
+
2. **Table Naming:**
|
|
1113
|
+
- All core tables → `core_*` prefix
|
|
1114
|
+
- All PACE tables → `core_*` prefix
|
|
1115
|
+
- Application tables → `{app}_*` prefix
|
|
1116
|
+
- Update all queries to use new table names
|
|
1117
|
+
|
|
1118
|
+
3. **Views:**
|
|
1119
|
+
- `organisation_memberships` and `user_organisation_memberships` → `core_organisation_memberships`
|
|
1120
|
+
|
|
1121
|
+
4. **Profiles:**
|
|
1122
|
+
- Person-scoped (not organisation-scoped)
|
|
1123
|
+
- Remove `organisation_id` from profile queries
|
|
1124
|
+
- Use `person_id` instead of `member_id` for contacts
|
|
1125
|
+
|
|
1126
|
+
5. **File References:**
|
|
1127
|
+
- Update `table_name` values to use new table names
|
|
1128
|
+
|
|
1129
|
+
6. **Types:**
|
|
1130
|
+
- Regenerate TypeScript types after migrations
|
|
1131
|
+
|
|
1132
|
+
7. **New Features:**
|
|
1133
|
+
- `useFormDialog` hook available
|
|
1134
|
+
- `DateTimeField` and `DatePickerWithTimezone` components available
|
|
1135
|
+
- Timezone and location utilities available
|
|
1136
|
+
|
|
1137
|
+
**Migration Order:**
|
|
1138
|
+
1. Update dependencies (React 19, pace-core 0.6.1)
|
|
1139
|
+
2. Apply person-scoped profiles migrations
|
|
1140
|
+
3. Apply table naming standardization migrations
|
|
1141
|
+
4. Regenerate TypeScript types
|
|
1142
|
+
5. Update code to use new table names
|
|
1143
|
+
6. Remove `organisation_id` filters from profile queries
|
|
1144
|
+
7. Update React component code for React 19
|
|
1145
|
+
8. Configure React Compiler
|
|
1146
|
+
9. Test thoroughly
|
|
1147
|
+
|
|
1148
|
+
---
|
|
1149
|
+
|
|
1150
|
+
**Last Updated:** January 2025
|
|
1151
|
+
**Version:** 0.6.1
|
|
1152
|
+
**Previous Version:** 0.5.190
|
|
1153
|
+
|