Remote / foldkit-remote

EntityDescriptor

interface · packages/remote/src/entity.ts:35

interface EntityDescriptor<
  Name extends string,
  F extends Schema.Struct.Fields,
> {
  readonly name: Name
  readonly schema: Schema.Struct<F>
  readonly fields: F
  ref(id: Schema.Schema.Type<F['id']>): EntityRef<Name, F>
  select<const Sel extends SelectionOf<F>>(
    selection: Sel,
  ): Selection<SelectionValue<F, Sel>, Name, 'entity'>
  patch(
    id: Schema.Schema.Type<F['id']>,
    values: Partial<Schema.Struct.Encoded<F>>,
  ): EntityPatch<Name, F>
}

In the guides

Members

EntityDescriptor.name

property · packages/remote/src/entity.ts:36

readonly name: Name

EntityDescriptor.schema

property · packages/remote/src/entity.ts:37

readonly schema: Schema.Struct<F>

EntityDescriptor.fields

property · packages/remote/src/entity.ts:38

readonly fields: F

EntityDescriptor.ref

method · packages/remote/src/entity.ts:42

ref(id: Schema.Schema.Type<F['id']>): EntityRef<Name, F>

EntityDescriptor.select

method · packages/remote/src/entity.ts:44

select<const Sel extends SelectionOf<F>>(
  selection: Sel,
): Selection<SelectionValue<F, Sel>, Name, 'entity'>

The fields a Surface reads of this entity; Selection.make(entity, …) with the entity as receiver.

EntityDescriptor.patch

method · packages/remote/src/entity.ts:48

patch(
  id: Schema.Schema.Type<F['id']>,
  values: Partial<Schema.Struct.Encoded<F>>,
): EntityPatch<Name, F>

A patch of this entity's wire-shaped values; Entity.patch(entity.ref(id), values).