Members
ISO8601DateRegExp
A regular expression to check for a reasonable ISO8601 format date. YYYY-MM-DDThh:mm YYYY-MM-DDThh:mmTZD YYYY-MM-DDThh:mm:ss YYYY-MM-DDThh:mm:ssTZD YYYY-MM-DDThh:mm:ss.s YYYY-MM-DDThh:mm:ss.sTZD
Type
-
RegExp
Source
LOGIC_KEYSArray.<String>
Array of valid logic strings.
Type
-
Array.<String>
Source
OP_MAPMap.<String, String>
Mapping of all operations plus additionally supported shortcut tokens (such as ">", "<", "==", "!=", etc.) as keys with their supported underlying operation (value).
This is sorted in order of longest token to shortest which helps tokenization grab the longest matching token first.
Type
-
Map.<String, String>
Source
Methods
HttpRequestLoader(httpReq, modelTypeopt) → {Promise.<(module:requests/get-request~GetRequest|module:requests/post-request~PostRequest|module:requests/put-request~PutRequest|module:requests/patch-request~PatchRequest|module:requests/delete-request~DeleteRequest|module:requests/options-request~OptionsRequest)>}
Attempts to parse a request object from an http.IncomingMessage
, matched by the request method.
Parameters
-
httpReq
http.IncomingMessage
The request object.
-
modelType
Modeling.AnyModelType
<optional>
Optional model set
Returns
-
Promise.<(module:requests/get-request~GetRequest|module:requests/post-request~PostRequest|module:requests/put-request~PutRequest|module:requests/patch-request~PatchRequest|module:requests/delete-request~DeleteRequest|module:requests/options-request~OptionsRequest)>
Source
PackageLoader(packageName) → {Promise.<BaseEngine>}
Attempts to load a node package by name which should be a StashKu engine.
Parameters
-
packageName
String
The name of the package containing the stashku engine.
Returns
-
Promise.<BaseEngine>
Source
start()
Starts the worker to perform actions using the loaded options.
Source
Type Definitions
ConditionCallback(f, orig)
Parameters
Source
ConditionCallback(f, orig)
Parameters
Source
ConditionCallback(f, orig) → {Filter}
Parameters
Returns
Source
Constructor
Type
-
instanceOf()
|instanceOf(T)
Source
Constructor
Type
-
instanceOf()
|instanceOf(T)
Source
DeleteRequestCallback(request, modelopt)
Parameters
-
request
DeleteRequest
-
model
M
<optional>
Source
GetRequestCallback(request, modelopt)
Parameters
-
request
GetRequest
-
model
M
<optional>
Source
LoggerCallback(state, severity, args)
Parameters
-
state
String
Always a "log" string.
-
severity
String
The severity level of the log message, either "error", "warn", "info", or "debug".
-
args
Array
The log message arguments, this can be a mix of types.
Source
MainState
Properties
-
versions
Object
-
opts
CLI.CommandLineOptions
-
args
*
Source
MemoryEngineConfiguration
Properties
-
caseSensitive
Boolean
Controls whether all resource names are stored in lower-case, and tracked case-insensitively or not. By default this is unset in the configuration which will default to
false
internally and allow it to be overridden by request headers. If set explicitly, the request header'scaseSensitive
flag will be ignored. -
limit
Number
Limits the maximum number of objects that can be stored in the memory engine per resource name. If this limit is reached, POST requests will throw an error.
Source
MemoryRequestHeader
Properties
-
caseSensitive
Boolean
Instructs the memory storage engine to search for a resource by its lower-case name (
false
) or regular-case (true
). This will be ignored if the same flag (caseSensitive
) is set on the memory storage configuration.
Source
ModelNameResolveCallback(name) → {*}
Parameters
-
name
String
The model name defined.
Returns
-
*
Returns a model type constructor/class associated with the model name.
Source
OptionsRequestCallback(request, modelopt)
Parameters
-
request
OptionsRequest
-
model
M
<optional>
Source
ParserToken
Properties
-
type
String
-
startIndex
Number
-
endIndex
Number
-
value
String
<optional>
Source
PatchRequestCallback(request, modelopt)
Parameters
-
request
PatchRequest
-
model
M
<optional>
Source
PostRequestCallback(request, modelopt)
Parameters
-
request
PostRequest
-
model
M
<optional>
Source
PutRequestCallback(request, modelopt)
Parameters
-
request
PutRequest
-
model
M
<optional>
Source
SortToken
Properties
-
type
String
-
value
String
Source
StashKuConfiguration
Properties
-
engine
String
|BaseEngine
The name or instance of the StashKu engine to use.
-
middleware
Array.<(StashKuMiddleware|StashKuMiddlewareCallback|StashKuMiddlewareLogCallback)>
-
model
StashKuModelConfiguration
Configuration describing how StashKu works with models.
-
resources
Array.<String>
Optional array of resource names that are allowed through this instance of StashKu. Any request asking for a resource not found in this array will throw an error.
Source
StashKuMiddleware
Properties
-
name
String
<optional>
An optional name for the middleware that is used for logging purposes.
-
states
Array.<String>
<optional>
The name(s) of the states to target, either "all"/"*", "log", "request", "response", or "done".
-
methods
Array.<String>
<optional>
The name(s) of the methods to target, either "all"/"*", "get", "post", "put", "patch" or "delete".
-
callback
StashKuMiddlewareCallback
|StashKuMiddlewareLogCallback
The callback to be called when being processed.
Source
StashKuMiddlewareCallback(stashku, engine, method, request, response, state)
Parameters
-
stashku
StashKu
The StashKu instance making the middleware call.
-
engine
BaseEngine
The storage engine instance that is processing the request.
-
method
String
The name of the request method being carried out, typically "get", "post", "put", "patch", "delete", "options".
-
request
GetRequest
|PostRequest
|PutRequest
|PatchRequest
|DeleteRequest
|OptionsRequest
The request object being specified.
-
response
Response
The response object (
null
if not prepared yet). -
state
String
The name of the state of where in the RESTful process the callback is being made, either:
- "request": Indicates the callback was made before the request has handed off to the engine.
- "response": Indicates the callback was made after the engine's response has been returned.
- "done": Indicates the callback was made after the engine has completed the response and the action is about to complete (StashKu hands off the storage engine response to the caller).
Source
StashKuMiddlewareLogCallback(stashku, engine, severity, args)
Parameters
-
stashku
StashKu
The StashKu instance making the middleware call.
-
engine
BaseEngine
The storage engine instance that is currently loaded.
-
severity
String
The severity level of the log message, either "error", "warn", "info", or "debug".
-
args
Array
The log message arguments, this can be a mix of types.
Source
StashKuModelConfiguration
Properties
-
header
Boolean
<optional>
false
Instructs StashKu to add a header
model
with the value of the$stashku
definition to all modelled RESTful requests. Certain engines, such asfetch
may offer advanced features that leverage model information in their operation.