Constructors

  • Parameters

    • type: string

      The type of the model.

    • id: undefined | string

      The id of the model.

    Returns Model

Properties

#attributes: string[] = []
#dependents: {
    id: string;
    relation: string;
    type: string;
}[] = []

Type declaration

  • id: string
  • relation: string
  • type: string
#links: LinksObject = {}
#meta: Meta = {}
#relationshipLinks: {
    [x: string]: LinksObject;
} = {}

Type declaration

#relationshipMeta: {
    [x: string]: Meta;
} = {}

Type declaration

#relationships: string[] = []
id: undefined | string
meta: Meta
type: string

Methods

  • Removes a relationship from a model.

    Parameters

    • Rest ...this: any
    • type: string

      The type of the dependent model.

    • id: string

      The id of the dependent model.

    • relationshipName: string

      The name of the relationship.

    Returns void

  • Serialize a model.

    Parameters

    • Rest ...this: any
    • options: undefined | ModelSerializeOptions

      The options for serialization.

    Returns JSONAPIDocument

    JSON API compliant object.

  • Set/add an attribute to a model.

    Parameters

    • Rest ...this: any
    • attributeName: string

      The name of the attribute.

    • value: any

      The value of the attribute.

    Returns void

  • Set/add a relationships to a model.

    Parameters

    • Rest ...this: any
    • relationshipName: string

      The name of the relationship.

    • models: null | Model | Model[]

      The linked model(s).

    Returns void

  • Sync record data to model.

    Parameters

    • Rest ...this: any
    • record: Optional<ResourceObject, "id" | "type">

      Record data to sync.

    • modelFactory: undefined | ((resource) => null | Model)

      Model factory.

    Returns void