Skip to main content

varo@2.1.1

convertItemsToReports(items, [reportType])
convertReportsToMessageContents(reports, [reportType])
convertToEms(messageContents)
isKeyInRange(key, start, end)
parseUtcForDataRange(timeZone, startIso, endIso)

This adaptor exports the following from common:

alterState()
combine()
cursor()
dataPath()
dataValue()
each()
field()
fields()
fn()
fnIf()
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: '' }
}
]
);

isKeyInRange

isKeyInRange(key, start, end) ⇒ boolean

Checks whether the timestamp embedded in a key falls within a UTC datetime range.

Returns: boolean - True if the parsed UTC timestamp is within the range, false otherwise.

ParamTypeDescription
keystringA string key containing a UTC timestamp in the format YYYYMMDDTHHMMSS, following a colon (e.g. "prefix:20250624T101530").
startDateThe inclusive lower bound of the UTC datetime range.
endDateThe exclusive upper bound of the UTC datetime range.

parseUtcForDataRange

parseUtcForDataRange(timeZone, startIso, endIso) ⇒ UtcRange

Computes the UTC datetime range that corresponds to a given IANA timezone.

ParamTypeDescription
timeZonestringAn IANA time zone identifier (e.g. "America/Los_Angeles").
startIsostringStarting date in ISO format.
endIsostringEnding date range in ISO format.

Interfaces

UtcRange

Properties

NameTypeDescription
wallClockDateThe current local datetime as it appears on the wall in the specified timezone.
startUtcDateUTC start date range (inclusive).
endUtcDateUTC end of date range (exclusive).
collectionKeysArrayArray of wildcard patterns to match UTC dates which correspond with date range (e.g. "20250624").