Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

  • ServiceListener
  • ServiceEmitter
  • ServiceListener
  • ServiceEmitter

Index

Constructors

constructor

  • new FrontService(data: FrontConstructor, listen?: boolean): FrontService

Properties

Private data

data: FrontConstructor

Private session

session: Front

Protected workers

workers: WorkerMap<string | null> = new Map<T, Worker<T>>()

Static Private _serviceName

_serviceName: string = path.basename(__filename.split('.')[0])

Static Protected logger

logger: Logger = new Logger()

A place to put output for debug and reference.

Accessors

apiHandle

  • get apiHandle(): FrontHandle

serviceName

  • get serviceName(): string

Static Protected expressApp

  • get expressApp(): express.Express

Methods

Protected activateMessageListener

  • activateMessageListener(): void

fetchNotes

  • fetchNotes(thread: string, _room: string, filter: RegExp): Promise<string[]>
  • Promise to find the comment history of a particular thread.

    Parameters

    • thread: string

      id of the thread to search.

    • _room: string

      id of the room in which the thread resides.

    • filter: RegExp

      Criteria to match.

    Returns Promise<string[]>

Private fetchUserId

  • fetchUserId(username: string): Promise<string | undefined>
  • Find the ID of a user specified by username.

    Parameters

    • username: string

      Target username to search for.

    Returns Promise<string | undefined>

    Promise that resolves to the user id.

Private findConversation

  • findConversation(subject: string, attemptsLeft?: number): Promise<string>
  • Attempt to find a recent conversation ID from it's subject line. Done by subject because the conversation_reference provided is sometimes junk.

    Parameters

    • subject: string

      Target subject line to search for.

    • Default value attemptsLeft: number = 10

      Since conversations take time to propagate this method may recurse.

    Returns Promise<string>

    Promise that resolves to the ID of the conversation.

Protected getWorker

Protected handleEvent

listen

  • listen(): void

makeGeneric

  • Promise to turn the data enqueued into a generic message format.

    Parameters

    • data: ServiceEvent

      Raw data from the enqueue, remembering this is as dumb and quick as possible.

    Returns Promise<ReceiptContext>

    A promise that resolves to the generic form of the event.

makeSpecific

  • Promise to turn the generic message format into a specific form to be emitted.

    Parameters

    Returns Promise<FrontEmitContext>

    Promise that resolves to the emit suitable form.

makeTagUpdate

  • Promise to turn the generic message format into a tag update to be emitted.

    Parameters

    Returns Promise<FrontEmitContext>

    Promise that resolves to the tag update object.

queueEvent

registerEvent

  • registerEvent(registration: ServiceRegistration): void
  • Store an event of interest, so that the method gets triggered appropriately.

    Parameters

    • registration: ServiceRegistration

      Registration object with event trigger and other details.

    Returns void

Protected removeWorker

  • removeWorker(context: string | null): void

sendData

Protected sendPayload

  • Deliver the payload to the service. Sourcing the relevant context has already been performed.

    Parameters

    • data: FrontEmitContext

      The object to be delivered to the service.

    Returns Promise<MessengerEmitResponse>

    Response from the service endpoint.

translateEventName

  • translateEventName(eventType: string): string
  • Turns the generic, messenger, name for an event into a specific trigger name for this class.

    Parameters

    • eventType: string

      Name of the event to translate, eg 'message'.

    Returns string

    This class's equivalent, eg 'post'.

Static Protected extractMetadata

  • extractMetadata(message: string, format: string): Metadata
  • Given a basic string this will extract a more rich context for the event, if embedded.

    Parameters

    • message: string

      Basic string that may contain metadata.

    • format: string

      Format of the metadata encoding.

    Returns Metadata

    Object of content, genesis and hidden.

Static Protected getIndicatorArrays

  • getIndicatorArrays(): object

Static initInterimContext

Static Protected messageOfTheDay

  • messageOfTheDay(): string

Static Protected stringifyMetadata

Generated using TypeDoc