Skip to content

Commit

Permalink
docs: Add Embed and AutoPlayVideo components to website
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Sep 27, 2024
1 parent f77a068 commit 746266d
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 63 deletions.
2 changes: 1 addition & 1 deletion docs/rest/guides/optimistic-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function CreateTodo({ userId }: { userId: number }) {
<div className="listItem nogap">
<label>
<input type="checkbox" name="new" checked={false} disabled />
<input type="text" onKeyDown={handleKeyDown} />
<TextInput size="small" onKeyDown={handleKeyDown} />
</label>
<CancelButton />
</div>
Expand Down
6 changes: 2 additions & 4 deletions packages/endpoint/src/schemas/Entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */

import { AbstractInstanceType } from '../normal.js';
import { Entity as EntitySchema } from '../schema.js';
import { Entity as EntityMixin } from '../schema.js';

const EmptyBase = class {} as any as abstract new (...args: any[]) => {
pk(
Expand All @@ -15,7 +13,7 @@ const EmptyBase = class {} as any as abstract new (...args: any[]) => {
* Represents data that should be deduped by specifying a primary key.
* @see https://dataclient.io/rest/api/Entity
*/
export default abstract class Entity extends EntitySchema(EmptyBase) {
export default abstract class Entity extends EntityMixin(EmptyBase) {
/** Control how automatic schema validation is handled
*
* `undefined`: Defaults - throw error in worst offense
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/schemas/EntitySchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AbstractInstanceType } from '../normal.js';
* Represents data that should be deduped by specifying a primary key.
* @see https://dataclient.io/rest/api/schema.Entity
*/
export default function EntitySchema<TBase extends Constructor>(
export default function EntityMixin<TBase extends Constructor>(
Base: TBase,
options: EntityOptions<InstanceType<TBase>> = {},
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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

exports[`EntitySchema denormalization can denormalize already partially denormalized data 1`] = `
exports[`EntityMixin denormalization can denormalize already partially denormalized data 1`] = `
Menu {
"food": Food {
"id": "1",
Expand All @@ -22,7 +22,7 @@ Menu {
}
`;

exports[`EntitySchema denormalization can denormalize already partially denormalized data 2`] = `
exports[`EntityMixin denormalization can denormalize already partially denormalized data 2`] = `
Menu {
"food": Food {
"id": "1",
Expand All @@ -31,23 +31,23 @@ Menu {
}
`;

exports[`EntitySchema denormalization denormalizes an entity 1`] = `
exports[`EntityMixin denormalization denormalizes an entity 1`] = `
Tacos {
"alias": undefined,
"id": "1",
"name": "foo",
}
`;

exports[`EntitySchema denormalization denormalizes an entity 2`] = `
exports[`EntityMixin denormalization denormalizes an entity 2`] = `
Tacos {
"alias": undefined,
"id": "1",
"name": "foo",
}
`;

exports[`EntitySchema denormalization denormalizes deep entities 1`] = `
exports[`EntityMixin denormalization denormalizes deep entities 1`] = `
Menu {
"food": Food {
"id": "1",
Expand All @@ -56,7 +56,7 @@ Menu {
}
`;

exports[`EntitySchema denormalization denormalizes deep entities 2`] = `
exports[`EntityMixin denormalization denormalizes deep entities 2`] = `
Menu {
"food": Food {
"id": "",
Expand All @@ -65,7 +65,7 @@ Menu {
}
`;

exports[`EntitySchema denormalization denormalizes deep entities with records 1`] = `
exports[`EntityMixin denormalization denormalizes deep entities with records 1`] = `
Menu {
"food": Food {
"id": "1",
Expand All @@ -74,7 +74,7 @@ Menu {
}
`;

exports[`EntitySchema denormalization denormalizes deep entities with records 2`] = `
exports[`EntityMixin denormalization denormalizes deep entities with records 2`] = `
Menu {
"food": Food {
"id": "1",
Expand All @@ -83,47 +83,47 @@ Menu {
}
`;

exports[`EntitySchema denormalization denormalizes deep entities with records 3`] = `
exports[`EntityMixin denormalization denormalizes deep entities with records 3`] = `
Menu {
"food": null,
"id": "2",
}
`;

exports[`EntitySchema denormalization denormalizes deep entities with records 4`] = `
exports[`EntityMixin denormalization denormalizes deep entities with records 4`] = `
Menu {
"food": null,
"id": "2",
}
`;

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

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

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

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

exports[`EntitySchema denormalization denormalizes to undefined for missing data 1`] = `
exports[`EntityMixin denormalization denormalizes to undefined for missing data 1`] = `
Menu {
"food": undefined,
"id": "1",
}
`;

exports[`EntitySchema denormalization denormalizes to undefined for missing data 2`] = `
exports[`EntityMixin denormalization denormalizes to undefined for missing data 2`] = `
Menu {
"food": undefined,
"id": "1",
}
`;

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

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

exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 1`] = `
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 1`] = `
Report {
"draftedBy": User {
"id": "456",
Expand All @@ -144,7 +144,7 @@ Report {
}
`;

exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 2`] = `
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 2`] = `
Report {
"draftedBy": User {
"id": "456",
Expand All @@ -165,7 +165,7 @@ Report {
}
`;

exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 3`] = `
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 3`] = `
User {
"id": "456",
"reports": [
Expand All @@ -180,7 +180,7 @@ User {
}
`;

exports[`EntitySchema denormalization nesting denormalizes recursive dependencies 4`] = `
exports[`EntityMixin denormalization nesting denormalizes recursive dependencies 4`] = `
User {
"id": "456",
"reports": Immutable.List [
Expand All @@ -195,7 +195,7 @@ User {
}
`;

exports[`EntitySchema normalization mergeStrategy can use a custom merging strategy 1`] = `
exports[`EntityMixin normalization mergeStrategy can use a custom merging strategy 1`] = `
{
"entities": {
"MergeTaco": {
Expand Down Expand Up @@ -223,7 +223,7 @@ exports[`EntitySchema normalization mergeStrategy can use a custom merging strat
}
`;

exports[`EntitySchema normalization mergeStrategy defaults to plain merging 1`] = `
exports[`EntityMixin normalization mergeStrategy defaults to plain merging 1`] = `
{
"entities": {
"Tacos": {
Expand Down Expand Up @@ -251,7 +251,7 @@ exports[`EntitySchema normalization mergeStrategy defaults to plain merging 1`]
}
`;

exports[`EntitySchema normalization normalizes already processed entities 1`] = `
exports[`EntityMixin normalization normalizes already processed entities 1`] = `
{
"entities": {},
"entityMeta": {},
Expand All @@ -262,7 +262,7 @@ exports[`EntitySchema normalization normalizes already processed entities 1`] =
}
`;

exports[`EntitySchema normalization normalizes already processed entities 2`] = `
exports[`EntityMixin normalization normalizes already processed entities 2`] = `
{
"entities": {},
"entityMeta": {},
Expand All @@ -273,7 +273,7 @@ exports[`EntitySchema normalization normalizes already processed entities 2`] =
}
`;

exports[`EntitySchema normalization normalizes already processed entities 3`] = `
exports[`EntityMixin normalization normalizes already processed entities 3`] = `
{
"entities": {
"Nested": {
Expand All @@ -298,7 +298,7 @@ exports[`EntitySchema normalization normalizes already processed entities 3`] =
}
`;

exports[`EntitySchema normalization normalizes an entity 1`] = `
exports[`EntityMixin normalization normalizes an entity 1`] = `
{
"entities": {
"MyEntity": {
Expand All @@ -321,7 +321,7 @@ exports[`EntitySchema normalization normalizes an entity 1`] = `
}
`;

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

exports[`EntitySchema normalization pk() can normalize entity IDs based on their object key 1`] = `
exports[`EntityMixin normalization pk() can normalize entity IDs based on their object key 1`] = `
{
"entities": {
"User": {
Expand Down Expand Up @@ -388,7 +388,7 @@ exports[`EntitySchema normalization pk() can normalize entity IDs based on their
}
`;

exports[`EntitySchema normalization pk() can use a custom pk() string 1`] = `
exports[`EntityMixin normalization pk() can use a custom pk() string 1`] = `
{
"entities": {
"User": {
Expand All @@ -412,7 +412,7 @@ exports[`EntitySchema normalization pk() can use a custom pk() string 1`] = `
}
`;

exports[`EntitySchema normalization process can use a custom processing strategy 1`] = `
exports[`EntityMixin normalization process can use a custom processing strategy 1`] = `
ProcessTaco {
"alias": undefined,
"id": "1",
Expand All @@ -421,7 +421,7 @@ ProcessTaco {
}
`;

exports[`EntitySchema normalization process can use information from the parent in the process strategy 1`] = `
exports[`EntityMixin normalization process can use information from the parent in the process strategy 1`] = `
EntityMixin {
"child": ChildEntity {
"content": "child",
Expand All @@ -434,7 +434,7 @@ EntityMixin {
}
`;

exports[`EntitySchema normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity 1`] = `
exports[`EntityMixin normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity 1`] = `
EntriesEntity {
"data": {
"attachment": AttachmentsEntity {
Expand All @@ -446,7 +446,7 @@ EntriesEntity {
}
`;

exports[`EntitySchema normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity2 1`] = `
exports[`EntityMixin normalization process schema denormalization is run before and passed to the schema denormalization EntriesEntity2 1`] = `
EntriesEntity2 {
"data": {
"attachment": AttachmentsEntity {
Expand All @@ -458,7 +458,7 @@ EntriesEntity2 {
}
`;

exports[`EntitySchema normalization should allow many unexpected as long as none are missing 1`] = `
exports[`EntityMixin normalization should allow many unexpected as long as none are missing 1`] = `
{
"entities": {
"MyEntity": {
Expand Down Expand Up @@ -502,7 +502,7 @@ exports[`EntitySchema normalization should allow many unexpected as long as none
}
`;

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

exports[`EntitySchema normalization should not throw if schema key is missing from Entity 1`] = `
exports[`EntityMixin normalization should not throw if schema key is missing from Entity 1`] = `
{
"entities": {
"MyData": {
Expand All @@ -541,7 +541,7 @@ exports[`EntitySchema normalization should not throw if schema key is missing fr
}
`;

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

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

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

exports[`EntitySchema normalization should throw a custom error loads with array 1`] = `
exports[`EntityMixin normalization should throw a custom error loads with array 1`] = `
"Missing usable primary key when normalizing response.
This is likely due to a malformed response.
Expand Down
Loading

0 comments on commit 746266d

Please sign in to comment.