Skip to content

Commit ab8ec9b

Browse files
committed
docs improvements
1 parent c0db125 commit ab8ec9b

23 files changed

+953
-8
lines changed

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,14 @@ Client library for interacting with the Cerbos policy decision point service ove
8282
OpenTelemetry instrumentation for the [gRPC](./grpc.md) and [HTTP](./http.md) client libraries.
8383

8484

85+
</td></tr>
86+
<tr><td>
87+
88+
[@cerbos/react](./react.md)
89+
90+
91+
</td><td>
92+
93+
8594
</td></tr>
8695
</tbody></table>

docs/react.asyncresult.data.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [AsyncResult](./react.asyncresult.md) &gt; [data](./react.asyncresult.data.md)
4+
5+
## AsyncResult.data property
6+
7+
**Signature:**
8+
9+
```typescript
10+
data: T | undefined;
11+
```

docs/react.asyncresult.error.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [AsyncResult](./react.asyncresult.md) &gt; [error](./react.asyncresult.error.md)
4+
5+
## AsyncResult.error property
6+
7+
**Signature:**
8+
9+
```typescript
10+
error: Error | undefined;
11+
```

docs/react.asyncresult.isloading.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [AsyncResult](./react.asyncresult.md) &gt; [isLoading](./react.asyncresult.isloading.md)
4+
5+
## AsyncResult.isLoading property
6+
7+
**Signature:**
8+
9+
```typescript
10+
isLoading: boolean;
11+
```

docs/react.asyncresult.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [AsyncResult](./react.asyncresult.md)
4+
5+
## AsyncResult interface
6+
7+
8+
**Signature:**
9+
10+
```typescript
11+
export interface AsyncResult<T>
12+
```
13+
14+
## Properties
15+
16+
<table><thead><tr><th>
17+
18+
Property
19+
20+
21+
</th><th>
22+
23+
Modifiers
24+
25+
26+
</th><th>
27+
28+
Type
29+
30+
31+
</th><th>
32+
33+
Description
34+
35+
36+
</th></tr></thead>
37+
<tbody><tr><td>
38+
39+
[data](./react.asyncresult.data.md)
40+
41+
42+
</td><td>
43+
44+
45+
</td><td>
46+
47+
T \| undefined
48+
49+
50+
</td><td>
51+
52+
53+
</td></tr>
54+
<tr><td>
55+
56+
[error](./react.asyncresult.error.md)
57+
58+
59+
</td><td>
60+
61+
62+
</td><td>
63+
64+
Error \| undefined
65+
66+
67+
</td><td>
68+
69+
70+
</td></tr>
71+
<tr><td>
72+
73+
[isLoading](./react.asyncresult.isloading.md)
74+
75+
76+
</td><td>
77+
78+
79+
</td><td>
80+
81+
boolean
82+
83+
84+
</td><td>
85+
86+
87+
</td></tr>
88+
</tbody></table>

docs/react.cerbosprovider.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [CerbosProvider](./react.cerbosprovider.md)
4+
5+
## CerbosProvider() function
6+
7+
Component to provide the Cerbos client to down the component tree, should be placed closer to the root of the application. The principal is required but can be an anonymous user in case your application requires authorization checks for unauthenticated users.
8+
9+
**Signature:**
10+
11+
```typescript
12+
export declare function CerbosProvider({ children, client, principal, auxData, }: CerbosProviderProps): ReactElement;
13+
```
14+
15+
## Parameters
16+
17+
<table><thead><tr><th>
18+
19+
Parameter
20+
21+
22+
</th><th>
23+
24+
Type
25+
26+
27+
</th><th>
28+
29+
Description
30+
31+
32+
</th></tr></thead>
33+
<tbody><tr><td>
34+
35+
{ children, client, principal, auxData, }
36+
37+
38+
</td><td>
39+
40+
[CerbosProviderProps](./react.cerbosproviderprops.md)
41+
42+
43+
</td><td>
44+
45+
46+
</td></tr>
47+
</tbody></table>
48+
**Returns:**
49+
50+
ReactElement
51+
52+
## Example
53+
54+
55+
```typescript
56+
import { Embedded as Cerbos } from "@cerbos/embedded";
57+
58+
// Initialize the Cerbos client using any of the client libraries
59+
// that fit the needs of your application. In this example we are
60+
// using `@cerbos/embedded`.
61+
const client = new Cerbos(...);
62+
63+
function MyApp({ children }) {
64+
const user = useUser();
65+
66+
return (
67+
<CerbosProvider
68+
client={client}
69+
principal={
70+
// Build and pass the principal object to the provider.
71+
{
72+
id: user ? user.id : "###ANONYMOUS_USER###", // We defined an arbitrary ID for anonymous users here, it will help us identify the checks for anonymous users in the Cerbos logs
73+
roles: user ? user.roles : [], // Pass the roles of the user, it the user is not authenticated, pass an empty array
74+
auxData: ... //optional
75+
}
76+
}
77+
>
78+
{children}
79+
</CerbosProvider>
80+
);
81+
}
82+
```
83+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [CerbosProviderProps](./react.cerbosproviderprops.md) &gt; [auxData](./react.cerbosproviderprops.auxdata.md)
4+
5+
## CerbosProviderProps.auxData property
6+
7+
**Signature:**
8+
9+
```typescript
10+
auxData?: Pick<AuxData, "jwt"> | undefined;
11+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [CerbosProviderProps](./react.cerbosproviderprops.md) &gt; [children](./react.cerbosproviderprops.children.md)
4+
5+
## CerbosProviderProps.children property
6+
7+
**Signature:**
8+
9+
```typescript
10+
children: ReactNode;
11+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [CerbosProviderProps](./react.cerbosproviderprops.md) &gt; [client](./react.cerbosproviderprops.client.md)
4+
5+
## CerbosProviderProps.client property
6+
7+
**Signature:**
8+
9+
```typescript
10+
client: Client;
11+
```

docs/react.cerbosproviderprops.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [CerbosProviderProps](./react.cerbosproviderprops.md)
4+
5+
## CerbosProviderProps interface
6+
7+
8+
**Signature:**
9+
10+
```typescript
11+
export interface CerbosProviderProps
12+
```
13+
14+
## Properties
15+
16+
<table><thead><tr><th>
17+
18+
Property
19+
20+
21+
</th><th>
22+
23+
Modifiers
24+
25+
26+
</th><th>
27+
28+
Type
29+
30+
31+
</th><th>
32+
33+
Description
34+
35+
36+
</th></tr></thead>
37+
<tbody><tr><td>
38+
39+
[auxData?](./react.cerbosproviderprops.auxdata.md)
40+
41+
42+
</td><td>
43+
44+
45+
</td><td>
46+
47+
Pick&lt;[AuxData](./core.auxdata.md)<!-- -->, "jwt"&gt; \| undefined
48+
49+
50+
</td><td>
51+
52+
_(Optional)_
53+
54+
55+
</td></tr>
56+
<tr><td>
57+
58+
[children](./react.cerbosproviderprops.children.md)
59+
60+
61+
</td><td>
62+
63+
64+
</td><td>
65+
66+
ReactNode
67+
68+
69+
</td><td>
70+
71+
72+
</td></tr>
73+
<tr><td>
74+
75+
[client](./react.cerbosproviderprops.client.md)
76+
77+
78+
</td><td>
79+
80+
81+
</td><td>
82+
83+
[Client](./core.client.md)
84+
85+
86+
</td><td>
87+
88+
89+
</td></tr>
90+
<tr><td>
91+
92+
[principal](./react.cerbosproviderprops.principal.md)
93+
94+
95+
</td><td>
96+
97+
98+
</td><td>
99+
100+
[Principal](./core.principal.md)
101+
102+
103+
</td><td>
104+
105+
106+
</td></tr>
107+
</tbody></table>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@cerbos/react](./react.md) &gt; [CerbosProviderProps](./react.cerbosproviderprops.md) &gt; [principal](./react.cerbosproviderprops.principal.md)
4+
5+
## CerbosProviderProps.principal property
6+
7+
**Signature:**
8+
9+
```typescript
10+
principal: Principal;
11+
```

0 commit comments

Comments
 (0)