Skip to main content

varo@1.1.0

convertItemsToReports(items, [reportType])
convertReportsToMessageContents(reports, [reportType])
convertToEms(messageContents)

This adaptor exports the following from common:

alterState()
combine()
cursor()
dataPath()
dataValue()
each()
field()
fields()
fn()
fnIf()
http
lastReferenceValue()
merge()
sourceValue()

Functions

convertItemsToReports

convertItemsToReports(items, [reportType]) ⇒ Operation

Read a collection of EMS-like data records and convert them to a standard EMS report/record format. Systematically separates report properties from record properties.

ParamTypeDefaultDescription
itemsArrayArray of EMS-like JSON objects.
[reportType]string"'unknown'"Optional. Source of the report, e.g., "ems" or "rtmd".

This operation writes the following keys to state:

State KeyDescription
dataThe converted, EMS-compliant report with records.

Example: Convert data to EMS-compliant data.

convertItemsToReport(
[
{ "ASER": "BJBC 08 30", "ABST": "20241205T004440Z", "TVC": 5.0 },
{ "ASER": "BJBC 08 30", "ABST": "20241205T005440Z", "TVC": 5.2 },
]
);

state.data becomes:
{
"ASER": "BJBC 08 30",
records: [
{ "ABST": "20241205T004440Z", "TVC": 5.0 },
{ "ABST": "20241205T005440Z", "TVC": 5.2 },
],
}

convertReportsToMessageContents

convertReportsToMessageContents(reports, [reportType]) ⇒ function

Converts an EMS-compliant report into Varo-compatible message components.

Returns: function - An operation function that receives state and returns updated message content.

ParamTypeDefaultDescription
reportsObjectEMS-compliant report objects.
[reportType]string"'unknown'"Optional. Source of the report, e.g., "ems" or "rtmd".

Example

// Convert EMS-compliant reports to Varo message components.
convertReportsToMessageContents(emsReports, "ems");

convertToEms

convertToEms(messageContents) ⇒ Operation

Processes EMS data from the provided list of message contents.

ParamTypeDescription
messageContentsArrayArray of message content objects.

This operation writes the following keys to state:

State KeyDescription
dataThe converted, EMS-compliant version of each message contents.

Example: Convert data to EMS-compliant data.

convertToEms(
[
{
metadata: { content: '', filename: '' },
data: { content: '', filename: '' }
}
]
);