◆ addQueryData()
| CloudRequestEngine::addQueryData | ( | flowData, | |
| queryData, | |||
| allEvidence, | |||
| evidence | |||
| ) |
Add query data to the evidence.
- Parameters
-
- {FlowData} - flowData FlowData for logging
- {object} - queryData The destination dictionary to add query data to.
- {Evidence} - allEvidence All evidence in the flow data. This is used to report which evidence keys are conflicting.
- {object} - evidence Evidence to add to the query Data.
◆ constructor()
CloudRequestEngine::constructor ( { resourceKey, licenseKey, baseURL, cloudRequestOrigin, requestClient } ) inlineConstructor for CloudRequestEngine.
- Parameters
-
- {object} - options options object
- {string} - options.resourceKey resourcekey for cloud service
- {string} - options.licenseKey licensekey for cloud service
- {string} - options.baseURL url the cloud service is located at if overriding default
- {string} - options.cloudRequestOrigin The value to set for the Origin header when making requests to the cloud service. This is used by the cloud service to check that the request is being made from a origin matching those allowed by the resource key. For more detail, see the 'Request Headers' section in the cloud documentation.
- {RequestClient} - options.requestClient Set predefined RequestClient.
◆ fetchEvidenceKeysAndProperties()
CloudRequestEngine::fetchEvidenceKeysAndProperties ( resolveCallback, rejectCallback ) inlineFetches evidence keys and properties data.
This method asynchronously fetches evidence keys and properties required for the operation. It uses Promises to handle data retrieval and provides callback functions for success and failure scenarios.
- Parameters
-
- {Function} - resolveCallback - A callback function to be called when the data is successfully fetched. It will receive the current instance as a parameter.
- {Function} - rejectCallback - A callback function to be called when an error occurs during data retrieval. It will receive the error information as a parameter.
◆ fetchProperties()
CloudRequestEngine::fetchProperties ( ) inlineInternal process to fetch all the properties available under a resourcekey.
- Returns
- {Promise<object>} properties from the cloud server
◆ getContent()
CloudRequestEngine::getContent ( flowData ) inlineGenerate the Content to send in the POST request.
The evidence keys e.g. 'query.' and 'header.' have an order of precedence. These are added to the evidence in reverse order, if there is conflict then the queryData value is overwritten. 'query.' evidence should take precedence over all other evidence. If there are evidence keys other than 'query.' that conflict then this is unexpected so a warning will be logged.
- Parameters
-
- {FlowData} - flowData FlowData to get evidence from
- Returns
- {object} Evidence Dictionary
◆ getData()
CloudRequestEngine::getData ( flowData ) inlineInternal function to get data from cloud service.
- Parameters
-
- {FlowData} - flowData FlowData used to extract evidence and send to cloud service for processing
- Returns
- {Promise} result of processing
◆ getErrorMessages()
CloudRequestEngine::getErrorMessages ( responseBody ) inlineTypically, cloud will return errors as JSON.
However, transport level errors or other failures can result in responses that are plain text. This function handles these cases.
- Parameters
-
- {string} - responseBody the response data to process
- Returns
- {Array} The error messages
◆ getErrorsFromResponse()
CloudRequestEngine::getErrorsFromResponse ( response ) inlineUsed to handle errors from http requests.
- Parameters
-
- {import('http').ServerResponse} - response Responce to get errors from
- Returns
- {Array<CloudRequestError>} Array of CloudRequestError from response
◆ getEvidenceKeys()
CloudRequestEngine::getEvidenceKeys ( ) inlineInternal function to get evidenceKeys used by cloud resourcekey.
- Returns
- {Promise} evidence promise
◆ getSelectedEvidence()
CloudRequestEngine::getSelectedEvidence ( evidence, type ) inlineGet evidence with specified prefix.
- Parameters
-
- {Evidence} - evidence All evidence in the flow data.
- {string} - type Required evidence key prefix
- Returns
- {Evidence} Selected evidence
◆ hasKeyPrefix()
CloudRequestEngine::hasKeyPrefix ( itemKey, prefix ) inlineCheck that the key of a KeyValuePair has the given prefix.
- Parameters
-
- {string} - itemKey Key to check
- {string} - prefix The prefix to check for.
- Returns
- {boolean} True if the key has the prefix.
◆ keysAndPropertiesFetched()
get CloudRequestEngine::keysAndPropertiesFetched ( ) inlineCheck if the keys and properties have been fetched.
This computed property determines whether the keys of a 'flowElementProperties' object and the 'evidenceKeyFilter' array both have elements, indicating that the necessary data has been fetched and is ready for use.
- Returns
- {boolean} True if the keys and properties are fetched and ready; otherwise, false.
◆ metaPropertyTransform()
CloudRequestEngine::metaPropertyTransform ( key, value ) inlineMeta property transform.
- Parameters
-
- {string} - key key to check
- {object} - value properties to transform
- Returns
- {object} transformed properties
◆ processInternal()
CloudRequestEngine::processInternal ( flowData ) inlineInternal process for cloud engine Returns raw JSON as a "cloud" property in "cloud".
- Parameters
-
- {FlowData} - flowData flowData to process
- Returns
- {Promise} data from cloud service
◆ propertiesTransform()
CloudRequestEngine::propertiesTransform ( properties ) inlineProperties transform.
- Parameters
-
- {object} - properties properties to transform
- Returns
- {object} transformed properties
◆ ready()
CloudRequestEngine::ready ( ) inlineFunction for testing if the cloud engine is ready Checks to see if properties and evidence keys have been fetched.
- Returns
- {Promise} whether ready
