Options
All
  • Public
  • Public/Protected
  • All
Menu

A collection of helper functions related to event processing, including:

  • directory management
  • event type determination
  • subscription creation and setting callbacks
  • event writing

Hierarchy

  • EventUtils

Index

Methods

Static createEvent

  • createEvent(eventName: string, appName: string): Event
  • Create an event with minimal information

    internal

    This is not intended for application developers

    throws

    {ImperativeError} If the application name is not recognized.

    throws

    {ImperativeError} If we are unable to create the '.events' directory.

    throws

    {ImperativeError} If we are unable to create the event file required for event emission.

    Parameters

    • eventName: string

      The name of the event.

    • appName: string

      The name of the application.

    Returns Event

    The created event

Static createSubscription

  • Creates and registers a new event subscription for a specific event processor.

    throws

    {ImperativeError} If the application name is not recognized.

    throws

    {ImperativeError} If we are unable to create the '.events' directory.

    throws

    {ImperativeError} If we are unable to create the event file required for event emission.

    Parameters

    • eeInst: EventProcessor

      The event processor instance.

    • eventName: string

      The name of the event.

    • eventType: EventTypes

      The type of event.

    Returns IEventDisposable

    An interface for managing the subscription.

Static ensureEventsDirExists

  • ensureEventsDirExists(directoryPath: string): void
  • Ensures that the specified directory for storing event files exists, creating it if necessary.

    throws

    {ImperativeError} If we are unable to create the '.events' directory.

    Parameters

    • directoryPath: string

      The path to the directory.

    Returns void

Static ensureFileExists

  • ensureFileExists(filePath: string): void
  • Ensures that the specified file path for storing event data exists, creating it if necessary.

    throws

    {ImperativeError} If we are unable to create the event file required for event emission.

    Parameters

    • filePath: string

      The path to the file.

    Returns void

Static getEventContents

  • getEventContents(eventFilePath: string): IEventJson
  • Retrieve the event contents form disk

    internal

    This is not intended for application developers

    throws

    {ImperativeError} If the contents of the event cannot be retrieved.

    Parameters

    • eventFilePath: string

      The path to the event file

    Returns IEventJson

    The object representing the Event

Static getEventDir

  • getEventDir(appName: string): string
  • Determines the directory path for storing event files based on the event type and application name.

    throws

    {ImperativeError} If the application name is not recognized.

    Parameters

    • appName: string

      The name of the application.

    Returns string

    The directory path.

Static getListOfApps

  • getListOfApps(): string[]
  • Retrieves a list of supported applications from configuration.

    static
    throws

    If the extenders.json file cannot be created when it does not exist.

    throws

    If the extenders.json file cannot be read.

    Returns string[]

    List of application names.

Static isSharedEvent

  • isSharedEvent(eventName: string): boolean
  • Determines if the specified event name is associated with a shared event.

    Parameters

    • eventName: string

      The name of the event.

    Returns boolean

    True if it is a shared event, otherwise false.

Static isUserEvent

  • isUserEvent(eventName: string): boolean
  • Determines if the specified event name is associated with a user event.

    Parameters

    • eventName: string

      The name of the event.

    Returns boolean

    True if it is a user event, otherwise false.

Static setupWatcher

  • Sets up a file watcher for a specific event, triggering callbacks when the event file is updated.

    throws

    {ImperativeError} If the event to be watched does not have an existing file to watch.

    throws

    {ImperativeError} Callbacks will fail if the contents of the event cannot be retrieved.

    Parameters

    Returns FSWatcher

    A file system watcher.

Static validateAppName

  • validateAppName(appName: string): void
  • Won't throw an error if user entered a valid appName

    static
    throws

    {ImperativeError} If the application name is not recognized.

    Parameters

    • appName: string

      The name of the application.

    Returns void

Static writeEvent

  • writeEvent(event: Event): void

Generated using TypeDoc