@jmruthers/pace-core 0.5.76 → 0.5.78

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