Module: OpenSearchUtils

Provides utilities for handling OpenSearch responses and requests.
Source:

Methods

(static) arrayFind(array, predicate, context) → {Any|undefined}

Finds a value in an array that satisfies the provided predicate function.
Parameters:
Name Type Description
array Array The array to search in.
predicate function Function to execute on each value in the array, taking three arguments: element The current element being processed in the array. index The index of the current element being processed in the array. array The array find was called upon.
context Object | null Object to use as "this" when executing the predicate function.
Source:
Returns:
The value of the first element in the array that satisfies the provided predicate function. Otherwise, undefined is returned.
Type
Any | undefined

(static) fetch(options) → {Promise}

Provides a standard method for fetching resources.
Parameters:
Name Type Description
options OpenSearchRequest
Source:
Returns:
A promise that resolves with the response or rejects with an error.
Type
Promise

(static) getChildTextContent(parent, localName, namespaceURI) → {String}

Gets the trimmed text content of the first child node starting from a root node.
Parameters:
Name Type Description
parent Node The root node from which to start the search.
localName String The local name (without the namespace) of the child node which contains the text content.
namespaceURI String | null The namespace URI of the child node.
Source:
Returns:
The text content of the specified child node.
Type
String

(static) getNodeAttributes(node, result) → {Object}

Gets the attributes of an XML node and stores them in an object.
Parameters:
Name Type Description
node Node The XML node to read from.
result Object An object to store the attributes.
Source:
Returns:
The resulting object.
Type
Object

(static) getTextContent(node) → {String}

Gets the trimmed text content of node.
Parameters:
Name Type Description
node Node The node from which to get the text content.
Source:
Returns:
The text content of the specified node.
Type
String

(static) getXmlElements(parent, localName, namespaceURI) → {Array.<Node>}

Finds all child nodes that match the localName and namespaceURI, starting from a root node.
Parameters:
Name Type Description
parent Node The root node from which to start the search.
localName String The local name (without the namespace) of the child node.
namespaceURI String | null The namespace URI of the child node.
Source:
Returns:
An array of XML nodes.
Type
Array.<Node>

(static) parseXml(xmlString) → {Element}

Parses an XML string and returns its root element.
Parameters:
Name Type Description
xmlString String The XML string to parse.
Source:
Returns:
The root element of the parsed document.
Type
Element