Class default

Constructors

  • Create a new TaskBase instance - Usually not called directly but instead inherited via an extends TaskBase call

    Currently settings are configured based on the environment that will be provided by the ETL server. As such the following environment variables must be set. ETL_API - The URL of the API to use ETL_LAYER - The Integer Layer ID to get config information and post results to ETL_TOKEN - The access token specific to the Layer

    Parameters

    • Optionalcurrent: string

    Returns default

Properties

layer?: {
    connection: number;
    created: string;
    description: string;
    enabled: boolean;
    id: number;
    incoming?: {
        config: { timezone?: { timezone: string } };
        created: string;
        cron: string;
        data: null | number;
        enabled_styles: boolean;
        environment: { [key: string]: unknown };
        ephemeral: { [key: string]: string };
        stale: number;
        styles: unknown;
        updated: string;
        webhooks: boolean;
    };
    logging: boolean;
    memory: number;
    name: string;
    task: string;
    timeout: number;
    updated: string;
}
flow: DataFlowType[] = ...
invocation: InvocationType[] = ...
name: string = 'default'
version: string = ...
webhooks?: (schema: Schemas, context: default) => void

Methods

  • Post an Alert to the Layer Alert API

    Parameters

    Returns Promise<object>

    The Response from the Layer Alert API

  • Returns Promise<
        {
            incoming?: {
                invocation: InvocationType[];
                schema: { input: unknown; output: unknown };
            };
            name: string;
            outgoing?: { schema: { input: unknown; output: unknown } };
            version: string;
        },
    >

  • Returns Promise<void>

  • Validate and provide a validated Environment object

    Type Parameters

    • T extends TSchema = TUnknown

    Parameters

    • type: T

    Returns Promise<Static<T>>

  • Provides a Fetch class with preset Authentication and JSON parsing For making calls to CloudTAK APIs

    Parameters

    • url: string | URL
    • Optionalopts: RequestInit

    Returns Promise<object>

    The parsed response body

  • Get all information about the layer being processed most importantly the user-defined environment object

    Returns Promise<
        {
            connection: number;
            created: string;
            description: string;
            enabled: boolean;
            id: number;
            incoming?: {
                config: { timezone?: { timezone: string } };
                created: string;
                cron: string;
                data: null | number;
                enabled_styles: boolean;
                environment: { [key: string]: unknown };
                ephemeral: { [key: string]: string };
                stale: number;
                styles: unknown;
                updated: string;
                webhooks: boolean;
            };
            logging: boolean;
            memory: number;
            name: string;
            task: string;
            timeout: number;
            updated: string;
        },
    >

    A Layer Config Object

  • Parameters

    • event: SQSEvent

    Returns Promise<boolean>

  • The extended class should override this function if it needs additional user-defined config values or wants to provide a Schema

    Input: By default it simply adds a DEBUG boolean which will conditionally print CoT GeoJSON in the logs if true.

    Output: Does not provide a defined schema. Providing a schema allow the User to perform mapping and styling operations

    Parameters

    Returns Promise<TSchema>

    A JSON Schema Object

  • Set ephemeral key/values Overwrites existing values, if any

    Parameters

    • ephem: Record<string, string>

    Returns Promise<void>

    A Layer Config Object

  • Submit a GeoJSON Feature collection to be submitted to the TAK Server as CoTs

    Parameters

    • fc: {
          features: {
              geometry:
                  | { coordinates: number[][][]; type: "Polygon" }
                  | { coordinates: number[]; type: "Point" }
                  | { coordinates: number[][]; type: "LineString" };
              id?: string;
              path?: string;
              properties: {
                  ackrequest?: { ackrequested: boolean; tag: string; uid: string };
                  archived?: boolean;
                  attachments?: string[];
                  callsign?: string;
                  center?: number[];
                  chat?: {
                      chatgrp: any;
                      chatroom: string;
                      groupOwner?: string;
                      id: string;
                      messageId?: string;
                      parent?: string;
                      senderCallsign: string;
                  };
                  contact?: {
                      callsign?: string;
                      endpoint?: string;
                      name?: string;
                      phone?: string;
                  };
                  course?: number;
                  dest?: | {
                      after?: string;
                      callsign?: string;
                      mission?: string;
                      "mission-guid"?: string;
                      path?: string;
                      uid?: string;
                  }
                  | {
                      after?: string;
                      callsign?: string;
                      mission?: string;
                      "mission-guid"?: string;
                      path?: string;
                      uid?: string;
                  }[];
                  droid?: string;
                  fileshare?: {
                      filename: string;
                      name: string;
                      senderCallsign: string;
                      senderUid: string;
                      senderUrl: string;
                      sha256: string;
                      sizeInBytes: number;
                  };
                  fill?: string;
                  "fill-opacity"?: number;
                  flow?: { [key: string]: string };
                  geofence?: {
                      boundingSphere?: number;
                      elevationMonitored?: string;
                      maxElevation?: string;
                      minElevation?: string;
                      monitor?: string;
                      tracking?: string;
                      trigger?: string;
                  };
                  group?: { name: string; role: string };
                  how?: string;
                  icon?: string;
                  links?: {
                      mime?: string;
                      parent_callsign?: string;
                      point?: string;
                      production_time?: string;
                      relation?: string;
                      remarks?: string;
                      type?: string;
                      uid?: string;
                      url?: string;
                  }[];
                  "marker-color"?: string;
                  "marker-opacity"?: number;
                  metadata?: { [key: string]: unknown };
                  mission?: {
                      authorUid?: string;
                      guid?: string;
                      missionChanges?: {
                          contentUid: string;
                          creatorUid: string;
                          details: {
                              callsign: string;
                              color: string;
                              lat: string;
                              lon: string;
                              type: string;
                          };
                          isFederatedChange: string;
                          missionName: string;
                          timestamp: string;
                          type: string;
                      }[];
                      missionLayer?: {
                          name?: string;
                          parentUid?: string;
                          type?: string;
                          uid?: string;
                      };
                      name?: string;
                      tool?: string;
                      type?: string;
                  };
                  precisionlocation?: { altsrc?: string; geopointsrc?: string };
                  remarks?: string;
                  sensor?: {
                      azimuth?: number;
                      displayMagneticReference?: number;
                      elevation?: number;
                      fov?: number;
                      fovAlpha?: number;
                      fovBlue?: number;
                      fovGreen?: number;
                      fovRed?: number;
                      hideFov?: boolean;
                      model?: string;
                      north?: number;
                      range?: number;
                      rangeLines?: number;
                      rangeLineStrokeColor?: number;
                      rangeLineStrokeWeight?: number;
                      roll?: number;
                      strokeColor?: number;
                      strokeWeight?: number;
                      type?: string;
                      version?: string;
                      vfov?: number;
                  };
                  shape?: { ellipse?: { angle: number; major: number; minor: number } };
                  slope?: number;
                  speed?: number;
                  stale?: string | number;
                  start?: string;
                  status?: { battery?: string; readiness?: string };
                  stroke?: string;
                  "stroke-opacity"?: number;
                  "stroke-style"?: string;
                  "stroke-width"?: number;
                  takv?: {
                      device?: string;
                      os?: string;
                      platform?: string;
                      version?: string;
                  };
                  time?: string;
                  track?: {
                      course?: string;
                      eCourse?: string;
                      eSlope?: string;
                      eSpeed?: string;
                      slope?: string;
                      speed?: string;
                  };
                  type?: string;
                  video?: {
                      connection?: {
                          address: string;
                          alias?: string;
                          bufferTime?: number;
                          ignoreEmbeddedKLV?: boolean;
                          networkTimeout?: number;
                          path?: string;
                          port?: number;
                          protocol?: string;
                          roverPort?: number;
                          rtspReliable?: number;
                          uid: string;
                      };
                      sensor?: string;
                      spi?: string;
                      uid?: string;
                      url?: string;
                  };
              };
              type: string;
          }[];
          type: "FeatureCollection";
      }

    Returns Promise<boolean>

    A boolean representing the success state

  • Arbitrary JSON objects occasionally need to get typed as part of an ETL This function provides the ability to strictly type unknown objects at runtime

    Type Parameters

    • T extends TSchema = TUnknown

    Parameters

    • type: T
    • body: unknown

    Returns Static<T>