@jmruthers/pace-core 0.5.114 → 0.5.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AuthService-CVgsgtaZ.d.ts → AuthService-D4646R4b.d.ts} +9 -4
- package/dist/{DataTable-3JRLZXER.js → DataTable-ZOAKQ3SU.js} +10 -9
- package/dist/{UnifiedAuthProvider-KZZUO27W.js → UnifiedAuthProvider-YFN7YGVN.js} +4 -3
- package/dist/{api-PKU4PUBO.js → api-TNIBJWLM.js} +3 -3
- package/dist/{audit-H4YJJF7R.js → audit-T36HM7IM.js} +2 -2
- package/dist/{chunk-4OX5PXHX.js → chunk-2GJ5GL77.js} +4 -5
- package/dist/chunk-2GJ5GL77.js.map +1 -0
- package/dist/{chunk-5YIZFEUQ.js → chunk-2LM4QQGH.js} +31 -35
- package/dist/chunk-2LM4QQGH.js.map +1 -0
- package/dist/{chunk-3OGQLOJM.js → chunk-3DBFLLLU.js} +30 -1
- package/dist/chunk-3DBFLLLU.js.map +1 -0
- package/dist/{chunk-KTHLNIMA.js → chunk-ECOVPXYS.js} +13 -62
- package/dist/chunk-ECOVPXYS.js.map +1 -0
- package/dist/{chunk-OO3V7W4H.js → chunk-KA3PSVNV.js} +87 -40
- package/dist/chunk-KA3PSVNV.js.map +1 -0
- package/dist/{chunk-HKWQN44G.js → chunk-KMPWND3F.js} +15 -15
- package/dist/{chunk-L36JW4KV.js → chunk-LFS45U62.js} +2 -2
- package/dist/{chunk-NEONKMTU.js → chunk-LZYHAL7Y.js} +9 -4
- package/dist/{chunk-NEONKMTU.js.map → chunk-LZYHAL7Y.js.map} +1 -1
- package/dist/{chunk-BUN7NMV7.js → chunk-O3FTRYEU.js} +2 -2
- package/dist/{chunk-F6QB26OS.js → chunk-P3PUOL6B.js} +80 -8
- package/dist/chunk-P3PUOL6B.js.map +1 -0
- package/dist/{chunk-ZPXWJA4H.js → chunk-PHDAXDHB.js} +131 -5
- package/dist/chunk-PHDAXDHB.js.map +1 -0
- package/dist/chunk-UJI6WSMD.js +201 -0
- package/dist/{chunk-5CDJCTOO.js.map → chunk-UJI6WSMD.js.map} +1 -1
- package/dist/{chunk-JHWQNJP3.js → chunk-UKZWNQMB.js} +65 -19
- package/dist/{chunk-JHWQNJP3.js.map → chunk-UKZWNQMB.js.map} +1 -1
- package/dist/{chunk-7H75SHXZ.js → chunk-VN3OOE35.js} +2 -2
- package/dist/{chunk-QKIVSZ2O.js → chunk-WP5I5GLN.js} +2 -2
- package/dist/components.d.ts +1 -1
- package/dist/components.js +12 -11
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +10 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -16
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +3 -2
- package/dist/rbac/index.d.ts +82 -1
- package/dist/rbac/index.js +13 -10
- package/dist/{useToast-DRah6K-g.d.ts → useToast-Cs_g32bg.d.ts} +8 -6
- package/dist/utils.js +6 -4
- package/dist/utils.js.map +1 -1
- package/dist/validation.js +3 -1
- package/dist/validation.js.map +1 -1
- package/docs/README.md +4 -0
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +35 -12
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +71 -0
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +122 -0
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +27 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +100 -0
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +52 -0
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +43 -16
- package/docs/architecture/rpc-function-standards.md +193 -0
- package/package.json +1 -1
- package/src/__tests__/TEST_STANDARD.md +244 -2
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +46 -16
- package/src/components/DataTable/__tests__/keyboard.test.tsx +276 -217
- package/src/components/DataTable/components/DataTableCore.tsx +32 -17
- package/src/components/DataTable/components/DataTableToolbar.tsx +3 -2
- package/src/components/DataTable/components/EditableRow.tsx +18 -1
- package/src/components/DataTable/components/ImportModal.tsx +25 -2
- package/src/components/DataTable/components/ViewRowModal.tsx +1 -1
- package/src/components/DataTable/components/__tests__/AccessDeniedPage.test.tsx +735 -0
- package/src/components/DataTable/components/__tests__/BulkOperationsDropdown.test.tsx +572 -0
- package/src/components/DataTable/components/__tests__/ColumnVisibilityDropdown.test.tsx +708 -0
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +451 -0
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +456 -0
- package/src/components/DataTable/components/__tests__/EditableRow.test.tsx +454 -0
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +462 -0
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +423 -0
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +393 -0
- package/src/components/DataTable/components/__tests__/GroupingDropdown.test.tsx +617 -0
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +734 -0
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +412 -0
- package/src/components/DataTable/hooks/useTableHandlers.ts +4 -0
- package/src/components/EventSelector/EventSelector.tsx +5 -25
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +12 -7
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +4 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +7 -2
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +13 -8
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +109 -100
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +18 -13
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +17 -12
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +2 -0
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +11 -1
- package/src/components/PasswordReset/PasswordChangeForm.test.tsx +2 -2
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +648 -0
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +10 -7
- package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +4 -12
- package/src/components/Select/Select.tsx +8 -0
- package/src/components/Toast/Toast.test.tsx +8 -7
- package/src/components/Toast/Toast.tsx +4 -4
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +367 -3
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +916 -0
- package/src/hooks/useEventTheme.ts +49 -18
- package/src/hooks/usePermissionCache.ts +5 -3
- package/src/hooks/useSecureDataAccess.ts +11 -1
- package/src/hooks/useToast.ts +11 -12
- package/src/providers/services/EventServiceProvider.tsx +15 -8
- package/src/rbac/__tests__/cache-invalidation.test.ts +385 -0
- package/src/rbac/audit.test.ts +206 -0
- package/src/rbac/audit.ts +37 -2
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +26 -23
- package/src/rbac/errors.test.ts +340 -0
- package/src/rbac/hooks/index.ts +9 -0
- package/src/rbac/hooks/useResolvedScope.test.ts +1063 -0
- package/src/rbac/hooks/useRoleManagement.test.ts +908 -0
- package/src/rbac/hooks/useRoleManagement.ts +255 -0
- package/src/services/AuthService.ts +10 -0
- package/src/services/EventService.ts +111 -50
- package/src/services/__tests__/AuthService.test.ts +1 -1
- package/src/services/__tests__/EventService.test.ts +60 -45
- package/src/services/interfaces/IEventService.ts +1 -1
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +320 -0
- package/src/utils/__tests__/logger.unit.test.ts +398 -0
- package/src/utils/__tests__/validation.unit.test.ts +225 -1
- package/src/utils/file-reference.test.ts +214 -0
- package/dist/chunk-3OGQLOJM.js.map +0 -1
- package/dist/chunk-4OX5PXHX.js.map +0 -1
- package/dist/chunk-5CDJCTOO.js +0 -190
- package/dist/chunk-5YIZFEUQ.js.map +0 -1
- package/dist/chunk-F6QB26OS.js.map +0 -1
- package/dist/chunk-KTHLNIMA.js.map +0 -1
- package/dist/chunk-OO3V7W4H.js.map +0 -1
- package/dist/chunk-ZPXWJA4H.js.map +0 -1
- package/src/rbac/audit-enhanced.ts +0 -351
- /package/dist/{DataTable-3JRLZXER.js.map → DataTable-ZOAKQ3SU.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-KZZUO27W.js.map → UnifiedAuthProvider-YFN7YGVN.js.map} +0 -0
- /package/dist/{api-PKU4PUBO.js.map → api-TNIBJWLM.js.map} +0 -0
- /package/dist/{audit-H4YJJF7R.js.map → audit-T36HM7IM.js.map} +0 -0
- /package/dist/{chunk-HKWQN44G.js.map → chunk-KMPWND3F.js.map} +0 -0
- /package/dist/{chunk-L36JW4KV.js.map → chunk-LFS45U62.js.map} +0 -0
- /package/dist/{chunk-BUN7NMV7.js.map → chunk-O3FTRYEU.js.map} +0 -0
- /package/dist/{chunk-7H75SHXZ.js.map → chunk-VN3OOE35.js.map} +0 -0
- /package/dist/{chunk-QKIVSZ2O.js.map → chunk-WP5I5GLN.js.map} +0 -0
package/docs/api/modules.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[@jmruthers/pace-core - v0.5.
|
|
1
|
+
[@jmruthers/pace-core - v0.5.116](README.md) / Exports
|
|
2
2
|
|
|
3
|
-
# @jmruthers/pace-core - v0.5.
|
|
3
|
+
# @jmruthers/pace-core - v0.5.116
|
|
4
4
|
|
|
5
5
|
**`File`**
|
|
6
6
|
|
|
@@ -114,6 +114,10 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
114
114
|
- [RBACLogger](interfaces/RBACLogger.md)
|
|
115
115
|
- [UseResolvedScopeOptions](interfaces/UseResolvedScopeOptions.md)
|
|
116
116
|
- [UseResolvedScopeReturn](interfaces/UseResolvedScopeReturn.md)
|
|
117
|
+
- [EventAppRoleData](interfaces/EventAppRoleData.md)
|
|
118
|
+
- [RevokeEventAppRoleParams](interfaces/RevokeEventAppRoleParams.md)
|
|
119
|
+
- [GrantEventAppRoleParams](interfaces/GrantEventAppRoleParams.md)
|
|
120
|
+
- [RoleManagementResult](interfaces/RoleManagementResult.md)
|
|
117
121
|
- [StyleImport](interfaces/StyleImport.md)
|
|
118
122
|
- [ColorShade](interfaces/ColorShade.md)
|
|
119
123
|
- [ColorPalette](interfaces/ColorPalette.md)
|
|
@@ -348,6 +352,7 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
348
352
|
- [useCachedPermissions](modules.md#usecachedpermissions)
|
|
349
353
|
- [useRBAC](modules.md#userbac)
|
|
350
354
|
- [useResolvedScope](modules.md#useresolvedscope)
|
|
355
|
+
- [useRoleManagement](modules.md#userolemanagement)
|
|
351
356
|
- [isValidPermission](modules.md#isvalidpermission)
|
|
352
357
|
- [getPermissionsForRole](modules.md#getpermissionsforrole)
|
|
353
358
|
- [createSecureClient](modules.md#createsecureclient)
|
|
@@ -2436,7 +2441,7 @@ function AdminApp() {
|
|
|
2436
2441
|
|
|
2437
2442
|
#### Defined in
|
|
2438
2443
|
|
|
2439
|
-
[packages/core/src/components/PaceAppLayout/PaceAppLayout.tsx:
|
|
2444
|
+
[packages/core/src/components/PaceAppLayout/PaceAppLayout.tsx:328](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/PaceAppLayout/PaceAppLayout.tsx#L328)
|
|
2440
2445
|
|
|
2441
2446
|
___
|
|
2442
2447
|
|
|
@@ -3013,7 +3018,7 @@ ___
|
|
|
3013
3018
|
|
|
3014
3019
|
#### Defined in
|
|
3015
3020
|
|
|
3016
|
-
[packages/core/src/components/Select/Select.tsx:
|
|
3021
|
+
[packages/core/src/components/Select/Select.tsx:473](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Select/Select.tsx#L473)
|
|
3017
3022
|
|
|
3018
3023
|
___
|
|
3019
3024
|
|
|
@@ -3033,7 +3038,7 @@ ___
|
|
|
3033
3038
|
|
|
3034
3039
|
#### Defined in
|
|
3035
3040
|
|
|
3036
|
-
[packages/core/src/components/Select/Select.tsx:
|
|
3041
|
+
[packages/core/src/components/Select/Select.tsx:490](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Select/Select.tsx#L490)
|
|
3037
3042
|
|
|
3038
3043
|
___
|
|
3039
3044
|
|
|
@@ -3053,7 +3058,7 @@ ___
|
|
|
3053
3058
|
|
|
3054
3059
|
#### Defined in
|
|
3055
3060
|
|
|
3056
|
-
[packages/core/src/components/Select/Select.tsx:
|
|
3061
|
+
[packages/core/src/components/Select/Select.tsx:593](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Select/Select.tsx#L593)
|
|
3057
3062
|
|
|
3058
3063
|
___
|
|
3059
3064
|
|
|
@@ -3073,7 +3078,7 @@ ___
|
|
|
3073
3078
|
|
|
3074
3079
|
#### Defined in
|
|
3075
3080
|
|
|
3076
|
-
[packages/core/src/components/Select/Select.tsx:
|
|
3081
|
+
[packages/core/src/components/Select/Select.tsx:694](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Select/Select.tsx#L694)
|
|
3077
3082
|
|
|
3078
3083
|
___
|
|
3079
3084
|
|
|
@@ -3093,7 +3098,7 @@ ___
|
|
|
3093
3098
|
|
|
3094
3099
|
#### Defined in
|
|
3095
3100
|
|
|
3096
|
-
[packages/core/src/components/Select/Select.tsx:
|
|
3101
|
+
[packages/core/src/components/Select/Select.tsx:705](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Select/Select.tsx#L705)
|
|
3097
3102
|
|
|
3098
3103
|
___
|
|
3099
3104
|
|
|
@@ -3113,7 +3118,7 @@ ___
|
|
|
3113
3118
|
|
|
3114
3119
|
#### Defined in
|
|
3115
3120
|
|
|
3116
|
-
[packages/core/src/components/Select/Select.tsx:
|
|
3121
|
+
[packages/core/src/components/Select/Select.tsx:716](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Select/Select.tsx#L716)
|
|
3117
3122
|
|
|
3118
3123
|
___
|
|
3119
3124
|
|
|
@@ -4062,7 +4067,7 @@ void - This is an effect hook with no return value
|
|
|
4062
4067
|
|
|
4063
4068
|
#### Defined in
|
|
4064
4069
|
|
|
4065
|
-
[packages/core/src/hooks/useEventTheme.ts:
|
|
4070
|
+
[packages/core/src/hooks/useEventTheme.ts:85](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/hooks/useEventTheme.ts#L85)
|
|
4066
4071
|
|
|
4067
4072
|
___
|
|
4068
4073
|
|
|
@@ -4386,12 +4391,12 @@ Object with toast state and control methods
|
|
|
4386
4391
|
| Name | Type | Description |
|
|
4387
4392
|
| :------ | :------ | :------ |
|
|
4388
4393
|
| `toasts` | `ToasterToast`[] | Array of active toasts |
|
|
4389
|
-
| `toast` | (`props`: `Toast`) => \{ `id`: `string` = id; `dismiss`: () => `void` ; `update`: (`props`: `Partial`\<`Omit`\<`ToasterToast`, ``"id"``\>\>) => `void` } | Creates a new toast notification |
|
|
4394
|
+
| `toast` | (`props`: `Toast`) => \{ `id`: `string` = id; `dismiss`: () => `void` ; `update`: (`props`: `Partial`\<`Omit`\<`ToasterToast`, ``"id"`` \| ``"duration"``\>\>) => `void` } | Creates a new toast notification |
|
|
4390
4395
|
| `dismiss` | (`toastId?`: `string`) => `void` | - |
|
|
4391
4396
|
|
|
4392
4397
|
#### Defined in
|
|
4393
4398
|
|
|
4394
|
-
[packages/core/src/hooks/useToast.ts:
|
|
4399
|
+
[packages/core/src/hooks/useToast.ts:229](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/hooks/useToast.ts#L229)
|
|
4395
4400
|
|
|
4396
4401
|
___
|
|
4397
4402
|
|
|
@@ -5273,7 +5278,7 @@ RBACAuditManager instance
|
|
|
5273
5278
|
|
|
5274
5279
|
#### Defined in
|
|
5275
5280
|
|
|
5276
|
-
[packages/core/src/rbac/audit.ts:
|
|
5281
|
+
[packages/core/src/rbac/audit.ts:375](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L375)
|
|
5277
5282
|
|
|
5278
5283
|
___
|
|
5279
5284
|
|
|
@@ -5295,7 +5300,7 @@ Set the global audit manager
|
|
|
5295
5300
|
|
|
5296
5301
|
#### Defined in
|
|
5297
5302
|
|
|
5298
|
-
[packages/core/src/rbac/audit.ts:
|
|
5303
|
+
[packages/core/src/rbac/audit.ts:391](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L391)
|
|
5299
5304
|
|
|
5300
5305
|
___
|
|
5301
5306
|
|
|
@@ -5313,7 +5318,7 @@ Global audit manager or null if not set
|
|
|
5313
5318
|
|
|
5314
5319
|
#### Defined in
|
|
5315
5320
|
|
|
5316
|
-
[packages/core/src/rbac/audit.ts:
|
|
5321
|
+
[packages/core/src/rbac/audit.ts:400](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L400)
|
|
5317
5322
|
|
|
5318
5323
|
___
|
|
5319
5324
|
|
|
@@ -5335,7 +5340,7 @@ Emit an audit event using the global audit manager
|
|
|
5335
5340
|
|
|
5336
5341
|
#### Defined in
|
|
5337
5342
|
|
|
5338
|
-
[packages/core/src/rbac/audit.ts:
|
|
5343
|
+
[packages/core/src/rbac/audit.ts:409](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L409)
|
|
5339
5344
|
|
|
5340
5345
|
___
|
|
5341
5346
|
|
|
@@ -6171,6 +6176,28 @@ const permission = useCan(userId, resolvedScope, permission);
|
|
|
6171
6176
|
|
|
6172
6177
|
___
|
|
6173
6178
|
|
|
6179
|
+
### useRoleManagement
|
|
6180
|
+
|
|
6181
|
+
▸ **useRoleManagement**(): `Object`
|
|
6182
|
+
|
|
6183
|
+
#### Returns
|
|
6184
|
+
|
|
6185
|
+
`Object`
|
|
6186
|
+
|
|
6187
|
+
| Name | Type |
|
|
6188
|
+
| :------ | :------ |
|
|
6189
|
+
| `revokeEventAppRole` | (`params`: [`RevokeEventAppRoleParams`](interfaces/RevokeEventAppRoleParams.md)) => `Promise`\<[`RoleManagementResult`](interfaces/RoleManagementResult.md)\> |
|
|
6190
|
+
| `grantEventAppRole` | (`params`: [`GrantEventAppRoleParams`](interfaces/GrantEventAppRoleParams.md)) => `Promise`\<[`RoleManagementResult`](interfaces/RoleManagementResult.md)\> |
|
|
6191
|
+
| `revokeRoleById` | (`roleId`: `string`) => `Promise`\<[`RoleManagementResult`](interfaces/RoleManagementResult.md)\> |
|
|
6192
|
+
| `isLoading` | `boolean` |
|
|
6193
|
+
| `error` | ``null`` \| `Error` |
|
|
6194
|
+
|
|
6195
|
+
#### Defined in
|
|
6196
|
+
|
|
6197
|
+
[packages/core/src/rbac/hooks/useRoleManagement.ts:68](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/useRoleManagement.ts#L68)
|
|
6198
|
+
|
|
6199
|
+
___
|
|
6200
|
+
|
|
6174
6201
|
### isValidPermission
|
|
6175
6202
|
|
|
6176
6203
|
▸ **isValidPermission**(`permission`): permission is \`create:$\{string}\` \| \`update:$\{string}\` \| \`read:$\{string}\` \| \`delete:$\{string}\`
|
|
@@ -714,6 +714,9 @@ rbac_check_permission_simplified(
|
|
|
714
714
|
- ❌ **WRONG**: `SELECT mealtype_name FROM cake_mealtype`
|
|
715
715
|
- ✅ **CORRECT**: `SELECT cake_mealtype.mealtype_name FROM cake_mealtype`
|
|
716
716
|
- Always fully qualify table names when there might be ambiguity
|
|
717
|
+
- **MANDATORY**: When using JOINs, always use table aliases and prefix ALL column references
|
|
718
|
+
- Common ambiguous columns: `organisation_id`, `created_by`, `updated_by`, `created_at`, `updated_at`
|
|
719
|
+
- See "Avoiding Ambiguous Column References" section below for detailed guidance
|
|
717
720
|
|
|
718
721
|
5. **Not checking existing migrations**: Before creating a new migration, check if a similar one already exists to avoid duplicates
|
|
719
722
|
|
|
@@ -736,6 +739,190 @@ rbac_check_permission_simplified(
|
|
|
736
739
|
|
|
737
740
|
3. **Update references** - Update all callers before removing
|
|
738
741
|
|
|
742
|
+
## Avoiding Ambiguous Column References
|
|
743
|
+
|
|
744
|
+
### Overview
|
|
745
|
+
|
|
746
|
+
Ambiguous column reference errors occur when PostgreSQL cannot determine which table a column belongs to in a query with JOINs. This is a common source of silent failures in RPC functions.
|
|
747
|
+
|
|
748
|
+
### Mandatory Rules
|
|
749
|
+
|
|
750
|
+
1. **Always use table aliases in JOINs**: Never write JOINs without table aliases
|
|
751
|
+
2. **Fully qualify ALL column references**: Every column in SELECT, WHERE, ORDER BY, GROUP BY, and HAVING clauses must be prefixed with its table alias
|
|
752
|
+
3. **Common ambiguous columns**: The following columns exist in multiple tables and MUST always be prefixed:
|
|
753
|
+
- `organisation_id`
|
|
754
|
+
- `created_by`, `updated_by`
|
|
755
|
+
- `created_at`, `updated_at`
|
|
756
|
+
- `event_id` and its variations (e.g., `dish_event_id`, `meal_event_id`)
|
|
757
|
+
|
|
758
|
+
### Correct Patterns
|
|
759
|
+
|
|
760
|
+
```sql
|
|
761
|
+
-- ✅ CORRECT: All columns properly prefixed with table aliases
|
|
762
|
+
SELECT
|
|
763
|
+
d.dish_id,
|
|
764
|
+
d.dish_name,
|
|
765
|
+
d.organisation_id,
|
|
766
|
+
d.created_at,
|
|
767
|
+
mt.mealtype_name,
|
|
768
|
+
e.event_name,
|
|
769
|
+
e.organisation_id AS event_organisation_id
|
|
770
|
+
FROM cake_dish d
|
|
771
|
+
LEFT JOIN cake_mealtype mt ON d.dish_mealtype_id = mt.mealtype_id
|
|
772
|
+
LEFT JOIN event e ON d.dish_event_id = e.event_id
|
|
773
|
+
WHERE d.dish_event_id = p_event_id
|
|
774
|
+
AND d.organisation_id = p_organisation_id
|
|
775
|
+
ORDER BY d.dish_code, mt.mealtype_name;
|
|
776
|
+
|
|
777
|
+
-- ✅ CORRECT: CTEs with proper aliases
|
|
778
|
+
WITH distribution_items AS (
|
|
779
|
+
SELECT
|
|
780
|
+
d.item_id,
|
|
781
|
+
d.collection_date,
|
|
782
|
+
SUM(d.required_quantity) as total_quantity
|
|
783
|
+
FROM data_cake_distribution_list(p_event_id, p_user_id, p_organisation_id) d
|
|
784
|
+
GROUP BY d.item_id, d.collection_date
|
|
785
|
+
)
|
|
786
|
+
SELECT
|
|
787
|
+
di.item_id,
|
|
788
|
+
di.collection_date,
|
|
789
|
+
di.total_quantity
|
|
790
|
+
FROM distribution_items di
|
|
791
|
+
WHERE di.item_id = p_item_id;
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
### Incorrect Patterns
|
|
795
|
+
|
|
796
|
+
```sql
|
|
797
|
+
-- ❌ WRONG: Missing table prefixes in SELECT
|
|
798
|
+
SELECT
|
|
799
|
+
dish_id,
|
|
800
|
+
dish_name,
|
|
801
|
+
organisation_id, -- AMBIGUOUS: Could be from cake_dish or event
|
|
802
|
+
mealtype_name
|
|
803
|
+
FROM cake_dish d
|
|
804
|
+
LEFT JOIN cake_mealtype mt ON d.dish_mealtype_id = mt.mealtype_id
|
|
805
|
+
LEFT JOIN event e ON d.dish_event_id = e.event_id;
|
|
806
|
+
|
|
807
|
+
-- ❌ WRONG: Missing table prefix in WHERE clause
|
|
808
|
+
SELECT d.dish_id, d.dish_name
|
|
809
|
+
FROM cake_dish d
|
|
810
|
+
LEFT JOIN event e ON d.dish_event_id = e.event_id
|
|
811
|
+
WHERE organisation_id = p_organisation_id; -- AMBIGUOUS: Which table?
|
|
812
|
+
|
|
813
|
+
-- ❌ WRONG: Missing table prefix in ORDER BY
|
|
814
|
+
SELECT d.dish_id, d.dish_name, e.event_name
|
|
815
|
+
FROM cake_dish d
|
|
816
|
+
LEFT JOIN event e ON d.dish_event_id = e.event_id
|
|
817
|
+
ORDER BY created_at; -- AMBIGUOUS: Which table's created_at?
|
|
818
|
+
|
|
819
|
+
-- ❌ WRONG: SELECT INTO with multiple columns but wrong variable count
|
|
820
|
+
SELECT d.dish_code, d.dish_name, mt.mealtype_name
|
|
821
|
+
INTO v_mealtype_name -- WRONG: Only one variable for three columns
|
|
822
|
+
FROM cake_dish d
|
|
823
|
+
LEFT JOIN cake_mealtype mt ON d.dish_mealtype_id = mt.mealtype_id;
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
### SELECT INTO Statements
|
|
827
|
+
|
|
828
|
+
When using `SELECT ... INTO`, ensure:
|
|
829
|
+
1. The number of columns matches the number of variables
|
|
830
|
+
2. All columns are properly prefixed with table aliases
|
|
831
|
+
3. Use separate variables for each column
|
|
832
|
+
|
|
833
|
+
```sql
|
|
834
|
+
-- ✅ CORRECT: Proper SELECT INTO with multiple variables
|
|
835
|
+
DECLARE
|
|
836
|
+
v_dish_code TEXT;
|
|
837
|
+
v_dish_name TEXT;
|
|
838
|
+
v_mealtype_name TEXT;
|
|
839
|
+
v_updated_at TIMESTAMPTZ;
|
|
840
|
+
BEGIN
|
|
841
|
+
SELECT
|
|
842
|
+
d.dish_code,
|
|
843
|
+
d.dish_name,
|
|
844
|
+
mt.mealtype_name,
|
|
845
|
+
d.updated_at
|
|
846
|
+
INTO
|
|
847
|
+
v_dish_code,
|
|
848
|
+
v_dish_name,
|
|
849
|
+
v_mealtype_name,
|
|
850
|
+
v_updated_at
|
|
851
|
+
FROM cake_dish d
|
|
852
|
+
LEFT JOIN cake_mealtype mt ON d.dish_mealtype_id = mt.mealtype_id
|
|
853
|
+
WHERE d.dish_id = p_dish_id;
|
|
854
|
+
END;
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
### CTEs and Subqueries
|
|
858
|
+
|
|
859
|
+
When using CTEs (Common Table Expressions) or subqueries:
|
|
860
|
+
1. Use descriptive aliases for CTEs
|
|
861
|
+
2. Fully qualify all column references within CTEs
|
|
862
|
+
3. When referencing CTEs in the main query, use the CTE alias
|
|
863
|
+
|
|
864
|
+
```sql
|
|
865
|
+
-- ✅ CORRECT: CTE with proper aliases
|
|
866
|
+
WITH unit_diners AS (
|
|
867
|
+
SELECT
|
|
868
|
+
d.diner_unit_id,
|
|
869
|
+
d.diner_diettype_id,
|
|
870
|
+
SUM(COALESCE(d.diner_adult, 0)) as adults,
|
|
871
|
+
SUM(COALESCE(d.diner_youth, 0)) as youth
|
|
872
|
+
FROM cake_diner d
|
|
873
|
+
INNER JOIN event_units eu ON d.diner_unit_id = eu.unit_id
|
|
874
|
+
WHERE (d.diner_adult > 0 OR d.diner_youth > 0)
|
|
875
|
+
GROUP BY d.diner_unit_id, d.diner_diettype_id
|
|
876
|
+
)
|
|
877
|
+
SELECT
|
|
878
|
+
ud.diner_unit_id,
|
|
879
|
+
ud.adults,
|
|
880
|
+
ud.youth
|
|
881
|
+
FROM unit_diners ud
|
|
882
|
+
WHERE ud.diner_unit_id = p_unit_id;
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
### Table Alias Naming Conventions
|
|
886
|
+
|
|
887
|
+
Use short, descriptive aliases:
|
|
888
|
+
- `d` for `cake_dish`
|
|
889
|
+
- `r` for `cake_recipe`
|
|
890
|
+
- `m` for `cake_meal`
|
|
891
|
+
- `mt` for `cake_mealtype`
|
|
892
|
+
- `i` for `cake_item`
|
|
893
|
+
- `dt` for `cake_diettype`
|
|
894
|
+
- `e` for `event`
|
|
895
|
+
- `u` for `cake_unit`
|
|
896
|
+
- `mp` for `cake_mealplan`
|
|
897
|
+
|
|
898
|
+
### UPDATE Statements
|
|
899
|
+
|
|
900
|
+
For UPDATE statements, the WHERE clause should reference the table being updated:
|
|
901
|
+
|
|
902
|
+
```sql
|
|
903
|
+
-- ✅ CORRECT: WHERE clause uses table name or alias
|
|
904
|
+
UPDATE cake_dish
|
|
905
|
+
SET dish_name = p_dish_name,
|
|
906
|
+
updated_by = p_user_id,
|
|
907
|
+
updated_at = now()
|
|
908
|
+
WHERE dish_id = p_dish_id; -- dish_id is unambiguous (primary key)
|
|
909
|
+
|
|
910
|
+
-- ✅ CORRECT: When updating with JOIN, qualify all columns
|
|
911
|
+
UPDATE cake_dish d
|
|
912
|
+
SET d.dish_name = p_dish_name
|
|
913
|
+
FROM cake_mealtype mt
|
|
914
|
+
WHERE d.dish_mealtype_id = mt.mealtype_id
|
|
915
|
+
AND d.dish_id = p_dish_id;
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
### Testing for Ambiguous References
|
|
919
|
+
|
|
920
|
+
Before deploying, test your function:
|
|
921
|
+
1. Call the function with valid parameters
|
|
922
|
+
2. Check PostgreSQL logs for "ambiguous column reference" errors
|
|
923
|
+
3. Verify all column references are prefixed in JOINs
|
|
924
|
+
4. Test with multiple tables that share column names
|
|
925
|
+
|
|
739
926
|
## Common Patterns
|
|
740
927
|
|
|
741
928
|
### Pattern 1: Simple Data Retrieval
|
|
@@ -871,6 +1058,12 @@ When creating or reviewing an RPC function, ensure:
|
|
|
871
1058
|
- ✅ **File naming**: `YYYYMMDDHHMMSS_descriptive_name.sql`
|
|
872
1059
|
- ✅ **No ambiguous column references**: Fully qualify table names (e.g., `cake_mealtype.mealtype_name`)
|
|
873
1060
|
|
|
1061
|
+
### ⚠️ Column Reference Requirements
|
|
1062
|
+
- ✅ **All column references in JOINs are fully qualified with table aliases**: Every column in SELECT, WHERE, ORDER BY, GROUP BY, HAVING must have table prefix
|
|
1063
|
+
- ✅ **No ambiguous column references in WHERE, ORDER BY, GROUP BY, HAVING clauses**: All columns must be prefixed with table alias
|
|
1064
|
+
- ✅ **Table aliases used consistently and meaningfully**: Use short, descriptive aliases (e.g., `d` for dish, `r` for recipe)
|
|
1065
|
+
- ✅ **SELECT INTO statements match variable count**: Number of columns must match number of variables
|
|
1066
|
+
|
|
874
1067
|
## References
|
|
875
1068
|
|
|
876
1069
|
- [RBAC System Documentation](../core-concepts/rbac-system.md)
|