Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ModelService

The ModelService is the main entry point in Convergence for working with real time data models. Models can be created, opened, deleted, and managed from the ModelService.

Hierarchy

Index

Methods

addListener

create

  • Creates a new model according to the options provided.

    Parameters

    Returns Promise<string>

    A Promise that is resolved with the id of the created model.

events

  • Provides the events emitted by this object as an Observable stream.

    example
    
    eventEmitter.events()
      .filter(e => e.name === "myevent")
      .subscribe(e => console.log(e));

    Returns Observable<IConvergenceEvent>

    An Observable stream of all events emitted by this object.

history

  • Opens an existing model, by id, in history mode.

    Parameters

    • id: string

      The id of the model to open in history mode.

    Returns Promise<HistoricalModel>

    A Promise resolved with the HistoricalModel when opened.

isOpen

  • isOpen(id: string): boolean
  • Determines if a model with the specified id is opened.

    Parameters

    • id: string

      The id of the model to check.

    Returns boolean

    True if the model is open, false otherwise.

isOpening

  • isOpening(id: string): boolean
  • Determines if a model with the specified id is being opened.

    Parameters

    • id: string

      The id of the model to check.

    Returns boolean

    True if the model is opening, false otherwise.

off

on

once

  • Adds a single shot event listener for the specified event. The listener will be called the first time the specified event is fired after the event registration occurs, after which the registration will be removed and no further events will be passed to the listener.

    Parameters

    Returns ConvergenceEventEmitter<IConvergenceEvent>

    This object, in support of a fluent API.

open

  • Opens an existing model with a known model id. A model with the specified id must already exist in the system.

    Parameters

    • id: string

      The id of the model to open.

    Returns Promise<RealTimeModel>

    A promise that is resolved with the specified model, once open.

openAutoCreate

  • Opens a model, creating it if needed. If the model already exists, it will be opened. If the model does not exist it will be created first, and then opened.

    See here for more context about race conditions this alleviates.

    Parameters

    Returns Promise<RealTimeModel>

    A Promise resolved with the RealTimeModel, once opened.

permissions

  • Gets the permissions manager for a specific model, by id. The permissions manager will allow the caller to set the model permissions for the specified model.

    Parameters

    • id: string

      The id of an existing model to get the permissions manager for.

    Returns ModelPermissionManager

    A permissions manager for the specified model.

query

  • Searches for models using the Model Query Syntax.

    Parameters

    • query: string

      The query string to use to look up the model.

    Returns Promise<ModelResult[]>

    A promise that will be resolved with the query results.

remove

  • remove(id: string): Promise<void>
  • Removes an existing model by id.

    Parameters

    • id: string

      The id of the model to remove.

    Returns Promise<void>

    A Promise that is resolved when the model is successfuly removed.

removeAllListeners

removeListener

removeListeners

session