Options
All
  • Public
  • Public/Protected
  • All
Menu

Wraps a read state, in which some elements of an ORM domain may be loading.

see

OrmDomain

experimental

Hierarchy

  • ReadLatchable
    • OrmUpdating

Index

Properties

Methods

Properties

Readonly domain

domain: OrmDomain

The attached ORM domain. The value of this property can be safely stored if required to later obtain a new updating state, or to commit changes.

Methods

get

  • Get a subject in the domain. This method and its array-based overload are the ONLY way to obtain subject instances, including new ones – a subject constructor should only ever be called by the passed construct callback. This ensures that the subject is attached to the domain. For new subjects, it also allows that the subject may have been concurrently created remotely in another clone.

    Type parameters

    Parameters

    • src: GraphSubject | string

      can be a plain IRI or Reference, used to identify the Subject

    • construct: ConstructOrmSubject<T>

      called as necessary to create a new ORM Subject

    Returns Promise<T>

  • Get an array of subjects in the domain. This method and its overload are the ONLY way to obtain subject instances, including new ones – a subject constructor should only ever be called by the passed construct callback. This ensures that the subject is attached to the domain. For new subjects, it also allows that the subject may have been concurrently created remotely in another clone.

    Type parameters

    Parameters

    • src: GraphSubject[] | string[]

      can be a plain IRI or Reference, used to identify the Subject

    • construct: ConstructOrmSubject<T>

      called as necessary to create a new ORM Subject

    Returns Promise<T[]>

latch

  • Make a bounded read-only use of state. The state is guaranteed not to change until the procedure's returned promise has settled.

    Type parameters

    • T

    Parameters

    Returns Promise<T>

updated

  • updated(update?: GraphUpdate, deleted?: undefined | ((subject: OrmSubject) => void), cacheMiss?: undefined | ((ref: GraphSubject) => void | Promise<unknown>)): Promise<void>
  • Updates the ORM domain from the given m-ld core API update. Usually called from a core API read or follow callback. Once the returned promise has resolved, all subject-graph changes will have been applied to domain subjects.

    Parameters

    • Optional update: GraphUpdate

      the m-ld core update

    • Optional deleted: undefined | ((subject: OrmSubject) => void)

      called when an ORM subject has been removed from the domain

    • Optional cacheMiss: undefined | ((ref: GraphSubject) => void | Promise<unknown>)

      called for all new ORM subjects, in case they are of interest to the domain – use get to translate the raw graph subject to an ORM subject.

    Returns Promise<void>

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static property
  • Static method
  • Protected method

Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.9.0 Source code licensed MIT. Privacy policy