@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,964 +0,0 @@
1
- # PACE Core Documentation Style Guide
2
-
3
- This comprehensive style guide ensures consistency, clarity, and maintainability across all PACE Core documentation. This is the single source of truth for documentation standards.
4
-
5
- > **📚 Navigation:** [← Documentation Home](./README.md) | [Review Report](../DOCUMENTATION_REVIEW_REPORT.md)
6
-
7
- ---
8
-
9
- **Last Updated:** 2025-01-XX | **Version:** v0.5.65+
10
-
11
- ## 📋 Table of Contents
12
-
13
- 1. [Writing Principles](#writing-principles)
14
- 2. [Formatting Standards](#formatting-standards)
15
- 3. [Content Structure](#content-structure)
16
- 4. [Code Examples](#code-examples)
17
- 5. [Cross-References](#cross-references)
18
- 6. [Component Documentation](#component-documentation)
19
- 7. [API Reference Standards](#api-reference-standards)
20
- 8. [Troubleshooting Guidelines](#troubleshooting-guidelines)
21
- 9. [Maintenance Checklist](#maintenance-checklist)
22
- 10. [Quality Assurance](#quality-assurance)
23
-
24
- ## 📝 Writing Principles
25
-
26
- ### 1. Clarity First
27
- - **Use simple, clear language** - Avoid jargon and technical complexity
28
- - **Be specific** - Provide concrete examples and exact code snippets
29
- - **Explain the "why"** - Don't just show what to do, explain why it's important
30
- - **Use active voice** - "Create a component" not "A component should be created"
31
- - **Write for the user's context** - Consider their experience level and use case
32
-
33
- ### 2. Developer-Focused
34
- - **Start with practical examples** - Show working code first
35
- - **Provide complete examples** - Include imports, setup, and usage
36
- - **Include error handling** - Show how to handle common issues
37
- - **Use realistic data** - Use meaningful variable names and values
38
- - **Show the complete flow** - From installation to implementation
39
-
40
- ### 3. Consistent Structure
41
- - **Use consistent headings** - Follow the established hierarchy
42
- - **Standardize code blocks** - Use consistent formatting and syntax highlighting
43
- - **Maintain uniform examples** - Use consistent variable names and patterns
44
- - **Follow the template structure** - Use provided templates for consistency
45
-
46
- ## 🎨 Formatting Standards
47
-
48
- ### Headings
49
-
50
- ```markdown
51
- # Main Title (H1) - Only in README files
52
- ## Section Title (H2) - Major sections
53
- ### Subsection (H3) - Subsections
54
- #### Detail (H4) - Specific details
55
- ##### Note (H5) - Important notes
56
- ```
57
-
58
- ### Code Blocks
59
-
60
- **TypeScript/JavaScript:**
61
- ```tsx
62
- // ✅ Good - Complete, runnable example
63
- import { useCan } from '@jmruthers/pace-core';
64
-
65
- function UserActions({ userId, scope }) {
66
- const { hasPermission, isLoading } = useCan();
67
- const [canEdit, setCanEdit] = useState(false);
68
-
69
- useEffect(() => {
70
- const checkPermission = async () => {
71
- if (!isLoading) {
72
- const editPerm = await hasPermission('update:users', { userId, scope });
73
- setCanEdit(editPerm);
74
- }
75
- };
76
-
77
- checkPermission();
78
- }, [hasPermission, isLoading, userId, scope]);
79
-
80
- return (
81
- <div>
82
- {canEdit && <EditButton />}
83
- </div>
84
- );
85
- }
86
- ```
87
-
88
- **SQL:**
89
- ```sql
90
- -- ✅ Good - Clear, commented SQL
91
- SELECT
92
- user_id,
93
- organisation_id,
94
- role,
95
- status
96
- FROM rbac_organisation_roles
97
- WHERE user_id = 'user-123'
98
- AND organisation_id = 'org-456'
99
- AND status = 'active';
100
- ```
101
-
102
- ### Callouts and Alerts
103
-
104
- ```markdown
105
- > **📚 New Developer?** Start with the [Quick Start Guide](./quick-start.md) to get up and running in 5 minutes.
106
-
107
- > **🔄 Migrating?** If you're upgrading from the legacy RBAC system, see the [Migration Guide](./migration/rbac-migration.md) for step-by-step instructions.
108
-
109
- > **⚠️ Important**: Always include organisation context in permission checks.
110
-
111
- > **💡 Tip**: Use batch permission checking for better performance when checking multiple permissions.
112
- ```
113
-
114
- ### Lists and Bullets
115
-
116
- ```markdown
117
- - **Use bold for key terms** - Makes scanning easier
118
- - **Keep items parallel** - Use consistent grammar and structure
119
- - **Limit to 7 items** - Break longer lists into subsections
120
- - **Use numbered lists for steps** - When order matters
121
- ```
122
-
123
- ## 📚 Content Structure
124
-
125
- ### File Organisation
126
-
127
- ```
128
- docs/
129
- ├── README.md # Main entry point
130
- ├── INDEX.md # Complete documentation index
131
- ├── getting-started/ # Onboarding content
132
- │ ├── installation.md
133
- │ ├── quick-start.md
134
- │ └── examples/
135
- ├── core-concepts/ # Fundamental concepts
136
- │ ├── authentication.md
137
- │ ├── rbac-system.md
138
- │ └── permissions.md
139
- ├── rbac/ # RBAC module docs
140
- │ ├── README.md
141
- │ ├── quick-start.md
142
- │ ├── api-reference.md
143
- │ ├── examples.md
144
- │ ├── advanced-patterns.md
145
- │ └── troubleshooting.md
146
- ├── implementation-guides/ # Practical guides
147
- │ ├── app-layout.md
148
- │ ├── permission-enforcement.md
149
- │ ├── data-tables.md
150
- │ ├── file-upload-storage.md # NEW
151
- │ ├── inactivity-tracking.md # NEW
152
- │ ├── organisation-security.md # NEW
153
- │ └── public-pages-advanced.md # NEW
154
- ├── api-reference/ # Complete API docs
155
- │ ├── components.md
156
- │ ├── hooks.md
157
- │ └── types.md
158
- ├── best-practices/ # Production patterns
159
- │ ├── security.md
160
- │ ├── performance.md
161
- │ └── testing.md
162
- ├── migration/ # Migration guides
163
- │ ├── MIGRATION_GUIDE.md # NEW - Unified guide
164
- │ └── rbac-migration.md
165
- └── troubleshooting/ # Problem solving
166
- ├── common-issues.md
167
- └── debugging.md
168
- ```
169
-
170
- ### File Naming Conventions
171
-
172
- **Implementation Guides:**
173
- - `kebab-case.md` - Use hyphens for multi-word files
174
- - `feature-name.md` - Descriptive, feature-focused names
175
- - `advanced-feature-name.md` - For advanced/comprehensive guides
176
-
177
- **API Reference:**
178
- - `components.md` - Plural for main API files
179
- - `hooks.md` - Plural for hook collections
180
- - `types.md` - Plural for type collections
181
-
182
- **Migration Guides:**
183
- - `MIGRATION_GUIDE.md` - All caps for main reference
184
- - `v0.4.17-source-path-fix.md` - Version-specific with descriptive name
185
- - `rbac-migration.md` - Feature-specific migration
186
-
187
- **Troubleshooting:**
188
- - `common-issues.md` - General troubleshooting
189
- - `specific-issue-name.md` - Specific problem guides
190
-
191
- ### Standard Sections
192
-
193
- Each documentation file should include:
194
-
195
- 1. **Title and Description** - Clear purpose and overview
196
- 2. **Prerequisites** - What readers need to know first
197
- 3. **Quick Start** - Get up and running quickly
198
- 4. **Detailed Guide** - Comprehensive coverage
199
- 5. **Examples** - Practical, working examples
200
- 6. **API Reference** - Complete technical details
201
- 7. **Troubleshooting** - Common issues and solutions
202
- 8. **Next Steps** - What to read next
203
-
204
- ## 💻 Code Examples
205
-
206
- ### Example Standards
207
-
208
- 1. **Complete and Runnable**
209
- ```tsx
210
- // ✅ Good - Complete example with imports
211
- import React, { useState, useEffect } from 'react';
212
- import { useCan } from '@jmruthers/pace-core';
213
-
214
- function UserActions({ userId, scope }) {
215
- const { hasPermission, isLoading } = useCan();
216
- const [canEdit, setCanEdit] = useState(false);
217
-
218
- useEffect(() => {
219
- const checkPermission = async () => {
220
- if (!isLoading) {
221
- const editPerm = await hasPermission('update:users', { userId, scope });
222
- setCanEdit(editPerm);
223
- }
224
- };
225
-
226
- checkPermission();
227
- }, [hasPermission, isLoading, userId, scope]);
228
-
229
- if (isLoading) return <div>Loading permissions...</div>;
230
-
231
- return (
232
- <div>
233
- {canEdit && <button>Edit User</button>}
234
- </div>
235
- );
236
- }
237
- ```
238
-
239
- 2. **Error Handling Included**
240
- ```tsx
241
- // ✅ Good - Includes error handling
242
- try {
243
- const canEdit = await hasPermission('update:users', { userId, scope });
244
- setCanEdit(canEdit);
245
- } catch (error) {
246
- console.error('Permission check failed:', error);
247
- setCanEdit(false);
248
- }
249
- ```
250
-
251
- 3. **Consistent Naming**
252
- ```tsx
253
- // ✅ Good - Consistent variable names
254
- const userId = 'user-123';
255
- const scope = { organisationId: 'org-456' };
256
- const permission = 'update:users';
257
- ```
258
-
259
- ### Code Block Guidelines
260
-
261
- - **Use TypeScript** - Always use `.tsx` for React components
262
- - **Include imports** - Show all necessary imports
263
- - **Add comments** - Explain complex logic
264
- - **Handle edge cases** - Show loading states, error handling
265
- - **Use realistic data** - Use meaningful variable names and values
266
-
267
- ## 🔗 Cross-References
268
-
269
- ### Internal Links
270
-
271
- ```markdown
272
- <!-- ✅ Good - Clear, descriptive links -->
273
- See the [RBAC Quick Start Guide](./rbac/quick-start.md) for a complete example.
274
-
275
- <!-- ❌ Avoid - Vague links -->
276
- See [this guide](./rbac/quick-start.md) for more info.
277
- ```
278
-
279
- ### Link Patterns
280
-
281
- - **Use descriptive text** - Link text should explain what the reader will find
282
- - **Keep links current** - Update links when files are moved or renamed
283
- - **Use relative paths** - Use `./` for same directory, `../` for parent directory
284
- - **Test all links** - Verify links work before publishing
285
-
286
- ## 🧩 Component Documentation
287
-
288
- ### Component Structure
289
-
290
- Each component should be documented with:
291
-
292
- 1. **Overview** - What the component does
293
- 2. **Props** - Complete prop interface with types
294
- 3. **Usage** - Basic usage example
295
- 4. **Variants** - Different variants and states
296
- 5. **Accessibility** - Accessibility features and requirements
297
- 6. **Examples** - Practical usage examples
298
- 7. **Troubleshooting** - Common issues and solutions
299
-
300
- ### Example Component Documentation
301
-
302
- ```markdown
303
- ## Button
304
-
305
- A versatile button component with multiple variants and states.
306
-
307
- ### Props
308
-
309
- ```typescript
310
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
311
- variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
312
- size?: 'default' | 'sm' | 'lg' | 'icon';
313
- asChild?: boolean;
314
- className?: string;
315
- }
316
- ```
317
-
318
- ### Usage
319
-
320
- ```tsx
321
- import { Button } from '@jmruthers/pace-core';
322
-
323
- // Default button
324
- <Button onClick={handleClick}>
325
- Click me
326
- </Button>
327
-
328
- // Destructive button
329
- <Button variant="destructive" size="lg">
330
- Delete
331
- </Button>
332
- ```
333
-
334
- ### Variants
335
-
336
- - **default**: Primary button with solid background
337
- - **destructive**: Red button for dangerous actions
338
- - **outline**: Bordered button with transparent background
339
- - **secondary**: Secondary button with muted styling
340
- - **ghost**: Transparent button with hover effects
341
- - **link**: Button styled as a link
342
-
343
- ### Accessibility
344
-
345
- - Supports keyboard navigation
346
- - Proper ARIA attributes
347
- - Focus management
348
- - Screen reader support
349
- ```
350
-
351
- ## 📋 API Reference Standards
352
-
353
- ### Hook Documentation
354
-
355
- ```markdown
356
- ## useCan
357
-
358
- Hook for checking user permissions with caching and error handling.
359
-
360
- ### Signature
361
-
362
- ```typescript
363
- function useCan(): {
364
- hasPermission: (permission: Permission, scope?: Scope) => Promise<boolean>;
365
- hasAnyPermission: (permissions: Permission[], scope?: Scope) => Promise<boolean>;
366
- hasAllPermissions: (permissions: Permission[], scope?: Scope) => Promise<boolean>;
367
- isLoading: boolean;
368
- error: Error | null;
369
- }
370
- ```
371
-
372
- ### Parameters
373
-
374
- - **permission**: The permission to check
375
- - **scope**: Optional scope context (organisation, event, etc.)
376
-
377
- ### Returns
378
-
379
- - **hasPermission**: Function to check a single permission
380
- - **hasAnyPermission**: Function to check if user has any of the permissions
381
- - **hasAllPermissions**: Function to check if user has all permissions
382
- - **isLoading**: Whether the permission check is in progress
383
- - **error**: Any error that occurred during the check
384
-
385
- ### Example
386
-
387
- ```tsx
388
- import { useCan } from '@jmruthers/pace-core';
389
-
390
- function UserActions({ userId }) {
391
- const { hasPermission, isLoading } = useCan();
392
- const [canEdit, setCanEdit] = useState(false);
393
-
394
- useEffect(() => {
395
- const checkPermission = async () => {
396
- const editPerm = await hasPermission('update:users', { userId });
397
- setCanEdit(editPerm);
398
- };
399
-
400
- checkPermission();
401
- }, [hasPermission, userId]);
402
-
403
- if (isLoading) return <div>Loading...</div>;
404
-
405
- return (
406
- <div>
407
- {canEdit && <EditButton />}
408
- </div>
409
- );
410
- }
411
- ```
412
- ```
413
-
414
- ## 🆘 Troubleshooting Guidelines
415
-
416
- ### Common Issues Structure
417
-
418
- ```markdown
419
- ## Common Issues
420
-
421
- ### Issue: Permission Check Always Returns False
422
-
423
- **Symptoms:**
424
- - Permission checks return false even for valid permissions
425
- - No error messages are displayed
426
-
427
- **Causes:**
428
- 1. Missing organisation context
429
- 2. Incorrect permission format
430
- 3. User not authenticated
431
-
432
- **Solutions:**
433
-
434
- 1. **Check Organisation Context**
435
- ```tsx
436
- // ❌ Wrong - Missing organisation context
437
- const canEdit = await hasPermission('update:users');
438
-
439
- // ✅ Correct - Include organisation context
440
- const canEdit = await hasPermission('update:users', {
441
- organisationId: currentOrganisation.id
442
- });
443
- ```
444
-
445
- 2. **Verify Permission Format**
446
- ```tsx
447
- // ❌ Wrong - Incorrect format
448
- const canEdit = await hasPermission('update users');
449
-
450
- // ✅ Correct - Use colon format
451
- const canEdit = await hasPermission('update:users');
452
- ```
453
-
454
- 3. **Check Authentication**
455
- ```tsx
456
- const { user, isLoading } = useUnifiedAuth();
457
-
458
- if (isLoading) return <div>Loading...</div>;
459
- if (!user) return <div>Please log in</div>;
460
- ```
461
-
462
- **Prevention:**
463
- - Always include organisation context in permission checks
464
- - Use TypeScript for permission type safety
465
- - Test permission checks in development
466
- ```
467
-
468
- ## 🔧 Maintenance Checklist
469
-
470
- ### Before Publishing
471
-
472
- - [ ] **Accuracy** - All code examples work and are current
473
- - [ ] **Completeness** - All necessary information is included
474
- - [ ] **Clarity** - Content is easy to understand
475
- - [ ] **Consistency** - Follows style guide and patterns
476
- - [ ] **Code examples** - All code is tested and working
477
- - [ ] **Links** - All internal and external links work
478
- - [ ] **Formatting** - Consistent markdown formatting
479
- - [ ] **Images** - All images are optimized and accessible
480
- - [ ] **Navigation** - Clear path through the content
481
- - [ ] **Examples** - Practical, real-world examples
482
- - [ ] **Troubleshooting** - Common issues are addressed
483
- - [ ] **Next steps** - Clear guidance on what to do next
484
-
485
- ### Regular Updates
486
-
487
- 1. **Review quarterly** - Check for outdated information
488
- 2. **Update examples** - Ensure code examples work with current versions
489
- 3. **Test links** - Verify all links are still valid
490
- 4. **Gather feedback** - Ask developers about confusing sections
491
-
492
- ### Version Control
493
-
494
- - **Update with code changes** - Documentation should reflect current implementation
495
- - **Maintain changelog** - Track documentation changes
496
- - **Test before merging** - Verify all examples work
497
- - **Review with team** - Get feedback from other developers
498
-
499
- ## 🎯 Quality Assurance
500
-
501
- ### Content Review
502
-
503
- 1. **Technical Accuracy**
504
- - All code examples compile and run
505
- - API references match actual implementation
506
- - Import paths are correct
507
- - Environment variables are accurate
508
-
509
- 2. **Completeness**
510
- - All exported components are documented
511
- - All hooks have usage examples
512
- - All props are documented with types
513
- - Common use cases are covered
514
-
515
- 3. **Consistency**
516
- - Terminology is consistent throughout
517
- - Code examples follow the same patterns
518
- - Formatting is uniform
519
- - Cross-references are accurate
520
-
521
- 4. **User Experience**
522
- - Clear navigation path
523
- - Practical examples
524
- - Troubleshooting guidance
525
- - Next steps provided
526
-
527
- ### Testing Process
528
-
529
- 1. **Code Examples** - Test all code examples in isolation
530
- 2. **Links** - Verify all internal and external links
531
- 3. **Cross-References** - Check all cross-references are accurate
532
- 4. **Import Paths** - Verify all import paths work
533
- 5. **Environment Variables** - Check environment variable names
534
-
535
- ### Review Process
536
-
537
- 1. **Self-Review** - Author reviews against checklist
538
- 2. **Technical Review** - Another developer reviews for accuracy
539
- 3. **User Testing** - Test with new developers
540
- 4. **Final Review** - Final check before publishing
541
-
542
- ## 📊 Metrics and Monitoring
543
-
544
- ### Documentation Health
545
-
546
- - **Broken Links** - Monitor and fix broken links
547
- - **Outdated Examples** - Track examples that need updates
548
- - **User Feedback** - Collect and act on user feedback
549
- - **Search Success** - Monitor search success rates
550
-
551
- ### Improvement Areas
552
-
553
- - **Common Questions** - Document frequently asked questions
554
- - **Pain Points** - Address common developer pain points
555
- - **Missing Content** - Identify and fill content gaps
556
- - **Outdated Information** - Keep information current
557
-
558
- ## 📋 Documentation Templates
559
-
560
- ### Implementation Guide Template
561
-
562
- ```markdown
563
- # [Feature Name]
564
-
565
- > **📝 Brief Description** | [← Back to Documentation](../README.md) | [↑ Table of Contents](#table-of-contents)
566
-
567
- [Brief overview of the feature and its purpose]
568
-
569
- ## Overview
570
-
571
- [Detailed explanation of what the feature does and why it's useful]
572
-
573
- ## Quick Start
574
-
575
- ### 1. Basic Usage
576
-
577
- ```tsx
578
- // Complete working example
579
- import { ComponentName } from '@jmruthers/pace-core';
580
-
581
- function MyComponent() {
582
- return <ComponentName />;
583
- }
584
- ```
585
-
586
- ### 2. [Advanced Usage Pattern]
587
-
588
- ```tsx
589
- // More complex example
590
- ```
591
-
592
- ## Components
593
-
594
- ### [ComponentName]
595
-
596
- [Description of component]
597
-
598
- #### Props
599
-
600
- ```typescript
601
- interface ComponentProps {
602
- // Props interface
603
- }
604
- ```
605
-
606
- #### Usage Examples
607
-
608
- [Multiple usage examples]
609
-
610
- ## Hooks
611
-
612
- ### [useHookName]
613
-
614
- [Description of hook]
615
-
616
- #### Interface
617
-
618
- ```typescript
619
- interface UseHookReturn {
620
- // Return type interface
621
- }
622
- ```
623
-
624
- #### Usage Examples
625
-
626
- [Multiple usage examples]
627
-
628
- ## [Additional Sections]
629
-
630
- [Feature-specific sections]
631
-
632
- ## Troubleshooting
633
-
634
- ### Common Issues
635
-
636
- [Common problems and solutions]
637
-
638
- ## Next Steps
639
-
640
- - [Related documentation links]
641
- ```
642
-
643
- ### API Reference Template
644
-
645
- ```markdown
646
- # [API Section] API Reference
647
-
648
- > **📚 Complete API Reference** | [← Back to Documentation](../README.md) | [↑ Table of Contents](#table-of-contents)
649
-
650
- [Brief description of the API section]
651
-
652
- ## [Item Name]
653
-
654
- [Description of the item]
655
-
656
- ### Props/Interface
657
-
658
- ```typescript
659
- interface ItemProps {
660
- // Interface definition
661
- }
662
- ```
663
-
664
- ### Usage
665
-
666
- ```tsx
667
- // Basic usage example
668
- ```
669
-
670
- ### [Additional Sections]
671
-
672
- [Item-specific sections]
673
- ```
674
-
675
- ### Migration Guide Template
676
-
677
- ```markdown
678
- # Migration Guide: [Version/Feature]
679
-
680
- > **🔄 Migration Instructions** | [← Back to Documentation](../README.md) | [↑ Table of Contents](#table-of-contents)
681
-
682
- [Brief description of what changed and why migration is needed]
683
-
684
- ## Overview
685
-
686
- [Detailed explanation of changes]
687
-
688
- ## Breaking Changes
689
-
690
- [List of breaking changes]
691
-
692
- ## Migration Steps
693
-
694
- ### 1. [Step Name]
695
-
696
- [Detailed step instructions]
697
-
698
- ### 2. [Step Name]
699
-
700
- [Detailed step instructions]
701
-
702
- ## Code Examples
703
-
704
- ### Before
705
-
706
- ```tsx
707
- // Old code
708
- ```
709
-
710
- ### After
711
-
712
- ```tsx
713
- // New code
714
- ```
715
-
716
- ## Troubleshooting
717
-
718
- ### Common Issues
719
-
720
- [Common migration problems and solutions]
721
-
722
- ## Next Steps
723
-
724
- [What to do after migration]
725
- ```
726
-
727
- ### Troubleshooting Guide Template
728
-
729
- ```markdown
730
- # [Issue Category] Troubleshooting
731
-
732
- > **🆘 Problem Solving** | [← Back to Documentation](../README.md) | [↑ Table of Contents](#table-of-contents)
733
-
734
- [Brief description of the issue category]
735
-
736
- ## Common Issues
737
-
738
- ### Issue: [Problem Description]
739
-
740
- **Symptoms:**
741
- - [Symptom 1]
742
- - [Symptom 2]
743
-
744
- **Causes:**
745
- 1. [Cause 1]
746
- 2. [Cause 2]
747
-
748
- **Solutions:**
749
-
750
- 1. **[Solution Name]**
751
- ```tsx
752
- // Code solution
753
- ```
754
-
755
- 2. **[Solution Name]**
756
- ```bash
757
- # Command solution
758
- ```
759
-
760
- **Prevention:**
761
- - [Prevention tip 1]
762
- - [Prevention tip 2]
763
-
764
- ## Debug Mode
765
-
766
- [How to enable debug mode]
767
-
768
- ## Getting Help
769
-
770
- [Additional resources]
771
- ```
772
-
773
- ## 🎯 Naming Conventions
774
-
775
- ### File Names
776
- - **Implementation guides**: `kebab-case.md` (e.g., `file-upload-storage.md`)
777
- - **API references**: `plural-noun.md` (e.g., `components.md`, `hooks.md`)
778
- - **Migration guides**: `MIGRATION_GUIDE.md` or `v0.4.17-feature-name.md`
779
- - **Troubleshooting**: `common-issues.md` or `specific-issue-name.md`
780
-
781
- ### Section Headings
782
- - **Use sentence case** - "Quick Start" not "Quick start"
783
- - **Be descriptive** - "File Upload & Storage System" not "Files"
784
- - **Use consistent hierarchy** - H2 for main sections, H3 for subsections
785
-
786
- ### Code Examples
787
- - **Use realistic names** - `userId`, `organisationId`, `permission`
788
- - **Be consistent** - Same variable names across all examples
789
- - **Use meaningful values** - `'user-123'` not `'test'`
790
-
791
- ### Cross-References
792
- - **Use descriptive link text** - "RBAC Quick Start Guide" not "this guide"
793
- - **Keep links current** - Update when files move
794
- - **Use relative paths** - `./file.md` for same directory
795
-
796
- ## 📌 Quick Reference Standards
797
-
798
- ### Essential Information Always Include
799
-
800
- Every documentation file should start with:
801
-
802
- ```markdown
803
- # [Feature Name]
804
-
805
- > **🎯 Use Case**: When to use this
806
- > **⏱️ Time Required**: How long to implement
807
- > **Prerequisites**: What you need to know first
808
-
809
- [Brief overview - one paragraph]
810
- ```
811
-
812
- ### Standard File Structure
813
-
814
- Every guide should include:
815
-
816
- 1. **Quick Start** - Complete, runnable code example that works immediately
817
- 2. **Detailed Guide** - Comprehensive coverage
818
- 3. **Examples** - Multiple real-world examples
819
- 4. **Troubleshooting** - Common issues and solutions
820
- 5. **Next Steps** - Links to related documentation
821
-
822
- ## 📋 Pre-Publishing Checklist
823
-
824
- Before publishing any documentation, verify:
825
-
826
- ### Content Quality
827
- - [ ] **Completeness**: All necessary information included
828
- - [ ] **Accuracy**: Information is current and correct
829
- - [ ] **Clarity**: Language is clear and accessible
830
- - [ ] **Consistency**: Follows style guide and conventions
831
-
832
- ### Code Examples
833
- - [ ] **Complete Examples** - All code examples are runnable and complete
834
- - [ ] **Error Handling** - Examples include proper error handling
835
- - [ ] **TypeScript** - All examples use TypeScript with proper types
836
- - [ ] **Imports** - All necessary imports are shown
837
- - [ ] **Comments** - Complex logic is explained with comments
838
- - [ ] **Best Practices** - Examples follow PACE Core best practices
839
-
840
- ### Navigation & Cross-References
841
- - [ ] **Navigation**: Proper breadcrumbs and cross-references
842
- - [ ] **Version Metadata**: Up-to-date version information
843
- - [ ] **Links**: All internal and external links verified
844
- - [ ] **Headings**: Proper heading hierarchy (H1 → H2 → H3)
845
-
846
- ### Formatting & Structure
847
- - [ ] **Headings**: Use proper heading hierarchy
848
- - [ ] **Lists**: Use consistent list formatting
849
- - [ ] **Code Blocks**: Use proper language tags
850
- - [ ] **Tables**: Use proper table formatting
851
- - [ ] **Accessibility**: Proper formatting for screen readers
852
-
853
- ### Review Process
854
- - [ ] **Self-Review**: Read aloud for clarity, test all examples
855
- - [ ] **Link Check**: Verify all links work
856
- - [ ] **Spell Check**: Use spell check tools
857
- - [ ] **Grammar Check**: Use grammar check tools
858
-
859
- ---
860
-
861
- ## 🔄 Maintenance Procedures
862
-
863
- ### When to Update Documentation
864
-
865
- **Automatically Update**:
866
- - When introducing breaking changes
867
- - When adding new features
868
- - When fixing bugs that affect documented behavior
869
- - When deprecating functionality
870
-
871
- **Regularly Review**:
872
- - Quarterly comprehensive audit
873
- - Monthly link verification
874
- - After major version releases
875
-
876
- ### Deprecation Process
877
-
878
- ```markdown
879
- > **⚠️ Deprecated**: This pattern is deprecated as of v0.5.65
880
-
881
- ## Deprecated Pattern
882
-
883
- [Old way - marked as deprecated]
884
-
885
- ## Recommended Replacement
886
-
887
- [New way - with migration guide]
888
-
889
- See [Migration Guide](./migration/) for details.
890
- ```
891
-
892
- ### Version References
893
-
894
- Always include version information:
895
-
896
- ```markdown
897
- > **Version**: 0.5.65+
898
- > **Breaking Changes**: None
899
- > **New Features**: Auto-save functionality
900
-
901
- > **Version**: v2.0.0+
902
- > **Breaking Changes**: Service architecture changes
903
- > **Migration Required**: Yes - see [Migration Guide](./migration/)
904
- ```
905
-
906
- ## 🤖 Documentation Automation
907
-
908
- ### Recommended Tools
909
-
910
- 1. **Link Checking**: Automatic broken link detection
911
- 2. **Code Validation**: Test code examples
912
- 3. **Spell Checking**: Automated grammar/spell check
913
- 4. **Version Checking**: Ensure version references are current
914
-
915
- ### CI/CD Integration
916
-
917
- ```yaml
918
- # Example GitHub Actions workflow
919
- name: Documentation Checks
920
-
921
- on: [push, pull_request]
922
-
923
- jobs:
924
- docs:
925
- runs-on: ubuntu-latest
926
- steps:
927
- - uses: actions/checkout@v3
928
- - run: npm install
929
- - run: npm run docs:check # Check all examples
930
- - run: npm run docs:links # Check all links
931
- - run: npm run docs:spell # Spell check
932
- ```
933
-
934
- ## 📊 Metrics and Success
935
-
936
- ### Quality Metrics
937
-
938
- **Quantitative**:
939
- - 100% of exported features documented
940
- - 100% of code examples runnable
941
- - 0 broken internal links
942
- - 95%+ terminology consistency
943
-
944
- **Qualitative**:
945
- - Developer feedback scores
946
- - Time to first success
947
- - Support ticket reduction
948
- - Onboarding completion rate
949
-
950
- ### Improvement Process
951
-
952
- 1. **Collect Feedback**: Developer surveys, support tickets
953
- 2. **Analyze Issues**: Identify pain points
954
- 3. **Plan Updates**: Prioritize improvements
955
- 4. **Implement Changes**: Update documentation
956
- 5. **Measure Impact**: Track improvements
957
-
958
- ---
959
-
960
- This comprehensive style guide ensures that PACE Core documentation is consistent, helpful, and maintainable. Follow these guidelines to create excellent developer documentation that helps users succeed with the library.
961
-
962
- **Related Resources**:
963
- - [Documentation Style Checklist](./documentation-style-checklist.md) - Quick checklist for reviews
964
- - [Quick Reference](./quick-reference.md) - Common patterns and examples