Skip to content

Commit 746266d

Browse files
committed
docs: Add Embed and AutoPlayVideo components to website
1 parent f77a068 commit 746266d

File tree

8 files changed

+159
-63
lines changed

8 files changed

+159
-63
lines changed

docs/rest/guides/optimistic-updates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function CreateTodo({ userId }: { userId: number }) {
9898
<div className="listItem nogap">
9999
<label>
100100
<input type="checkbox" name="new" checked={false} disabled />
101-
<input type="text" onKeyDown={handleKeyDown} />
101+
<TextInput size="small" onKeyDown={handleKeyDown} />
102102
</label>
103103
<CancelButton />
104104
</div>

packages/endpoint/src/schemas/Entity.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2-
31
import { AbstractInstanceType } from '../normal.js';
4-
import { Entity as EntitySchema } from '../schema.js';
2+
import { Entity as EntityMixin } from '../schema.js';
53

64
const EmptyBase = class {} as any as abstract new (...args: any[]) => {
75
pk(
@@ -15,7 +13,7 @@ const EmptyBase = class {} as any as abstract new (...args: any[]) => {
1513
* Represents data that should be deduped by specifying a primary key.
1614
* @see https://dataclient.io/rest/api/Entity
1715
*/
18-
export default abstract class Entity extends EntitySchema(EmptyBase) {
16+
export default abstract class Entity extends EntityMixin(EmptyBase) {
1917
/** Control how automatic schema validation is handled
2018
*
2119
* `undefined`: Defaults - throw error in worst offense

packages/endpoint/src/schemas/EntitySchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { AbstractInstanceType } from '../normal.js';
1212
* Represents data that should be deduped by specifying a primary key.
1313
* @see https://dataclient.io/rest/api/schema.Entity
1414
*/
15-
export default function EntitySchema<TBase extends Constructor>(
15+
export default function EntityMixin<TBase extends Constructor>(
1616
Base: TBase,
1717
options: EntityOptions<InstanceType<TBase>> = {},
1818
) {

packages/endpoint/src/schemas/__tests__/__snapshots__/EntitySchema.test.ts.snap

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`EntitySchema construction pk should fail with no id and pk unspecified 1`] = `
3+
exports[`EntityMixin construction pk should fail with no id and pk unspecified 1`] = `
44
"Missing usable primary key when normalizing response.
55
66
'id' missing but needed for default pk(). Try defining pk() for your Entity.
@@ -13,7 +13,7 @@ exports[`EntitySchema construction pk should fail with no id and pk unspecified
1313
"
1414
`;
1515

16-
exports[`EntitySchema denormalization can denormalize already partially denormalized data 1`] = `
16+
exports[`EntityMixin denormalization can denormalize already partially denormalized data 1`] = `
1717
Menu {
1818
"food": Food {
1919
"id": "1",
@@ -22,7 +22,7 @@ Menu {
2222
}
2323
`;
2424

25-
exports[`EntitySchema denormalization can denormalize already partially denormalized data 2`] = `
25+
exports[`EntityMixin denormalization can denormalize already partially denormalized data 2`] = `
2626
Menu {
2727
"food": Food {
2828
"id": "1",
@@ -31,23 +31,23 @@ Menu {
3131
}
3232
`;
3333

34-
exports[`EntitySchema denormalization denormalizes an entity 1`] = `
34+
exports[`EntityMixin denormalization denormalizes an entity 1`] = `
3535
Tacos {
3636
"alias": undefined,
3737
"id": "1",
3838
"name": "foo",
3939
}
4040
`;
4141

42-
exports[`EntitySchema denormalization denormalizes an entity 2`] = `
42+
exports[`EntityMixin denormalization denormalizes an entity 2`] = `
4343
Tacos {
4444
"alias": undefined,
4545
"id": "1",
4646
"name": "foo",
4747
}
4848
`;
4949

50-
exports[`EntitySchema denormalization denormalizes deep entities 1`] = `
50+
exports[`EntityMixin denormalization denormalizes deep entities 1`] = `
5151
Menu {
5252
"food": Food {
5353
"id": "1",
@@ -56,7 +56,7 @@ Menu {
5656
}
5757
`;
5858

59-
exports[`EntitySchema denormalization denormalizes deep entities 2`] = `
59+
exports[`EntityMixin denormalization denormalizes deep entities 2`] = `
6060
Menu {
6161
"food": Food {
6262
"id": "",
@@ -65,7 +65,7 @@ Menu {
6565
}
6666
`;
6767

68-
exports[`EntitySchema denormalization denormalizes deep entities with records 1`] = `
68+
exports[`EntityMixin denormalization denormalizes deep entities with records 1`] = `
6969
Menu {
7070
"food": Food {
7171
"id": "1",
@@ -74,7 +74,7 @@ Menu {
7474
}
7575
`;
7676

77-
exports[`EntitySchema denormalization denormalizes deep entities with records 2`] = `
77+
exports[`EntityMixin denormalization denormalizes deep entities with records 2`] = `
7878
Menu {
7979
"food": Food {
8080
"id": "1",
@@ -83,47 +83,47 @@ Menu {
8383
}
8484
`;
8585

86-
exports[`EntitySchema denormalization denormalizes deep entities with records 3`] = `
86+
exports[`EntityMixin denormalization denormalizes deep entities with records 3`] = `
8787
Menu {
8888
"food": null,
8989
"id": "2",
9090
}
9191
`;
9292

93-
exports[`EntitySchema denormalization denormalizes deep entities with records 4`] = `
93+
exports[`EntityMixin denormalization denormalizes deep entities with records 4`] = `
9494
Menu {
9595
"food": null,
9696
"id": "2",
9797
}
9898
`;
9999

100-
exports[`EntitySchema denormalization denormalizes to undefined for deleted data 1`] = `Symbol(INVALID)`;
100+
exports[`EntityMixin denormalization denormalizes to undefined for deleted data 1`] = `Symbol(INVALID)`;
101101

102-
exports[`EntitySchema denormalization denormalizes to undefined for deleted data 2`] = `Symbol(INVALID)`;
102+
exports[`EntityMixin denormalization denormalizes to undefined for deleted data 2`] = `Symbol(INVALID)`;
103103

104-
exports[`EntitySchema denormalization denormalizes to undefined for deleted data 3`] = `Symbol(INVALID)`;
104+
exports[`EntityMixin denormalization denormalizes to undefined for deleted data 3`] = `Symbol(INVALID)`;
105105

106-
exports[`EntitySchema denormalization denormalizes to undefined for deleted data 4`] = `Symbol(INVALID)`;
106+
exports[`EntityMixin denormalization denormalizes to undefined for deleted data 4`] = `Symbol(INVALID)`;
107107

108-
exports[`EntitySchema denormalization denormalizes to undefined for missing data 1`] = `
108+
exports[`EntityMixin denormalization denormalizes to undefined for missing data 1`] = `
109109
Menu {
110110
"food": undefined,
111111
"id": "1",
112112
}
113113
`;
114114

115-
exports[`EntitySchema denormalization denormalizes to undefined for missing data 2`] = `
115+
exports[`EntityMixin denormalization denormalizes to undefined for missing data 2`] = `
116116
Menu {
117117
"food": undefined,
118118
"id": "1",
119119
}
120120
`;
121121

122-
exports[`EntitySchema denormalization denormalizes to undefined for missing data 3`] = `undefined`;
122+
exports[`EntityMixin denormalization denormalizes to undefined for missing data 3`] = `undefined`;
123123

124-
exports[`EntitySchema denormalization denormalizes to undefined for missing data 4`] = `undefined`;
124+
exports[`EntityMixin denormalization denormalizes to undefined for missing data 4`] = `undefined`;
125125

126-
exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 1`] = `
126+
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 1`] = `
127127
Report {
128128
"draftedBy": User {
129129
"id": "456",
@@ -144,7 +144,7 @@ Report {
144144
}
145145
`;
146146

147-
exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 2`] = `
147+
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 2`] = `
148148
Report {
149149
"draftedBy": User {
150150
"id": "456",
@@ -165,7 +165,7 @@ Report {
165165
}
166166
`;
167167

168-
exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 3`] = `
168+
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 3`] = `
169169
User {
170170
"id": "456",
171171
"reports": [
@@ -180,7 +180,7 @@ User {
180180
}
181181
`;
182182

183-
exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 4`] = `
183+
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 4`] = `
184184
User {
185185
"id": "456",
186186
"reports": Immutable.List [
@@ -195,7 +195,7 @@ User {
195195
}
196196
`;
197197

198-
exports[`EntitySchema normalization mergeStrategy can use a custom merging strategy 1`] = `
198+
exports[`EntityMixin normalization mergeStrategy can use a custom merging strategy 1`] = `
199199
{
200200
"entities": {
201201
"MergeTaco": {
@@ -223,7 +223,7 @@ exports[`EntitySchema normalization mergeStrategy can use a custom merging strat
223223
}
224224
`;
225225

226-
exports[`EntitySchema normalization mergeStrategy defaults to plain merging 1`] = `
226+
exports[`EntityMixin normalization mergeStrategy defaults to plain merging 1`] = `
227227
{
228228
"entities": {
229229
"Tacos": {
@@ -251,7 +251,7 @@ exports[`EntitySchema normalization mergeStrategy defaults to plain merging 1`]
251251
}
252252
`;
253253

254-
exports[`EntitySchema normalization normalizes already processed entities 1`] = `
254+
exports[`EntityMixin normalization normalizes already processed entities 1`] = `
255255
{
256256
"entities": {},
257257
"entityMeta": {},
@@ -262,7 +262,7 @@ exports[`EntitySchema normalization normalizes already processed entities 1`] =
262262
}
263263
`;
264264

265-
exports[`EntitySchema normalization normalizes already processed entities 2`] = `
265+
exports[`EntityMixin normalization normalizes already processed entities 2`] = `
266266
{
267267
"entities": {},
268268
"entityMeta": {},
@@ -273,7 +273,7 @@ exports[`EntitySchema normalization normalizes already processed entities 2`] =
273273
}
274274
`;
275275

276-
exports[`EntitySchema normalization normalizes already processed entities 3`] = `
276+
exports[`EntityMixin normalization normalizes already processed entities 3`] = `
277277
{
278278
"entities": {
279279
"Nested": {
@@ -298,7 +298,7 @@ exports[`EntitySchema normalization normalizes already processed entities 3`] =
298298
}
299299
`;
300300

301-
exports[`EntitySchema normalization normalizes an entity 1`] = `
301+
exports[`EntityMixin normalization normalizes an entity 1`] = `
302302
{
303303
"entities": {
304304
"MyEntity": {
@@ -321,7 +321,7 @@ exports[`EntitySchema normalization normalizes an entity 1`] = `
321321
}
322322
`;
323323

324-
exports[`EntitySchema normalization pk() can build the entity's ID from the parent object 1`] = `
324+
exports[`EntityMixin normalization pk() can build the entity's ID from the parent object 1`] = `
325325
{
326326
"entities": {
327327
"User": {
@@ -348,7 +348,7 @@ exports[`EntitySchema normalization pk() can build the entity's ID from the pare
348348
}
349349
`;
350350

351-
exports[`EntitySchema normalization pk() can normalize entity IDs based on their object key 1`] = `
351+
exports[`EntityMixin normalization pk() can normalize entity IDs based on their object key 1`] = `
352352
{
353353
"entities": {
354354
"User": {
@@ -388,7 +388,7 @@ exports[`EntitySchema normalization pk() can normalize entity IDs based on their
388388
}
389389
`;
390390

391-
exports[`EntitySchema normalization pk() can use a custom pk() string 1`] = `
391+
exports[`EntityMixin normalization pk() can use a custom pk() string 1`] = `
392392
{
393393
"entities": {
394394
"User": {
@@ -412,7 +412,7 @@ exports[`EntitySchema normalization pk() can use a custom pk() string 1`] = `
412412
}
413413
`;
414414

415-
exports[`EntitySchema normalization process can use a custom processing strategy 1`] = `
415+
exports[`EntityMixin normalization process can use a custom processing strategy 1`] = `
416416
ProcessTaco {
417417
"alias": undefined,
418418
"id": "1",
@@ -421,7 +421,7 @@ ProcessTaco {
421421
}
422422
`;
423423

424-
exports[`EntitySchema normalization process can use information from the parent in the process strategy 1`] = `
424+
exports[`EntityMixin normalization process can use information from the parent in the process strategy 1`] = `
425425
EntityMixin {
426426
"child": ChildEntity {
427427
"content": "child",
@@ -434,7 +434,7 @@ EntityMixin {
434434
}
435435
`;
436436

437-
exports[`EntitySchema normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity 1`] = `
437+
exports[`EntityMixin normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity 1`] = `
438438
EntriesEntity {
439439
"data": {
440440
"attachment": AttachmentsEntity {
@@ -446,7 +446,7 @@ EntriesEntity {
446446
}
447447
`;
448448

449-
exports[`EntitySchema normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity2 1`] = `
449+
exports[`EntityMixin normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity2 1`] = `
450450
EntriesEntity2 {
451451
"data": {
452452
"attachment": AttachmentsEntity {
@@ -458,7 +458,7 @@ EntriesEntity2 {
458458
}
459459
`;
460460

461-
exports[`EntitySchema normalization should allow many unexpected as long as none are missing 1`] = `
461+
exports[`EntityMixin normalization should allow many unexpected as long as none are missing 1`] = `
462462
{
463463
"entities": {
464464
"MyEntity": {
@@ -502,7 +502,7 @@ exports[`EntitySchema normalization should allow many unexpected as long as none
502502
}
503503
`;
504504

505-
exports[`EntitySchema normalization should error if no matching keys are found 1`] = `
505+
exports[`EntityMixin normalization should error if no matching keys are found 1`] = `
506506
"Missing usable primary key when normalizing response.
507507
508508
This is likely due to a malformed response.
@@ -517,7 +517,7 @@ exports[`EntitySchema normalization should error if no matching keys are found 1
517517
"
518518
`;
519519

520-
exports[`EntitySchema normalization should not throw if schema key is missing from Entity 1`] = `
520+
exports[`EntityMixin normalization should not throw if schema key is missing from Entity 1`] = `
521521
{
522522
"entities": {
523523
"MyData": {
@@ -541,7 +541,7 @@ exports[`EntitySchema normalization should not throw if schema key is missing fr
541541
}
542542
`;
543543

544-
exports[`EntitySchema normalization should throw a custom error if data does not include pk 1`] = `
544+
exports[`EntityMixin normalization should throw a custom error if data does not include pk 1`] = `
545545
"Missing usable primary key when normalizing response.
546546
547547
This is likely due to a malformed response.
@@ -556,7 +556,7 @@ exports[`EntitySchema normalization should throw a custom error if data does not
556556
"
557557
`;
558558

559-
exports[`EntitySchema normalization should throw a custom error if data loads with no matching props 1`] = `
559+
exports[`EntityMixin normalization should throw a custom error if data loads with no matching props 1`] = `
560560
"Missing usable primary key when normalizing response.
561561
562562
This is likely due to a malformed response.
@@ -569,7 +569,7 @@ exports[`EntitySchema normalization should throw a custom error if data loads wi
569569
"
570570
`;
571571

572-
exports[`EntitySchema normalization should throw a custom error if data loads with string 1`] = `
572+
exports[`EntityMixin normalization should throw a custom error if data loads with string 1`] = `
573573
"Unexpected input given to normalize. Expected type to be "object", found "string".
574574
575575
Schema: {
@@ -581,7 +581,7 @@ exports[`EntitySchema normalization should throw a custom error if data loads wi
581581
Input: "hibho""
582582
`;
583583

584-
exports[`EntitySchema normalization should throw a custom error loads with array 1`] = `
584+
exports[`EntityMixin normalization should throw a custom error loads with array 1`] = `
585585
"Missing usable primary key when normalizing response.
586586
587587
This is likely due to a malformed response.

0 commit comments

Comments
 (0)