@jmruthers/pace-core 0.5.110 → 0.5.111
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-DrHrvXNZ.d.ts → AuthService-CVgsgtaZ.d.ts} +8 -0
- package/dist/{DataTable-D3BK2FCN.js → DataTable-5W2HVLLV.js} +8 -8
- package/dist/{UnifiedAuthProvider-A7I23UCN.js → UnifiedAuthProvider-LUM3QLS5.js} +3 -3
- package/dist/{api-PIE4JRFS.js → api-SIZPFBFX.js} +5 -3
- package/dist/{audit-65VNHEV2.js → audit-5JI5T3SL.js} +2 -2
- package/dist/{chunk-3J5N2T2N.js → chunk-2BIDKXQU.js} +113 -116
- package/dist/chunk-2BIDKXQU.js.map +1 -0
- package/dist/{chunk-AWK2FAUN.js → chunk-ACYQNYHB.js} +7 -7
- package/dist/{chunk-D6MEKC27.js → chunk-EFVQBYFN.js} +2 -2
- package/dist/{chunk-EZ64QG2I.js → chunk-I5YM5BGS.js} +2 -2
- package/dist/{chunk-Q7APDV6H.js → chunk-IWJYNWXN.js} +13 -5
- package/dist/chunk-IWJYNWXN.js.map +1 -0
- package/dist/{chunk-YFMENCR4.js → chunk-JE2GFA3O.js} +3 -3
- package/dist/{chunk-AUXS7XSO.js → chunk-MW73E7SP.js} +35 -11
- package/dist/chunk-MW73E7SP.js.map +1 -0
- package/dist/{chunk-XRSP3H52.js → chunk-PXXS26G5.js} +57 -23
- package/dist/chunk-PXXS26G5.js.map +1 -0
- package/dist/{chunk-HGZSO43Y.js → chunk-TD4BXGPE.js} +4 -4
- package/dist/{chunk-EYSXQ756.js → chunk-TDFBX7KJ.js} +2 -2
- package/dist/{chunk-HADXAZT3.js → chunk-UGVU7L7N.js} +52 -90
- package/dist/chunk-UGVU7L7N.js.map +1 -0
- package/dist/{chunk-2W4WKJVF.js → chunk-X7SPKHYZ.js} +290 -255
- package/dist/chunk-X7SPKHYZ.js.map +1 -0
- package/dist/{chunk-7GBEBJLR.js → chunk-ZL45MG76.js} +45 -37
- package/dist/chunk-ZL45MG76.js.map +1 -0
- package/dist/components.js +10 -10
- package/dist/hooks.d.ts +11 -1
- package/dist/hooks.js +9 -7
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -13
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +13 -8
- package/dist/rbac/index.js +9 -9
- package/dist/utils.js +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +4 -4
- package/docs/api/classes/MissingUserContextError.md +4 -4
- package/docs/api/classes/OrganisationContextRequiredError.md +4 -4
- package/docs/api/classes/PermissionDeniedError.md +4 -4
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +8 -8
- package/docs/api/classes/RBACCache.md +8 -8
- package/docs/api/classes/RBACEngine.md +4 -4
- package/docs/api/classes/RBACError.md +4 -4
- package/docs/api/classes/RBACNotInitializedError.md +4 -4
- 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/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/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 +4 -4
- 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/RoleBasedRouterContextType.md +8 -8
- package/docs/api/interfaces/RoleBasedRouterProps.md +10 -10
- package/docs/api/interfaces/RouteAccessRecord.md +10 -10
- package/docs/api/interfaces/RouteConfig.md +19 -6
- 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 +36 -36
- package/docs/api-reference/hooks.md +8 -4
- package/docs/architecture/rpc-function-standards.md +3 -1
- package/docs/best-practices/common-patterns.md +3 -3
- package/docs/best-practices/deployment.md +10 -4
- package/docs/best-practices/performance.md +11 -3
- package/docs/core-concepts/organisations.md +8 -8
- package/docs/core-concepts/permissions.md +133 -72
- package/docs/migration/rbac-migration.md +65 -66
- package/docs/rbac/advanced-patterns.md +15 -22
- package/docs/rbac/examples.md +12 -12
- package/docs/rbac/getting-started.md +3 -3
- package/docs/rbac/troubleshooting.md +2 -1
- package/package.json +1 -1
- package/src/components/DataTable/components/__tests__/ActionButtons.test.tsx +913 -0
- package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +609 -0
- package/src/components/DataTable/components/__tests__/EmptyState.test.tsx +434 -0
- package/src/components/DataTable/components/__tests__/LoadingState.test.tsx +120 -0
- package/src/components/DataTable/components/__tests__/PaginationControls.test.tsx +519 -0
- package/src/components/DataTable/examples/__tests__/HierarchicalActionsExample.test.tsx +316 -0
- package/src/components/DataTable/examples/__tests__/InitialPageSizeExample.test.tsx +211 -0
- package/src/components/FileUpload/FileUpload.tsx +2 -8
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +193 -63
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +102 -135
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +41 -2
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +61 -6
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +71 -21
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +113 -41
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +155 -45
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +30 -1
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +63 -5
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +156 -72
- package/src/hooks/__tests__/useRBAC.unit.test.ts +4 -38
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useFileDisplay.ts +51 -0
- package/src/hooks/usePermissionCache.test.ts +112 -68
- package/src/hooks/usePermissionCache.ts +55 -15
- package/src/rbac/README.md +81 -39
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +3 -3
- package/src/rbac/__tests__/engine.comprehensive.test.ts +15 -6
- package/src/rbac/__tests__/rbac-core.test.tsx +1 -1
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +57 -4
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +3 -2
- package/src/rbac/adapters.tsx +4 -4
- package/src/rbac/api.test.ts +37 -13
- package/src/rbac/api.ts +25 -8
- package/src/rbac/audit.test.ts +2 -2
- package/src/rbac/audit.ts +14 -5
- package/src/rbac/cache.test.ts +12 -0
- package/src/rbac/cache.ts +29 -9
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +1 -1
- package/src/rbac/components/NavigationGuard.tsx +14 -14
- package/src/rbac/components/NavigationProvider.test.tsx +1 -1
- package/src/rbac/components/PagePermissionGuard.tsx +4 -3
- package/src/rbac/components/PagePermissionProvider.test.tsx +1 -1
- package/src/rbac/components/PermissionEnforcer.tsx +19 -15
- package/src/rbac/components/RoleBasedRouter.tsx +16 -9
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +123 -107
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +1 -1
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +121 -103
- package/src/rbac/docs/event-based-apps.md +6 -6
- package/src/rbac/engine.ts +12 -2
- package/src/rbac/hooks/useCan.test.ts +29 -2
- package/src/rbac/hooks/usePermissions.test.ts +25 -25
- package/src/rbac/hooks/usePermissions.ts +47 -23
- package/src/rbac/hooks/useRBAC.simple.test.ts +1 -8
- package/src/rbac/hooks/useRBAC.test.ts +3 -40
- package/src/rbac/hooks/useRBAC.ts +0 -55
- package/src/rbac/hooks/useResolvedScope.ts +23 -31
- package/src/rbac/permissions.test.ts +11 -7
- package/src/rbac/security.test.ts +2 -2
- package/src/rbac/security.ts +22 -7
- package/src/rbac/types.test.ts +2 -2
- package/src/rbac/types.ts +1 -2
- package/src/services/EventService.ts +41 -13
- package/src/services/__tests__/EventService.test.ts +25 -4
- package/src/services/interfaces/IEventService.ts +1 -0
- package/src/utils/file-reference.ts +9 -0
- package/dist/chunk-2W4WKJVF.js.map +0 -1
- package/dist/chunk-3J5N2T2N.js.map +0 -1
- package/dist/chunk-7GBEBJLR.js.map +0 -1
- package/dist/chunk-AUXS7XSO.js.map +0 -1
- package/dist/chunk-HADXAZT3.js.map +0 -1
- package/dist/chunk-Q7APDV6H.js.map +0 -1
- package/dist/chunk-XRSP3H52.js.map +0 -1
- /package/dist/{DataTable-D3BK2FCN.js.map → DataTable-5W2HVLLV.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-A7I23UCN.js.map → UnifiedAuthProvider-LUM3QLS5.js.map} +0 -0
- /package/dist/{api-PIE4JRFS.js.map → api-SIZPFBFX.js.map} +0 -0
- /package/dist/{audit-65VNHEV2.js.map → audit-5JI5T3SL.js.map} +0 -0
- /package/dist/{chunk-AWK2FAUN.js.map → chunk-ACYQNYHB.js.map} +0 -0
- /package/dist/{chunk-D6MEKC27.js.map → chunk-EFVQBYFN.js.map} +0 -0
- /package/dist/{chunk-EZ64QG2I.js.map → chunk-I5YM5BGS.js.map} +0 -0
- /package/dist/{chunk-YFMENCR4.js.map → chunk-JE2GFA3O.js.map} +0 -0
- /package/dist/{chunk-HGZSO43Y.js.map → chunk-TD4BXGPE.js.map} +0 -0
- /package/dist/{chunk-EYSXQ756.js.map → chunk-TDFBX7KJ.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[@jmruthers/pace-core - v0.5.
|
|
1
|
+
[@jmruthers/pace-core - v0.5.111](../README.md) / [Exports](../modules.md) / RouteConfig
|
|
2
2
|
|
|
3
3
|
# Interface: RouteConfig
|
|
4
4
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- [path](RouteConfig.md#path)
|
|
10
10
|
- [component](RouteConfig.md#component)
|
|
11
11
|
- [permissions](RouteConfig.md#permissions)
|
|
12
|
+
- [public](RouteConfig.md#public)
|
|
12
13
|
- [roles](RouteConfig.md#roles)
|
|
13
14
|
- [accessLevel](RouteConfig.md#accesslevel)
|
|
14
15
|
- [pageId](RouteConfig.md#pageid)
|
|
@@ -53,6 +54,18 @@ Permissions required for this route
|
|
|
53
54
|
|
|
54
55
|
___
|
|
55
56
|
|
|
57
|
+
### public
|
|
58
|
+
|
|
59
|
+
• `Optional` **public**: `boolean`
|
|
60
|
+
|
|
61
|
+
If true, this route is public and doesn't require permission checks
|
|
62
|
+
|
|
63
|
+
#### Defined in
|
|
64
|
+
|
|
65
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:83](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L83)
|
|
66
|
+
|
|
67
|
+
___
|
|
68
|
+
|
|
56
69
|
### roles
|
|
57
70
|
|
|
58
71
|
• `Optional` **roles**: `string`[]
|
|
@@ -61,7 +74,7 @@ Roles that can access this route
|
|
|
61
74
|
|
|
62
75
|
#### Defined in
|
|
63
76
|
|
|
64
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
77
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:86](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L86)
|
|
65
78
|
|
|
66
79
|
___
|
|
67
80
|
|
|
@@ -73,7 +86,7 @@ Minimum access level required
|
|
|
73
86
|
|
|
74
87
|
#### Defined in
|
|
75
88
|
|
|
76
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
89
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:89](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L89)
|
|
77
90
|
|
|
78
91
|
___
|
|
79
92
|
|
|
@@ -85,7 +98,7 @@ Page ID for permission checking
|
|
|
85
98
|
|
|
86
99
|
#### Defined in
|
|
87
100
|
|
|
88
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
101
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:92](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L92)
|
|
89
102
|
|
|
90
103
|
___
|
|
91
104
|
|
|
@@ -97,7 +110,7 @@ Enable strict mode for this route
|
|
|
97
110
|
|
|
98
111
|
#### Defined in
|
|
99
112
|
|
|
100
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
113
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:95](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L95)
|
|
101
114
|
|
|
102
115
|
___
|
|
103
116
|
|
|
@@ -118,4 +131,4 @@ Route metadata
|
|
|
118
131
|
|
|
119
132
|
#### Defined in
|
|
120
133
|
|
|
121
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
134
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:98](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L98)
|
package/docs/api/modules.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[@jmruthers/pace-core - v0.5.
|
|
1
|
+
[@jmruthers/pace-core - v0.5.111](README.md) / Exports
|
|
2
2
|
|
|
3
|
-
# @jmruthers/pace-core - v0.5.
|
|
3
|
+
# @jmruthers/pace-core - v0.5.111
|
|
4
4
|
|
|
5
5
|
**`File`**
|
|
6
6
|
|
|
@@ -641,7 +641,7 @@ You can create additional instances if needed for different contexts.
|
|
|
641
641
|
|
|
642
642
|
#### Defined in
|
|
643
643
|
|
|
644
|
-
[packages/core/src/rbac/cache.ts:
|
|
644
|
+
[packages/core/src/rbac/cache.ts:256](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/cache.ts#L256)
|
|
645
645
|
|
|
646
646
|
___
|
|
647
647
|
|
|
@@ -663,7 +663,7 @@ Cache key patterns for invalidation
|
|
|
663
663
|
|
|
664
664
|
#### Defined in
|
|
665
665
|
|
|
666
|
-
[packages/core/src/rbac/cache.ts:
|
|
666
|
+
[packages/core/src/rbac/cache.ts:261](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/cache.ts#L261)
|
|
667
667
|
|
|
668
668
|
___
|
|
669
669
|
|
|
@@ -2436,7 +2436,7 @@ function AdminApp() {
|
|
|
2436
2436
|
|
|
2437
2437
|
#### Defined in
|
|
2438
2438
|
|
|
2439
|
-
[packages/core/src/components/PaceAppLayout/PaceAppLayout.tsx:
|
|
2439
|
+
[packages/core/src/components/PaceAppLayout/PaceAppLayout.tsx:327](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/PaceAppLayout/PaceAppLayout.tsx#L327)
|
|
2440
2440
|
|
|
2441
2441
|
___
|
|
2442
2442
|
|
|
@@ -2480,7 +2480,7 @@ JSX.Element - The rendered login page with enhanced functionality
|
|
|
2480
2480
|
|
|
2481
2481
|
#### Defined in
|
|
2482
2482
|
|
|
2483
|
-
[packages/core/src/components/PaceLoginPage/PaceLoginPage.tsx:
|
|
2483
|
+
[packages/core/src/components/PaceLoginPage/PaceLoginPage.tsx:166](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/PaceLoginPage/PaceLoginPage.tsx#L166)
|
|
2484
2484
|
|
|
2485
2485
|
___
|
|
2486
2486
|
|
|
@@ -4529,7 +4529,7 @@ Can auto-infer userId from context if not provided.
|
|
|
4529
4529
|
<PermissionGuard
|
|
4530
4530
|
userId="user-123"
|
|
4531
4531
|
scope={{ organisationId: 'org-456' }}
|
|
4532
|
-
permission="
|
|
4532
|
+
permission="update:events"
|
|
4533
4533
|
pageId="page-789"
|
|
4534
4534
|
fallback={<AccessDenied />}
|
|
4535
4535
|
>
|
|
@@ -4538,7 +4538,7 @@ Can auto-infer userId from context if not provided.
|
|
|
4538
4538
|
|
|
4539
4539
|
// With context inference (requires auth context)
|
|
4540
4540
|
<PermissionGuard
|
|
4541
|
-
permission="
|
|
4541
|
+
permission="update:events"
|
|
4542
4542
|
scope={{ organisationId: 'org-456' }}
|
|
4543
4543
|
fallback={<AccessDenied />}
|
|
4544
4544
|
>
|
|
@@ -4654,7 +4654,7 @@ Wrapped handler function
|
|
|
4654
4654
|
|
|
4655
4655
|
```typescript
|
|
4656
4656
|
const protectedHandler = withPermissionGuard(
|
|
4657
|
-
{ permission: '
|
|
4657
|
+
{ permission: 'update:events', pageId: 'page-789' },
|
|
4658
4658
|
async (req, res) => {
|
|
4659
4659
|
// Handler logic here
|
|
4660
4660
|
res.json({ success: true });
|
|
@@ -4841,7 +4841,7 @@ import { createRBACMiddleware } from '@jmruthers/pace-core/rbac';
|
|
|
4841
4841
|
|
|
4842
4842
|
export default createRBACMiddleware({
|
|
4843
4843
|
protectedRoutes: [
|
|
4844
|
-
{ path: '/admin', permission: '
|
|
4844
|
+
{ path: '/admin', permission: 'update:admin' },
|
|
4845
4845
|
{ path: '/events', permission: 'read:events' },
|
|
4846
4846
|
],
|
|
4847
4847
|
fallbackUrl: '/access-denied',
|
|
@@ -4992,7 +4992,7 @@ Setup RBAC system
|
|
|
4992
4992
|
|
|
4993
4993
|
#### Defined in
|
|
4994
4994
|
|
|
4995
|
-
[packages/core/src/rbac/api.ts:
|
|
4995
|
+
[packages/core/src/rbac/api.ts:39](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L39)
|
|
4996
4996
|
|
|
4997
4997
|
___
|
|
4998
4998
|
|
|
@@ -5027,7 +5027,7 @@ const accessLevel = await getAccessLevel({
|
|
|
5027
5027
|
|
|
5028
5028
|
#### Defined in
|
|
5029
5029
|
|
|
5030
|
-
[packages/core/src/rbac/api.ts:
|
|
5030
|
+
[packages/core/src/rbac/api.ts:90](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L90)
|
|
5031
5031
|
|
|
5032
5032
|
___
|
|
5033
5033
|
|
|
@@ -5066,7 +5066,7 @@ const permissions = await getPermissionMap({
|
|
|
5066
5066
|
|
|
5067
5067
|
#### Defined in
|
|
5068
5068
|
|
|
5069
|
-
[packages/core/src/rbac/api.ts:
|
|
5069
|
+
[packages/core/src/rbac/api.ts:116](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L116)
|
|
5070
5070
|
|
|
5071
5071
|
___
|
|
5072
5072
|
|
|
@@ -5088,7 +5088,7 @@ ___
|
|
|
5088
5088
|
|
|
5089
5089
|
#### Defined in
|
|
5090
5090
|
|
|
5091
|
-
[packages/core/src/rbac/api.ts:
|
|
5091
|
+
[packages/core/src/rbac/api.ts:124](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L124)
|
|
5092
5092
|
|
|
5093
5093
|
___
|
|
5094
5094
|
|
|
@@ -5110,7 +5110,7 @@ ___
|
|
|
5110
5110
|
|
|
5111
5111
|
#### Defined in
|
|
5112
5112
|
|
|
5113
|
-
[packages/core/src/rbac/api.ts:
|
|
5113
|
+
[packages/core/src/rbac/api.ts:132](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L132)
|
|
5114
5114
|
|
|
5115
5115
|
___
|
|
5116
5116
|
|
|
@@ -5138,14 +5138,14 @@ Promise resolving to permission result
|
|
|
5138
5138
|
const canManage = await isPermitted({
|
|
5139
5139
|
userId: 'user-123',
|
|
5140
5140
|
scope: { organisationId: 'org-456' },
|
|
5141
|
-
permission: '
|
|
5141
|
+
permission: 'update:events',
|
|
5142
5142
|
pageId: 'page-789'
|
|
5143
5143
|
});
|
|
5144
5144
|
```
|
|
5145
5145
|
|
|
5146
5146
|
#### Defined in
|
|
5147
5147
|
|
|
5148
|
-
[packages/core/src/rbac/api.ts:
|
|
5148
|
+
[packages/core/src/rbac/api.ts:156](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L156)
|
|
5149
5149
|
|
|
5150
5150
|
___
|
|
5151
5151
|
|
|
@@ -5169,7 +5169,7 @@ Promise resolving to permission result
|
|
|
5169
5169
|
|
|
5170
5170
|
#### Defined in
|
|
5171
5171
|
|
|
5172
|
-
[packages/core/src/rbac/api.ts:
|
|
5172
|
+
[packages/core/src/rbac/api.ts:182](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L182)
|
|
5173
5173
|
|
|
5174
5174
|
___
|
|
5175
5175
|
|
|
@@ -5193,7 +5193,7 @@ Promise<boolean> - True if user has permission
|
|
|
5193
5193
|
|
|
5194
5194
|
#### Defined in
|
|
5195
5195
|
|
|
5196
|
-
[packages/core/src/rbac/api.ts:
|
|
5196
|
+
[packages/core/src/rbac/api.ts:215](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L215)
|
|
5197
5197
|
|
|
5198
5198
|
___
|
|
5199
5199
|
|
|
@@ -5221,7 +5221,7 @@ Promise resolving to true if user has any permission
|
|
|
5221
5221
|
|
|
5222
5222
|
#### Defined in
|
|
5223
5223
|
|
|
5224
|
-
[packages/core/src/rbac/api.ts:
|
|
5224
|
+
[packages/core/src/rbac/api.ts:225](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L225)
|
|
5225
5225
|
|
|
5226
5226
|
___
|
|
5227
5227
|
|
|
@@ -5249,7 +5249,7 @@ Promise resolving to true if user has all permissions
|
|
|
5249
5249
|
|
|
5250
5250
|
#### Defined in
|
|
5251
5251
|
|
|
5252
|
-
[packages/core/src/rbac/api.ts:
|
|
5252
|
+
[packages/core/src/rbac/api.ts:253](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/api.ts#L253)
|
|
5253
5253
|
|
|
5254
5254
|
___
|
|
5255
5255
|
|
|
@@ -5273,7 +5273,7 @@ RBACAuditManager instance
|
|
|
5273
5273
|
|
|
5274
5274
|
#### Defined in
|
|
5275
5275
|
|
|
5276
|
-
[packages/core/src/rbac/audit.ts:
|
|
5276
|
+
[packages/core/src/rbac/audit.ts:330](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L330)
|
|
5277
5277
|
|
|
5278
5278
|
___
|
|
5279
5279
|
|
|
@@ -5295,7 +5295,7 @@ Set the global audit manager
|
|
|
5295
5295
|
|
|
5296
5296
|
#### Defined in
|
|
5297
5297
|
|
|
5298
|
-
[packages/core/src/rbac/audit.ts:
|
|
5298
|
+
[packages/core/src/rbac/audit.ts:346](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L346)
|
|
5299
5299
|
|
|
5300
5300
|
___
|
|
5301
5301
|
|
|
@@ -5313,7 +5313,7 @@ Global audit manager or null if not set
|
|
|
5313
5313
|
|
|
5314
5314
|
#### Defined in
|
|
5315
5315
|
|
|
5316
|
-
[packages/core/src/rbac/audit.ts:
|
|
5316
|
+
[packages/core/src/rbac/audit.ts:355](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L355)
|
|
5317
5317
|
|
|
5318
5318
|
___
|
|
5319
5319
|
|
|
@@ -5335,7 +5335,7 @@ Emit an audit event using the global audit manager
|
|
|
5335
5335
|
|
|
5336
5336
|
#### Defined in
|
|
5337
5337
|
|
|
5338
|
-
[packages/core/src/rbac/audit.ts:
|
|
5338
|
+
[packages/core/src/rbac/audit.ts:364](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/audit.ts#L364)
|
|
5339
5339
|
|
|
5340
5340
|
___
|
|
5341
5341
|
|
|
@@ -5467,7 +5467,7 @@ React element with permission enforcement
|
|
|
5467
5467
|
|
|
5468
5468
|
#### Defined in
|
|
5469
5469
|
|
|
5470
|
-
[packages/core/src/rbac/components/PagePermissionGuard.tsx:
|
|
5470
|
+
[packages/core/src/rbac/components/PagePermissionGuard.tsx:534](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/PagePermissionGuard.tsx#L534)
|
|
5471
5471
|
|
|
5472
5472
|
___
|
|
5473
5473
|
|
|
@@ -5571,7 +5571,7 @@ React element with role-based routing
|
|
|
5571
5571
|
|
|
5572
5572
|
#### Defined in
|
|
5573
5573
|
|
|
5574
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
5574
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:181](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L181)
|
|
5575
5575
|
|
|
5576
5576
|
___
|
|
5577
5577
|
|
|
@@ -5593,7 +5593,7 @@ Error if used outside of RoleBasedRouter
|
|
|
5593
5593
|
|
|
5594
5594
|
#### Defined in
|
|
5595
5595
|
|
|
5596
|
-
[packages/core/src/rbac/components/RoleBasedRouter.tsx:
|
|
5596
|
+
[packages/core/src/rbac/components/RoleBasedRouter.tsx:395](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/RoleBasedRouter.tsx#L395)
|
|
5597
5597
|
|
|
5598
5598
|
___
|
|
5599
5599
|
|
|
@@ -5743,7 +5743,7 @@ RBACEngine instance
|
|
|
5743
5743
|
|
|
5744
5744
|
#### Defined in
|
|
5745
5745
|
|
|
5746
|
-
[packages/core/src/rbac/engine.ts:
|
|
5746
|
+
[packages/core/src/rbac/engine.ts:611](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L611)
|
|
5747
5747
|
|
|
5748
5748
|
___
|
|
5749
5749
|
|
|
@@ -5844,7 +5844,7 @@ function MyComponent() {
|
|
|
5844
5844
|
|
|
5845
5845
|
#### Defined in
|
|
5846
5846
|
|
|
5847
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
5847
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:201](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L201)
|
|
5848
5848
|
|
|
5849
5849
|
___
|
|
5850
5850
|
|
|
@@ -5894,7 +5894,7 @@ function MyComponent() {
|
|
|
5894
5894
|
|
|
5895
5895
|
#### Defined in
|
|
5896
5896
|
|
|
5897
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
5897
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:359](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L359)
|
|
5898
5898
|
|
|
5899
5899
|
___
|
|
5900
5900
|
|
|
@@ -5951,7 +5951,7 @@ function MyComponent() {
|
|
|
5951
5951
|
|
|
5952
5952
|
#### Defined in
|
|
5953
5953
|
|
|
5954
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
5954
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:434](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L434)
|
|
5955
5955
|
|
|
5956
5956
|
___
|
|
5957
5957
|
|
|
@@ -6002,7 +6002,7 @@ function MyComponent() {
|
|
|
6002
6002
|
|
|
6003
6003
|
#### Defined in
|
|
6004
6004
|
|
|
6005
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6005
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:517](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L517)
|
|
6006
6006
|
|
|
6007
6007
|
___
|
|
6008
6008
|
|
|
@@ -6053,7 +6053,7 @@ function MyComponent() {
|
|
|
6053
6053
|
|
|
6054
6054
|
#### Defined in
|
|
6055
6055
|
|
|
6056
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6056
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:603](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L603)
|
|
6057
6057
|
|
|
6058
6058
|
___
|
|
6059
6059
|
|
|
@@ -6104,7 +6104,7 @@ function MyComponent() {
|
|
|
6104
6104
|
|
|
6105
6105
|
#### Defined in
|
|
6106
6106
|
|
|
6107
|
-
[packages/core/src/rbac/hooks/usePermissions.ts:
|
|
6107
|
+
[packages/core/src/rbac/hooks/usePermissions.ts:688](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/usePermissions.ts#L688)
|
|
6108
6108
|
|
|
6109
6109
|
___
|
|
6110
6110
|
|
|
@@ -6124,7 +6124,7 @@ ___
|
|
|
6124
6124
|
|
|
6125
6125
|
#### Defined in
|
|
6126
6126
|
|
|
6127
|
-
[packages/core/src/rbac/hooks/useRBAC.ts:
|
|
6127
|
+
[packages/core/src/rbac/hooks/useRBAC.ts:51](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/useRBAC.ts#L51)
|
|
6128
6128
|
|
|
6129
6129
|
___
|
|
6130
6130
|
|
|
@@ -512,13 +512,17 @@ function Dropdown() {
|
|
|
512
512
|
You can compose multiple hooks to create custom functionality:
|
|
513
513
|
|
|
514
514
|
```tsx
|
|
515
|
+
import { useCan } from '@jmruthers/pace-core/rbac';
|
|
516
|
+
|
|
515
517
|
function useUserDashboard() {
|
|
516
|
-
const { user, loading: authLoading } = useUnifiedAuth();
|
|
518
|
+
const { user, loading: authLoading, selectedOrganisationId } = useUnifiedAuth();
|
|
517
519
|
const { events, selectedEvent } = useEvents();
|
|
518
|
-
const {
|
|
520
|
+
const { can: canUpdateEvents } = useCan(
|
|
521
|
+
user?.id || '',
|
|
522
|
+
{ organisationId: selectedOrganisationId || '', eventId: selectedEvent?.event_id, appId: undefined },
|
|
523
|
+
'update:events'
|
|
524
|
+
);
|
|
519
525
|
const { showToast } = useToast();
|
|
520
|
-
|
|
521
|
-
const canManageEvents = hasPermission('manage:events');
|
|
522
526
|
const userEvents = events.filter(event =>
|
|
523
527
|
event.organiserId === user?.id
|
|
524
528
|
);
|
|
@@ -607,7 +607,8 @@ SELECT * FROM data_user_events_get(NULL, 'user-id', 'org-123');
|
|
|
607
607
|
3. **Add comments**: Document purpose, parameters, returns
|
|
608
608
|
4. **Add grants**: `GRANT EXECUTE ON FUNCTION ... TO authenticated;`
|
|
609
609
|
5. **Add tests**: Include test queries in migration
|
|
610
|
-
6. **
|
|
610
|
+
6. **Regenerate types**: Run `npm run generate-types` to automatically generate TypeScript types from the database schema
|
|
611
|
+
7. **Verify types**: Check that `Database['public']['Functions']['function_name']` exists in `packages/core/src/types/database.generated.ts`
|
|
611
612
|
|
|
612
613
|
### Updating Existing Functions
|
|
613
614
|
|
|
@@ -615,6 +616,7 @@ SELECT * FROM data_user_events_get(NULL, 'user-id', 'org-123');
|
|
|
615
616
|
2. **Preserve backward compatibility** - Add new parameters with defaults
|
|
616
617
|
3. **Version changes** - Update function name if breaking changes (e.g., `_v2`)
|
|
617
618
|
4. **Document changes** - Add comments explaining changes
|
|
619
|
+
5. **Regenerate types**: Run `npm run generate-types` after function changes to update TypeScript types
|
|
618
620
|
|
|
619
621
|
### Deprecating Functions
|
|
620
622
|
|