Skip to main content

abstractAOverlay <S, T>

@group

Overlays

Hierarchy

Implements

  • IOverlay<S, T>

Index

Properties

readonlyinheritedanchors

anchors: (MatchingAnchor<BaseAnchorSchema> | UnknownAnchor)[] = []

readonlyoverlayId

overlayId: S[overlayId]

readonlyproperties

properties: S[properties]

staticreadonlyinheritedNODE_NAME

NODE_NAME: string

The name of the node. All nodes with same name are of the same category.

staticreadonlyinheritedNODE_PACKAGE

NODE_PACKAGE: string

The package of the node.

staticreadonlyinheritedNODE_SCHEMA

NODE_SCHEMA: unknown

The schema of the node.

staticreadonlyinheritedNODE_TYPE

NODE_TYPE: NodeType

The type of the node.

Methods

addAnchor

  • To add an Anchor.

    Each node can store multiple anchors for reference. These anchors don't necessarily need to be parented by self, but must be unique, i.e. an anchor, identified by it's parent, cannot be added twice to self's list of anchors.


    Parameters

    Returns void

inheritedaddChild

  • addChild(onField: string | keyof T, child: UnknownNode, toField: string): { childToParentDependency: Dependency; parentToChildDependency: Dependency }
  • To add another node as a child of self.

    @throws

    NodeError If dependency relationship already exists!


    Parameters

    • onField: string | keyof T

      The field in self on which the dependency is being defined.

    • child: UnknownNode

      The child node.

    • toField: string

      The field in child on which the dependency is being defined.

    Returns { childToParentDependency: Dependency; parentToChildDependency: Dependency }

    • childToParentDependency: The dependency edge from child to self.
    • parentToChildDependency: The dependency edge from self to child.

inheritedaddFieldDependency

  • addFieldDependency(behaviors: { forAction: DiffAction; onAction: DiffAction; onField: string | keyof T; toField: string | keyof T }[]): void
  • To add a behavior on self to order multiple actions of self.


    Parameters

    • behaviors: { forAction: DiffAction; onAction: DiffAction; onField: string | keyof T; toField: string | keyof T }[]

    Returns void

inheritedaddRelationship

  • addRelationship(to: UnknownNode): { thisToThatDependency: Dependency }
  • To add another node as a sibling of self.


    Parameters

    • to: UnknownNode

      The sibling node.

    Returns { thisToThatDependency: Dependency }

    • thisToThatDependency: The dependency edge from self to sibling.

inheritedderiveDependencyField

  • deriveDependencyField(): undefined | string
  • Returns undefined | string

diff

  • diff(): Promise<Diff<UnknownNode, unknown>[]>
  • Returns Promise<Diff<UnknownNode, unknown>[]>

diffAnchors

  • diffAnchors(): Promise<Diff<UnknownNode, unknown>[]>
  • Returns Promise<Diff<UnknownNode, unknown>[]>

diffProperties

  • diffProperties(): Promise<Diff<UnknownNode, unknown>[]>
  • Returns Promise<Diff<UnknownNode, unknown>[]>

inheritedgetAncestors

  • getAncestors(): UnknownNode[]
  • To get all ancestors of self.

    • Includes parent nodes.
    • Might include sibling nodes, if the dependency behaviors dictate the sibling is necessary for self node to exist.

    Returns UnknownNode[]

getAnchor

  • getAnchor(anchorId: string, parent: UnknownModel): undefined | UnknownAnchor
  • To get an anchor with a given ID and parent.


    Parameters

    • anchorId: string

      The ID of the anchor.

    • parent: UnknownModel

      The parent of the anchor.

      • If parent is not given, then self is considered the parent of this anchor.

    Returns undefined | UnknownAnchor

getAnchorIndex

  • getAnchorIndex(anchorId: string, parent: UnknownModel): number
  • To get the index of an anchor with a given ID and parent.


    Parameters

    • anchorId: string

      The ID of the anchor.

    • parent: UnknownModel

      The parent of the anchor.

      • If parent is not given, then self is considered the parent of this anchor.

    Returns number

inheritedgetAnchors

  • To get all anchors, filtered by anchor properties.


    Parameters

    Returns UnknownAnchor[]

inheritedgetAnchorsMatchingSchema

  • getAnchorsMatchingSchema<S>(from: Constructable<S>, propertyFilters?: ObjectKeyValue<S[properties]>[], __namedParameters?: { searchBoundaryMembers?: boolean }): Promise<MatchingAnchor<S>[]>
  • Type parameters

    Parameters

    • from: Constructable<S>
    • propertyFilters: ObjectKeyValue<S[properties]>[] = []
    • __namedParameters: { searchBoundaryMembers?: boolean } = {}
      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingAnchor<S>[]>

inheritedgetBoundaryMembers

  • getBoundaryMembers(): UnknownNode[]
  • To get a boundary (sub graph) of self. A boundary is a group of nodes that must belong together. The boundary consists of all nodes associated with self, which includes parents, grand parents, children, grand children, and siblings.


    Returns UnknownNode[]

inheritedgetChild

  • getChild(name: string, filters?: { key: string; value: any }[]): undefined | UnknownNode
  • To get a child of self that matches the given filters.

    @throws

    NodeError If more than one child is found.


    Parameters

    • name: string

      The NODE_NAME of the child.

    • filters: { key: string; value: any }[] = []

      A set of filters, to be applied on children, where key is the property name and value is the value to filter by.

    Returns undefined | UnknownNode

inheritedgetChildren

  • getChildren(name?: string): {}
  • To get all children of self.


    Parameters

    • optionalname: string

      The NODE_NAME of the children.

    Returns {}

    All children as an object with the NODE_NAME as the key, and self's dependency to the child as the value.

inheritedgetContext

  • getContext(): string
  • To get the context of self. A context is a string representation of self that uniquely identifies self in the graph.


    Returns string

inheritedgetDependencies

  • To get all dependencies of self.

    • Can be filtered to just dependencies with a single node.

    Parameters

    • optionalto: UnknownNode

      The other node. If present, will only return dependencies of self with this node.

    Returns Dependency[]

inheritedgetDependency

  • To get a dependency of self with another node.


    Parameters

    • to: UnknownNode

      The other node.

    • relationship: DependencyRelationship

      The relationship between self and the other node.

    Returns undefined | Dependency

    The dependency with the other node having the given relationship, or undefined if not found.

inheritedgetDependencyIndex

  • To get the index of a dependency of self with another node.


    Parameters

    • to: UnknownNode

      The other node.

    • relationship: DependencyRelationship

      The relationship between self and the other node.

    Returns number

    The index of the dependency with the other node having the given relationship, or -1 if not found.

inheritedgetModelsMatchingSchema

  • getModelsMatchingSchema<S>(schema: Constructable<S>, filters?: ObjectKeyValue<S>[], __namedParameters?: { searchBoundaryMembers?: boolean }): Promise<MatchingModel<S>[]>
  • Type parameters

    • S: object

    Parameters

    • schema: Constructable<S>
    • filters: ObjectKeyValue<S>[] = []
    • __namedParameters: { searchBoundaryMembers?: boolean } = {}
      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingModel<S>[]>

inheritedgetOverlaysMatchingSchema

  • getOverlaysMatchingSchema<S>(schema: Constructable<S>, propertyFilters?: ObjectKeyValue<S[properties]>[], __namedParameters?: { searchBoundaryMembers?: boolean }): Promise<MatchingModel<S>[]>
  • Type parameters

    Parameters

    • schema: Constructable<S>
    • propertyFilters: ObjectKeyValue<S[properties]>[] = []
    • __namedParameters: { searchBoundaryMembers?: boolean } = {}
      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingModel<S>[]>

inheritedgetParents

  • getParents(name?: string): {}
  • To get all parent of self.


    Parameters

    • optionalname: string

      The NODE_NAME of the parent.

    Returns {}

    All parents as an object with the NODE_NAME as the key, and self's dependency to the parent as the value.

inheritedgetResourcesMatchingSchema

  • getResourcesMatchingSchema<S>(schema: Constructable<S>, propertyFilters?: ObjectKeyValue<S[properties]>[], responseFilters?: ObjectKeyValue<S[response]>[], __namedParameters?: { searchBoundaryMembers?: boolean }): Promise<MatchingResource<S>[]>
  • Type parameters

    Parameters

    • schema: Constructable<S>
    • propertyFilters: ObjectKeyValue<S[properties]>[] = []
    • responseFilters: ObjectKeyValue<S[response]>[] = []
    • __namedParameters: { searchBoundaryMembers?: boolean } = {}
      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingResource<S>[]>

inheritedgetSiblings

  • getSiblings(name?: string): {}
  • To get all siblings of self.


    Parameters

    • optionalname: string

      The NODE_NAME of the sibling.

    Returns {}

    All siblings as an object with the NODE_NAME as the key, and self's dependency to the sibling as the value.

inheritedhasAncestor

  • hasAncestor(node: UnknownNode): boolean
  • To check if given node is an ancestor of self.


    Parameters

    • node: UnknownNode

      The other node.

    Returns boolean

inheritedremoveAllAnchors

  • removeAllAnchors(): void
  • To remove all anchors from self.


    Returns void

removeAnchor

  • To remove an anchor from self.


    Parameters

    Returns void

inheritedremoveDependency

  • removeDependency(dependencyIndex: number): void
  • To remove a dependency from self.


    Parameters

    • dependencyIndex: number

      The index of the dependency to remove.

    Returns void

inheritedremoveRelationship

  • removeRelationship(node: UnknownNode): void
  • To remove ALL dependencies from self for the given node.


    Parameters

    • node: UnknownNode

      The other node.

    Returns void

setContext

  • setContext(): string
  • Returns string

synth

  • synth(): S
  • Returns S

inheritedtoJSON

  • toJSON(): S
  • Returns S

staticunSynth

  • unSynth(deserializationClass: any, overlay: BaseOverlaySchema, deReferenceContext: (context: string) => Promise<UnknownModel>): Promise<UnknownOverlay>
  • To create self given its serialized representation.

    • First argument is the serialized representation.
    • Second argument is the deReferenceContext() function to resolve other nodes self depends on.

    Parameters

    • deserializationClass: any
    • overlay: BaseOverlaySchema
    • deReferenceContext: (context: string) => Promise<UnknownModel>

      Returns Promise<UnknownOverlay>