Skip to content

Commit 3b337e7

Browse files
committed
docs: Add schema table to README
1 parent a725050 commit 3b337e7

File tree

8 files changed

+489
-66
lines changed

8 files changed

+489
-66
lines changed

.changeset/early-balloons-judge.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@data-client/normalizr': patch
3+
'@data-client/endpoint': patch
4+
'@data-client/rest': patch
5+
'@data-client/graphql': patch
6+
---
7+
8+
Add schema table to README

README.md

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,85 @@ For the small price of 9kb gziped.    [🏁Get started now](https://da
294294

295295
### [Define Data](https://dataclient.io/docs/getting-started/resource)
296296

297-
- Networking definition
298-
- [Endpoints](https://dataclient.io/rest/api/Endpoint): [RestEndpoint](https://dataclient.io/rest/api/RestEndpoint), [GQLEndpoint](https://dataclient.io/graphql/api/GQLEndpoint)
299-
- [Resources](https://dataclient.io/docs/getting-started/resource): [resource()](https://dataclient.io/rest/api/resource), [hookifyResource()](https://dataclient.io/rest/api/hookifyResource)
300-
- [Data model](https://dataclient.io/docs/concepts/normalization)
301-
- [Entity](https://dataclient.io/rest/api/Entity), [schema.Entity](https://dataclient.io/rest/api/schema.Entity) mixin, [GQLEntity](https://dataclient.io/graphql/api/GQLEntity)
302-
- [Object](https://dataclient.io/rest/api/Object)
303-
- [Array](https://dataclient.io/rest/api/Array)
304-
- [Values](https://dataclient.io/rest/api/Values)
305-
- [All](https://dataclient.io/rest/api/All)
306-
- [Collection](https://dataclient.io/rest/api/Collection)
307-
- [Query](https://dataclient.io/rest/api/Query)
308-
- [Union](https://dataclient.io/rest/api/Union)
309-
- [Invalidate](https://dataclient.io/rest/api/Invalidate)
297+
#### Networking definition
298+
- [Endpoints](https://dataclient.io/rest/api/Endpoint): [RestEndpoint](https://dataclient.io/rest/api/RestEndpoint), [GQLEndpoint](https://dataclient.io/graphql/api/GQLEndpoint)
299+
- [Resources](https://dataclient.io/docs/getting-started/resource): [resource()](https://dataclient.io/rest/api/resource), [hookifyResource()](https://dataclient.io/rest/api/hookifyResource)
300+
301+
<table>
302+
<caption>
303+
<a href="https://dataclient.io/docs/concepts/normalization">Data model</a>
304+
</caption>
305+
<thead>
306+
<tr>
307+
<th>Data Type</th>
308+
<th>Mutable</th>
309+
<th>Schema</th>
310+
<th>Description</th>
311+
<th><a href="https://dataclient.io/rest/api/schema#queryable">Queryable</a></th>
312+
</tr>
313+
</thead>
314+
<tbody><tr>
315+
<td rowSpan="4"><a href="https://en.wikipedia.org/wiki/Object_(computer_science)">Object</a></td>
316+
<td align="center">✅</td>
317+
<td><a href="https://dataclient.io/rest/api/Entity">Entity</a>, <a href="https://dataclient.io/rest/api/schema.Entity">schema.Entity</a> mixin</td>
318+
<td>single <em>unique</em> object</td>
319+
<td align="center">✅</td>
320+
</tr>
321+
<tr>
322+
<td align="center">✅</td>
323+
<td><a href="https://dataclient.io/rest/api/Union">Union(Entity)</a></td>
324+
<td>polymorphic objects (<code>A | B</code>)</td>
325+
<td align="center">✅</td>
326+
</tr>
327+
<tr>
328+
<td align="center">🛑</td>
329+
<td><a href="https://dataclient.io/rest/api/Object">Object</a></td>
330+
<td>statically known keys</td>
331+
<td align="center">🛑</td>
332+
</tr>
333+
<tr>
334+
<td align="center"></td>
335+
<td><a href="https://dataclient.io/rest/api/Invalidate">Invalidate(Entity)</a></td>
336+
<td><a href="https://dataclient.io/docs/concepts/expiry-policy#invalidate-entity">delete an entity</a></td>
337+
<td align="center">🛑</td>
338+
</tr>
339+
<tr>
340+
<td rowSpan="3"><a href="https://en.wikipedia.org/wiki/List_(abstract_data_type)">List</a></td>
341+
<td align="center">✅</td>
342+
<td><a href="https://dataclient.io/rest/api/Collection">Collection(Array)</a></td>
343+
<td>growable lists</td>
344+
<td align="center">✅</td>
345+
</tr>
346+
<tr>
347+
<td align="center">🛑</td>
348+
<td><a href="https://dataclient.io/rest/api/Array">Array</a></td>
349+
<td>immutable lists</td>
350+
<td align="center">🛑</td>
351+
</tr>
352+
<tr>
353+
<td align="center">✅</td>
354+
<td><a href="https://dataclient.io/rest/api/All">All</a></td>
355+
<td>list of all entities of a kind</td>
356+
<td align="center">✅</td>
357+
</tr>
358+
<tr>
359+
<td rowSpan="2"><a href="https://en.wikipedia.org/wiki/Associative_array">Map</a></td>
360+
<td align="center">✅</td>
361+
<td><a href="https://dataclient.io/rest/api/Collection">Collection(Values)</a></td>
362+
<td>growable maps</td>
363+
<td align="center">✅</td>
364+
</tr>
365+
<tr>
366+
<td align="center">🛑</td>
367+
<td><a href="https://dataclient.io/rest/api/Values">Values</a></td>
368+
<td>immutable maps</td>
369+
<td align="center">🛑</td>
370+
</tr>
371+
<tr>
372+
<td>any</td>
373+
<td align="center"></td>
374+
<td><a href="https://dataclient.io/rest/api/Query">Query(Queryable)</a></td>
375+
<td>memoized custom transforms</td>
376+
<td align="center">✅</td>
377+
</tr>
378+
</tbody></table>

docs/rest/shared/_SortDemo.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66

77
<HooksPlayground fixtures={postFixtures} getInitialInterceptorData={getInitialInterceptorData} row defaultTab={props.defaultTab}>
88

9-
```ts title="getPosts" {20-27}
9+
```ts title="getPosts" {17-24}
1010
import { Entity, RestEndpoint } from '@data-client/rest';
1111

1212
export class Post extends Entity {

packages/endpoint/README.md

Lines changed: 80 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -201,36 +201,85 @@ const UserDetail = new Endpoint(({ id }) ⇒ fetch(`/users/${id}`));
201201
const UserDetailNormalized = UserDetail.extend({ schema: User });
202202
```
203203

204-
### Index
205-
206-
```typescript
207-
import { Entity } from '@data-client/normalizr';
208-
import { Index } from '@data-client/endpoint';
209-
210-
class User extends Entity {
211-
id = '';
212-
username = '';\
213-
214-
static indexes = ['username'] as const;
215-
}
216-
217-
const bob = useQuery(User, { username: 'bob' });
218-
219-
// @ts-expect-error Indexes don't fetch, they just retrieve already existing data
220-
const bob = useSuspense(UserIndex, { username: 'bob' });
221-
```
222-
223204
## API
224205

225-
- Networking definition
226-
- [Endpoints](https://dataclient.io/rest/api/Endpoint)
227-
- [Data model](https://dataclient.io/docs/concepts/normalization)
228-
- [Entity](https://dataclient.io/rest/api/Entity), [schema.Entity](https://dataclient.io/rest/api/schema.Entity) mixin
229-
- [Object](https://dataclient.io/rest/api/Object)
230-
- [Array](https://dataclient.io/rest/api/Array)
231-
- [Values](https://dataclient.io/rest/api/Values)
232-
- [All](https://dataclient.io/rest/api/All)
233-
- [Query](https://dataclient.io/rest/api/Query)
234-
- [Collection](https://dataclient.io/rest/api/Collection)
235-
- [Union](https://dataclient.io/rest/api/Union)
236-
- [Invalidate](https://dataclient.io/rest/api/Invalidate)
206+
Networking definition: [Endpoints](https://dataclient.io/rest/api/Endpoint)
207+
208+
<table>
209+
<caption>
210+
<a href="https://dataclient.io/docs/concepts/normalization">Data model</a>
211+
</caption>
212+
<thead>
213+
<tr>
214+
<th>Data Type</th>
215+
<th>Mutable</th>
216+
<th>Schema</th>
217+
<th>Description</th>
218+
<th><a href="https://dataclient.io/rest/api/schema#queryable">Queryable</a></th>
219+
</tr>
220+
</thead>
221+
<tbody><tr>
222+
<td rowSpan="4"><a href="https://en.wikipedia.org/wiki/Object_(computer_science)">Object</a></td>
223+
<td align="center">✅</td>
224+
<td><a href="https://dataclient.io/rest/api/Entity">Entity</a>, <a href="https://dataclient.io/rest/api/schema.Entity">schema.Entity</a> mixin</td>
225+
<td>single <em>unique</em> object</td>
226+
<td align="center">✅</td>
227+
</tr>
228+
<tr>
229+
<td align="center">✅</td>
230+
<td><a href="https://dataclient.io/rest/api/Union">Union(Entity)</a></td>
231+
<td>polymorphic objects (<code>A | B</code>)</td>
232+
<td align="center">✅</td>
233+
</tr>
234+
<tr>
235+
<td align="center">🛑</td>
236+
<td><a href="https://dataclient.io/rest/api/Object">Object</a></td>
237+
<td>statically known keys</td>
238+
<td align="center">🛑</td>
239+
</tr>
240+
<tr>
241+
<td align="center"></td>
242+
<td><a href="https://dataclient.io/rest/api/Invalidate">Invalidate(Entity)</a></td>
243+
<td><a href="https://dataclient.io/docs/concepts/expiry-policy#invalidate-entity">delete an entity</a></td>
244+
<td align="center">🛑</td>
245+
</tr>
246+
<tr>
247+
<td rowSpan="3"><a href="https://en.wikipedia.org/wiki/List_(abstract_data_type)">List</a></td>
248+
<td align="center">✅</td>
249+
<td><a href="https://dataclient.io/rest/api/Collection">Collection(Array)</a></td>
250+
<td>growable lists</td>
251+
<td align="center">✅</td>
252+
</tr>
253+
<tr>
254+
<td align="center">🛑</td>
255+
<td><a href="https://dataclient.io/rest/api/Array">Array</a></td>
256+
<td>immutable lists</td>
257+
<td align="center">🛑</td>
258+
</tr>
259+
<tr>
260+
<td align="center">✅</td>
261+
<td><a href="https://dataclient.io/rest/api/All">All</a></td>
262+
<td>list of all entities of a kind</td>
263+
<td align="center">✅</td>
264+
</tr>
265+
<tr>
266+
<td rowSpan="2"><a href="https://en.wikipedia.org/wiki/Associative_array">Map</a></td>
267+
<td align="center">✅</td>
268+
<td><a href="https://dataclient.io/rest/api/Collection">Collection(Values)</a></td>
269+
<td>growable maps</td>
270+
<td align="center">✅</td>
271+
</tr>
272+
<tr>
273+
<td align="center">🛑</td>
274+
<td><a href="https://dataclient.io/rest/api/Values">Values</a></td>
275+
<td>immutable maps</td>
276+
<td align="center">🛑</td>
277+
</tr>
278+
<tr>
279+
<td>any</td>
280+
<td align="center"></td>
281+
<td><a href="https://dataclient.io/rest/api/Query">Query(Queryable)</a></td>
282+
<td>memoized custom transforms</td>
283+
<td align="center">✅</td>
284+
</tr>
285+
</tbody></table>

packages/graphql/README.md

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,84 @@ return <ReviewForm onSubmit={data => controller.fetch(createReview, data)} />;
9393

9494
## API
9595

96-
- Networking definition
96+
#### Networking definition
9797
- [Endpoints](https://dataclient.io/rest/api/Endpoint): [GQLEndpoint](https://dataclient.io/graphql/api/GQLEndpoint)
98-
- [Data model](https://dataclient.io/docs/concepts/normalization)
99-
- [Entity](https://dataclient.io/rest/api/Entity), [schema.Entity](https://dataclient.io/rest/api/schema.Entity) mixin, [GQLEntity](https://dataclient.io/graphql/api/GQLEntity)
100-
- [Object](https://dataclient.io/rest/api/Object)
101-
- [Array](https://dataclient.io/rest/api/Array)
102-
- [Values](https://dataclient.io/rest/api/Values)
103-
- [All](https://dataclient.io/rest/api/All)
104-
- [Collection](https://dataclient.io/rest/api/Collection)
105-
- [Union](https://dataclient.io/rest/api/Union)
106-
- [Invalidate](https://dataclient.io/rest/api/Invalidate)
98+
99+
<table>
100+
<caption>
101+
<a href="https://dataclient.io/docs/concepts/normalization">Data model</a>
102+
</caption>
103+
<thead>
104+
<tr>
105+
<th>Data Type</th>
106+
<th>Mutable</th>
107+
<th>Schema</th>
108+
<th>Description</th>
109+
<th><a href="https://dataclient.io/rest/api/schema#queryable">Queryable</a></th>
110+
</tr>
111+
</thead>
112+
<tbody><tr>
113+
<td rowSpan="4"><a href="https://en.wikipedia.org/wiki/Object_(computer_science)">Object</a></td>
114+
<td align="center">✅</td>
115+
<td><a href="https://dataclient.io/rest/api/Entity">Entity</a>, <a href="https://dataclient.io/rest/api/schema.Entity">schema.Entity</a> mixin, <a href="https://dataclient.io/graphql/api/GQLEntity">GQLEntity</a></td>
116+
<td>single <em>unique</em> object</td>
117+
<td align="center">✅</td>
118+
</tr>
119+
<tr>
120+
<td align="center">✅</td>
121+
<td><a href="https://dataclient.io/rest/api/Union">Union(Entity)</a></td>
122+
<td>polymorphic objects (<code>A | B</code>)</td>
123+
<td align="center">✅</td>
124+
</tr>
125+
<tr>
126+
<td align="center">🛑</td>
127+
<td><a href="https://dataclient.io/rest/api/Object">Object</a></td>
128+
<td>statically known keys</td>
129+
<td align="center">🛑</td>
130+
</tr>
131+
<tr>
132+
<td align="center"></td>
133+
<td><a href="https://dataclient.io/rest/api/Invalidate">Invalidate(Entity)</a></td>
134+
<td><a href="https://dataclient.io/docs/concepts/expiry-policy#invalidate-entity">delete an entity</a></td>
135+
<td align="center">🛑</td>
136+
</tr>
137+
<tr>
138+
<td rowSpan="3"><a href="https://en.wikipedia.org/wiki/List_(abstract_data_type)">List</a></td>
139+
<td align="center">✅</td>
140+
<td><a href="https://dataclient.io/rest/api/Collection">Collection(Array)</a></td>
141+
<td>growable lists</td>
142+
<td align="center">✅</td>
143+
</tr>
144+
<tr>
145+
<td align="center">🛑</td>
146+
<td><a href="https://dataclient.io/rest/api/Array">Array</a></td>
147+
<td>immutable lists</td>
148+
<td align="center">🛑</td>
149+
</tr>
150+
<tr>
151+
<td align="center">✅</td>
152+
<td><a href="https://dataclient.io/rest/api/All">All</a></td>
153+
<td>list of all entities of a kind</td>
154+
<td align="center">✅</td>
155+
</tr>
156+
<tr>
157+
<td rowSpan="2"><a href="https://en.wikipedia.org/wiki/Associative_array">Map</a></td>
158+
<td align="center">✅</td>
159+
<td><a href="https://dataclient.io/rest/api/Collection">Collection(Values)</a></td>
160+
<td>growable maps</td>
161+
<td align="center">✅</td>
162+
</tr>
163+
<tr>
164+
<td align="center">🛑</td>
165+
<td><a href="https://dataclient.io/rest/api/Values">Values</a></td>
166+
<td>immutable maps</td>
167+
<td align="center">🛑</td>
168+
</tr>
169+
<tr>
170+
<td>any</td>
171+
<td align="center"></td>
172+
<td><a href="https://dataclient.io/rest/api/Query">Query(Queryable)</a></td>
173+
<td>memoized custom transforms</td>
174+
<td align="center">✅</td>
175+
</tr>
176+
</tbody></table>

0 commit comments

Comments
 (0)