A stream datum entity.

A stream datum is a datum without any metadata describing the datum property names. The instantantaneous, accumulating, and status property values are stored as the array fields iProps, aProps, and sProps. A DatumStreamMetadata object is required to associate names with these arrays.

Hierarchy

  • StreamDatum

Implements

Constructors

  • Constructor.

    Parameters

    • streamId: string

      the datum stream ID

    • ts: string | number | Date

      the datum timestamp, either as a Date instance or a form suitable for constructing as new Date(ts)

    • Optional iProps: number[]

      the instantaneous property values

    • Optional aProps: number[]

      the accumulating property values

    • Optional sProps: string[]

      the status property values

    • Optional tags: string[] | Iterable<string>

      the tag values

    • Optional meta: DatumStreamMetadata | DatumStreamMetadataRegistry

      optional metadata to attach, or a metadata registry to resolve metadata based on the given streamId

    Returns StreamDatum

Properties

aProps?: number[]

The accumulating property values.

iProps?: number[]

The instantaneous property values.

Attached metadata.

sProps?: string[]

The status property values.

streamId: string

The stream ID.

tags?: Set<string>

The tag values.

ts: Date

The timestamp.

Accessors

Methods

  • Get the property values for a given samples type.

    Parameters

    Returns undefined | string[] | number[] | Set<string>

    the property values for the given type, or undefined if none available

  • Get this object as an array suitable for encoding into a standard stream datum JSON string.

    This method can encode the datum into an array using one of two ways, depending on whether the registry argument is provided. When provided, the first array element will be the stream metadata index based on calling indexOfMetadataStreamId(). Otherwise the first array element will be the stream ID itself.

    For example if a registry is used, the resulting array might look like this:

    [0, 1650667326308, 12326, null, 230.19719, 50.19501, 6472722]
    

    while without a registry the array might look like this:

    ["7714f762-2361-4ec2-98ab-7e96807b32a6", 1650667326308, 12326, null, 230.19719, 50.19501, 6472722]
    

    Parameters

    Returns any[]

    the datum stream array object

  • Get this instance as a simple object.

    The following basic properties will be set on the returned object:

    • streamId - the stream ID
    • date - the timestamp
    • sourceId - the metadata source ID
    • nodeId or locationId - either the node ID or location ID from the metadata
    • tags - any tags (as an Array)

    Beyond that, all instantaneous, accumulating, and status properties will be included. If duplicate property names exist between the different classifications, the first-available value will be used.

    Parameters

    Returns undefined | Record<string, any>

    an object populated with all available properties

  • Create a new module:domain~StreamDatum StreamDatum instance from an array parsed from a stream datum JSON string.

    The array must have been parsed from JSON that was encoded the same way module:domain~StreamDatum#toJsonEncoding StreamDatum#toJsonEncoding() does.

    Parameters

    Returns undefined | StreamDatum

    the stream datum instance

Generated using TypeDoc