Constructor
new FetchEngine()
Creates a new FetchEngine instance.
Source
Members
configFetchEngine
Type
Source
dataMap.<String, Array>
Type
-
Map.<String, Array>
Source
Methods
configure(config)
Parameters
-
config
FetchEngineThe configuration object for the storage engine.
Source
delete(request) → {Promise.<module:response~Response>}
Parameters
-
request
DeleteRequestThe 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.
Source
get(request) → {Promise.<module:response~Response>}
Parameters
-
request
GetRequestThe GET request to send to the storage engine.
Returns
-
Promise.<module:response~Response>Returns the data objects from storage matching request criteria.
Source
options(request) → {Promise.<module:response~Response>}
Parameters
-
request
OptionsRequestThe 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.
Source
patch(request) → {Promise.<module:response~Response>}
Parameters
-
request
PatchRequestThe 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.
Source
post(request) → {Promise.<module:response~Response>}
Parameters
-
request
PostRequestThe 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
PutRequestThe 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 may not exactly match the objects requested to be updated, as some may have been deleted from storage or some may not match the key criteria.
Source
resources() → {Promise.<Array.<String>>}
Returns
-
Promise.<Array.<String>>
Source
Type Definitions
Configuration
Properties
-
root
String<optional>
The root URI of each fetch request. If specified, will be prefixed to each resource.
-
path
String<optional>
"/api"The path to the URI endpoint. This is prefixed before each resource, but after the
root(if specified). -
trailingSlash
Boolean<optional>
falseSets whether a slash will be added at the end of the generated URI.
-
omitResource
Boolean<optional>
falseOmits
toandfromproperties and values from the request payload sent over fetch. This may help force endpoints to ensure the resource is determined on their end instead of by the requestor. -
model
FetchEngine<optional>
-
fetch
RequestInit<optional>
Optional fetch defaults to apply before request-specific configuration is set.
Source
ModelConfiguration
Properties
-
pathProperty
String<optional>
"resource"Instructs StashKu which property from the
$stashkuobject on a model type to populate the resource (toorfrom) on a request. Can be"name","slug","plural.name","plural.slug", or"resource"(default). -
header
Boolean<optional>
falseDetermines whether the fetch request to the HTTP endpoint will include the model header when
STASHKU_MODEL_HEADERis enabled. By default this is disabled and the headermodelproperty will not be sent. Setting this flag totruewill forward themodelheader of the StashKu request.