Type Alias OverrideCollectionInterface<T, S>

OverrideCollectionInterface<T, S>: {
    [isOverrideCollection]: boolean;
    getSerializedByKey: ((key: string) => S | undefined);
    override: ((item: T) => T | null);
    parseItems: ((items: (S & {
        type?: string;
    })[] | undefined, moduleId: string) => Promise<void>);
    removeModule: ((moduleId: string) => void);
    replace: ((item: T) => T | null);
    replaced: VcsEvent<ReplacedEvent<T>>;
    serializeModule: ((moduleId: string) => object[]);
    shadowMap: Map<string, (S & {
        [moduleIdSymbol]?: string;
    })[]>;
    uniqueKey: keyof T;
}

The override collection adds the ability to override a unique item and re-creating it, should the override be removed. This does change some flow of called events. 1) if you override an item, removed is not called for the removed current item. 2) replaced is called for items which where replaced. 3) added can be called more the once for the same unique id. Replaced is called before added has been called for the item.

Type Parameters

  • T
  • S

Type declaration

  • [isOverrideCollection]: boolean
  • getSerializedByKey: ((key: string) => S | undefined)
      • (key): S | undefined
      • Parameters

        • key: string

        Returns S | undefined

  • override: ((item: T) => T | null)

    returns the overriden item or null if the item could not be inserted (this would be the result of a race condition)

      • (item): T | null
      • Parameters

        • item: T

        Returns T | null

  • parseItems: ((items: (S & {
        type?: string;
    })[] | undefined, moduleId: string) => Promise<void>)
      • (items, moduleId): Promise<void>
      • Parameters

        • items: (S & {
              type?: string;
          })[] | undefined
        • moduleId: string

        Returns Promise<void>

  • removeModule: ((moduleId: string) => void)
      • (moduleId): void
      • Parameters

        • moduleId: string

        Returns void

  • replace: ((item: T) => T | null)

    Replacement is only supported for items of the dynamic module. For other items you may use override instead. Returns the replaced item or null if the item could not be inserted

      • (item): T | null
      • Parameters

        • item: T

        Returns T | null

  • replaced: VcsEvent<ReplacedEvent<T>>

    replaced is called before added

  • serializeModule: ((moduleId: string) => object[])
      • (moduleId): object[]
      • Parameters

        • moduleId: string

        Returns object[]

  • shadowMap: Map<string, (S & {
        [moduleIdSymbol]?: string;
    })[]>
  • uniqueKey: keyof T