Meta holds non-standard meta-information associated with resources and collections
new Meta()
Instance Members
Resource
Resource corresponds to a single item JSON API payload
new Resource()
Static Members
Instance Members
returns an attribute value at a given key path
Parameters
Returns
any
sets an attribute value at a given key path. If intermediate keys on the
path do not exist, they are created with objects for values
Parameters
removes an attribute field at a given key path
Parameters
replaces the entire attribute object with a new mapping. This is useful
for populating an empty/fresh resource
replace(attributes: {})
Parameters
▸
relationship(name, options = ed)
returns a result that may contain none, one or many resources for
relationship identified by name. If options.resolved
is set, this method
attempts to resolve the relationships using the included array of related
resources
Parameters
options ({resolve: boolean?}?
= ed
)
Returns
Result<Model>
converts the resource into a plain JS object
Parameters
Returns
Payload
Collection
Collection corresponds to a multi-item JSON API payload
new Collection()
Static Members
Instance Members
Retrieves a model at given index from the collection
Parameters
Returns
Model
adds an resource entry to the collection with associated and adds in
related resource entries to included list
Parameters
▸
concat(items, included)
merges a list of resource entries to the collection and adds in related
resource entries to included list
Parameters
▸
splice(start, deleteCount, items, included)
modifies the collection to insert/remove resource entries at a given index
and adds in any resource entries to included list
Parameters
▸
insert(index, item, included)
shortcut for splice that inserts a resource entry at a given index
Parameters
converts the resource into a plain JS object
Parameters
Returns
Payload
Identifier
Identifier uniquely identifies a JSON API resource
Identifier
Type:
{type: string, id: string}
Item
Item describes a data entry in a JSON API payload
Item
Type:
{id: string?, type: string, attributes: {}?, relationships: {}?}
Payload
Payload describes the fields in a JSON API object
Payload
Type:
{jsonapi: {version: "1.0"
}?, data: (Item | Array<Item>)?, errors: Array<ErrorItem>?}
Result
Result allows safe access to the result of a computation that can have
one, many or no values of a given type T
Result
Serializable
Serializable types can be converted into a Payload object
Serializable
Accessor
Accessor types can retrieve a value at a given key path
Accessor
Mutator
Mutator types can set and unset a value at a given key path
Mutator
Model
Model defines fields and methods to access and mutate JSON API single-item payloads
Model
List
List defines fields and methods to access and mutate JSON API collection payloads
List