varo@2.1.4
- 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.
| Param | Type | Default | Description |
|---|---|---|---|
| items | Array | Array 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 Key | Description |
|---|---|
| data | The 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.
| Param | Type | Default | Description |
|---|---|---|---|
| reports | Object | EMS-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.
| Param | Type | Description |
|---|---|---|
| messageContents | Array | Array of message content objects. |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | The 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.
| Param | Type | Description |
|---|---|---|
| key | string | A string key containing a UTC timestamp in the format YYYYMMDDTHHMMSS, following a colon (e.g. "prefix:20250624T101530"). |
| start | Date | The inclusive lower bound of the UTC datetime range. |
| end | Date | The 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.
| Param | Type | Description |
|---|---|---|
| timeZone | string | An IANA time zone identifier (e.g. "America/Los_Angeles"). |
| startIso | string | Starting date in ISO format. |
| endIso | string | Ending date range in ISO format. |
Interfaces
UtcRange
Properties
| Name | Type | Description |
|---|---|---|
| wallClock | Date | The current local datetime as it appears on the wall in the specified timezone. |
| startUtc | Date | UTC start date range (inclusive). |
| endUtc | Date | UTC end of date range (exclusive). |
| collectionKeys | Array | Array of wildcard patterns to match UTC dates which correspond with date range (e.g. "20250624"). |