- keysToBeOmittedOnDeepCheck :
Array.<string> An array of keys to be omitted during a deep check operation. These keys typically represent internal properties or methods that should not be considered when comparing the current state of a record with its original state.
- keysToBeOmittedOnRequestPayload :
Array.<string> An array of keys to be omitted when constructing a request payload. These keys typically represent internal object properties or methods that should not be included in the data sent to the server.
- _initializeAxiosConfig() ℗
Initializes the Axios configuration with the base URL.
Sets the
baseURLproperty in the Axios defaults to the value returned by the_getBaseURL()method. This ensures that all Axios requests use the correct base URL for the API.- _initializeCollections(collections) ℗
Initializes a collection of collections with optional default values.
Iterates through the provided array of
collectionsand calls the_addCollectionmethod for each collection name, initializing it with an empty array ([]) as the default value.- _getBaseURL() ⇒
string℗ Gets the base URL for API requests.
Constructs the base URL by combining the
hostandnamespaceproperties of the instance.- _isCollectionExisting(collectionName) ℗
Checks if a collection exists in the current instance.
This method verifies if a collection with the given
collectionNameexists in thecollectionsobject of theApiResourceManagerinstance.- _addCollection(collectionName, collectionRecords) ℗
Adds a collection to the current instance.
This method adds a new collection with the specified
collectionNameto thecollectionsobject of theApiResourceManager. ThecollectionRecordsarray is used to initialize the collection's data.- _addAlias(aliasName, aliasRecords) ℗
Adds an alias to the aliases object.
This method creates an alias for a collection or a single record. The
aliasNamespecifies the name of the alias, andaliasRecordscan be either an array of records (for a collection alias) or a single record object.If
aliasRecordsis an array, it's used directly (or an empty array ifaliasRecordsis falsy). If it's a plain object, it's used directly (or an empty object ifaliasRecordsis falsy).- _addRequestAlias(aliasName, requestHashKey) ℗
Adds a request alias to the request aliases object.
This method maps a specific
aliasNameto arequestHashKeyin therequestAliasesdictionary. This allows the system to reference a specific request context using a human-readable alias.- _generateHashId([object]) ⇒
string℗ Generates a hash ID based on the provided object.
This method generates a unique hash ID by stringifying the given
objectand then calculating its MD5 hash using themd5library. If noobjectis provided, it defaults to an object with anidproperty generated usinguuidv1().- _setProperties(targetObject, keyValuePairs) ℗
Sets multiple properties on a target object recursively.
This method iterates through the
keyValuePairsobject and sets the corresponding properties on thetargetObject. It handles nested objects by recursively calling itself with an updatedprefix.- _getRecordProperty(key) ⇒
*℗ Gets a property from the current record.
This method retrieves the value of a property with the given
keyfrom the current record object (this). It uses Lodash'sgetfunction (aliased asgetProperty) to access the property.- _setRecordProperty(key, value) ℗
Sets a single property on the current record and updates its state based on changes.
This method sets the property with the given
keyto the specifiedvalueon the current record object (this). It then checks if the record has been modified by comparing it with theoriginalRecord. If changes are detected, it updates theisDirtyandisPristineflags accordingly.- _setRecordProperties(values) ℗
Sets multiple properties on the current record and updates its state based on changes.
This method sets multiple properties on the current record object (
this) using the providedvaluesobject. It then compares the updated record with theoriginalRecordto detect any modifications. If the record has been changed, it updates theisDirtyandisPristineflags.- _sortRecordsBy(currentRecords, [sortProperties]) ⇒
Array℗ Sorts an array of records based on specified properties and sort orders.
This method sorts the
currentRecordsarray using the providedsortProperties. EachsortPropertyshould be a string in the format "property:order", where "property" is the name of the property to sort by and "order" is either "asc" (ascending) or "desc" (descending).- _unloadFromCollection(collectionRecord) ℗
Removes a record from a specified collection based on its hash ID.
This method removes a
collectionRecordfrom its corresponding collection in thecollectionsobject. It determines the collection using the record'scollectionNameproperty and finds the record's index within the collection using itshashId. If the record is found, it's removed from the collection using Lodash'spullAt.- _unloadFromRequestHashes(collectionRecord) ℗
Removes a record from all request hashes based on its hash ID.
This method iterates through all request hashes in the
requestHashesobject and removes any occurrences of thecollectionRecordbased on itshashId. It handles both array-based and object-based request hash data.- _unloadFromAliases(collectionRecord) ℗
Removes a record from all aliases based on its hash ID.
This method iterates through all aliases in the
aliasesobject and removes any occurrences of thecollectionRecordbased on itshashId. It handles both array-based and object-based alias data.- unloadRecord(currentRecord)
Unloads a record from the collection, request hashes, and aliases.
This method removes a
currentRecordfrom all relevant data stores within theApiResourceManager:- The main collection where the record belongs.
- Any request hashes where the record might be present.
- Any aliases that refer to the record.
- _saveRecord(currentRecord, [collectionConfig]) ⇒
Promise℗ Saves a record to the server.
This method saves the
currentRecordto the server by making an API request. It determines whether to use a PUT (update) or POST (create) request based on the validity of the record'sid. ThecollectionConfigparameter can be used to provide additional configuration for the request.- _deleteRecord(currentRecord, [collectionConfig]) ⇒
Promise℗ Deletes a record from the server.
This method deletes the
currentRecordfrom the server by making a DELETE API request. ThecollectionConfigparameter can be used to provide additional configuration for the request.- _reloadRecord(currentRecord, [collectionConfig]) ⇒
Promise.<Object>℗ Reloads a record from the server.
Fetches the latest data for the specified record and updates the local copy.
- _rollbackRecordAttributes() ⇒
void℗ Reverts the record's attributes to their original state.
This method retrieves the stored
originalRecord(excluding internal ARM properties), applies those values back to the current record instance, and resets theisDirtyandisPristinestate flags.- _getCollectionRecord(collectionName, [collectionConfig], currentRecord) ⇒
Object|Array℗ Retrieves records from a specified collection based on given criteria.
This method retrieves records from the collection with the specified
collectionName, potentially fetching them asynchronously if needed. It uses thecollectionConfigto determine how to filter, sort, and retrieve the records.The
currentRecordis used to extract related records based on thereferenceKeyprovided in thecollectionConfig. If the related records are not already in the local collection andasyncis true in thecollectionConfig, it initiates an asynchronous request to fetch them.- _injectCollectionActions(collectionRecord) ℗
Injects action methods into a collection record.
This method decorates a
collectionRecordwith predefined action methods, enabling convenient interactions with the record, including:- Property access and modification
- Persistence operations (save, delete, reload)
- Retrieval of related collections
- _injectRequestHashActions(requestObject, responseObject, requestHashKey) ℗
Decorates the response object with actionable methods.
- Attaches a
reloadmethod to theresponseObjectthat, when invoked, triggers a re-fetch of the original request using the stored hash key.
- Attaches a
- _injectCollectionReferenceKeys(collectionName, collectionRecord, [collectionRecordHashId]) ℗
Injects reference keys into a collection record.
This method adds essential reference keys to a
collectionRecord, including:collectionName: The name of the collection the record belongs to.hashId: A unique hash ID generated for the record.isLoading,isError,isPristine,isDirty: Flags to track the record's state.originalRecord: A copy of the original record data for change tracking.
- _pushToCollection(collectionName, collectionRecords) ⇒
Array|Object℗ Pushes records to a specified collection.
This method adds or updates records in the collection with the given
collectionName. ThecollectionRecordscan be either an array of records or a single record object.If
collectionRecordsis an array, it iterates through the records and adds them to the collection if they don't already exist. If a record with the samehashIdalready exists, it updates the existing record with the new data.If
collectionRecordsis a single object, it adds it to the collection if it doesn't exist or updates the existing record if it has the samehashId.- _pushToAliases(collectionRecords) ℗
Pushes records to specified aliases.
This method updates aliases in the
aliasesobject with the providedcollectionRecords. It handles both array-based and object-based aliases.If an alias refers to an array of records, the method iterates through the
collectionRecordsand updates any matching records within the alias array based on theirhashId.If an alias refers to a single record object, the method updates the alias with the matching
collectionRecordbased on itshashId.- _pushToRequestHashes(collectionRecords) ℗
Pushes records to specified request hashes.
This method updates request hashes in the
requestHashesobject with the providedcollectionRecords. It handles both array-based and object-based request hash data.If a request hash's
dataproperty is an array, the method iterates through thecollectionRecordsand updates any matching records within thedataarray based on theirhashId.If a request hash's
dataproperty is a single record object, the method updates thedatawith the matchingcollectionRecordbased on itshashId.- _pushPayload(collectionName, collectionRecords) ⇒
Array|Object℗ Pushes records to a collection, aliases, and request hashes.
This method orchestrates the process of adding or updating records in various data stores within the
ApiResourceManager. It takes acollectionNameandcollectionRecords(which can be an array or a single object) and performs the following actions:- Checks if the specified collection exists.
- Pushes the records to the collection using
_pushToCollection. - Updates any relevant aliases using
_pushToAliases. - Updates any relevant request hashes using
_pushToRequestHashes.
- pushPayload(collectionName, collectionRecords) ⇒
Array|Object Pushes records to a collection, aliases, and request hashes.
This method orchestrates the process of adding or updating records in various data stores within the
ApiResourceManager. It takes acollectionNameandcollectionRecords(which can be an array or a single object) and performs the following actions:- Checks if the specified collection exists.
- Pushes the records to the collection using
_pushToCollection. - Updates any relevant aliases using
_pushToAliases. - Updates any relevant request hashes using
_pushToRequestHashes.
- _pushRequestHash(requestObject, responseObject) ⇒
Object℗ Caches a request/response pair in the internal hash store.
- Generates a unique key based on the request and performs one of two actions:
- If the key exists and the new response is marked
isNew, it toggles the existing entry'sisNewflag tofalse. - Otherwise, it stores the new response object under that key.
- Also injects contextual actions (e.g., reload) into the response object.
- setHost(host)
Sets the host URL for the client and initializes the Axios configuration.
This method sets the
hostproperty of theApiResourceManagerinstance to the providedhostURL. It then calls the_initializeAxiosConfigmethod to update the Axios configuration with the new host, ensuring that subsequent API requests use the correct base URL.- setNamespace(namespace)
Sets the namespace for the client.
This method sets the
namespaceproperty of theApiResourceManagerinstance to the providednamespace. The namespace is typically used as a path prefix in the base URL for API requests, allowing you to version your API or organize it into different sections. For example, a namespace of "api/v2" would result in a base URL like "https://example.com/api/v2".- setHeadersCommon(key, value)
Sets a common header for all Axios requests.
This method sets a common header that will be included in all Axios requests made by the
ApiResourceManager. Thekeyparameter specifies the header name, and thevalueparameter specifies the header value.- setPayloadIncludeReference(key)
Sets the reference key used for included data in request payloads.
This method sets the
payloadIncludedReferenceproperty of theApiResourceManagerinstance. This property determines the key used to identify the type of included data in API request payloads. For example, if the payload includes related resources, this key might be used to specify the type of each included resource.- setGlobal()
Makes the instance accessible globally in a browser environment.
This method attaches the
ApiResourceManagerinstance to thewindowobject in a browser environment, making it globally accessible aswindow.ARM. The instance is frozen usingObject.freeze()to prevent accidental modifications.Caution: This method should be used with care as it modifies the global scope and could potentially lead to naming conflicts.
- getCollection(collectionName) ⇒
Array Retrieves a collection by its name.
This method retrieves the collection with the specified
collectionNamefrom thecollectionsobject of theApiResourceManager. If the collection does not exist, it returns an empty observable array.- _unloadCollection(collectionName) ℗
Unloads a collection by resetting it to an empty array.
This method removes all records from the specified collection in the
collectionsobject of theApiResourceManager.- clearCollection(collectionName)
Clears the contents of a specified collection and unloads related data.
This method removes all records from the collection with the given
collectionNamein thecollectionsobject of theApiResourceManager. It also unloads the records from aliases and request hashes.- getAlias(aliasName, [fallbackRecords]) ⇒
Array|Object Retrieves an alias by its name, with optional fallback records.
This method retrieves the alias with the specified
aliasNamefrom thealiasesobject of theApiResourceManager. If the alias does not exist, it returns the providedfallbackRecords(if any).If
fallbackRecordsis a plain object, the method injects collection actions into it using_injectCollectionActionsbefore returning it.- getRequestAlias(aliasName) ⇒
Object|null Retrieves the request data by resolving a readable alias to its latest request hash.
The
requestAliasesproperty acts as a reference map, linking a human-readable alias to the hash of the most recent request. This method performs a lookup on that hash to return the actual request data.- createRecord(collectionName, [collectionRecord], [collectionRecordRandomId]) ⇒
Object Creates a new record in a specified collection.
This method creates a new record in the collection with the given
collectionName. ThecollectionRecordparameter can be used to provide initial data for the record. IfcollectionRecordRandomIdis true (default), a unique ID is generated for the record usinguuidv1(). Otherwise, a NIL UUID is used.The method injects necessary reference keys and actions into the record using
_injectCollectionReferenceKeysand_injectCollectionActions.- _reloadRequest(requestObject, requestHashKey) ⇒
Promise.<void>℗ Reloads a request by updating its skip ID and re-executing the request.
This method modifies the
requestObjectby generating a new skip ID usinguuidv1()and settingautoResolvetofalseandautoResolveOriginto'_internal'. It then re-executes the request using the_requestmethod. During the reload process, it sets theisLoadingflag of the corresponding request hash totrueand resets it tofalseafter the request is completed.- _resolveRequest(config, requestXHR, requestHashObject) ⇒
Promise|Object℗ Resolves the request based on configuration.
This method determines how to resolve an API request based on the
autoResolveoption in theconfigobject.If
autoResolveis true (which is the default if not explicitly provided), the method returns therequestHashObject, which likely contains the cached response data.If
autoResolveis false, the method returns therequestXHRobject, which represents the actual Axios request Promise. This allows for more control over handling the response, such as accessing the raw response data or handling specific HTTP status codes.- _request(requestConfig) ⇒
Promise.<*> Makes an API request based on the provided configuration.
This method handles various HTTP methods (GET, POST, PUT, DELETE), resource URLs, query parameters, payloads, and error handling. It also manages aliases, request caching, and asynchronous loading of related resources.
- _processRequestPayload(resourceIgnorePayload, resourcePayloadRecord, requestOptions)
Processes the payload for a request, omitting specified keys and setting it in the request options.
- _processRequestURL(requestOptions, resourceName, resourceId)
Processes the URL for a request, constructing it from the resource name and ID.
- _processRequestAlias(requestObject, collectionRecords) ℗
Processes an alias for a request, mapping both the records and the request hash.
This method extracts the alias name from the request configuration and:
- Maps the alias name to the provided collection records in the aliases store.
- Maps the alias name to the generated request hash key in the request aliases store.
- _processRequestOverride(resourceConfig, requestOptions)
Processes request overrides based on the provided configuration.
This method modifies the
requestOptionsobject to incorporate any overrides specified in theresourceConfig.- query(resource, [params], [config]) ⇒
Object|Promise Queries a resource with specified parameters and configuration.
This method sends a GET request to the specified
resourcewith the givenparams(query parameters) andconfig(request configuration). It uses the_requestmethod to handle the API request and the_resolveRequestmethod to determine how to resolve the request (either with cached data or the raw Axios Promise).- queryRecord(resource, [params], [config]) ⇒
Object|Promise Queries a single record from a specified resource.
This method sends a GET request to the specified
resourceto retrieve a single record. Theparams(query parameters) andconfig(request configuration) can be used to customize the request. It uses the_requestmethod to handle the API request and the_resolveRequestmethod to determine how to resolve the request (either with cached data or the raw Axios Promise).- findAll(resource, [config]) ⇒
Object|Promise Fetches a collection of records from a specified resource.
This method sends a GET request to the specified
resourceto retrieve all records. Theconfig(request configuration) can be used to customize the request. It uses the_requestmethod to handle the API request and the_resolveRequestmethod to determine how to resolve the request (either with cached data or the raw Axios Promise).- findRecord(resource, id, [params], [config]) ⇒
Object|Promise Finds a specific record by ID from a given resource.
This method sends a GET request to the specified
resourceto retrieve a single record with the givenid. Theparams(query parameters) andconfig(request configuration) can be used to customize the request. It uses the_requestmethod to handle the API request and the_resolveRequestmethod to determine how to resolve the request (either with cached data or the raw Axios Promise).- peekAll(collectionName) ⇒
Array|undefined Peeks at all records in a specified collection without triggering a request.
This method retrieves all records from the collection with the specified
collectionNamefrom thecollectionsobject of theApiResourceManager. It does not make an API request to fetch the data; it only returns the locally stored records.- peekRecord(collectionName, collectionRecordId) ⇒
Object|undefined Peeks at a specific record in a collection without triggering a request.
This method retrieves a specific record from the collection with the given
collectionNameandcollectionRecordIdfrom thecollectionsobject of theApiResourceManager. It does not make an API request; it only returns the locally stored record if found.- _setRootScope(rootScopeProperty, rootScopeValue) ℗
Internal method to set a property on the root scope.
- setRootScope(rootScopeProperty, rootScopeValue)
Sets a property on the root scope.
- getRootScope(rootScopeProperty) ⇒
* Gets a property from the root scope.
- ajax([config]) ⇒
Promise Makes an AJAX request using the axios library.
- findBy(objects, [findProperties]) ⇒
Object|undefined Finds the first object in an array that matches the specified properties.
- findIndexBy(objects, [findIndexProperties]) ⇒
number Finds the index of the first object in an array that matches the specified properties.
- filterBy(objects, [filterProperties]) ⇒
Array.<Object> Filters an array of objects based on the specified properties.
- uniqBy(objects, uniqByProperty) ⇒
Array.<Object> Creates a new array of unique objects based on a specified property.
- uniq(values) ⇒
Array.<*> Creates a new array of unique primitive values.
- groupBy(objects, groupByProperty) ⇒
Object Groups objects into arrays based on a specified property.
- mapBy(objects, mapByProperty) ⇒
Array.<*> Maps an array of objects to a new array of values, extracting a specific property from each object.
- firstObject([objects]) ⇒
Object|undefined Returns the first object in an array.
- lastObject([objects]) ⇒
Object|undefined Returns the last object in an array.
- mergeObjects([objects], [otherObjects]) ⇒
Array.<Object> Merges two arrays of objects into a single array, removing duplicates.
- chunkObjects([objects], [chunkSize]) ⇒
Array.<Array.<Object>> Splits an array of objects into chunks of a specified size.
- sortBy(objects, sortProperties) ⇒
Array.<Object> Sorts an array of objects based on specified properties and sort orders.
- sum(objects) ⇒
number Sums the values of an array of objects.
- sumBy(objects, sumByProperty) ⇒
number Sums the values of an array of objects, extracting a specific property from each object.
- isEmpty(value) ⇒
boolean Checks if a value is empty.
- isPresent(value) ⇒
boolean Checks if a value is present (not empty).
- isEqual(value, other) ⇒
boolean Checks if two values are equal.
- isNumber(value) ⇒
boolean Checks if a value is a number.
- isNil(value) ⇒
boolean Checks if a value is null or undefined.
- isNull(value) ⇒
boolean Checks if a value is null.
- isGte(value, other) ⇒
boolean Checks if a value is greater than or equal to another value.
- isGt(value, other) ⇒
boolean Checks if a value is greater than another value.
- isLte(value, other) ⇒
boolean Checks if a value is less than or equal to another value.
- isLt(value, other) ⇒
boolean Checks if a value is less than another value.
- DefaultRequestArrayResponse :
Object Default response object for array-based requests.
- DefaultRequestObjectResponse :
Object Default response object for object-based requests.
An array of keys to be omitted during a deep check operation. These keys typically represent internal properties or methods that should not be considered when comparing the current state of a record with its original state.
An array of keys to be omitted when constructing a request payload. These keys typically represent internal object properties or methods that should not be included in the data sent to the server.
Initializes the Axios configuration with the base URL.
Sets the baseURL property in the Axios defaults to the value
returned by the _getBaseURL() method. This ensures that all
Axios requests use the correct base URL for the API.
Kind: global function
Access: private
Initializes a collection of collections with optional default values.
Iterates through the provided array of collections and calls the
_addCollection method for each collection name, initializing it
with an empty array ([]) as the default value.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collections | Array.<string> |
An array of collection names to initialize. |
Gets the base URL for API requests.
Constructs the base URL by combining the host and namespace
properties of the instance.
Kind: global function
Returns: string - The base URL constructed from host and namespace.
Access: private
Checks if a collection exists in the current instance.
This method verifies if a collection with the given collectionName
exists in the collections object of the ApiResourceManager instance.
Kind: global function
Throws:
ErrorIf the collection does not exist.
Access: private
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to check. |
Adds a collection to the current instance.
This method adds a new collection with the specified collectionName
to the collections object of the ApiResourceManager. The
collectionRecords array is used to initialize the collection's data.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to add. |
| collectionRecords | Array |
The initial records for the collection. |
Adds an alias to the aliases object.
This method creates an alias for a collection or a single record.
The aliasName specifies the name of the alias, and aliasRecords
can be either an array of records (for a collection alias) or a
single record object.
If aliasRecords is an array, it's used directly (or an empty array
if aliasRecords is falsy). If it's a plain object, it's used directly
(or an empty object if aliasRecords is falsy).
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| aliasName | string |
The name of the alias. |
| aliasRecords | Array | Object |
The records to be aliased. |
Adds a request alias to the request aliases object.
This method maps a specific aliasName to a requestHashKey in the
requestAliases dictionary. This allows the system to reference a
specific request context using a human-readable alias.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| aliasName | string |
The name of the alias for the request. |
| requestHashKey | string |
The unique hash key identifying the request. |
Generates a hash ID based on the provided object.
This method generates a unique hash ID by stringifying the given
object and then calculating its MD5 hash using the md5 library.
If no object is provided, it defaults to an object with an
id property generated using uuidv1().
Kind: global function
Returns: string - The generated hash ID.
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| [object] | Object |
{ id: uuidv1() } |
The object to generate the hash ID from. |
Sets multiple properties on a target object recursively.
This method iterates through the keyValuePairs object and sets the
corresponding properties on the targetObject. It handles nested
objects by recursively calling itself with an updated prefix.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| targetObject | Object |
The object on which to set the properties. |
| keyValuePairs | Object |
An object containing key-value pairs to set. |
Gets a property from the current record.
This method retrieves the value of a property with the given key
from the current record object (this). It uses Lodash's get
function (aliased as getProperty) to access the property.
Kind: global function
Returns: * - The value of the property.
Access: private
| Param | Type | Description |
|---|---|---|
| key | string |
The key of the property to retrieve. |
Sets a single property on the current record and updates its state based on changes.
This method sets the property with the given key to the specified
value on the current record object (this). It then checks if the
record has been modified by comparing it with the originalRecord.
If changes are detected, it updates the isDirty and isPristine
flags accordingly.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| key | string |
The property key to set. |
| value | * |
The value to set for the property. |
Sets multiple properties on the current record and updates its state based on changes.
This method sets multiple properties on the current record object
(this) using the provided values object. It then compares the
updated record with the originalRecord to detect any modifications.
If the record has been changed, it updates the isDirty and
isPristine flags.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| values | Object |
An object containing key-value pairs to set on the record. |
Sorts an array of records based on specified properties and sort orders.
This method sorts the currentRecords array using the provided
sortProperties. Each sortProperty should be a string in the
format "property:order", where "property" is the name of the property
to sort by and "order" is either "asc" (ascending) or "desc"
(descending).
Kind: global function
Returns: Array - The sorted array of records.
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| currentRecords | Array |
The array of records to sort. | |
| [sortProperties] | Array.<string> |
[] |
An array of sort properties. |
Removes a record from a specified collection based on its hash ID.
This method removes a collectionRecord from its corresponding
collection in the collections object. It determines the collection
using the record's collectionName property and finds the record's
index within the collection using its hashId. If the record is
found, it's removed from the collection using Lodash's pullAt.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionRecord | Object |
The record to be removed from the collection. |
Removes a record from all request hashes based on its hash ID.
This method iterates through all request hashes in the requestHashes
object and removes any occurrences of the collectionRecord based on
its hashId. It handles both array-based and object-based request
hash data.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionRecord | Object |
The record to be removed from request hashes. |
Removes a record from all aliases based on its hash ID.
This method iterates through all aliases in the aliases object
and removes any occurrences of the collectionRecord based on its
hashId. It handles both array-based and object-based alias data.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionRecord | Object |
The record to be removed from aliases. |
Unloads a record from the collection, request hashes, and aliases.
This method removes a currentRecord from all relevant data stores
within the ApiResourceManager:
- The main collection where the record belongs.
- Any request hashes where the record might be present.
- Any aliases that refer to the record.
Kind: global function
| Param | Type | Description |
|---|---|---|
| currentRecord | Object |
The record to be unloaded. |
Saves a record to the server.
This method saves the currentRecord to the server by making an API
request. It determines whether to use a PUT (update) or POST (create)
request based on the validity of the record's id. The collectionConfig
parameter can be used to provide additional configuration for the
request.
Kind: global function
Returns: Promise - A Promise that resolves when the save is successful
or rejects with an error.
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| currentRecord | Object |
The record to be saved. | |
| [collectionConfig] | Object |
{} |
Optional configuration for the save request. |
Deletes a record from the server.
This method deletes the currentRecord from the server by making
a DELETE API request. The collectionConfig parameter can be used
to provide additional configuration for the request.
Kind: global function
Returns: Promise - A Promise that resolves when the deletion is
successful or rejects with an error.
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| currentRecord | Object |
The record to be deleted. | |
| [collectionConfig] | Object |
{} |
Optional configuration for the delete request. |
Reloads a record from the server.
Fetches the latest data for the specified record and updates the local copy.
Kind: global function
Returns: Promise.<Object> - A Promise resolving with the updated record or rejecting with an error.
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| currentRecord | Object |
The record to reload. | |
| [collectionConfig] | Object |
{} |
Optional configuration for the collection. |
Reverts the record's attributes to their original state.
This method retrieves the stored originalRecord (excluding internal
ARM properties), applies those values back to the current record instance,
and resets the isDirty and isPristine state flags.
Kind: global function
Access: private
Retrieves records from a specified collection based on given criteria.
This method retrieves records from the collection with the specified
collectionName, potentially fetching them asynchronously if needed.
It uses the collectionConfig to determine how to filter, sort,
and retrieve the records.
The currentRecord is used to extract related records based on the
referenceKey provided in the collectionConfig. If the related
records are not already in the local collection and async is true
in the collectionConfig, it initiates an asynchronous request to
fetch them.
Kind: global function
Returns: Object | Array - The retrieved records (single object or array).
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| collectionName | string |
The name of the collection. | |
| [collectionConfig] | Object |
{} |
Configuration for retrieving the records. |
| currentRecord | Object | Array |
The record containing potential related records. |
Injects action methods into a collection record.
This method decorates a collectionRecord with predefined action methods,
enabling convenient interactions with the record, including:
- Property access and modification
- Persistence operations (save, delete, reload)
- Retrieval of related collections
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionRecord | Object |
The collection record to inject actions into. |
Decorates the response object with actionable methods.
- Attaches a
reloadmethod to theresponseObjectthat, when invoked, triggers a re-fetch of the original request using the stored hash key.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| requestObject | Object |
The original request configuration. |
| responseObject | Object |
The object to be decorated with actions. |
| requestHashKey | string |
The unique identifier for the request in the store. |
Injects reference keys into a collection record.
This method adds essential reference keys to a collectionRecord,
including:
collectionName: The name of the collection the record belongs to.hashId: A unique hash ID generated for the record.isLoading,isError,isPristine,isDirty: Flags to track the record's state.originalRecord: A copy of the original record data for change tracking.
Kind: global function
Access: private
| Param | Type | Default | Description |
|---|---|---|---|
| collectionName | string |
The name of the collection. | |
| collectionRecord | Object |
The collection record to inject keys into. | |
| [collectionRecordHashId] | string |
null |
Optional pre-generated hash ID for the record. |
Pushes records to a specified collection.
This method adds or updates records in the collection with the given
collectionName. The collectionRecords can be either an array of
records or a single record object.
If collectionRecords is an array, it iterates through the records
and adds them to the collection if they don't already exist. If a
record with the same hashId already exists, it updates the existing
record with the new data.
If collectionRecords is a single object, it adds it to the collection
if it doesn't exist or updates the existing record if it has the same
hashId.
Kind: global function
Returns: Array | Object - The pushed records (array or single object).
Access: private
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to push records to. |
| collectionRecords | Array | Object |
The records to be pushed. |
Pushes records to specified aliases.
This method updates aliases in the aliases object with the provided
collectionRecords. It handles both array-based and object-based
aliases.
If an alias refers to an array of records, the method iterates through
the collectionRecords and updates any matching records within the
alias array based on their hashId.
If an alias refers to a single record object, the method updates the
alias with the matching collectionRecord based on its hashId.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionRecords | Array | Object |
The records to be pushed to aliases. |
Pushes records to specified request hashes.
This method updates request hashes in the requestHashes object with
the provided collectionRecords. It handles both array-based and
object-based request hash data.
If a request hash's data property is an array, the method iterates
through the collectionRecords and updates any matching records
within the data array based on their hashId.
If a request hash's data property is a single record object, the
method updates the data with the matching collectionRecord based
on its hashId.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionRecords | Array | Object |
The records to be pushed to request hashes. |
Pushes records to a collection, aliases, and request hashes.
This method orchestrates the process of adding or updating records
in various data stores within the ApiResourceManager. It takes a
collectionName and collectionRecords (which can be an array or
a single object) and performs the following actions:
- Checks if the specified collection exists.
- Pushes the records to the collection using
_pushToCollection. - Updates any relevant aliases using
_pushToAliases. - Updates any relevant request hashes using
_pushToRequestHashes.
Kind: global function
Returns: Array | Object - The updated collection records.
Access: private
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection. |
| collectionRecords | Array | Object |
The records to be pushed. |
Pushes records to a collection, aliases, and request hashes.
This method orchestrates the process of adding or updating records
in various data stores within the ApiResourceManager. It takes a
collectionName and collectionRecords (which can be an array or
a single object) and performs the following actions:
- Checks if the specified collection exists.
- Pushes the records to the collection using
_pushToCollection. - Updates any relevant aliases using
_pushToAliases. - Updates any relevant request hashes using
_pushToRequestHashes.
Kind: global function
Returns: Array | Object - The updated collection records.
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection. |
| collectionRecords | Array | Object |
The records to be pushed. |
Caches a request/response pair in the internal hash store.
- Generates a unique key based on the request and performs one of two actions:
- If the key exists and the new response is marked
isNew, it toggles the existing entry'sisNewflag tofalse. - Otherwise, it stores the new response object under that key.
- Also injects contextual actions (e.g., reload) into the response object.
Kind: global function
Returns: Object - The stored request hash entry.
Access: private
| Param | Type | Description |
|---|---|---|
| requestObject | Object |
The source object used to generate the hash key. |
| responseObject | Object |
The data/state to be stored. |
Sets the host URL for the client and initializes the Axios configuration.
This method sets the host property of the ApiResourceManager instance
to the provided host URL. It then calls the _initializeAxiosConfig
method to update the Axios configuration with the new host, ensuring
that subsequent API requests use the correct base URL.
Kind: global function
| Param | Type | Description |
|---|---|---|
| host | string |
The base URL of the API server. |
Sets the namespace for the client.
This method sets the namespace property of the ApiResourceManager
instance to the provided namespace. The namespace is typically used
as a path prefix in the base URL for API requests, allowing you to
version your API or organize it into different sections. For example,
a namespace of "api/v2" would result in a base URL like
"https://example.com/api/v2".
Kind: global function
| Param | Type | Description |
|---|---|---|
| namespace | string |
The namespace for API requests. |
Sets a common header for all Axios requests.
This method sets a common header that will be included in all
Axios requests made by the ApiResourceManager. The key parameter
specifies the header name, and the value parameter specifies the
header value.
Kind: global function
| Param | Type | Description |
|---|---|---|
| key | string |
The header key (e.g., 'Authorization', 'Content-Type'). |
| value | string | number | boolean |
The header value. |
Sets the reference key used for included data in request payloads.
This method sets the payloadIncludedReference property of the
ApiResourceManager instance. This property determines the key used
to identify the type of included data in API request payloads.
For example, if the payload includes related resources, this key
might be used to specify the type of each included resource.
Kind: global function
| Param | Type | Description |
|---|---|---|
| key | string |
The new reference key for included data. |
Makes the instance accessible globally in a browser environment.
This method attaches the ApiResourceManager instance to the window
object in a browser environment, making it globally accessible as
window.ARM. The instance is frozen using Object.freeze() to prevent
accidental modifications.
Caution: This method should be used with care as it modifies the global scope and could potentially lead to naming conflicts.
Retrieves a collection by its name.
This method retrieves the collection with the specified collectionName
from the collections object of the ApiResourceManager. If the
collection does not exist, it returns an empty observable array.
Kind: global function
Returns: Array - The collection data as an observable array.
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to retrieve. |
Unloads a collection by resetting it to an empty array.
This method removes all records from the specified collection in the
collections object of the ApiResourceManager.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to unload. |
Clears the contents of a specified collection and unloads related data.
This method removes all records from the collection with the given
collectionName in the collections object of the ApiResourceManager.
It also unloads the records from aliases and request hashes.
Kind: global function
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to clear. |
Retrieves an alias by its name, with optional fallback records.
This method retrieves the alias with the specified aliasName from
the aliases object of the ApiResourceManager. If the alias does
not exist, it returns the provided fallbackRecords (if any).
If fallbackRecords is a plain object, the method injects collection
actions into it using _injectCollectionActions before returning it.
Kind: global function
Returns: Array | Object - The alias data or the fallback records.
| Param | Type | Description |
|---|---|---|
| aliasName | string |
The name of the alias to retrieve. |
| [fallbackRecords] | Array | Object |
Optional fallback records to return if the alias is not found. |
Retrieves the request data by resolving a readable alias to its latest request hash.
The requestAliases property acts as a reference map, linking a human-readable
alias to the hash of the most recent request. This method performs a lookup
on that hash to return the actual request data.
Kind: global function
Returns: Object | null - The request data object if found; otherwise, null.
| Param | Type | Description |
|---|---|---|
| aliasName | string |
The readable alias name to resolve. |
Creates a new record in a specified collection.
This method creates a new record in the collection with the given
collectionName. The collectionRecord parameter can be used to
provide initial data for the record. If collectionRecordRandomId
is true (default), a unique ID is generated for the record using
uuidv1(). Otherwise, a NIL UUID is used.
The method injects necessary reference keys and actions into the
record using _injectCollectionReferenceKeys and
_injectCollectionActions.
Kind: global function
Returns: Object - The created record.
| Param | Type | Default | Description |
|---|---|---|---|
| collectionName | string |
The name of the collection to create the record in. | |
| [collectionRecord] | Object |
{} |
Optional initial data for the record. |
| [collectionRecordRandomId] | boolean |
true |
Whether to generate a random ID. |
Reloads a request by updating its skip ID and re-executing the request.
This method modifies the requestObject by generating a new skip ID
using uuidv1() and setting autoResolve to false and autoResolveOrigin
to '_internal'. It then re-executes the request using the _request
method. During the reload process, it sets the isLoading flag of the
corresponding request hash to true and resets it to false after
the request is completed.
Kind: global function
Returns: Promise.<void> - A promise that resolves when the request is reloaded.
Access: private
| Param | Type | Description |
|---|---|---|
| requestObject | Object |
The request object to reload. |
| requestHashKey | string |
The key of the request hash to update. |
Resolves the request based on configuration.
This method determines how to resolve an API request based on the
autoResolve option in the config object.
If autoResolve is true (which is the default if not explicitly
provided), the method returns the requestHashObject, which likely
contains the cached response data.
If autoResolve is false, the method returns the requestXHR object,
which represents the actual Axios request Promise. This allows for
more control over handling the response, such as accessing the raw
response data or handling specific HTTP status codes.
Kind: global function
Returns: Promise | Object - The resolved value based on the
autoResolve configuration.
Access: private
| Param | Type | Description |
|---|---|---|
| config | Object |
The configuration object for the request. |
| requestXHR | Promise |
The Axios request Promise. |
| requestHashObject | Object |
The request hash object containing cached response data. |
Makes an API request based on the provided configuration.
This method handles various HTTP methods (GET, POST, PUT, DELETE), resource URLs, query parameters, payloads, and error handling. It also manages aliases, request caching, and asynchronous loading of related resources.
Kind: global function
Returns: Promise.<*> - A Promise that resolves with the API response data or the request hash object (if autoResolve is true), or rejects with an error.
| Param | Type | Description |
|---|---|---|
| requestConfig | Object |
The configuration object for the request. |
| requestConfig.resourceMethod | string |
The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete'). |
| requestConfig.resourceName | string |
The name of the API resource being accessed. |
| [requestConfig.resourceId] | string | number |
Optional ID of the specific resource for GET/PUT/DELETE requests. |
| [requestConfig.resourceParams] | Object |
Optional query parameters for the request. |
| [requestConfig.resourcePayload] | Object |
Optional payload data for POST/PUT requests. |
| [requestConfig.resourceFallback] | * |
Optional fallback value to return if the request fails and no response data is available. |
| [requestConfig.resourceConfig] | Object |
Optional configuration overrides for the request (e.g., alias, autoResolve, skip, ignorePayload, override). |
Processes the payload for a request, omitting specified keys and setting it in the request options.
Kind: global function
| Param | Type | Description |
|---|---|---|
| resourceIgnorePayload | Array.<string> |
An array of keys to be ignored (omitted) from the payload. |
| resourcePayloadRecord | Object |
The record object containing the payload data. |
| requestOptions | Object |
The options object for the request, where the processed payload will be set. |
Processes the URL for a request, constructing it from the resource name and ID.
Kind: global function
| Param | Type | Description |
|---|---|---|
| requestOptions | Object |
The options object for the request, where the URL will be set. |
| resourceName | string |
The name of the resource being accessed. |
| resourceId | string | number |
The ID of the specific resource. |
Processes an alias for a request, mapping both the records and the request hash.
This method extracts the alias name from the request configuration and:
- Maps the alias name to the provided collection records in the aliases store.
- Maps the alias name to the generated request hash key in the request aliases store.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| requestObject | Object |
The full request object used to generate the hash ID and containing the resource configuration. |
| collectionRecords | Array | Object |
The records to be aliased. Can be an array or a single object. |
Processes request overrides based on the provided configuration.
This method modifies the requestOptions object to incorporate any overrides
specified in the resourceConfig.
Kind: global function
| Param | Type | Description |
|---|---|---|
| resourceConfig | Object |
The configuration object for the resource request. |
| resourceConfig.override | Object |
Optional overrides for the request. |
| [resourceConfig.override.host] | string |
Optional override for the base URL host. |
| [resourceConfig.override.namespace] | string |
Optional override for the API namespace. |
| [resourceConfig.override.path] | string |
Optional override for the request path. |
| [resourceConfig.override.headers] | Object |
Optional override for request headers. |
| requestOptions | Object |
The request options object to be modified. |
Queries a resource with specified parameters and configuration.
This method sends a GET request to the specified resource with the
given params (query parameters) and config (request configuration).
It uses the _request method to handle the API request and the
_resolveRequest method to determine how to resolve the request
(either with cached data or the raw Axios Promise).
Kind: global function
Returns: Object | Promise - The resolved value based on the autoResolve
configuration in config.
| Param | Type | Default | Description |
|---|---|---|---|
| resource | string |
The name of the API resource to query. | |
| [params] | Object |
{} |
Optional query parameters for the request. |
| [config] | Object |
{} |
Optional configuration for the request. |
Queries a single record from a specified resource.
This method sends a GET request to the specified resource to
retrieve a single record. The params (query parameters) and
config (request configuration) can be used to customize the
request. It uses the _request method to handle the API request
and the _resolveRequest method to determine how to resolve the
request (either with cached data or the raw Axios Promise).
Kind: global function
Returns: Object | Promise - The resolved value based on the autoResolve
configuration in config.
| Param | Type | Default | Description |
|---|---|---|---|
| resource | string |
The name of the API resource to query. | |
| [params] | Object |
{} |
Optional query parameters for the request. |
| [config] | Object |
{} |
Optional configuration for the request. |
Fetches a collection of records from a specified resource.
This method sends a GET request to the specified resource to
retrieve all records. The config (request configuration) can be
used to customize the request. It uses the _request method to
handle the API request and the _resolveRequest method to determine
how to resolve the request (either with cached data or the raw
Axios Promise).
Kind: global function
Returns: Object | Promise - The resolved value based on the autoResolve
configuration in config.
| Param | Type | Default | Description |
|---|---|---|---|
| resource | string |
The name of the API resource to query. | |
| [config] | Object |
{} |
Optional configuration for the request. |
Finds a specific record by ID from a given resource.
This method sends a GET request to the specified resource to
retrieve a single record with the given id. The params
(query parameters) and config (request configuration) can be used
to customize the request. It uses the _request method to handle
the API request and the _resolveRequest method to determine how
to resolve the request (either with cached data or the raw Axios
Promise).
Kind: global function
Returns: Object | Promise - The resolved value based on the autoResolve
configuration in config.
| Param | Type | Default | Description |
|---|---|---|---|
| resource | string |
The name of the API resource to query. | |
| id | number | string |
The ID of the record to find. | |
| [params] | Object |
{} |
Optional query parameters for the request. |
| [config] | Object |
{} |
Optional configuration for the request. |
Peeks at all records in a specified collection without triggering a request.
This method retrieves all records from the collection with the
specified collectionName from the collections object of the
ApiResourceManager. It does not make an API request to fetch
the data; it only returns the locally stored records.
Kind: global function
Returns: Array | undefined - The collection records, or undefined if
the collection is not found.
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection to peek at. |
Peeks at a specific record in a collection without triggering a request.
This method retrieves a specific record from the collection with the
given collectionName and collectionRecordId from the collections
object of the ApiResourceManager. It does not make an API request;
it only returns the locally stored record if found.
Kind: global function
Returns: Object | undefined - The found record, or undefined if not found
in the local collection.
| Param | Type | Description |
|---|---|---|
| collectionName | string |
The name of the collection. |
| collectionRecordId | number | string |
The ID of the record to find. |
Internal method to set a property on the root scope.
Kind: global function
Access: private
| Param | Type | Description |
|---|---|---|
| rootScopeProperty | string |
The property name to set. |
| rootScopeValue | * |
The value to set. |
Sets a property on the root scope.
Kind: global function
| Param | Type | Description |
|---|---|---|
| rootScopeProperty | string |
The property name to set. |
| rootScopeValue | * |
The value to set. |
Gets a property from the root scope.
Kind: global function
Returns: * - The value of the property.
| Param | Type | Description |
|---|---|---|
| rootScopeProperty | string |
The property name to get. |
Makes an AJAX request using the axios library.
Kind: global function
Returns: Promise - A Promise that resolves with the Axios response or
rejects with an error.
| Param | Type | Default | Description |
|---|---|---|---|
| [config] | Object |
{} |
Configuration object for the axios request. |
Finds the first object in an array that matches the specified properties.
Kind: global function
Returns: Object | undefined - The found object, or undefined if not found.
| Param | Type | Default | Description |
|---|---|---|---|
| objects | Array.<Object> |
The array of objects to search. | |
| [findProperties] | Object |
{} |
The properties to match. |
Finds the index of the first object in an array that matches the specified properties.
Kind: global function
Returns: number - The index of the found object, or -1 if not found.
| Param | Type | Default | Description |
|---|---|---|---|
| objects | Array.<Object> |
The array of objects to search. | |
| [findIndexProperties] | Object |
{} |
The properties to match. |
Filters an array of objects based on the specified properties.
Kind: global function
Returns: Array.<Object> - The filtered array of objects.
| Param | Type | Default | Description |
|---|---|---|---|
| objects | Array.<Object> |
The array of objects to filter. | |
| [filterProperties] | Object |
{} |
The filter criteria. |
Creates a new array of unique objects based on a specified property.
Kind: global function
Returns: Array.<Object> - The array of unique objects.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> |
The array of objects to process. |
| uniqByProperty | string |
The property to use for uniqueness comparison. |
Creates a new array of unique primitive values.
Kind: global function
Returns: Array.<*> - The array of unique values.
| Param | Type | Description |
|---|---|---|
| values | Array.<*> |
The array of values to process. |
Groups objects into arrays based on a specified property.
Kind: global function
Returns: Object - An object where keys are group values and values
are arrays of objects.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> |
The array of objects to group. |
| groupByProperty | string |
The property to group by. |
Maps an array of objects to a new array of values, extracting a specific property from each object.
Kind: global function
Returns: Array.<*> - A new array containing the extracted values.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> |
The array of objects to map. |
| mapByProperty | string |
The property to extract from each object. |
Returns the first object in an array.
Kind: global function
Returns: Object | undefined - The first object, or undefined if the
array is empty.
| Param | Type | Default | Description |
|---|---|---|---|
| [objects] | Array.<Object> |
[] |
The array of objects. |
Returns the last object in an array.
Kind: global function
Returns: Object | undefined - The last object, or undefined if the
array is empty.
| Param | Type | Default | Description |
|---|---|---|---|
| [objects] | Array.<Object> |
[] |
The array of objects. |
Merges two arrays of objects into a single array, removing duplicates.
Kind: global function
Returns: Array.<Object> - The merged array of objects without duplicates.
| Param | Type | Default | Description |
|---|---|---|---|
| [objects] | Array.<Object> |
[] |
The first array of objects. |
| [otherObjects] | Array.<Object> |
[] |
The second array of objects. |
Splits an array of objects into chunks of a specified size.
Kind: global function
Returns: Array.<Array.<Object>> - An array of chunks.
| Param | Type | Default | Description |
|---|---|---|---|
| [objects] | Array.<Object> |
[] |
The array of objects to chunk. |
| [chunkSize] | number |
1 |
The size of each chunk. |
Sorts an array of objects based on specified properties and sort orders.
Kind: global function
Returns: Array.<Object> - The sorted array of objects.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> |
The array of objects to sort. |
| sortProperties | Array.<string> |
An array of sort properties in the format of 'property:order'. |
Sums the values of an array of objects.
Kind: global function
Returns: number - The sum of the values.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> |
The array of objects to sum. |
Sums the values of an array of objects, extracting a specific property from each object.
Kind: global function
Returns: number - The sum of the extracted values.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> |
The array of objects to sum. |
| sumByProperty | string |
The property to extract from each object. |
Checks if a value is empty.
Kind: global function
Returns: boolean - True if the value is empty, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | * |
The value to check. |
Checks if a value is present (not empty).
Kind: global function
Returns: boolean - True if the value is present, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | * |
The value to check. |
Checks if two values are equal.
Kind: global function
Returns: boolean - True if the values are equal, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | * |
The first value. |
| other | * |
The second value. |
Checks if a value is a number.
Kind: global function
Returns: boolean - True if the value is a number, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | * |
The value to check. |
Checks if a value is null or undefined.
Kind: global function
Returns: boolean - True if the value is null or undefined, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | * |
The value to check. |
Checks if a value is null.
Kind: global function
Returns: boolean - True if the value is null, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | * |
The value to check. |
Checks if a value is greater than or equal to another value.
Kind: global function
Returns: boolean - True if the first value is greater than or equal
to the second value, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | number |
The first value. |
| other | number |
The second value. |
Checks if a value is greater than another value.
Kind: global function
Returns: boolean - True if the first value is greater than the second
value, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | number |
The first value. |
| other | number |
The second value. |
Checks if a value is less than or equal to another value.
Kind: global function
Returns: boolean - True if the first value is less than or equal to
the second value, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | number |
The first value. |
| other | number |
The second value. |
Checks if a value is less than another value.
Kind: global function
Returns: boolean - True if the first value is less than the second
value, false otherwise.
| Param | Type | Description |
|---|---|---|
| value | number |
The first value. |
| other | number |
The second value. |
Default response object for array-based requests.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| isLoading | boolean |
Indicates if the request is loading. |
| isError | boolean |
Indicates if an error occurred during the request. |
| isNew | boolean |
Indicates if the response is new. |
| data | Array |
The main data array returned by the request. |
| included | Array |
Additional included data related to the response. |
| meta | Object |
Metadata about the response. |
| error | Object |
Error information, if any (null if no error). |
Default response object for object-based requests.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| isLoading | boolean |
Indicates if the request is loading. |
| isError | boolean |
Indicates if an error occurred during the request. |
| isNew | boolean |
Indicates if the response is new. |
| data | Object |
The main data object returned by the request. |
| included | Array |
Additional included data related to the response. |
| meta | Object |
Metadata about the response. |
| error | Object |
Error information, if any (null if no error). |