Options
All
  • Public
  • Public/Protected
  • All
Menu

An abstract subclass of the Collection container which defines a collection of Document instances.

abstract
param data

An array of data objects from which to create document instances

Hierarchy

Index

Constructors

Properties

apps: Application[]

An Array of application references which will be automatically updated when the collection content changes

invalidDocumentIds: Set<string> = ...

Record the set of document ids where the Document was not initialized because of invalid source data

documentName: string

The base Document type which is contained within this DocumentCollection

Accessors

  • get documentClass(): Function
  • A reference to the Document class definition which is contained within this DocumentCollection.

    Returns Function

  • get documentName(): any
  • inheritdoc

    Returns any

  • get name(): string
  • The Collection class name

    Returns string

Methods

  • getInvalid(id: string): Document
  • Obtain a temporary Document instance for a document id which currently has invalid source data.

    Parameters

    • id: string

      A document ID with invalid source data.

    Returns Document

    An in-memory instance for the invalid Document

  • set(id: any, document: any): void
  • inheritdoc

    Parameters

    • id: any
    • document: any

    Returns void

  • delete(id: any): void
  • inheritdoc

    Parameters

    • id: any

    Returns void

  • render(force: any, options: any): void
  • Render any Applications associated with this DocumentCollection.

    Parameters

    • force: any
    • options: any

    Returns void

  • updateAll(transformation: any, condition?: Function, options?: any): Promise<Document[]>
  • Update all objects in this DocumentCollection with a provided transformation. Conditionally filter to only apply to Entities which match a certain condition.

    Parameters

    • transformation: any

      An object of data or function to apply to all matched objects

    • condition: Function = null

      A function which tests whether to target each object

    • options: any = {}

    Returns Promise<Document[]>

    An array of updated data once the operation is complete

  • _preCreateDocuments(result: any[], options: any, userId: string): void
  • Preliminary actions taken before a set of Documents in this Collection are created.

    Parameters

    • result: any[]

      An Array of created data objects

    • options: any

      Options which modified the creation operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onCreateDocuments(documents: Document[], result: any[], options: any, userId: string): void
  • Follow-up actions taken after a set of Documents in this Collection are created.

    Parameters

    • documents: Document[]

      An Array of created Documents

    • result: any[]

      An Array of created data objects

    • options: any

      Options which modified the creation operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _preUpdateDocuments(result: any[], options: any, userId: string): void
  • Preliminary actions taken before a set of Documents in this Collection are updated.

    Parameters

    • result: any[]

      An Array of incremental data objects

    • options: any

      Options which modified the update operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onUpdateDocuments(documents: Document[], result: any[], options: any, userId: string): void
  • Follow-up actions taken after a set of Documents in this Collection are updated.

    Parameters

    • documents: Document[]

      An Array of updated Documents

    • result: any[]

      An Array of incremental data objects

    • options: any

      Options which modified the update operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _preDeleteDocuments(result: string[], options: any, userId: string): void
  • Preliminary actions taken before a set of Documents in this Collection are deleted.

    Parameters

    • result: string[]

      An Array of document IDs being deleted

    • options: any

      Options which modified the deletion operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onDeleteDocuments(documents: Document[], result: string[], options: any, userId: string): void
  • Follow-up actions taken after a set of Documents in this Collection are deleted.

    Parameters

    • documents: Document[]

      An Array of deleted Documents

    • result: string[]

      An Array of document IDs being deleted

    • options: any

      Options which modified the deletion operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _initialize(): void
  • Initialize the DocumentCollection by constructing any initially provided Document instances

    Returns void

  • _getRenderContext(action: string, documents: Document[], data: any[] | string[]): { action: string; documentType: string; documents: Document[]; data: any[] | string[] }
  • Generate the render context information provided for CRUD operations.

    Parameters

    • action: string

      The CRUD operation.

    • documents: Document[]

      The documents being operated on.

    • data: any[] | string[]

      An array of creation or update objects, or an array of document IDs, depending on the operation.

    Returns { action: string; documentType: string; documents: Document[]; data: any[] | string[] }

    • action: string
    • documentType: string
    • documents: Document[]
    • data: any[] | string[]