@@ -201,36 +201,85 @@ const UserDetail = new Endpoint(({ id }) ⇒ fetch(`/users/${id}`));
201201const 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 >
0 commit comments