@jmruthers/pace-core 0.5.190 → 0.5.193

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.
Files changed (334) hide show
  1. package/dist/{AuthService-CbP_utw2.d.ts → AuthService-DjnJHDtC.d.ts} +1 -0
  2. package/dist/{DataTable-ON3IXISJ.js → DataTable-5FU7IESH.js} +7 -6
  3. package/dist/{DataTable-IVYljGJ6.d.ts → DataTable-Be6dH_dR.d.ts} +1 -1
  4. package/dist/{PublicPageProvider-C4uxosp6.d.ts → PublicPageProvider-C0Sm_e5k.d.ts} +4 -2
  5. package/dist/{UnifiedAuthProvider-BYA9qB-o.d.ts → UnifiedAuthProvider-185Ih4dj.d.ts} +2 -0
  6. package/dist/{UnifiedAuthProvider-X5NXANVI.js → UnifiedAuthProvider-RGJTDE2C.js} +3 -3
  7. package/dist/{api-I6UCQ5S6.js → api-N774RPUA.js} +2 -2
  8. package/dist/chunk-6C4YBBJM 5.js +628 -0
  9. package/dist/chunk-7D4SUZUM.js 2.map +1 -0
  10. package/dist/{chunk-73HSNNOQ.js → chunk-7EQTDTTJ.js} +47 -74
  11. package/dist/chunk-7EQTDTTJ.js 2.map +1 -0
  12. package/dist/chunk-7EQTDTTJ.js.map +1 -0
  13. package/dist/{chunk-J2XXC7R5.js → chunk-7FLMSG37.js} +409 -244
  14. package/dist/chunk-7FLMSG37.js 2.map +1 -0
  15. package/dist/chunk-7FLMSG37.js.map +1 -0
  16. package/dist/{chunk-NIU6J6OX.js → chunk-BC4IJKSL.js} +23 -32
  17. package/dist/chunk-BC4IJKSL.js.map +1 -0
  18. package/dist/{chunk-SDMHPX3X.js → chunk-E3SPN4VZ 5.js } +198 -53
  19. package/dist/chunk-E3SPN4VZ.js +12917 -0
  20. package/dist/{chunk-SDMHPX3X.js.map → chunk-E3SPN4VZ.js.map} +1 -1
  21. package/dist/chunk-E66EQZE6 5.js +37 -0
  22. package/dist/chunk-E66EQZE6.js 2.map +1 -0
  23. package/dist/{chunk-DZWK57KZ.js → chunk-G37KK66H.js} +1 -1
  24. package/dist/{chunk-DZWK57KZ.js.map → chunk-G37KK66H.js.map} +1 -1
  25. package/dist/{chunk-STYK4OH2.js → chunk-HWIIPPNI.js} +44 -225
  26. package/dist/chunk-HWIIPPNI.js.map +1 -0
  27. package/dist/chunk-I7PSE6JW 5.js +191 -0
  28. package/dist/chunk-I7PSE6JW.js 2.map +1 -0
  29. package/dist/{chunk-Y4BUBBHD.js → chunk-IIELH4DL.js} +211 -136
  30. package/dist/chunk-IIELH4DL.js.map +1 -0
  31. package/dist/{chunk-RUYZKXOD.js → chunk-KNC55RTG.js} +17 -5
  32. package/dist/chunk-KNC55RTG.js 5.map +1 -0
  33. package/dist/chunk-KNC55RTG.js.map +1 -0
  34. package/dist/chunk-KQCRWDSA.js 5.map +1 -0
  35. package/dist/{chunk-4QYC5L4K.js → chunk-LFNCN2SP.js} +26 -30
  36. package/dist/chunk-LFNCN2SP.js 2.map +1 -0
  37. package/dist/chunk-LFNCN2SP.js.map +1 -0
  38. package/dist/chunk-LMC26NLJ 2.js +84 -0
  39. package/dist/{chunk-VVBAW5A5.js → chunk-NOAYCWCX 5.js } +118 -110
  40. package/dist/chunk-NOAYCWCX.js +4993 -0
  41. package/dist/chunk-NOAYCWCX.js.map +1 -0
  42. package/dist/chunk-QWWZ5CAQ.js 3.map +1 -0
  43. package/dist/chunk-QXHPKYJV 3.js +113 -0
  44. package/dist/chunk-R77UEZ4E 3.js +68 -0
  45. package/dist/chunk-VBXEHIUJ.js 6.map +1 -0
  46. package/dist/{chunk-HQVPB5MZ.js → chunk-XNXXZ43G.js} +77 -33
  47. package/dist/chunk-XNXXZ43G.js.map +1 -0
  48. package/dist/chunk-ZSAAAMVR 6.js +25 -0
  49. package/dist/components.d.ts +4 -4
  50. package/dist/components.js +8 -8
  51. package/dist/components.js 5.map +1 -0
  52. package/dist/{database.generated-DI89OQeI.d.ts → database.generated-CzIvgcPu.d.ts} +165 -201
  53. package/dist/hooks.d.ts +12 -12
  54. package/dist/hooks.js +9 -9
  55. package/dist/index.d.ts +11 -11
  56. package/dist/index.js +20 -27
  57. package/dist/index.js.map +1 -1
  58. package/dist/providers.d.ts +3 -3
  59. package/dist/providers.js +2 -2
  60. package/dist/rbac/index.d.ts +2 -20
  61. package/dist/rbac/index.js +7 -9
  62. package/dist/styles/index 2.js +12 -0
  63. package/dist/styles/index.js 5.map +1 -0
  64. package/dist/theming/runtime 5.js +19 -0
  65. package/dist/theming/runtime.js 5.map +1 -0
  66. package/dist/{types-Bwgl--Xo.d.ts → types-CEpcvwwF.d.ts} +1 -1
  67. package/dist/types.d.ts +2 -2
  68. package/dist/{usePublicRouteParams-DxIDS4bC.d.ts → usePublicRouteParams-TZe0gy-4.d.ts} +1 -1
  69. package/dist/utils.d.ts +8 -8
  70. package/dist/utils.js +2 -2
  71. package/docs/api/classes/ColumnFactory.md +1 -1
  72. package/docs/api/classes/ErrorBoundary.md +1 -1
  73. package/docs/api/classes/InvalidScopeError.md +1 -1
  74. package/docs/api/classes/Logger.md +1 -1
  75. package/docs/api/classes/MissingUserContextError.md +1 -1
  76. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  77. package/docs/api/classes/PermissionDeniedError.md +2 -2
  78. package/docs/api/classes/RBACAuditManager.md +2 -2
  79. package/docs/api/classes/RBACCache.md +1 -1
  80. package/docs/api/classes/RBACEngine.md +2 -2
  81. package/docs/api/classes/RBACError.md +1 -1
  82. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  83. package/docs/api/classes/SecureSupabaseClient.md +10 -10
  84. package/docs/api/classes/StorageUtils.md +1 -1
  85. package/docs/api/enums/FileCategory.md +1 -1
  86. package/docs/api/enums/LogLevel.md +1 -1
  87. package/docs/api/enums/RBACErrorCode.md +1 -1
  88. package/docs/api/enums/RPCFunction.md +1 -1
  89. package/docs/api/interfaces/AddressFieldProps.md +1 -1
  90. package/docs/api/interfaces/AddressFieldRef.md +1 -1
  91. package/docs/api/interfaces/AggregateConfig.md +1 -1
  92. package/docs/api/interfaces/AutocompleteOptions.md +1 -1
  93. package/docs/api/interfaces/AvatarProps.md +1 -1
  94. package/docs/api/interfaces/BadgeProps.md +1 -1
  95. package/docs/api/interfaces/ButtonProps.md +1 -1
  96. package/docs/api/interfaces/CalendarProps.md +1 -1
  97. package/docs/api/interfaces/CardProps.md +1 -1
  98. package/docs/api/interfaces/ColorPalette.md +1 -1
  99. package/docs/api/interfaces/ColorShade.md +1 -1
  100. package/docs/api/interfaces/ComplianceResult.md +1 -1
  101. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  102. package/docs/api/interfaces/DataRecord.md +1 -1
  103. package/docs/api/interfaces/DataTableAction.md +1 -1
  104. package/docs/api/interfaces/DataTableColumn.md +1 -1
  105. package/docs/api/interfaces/DataTableProps.md +1 -1
  106. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  107. package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
  108. package/docs/api/interfaces/DatabaseIssue.md +1 -1
  109. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  110. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  111. package/docs/api/interfaces/EventAppRoleData.md +1 -1
  112. package/docs/api/interfaces/ExportColumn.md +1 -1
  113. package/docs/api/interfaces/ExportOptions.md +1 -1
  114. package/docs/api/interfaces/FileDisplayProps.md +24 -11
  115. package/docs/api/interfaces/FileMetadata.md +1 -1
  116. package/docs/api/interfaces/FileReference.md +1 -1
  117. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  118. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  119. package/docs/api/interfaces/FileUploadProps.md +1 -1
  120. package/docs/api/interfaces/FooterProps.md +1 -1
  121. package/docs/api/interfaces/FormFieldProps.md +1 -1
  122. package/docs/api/interfaces/FormProps.md +1 -1
  123. package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
  124. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  125. package/docs/api/interfaces/InputProps.md +1 -1
  126. package/docs/api/interfaces/LabelProps.md +1 -1
  127. package/docs/api/interfaces/LoggerConfig.md +1 -1
  128. package/docs/api/interfaces/LoginFormProps.md +1 -1
  129. package/docs/api/interfaces/NavigationAccessRecord.md +2 -2
  130. package/docs/api/interfaces/NavigationContextType.md +1 -1
  131. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  132. package/docs/api/interfaces/NavigationItem.md +1 -1
  133. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  134. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  135. package/docs/api/interfaces/Organisation.md +1 -1
  136. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  137. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  138. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  139. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  140. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  141. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  142. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  143. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  144. package/docs/api/interfaces/PagePermissionGuardProps.md +2 -2
  145. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  146. package/docs/api/interfaces/PaletteData.md +1 -1
  147. package/docs/api/interfaces/ParsedAddress.md +2 -2
  148. package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
  149. package/docs/api/interfaces/ProgressProps.md +1 -1
  150. package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
  151. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  152. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  153. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  154. package/docs/api/interfaces/QuickFix.md +1 -1
  155. package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
  156. package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
  157. package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
  158. package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
  159. package/docs/api/interfaces/RBACConfig.md +2 -2
  160. package/docs/api/interfaces/RBACContext.md +1 -1
  161. package/docs/api/interfaces/RBACLogger.md +1 -1
  162. package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
  163. package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
  164. package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
  165. package/docs/api/interfaces/RBACPermissionCheckResult.md +2 -2
  166. package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
  167. package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
  168. package/docs/api/interfaces/RBACResult.md +1 -1
  169. package/docs/api/interfaces/RBACRoleGrantParams.md +2 -2
  170. package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
  171. package/docs/api/interfaces/RBACRoleRevokeParams.md +2 -2
  172. package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
  173. package/docs/api/interfaces/RBACRoleValidateParams.md +2 -2
  174. package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
  175. package/docs/api/interfaces/RBACRolesListParams.md +1 -1
  176. package/docs/api/interfaces/RBACRolesListResult.md +2 -2
  177. package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
  178. package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
  179. package/docs/api/interfaces/ResourcePermissions.md +1 -1
  180. package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
  181. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  182. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  183. package/docs/api/interfaces/RoleManagementResult.md +1 -1
  184. package/docs/api/interfaces/RouteAccessRecord.md +2 -2
  185. package/docs/api/interfaces/RouteConfig.md +2 -2
  186. package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
  187. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  188. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  189. package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
  190. package/docs/api/interfaces/SetupIssue.md +1 -1
  191. package/docs/api/interfaces/StorageConfig.md +1 -1
  192. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  193. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  194. package/docs/api/interfaces/StorageListOptions.md +1 -1
  195. package/docs/api/interfaces/StorageListResult.md +1 -1
  196. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  197. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  198. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  199. package/docs/api/interfaces/StyleImport.md +1 -1
  200. package/docs/api/interfaces/SwitchProps.md +1 -1
  201. package/docs/api/interfaces/TabsContentProps.md +1 -1
  202. package/docs/api/interfaces/TabsListProps.md +1 -1
  203. package/docs/api/interfaces/TabsProps.md +1 -1
  204. package/docs/api/interfaces/TabsTriggerProps.md +1 -1
  205. package/docs/api/interfaces/TextareaProps.md +1 -1
  206. package/docs/api/interfaces/ToastActionElement.md +1 -1
  207. package/docs/api/interfaces/ToastProps.md +1 -1
  208. package/docs/api/interfaces/UnifiedAuthContextType.md +60 -38
  209. package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
  210. package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
  211. package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
  212. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  213. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  214. package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
  215. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  216. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  217. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  218. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
  219. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  220. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  221. package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
  222. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  223. package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
  224. package/docs/api/interfaces/UserEventAccess.md +1 -1
  225. package/docs/api/interfaces/UserMenuProps.md +1 -1
  226. package/docs/api/interfaces/UserProfile.md +1 -1
  227. package/docs/api/modules.md +202 -217
  228. package/docs/migration/README.md +18 -0
  229. package/docs/migration/database-changes-december-2025.md +768 -0
  230. package/docs/migration/person-scoped-profiles-migration-guide.md +472 -0
  231. package/docs/rbac/event-based-apps.md +124 -6
  232. package/package.json +1 -1
  233. package/scripts/check-pace-core-compliance.cjs +292 -57
  234. package/src/__tests__/public-recipe-view.test.ts +10 -10
  235. package/src/__tests__/rls-policies.test.ts +16 -14
  236. package/src/components/AddressField/README.md +6 -6
  237. package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +172 -45
  238. package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +121 -28
  239. package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +9 -8
  240. package/src/components/DataTable/__tests__/DataTableCore.test.tsx +20 -52
  241. package/src/components/DataTable/__tests__/a11y.basic.test.tsx +170 -34
  242. package/src/components/DataTable/__tests__/keyboard.test.tsx +75 -12
  243. package/src/components/DataTable/__tests__/pagination.modes.test.tsx +75 -11
  244. package/src/components/DataTable/components/UnifiedTableBody.tsx +85 -14
  245. package/src/components/DataTable/hooks/useDataTablePermissions.ts +75 -10
  246. package/src/components/FileDisplay/FileDisplay.test.tsx +2 -1
  247. package/src/components/FileDisplay/FileDisplay.tsx +16 -4
  248. package/src/components/NavigationMenu/NavigationMenu.test.tsx +6 -4
  249. package/src/components/NavigationMenu/NavigationMenu.tsx +1 -10
  250. package/src/components/OrganisationSelector/OrganisationSelector.tsx +35 -16
  251. package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +25 -2
  252. package/src/components/PaceAppLayout/PaceAppLayout.tsx +97 -68
  253. package/src/components/PaceLoginPage/PaceLoginPage.tsx +0 -7
  254. package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +5 -9
  255. package/src/components/ProtectedRoute/ProtectedRoute.tsx +0 -1
  256. package/src/components/PublicLayout/PublicPageProvider.tsx +0 -1
  257. package/src/components/Select/Select.test.tsx +4 -1
  258. package/src/components/Select/Select.tsx +60 -15
  259. package/src/hooks/__tests__/usePermissionCache.simple.test.ts +192 -0
  260. package/src/hooks/__tests__/usePermissionCache.unit.test.ts +741 -0
  261. package/src/hooks/__tests__/usePublicEvent.simple.test.ts +703 -0
  262. package/src/hooks/__tests__/usePublicEvent.unit.test.ts +581 -0
  263. package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +23 -15
  264. package/src/hooks/public/usePublicEvent.ts +8 -8
  265. package/src/hooks/public/usePublicFileDisplay.ts +2 -2
  266. package/src/hooks/services/useAuthService.ts +21 -3
  267. package/src/hooks/services/useEventService.ts +21 -3
  268. package/src/hooks/services/useInactivityService.ts +21 -3
  269. package/src/hooks/services/useOrganisationService.ts +21 -3
  270. package/src/hooks/useFileDisplay.ts +18 -26
  271. package/src/hooks/useQueryCache.ts +6 -6
  272. package/src/hooks/useSecureDataAccess.test.ts +24 -17
  273. package/src/hooks/useSecureDataAccess.ts +18 -13
  274. package/src/providers/__tests__/OrganisationProvider.test.tsx +27 -21
  275. package/src/providers/services/EventServiceProvider.tsx +0 -8
  276. package/src/providers/services/UnifiedAuthProvider.tsx +174 -24
  277. package/src/rbac/__tests__/adapters.comprehensive.test.tsx +10 -16
  278. package/src/rbac/__tests__/isSuperAdmin.real.test.ts +82 -0
  279. package/src/rbac/adapters.tsx +3 -22
  280. package/src/rbac/api.test.ts +2 -2
  281. package/src/rbac/api.ts +7 -1
  282. package/src/rbac/components/EnhancedNavigationMenu.tsx +2 -15
  283. package/src/rbac/components/NavigationGuard.tsx +1 -10
  284. package/src/rbac/components/NavigationProvider.tsx +0 -1
  285. package/src/rbac/components/PermissionEnforcer.tsx +45 -12
  286. package/src/rbac/components/SecureDataProvider.tsx +0 -1
  287. package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +7 -43
  288. package/src/rbac/components/__tests__/NavigationGuard.test.tsx +4 -11
  289. package/src/rbac/components/__tests__/NavigationProvider.test.tsx +3 -3
  290. package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +1 -1
  291. package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +1 -1
  292. package/src/rbac/engine.ts +14 -2
  293. package/src/rbac/hooks/index.ts +0 -3
  294. package/src/rbac/hooks/usePermissions.ts +51 -11
  295. package/src/rbac/hooks/useRBAC.simple.test.ts +95 -0
  296. package/src/rbac/hooks/useRBAC.ts +3 -13
  297. package/src/rbac/hooks/useResolvedScope.test.ts +75 -54
  298. package/src/rbac/hooks/useResolvedScope.ts +58 -33
  299. package/src/rbac/hooks/useSecureSupabase.ts +4 -9
  300. package/src/rbac/secureClient.ts +31 -0
  301. package/src/rbac/utils/__tests__/eventContext.test.ts +2 -2
  302. package/src/rbac/utils/__tests__/eventContext.unit.test.ts +490 -0
  303. package/src/rbac/utils/eventContext.ts +5 -2
  304. package/src/services/AuthService.ts +37 -8
  305. package/src/services/EventService.ts +4 -57
  306. package/src/services/InactivityService.ts +127 -34
  307. package/src/services/OrganisationService.ts +160 -149
  308. package/src/services/__tests__/OrganisationService.pagination.test.ts +34 -8
  309. package/src/services/__tests__/OrganisationService.test.ts +218 -86
  310. package/src/types/database.generated.ts +166 -201
  311. package/src/types/supabase.ts +2 -2
  312. package/src/utils/__tests__/secureDataAccess.unit.test.ts +3 -2
  313. package/src/utils/file-reference/index.ts +4 -4
  314. package/src/utils/google-places/googlePlacesUtils.ts +1 -1
  315. package/src/utils/google-places/types.ts +1 -1
  316. package/src/utils/request-deduplication.ts +4 -4
  317. package/src/utils/security/secureDataAccess.test.ts +1 -1
  318. package/src/utils/security/secureDataAccess.ts +7 -4
  319. package/src/utils/storage/README.md +1 -1
  320. package/dist/chunk-4QYC5L4K.js.map +0 -1
  321. package/dist/chunk-73HSNNOQ.js.map +0 -1
  322. package/dist/chunk-HQVPB5MZ.js.map +0 -1
  323. package/dist/chunk-J2XXC7R5.js.map +0 -1
  324. package/dist/chunk-NIU6J6OX.js.map +0 -1
  325. package/dist/chunk-RUYZKXOD.js.map +0 -1
  326. package/dist/chunk-STYK4OH2.js.map +0 -1
  327. package/dist/chunk-VVBAW5A5.js.map +0 -1
  328. package/dist/chunk-Y4BUBBHD.js.map +0 -1
  329. package/scripts/check-pace-core-compliance.js +0 -512
  330. package/src/rbac/hooks/useSuperAdminBypass.ts +0 -126
  331. package/src/utils/context/superAdminOverride.ts +0 -58
  332. /package/dist/{DataTable-ON3IXISJ.js.map → DataTable-5FU7IESH.js.map} +0 -0
  333. /package/dist/{UnifiedAuthProvider-X5NXANVI.js.map → UnifiedAuthProvider-RGJTDE2C.js.map} +0 -0
  334. /package/dist/{api-I6UCQ5S6.js.map → api-N774RPUA.js.map} +0 -0
@@ -0,0 +1,768 @@
1
+ # Database Changes - December 2025
2
+
3
+ **Version:** 0.5.190+
4
+ **Migration Date:** 2025-12-06
5
+ **Breaking Changes:** Yes
6
+
7
+ ## Overview
8
+
9
+ This document details the database schema changes made in December 2025 that affect consuming applications. There are two major changes:
10
+
11
+ 1. **Table Naming Standardization** (2025-12-06) - All tables renamed to follow `app_entity` pattern
12
+ 2. **Person-Scoped Profiles Migration** (2025-12-05) - Profiles migrated from organisation-scoped to person-scoped
13
+
14
+ **⚠️ CRITICAL**: Both changes are **breaking changes** and require code updates in consuming applications.
15
+
16
+ ---
17
+
18
+ ## Change 1: Table Naming Standardization
19
+
20
+ **Migration:** `20251206111258_standardize_table_naming_app_entity.sql`
21
+ **Date:** 2025-12-06
22
+
23
+ ### Purpose
24
+
25
+ All tables have been renamed to follow the `app_entity` naming convention:
26
+ - **Core infrastructure tables** → `core_*` prefix
27
+ - **Application-specific tables** → `{app}_*` prefix (e.g., `cake_*`, `trac_*`, `medi_*`)
28
+ - **Shared PACE tables** → `core_*` prefix (since PACE is the overall suite)
29
+
30
+ ### Table Renames
31
+
32
+ #### Core Infrastructure Tables
33
+
34
+ | Old Name | New Name | Notes |
35
+ |----------|----------|-------|
36
+ | `organisations` | `core_organisations` | Core organisation table |
37
+ | `event` | `core_events` | Core event table |
38
+ | `file_references` | `core_file_references` | File reference system |
39
+ | `form_context_types` | `core_form_context_types` | Form system |
40
+ | `form_field_config` | `core_form_field_config` | Form system |
41
+ | `form_fields` | `core_form_fields` | Form system |
42
+ | `form_response_values` | `core_form_response_values` | Form system |
43
+ | `form_responses` | `core_form_responses` | Form system |
44
+ | `forms` | `core_forms` | Form system |
45
+ | `event_app_access` | `core_event_app_access` | Event access control |
46
+ | `organisation_app_access` | `core_organisation_app_access` | Organisation access control |
47
+ | `organisation_audit_log` | `core_organisation_audit_log` | Audit logging |
48
+
49
+ #### PACE Tables (Renamed to `core_*`)
50
+
51
+ | Old Name | New Name | Notes |
52
+ |----------|----------|-------|
53
+ | `pace_person` | `core_person` | Person records |
54
+ | `pace_member` | `core_member` | Membership profiles |
55
+ | `pace_contact` | `core_contact` | Contact profiles |
56
+ | `pace_address` | `core_address` | Address records |
57
+ | `pace_phone` | `core_phone` | Phone records |
58
+ | `pace_consent` | `core_consent` | Consent records |
59
+ | `pace_consent_type` | `core_consent_type` | Consent types |
60
+ | `pace_contact_type` | `core_contact_type` | Contact types |
61
+ | `pace_field_list` | `core_field_list` | Field lists |
62
+ | `pace_gender_type` | `core_gender_type` | Gender types |
63
+ | `pace_identification` | `core_identification` | Identification records |
64
+ | `pace_identification_type` | `core_identification_type` | Identification types |
65
+ | `pace_member_role` | `core_member_role` | Member roles |
66
+ | `pace_membership_type` | `core_membership_type` | Membership types |
67
+ | `pace_merchandise` | `core_merchandise` | Merchandise records |
68
+ | `pace_phone_type` | `core_phone_type` | Phone types |
69
+ | `pace_pronoun_type` | `core_pronoun_type` | Pronoun types |
70
+ | `pace_qualification` | `core_qualification` | Qualification records |
71
+ | `pace_role_type` | `core_role_type` | Role types |
72
+
73
+ ### View Changes
74
+
75
+ #### Membership Views
76
+
77
+ | Old Name | New Name | Notes |
78
+ |----------|----------|-------|
79
+ | `organisation_memberships` | **DROPPED** | Merged into `core_organisation_memberships` |
80
+ | `user_organisation_memberships` | **DROPPED** | Merged into `core_organisation_memberships` |
81
+ | - | `core_organisation_memberships` | **NEW** - Unified membership view |
82
+
83
+ **New View Details:**
84
+
85
+ The `core_organisation_memberships` view provides a unified view of organisation memberships:
86
+
87
+ ```sql
88
+ CREATE VIEW core_organisation_memberships AS
89
+ SELECT
90
+ id,
91
+ user_id,
92
+ organisation_id,
93
+ role,
94
+ (role = ANY (ARRAY['org_admin'::rbac_organisation_role, 'leader'::rbac_organisation_role])) AS is_primary,
95
+ granted_at AS joined_at,
96
+ status,
97
+ created_at,
98
+ updated_at,
99
+ granted_by AS created_by,
100
+ revoked_by AS updated_by,
101
+ granted_at,
102
+ revoked_at,
103
+ valid_from,
104
+ valid_to,
105
+ notes
106
+ FROM rbac_organisation_roles ror
107
+ WHERE ror.status = 'active'::text
108
+ AND ror.revoked_at IS NULL
109
+ AND ror.valid_from <= NOW()
110
+ AND (ror.valid_to IS NULL OR ror.valid_to >= NOW())
111
+ AND ror.role IN (
112
+ 'org_admin'::rbac_organisation_role,
113
+ 'leader'::rbac_organisation_role,
114
+ 'member'::rbac_organisation_role,
115
+ 'supporter'::rbac_organisation_role
116
+ );
117
+ ```
118
+
119
+ **Key Features:**
120
+ - Returns only active, non-revoked memberships
121
+ - Includes all membership roles (org_admin, leader, member, supporter)
122
+ - Respects valid time windows (valid_from/valid_to)
123
+ - Optimized for RLS policies with `security_barrier=true` and `security_invoker=true`
124
+
125
+ #### Application-Specific Views
126
+
127
+ | Old Name | New Name | Notes |
128
+ |----------|----------|-------|
129
+ | `public_recipe_details` | `cake_public_recipe_details` | CAKE app public recipe view |
130
+
131
+ ### Breaking Changes
132
+
133
+ #### 1. Direct Table Queries
134
+
135
+ **Before:**
136
+ ```typescript
137
+ // ❌ This will fail - table name changed
138
+ const { data } = await supabase
139
+ .from('organisations')
140
+ .select('*');
141
+ ```
142
+
143
+ **After:**
144
+ ```typescript
145
+ // ✅ Use new table name
146
+ const { data } = await supabase
147
+ .from('core_organisations')
148
+ .select('*');
149
+ ```
150
+
151
+ #### 2. View Queries
152
+
153
+ **Before:**
154
+ ```typescript
155
+ // ❌ This will fail - view dropped
156
+ const { data } = await supabase
157
+ .from('organisation_memberships')
158
+ .select('*')
159
+ .eq('organisation_id', orgId);
160
+ ```
161
+
162
+ **After:**
163
+ ```typescript
164
+ // ✅ Use new unified view
165
+ const { data } = await supabase
166
+ .from('core_organisation_memberships')
167
+ .select('*')
168
+ .eq('organisation_id', orgId);
169
+ ```
170
+
171
+ #### 3. Joins and Relationships
172
+
173
+ **Before:**
174
+ ```typescript
175
+ // ❌ This will fail - table names changed
176
+ const { data } = await supabase
177
+ .from('pace_person')
178
+ .select('*, pace_member(*), organisations(*)')
179
+ .eq('id', personId);
180
+ ```
181
+
182
+ **After:**
183
+ ```typescript
184
+ // ✅ Use new table names
185
+ const { data } = await supabase
186
+ .from('core_person')
187
+ .select('*, core_member(*), core_organisations(*)')
188
+ .eq('id', personId);
189
+ ```
190
+
191
+ #### 4. File References
192
+
193
+ **Before:**
194
+ ```typescript
195
+ // ❌ This will fail - table name changed
196
+ const { data } = await supabase
197
+ .from('file_references')
198
+ .select('*')
199
+ .eq('table_name', 'pace_person')
200
+ .eq('record_id', personId);
201
+ ```
202
+
203
+ **After:**
204
+ ```typescript
205
+ // ✅ Use new table names
206
+ const { data } = await supabase
207
+ .from('core_file_references')
208
+ .select('*')
209
+ .eq('table_name', 'core_person') // Also update table_name values
210
+ .eq('record_id', personId);
211
+ ```
212
+
213
+ **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:
214
+ - `'pace_person'` → `'core_person'`
215
+ - `'event'` → `'core_events'`
216
+ - `'pace_member'` → `'core_member'`
217
+ - `'pace_contact'` → `'core_contact'`
218
+ - etc.
219
+
220
+ #### 5. Event Queries
221
+
222
+ **Before:**
223
+ ```typescript
224
+ // ❌ This will fail - table name changed
225
+ const { data } = await supabase
226
+ .from('event')
227
+ .select('*')
228
+ .eq('event_id', eventId);
229
+ ```
230
+
231
+ **After:**
232
+ ```typescript
233
+ // ✅ Use new table name
234
+ const { data } = await supabase
235
+ .from('core_events')
236
+ .select('*')
237
+ .eq('event_id', eventId);
238
+ ```
239
+
240
+ ### RPC Functions Updated
241
+
242
+ The following RPC functions have been updated to use the new table names:
243
+
244
+ - `data_file_reference_url_get` - Now queries `core_file_references`
245
+ - `data_file_reference_get` - Now queries `core_file_references`
246
+ - `data_file_reference_delete` - Now queries `core_file_references`
247
+ - `check_user_pace_member_access` - Now queries `core_person` and `core_member`
248
+ - `check_user_medi_profile_access` - Now queries `core_member`
249
+ - `check_user_pace_contact_access` - Now queries `core_person` and `core_contact`
250
+ - `check_user_event_access` - Now queries `core_events`
251
+ - `check_public_event_visible` - Now queries `core_events`
252
+ - `get_event_organisation_id` - Now queries `core_events`
253
+ - `is_event_visible` - Now queries `core_events`
254
+ - `data_user_events_get` - Now queries `core_events`
255
+ - `data_user_organisation_roles_get` - Now queries `core_organisations`
256
+ - `data_user_organisations_get` - Now queries `core_organisations`
257
+ - `get_public_event_by_code` - Now queries `core_events` and `core_file_references`
258
+ - `app_cake_dish_create` - Now queries `core_events`
259
+ - `app_cake_dish_update` - Now queries `core_events`
260
+ - `app_cake_unit_create` - Now queries `core_events`
261
+ - `app_base_application_create` - Now queries `core_person` and `core_events`
262
+ - `app_pace_contact_update` - Now queries `core_contact`, `core_person`, `core_member`, `core_phone`
263
+ - `get_organisation_members` - Now uses `core_organisation_memberships` view
264
+
265
+ **Note**: `set_super_admin_override` function has been **removed** (as of migration `20251208133718_remove_super_admin_override_mechanism.sql`). Super admin access is now determined solely by the `is_super_admin()` function in RLS policies. If you were using this function, remove those calls as they are no longer needed or available.
266
+
267
+ **Note**: RPC function signatures have not changed - only internal table references. Your RPC calls should continue to work, but ensure you're using the correct table names in any direct queries.
268
+
269
+ ### TypeScript Type Updates
270
+
271
+ After applying migrations, **regenerate your database types**:
272
+
273
+ ```bash
274
+ npx supabase gen types typescript --project-id <your-project-id> > src/types/database.generated.ts
275
+ ```
276
+
277
+ The updated types will reflect:
278
+ - All table names changed to `core_*` or `{app}_*` prefixes
279
+ - View names updated
280
+ - Relationship types updated
281
+
282
+ ### Migration Checklist
283
+
284
+ Use this checklist to identify areas in your app that need updates:
285
+
286
+ #### Database Queries
287
+ - [ ] Search codebase for `from('organisations')` → Update to `from('core_organisations')`
288
+ - [ ] Search codebase for `from('event')` → Update to `from('core_events')`
289
+ - [ ] Search codebase for `from('file_references')` → Update to `from('core_file_references')`
290
+ - [ ] Search codebase for `from('pace_*')` → Update to `from('core_*')`
291
+ - [ ] Search codebase for `from('organisation_memberships')` → Update to `from('core_organisation_memberships')`
292
+ - [ ] Search codebase for `from('user_organisation_memberships')` → Update to `from('core_organisation_memberships')`
293
+ - [ ] Search codebase for `from('public_recipe_details')` → Update to `from('cake_public_recipe_details')`
294
+
295
+ #### TypeScript Types
296
+ - [ ] Regenerate database types from current schema
297
+ - [ ] Update all type references to use new table names
298
+ - [ ] Update interface definitions that reference old table names
299
+
300
+ #### File References
301
+ - [ ] Update `table_name` values in file reference queries to use new table names
302
+ - [ ] Review file upload code that sets `table_name`
303
+ - [ ] Update file reference display components
304
+
305
+ #### Joins and Relationships
306
+ - [ ] Update all `.select()` statements with joins to use new table names
307
+ - [ ] Review relationship queries (e.g., `pace_person(*)` → `core_person(*)`)
308
+ - [ ] Update foreign key lookups
309
+
310
+ #### RLS Policies
311
+ - [ ] Review any custom RLS policies that reference old table names
312
+ - [ ] Update policy definitions if you have custom policies
313
+
314
+ ### Code Migration Examples
315
+
316
+ #### Example 1: Organisation Query
317
+
318
+ **Before:**
319
+ ```typescript
320
+ const { data: organisations } = await supabase
321
+ .from('organisations')
322
+ .select('*')
323
+ .eq('is_active', true);
324
+ ```
325
+
326
+ **After:**
327
+ ```typescript
328
+ const { data: organisations } = await supabase
329
+ .from('core_organisations')
330
+ .select('*')
331
+ .eq('is_active', true);
332
+ ```
333
+
334
+ #### Example 2: Event Query with Joins
335
+
336
+ **Before:**
337
+ ```typescript
338
+ const { data: events } = await supabase
339
+ .from('event')
340
+ .select(`
341
+ *,
342
+ organisations(*)
343
+ `)
344
+ .eq('organisation_id', orgId);
345
+ ```
346
+
347
+ **After:**
348
+ ```typescript
349
+ const { data: events } = await supabase
350
+ .from('core_events')
351
+ .select(`
352
+ *,
353
+ core_organisations(*)
354
+ `)
355
+ .eq('organisation_id', orgId);
356
+ ```
357
+
358
+ #### Example 3: Person with Member Profile
359
+
360
+ **Before:**
361
+ ```typescript
362
+ const { data: person } = await supabase
363
+ .from('pace_person')
364
+ .select(`
365
+ *,
366
+ pace_member(*)
367
+ `)
368
+ .eq('id', personId)
369
+ .single();
370
+ ```
371
+
372
+ **After:**
373
+ ```typescript
374
+ const { data: person } = await supabase
375
+ .from('core_person')
376
+ .select(`
377
+ *,
378
+ core_member(*)
379
+ `)
380
+ .eq('id', personId)
381
+ .single();
382
+ ```
383
+
384
+ #### Example 4: Organisation Memberships
385
+
386
+ **Before:**
387
+ ```typescript
388
+ const { data: memberships } = await supabase
389
+ .from('organisation_memberships')
390
+ .select('*')
391
+ .eq('organisation_id', orgId)
392
+ .eq('user_id', userId);
393
+ ```
394
+
395
+ **After:**
396
+ ```typescript
397
+ const { data: memberships } = await supabase
398
+ .from('core_organisation_memberships')
399
+ .select('*')
400
+ .eq('organisation_id', orgId)
401
+ .eq('user_id', userId);
402
+ ```
403
+
404
+ #### Example 5: File References
405
+
406
+ **Before:**
407
+ ```typescript
408
+ const { data: files } = await supabase
409
+ .from('file_references')
410
+ .select('*')
411
+ .eq('table_name', 'pace_person')
412
+ .eq('record_id', personId);
413
+ ```
414
+
415
+ **After:**
416
+ ```typescript
417
+ const { data: files } = await supabase
418
+ .from('core_file_references')
419
+ .select('*')
420
+ .eq('table_name', 'core_person') // Updated table_name value
421
+ .eq('record_id', personId);
422
+ ```
423
+
424
+ ---
425
+
426
+ ## Change 2: Person-Scoped Profiles Migration
427
+
428
+ **Migration:** `20251205211120_migrate_profiles_to_person_scoped.sql` + related migrations
429
+ **Date:** 2025-12-05
430
+ **Documentation:** See [Person-Scoped Profiles Migration Guide](./person-scoped-profiles-migration-guide.md)
431
+
432
+ ### Quick Summary
433
+
434
+ Profiles have been migrated from **organisation-scoped** to **person-scoped**:
435
+
436
+ - **One membership profile** (`core_member`) per person (regardless of organisation)
437
+ - **One medical profile** (`medi_profile`) per person
438
+ - **Multiple contact profiles** (`core_contact`) per person
439
+
440
+ ### Key Changes
441
+
442
+ 1. **Removed `organisation_id`** from:
443
+ - `core_member` (was `pace_member`)
444
+ - `medi_profile`
445
+ - `core_contact` (was `pace_contact`)
446
+ - Related tables: `medi_condition`, `medi_diet`, `medi_action_plan`, `core_consent`, `core_identification`, `core_qualification`
447
+
448
+ 2. **Removed `member_id`** from `core_contact` (now uses `person_id` directly)
449
+
450
+ 3. **Added unique constraint** on `core_member.person_id` (one membership per person)
451
+
452
+ ### Impact on Table Naming
453
+
454
+ Note that the person-scoped profiles migration happened **before** the table naming standardization. The tables were renamed as part of the standardization:
455
+
456
+ - `pace_member` → `core_member` (person-scoped, no `organisation_id`)
457
+ - `pace_contact` → `core_contact` (person-scoped, uses `person_id` instead of `member_id`)
458
+ - `pace_person` → `core_person`
459
+
460
+ ### Combined Migration Example
461
+
462
+ **Before (Old Schema):**
463
+ ```typescript
464
+ // ❌ Old table names + organisation-scoped
465
+ const { data } = await supabase
466
+ .from('pace_member')
467
+ .select('*')
468
+ .eq('person_id', personId)
469
+ .eq('organisation_id', orgId); // ❌ organisation_id no longer exists
470
+ ```
471
+
472
+ **After (New Schema):**
473
+ ```typescript
474
+ // ✅ New table names + person-scoped
475
+ const { data } = await supabase
476
+ .from('core_member')
477
+ .select('*')
478
+ .eq('person_id', personId); // ✅ No organisation_id needed
479
+ ```
480
+
481
+ ---
482
+
483
+ ## Complete Migration Checklist
484
+
485
+ ### Phase 1: Table Naming Updates
486
+
487
+ - [ ] Update all `from('organisations')` → `from('core_organisations')`
488
+ - [ ] Update all `from('event')` → `from('core_events')`
489
+ - [ ] Update all `from('file_references')` → `from('core_file_references')`
490
+ - [ ] Update all `from('pace_*')` → `from('core_*')`
491
+ - [ ] Update all `from('organisation_memberships')` → `from('core_organisation_memberships')`
492
+ - [ ] Update all `from('user_organisation_memberships')` → `from('core_organisation_memberships')`
493
+ - [ ] Update all `from('public_recipe_details')` → `from('cake_public_recipe_details')`
494
+ - [ ] Update all `.select()` joins to use new table names
495
+ - [ ] Update `table_name` values in file reference queries
496
+ - [ ] Regenerate TypeScript types
497
+
498
+ ### Phase 2: Person-Scoped Profiles Updates
499
+
500
+ - [ ] Remove `organisation_id` filters from profile table queries
501
+ - [ ] Update `pace_contact` queries to use `person_id` instead of `member_id`
502
+ - [ ] Update profile creation logic (no `organisation_id` needed)
503
+ - [ ] Review profile access patterns (person-scoped, not org-scoped)
504
+ - [ ] See [Person-Scoped Profiles Migration Guide](./person-scoped-profiles-migration-guide.md) for detailed checklist
505
+
506
+ ### Phase 3: Testing
507
+
508
+ - [ ] Test all database queries with new table names
509
+ - [ ] Test profile queries (person-scoped)
510
+ - [ ] Test file reference queries
511
+ - [ ] Test organisation membership queries
512
+ - [ ] Test event queries
513
+ - [ ] Verify RLS policies work correctly
514
+ - [ ] Test cross-organisation scenarios
515
+
516
+ ### Phase 4: Type Updates
517
+
518
+ - [ ] Regenerate TypeScript types from current schema
519
+ - [ ] Update all type references
520
+ - [ ] Fix TypeScript compilation errors
521
+ - [ ] Update interface definitions
522
+
523
+ ---
524
+
525
+ ## RPC Functions Reference
526
+
527
+ All RPC functions have been updated internally to use the new table names. Function signatures remain the same, so your RPC calls should continue to work without changes.
528
+
529
+ However, if you're using RPC functions that return data with table names (e.g., in `table_name` columns), ensure you handle the new table names correctly.
530
+
531
+ ### Updated RPC Functions
532
+
533
+ The following RPC functions now use new table names internally:
534
+
535
+ **File Reference Functions:**
536
+ - `data_file_reference_url_get`
537
+ - `data_file_reference_get`
538
+ - `data_file_reference_delete`
539
+ - `data_file_reference_create`
540
+
541
+ **Profile Functions:**
542
+ - `data_pace_member_profile_get`
543
+ - `data_pace_linked_profiles_list`
544
+ - `data_pace_contacts_list`
545
+ - `data_pace_contact_get`
546
+ - `app_pace_contact_update`
547
+
548
+ **Event Functions:**
549
+ - `data_user_events_get`
550
+ - `get_public_event_by_code`
551
+ - `check_user_event_access`
552
+ - `check_public_event_visible`
553
+
554
+ **Organisation Functions:**
555
+ - `data_user_organisations_get`
556
+ - `data_user_organisation_roles_get`
557
+ - `get_organisation_members`
558
+
559
+ **Application Functions:**
560
+ - `app_cake_dish_create`
561
+ - `app_cake_dish_update`
562
+ - `app_cake_unit_create`
563
+ - `app_base_application_create`
564
+
565
+ ---
566
+
567
+ ## Common Issues and Solutions
568
+
569
+ ### Issue 1: "relation does not exist"
570
+
571
+ **Error:**
572
+ ```
573
+ relation "organisations" does not exist
574
+ ```
575
+
576
+ **Solution:**
577
+ Update table name to `core_organisations`:
578
+ ```typescript
579
+ // ❌ Old
580
+ .from('organisations')
581
+
582
+ // ✅ New
583
+ .from('core_organisations')
584
+ ```
585
+
586
+ ### Issue 2: "column does not exist"
587
+
588
+ **Error:**
589
+ ```
590
+ column "organisation_id" does not exist in table "core_member"
591
+ ```
592
+
593
+ **Solution:**
594
+ Remove `organisation_id` filters from profile table queries. Profiles are now person-scoped:
595
+ ```typescript
596
+ // ❌ Old
597
+ .from('core_member')
598
+ .eq('organisation_id', orgId) // ❌ Column doesn't exist
599
+
600
+ // ✅ New
601
+ .from('core_member')
602
+ .eq('person_id', personId) // ✅ Person-scoped
603
+ ```
604
+
605
+ ### Issue 3: View not found
606
+
607
+ **Error:**
608
+ ```
609
+ relation "organisation_memberships" does not exist
610
+ ```
611
+
612
+ **Solution:**
613
+ Use the new unified view:
614
+ ```typescript
615
+ // ❌ Old
616
+ .from('organisation_memberships')
617
+
618
+ // ✅ New
619
+ .from('core_organisation_memberships')
620
+ ```
621
+
622
+ ### Issue 4: File reference table_name mismatch
623
+
624
+ **Error:**
625
+ ```
626
+ No file references found (table_name mismatch)
627
+ ```
628
+
629
+ **Solution:**
630
+ Update `table_name` values to use new table names:
631
+ ```typescript
632
+ // ❌ Old
633
+ .eq('table_name', 'pace_person')
634
+
635
+ // ✅ New
636
+ .eq('table_name', 'core_person')
637
+ ```
638
+
639
+ ---
640
+
641
+ ## Testing Recommendations
642
+
643
+ ### 1. Search and Replace Strategy
644
+
645
+ Use your IDE's search and replace to update table names:
646
+
647
+ 1. **Search for old table names:**
648
+ - `'organisations'` → `'core_organisations'`
649
+ - `'event'` → `'core_events'`
650
+ - `'pace_person'` → `'core_person'`
651
+ - `'pace_member'` → `'core_member'`
652
+ - etc.
653
+
654
+ 2. **Update view references:**
655
+ - `'organisation_memberships'` → `'core_organisation_memberships'`
656
+ - `'user_organisation_memberships'` → `'core_organisation_memberships'`
657
+
658
+ 3. **Update file reference table_name values:**
659
+ - `'pace_person'` → `'core_person'`
660
+ - `'event'` → `'core_events'`
661
+ - etc.
662
+
663
+ ### 2. TypeScript Type Regeneration
664
+
665
+ After migrations are applied:
666
+
667
+ ```bash
668
+ # Regenerate types from current schema
669
+ npx supabase gen types typescript --project-id <your-project-id> > src/types/database.generated.ts
670
+
671
+ # Fix any TypeScript errors
672
+ npm run type-check
673
+ ```
674
+
675
+ ### 3. Integration Testing
676
+
677
+ Test the following scenarios:
678
+
679
+ - [ ] Organisation queries
680
+ - [ ] Event queries
681
+ - [ ] Person/profile queries
682
+ - [ ] File reference queries
683
+ - [ ] Organisation membership queries
684
+ - [ ] Cross-organisation profile access
685
+ - [ ] RPC function calls
686
+
687
+ ### 4. RLS Policy Verification
688
+
689
+ Verify RLS policies work correctly:
690
+
691
+ - [ ] Organisation access checks
692
+ - [ ] Event access checks
693
+ - [ ] Person/profile access checks
694
+ - [ ] File reference access checks
695
+ - [ ] Membership view access
696
+
697
+ ---
698
+
699
+ ## Support and Questions
700
+
701
+ ### Migration Files
702
+
703
+ All migration files are located in:
704
+ - `supabase/migrations/20251206111258_standardize_table_naming_app_entity.sql`
705
+ - `supabase/migrations/20251205211120_migrate_profiles_to_person_scoped.sql`
706
+ - `supabase/migrations/20251205211121_schema_changes_person_scoped_profiles.sql`
707
+ - Related migration files in `supabase/migrations/`
708
+
709
+ ### Documentation
710
+
711
+ - [Person-Scoped Profiles Migration Guide](./person-scoped-profiles-migration-guide.md)
712
+ - [API & RPC Standard](../standards/02-api-and-rpc-standard.md)
713
+ - [Database Schema Requirements](../architecture/database-schema-requirements.md)
714
+
715
+ ### Getting Help
716
+
717
+ If you encounter issues:
718
+
719
+ 1. **Check Migration Status**: Verify all migrations are applied
720
+ 2. **Verify Types**: Regenerate TypeScript types from current schema
721
+ 3. **Review RLS**: Ensure RLS policies are correctly applied
722
+ 4. **Check Logs**: Review Supabase logs for errors
723
+ 5. **Search Codebase**: Use search to find all references to old table names
724
+
725
+ ---
726
+
727
+ ## Summary
728
+
729
+ **Key Takeaways:**
730
+
731
+ 1. **Table Naming:**
732
+ - All core tables → `core_*` prefix
733
+ - All PACE tables → `core_*` prefix
734
+ - Application tables → `{app}_*` prefix
735
+ - Update all queries to use new table names
736
+
737
+ 2. **Views:**
738
+ - `organisation_memberships` and `user_organisation_memberships` → `core_organisation_memberships`
739
+ - `public_recipe_details` → `cake_public_recipe_details`
740
+
741
+ 3. **Profiles:**
742
+ - Person-scoped (not organisation-scoped)
743
+ - Remove `organisation_id` from profile queries
744
+ - Use `person_id` instead of `member_id` for contacts
745
+
746
+ 4. **File References:**
747
+ - Update `table_name` values to use new table names
748
+
749
+ 5. **Types:**
750
+ - Regenerate TypeScript types after migrations
751
+
752
+ 6. **Testing:**
753
+ - Test all database queries
754
+ - Test profile access patterns
755
+ - Verify RLS policies work correctly
756
+
757
+ **Migration Order:**
758
+ 1. Apply person-scoped profiles migrations (Dec 5)
759
+ 2. Apply table naming standardization (Dec 6)
760
+ 3. Update code to use new table names
761
+ 4. Regenerate TypeScript types
762
+ 5. Test thoroughly
763
+
764
+ ---
765
+
766
+ **Last Updated:** 2025-12-06
767
+ **Version:** 0.5.190+
768
+