import { ModelCacheOptions, ActionPerformResponse } from './types'; /** * Return the model specific utility object * @param {object} modelOrDomain: the model object or entityType state object (if model `id` is provided) * @param {string} id: the model id if `modelOrDomain` represents the entityType state object */ import { ModelConstructorOptions } from './types'; export default class Model { id: any; private _value?; private _meta?; private _data?; private formatted; private entities?; private options?; private formattedValue?; constructor(options: ModelConstructorOptions); meta(): any; /** * Return the (optionally formatted) model data */ value(): any; /** * Return metadata associated with this model */ data(): any; /** * Return truthy if the model has been fetched (`fetched` if fetched and `set` if used with constructor to set value) */ wasFetched(): boolean; /** * Return true if there is not a fetch pending or the model has been sucessfully fetched */ canBeFetched(): boolean; /** * Return a truthy (timestamp of when the fetch was initiated) if a fetch is pending */ isFetchPending(): boolean; /** * Return a fetch success result or false */ fetchSuccess(): any; /** * Return a fetch error result or false */ fetchError(): any; /** * Return a truthy (timestamp of action initiation) if the action is pending * @param {string} id: optinal identifier to see if a specific action is currently in progress * @paramm {string} actionId: action id */ isActionPending(actionId: any): boolean; /** * If an action was performed and successful, return { success, error, pending }. `success` and `error` will be mutually exclusive and will * represent the XHR response payload * @paramm {string} actionId: action id to only return true if a specific action was performed */ wasActionPerformed(actionId: any): ActionPerformResponse; /** * If an action was performed and is an in error state, return the error response * @paramm {string} actionId: action id to only return true if a specific action was performed * @returns the error response payload */ actionError(actionId: any): any; /** * If an action was performed and is in success state, return the success response * @paramm {string} actionId: action id to only return true if a specific action was performed * @returns the success response payload or true if the response was a success */ actionSuccess(actionId: any): any; /** * Return the number of milis since the last fetch completion (success or error) */ timeSinceFetch(currentTime?: number): number; /** * Return a model from the cache object and create one if one does not exist */ static fromCache(options: ModelCacheOptions, cache?: any): any; /** * Clear the model referred to by the entity type and id from the cache */ static clearCache(id: any, entityType: string, cache?: any): void; }