An Observable for all the items of this entity. If the Entity has already loaded all possible items (if loadAll
is set to true
, for example), those items are returned.
Otherwise, a query with no DataQuery will be performed to the backend and the data will be fetched.
All the hard-coded values of an Entity, as specified through the values
configuration.
Clears the cached values in the Repository, if they were set as a result of using allItems$ or loadAll: true
.
Clears all cached data in this Repository
Creates a full model of this Repository's Entity. Any sub-models that need to be fetched from backend will be fetched (if options.availability === DataAvailability.deep). This method is used internally when modeling entities and value objects, but may be used externally as well, in case an item should be created programmatically from raw data.
The raw data for the entity, as it arrives from backend
Creates a new instance of the Repository's entity. All fields will be undefined, except those that have defaultValue or those that are arrays, which will have an empty array as value.
Returns the base URL for this Repository's API calls (not including base URL - the domain)
Returns the full URL for an API call
Fetches an item from backend, for the specified ID, or from cache, if it's available.
Returns the HttpOptions for the specified DataQuery.
Uses the entity config's parseDataQuery
configuration, if available, or otherwise the queryToHttpOptions
function.
If the entity config has fixedData
set, the fixed data will be added to the HttpOptions params.
Returns a related item by an item ID Note: there has to be a foreignKey set in the RelationshipRepository config, otherwise this will not work.
Queries the relationship for an item ID instead of sourceItem or entity/valueObject. Note: there has to be a foreignKey set in the RelationshipRepository config, otherwise this will not work.
Creates a JSON object that can be saved to server, with the reverse logic of getItemModelData
Validates that the specified item is valid, according to the requirements of the entity (or value object) it belongs to. Meaning, that it can be used as data for creating an instance of T.
Generated using TypeDoc
A Repository is a service through which all of an Entity's data is fetched, cached and saved back to the backend.
Relationship repository handles two repositories that are defined using a foreign key