@AppKu/StashKu

@AppKu/StashKu

v1.0.46

Global

Members

constant

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

constant

LOGIC_KEYSArray.<String>

Array of valid logic strings.

Type

  • Array.<String>

Source

constant

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

async

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

async

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

Source

Type Definitions

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

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's caseSensitive 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

ParserToken

Properties

  • type String
  • startIndex Number
  • endIndex Number
  • value String <optional>

Source

StashKuConfiguration

Properties

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 as fetch may offer advanced features that leverage model information in their operation.

Source