Class EntityManagerFactory

This base class provides an lock interface to execute exclusive operations

Hierarchy

Constructors

  • Creates a new EntityManagerFactory connected to the given destination

    Parameters

    • Optional options: string | {
          basePath?: string;
          host?: string;
          port?: number;
          schema?: JsonMap;
          secure?: boolean;
          staleness?: number;
          tokenStorage?: TokenStorage;
          tokenStorageFactory?: TokenStorageFactory;
      } = {}

      The destination to connect with, or an options object

    Returns EntityManagerFactory

Properties

[CONNECTED]?: (() => any)

Type declaration

    • (): any
    • Returns any

code: Code = ...
connectData: null | ConnectData = null
connection: null | Connector = null
metamodel: Metamodel = ...
staleness: null | number = null
tokenStorage: null | TokenStorage = null
tokenStorageFactory: TokenStorageFactory = ...

Accessors

  • get isReady(): boolean
  • Indicates if there is currently no exclusive operation executed true If no exclusive lock is hold

    Returns boolean

Methods

  • Apply additional configurations to this EntityManagerFactory

    Returns

    Parameters

    • options: {
          staleness?: number;
          tokenStorage?: TokenStorage;
          tokenStorageFactory?: TokenStorageFactory;
      }

      The additional configuration options

      • Optional staleness?: number

        The maximum staleness of objects that are acceptable while reading cached data, 0 to always bypass the browser cache

      • Optional tokenStorage?: TokenStorage

        The tokenStorage which should be used by this emf

      • Optional tokenStorageFactory?: TokenStorageFactory

        The tokenStorage factory implementation which should be used for token storage

    Returns void

  • Connects this EntityManager to the given destination

    Returns

    Parameters

    • hostOrApp: string

      The host or the app name to connect with

    • Optional secure: boolean

      true To use a secure connection

    • Optional basePath: string

      The base path of the api

    Returns Promise<EntityManagerFactory>

  • Connects this EntityManager to the given destination

    Returns

    Parameters

    • hostOrApp: string

      The host or the app name to connect with

    • Optional port: number

      The port to connect to

    • Optional secure: boolean

      true To use a secure connection

    • Optional basePath: string

      The base path of the api

    Returns Promise<EntityManagerFactory>

  • Create a new application-managed EntityManager.

    Returns

    a new entityManager

    Parameters

    • Optional useSharedTokenStorage: boolean

      The token storage to persist the authorization token, or true To use the shared token storage of the emf. false To use a instance based storage.

    Returns EntityManager

  • Creates a new Metamodel instance, which is not connected

    Returns

    A new Metamodel instance

    Returns Metamodel

  • Waits on the previously requested operation and calls the doneCallback if the operation is fulfilled

    Returns

    A promise which completes successfully, when the previously requested operation completes

    Parameters

    • Optional doneCallback: ((this: EntityManagerFactory) => any)

      The callback which will be invoked when the previously operations on this object is completed.

    • Optional failCallback: ((error: Error) => any)

      When the lock can't be released caused by a none recoverable error

        • (error: Error): any
        • Parameters

          • error: Error

          Returns any

    Returns Promise<EntityManagerFactory>

  • Protected

    Try to aquire an exclusive lock and executes the given callback.

    Returns

    A promise

    Throws

    If the lock can't be aquired

    Type Parameters

    • T

    Parameters

    • callback: (() => Promise<T>)

      The exclusive operation to execute

        • (): Promise<T>
        • Returns Promise<T>

    • Optional critical: boolean = false

      Indicates if the operation is critical. If the operation is critical and the operation fails, then the lock will not be released

    Returns Promise<T>

Generated using TypeDoc