@jmruthers/pace-core 0.5.189 → 0.5.190

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 (420) hide show
  1. package/core-usage-manifest.json +0 -4
  2. package/dist/{AuthService-B-cd2MA4.d.ts → AuthService-CbP_utw2.d.ts} +7 -3
  3. package/dist/{DataTable-GUFUNZ3N.js → DataTable-ON3IXISJ.js} +8 -8
  4. package/dist/{PublicPageProvider-B8HaLe69.d.ts → PublicPageProvider-C4uxosp6.d.ts} +83 -24
  5. package/dist/{UnifiedAuthProvider-BG0AL5eE.d.ts → UnifiedAuthProvider-BYA9qB-o.d.ts} +4 -3
  6. package/dist/{UnifiedAuthProvider-643PUAIM.js → UnifiedAuthProvider-X5NXANVI.js} +4 -2
  7. package/dist/{api-YP7XD5L6.js → api-I6UCQ5S6.js} +4 -2
  8. package/dist/{chunk-DDM4CCYT.js → chunk-4QYC5L4K.js} +60 -35
  9. package/dist/chunk-4QYC5L4K.js.map +1 -0
  10. package/dist/{chunk-IM4QE42D.js → chunk-73HSNNOQ.js} +141 -326
  11. package/dist/chunk-73HSNNOQ.js.map +1 -0
  12. package/dist/{chunk-YHCN776L.js → chunk-DZWK57KZ.js} +2 -75
  13. package/dist/chunk-DZWK57KZ.js.map +1 -0
  14. package/dist/{chunk-3GOZZZYH.js → chunk-HQVPB5MZ.js} +238 -301
  15. package/dist/chunk-HQVPB5MZ.js.map +1 -0
  16. package/dist/{chunk-THRPYOFK.js → chunk-HW3OVDUF.js} +5 -5
  17. package/dist/chunk-HW3OVDUF.js.map +1 -0
  18. package/dist/{chunk-F2IMUDXZ.js → chunk-I7PSE6JW.js} +75 -2
  19. package/dist/chunk-I7PSE6JW.js.map +1 -0
  20. package/dist/{chunk-VGZZXKBR.js → chunk-J2XXC7R5.js} +280 -52
  21. package/dist/chunk-J2XXC7R5.js.map +1 -0
  22. package/dist/{chunk-UCQSRW7Z.js → chunk-NIU6J6OX.js} +425 -378
  23. package/dist/chunk-NIU6J6OX.js.map +1 -0
  24. package/dist/{chunk-HESYZWZW.js → chunk-QWWZ5CAQ.js} +2 -2
  25. package/dist/{chunk-HEHYGYOX.js → chunk-RUYZKXOD.js} +401 -46
  26. package/dist/chunk-RUYZKXOD.js.map +1 -0
  27. package/dist/{chunk-2UUZZJFT.js → chunk-SDMHPX3X.js} +176 -160
  28. package/dist/{chunk-2UUZZJFT.js.map → chunk-SDMHPX3X.js.map} +1 -1
  29. package/dist/{chunk-MX64ZF6I.js → chunk-STYK4OH2.js} +11 -11
  30. package/dist/chunk-STYK4OH2.js.map +1 -0
  31. package/dist/{chunk-YGPFYGA6.js → chunk-VVBAW5A5.js} +822 -498
  32. package/dist/chunk-VVBAW5A5.js.map +1 -0
  33. package/dist/chunk-Y4BUBBHD.js +614 -0
  34. package/dist/chunk-Y4BUBBHD.js.map +1 -0
  35. package/dist/{chunk-SAUPYVLF.js → chunk-ZSAAAMVR.js} +1 -1
  36. package/dist/chunk-ZSAAAMVR.js.map +1 -0
  37. package/dist/components.d.ts +3 -4
  38. package/dist/components.js +19 -19
  39. package/dist/components.js.map +1 -1
  40. package/dist/eslint-rules/pace-core-compliance.cjs +0 -2
  41. package/dist/{file-reference-D037xOFK.d.ts → file-reference-BavO2eQj.d.ts} +13 -10
  42. package/dist/hooks.d.ts +10 -5
  43. package/dist/hooks.js +14 -8
  44. package/dist/hooks.js.map +1 -1
  45. package/dist/index.d.ts +13 -11
  46. package/dist/index.js +79 -69
  47. package/dist/index.js.map +1 -1
  48. package/dist/providers.d.ts +3 -3
  49. package/dist/providers.js +3 -1
  50. package/dist/rbac/index.d.ts +76 -12
  51. package/dist/rbac/index.js +12 -9
  52. package/dist/types.d.ts +1 -1
  53. package/dist/types.js +1 -1
  54. package/dist/{usePublicRouteParams-CTDELQ7H.d.ts → usePublicRouteParams-DxIDS4bC.d.ts} +16 -9
  55. package/dist/utils.js +16 -16
  56. package/docs/README.md +2 -2
  57. package/docs/api/classes/ColumnFactory.md +1 -1
  58. package/docs/api/classes/ErrorBoundary.md +1 -1
  59. package/docs/api/classes/InvalidScopeError.md +2 -2
  60. package/docs/api/classes/Logger.md +1 -1
  61. package/docs/api/classes/MissingUserContextError.md +2 -2
  62. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  63. package/docs/api/classes/PermissionDeniedError.md +1 -1
  64. package/docs/api/classes/RBACAuditManager.md +1 -1
  65. package/docs/api/classes/RBACCache.md +1 -1
  66. package/docs/api/classes/RBACEngine.md +4 -4
  67. package/docs/api/classes/RBACError.md +1 -1
  68. package/docs/api/classes/RBACNotInitializedError.md +2 -2
  69. package/docs/api/classes/SecureSupabaseClient.md +21 -16
  70. package/docs/api/classes/StorageUtils.md +7 -4
  71. package/docs/api/enums/FileCategory.md +1 -1
  72. package/docs/api/enums/LogLevel.md +1 -1
  73. package/docs/api/enums/RBACErrorCode.md +1 -1
  74. package/docs/api/enums/RPCFunction.md +1 -1
  75. package/docs/api/interfaces/AddressFieldProps.md +1 -1
  76. package/docs/api/interfaces/AddressFieldRef.md +1 -1
  77. package/docs/api/interfaces/AggregateConfig.md +1 -1
  78. package/docs/api/interfaces/AutocompleteOptions.md +1 -1
  79. package/docs/api/interfaces/AvatarProps.md +1 -1
  80. package/docs/api/interfaces/BadgeProps.md +1 -1
  81. package/docs/api/interfaces/ButtonProps.md +1 -1
  82. package/docs/api/interfaces/CalendarProps.md +20 -6
  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/ComplianceResult.md +1 -1
  87. package/docs/api/interfaces/DataAccessRecord.md +9 -9
  88. package/docs/api/interfaces/DataRecord.md +1 -1
  89. package/docs/api/interfaces/DataTableAction.md +1 -1
  90. package/docs/api/interfaces/DataTableColumn.md +1 -1
  91. package/docs/api/interfaces/DataTableProps.md +1 -1
  92. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  93. package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
  94. package/docs/api/interfaces/DatabaseIssue.md +1 -1
  95. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  96. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  97. package/docs/api/interfaces/EventAppRoleData.md +1 -1
  98. package/docs/api/interfaces/ExportColumn.md +1 -1
  99. package/docs/api/interfaces/ExportOptions.md +1 -1
  100. package/docs/api/interfaces/FileDisplayProps.md +62 -16
  101. package/docs/api/interfaces/FileMetadata.md +1 -1
  102. package/docs/api/interfaces/FileReference.md +2 -2
  103. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  104. package/docs/api/interfaces/FileUploadOptions.md +26 -12
  105. package/docs/api/interfaces/FileUploadProps.md +30 -19
  106. package/docs/api/interfaces/FooterProps.md +1 -1
  107. package/docs/api/interfaces/FormFieldProps.md +1 -1
  108. package/docs/api/interfaces/FormProps.md +1 -1
  109. package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
  110. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  111. package/docs/api/interfaces/InputProps.md +1 -1
  112. package/docs/api/interfaces/LabelProps.md +1 -1
  113. package/docs/api/interfaces/LoggerConfig.md +1 -1
  114. package/docs/api/interfaces/LoginFormProps.md +1 -1
  115. package/docs/api/interfaces/NavigationAccessRecord.md +10 -10
  116. package/docs/api/interfaces/NavigationContextType.md +9 -9
  117. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  118. package/docs/api/interfaces/NavigationItem.md +1 -1
  119. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  120. package/docs/api/interfaces/NavigationProviderProps.md +7 -7
  121. package/docs/api/interfaces/Organisation.md +1 -1
  122. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  123. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  124. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  125. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  126. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  127. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  128. package/docs/api/interfaces/PageAccessRecord.md +8 -8
  129. package/docs/api/interfaces/PagePermissionContextType.md +8 -8
  130. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  131. package/docs/api/interfaces/PagePermissionProviderProps.md +7 -7
  132. package/docs/api/interfaces/PaletteData.md +1 -1
  133. package/docs/api/interfaces/ParsedAddress.md +1 -1
  134. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  135. package/docs/api/interfaces/ProgressProps.md +3 -11
  136. package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
  137. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  138. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  139. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  140. package/docs/api/interfaces/QuickFix.md +1 -1
  141. package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
  142. package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
  143. package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
  144. package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
  145. package/docs/api/interfaces/RBACConfig.md +1 -1
  146. package/docs/api/interfaces/RBACContext.md +1 -1
  147. package/docs/api/interfaces/RBACLogger.md +1 -1
  148. package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
  149. package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
  150. package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
  151. package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
  152. package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
  153. package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
  154. package/docs/api/interfaces/RBACResult.md +1 -1
  155. package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
  156. package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
  157. package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
  158. package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
  159. package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
  160. package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
  161. package/docs/api/interfaces/RBACRolesListParams.md +1 -1
  162. package/docs/api/interfaces/RBACRolesListResult.md +1 -1
  163. package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
  164. package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
  165. package/docs/api/interfaces/ResourcePermissions.md +1 -1
  166. package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
  167. package/docs/api/interfaces/RoleBasedRouterContextType.md +8 -8
  168. package/docs/api/interfaces/RoleBasedRouterProps.md +10 -10
  169. package/docs/api/interfaces/RoleManagementResult.md +1 -1
  170. package/docs/api/interfaces/RouteAccessRecord.md +10 -10
  171. package/docs/api/interfaces/RouteConfig.md +10 -10
  172. package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
  173. package/docs/api/interfaces/SecureDataContextType.md +9 -9
  174. package/docs/api/interfaces/SecureDataProviderProps.md +8 -8
  175. package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
  176. package/docs/api/interfaces/SetupIssue.md +1 -1
  177. package/docs/api/interfaces/StorageConfig.md +4 -4
  178. package/docs/api/interfaces/StorageFileInfo.md +7 -7
  179. package/docs/api/interfaces/StorageFileMetadata.md +25 -14
  180. package/docs/api/interfaces/StorageListOptions.md +22 -9
  181. package/docs/api/interfaces/StorageListResult.md +4 -4
  182. package/docs/api/interfaces/StorageUploadOptions.md +21 -8
  183. package/docs/api/interfaces/StorageUploadResult.md +6 -6
  184. package/docs/api/interfaces/StorageUrlOptions.md +19 -6
  185. package/docs/api/interfaces/StyleImport.md +1 -1
  186. package/docs/api/interfaces/SwitchProps.md +1 -1
  187. package/docs/api/interfaces/TabsContentProps.md +1 -1
  188. package/docs/api/interfaces/TabsListProps.md +1 -1
  189. package/docs/api/interfaces/TabsProps.md +1 -1
  190. package/docs/api/interfaces/TabsTriggerProps.md +1 -1
  191. package/docs/api/interfaces/TextareaProps.md +1 -1
  192. package/docs/api/interfaces/ToastActionElement.md +1 -1
  193. package/docs/api/interfaces/ToastProps.md +1 -1
  194. package/docs/api/interfaces/UnifiedAuthContextType.md +53 -53
  195. package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
  196. package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
  197. package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
  198. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  199. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  200. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  201. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  202. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  203. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  204. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
  205. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  206. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  207. package/docs/api/interfaces/UseResolvedScopeOptions.md +4 -4
  208. package/docs/api/interfaces/UseResolvedScopeReturn.md +4 -4
  209. package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
  210. package/docs/api/interfaces/UserEventAccess.md +11 -11
  211. package/docs/api/interfaces/UserMenuProps.md +1 -1
  212. package/docs/api/interfaces/UserProfile.md +1 -1
  213. package/docs/api/modules.md +151 -92
  214. package/docs/api-reference/components.md +15 -7
  215. package/docs/api-reference/providers.md +2 -2
  216. package/docs/api-reference/rpc-functions.md +1 -0
  217. package/docs/best-practices/README.md +1 -1
  218. package/docs/best-practices/deployment.md +8 -8
  219. package/docs/getting-started/examples/README.md +2 -2
  220. package/docs/getting-started/installation-guide.md +4 -4
  221. package/docs/getting-started/quick-start.md +3 -3
  222. package/docs/migration/MIGRATION_GUIDE.md +3 -3
  223. package/docs/rbac/compliance/compliance-guide.md +2 -2
  224. package/docs/rbac/event-based-apps.md +2 -2
  225. package/docs/rbac/getting-started.md +2 -2
  226. package/docs/rbac/quick-start.md +2 -2
  227. package/docs/security/README.md +4 -4
  228. package/docs/standards/07-rbac-and-rls-standard.md +430 -7
  229. package/docs/troubleshooting/README.md +2 -2
  230. package/docs/troubleshooting/migration.md +3 -3
  231. package/package.json +1 -3
  232. package/scripts/check-pace-core-compliance.cjs +1 -1
  233. package/scripts/check-pace-core-compliance.js +1 -1
  234. package/src/__tests__/fixtures/supabase.ts +301 -0
  235. package/src/__tests__/public-recipe-view.test.ts +9 -9
  236. package/src/__tests__/rls-policies.test.ts +197 -61
  237. package/src/components/AddressField/AddressField.test.tsx +42 -0
  238. package/src/components/AddressField/AddressField.tsx +71 -60
  239. package/src/components/AddressField/README.md +1 -0
  240. package/src/components/Alert/Alert.test.tsx +50 -10
  241. package/src/components/Alert/Alert.tsx +5 -3
  242. package/src/components/Avatar/Avatar.test.tsx +95 -43
  243. package/src/components/Avatar/Avatar.tsx +16 -16
  244. package/src/components/Button/Button.test.tsx +2 -1
  245. package/src/components/Button/Button.tsx +3 -3
  246. package/src/components/Calendar/Calendar.test.tsx +53 -37
  247. package/src/components/Calendar/Calendar.tsx +409 -82
  248. package/src/components/Card/Card.test.tsx +7 -4
  249. package/src/components/Card/Card.tsx +3 -6
  250. package/src/components/Checkbox/Checkbox.tsx +2 -2
  251. package/src/components/DataTable/components/ActionButtons.tsx +5 -5
  252. package/src/components/DataTable/components/BulkOperationsDropdown.tsx +2 -2
  253. package/src/components/DataTable/components/ColumnFilter.tsx +1 -1
  254. package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +3 -3
  255. package/src/components/DataTable/components/DataTableBody.tsx +12 -12
  256. package/src/components/DataTable/components/DataTableCore.tsx +3 -3
  257. package/src/components/DataTable/components/DataTableToolbar.tsx +5 -5
  258. package/src/components/DataTable/components/DraggableColumnHeader.tsx +3 -3
  259. package/src/components/DataTable/components/EditableRow.tsx +2 -2
  260. package/src/components/DataTable/components/EmptyState.tsx +3 -3
  261. package/src/components/DataTable/components/GroupHeader.tsx +2 -2
  262. package/src/components/DataTable/components/GroupingDropdown.tsx +1 -1
  263. package/src/components/DataTable/components/ImportModal.tsx +4 -4
  264. package/src/components/DataTable/components/LoadingState.tsx +1 -1
  265. package/src/components/DataTable/components/PaginationControls.tsx +11 -11
  266. package/src/components/DataTable/components/UnifiedTableBody.tsx +9 -9
  267. package/src/components/DataTable/components/ViewRowModal.tsx +2 -2
  268. package/src/components/DataTable/components/__tests__/AccessDeniedPage.test.tsx +11 -37
  269. package/src/components/DataTable/components/__tests__/DataTableToolbar.test.tsx +157 -0
  270. package/src/components/DataTable/components/__tests__/LoadingState.test.tsx +2 -1
  271. package/src/components/DataTable/components/__tests__/VirtualizedDataTable.test.tsx +128 -0
  272. package/src/components/DataTable/core/__tests__/ActionManager.test.ts +19 -0
  273. package/src/components/DataTable/core/__tests__/ColumnFactory.test.ts +51 -0
  274. package/src/components/DataTable/core/__tests__/ColumnManager.test.ts +84 -0
  275. package/src/components/DataTable/core/__tests__/DataManager.test.ts +14 -0
  276. package/src/components/DataTable/core/__tests__/DataTableContext.test.tsx +136 -0
  277. package/src/components/DataTable/core/__tests__/LocalDataAdapter.test.ts +16 -0
  278. package/src/components/DataTable/core/__tests__/PluginRegistry.test.ts +18 -0
  279. package/src/components/DataTable/hooks/useDataTablePermissions.ts +28 -7
  280. package/src/components/DataTable/utils/__tests__/hierarchicalUtils.test.ts +30 -1
  281. package/src/components/DataTable/utils/hierarchicalUtils.ts +38 -10
  282. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +8 -3
  283. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +4 -4
  284. package/src/components/Dialog/Dialog.tsx +2 -2
  285. package/src/components/EventSelector/EventSelector.tsx +7 -7
  286. package/src/components/FileDisplay/FileDisplay.tsx +291 -179
  287. package/src/components/FileUpload/FileUpload.tsx +7 -4
  288. package/src/components/Header/Header.test.tsx +28 -0
  289. package/src/components/Header/Header.tsx +22 -9
  290. package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +2 -2
  291. package/src/components/LoadingSpinner/LoadingSpinner.test.tsx +19 -14
  292. package/src/components/LoadingSpinner/LoadingSpinner.tsx +5 -5
  293. package/src/components/NavigationMenu/NavigationMenu.test.tsx +127 -1
  294. package/src/components/OrganisationSelector/OrganisationSelector.tsx +8 -8
  295. package/src/components/PaceAppLayout/PaceAppLayout.integration.test.tsx +4 -0
  296. package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +3 -0
  297. package/src/components/PaceAppLayout/PaceAppLayout.security.test.tsx +3 -0
  298. package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +16 -6
  299. package/src/components/PaceAppLayout/PaceAppLayout.tsx +37 -3
  300. package/src/components/PaceAppLayout/test-setup.tsx +1 -0
  301. package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +66 -45
  302. package/src/components/PaceLoginPage/PaceLoginPage.tsx +6 -4
  303. package/src/components/Progress/Progress.test.tsx +18 -19
  304. package/src/components/Progress/Progress.tsx +31 -32
  305. package/src/components/PublicLayout/PublicLayout.test.tsx +6 -6
  306. package/src/components/PublicLayout/PublicPageProvider.tsx +5 -3
  307. package/src/components/Select/Select.tsx +5 -5
  308. package/src/components/Switch/Switch.test.tsx +2 -1
  309. package/src/components/Switch/Switch.tsx +1 -1
  310. package/src/components/Toast/Toast.tsx +1 -1
  311. package/src/components/Tooltip/Tooltip.test.tsx +8 -2
  312. package/src/components/UserMenu/UserMenu.tsx +3 -3
  313. package/src/eslint-rules/pace-core-compliance.cjs +0 -2
  314. package/src/eslint-rules/pace-core-compliance.js +0 -2
  315. package/src/hooks/__tests__/hooks.integration.test.tsx +4 -1
  316. package/src/hooks/__tests__/useAppConfig.unit.test.ts +76 -5
  317. package/src/hooks/__tests__/useDataTableState.test.ts +76 -0
  318. package/src/hooks/__tests__/useFileUrl.unit.test.ts +25 -69
  319. package/src/hooks/__tests__/useFileUrlCache.test.ts +129 -0
  320. package/src/hooks/__tests__/usePreventTabReload.test.ts +88 -0
  321. package/src/hooks/__tests__/{usePublicEvent.unit.test.ts → usePublicEvent.test.ts} +28 -1
  322. package/src/hooks/__tests__/useQueryCache.test.ts +144 -0
  323. package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +58 -16
  324. package/src/hooks/index.ts +1 -1
  325. package/src/hooks/public/usePublicEvent.ts +2 -2
  326. package/src/hooks/public/usePublicFileDisplay.ts +173 -87
  327. package/src/hooks/useAppConfig.ts +24 -5
  328. package/src/hooks/useFileDisplay.ts +297 -34
  329. package/src/hooks/useFileReference.ts +56 -11
  330. package/src/hooks/useFileUrl.ts +1 -1
  331. package/src/hooks/useInactivityTracker.ts +16 -7
  332. package/src/hooks/usePermissionCache.test.ts +85 -8
  333. package/src/hooks/useQueryCache.ts +21 -0
  334. package/src/hooks/useSecureDataAccess.test.ts +80 -35
  335. package/src/hooks/useSecureDataAccess.ts +80 -37
  336. package/src/providers/services/EventServiceProvider.tsx +37 -17
  337. package/src/providers/services/InactivityServiceProvider.tsx +4 -4
  338. package/src/providers/services/OrganisationServiceProvider.tsx +8 -1
  339. package/src/providers/services/UnifiedAuthProvider.tsx +115 -29
  340. package/src/rbac/__tests__/auth-rbac.e2e.test.tsx +451 -0
  341. package/src/rbac/__tests__/engine.comprehensive.test.ts +12 -0
  342. package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +8 -0
  343. package/src/rbac/__tests__/rbac-engine-simplified.test.ts +4 -0
  344. package/src/rbac/api.ts +240 -36
  345. package/src/rbac/cache-invalidation.ts +21 -7
  346. package/src/rbac/compliance/quick-fix-suggestions.ts +1 -1
  347. package/src/rbac/components/NavigationGuard.tsx +23 -63
  348. package/src/rbac/components/NavigationProvider.test.tsx +52 -23
  349. package/src/rbac/components/NavigationProvider.tsx +13 -11
  350. package/src/rbac/components/PagePermissionGuard.tsx +77 -203
  351. package/src/rbac/components/PagePermissionProvider.tsx +13 -11
  352. package/src/rbac/components/PermissionEnforcer.tsx +24 -62
  353. package/src/rbac/components/RoleBasedRouter.tsx +14 -12
  354. package/src/rbac/components/SecureDataProvider.tsx +13 -11
  355. package/src/rbac/components/__tests__/NavigationGuard.test.tsx +104 -41
  356. package/src/rbac/components/__tests__/NavigationProvider.test.tsx +49 -12
  357. package/src/rbac/components/__tests__/PagePermissionGuard.race-condition.test.tsx +22 -1
  358. package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +161 -82
  359. package/src/rbac/components/__tests__/PagePermissionGuard.verification.test.tsx +22 -1
  360. package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +77 -30
  361. package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +39 -5
  362. package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +47 -4
  363. package/src/rbac/engine.ts +4 -2
  364. package/src/rbac/hooks/__tests__/useSecureSupabase.test.ts +144 -52
  365. package/src/rbac/hooks/index.ts +3 -0
  366. package/src/rbac/hooks/useCan.test.ts +101 -53
  367. package/src/rbac/hooks/usePermissions.ts +108 -41
  368. package/src/rbac/hooks/useRBAC.test.ts +11 -3
  369. package/src/rbac/hooks/useRBAC.ts +83 -40
  370. package/src/rbac/hooks/useResolvedScope.test.ts +189 -63
  371. package/src/rbac/hooks/useResolvedScope.ts +128 -70
  372. package/src/rbac/hooks/useSecureSupabase.ts +36 -19
  373. package/src/rbac/hooks/useSuperAdminBypass.ts +126 -0
  374. package/src/rbac/request-deduplication.ts +1 -1
  375. package/src/rbac/secureClient.ts +72 -12
  376. package/src/rbac/security.ts +29 -23
  377. package/src/rbac/types.ts +10 -0
  378. package/src/rbac/utils/__tests__/contextValidator.test.ts +150 -0
  379. package/src/rbac/utils/__tests__/deep-equal.test.ts +53 -0
  380. package/src/rbac/utils/__tests__/eventContext.test.ts +6 -1
  381. package/src/rbac/utils/contextValidator.ts +288 -0
  382. package/src/rbac/utils/eventContext.ts +48 -2
  383. package/src/services/EventService.ts +165 -21
  384. package/src/services/OrganisationService.ts +37 -2
  385. package/src/services/__tests__/EventService.test.ts +26 -21
  386. package/src/types/file-reference.ts +13 -10
  387. package/src/utils/app/appNameResolver.test.ts +346 -73
  388. package/src/utils/context/superAdminOverride.ts +58 -0
  389. package/src/utils/file-reference/index.ts +61 -33
  390. package/src/utils/google-places/googlePlacesUtils.test.ts +98 -0
  391. package/src/utils/google-places/loadGoogleMapsScript.test.ts +83 -0
  392. package/src/utils/storage/helpers.test.ts +1 -1
  393. package/src/utils/storage/helpers.ts +38 -19
  394. package/src/utils/storage/types.ts +15 -8
  395. package/src/utils/validation/__tests__/csrf.test.ts +105 -0
  396. package/src/utils/validation/__tests__/sqlInjectionProtection.test.ts +92 -0
  397. package/src/vite-env.d.ts +2 -2
  398. package/dist/chunk-3GOZZZYH.js.map +0 -1
  399. package/dist/chunk-DDM4CCYT.js.map +0 -1
  400. package/dist/chunk-E7UAOUMY.js +0 -75
  401. package/dist/chunk-E7UAOUMY.js.map +0 -1
  402. package/dist/chunk-F2IMUDXZ.js.map +0 -1
  403. package/dist/chunk-HEHYGYOX.js.map +0 -1
  404. package/dist/chunk-IM4QE42D.js.map +0 -1
  405. package/dist/chunk-MX64ZF6I.js.map +0 -1
  406. package/dist/chunk-SAUPYVLF.js.map +0 -1
  407. package/dist/chunk-THRPYOFK.js.map +0 -1
  408. package/dist/chunk-UCQSRW7Z.js.map +0 -1
  409. package/dist/chunk-VGZZXKBR.js.map +0 -1
  410. package/dist/chunk-YGPFYGA6.js.map +0 -1
  411. package/dist/chunk-YHCN776L.js.map +0 -1
  412. package/src/hooks/__tests__/usePermissionCache.simple.test.ts +0 -192
  413. package/src/hooks/__tests__/usePermissionCache.unit.test.ts +0 -741
  414. package/src/hooks/__tests__/usePublicEvent.simple.test.ts +0 -703
  415. package/src/rbac/hooks/useRBAC.simple.test.ts +0 -95
  416. package/src/rbac/utils/__tests__/eventContext.unit.test.ts +0 -428
  417. /package/dist/{DataTable-GUFUNZ3N.js.map → DataTable-ON3IXISJ.js.map} +0 -0
  418. /package/dist/{UnifiedAuthProvider-643PUAIM.js.map → UnifiedAuthProvider-X5NXANVI.js.map} +0 -0
  419. /package/dist/{api-YP7XD5L6.js.map → api-I6UCQ5S6.js.map} +0 -0
  420. /package/dist/{chunk-HESYZWZW.js.map → chunk-QWWZ5CAQ.js.map} +0 -0
@@ -7,6 +7,25 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import React__default, { ReactNode } from 'react';
8
8
  import '../core-CUElvH_C.js';
9
9
 
10
+ /**
11
+ * Context Validator for RBAC
12
+ * @package @jmruthers/pace-core
13
+ * @module RBAC/ContextValidator
14
+ * @since 1.0.0
15
+ *
16
+ * Centralized validation for RBAC context requirements based on app configuration.
17
+ * Enforces app-specific context rules with single primary context:
18
+ * - requires_event = TRUE: Event is PRIMARY context, org derived from event (org not required in input)
19
+ * - requires_event = FALSE: Organisation is PRIMARY context, event optional
20
+ * - PORTAL/ADMIN apps: Both contexts optional (allows users to view/edit own profiles, super admin access)
21
+ *
22
+ * Key principle: Only one primary context is required based on app config. The other is derived or optional.
23
+ */
24
+
25
+ interface AppConfig {
26
+ requires_event: boolean;
27
+ }
28
+
10
29
  /**
11
30
  * RBAC Security Enhancements
12
31
  * @package @jmruthers/pace-core
@@ -34,7 +53,7 @@ interface RBACSecurityConfig {
34
53
  */
35
54
  interface SecurityContext {
36
55
  userId: UUID;
37
- organisationId: UUID;
56
+ organisationId: UUID | null;
38
57
  ipAddress?: string;
39
58
  userAgent?: string;
40
59
  timestamp: Date;
@@ -102,6 +121,9 @@ declare function isDevelopmentMode(): boolean;
102
121
  *
103
122
  * This client automatically injects organisation context into all requests
104
123
  * and prevents queries that don't have the required context.
124
+ *
125
+ * Note: Callers should derive organisationId from eventId before creating this client
126
+ * if working with event-required apps. The client requires organisationId.
105
127
  */
106
128
  declare class SecureSupabaseClient {
107
129
  private supabase;
@@ -111,7 +133,8 @@ declare class SecureSupabaseClient {
111
133
  private organisationId;
112
134
  private eventId?;
113
135
  private appId?;
114
- constructor(supabaseUrl: string, supabaseKey: string, organisationId: UUID, eventId?: string, appId?: UUID);
136
+ private isSuperAdmin;
137
+ constructor(supabaseUrl: string, supabaseKey: string, organisationId: UUID, eventId?: string, appId?: UUID, isSuperAdmin?: boolean);
115
138
  /**
116
139
  * Setup context injection for all database operations
117
140
  */
@@ -138,6 +161,17 @@ declare class SecureSupabaseClient {
138
161
  private injectContext;
139
162
  /**
140
163
  * Add organisation filter to a query
164
+ *
165
+ * Defense in depth strategy:
166
+ * - RLS policies are the primary security layer (cannot be bypassed)
167
+ * - Application-level filtering adds an additional layer of protection
168
+ *
169
+ * For rbac_user_profiles:
170
+ * - Super admins: No org filter (see all users) - RLS will allow access
171
+ * - Non-super-admins: Apply org filter as defense in depth - RLS will also filter
172
+ *
173
+ * For other tables:
174
+ * - Always apply org filter unless super admin bypasses it
141
175
  */
142
176
  private addOrganisationFilter;
143
177
  /**
@@ -163,6 +197,7 @@ declare class SecureSupabaseClient {
163
197
  organisationId?: UUID;
164
198
  eventId?: string;
165
199
  appId?: UUID;
200
+ isSuperAdmin?: boolean;
166
201
  }): SecureSupabaseClient;
167
202
  /**
168
203
  * Get the underlying Supabase client (for internal use only)
@@ -178,6 +213,7 @@ declare class SecureSupabaseClient {
178
213
  * @param organisationId - Required organisation ID
179
214
  * @param eventId - Optional event ID
180
215
  * @param appId - Optional app ID
216
+ * @param isSuperAdmin - Optional super admin flag (defaults to false)
181
217
  * @returns SecureSupabaseClient instance
182
218
  *
183
219
  * @example
@@ -187,11 +223,12 @@ declare class SecureSupabaseClient {
187
223
  * 'your-publishable-key-or-anon-key',
188
224
  * 'org-123',
189
225
  * 'event-456',
190
- * 'app-789'
226
+ * 'app-789',
227
+ * false // isSuperAdmin
191
228
  * );
192
229
  * ```
193
230
  */
194
- declare function createSecureClient(supabaseUrl: string, supabaseKey: string, organisationId: UUID, eventId?: string, appId?: UUID): SecureSupabaseClient;
231
+ declare function createSecureClient(supabaseUrl: string, supabaseKey: string, organisationId: UUID, eventId?: string, appId?: UUID, isSuperAdmin?: boolean): SecureSupabaseClient;
195
232
  /**
196
233
  * Create a secure client from an existing Supabase client
197
234
  *
@@ -1395,6 +1432,7 @@ declare function usePermissions(userId: UUID, organisationId: string | undefined
1395
1432
  * @param permission - Permission to check
1396
1433
  * @param pageId - Optional page ID
1397
1434
  * @param useCache - Whether to use cached results
1435
+ * @param appName - Optional app name (for PORTAL/ADMIN special case)
1398
1436
  * @returns Permission check state and methods
1399
1437
  *
1400
1438
  * @example
@@ -1409,7 +1447,7 @@ declare function usePermissions(userId: UUID, organisationId: string | undefined
1409
1447
  * }
1410
1448
  * ```
1411
1449
  */
1412
- declare function useCan(userId: UUID, scope: Scope, permission: Permission, pageId?: UUID, useCache?: boolean): {
1450
+ declare function useCan(userId: UUID, scope: Scope, permission: Permission, pageId?: UUID, useCache?: boolean, appName?: string): {
1413
1451
  can: boolean;
1414
1452
  isLoading: boolean;
1415
1453
  error: Error | null;
@@ -1790,7 +1828,7 @@ declare function useRoleManagement(): {
1790
1828
  *
1791
1829
  * - Must be used within `UnifiedAuthProvider` context
1792
1830
  * - Requires `useOrganisations` and `useEvents` hooks to be available
1793
- * - Environment variables `VITE_SUPABASE_URL` and `VITE_SUPABASE_ANON_KEY` must be set
1831
+ * - Environment variables `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY` must be set
1794
1832
  * (or `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` for Next.js)
1795
1833
  *
1796
1834
  * ## See Also
@@ -1841,6 +1879,24 @@ declare function useRoleManagement(): {
1841
1879
  */
1842
1880
  declare function useSecureSupabase(baseClient?: SupabaseClient<Database> | null): SupabaseClient<Database> | null;
1843
1881
 
1882
+ /**
1883
+ * @file useSuperAdminBypass
1884
+ * @package @jmruthers/pace-core
1885
+ *
1886
+ * Detects whether the current user is a super admin, keeps the
1887
+ * server session override flag in sync, and exposes a boolean
1888
+ * that downstream hooks can use to bypass organisation scoping.
1889
+ */
1890
+ interface SuperAdminBypassState {
1891
+ /** True when the user has been verified as a super admin */
1892
+ isSuperAdmin: boolean;
1893
+ /** True while the hook is checking the server */
1894
+ isLoading: boolean;
1895
+ /** Error returned by the verification request, if any */
1896
+ error: Error | null;
1897
+ }
1898
+ declare function useSuperAdminBypass(): SuperAdminBypassState;
1899
+
1844
1900
  /**
1845
1901
  * RBAC Adapters
1846
1902
  * @package @jmruthers/pace-core
@@ -2134,6 +2190,8 @@ declare function setupRBAC(supabase: SupabaseClient<Database>, config?: Partial<
2134
2190
  * Get user's access level in a scope
2135
2191
  *
2136
2192
  * @param input - Access level input
2193
+ * @param appConfig - Optional app configuration
2194
+ * @param appName - Optional app name
2137
2195
  * @returns Promise resolving to access level
2138
2196
  *
2139
2197
  * @example
@@ -2147,11 +2205,13 @@ declare function setupRBAC(supabase: SupabaseClient<Database>, config?: Partial<
2147
2205
  declare function getAccessLevel(input: {
2148
2206
  userId: UUID;
2149
2207
  scope: Scope;
2150
- }): Promise<AccessLevel>;
2208
+ }, appConfig?: AppConfig | null, appName?: string): Promise<AccessLevel>;
2151
2209
  /**
2152
2210
  * Get user's permission map for a scope
2153
2211
  *
2154
2212
  * @param input - Permission map input
2213
+ * @param appConfig - Optional app configuration
2214
+ * @param appName - Optional app name
2155
2215
  * @returns Promise resolving to permission map
2156
2216
  *
2157
2217
  * @example
@@ -2169,7 +2229,7 @@ declare function getAccessLevel(input: {
2169
2229
  declare function getPermissionMap(input: {
2170
2230
  userId: UUID;
2171
2231
  scope: Scope;
2172
- }): Promise<PermissionMap>;
2232
+ }, appConfig?: AppConfig | null, appName?: string): Promise<PermissionMap>;
2173
2233
  declare function resolveAppContext(input: {
2174
2234
  userId: UUID;
2175
2235
  appName: string;
@@ -2177,11 +2237,13 @@ declare function resolveAppContext(input: {
2177
2237
  declare function getRoleContext(input: {
2178
2238
  userId: UUID;
2179
2239
  scope: Scope;
2180
- }): Promise<RBACRoleContext>;
2240
+ }, appConfig?: AppConfig | null, appName?: string): Promise<RBACRoleContext>;
2181
2241
  /**
2182
2242
  * Check if user has a specific permission
2183
2243
  *
2184
2244
  * @param input - Permission check input
2245
+ * @param appConfig - Optional app configuration (if not provided, will be fetched)
2246
+ * @param appName - Optional app name (for PORTAL/ADMIN special case and config lookup)
2185
2247
  * @returns Promise resolving to permission result
2186
2248
  *
2187
2249
  * @example
@@ -2194,7 +2256,7 @@ declare function getRoleContext(input: {
2194
2256
  * });
2195
2257
  * ```
2196
2258
  */
2197
- declare function isPermitted(input: PermissionCheck): Promise<boolean>;
2259
+ declare function isPermitted(input: PermissionCheck, appConfig?: AppConfig | null, appName?: string): Promise<boolean>;
2198
2260
  /**
2199
2261
  * Check if user has a specific permission (cached version)
2200
2262
  *
@@ -2202,9 +2264,11 @@ declare function isPermitted(input: PermissionCheck): Promise<boolean>;
2202
2264
  * and checks cache before making new requests. Uses session cache for page-level checks.
2203
2265
  *
2204
2266
  * @param input - Permission check input
2267
+ * @param appConfig - Optional app configuration
2268
+ * @param appName - Optional app name
2205
2269
  * @returns Promise resolving to permission result
2206
2270
  */
2207
- declare function isPermittedCached(input: PermissionCheck): Promise<boolean>;
2271
+ declare function isPermittedCached(input: PermissionCheck, appConfig?: AppConfig | null, appName?: string): Promise<boolean>;
2208
2272
  /**
2209
2273
  * Check if a user has a specific permission (alias for isPermitted)
2210
2274
  *
@@ -2563,4 +2627,4 @@ declare function getDirectSupabaseAuthFixes(): QuickFix;
2563
2627
  */
2564
2628
  declare function getQuickFixes(issueType: string, details?: Record<string, any>): QuickFix[];
2565
2629
 
2566
- export { ALL_PERMISSIONS, AccessLevel, AccessLevelGuard, type AllPermissions, CACHE_PATTERNS, type ComplianceResult, type DataAccessRecord, type DatabaseComplianceResult, type DatabaseIssue, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, type EnhancedNavigationMenuProps, type EventAppRoleData, GLOBAL_PERMISSIONS, type GrantEventAppRoleParams, type LogLevel, type NavigationAccessRecord, type NavigationContextType, NavigationGuard, type NavigationGuardProps, type NavigationItem, NavigationProvider, type NavigationProviderProps, ORGANISATION_PERMISSIONS, PAGE_PERMISSIONS, type PageAccessRecord, type PagePermissionContextType, PagePermissionGuard, type PagePermissionGuardProps, PagePermissionProvider, type PagePermissionProviderProps, Permission, PermissionCheck, PermissionEnforcer, type PermissionEnforcerProps, PermissionGuard, PermissionMap, type QuickFix, RBACAuditManager, RBACCache, type RBACConfig, RBACEngine, type RBACLogger, type RBACPerformanceMetrics, type ResourcePermissions, type RevokeEventAppRoleParams, RoleBasedRouter, type RoleBasedRouterContextType, type RoleBasedRouterProps, type RoleManagementResult, type RouteAccessRecord, type RouteConfig, type RuntimeComplianceResult, Scope, type SecureDataContextType, SecureDataProvider, type SecureDataProviderProps, SecureSupabaseClient, type SetupIssue, UUID, type UseResolvedScopeOptions, type UseResolvedScopeReturn, type UseResourcePermissionsOptions, checkRuntimeCompliance, clearInFlightRequests, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, disablePerformanceMonitoring, emitAuditEvent, enablePerformanceMonitoring, fromSupabaseClient, getAccessLevel, getCustomAuthCodeFixes, getDirectSupabaseAuthFixes, getDuplicateConfigFixes, getGlobalAuditManager, getInFlightRequestCount, getPerformanceMetrics, getPerformanceSummary, getPermissionMap, getPermissionsForRole, getQuickFixes, getRBACConfig, getRBACLogger, getRoleContext, getSetupIssues, getUnprotectedPageFixes, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPerformanceMonitoringEnabled, isPermitted, isPermittedCached, isRBACInitialized, isValidPermission, rbacCache, recordAuditEvent, recordPermissionCheck, resetPerformanceMetrics, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useResourcePermissions, useRoleBasedRouter, useRoleManagement, useSecureData, useSecureSupabase, validateAndWarn, validateDatabaseConfiguration, validateRBACSetup, withAccessLevelGuard, withPermissionGuard, withRoleGuard };
2630
+ export { ALL_PERMISSIONS, AccessLevel, AccessLevelGuard, type AllPermissions, CACHE_PATTERNS, type ComplianceResult, type DataAccessRecord, type DatabaseComplianceResult, type DatabaseIssue, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, type EnhancedNavigationMenuProps, type EventAppRoleData, GLOBAL_PERMISSIONS, type GrantEventAppRoleParams, type LogLevel, type NavigationAccessRecord, type NavigationContextType, NavigationGuard, type NavigationGuardProps, type NavigationItem, NavigationProvider, type NavigationProviderProps, ORGANISATION_PERMISSIONS, PAGE_PERMISSIONS, type PageAccessRecord, type PagePermissionContextType, PagePermissionGuard, type PagePermissionGuardProps, PagePermissionProvider, type PagePermissionProviderProps, Permission, PermissionCheck, PermissionEnforcer, type PermissionEnforcerProps, PermissionGuard, PermissionMap, type QuickFix, RBACAuditManager, RBACCache, type RBACConfig, RBACEngine, type RBACLogger, type RBACPerformanceMetrics, type ResourcePermissions, type RevokeEventAppRoleParams, RoleBasedRouter, type RoleBasedRouterContextType, type RoleBasedRouterProps, type RoleManagementResult, type RouteAccessRecord, type RouteConfig, type RuntimeComplianceResult, Scope, type SecureDataContextType, SecureDataProvider, type SecureDataProviderProps, SecureSupabaseClient, type SetupIssue, UUID, type UseResolvedScopeOptions, type UseResolvedScopeReturn, type UseResourcePermissionsOptions, checkRuntimeCompliance, clearInFlightRequests, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, disablePerformanceMonitoring, emitAuditEvent, enablePerformanceMonitoring, fromSupabaseClient, getAccessLevel, getCustomAuthCodeFixes, getDirectSupabaseAuthFixes, getDuplicateConfigFixes, getGlobalAuditManager, getInFlightRequestCount, getPerformanceMetrics, getPerformanceSummary, getPermissionMap, getPermissionsForRole, getQuickFixes, getRBACConfig, getRBACLogger, getRoleContext, getSetupIssues, getUnprotectedPageFixes, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPerformanceMonitoringEnabled, isPermitted, isPermittedCached, isRBACInitialized, isValidPermission, rbacCache, recordAuditEvent, recordPermissionCheck, resetPerformanceMetrics, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useResourcePermissions, useRoleBasedRouter, useRoleManagement, useSecureData, useSecureSupabase, useSuperAdminBypass, validateAndWarn, validateDatabaseConfiguration, validateRBACSetup, withAccessLevelGuard, withPermissionGuard, withRoleGuard };
@@ -40,7 +40,7 @@ import {
40
40
  withAccessLevelGuard,
41
41
  withPermissionGuard,
42
42
  withRoleGuard
43
- } from "../chunk-IM4QE42D.js";
43
+ } from "../chunk-73HSNNOQ.js";
44
44
  import {
45
45
  SecureSupabaseClient,
46
46
  createSecureClient,
@@ -53,11 +53,17 @@ import {
53
53
  useMultiplePermissions,
54
54
  usePermissions,
55
55
  useRBAC,
56
- useResolvedScope,
57
56
  useResourcePermissions,
58
57
  useRoleManagement,
59
58
  useSecureSupabase
60
- } from "../chunk-3GOZZZYH.js";
59
+ } from "../chunk-HQVPB5MZ.js";
60
+ import "../chunk-4QYC5L4K.js";
61
+ import {
62
+ useResolvedScope,
63
+ useSuperAdminBypass
64
+ } from "../chunk-Y4BUBBHD.js";
65
+ import "../chunk-KQCRWDSA.js";
66
+ import "../chunk-J2XXC7R5.js";
61
67
  import {
62
68
  CACHE_PATTERNS,
63
69
  RBACCache,
@@ -89,7 +95,7 @@ import {
89
95
  resetPerformanceMetrics,
90
96
  resolveAppContext,
91
97
  setupRBAC
92
- } from "../chunk-HEHYGYOX.js";
98
+ } from "../chunk-RUYZKXOD.js";
93
99
  import {
94
100
  RBACAuditManager,
95
101
  createAuditManager,
@@ -97,12 +103,8 @@ import {
97
103
  getGlobalAuditManager,
98
104
  setGlobalAuditManager
99
105
  } from "../chunk-63FOKYGO.js";
100
- import "../chunk-DDM4CCYT.js";
101
- import "../chunk-E7UAOUMY.js";
102
- import "../chunk-KQCRWDSA.js";
103
- import "../chunk-VGZZXKBR.js";
104
106
  import "../chunk-QXHPKYJV.js";
105
- import "../chunk-F2IMUDXZ.js";
107
+ import "../chunk-I7PSE6JW.js";
106
108
  import "../chunk-VBXEHIUJ.js";
107
109
  import "../chunk-PWLANIRT.js";
108
110
  import "../chunk-7D4SUZUM.js";
@@ -192,6 +194,7 @@ export {
192
194
  useRoleManagement,
193
195
  useSecureData,
194
196
  useSecureSupabase,
197
+ useSuperAdminBypass,
195
198
  validateAndWarn,
196
199
  validateDatabaseConfiguration,
197
200
  validateRBACSetup,
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export { A as AppId, D as DataRecord, E as EventId, O as OrganisationId, P as Pa
3
3
  import { U as User, a as Session } from './auth-BZOJqrdd.js';
4
4
  export { S as SessionRestorationState } from './auth-BZOJqrdd.js';
5
5
  export { E as Event, c as EventContextType, b as EventTheme, k as ORGANISATION_ROLE_PERMISSIONS, O as Organisation, n as OrganisationAccessLog, h as OrganisationContextType, j as OrganisationHierarchy, e as OrganisationInvitation, a as OrganisationMembership, m as OrganisationPermission, i as OrganisationProviderProps, l as OrganisationRole, f as OrganisationRoleDefinition, g as OrganisationSecurityError, d as OrganisationSettings, o as SecureQueryOptions, S as SuperAdminContext, T as ThemeColors, U as UserProfile } from './event-CW5YB_2p.js';
6
- export { g as BucketInfo, B as BulkUploadResult, F as FileCategory, b as FileMetadata, a as FileReference, d as FileReferenceService, f as FileReferenceWithUrl, c as FileUploadOptions, e as FileUploadResult, h as FileUrlInfo, S as StorageUploadOptions, U as UploadProgress } from './file-reference-D037xOFK.js';
6
+ export { g as BucketInfo, B as BulkUploadResult, F as FileCategory, b as FileMetadata, a as FileReference, d as FileReferenceService, f as FileReferenceWithUrl, c as FileUploadOptions, e as FileUploadResult, h as FileUrlInfo, S as StorageUploadOptions, U as UploadProgress } from './file-reference-BavO2eQj.js';
7
7
  export { C as ChangePasswordFormValues, o as ContactFormData, F as FormData, k as LoginFormData, L as LoginFormValues, P as ProfileFormData, m as RegistrationFormData, R as RegistrationFormValues, S as SecureLoginFormValues, j as SecureRegistrationFormValues, U as UserProfileFormValues, V as ValidationError, a as ValidationResult, g as changePasswordSchema, t as combineSchemas, i as contactFormSchema, d as dateSchema, e as emailSchema, l as loginSchema, n as nameSchema, f as passwordResetSchema, b as passwordSchema, p as phoneSchema, q as pickSchema, r as registrationSchema, c as secureLoginSchema, s as securePasswordSchema, u as urlSchema, h as userProfileSchema } from './validation-643vUDZW.js';
8
8
  import { SupabaseClient } from '@supabase/supabase-js';
9
9
  export { D as Database, J as Json } from './database.generated-DI89OQeI.js';
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FileCategory
3
- } from "./chunk-SAUPYVLF.js";
3
+ } from "./chunk-ZSAAAMVR.js";
4
4
  import {
5
5
  AuthErrorCode,
6
6
  PermissionErrorCode,
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  import { l as OrganisationRole, m as OrganisationPermission, S as SuperAdminContext, E as Event } from './event-CW5YB_2p.js';
4
4
  import { SupabaseClient } from '@supabase/supabase-js';
5
5
  import { D as Database } from './database.generated-DI89OQeI.js';
6
- import { F as FileCategory, a as FileReference } from './file-reference-D037xOFK.js';
6
+ import { F as FileCategory, a as FileReference } from './file-reference-BavO2eQj.js';
7
7
 
8
8
  interface UseZodFormProps<T extends z.ZodTypeAny> {
9
9
  schema: T;
@@ -352,13 +352,15 @@ declare function useEventTheme(event?: Event | null): void;
352
352
  interface StorageUploadOptions {
353
353
  /** The app name from rbac_apps */
354
354
  appName: string;
355
- /** Organisation ID for scoping */
356
- orgId: string;
355
+ /** Organisation ID for scoping (required if userId not provided) */
356
+ orgId?: string;
357
+ /** User ID for user-scoped files (required if orgId not provided) */
358
+ userId?: string;
357
359
  /** Whether the file should be publicly accessible */
358
360
  isPublic?: boolean;
359
361
  /** Optional tags for categorisation */
360
362
  tags?: string[];
361
- /** Optional custom path within the app/org structure */
363
+ /** Optional custom path within the app/org/user structure */
362
364
  customPath?: string;
363
365
  /** Optional metadata to store with the file */
364
366
  metadata?: Record<string, any>;
@@ -369,7 +371,8 @@ interface StorageFileMetadata {
369
371
  width?: number;
370
372
  height?: number;
371
373
  hash?: string;
372
- orgId: string;
374
+ orgId?: string;
375
+ userId?: string;
373
376
  appName: string;
374
377
  uploadedBy: string;
375
378
  uploadedAt: string;
@@ -387,16 +390,20 @@ interface StorageUploadResult {
387
390
  interface StorageUrlOptions {
388
391
  /** The app name from rbac_apps */
389
392
  appName: string;
390
- /** Organisation ID for scoping */
391
- orgId: string;
393
+ /** Organisation ID for scoping (required if userId not provided) */
394
+ orgId?: string;
395
+ /** User ID for user-scoped files (required if orgId not provided) */
396
+ userId?: string;
392
397
  /** Expiry time in seconds for signed URLs (default: 3600) */
393
398
  expiresIn?: number;
394
399
  }
395
400
  interface StorageListOptions {
396
401
  /** The app name from rbac_apps */
397
402
  appName: string;
398
- /** Organisation ID for scoping */
399
- orgId: string;
403
+ /** Organisation ID for scoping (required if userId not provided) */
404
+ orgId?: string;
405
+ /** User ID for user-scoped files (required if orgId not provided) */
406
+ userId?: string;
400
407
  /** Optional path prefix to filter by */
401
408
  pathPrefix?: string;
402
409
  /** Optional tags to filter by */
package/dist/utils.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  setAppConfig,
23
23
  urlSchema,
24
24
  useSessionTracking
25
- } from "./chunk-HESYZWZW.js";
25
+ } from "./chunk-QWWZ5CAQ.js";
26
26
  import {
27
27
  CachedAppIdResolver,
28
28
  LoadingSpinner,
@@ -37,27 +37,17 @@ import {
37
37
  getUserTimeZone,
38
38
  roundToNearestMinutes,
39
39
  toZonedTime
40
- } from "./chunk-THRPYOFK.js";
40
+ } from "./chunk-HW3OVDUF.js";
41
41
  import {
42
42
  cn,
43
43
  renderSafeHtml,
44
44
  sanitizeHtml,
45
45
  validateHtml
46
46
  } from "./chunk-R77UEZ4E.js";
47
- import {
48
- getAppNameFromBuildTime,
49
- getAppNameFromEnvironment,
50
- getAppNameFromGlobal,
51
- getAppNameFromPackageJson,
52
- getCurrentAppName,
53
- getCurrentAppNameWithFallback,
54
- setRBACAppName
55
- } from "./chunk-F2IMUDXZ.js";
56
47
  import {
57
48
  useComponentPerformance
58
49
  } from "./chunk-E66EQZE6.js";
59
50
  import {
60
- PERFORMANCE_BUDGETS,
61
51
  clearInFlightRequests,
62
52
  createAddressFromPlaceResult,
63
53
  deduplicatedQuery,
@@ -67,9 +57,19 @@ import {
67
57
  getAddressByPlaceId,
68
58
  getInFlightRequestStats,
69
59
  getOrCreateRequest,
70
- parseAddressComponents,
71
- performanceBudgetMonitor
72
- } from "./chunk-YHCN776L.js";
60
+ parseAddressComponents
61
+ } from "./chunk-DZWK57KZ.js";
62
+ import {
63
+ PERFORMANCE_BUDGETS,
64
+ getAppNameFromBuildTime,
65
+ getAppNameFromEnvironment,
66
+ getAppNameFromGlobal,
67
+ getAppNameFromPackageJson,
68
+ getCurrentAppName,
69
+ getCurrentAppNameWithFallback,
70
+ performanceBudgetMonitor,
71
+ setRBACAppName
72
+ } from "./chunk-I7PSE6JW.js";
73
73
  import {
74
74
  clearOrganisationContext,
75
75
  getOrganisationContext,
@@ -951,7 +951,7 @@ function createLazyComponent(importFn, componentName, options = {}) {
951
951
  return WrappedComponent;
952
952
  }
953
953
  var LazyDataTable = createLazyComponent(
954
- () => import("./DataTable-GUFUNZ3N.js").then((module) => ({ default: module.DataTable })),
954
+ () => import("./DataTable-ON3IXISJ.js").then((module) => ({ default: module.DataTable })),
955
955
  "DataTable"
956
956
  );
957
957
 
package/docs/README.md CHANGED
@@ -19,7 +19,7 @@ npm install @jmruthers/pace-core \
19
19
  react react-dom \
20
20
  @tanstack/react-table \
21
21
  @radix-ui/react-avatar @radix-ui/react-checkbox @radix-ui/react-dialog \
22
- @radix-ui/react-label @radix-ui/react-progress @radix-ui/react-slot \
22
+ @radix-ui/react-label @radix-ui/react-slot \
23
23
  @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-toast @radix-ui/react-tooltip \
24
24
  clsx lucide-react react-day-picker react-hook-form react-router-dom tailwind-merge zod
25
25
 
@@ -67,7 +67,7 @@ import '@jmruthers/pace-core/styles/core.css';
67
67
 
68
68
  const supabase = createClient(
69
69
  import.meta.env.VITE_SUPABASE_URL!,
70
- import.meta.env.VITE_SUPABASE_ANON_KEY!
70
+ import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!
71
71
  );
72
72
 
73
73
  function AppShell() {
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / ColumnFactory
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / ColumnFactory
2
2
 
3
3
  # Class: ColumnFactory\<TData\>
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / ErrorBoundary
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / ErrorBoundary
2
2
 
3
3
  # Class: ErrorBoundary
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / InvalidScopeError
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / InvalidScopeError
2
2
 
3
3
  # Class: InvalidScopeError
4
4
 
@@ -42,7 +42,7 @@
42
42
 
43
43
  #### Defined in
44
44
 
45
- [packages/core/src/rbac/types.ts:336](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L336)
45
+ [packages/core/src/rbac/types.ts:346](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L346)
46
46
 
47
47
  ## Properties
48
48
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / Logger
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / Logger
2
2
 
3
3
  # Class: Logger
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / MissingUserContextError
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / MissingUserContextError
2
2
 
3
3
  # Class: MissingUserContextError
4
4
 
@@ -35,7 +35,7 @@
35
35
 
36
36
  #### Defined in
37
37
 
38
- [packages/core/src/rbac/types.ts:347](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L347)
38
+ [packages/core/src/rbac/types.ts:357](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L357)
39
39
 
40
40
  ## Properties
41
41
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / OrganisationContextRequiredError
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / OrganisationContextRequiredError
2
2
 
3
3
  # Class: OrganisationContextRequiredError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / PermissionDeniedError
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / PermissionDeniedError
2
2
 
3
3
  # Class: PermissionDeniedError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / RBACAuditManager
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / RBACAuditManager
2
2
 
3
3
  # Class: RBACAuditManager
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / RBACCache
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / RBACCache
2
2
 
3
3
  # Class: RBACCache
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / RBACEngine
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / RBACEngine
2
2
 
3
3
  # Class: RBACEngine
4
4
 
@@ -124,7 +124,7 @@ Promise resolving to permission map
124
124
 
125
125
  #### Defined in
126
126
 
127
- [packages/core/src/rbac/engine.ts:357](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L357)
127
+ [packages/core/src/rbac/engine.ts:359](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L359)
128
128
 
129
129
  ___
130
130
 
@@ -146,7 +146,7 @@ ___
146
146
 
147
147
  #### Defined in
148
148
 
149
- [packages/core/src/rbac/engine.ts:438](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L438)
149
+ [packages/core/src/rbac/engine.ts:440](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L440)
150
150
 
151
151
  ___
152
152
 
@@ -168,4 +168,4 @@ ___
168
168
 
169
169
  #### Defined in
170
170
 
171
- [packages/core/src/rbac/engine.ts:472](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L472)
171
+ [packages/core/src/rbac/engine.ts:474](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L474)
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / RBACError
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / RBACError
2
2
 
3
3
  # Class: RBACError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.189](../README.md) / [Exports](../modules.md) / RBACNotInitializedError
1
+ [@jmruthers/pace-core - v0.5.190](../README.md) / [Exports](../modules.md) / RBACNotInitializedError
2
2
 
3
3
  # Class: RBACNotInitializedError
4
4
 
@@ -35,7 +35,7 @@
35
35
 
36
36
  #### Defined in
37
37
 
38
- [packages/core/src/rbac/types.ts:326](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L326)
38
+ [packages/core/src/rbac/types.ts:336](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L336)
39
39
 
40
40
  ## Properties
41
41