Constructor
new MemoryEngine()
Creates a new MemoryEngine
instance.
Source
Members
configMemoryEngineConfiguration
Type
Source
dataMap.<String, Array>
Type
-
Map.<String, Array>
Source
Methods
configure(config)
Parameters
-
config
MemoryEngineConfiguration
The configuration object for the storage engine.
Source
delete(request) → {Promise.<module:response~Response>}
If the last item from memory is deleted, the resource is also deleted from memory (resulting in a 404 for the resource until a new record is added under that resource name).
Parameters
-
request
DeleteRequest
The DELETE request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage that were deleted with the request criteria.
Throws
404 Error when the requested resource is has not been stored in memory.
Source
get(request) → {Promise.<module:response~Response>}
Parameters
-
request
GetRequest
The GET request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage matching request criteria.
Throws
404 Error when the requested resource is has not been stored in memory.
Source
options(request) → {Promise.<module:response~Response>}
Parameters
-
request
OptionsRequest
The OPTIONS request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns a response with a single data object- the dynamically created model configuration.
Throws
404 Error when the requested resource is has not been stored in memory.
Source
patch(request) → {Promise.<module:response~Response>}
Parameters
-
request
PatchRequest
The PATCH request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns a response with the total number of the objects affected in storage. No data objects are typically returned with this request.
Throws
404 Error when the requested resource is has not been stored in memory.
Source
post(request) → {Promise.<module:response~Response>}
This will create the resource in memory if it does not already exist.
Parameters
-
request
PostRequest
The POST request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage that were created with the request criteria.
Source
put(request) → {Promise.<module:response~Response>}
Parameters
-
request
PutRequest
The PUT request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage that were updated with the request criteria. This could potentially not exactly match the objects requested to be updated, as some may have been deleted from storage or some may not match the primary key criteria.
Throws
404 Error when the requested resource is has not been stored in memory.
Source
resourceOf(request) → {String}
Finds and adjusts the resource name of the given request with consideration to the case-sensitivity setting on the storage engine or per-request.
Parameters
-
request
GetRequest
|PatchRequest
|PostRequest
|PutRequest
|OptionsRequest
The request to extract the resource (target) name from.
Returns
-
String
Source
resources() → {Promise.<Array.<String>>}
Returns
-
Promise.<Array.<String>>