@jmruthers/pace-core 0.5.1 → 0.5.3
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/{DataTable-GX3XERFJ.js → DataTable-ZQDRE46Q.js} +7 -6
- package/dist/{PublicLoadingSpinner-DztrzuJr.d.ts → PublicLoadingSpinner-Bq_-BeK-.d.ts} +1 -1
- package/dist/RBACProvider-BO4ilsQB.d.ts +63 -0
- package/dist/{UnifiedAuthProvider-w66zSCUf.d.ts → UnifiedAuthProvider-DGQsy-vY.d.ts} +2 -59
- package/dist/{api-ETQ6YJ3C.js → api-H5A3H4IR.js} +2 -2
- package/dist/{chunk-T3XIA4AJ.js → chunk-5H3C2SWM.js} +14 -16
- package/dist/chunk-5H3C2SWM.js.map +1 -0
- package/dist/chunk-5SIXIV7R.js +1925 -0
- package/dist/chunk-5SIXIV7R.js.map +1 -0
- package/dist/chunk-GNTALZV3.js +17 -0
- package/dist/chunk-GNTALZV3.js.map +1 -0
- package/dist/{chunk-C5G2A4PO.js → chunk-GWSBHC4J.js} +6 -6
- package/dist/{chunk-XJK2J4N6.js → chunk-HD7PYDUV.js} +4 -6
- package/dist/{chunk-XJK2J4N6.js.map → chunk-HD7PYDUV.js.map} +1 -1
- package/dist/{chunk-TGDCLPP2.js → chunk-HXX35Q2M.js} +6 -21
- package/dist/chunk-HXX35Q2M.js.map +1 -0
- package/dist/{chunk-5EL3KHOQ.js → chunk-K6B7BLSE.js} +2 -2
- package/dist/{chunk-GSNM5D6H.js → chunk-M4RW7PIP.js} +4 -4
- package/dist/{chunk-U6JDHVC2.js → chunk-PVMYVQSM.js} +6 -8
- package/dist/{chunk-U6JDHVC2.js.map → chunk-PVMYVQSM.js.map} +1 -1
- package/dist/{chunk-6CR3MRZN.js → chunk-QKHFMQ5R.js} +372 -11
- package/dist/{chunk-6CR3MRZN.js.map → chunk-QKHFMQ5R.js.map} +1 -1
- package/dist/chunk-QVYBYGT2.js +428 -0
- package/dist/chunk-QVYBYGT2.js.map +1 -0
- package/dist/{chunk-OEGRKULD.js → chunk-WJARTBCT.js} +56 -1
- package/dist/chunk-WJARTBCT.js.map +1 -0
- package/dist/components.d.ts +4 -3
- package/dist/components.js +16 -162
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +7 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +152 -17
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +3 -2
- package/dist/providers.js +6 -12
- package/dist/rbac/index.d.ts +167 -98
- package/dist/rbac/index.js +48 -1881
- package/dist/rbac/index.js.map +1 -1
- package/dist/styles/core.css +0 -58
- package/dist/types.d.ts +2 -2
- package/dist/{unified-CM7T0aTK.d.ts → unified-CMPjE_fv.d.ts} +1 -1
- package/dist/{usePublicRouteParams-B6i0KtXW.d.ts → usePublicRouteParams-B2OcAsur.d.ts} +1 -1
- package/dist/utils.js +12 -14
- package/dist/utils.js.map +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +73 -0
- package/docs/api/classes/MissingUserContextError.md +66 -0
- package/docs/api/classes/OrganisationContextRequiredError.md +66 -0
- package/docs/api/classes/PermissionDeniedError.md +73 -0
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +270 -0
- package/docs/api/classes/RBACCache.md +284 -0
- package/docs/api/classes/RBACEngine.md +141 -0
- package/docs/api/classes/RBACError.md +76 -0
- package/docs/api/classes/RBACNotInitializedError.md +66 -0
- package/docs/api/classes/SecureSupabaseClient.md +135 -0
- 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 +96 -0
- 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 +235 -0
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.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 +107 -0
- package/docs/api/interfaces/NavigationContextType.md +164 -0
- package/docs/api/interfaces/NavigationGuardProps.md +139 -0
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +117 -0
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +2 -2
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +85 -0
- package/docs/api/interfaces/PagePermissionContextType.md +140 -0
- package/docs/api/interfaces/PagePermissionGuardProps.md +153 -0
- package/docs/api/interfaces/PagePermissionProviderProps.md +119 -0
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +153 -0
- 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 +99 -0
- package/docs/api/interfaces/RBACContextType.md +474 -0
- package/docs/api/interfaces/RBACLogger.md +112 -0
- package/docs/api/interfaces/RBACProviderProps.md +107 -0
- package/docs/api/interfaces/RoleBasedRouterContextType.md +151 -0
- package/docs/api/interfaces/RoleBasedRouterProps.md +156 -0
- package/docs/api/interfaces/RouteAccessRecord.md +107 -0
- package/docs/api/interfaces/RouteConfig.md +121 -0
- package/docs/api/interfaces/SecureDataContextType.md +168 -0
- package/docs/api/interfaces/SecureDataProviderProps.md +132 -0
- 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/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +85 -85
- 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/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +2244 -3
- package/docs/migration-guide.md +43 -18
- package/docs/styles/README.md +187 -98
- package/docs/usage.md +32 -7
- package/package.json +2 -2
- package/src/components/Footer/Footer.test.tsx +482 -0
- package/src/components/Form/Form.test.tsx +1158 -0
- package/src/components/Header/Header.test.tsx +582 -0
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +489 -0
- package/src/components/Input/Input.test.tsx +466 -0
- package/src/components/LoadingSpinner/LoadingSpinner.test.tsx +450 -0
- package/src/components/LoginForm/LoginForm.test.tsx +816 -0
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +883 -0
- package/src/components/OrganisationSelector/OrganisationSelector.test.tsx +748 -0
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +891 -0
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +475 -0
- package/src/components/PasswordReset/PasswordChangeForm.test.tsx +621 -0
- package/src/components/PasswordReset/PasswordResetForm.test.tsx +605 -0
- package/src/components/Select/Select.test.tsx +948 -0
- package/src/components/SuperAdminGuard.tsx +1 -1
- package/src/components/Toast/Toast.test.tsx +586 -0
- package/src/components/Tooltip/Tooltip.test.tsx +852 -0
- package/src/components/UserMenu/UserMenu.test.tsx +702 -0
- package/src/components/UserMenu/UserMenu.tsx +2 -2
- package/src/hooks/useDebounce.test.ts +375 -0
- package/src/hooks/useOrganisationPermissions.test.ts +528 -0
- package/src/hooks/useOrganisationSecurity.test.ts +734 -0
- package/src/hooks/usePermissionCache.test.ts +542 -0
- package/src/hooks/usePermissionCache.ts +1 -1
- package/src/index.ts +2 -3
- package/src/providers/UnifiedAuthProvider.tsx +2 -2
- package/src/providers/index.ts +3 -1
- package/src/rbac/__tests__/integration.test.tsx +218 -0
- package/src/rbac/api.test.ts +441 -0
- package/src/rbac/hooks/index.ts +21 -0
- package/src/rbac/hooks/useCan.test.ts +461 -0
- package/src/rbac/hooks/usePermissions.test.ts +359 -0
- package/src/rbac/hooks/usePermissions.ts +567 -0
- package/src/rbac/hooks/useRBAC.simple.test.ts +90 -0
- package/src/rbac/hooks/useRBAC.test.ts +503 -0
- package/src/{hooks → rbac/hooks}/useRBAC.ts +7 -7
- package/src/rbac/index.ts +5 -10
- package/src/{providers → rbac/providers}/RBACProvider.tsx +6 -6
- package/src/rbac/providers/__tests__/RBACProvider.test.tsx +687 -0
- package/src/rbac/providers/index.ts +11 -0
- package/src/styles/core.css +0 -58
- package/src/utils/formatDate.test.ts +241 -0
- package/dist/chunk-AUE24LVR.js +0 -268
- package/dist/chunk-AUE24LVR.js.map +0 -1
- package/dist/chunk-COBPIXXQ.js +0 -379
- package/dist/chunk-COBPIXXQ.js.map +0 -1
- package/dist/chunk-OEGRKULD.js.map +0 -1
- package/dist/chunk-OYRY44Q2.js +0 -62
- package/dist/chunk-OYRY44Q2.js.map +0 -1
- package/dist/chunk-T3XIA4AJ.js.map +0 -1
- package/dist/chunk-TGDCLPP2.js.map +0 -1
- package/src/components/RBAC/PagePermissionGuard.tsx +0 -287
- package/src/components/RBAC/RBACGuard.tsx +0 -143
- package/src/components/RBAC/RBACProvider.tsx +0 -186
- package/src/components/RBAC/RoleBasedContent.tsx +0 -129
- package/src/components/RBAC/index.ts +0 -23
- package/src/rbac/hooks.ts +0 -570
- /package/dist/{DataTable-GX3XERFJ.js.map → DataTable-ZQDRE46Q.js.map} +0 -0
- /package/dist/{api-ETQ6YJ3C.js.map → api-H5A3H4IR.js.map} +0 -0
- /package/dist/{chunk-C5G2A4PO.js.map → chunk-GWSBHC4J.js.map} +0 -0
- /package/dist/{chunk-5EL3KHOQ.js.map → chunk-K6B7BLSE.js.map} +0 -0
- /package/dist/{chunk-GSNM5D6H.js.map → chunk-M4RW7PIP.js.map} +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
[@jmruthers/pace-core - v0.5.3](../README.md) / [Exports](../modules.md) / RBACEngine
|
|
2
|
+
|
|
3
|
+
# Class: RBACEngine
|
|
4
|
+
|
|
5
|
+
RBAC Engine
|
|
6
|
+
|
|
7
|
+
Implements the core permission algorithm with deny-overrides-allow precedence.
|
|
8
|
+
|
|
9
|
+
## Table of contents
|
|
10
|
+
|
|
11
|
+
### Constructors
|
|
12
|
+
|
|
13
|
+
- [constructor](RBACEngine.md#constructor)
|
|
14
|
+
|
|
15
|
+
### Methods
|
|
16
|
+
|
|
17
|
+
- [isPermitted](RBACEngine.md#ispermitted)
|
|
18
|
+
- [getAccessLevel](RBACEngine.md#getaccesslevel)
|
|
19
|
+
- [getPermissionMap](RBACEngine.md#getpermissionmap)
|
|
20
|
+
- [getAppConfig](RBACEngine.md#getappconfig)
|
|
21
|
+
|
|
22
|
+
## Constructors
|
|
23
|
+
|
|
24
|
+
### constructor
|
|
25
|
+
|
|
26
|
+
• **new RBACEngine**(`supabase`): [`RBACEngine`](RBACEngine.md)
|
|
27
|
+
|
|
28
|
+
#### Parameters
|
|
29
|
+
|
|
30
|
+
| Name | Type |
|
|
31
|
+
| :------ | :------ |
|
|
32
|
+
| `supabase` | `default`\<`Database`, ``"public"``, ``"public"``, `never`, {}\> |
|
|
33
|
+
|
|
34
|
+
#### Returns
|
|
35
|
+
|
|
36
|
+
[`RBACEngine`](RBACEngine.md)
|
|
37
|
+
|
|
38
|
+
#### Defined in
|
|
39
|
+
|
|
40
|
+
[packages/core/src/rbac/engine.ts:52](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L52)
|
|
41
|
+
|
|
42
|
+
## Methods
|
|
43
|
+
|
|
44
|
+
### isPermitted
|
|
45
|
+
|
|
46
|
+
▸ **isPermitted**(`input`, `securityContext?`): `Promise`\<`boolean`\>
|
|
47
|
+
|
|
48
|
+
Check if a user has a specific permission
|
|
49
|
+
|
|
50
|
+
#### Parameters
|
|
51
|
+
|
|
52
|
+
| Name | Type | Description |
|
|
53
|
+
| :------ | :------ | :------ |
|
|
54
|
+
| `input` | [`PermissionCheck`](../modules.md#permissioncheck) | Permission check input |
|
|
55
|
+
| `securityContext?` | `SecurityContext` | Optional security context for enhanced validation |
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`Promise`\<`boolean`\>
|
|
60
|
+
|
|
61
|
+
Promise resolving to permission result
|
|
62
|
+
|
|
63
|
+
#### Defined in
|
|
64
|
+
|
|
65
|
+
[packages/core/src/rbac/engine.ts:64](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L64)
|
|
66
|
+
|
|
67
|
+
___
|
|
68
|
+
|
|
69
|
+
### getAccessLevel
|
|
70
|
+
|
|
71
|
+
▸ **getAccessLevel**(`input`): `Promise`\<[`AccessLevel`](../modules.md#accesslevel)\>
|
|
72
|
+
|
|
73
|
+
Get user's access level in a scope
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
| Name | Type | Description |
|
|
78
|
+
| :------ | :------ | :------ |
|
|
79
|
+
| `input` | `Object` | Access level input |
|
|
80
|
+
| `input.userId` | `string` | - |
|
|
81
|
+
| `input.scope` | [`Scope`](../modules.md#scope) | - |
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`Promise`\<[`AccessLevel`](../modules.md#accesslevel)\>
|
|
86
|
+
|
|
87
|
+
Promise resolving to access level
|
|
88
|
+
|
|
89
|
+
#### Defined in
|
|
90
|
+
|
|
91
|
+
[packages/core/src/rbac/engine.ts:298](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L298)
|
|
92
|
+
|
|
93
|
+
___
|
|
94
|
+
|
|
95
|
+
### getPermissionMap
|
|
96
|
+
|
|
97
|
+
▸ **getPermissionMap**(`input`): `Promise`\<[`PermissionMap`](../modules.md#permissionmap)\>
|
|
98
|
+
|
|
99
|
+
Get user's permission map for a scope
|
|
100
|
+
|
|
101
|
+
#### Parameters
|
|
102
|
+
|
|
103
|
+
| Name | Type | Description |
|
|
104
|
+
| :------ | :------ | :------ |
|
|
105
|
+
| `input` | `Object` | Permission map input |
|
|
106
|
+
| `input.userId` | `string` | - |
|
|
107
|
+
| `input.scope` | [`Scope`](../modules.md#scope) | - |
|
|
108
|
+
|
|
109
|
+
#### Returns
|
|
110
|
+
|
|
111
|
+
`Promise`\<[`PermissionMap`](../modules.md#permissionmap)\>
|
|
112
|
+
|
|
113
|
+
Promise resolving to permission map
|
|
114
|
+
|
|
115
|
+
#### Defined in
|
|
116
|
+
|
|
117
|
+
[packages/core/src/rbac/engine.ts:361](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L361)
|
|
118
|
+
|
|
119
|
+
___
|
|
120
|
+
|
|
121
|
+
### getAppConfig
|
|
122
|
+
|
|
123
|
+
▸ **getAppConfig**(`appId`): `Promise`\<``null`` \| \{ `requires_event`: `boolean` }\>
|
|
124
|
+
|
|
125
|
+
Get app configuration including requires_event setting
|
|
126
|
+
|
|
127
|
+
#### Parameters
|
|
128
|
+
|
|
129
|
+
| Name | Type | Description |
|
|
130
|
+
| :------ | :------ | :------ |
|
|
131
|
+
| `appId` | `string` | App ID |
|
|
132
|
+
|
|
133
|
+
#### Returns
|
|
134
|
+
|
|
135
|
+
`Promise`\<``null`` \| \{ `requires_event`: `boolean` }\>
|
|
136
|
+
|
|
137
|
+
Promise resolving to app configuration
|
|
138
|
+
|
|
139
|
+
#### Defined in
|
|
140
|
+
|
|
141
|
+
[packages/core/src/rbac/engine.ts:461](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/engine.ts#L461)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[@jmruthers/pace-core - v0.5.3](../README.md) / [Exports](../modules.md) / RBACError
|
|
2
|
+
|
|
3
|
+
# Class: RBACError
|
|
4
|
+
|
|
5
|
+
## Hierarchy
|
|
6
|
+
|
|
7
|
+
- `Error`
|
|
8
|
+
|
|
9
|
+
↳ **`RBACError`**
|
|
10
|
+
|
|
11
|
+
↳↳ [`PermissionDeniedError`](PermissionDeniedError.md)
|
|
12
|
+
|
|
13
|
+
↳↳ [`OrganisationContextRequiredError`](OrganisationContextRequiredError.md)
|
|
14
|
+
|
|
15
|
+
↳↳ [`RBACNotInitializedError`](RBACNotInitializedError.md)
|
|
16
|
+
|
|
17
|
+
↳↳ [`InvalidScopeError`](InvalidScopeError.md)
|
|
18
|
+
|
|
19
|
+
↳↳ [`MissingUserContextError`](MissingUserContextError.md)
|
|
20
|
+
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
### Constructors
|
|
24
|
+
|
|
25
|
+
- [constructor](RBACError.md#constructor)
|
|
26
|
+
|
|
27
|
+
### Properties
|
|
28
|
+
|
|
29
|
+
- [code](RBACError.md#code)
|
|
30
|
+
- [context](RBACError.md#context)
|
|
31
|
+
|
|
32
|
+
## Constructors
|
|
33
|
+
|
|
34
|
+
### constructor
|
|
35
|
+
|
|
36
|
+
• **new RBACError**(`message`, `code`, `context?`): [`RBACError`](RBACError.md)
|
|
37
|
+
|
|
38
|
+
#### Parameters
|
|
39
|
+
|
|
40
|
+
| Name | Type |
|
|
41
|
+
| :------ | :------ |
|
|
42
|
+
| `message` | `string` |
|
|
43
|
+
| `code` | `string` |
|
|
44
|
+
| `context?` | `Record`\<`string`, `any`\> |
|
|
45
|
+
|
|
46
|
+
#### Returns
|
|
47
|
+
|
|
48
|
+
[`RBACError`](RBACError.md)
|
|
49
|
+
|
|
50
|
+
#### Overrides
|
|
51
|
+
|
|
52
|
+
Error.constructor
|
|
53
|
+
|
|
54
|
+
#### Defined in
|
|
55
|
+
|
|
56
|
+
[packages/core/src/rbac/types.ts:283](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L283)
|
|
57
|
+
|
|
58
|
+
## Properties
|
|
59
|
+
|
|
60
|
+
### code
|
|
61
|
+
|
|
62
|
+
• **code**: `string`
|
|
63
|
+
|
|
64
|
+
#### Defined in
|
|
65
|
+
|
|
66
|
+
[packages/core/src/rbac/types.ts:285](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L285)
|
|
67
|
+
|
|
68
|
+
___
|
|
69
|
+
|
|
70
|
+
### context
|
|
71
|
+
|
|
72
|
+
• `Optional` **context**: `Record`\<`string`, `any`\>
|
|
73
|
+
|
|
74
|
+
#### Defined in
|
|
75
|
+
|
|
76
|
+
[packages/core/src/rbac/types.ts:286](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L286)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[@jmruthers/pace-core - v0.5.3](../README.md) / [Exports](../modules.md) / RBACNotInitializedError
|
|
2
|
+
|
|
3
|
+
# Class: RBACNotInitializedError
|
|
4
|
+
|
|
5
|
+
## Hierarchy
|
|
6
|
+
|
|
7
|
+
- [`RBACError`](RBACError.md)
|
|
8
|
+
|
|
9
|
+
↳ **`RBACNotInitializedError`**
|
|
10
|
+
|
|
11
|
+
## Table of contents
|
|
12
|
+
|
|
13
|
+
### Constructors
|
|
14
|
+
|
|
15
|
+
- [constructor](RBACNotInitializedError.md#constructor)
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
- [code](RBACNotInitializedError.md#code)
|
|
20
|
+
- [context](RBACNotInitializedError.md#context)
|
|
21
|
+
|
|
22
|
+
## Constructors
|
|
23
|
+
|
|
24
|
+
### constructor
|
|
25
|
+
|
|
26
|
+
• **new RBACNotInitializedError**(): [`RBACNotInitializedError`](RBACNotInitializedError.md)
|
|
27
|
+
|
|
28
|
+
#### Returns
|
|
29
|
+
|
|
30
|
+
[`RBACNotInitializedError`](RBACNotInitializedError.md)
|
|
31
|
+
|
|
32
|
+
#### Overrides
|
|
33
|
+
|
|
34
|
+
[RBACError](RBACError.md).[constructor](RBACError.md#constructor)
|
|
35
|
+
|
|
36
|
+
#### Defined in
|
|
37
|
+
|
|
38
|
+
[packages/core/src/rbac/types.ts:315](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L315)
|
|
39
|
+
|
|
40
|
+
## Properties
|
|
41
|
+
|
|
42
|
+
### code
|
|
43
|
+
|
|
44
|
+
• **code**: `string`
|
|
45
|
+
|
|
46
|
+
#### Inherited from
|
|
47
|
+
|
|
48
|
+
[RBACError](RBACError.md).[code](RBACError.md#code)
|
|
49
|
+
|
|
50
|
+
#### Defined in
|
|
51
|
+
|
|
52
|
+
[packages/core/src/rbac/types.ts:285](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L285)
|
|
53
|
+
|
|
54
|
+
___
|
|
55
|
+
|
|
56
|
+
### context
|
|
57
|
+
|
|
58
|
+
• `Optional` **context**: `Record`\<`string`, `any`\>
|
|
59
|
+
|
|
60
|
+
#### Inherited from
|
|
61
|
+
|
|
62
|
+
[RBACError](RBACError.md).[context](RBACError.md#context)
|
|
63
|
+
|
|
64
|
+
#### Defined in
|
|
65
|
+
|
|
66
|
+
[packages/core/src/rbac/types.ts:286](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/types.ts#L286)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
[@jmruthers/pace-core - v0.5.3](../README.md) / [Exports](../modules.md) / SecureSupabaseClient
|
|
2
|
+
|
|
3
|
+
# Class: SecureSupabaseClient
|
|
4
|
+
|
|
5
|
+
Secure Supabase Client that enforces organisation context
|
|
6
|
+
|
|
7
|
+
This client automatically injects organisation context into all requests
|
|
8
|
+
and prevents queries that don't have the required context.
|
|
9
|
+
|
|
10
|
+
## Table of contents
|
|
11
|
+
|
|
12
|
+
### Constructors
|
|
13
|
+
|
|
14
|
+
- [constructor](SecureSupabaseClient.md#constructor)
|
|
15
|
+
|
|
16
|
+
### Methods
|
|
17
|
+
|
|
18
|
+
- [getOrganisationId](SecureSupabaseClient.md#getorganisationid)
|
|
19
|
+
- [getEventId](SecureSupabaseClient.md#geteventid)
|
|
20
|
+
- [getAppId](SecureSupabaseClient.md#getappid)
|
|
21
|
+
- [withContext](SecureSupabaseClient.md#withcontext)
|
|
22
|
+
- [getClient](SecureSupabaseClient.md#getclient)
|
|
23
|
+
|
|
24
|
+
## Constructors
|
|
25
|
+
|
|
26
|
+
### constructor
|
|
27
|
+
|
|
28
|
+
• **new SecureSupabaseClient**(`supabaseUrl`, `supabaseKey`, `organisationId`, `eventId?`, `appId?`): [`SecureSupabaseClient`](SecureSupabaseClient.md)
|
|
29
|
+
|
|
30
|
+
#### Parameters
|
|
31
|
+
|
|
32
|
+
| Name | Type |
|
|
33
|
+
| :------ | :------ |
|
|
34
|
+
| `supabaseUrl` | `string` |
|
|
35
|
+
| `supabaseKey` | `string` |
|
|
36
|
+
| `organisationId` | `string` |
|
|
37
|
+
| `eventId?` | `string` |
|
|
38
|
+
| `appId?` | `string` |
|
|
39
|
+
|
|
40
|
+
#### Returns
|
|
41
|
+
|
|
42
|
+
[`SecureSupabaseClient`](SecureSupabaseClient.md)
|
|
43
|
+
|
|
44
|
+
#### Defined in
|
|
45
|
+
|
|
46
|
+
[packages/core/src/rbac/secureClient.ts:30](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/secureClient.ts#L30)
|
|
47
|
+
|
|
48
|
+
## Methods
|
|
49
|
+
|
|
50
|
+
### getOrganisationId
|
|
51
|
+
|
|
52
|
+
▸ **getOrganisationId**(): `string`
|
|
53
|
+
|
|
54
|
+
Get the current organisation ID
|
|
55
|
+
|
|
56
|
+
#### Returns
|
|
57
|
+
|
|
58
|
+
`string`
|
|
59
|
+
|
|
60
|
+
#### Defined in
|
|
61
|
+
|
|
62
|
+
[packages/core/src/rbac/secureClient.ts:151](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/secureClient.ts#L151)
|
|
63
|
+
|
|
64
|
+
___
|
|
65
|
+
|
|
66
|
+
### getEventId
|
|
67
|
+
|
|
68
|
+
▸ **getEventId**(): `undefined` \| `string`
|
|
69
|
+
|
|
70
|
+
Get the current event ID
|
|
71
|
+
|
|
72
|
+
#### Returns
|
|
73
|
+
|
|
74
|
+
`undefined` \| `string`
|
|
75
|
+
|
|
76
|
+
#### Defined in
|
|
77
|
+
|
|
78
|
+
[packages/core/src/rbac/secureClient.ts:158](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/secureClient.ts#L158)
|
|
79
|
+
|
|
80
|
+
___
|
|
81
|
+
|
|
82
|
+
### getAppId
|
|
83
|
+
|
|
84
|
+
▸ **getAppId**(): `undefined` \| `string`
|
|
85
|
+
|
|
86
|
+
Get the current app ID
|
|
87
|
+
|
|
88
|
+
#### Returns
|
|
89
|
+
|
|
90
|
+
`undefined` \| `string`
|
|
91
|
+
|
|
92
|
+
#### Defined in
|
|
93
|
+
|
|
94
|
+
[packages/core/src/rbac/secureClient.ts:165](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/secureClient.ts#L165)
|
|
95
|
+
|
|
96
|
+
___
|
|
97
|
+
|
|
98
|
+
### withContext
|
|
99
|
+
|
|
100
|
+
▸ **withContext**(`updates`): [`SecureSupabaseClient`](SecureSupabaseClient.md)
|
|
101
|
+
|
|
102
|
+
Create a new client with updated context
|
|
103
|
+
|
|
104
|
+
#### Parameters
|
|
105
|
+
|
|
106
|
+
| Name | Type |
|
|
107
|
+
| :------ | :------ |
|
|
108
|
+
| `updates` | `Object` |
|
|
109
|
+
| `updates.organisationId?` | `string` |
|
|
110
|
+
| `updates.eventId?` | `string` |
|
|
111
|
+
| `updates.appId?` | `string` |
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
[`SecureSupabaseClient`](SecureSupabaseClient.md)
|
|
116
|
+
|
|
117
|
+
#### Defined in
|
|
118
|
+
|
|
119
|
+
[packages/core/src/rbac/secureClient.ts:172](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/secureClient.ts#L172)
|
|
120
|
+
|
|
121
|
+
___
|
|
122
|
+
|
|
123
|
+
### getClient
|
|
124
|
+
|
|
125
|
+
▸ **getClient**(): `default`\<`Database`, ``"public"``, ``"public"``, `never`, {}\>
|
|
126
|
+
|
|
127
|
+
Get the underlying Supabase client (for internal use only)
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`default`\<`Database`, ``"public"``, ``"public"``, `never`, {}\>
|
|
132
|
+
|
|
133
|
+
#### Defined in
|
|
134
|
+
|
|
135
|
+
[packages/core/src/rbac/secureClient.ts:190](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/secureClient.ts#L190)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[@jmruthers/pace-core - v0.5.3](../README.md) / [Exports](../modules.md) / DataAccessRecord
|
|
2
|
+
|
|
3
|
+
# Interface: DataAccessRecord
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
### Properties
|
|
8
|
+
|
|
9
|
+
- [table](DataAccessRecord.md#table)
|
|
10
|
+
- [operation](DataAccessRecord.md#operation)
|
|
11
|
+
- [userId](DataAccessRecord.md#userid)
|
|
12
|
+
- [scope](DataAccessRecord.md#scope)
|
|
13
|
+
- [allowed](DataAccessRecord.md#allowed)
|
|
14
|
+
- [timestamp](DataAccessRecord.md#timestamp)
|
|
15
|
+
- [query](DataAccessRecord.md#query)
|
|
16
|
+
- [filters](DataAccessRecord.md#filters)
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
### table
|
|
21
|
+
|
|
22
|
+
• **table**: `string`
|
|
23
|
+
|
|
24
|
+
#### Defined in
|
|
25
|
+
|
|
26
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:65](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L65)
|
|
27
|
+
|
|
28
|
+
___
|
|
29
|
+
|
|
30
|
+
### operation
|
|
31
|
+
|
|
32
|
+
• **operation**: `string`
|
|
33
|
+
|
|
34
|
+
#### Defined in
|
|
35
|
+
|
|
36
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:66](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L66)
|
|
37
|
+
|
|
38
|
+
___
|
|
39
|
+
|
|
40
|
+
### userId
|
|
41
|
+
|
|
42
|
+
• **userId**: `string`
|
|
43
|
+
|
|
44
|
+
#### Defined in
|
|
45
|
+
|
|
46
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:67](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L67)
|
|
47
|
+
|
|
48
|
+
___
|
|
49
|
+
|
|
50
|
+
### scope
|
|
51
|
+
|
|
52
|
+
• **scope**: [`Scope`](../modules.md#scope)
|
|
53
|
+
|
|
54
|
+
#### Defined in
|
|
55
|
+
|
|
56
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:68](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L68)
|
|
57
|
+
|
|
58
|
+
___
|
|
59
|
+
|
|
60
|
+
### allowed
|
|
61
|
+
|
|
62
|
+
• **allowed**: `boolean`
|
|
63
|
+
|
|
64
|
+
#### Defined in
|
|
65
|
+
|
|
66
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:69](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L69)
|
|
67
|
+
|
|
68
|
+
___
|
|
69
|
+
|
|
70
|
+
### timestamp
|
|
71
|
+
|
|
72
|
+
• **timestamp**: `string`
|
|
73
|
+
|
|
74
|
+
#### Defined in
|
|
75
|
+
|
|
76
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:70](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L70)
|
|
77
|
+
|
|
78
|
+
___
|
|
79
|
+
|
|
80
|
+
### query
|
|
81
|
+
|
|
82
|
+
• `Optional` **query**: `string`
|
|
83
|
+
|
|
84
|
+
#### Defined in
|
|
85
|
+
|
|
86
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:71](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L71)
|
|
87
|
+
|
|
88
|
+
___
|
|
89
|
+
|
|
90
|
+
### filters
|
|
91
|
+
|
|
92
|
+
• `Optional` **filters**: `Record`\<`string`, `any`\>
|
|
93
|
+
|
|
94
|
+
#### Defined in
|
|
95
|
+
|
|
96
|
+
[packages/core/src/rbac/components/SecureDataProvider.tsx:72](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/components/SecureDataProvider.tsx#L72)
|