Class AncestorTrait

The base Trait class.

Any core Kosmos or custom application traits must inherit this class and must declare it's own configuration type extending TraitConfigBase interface.

Hierarchy

Constructors

Properties

_additionalProperties: Record<string, ScalarTypes> = {}

Trait instance configuration.

_dataSourceWrapper: DataSourceWrapper
_depth: number = MAX_DEPTH
_global: boolean = false

Whether this is a global (not bound to any specific schema item) trait instance.

_graphqlSchemaManager: GraphQLSchemaManager
_parents: ParentItem[] = []
_schemaManager: SchemaManager
_type?: "ancestor"

Trait type.

Methods

  • This functions returns the hierarchy of ancestors for a given vertex.

    Returns

    The hierarchy array of ancestors.

    Parameters

    • datasourceWrapper: DataSourceWrapper
    • context: KosmosUserContext<object>

      The user context

    • entityId: string

      The id of the current vertex

    • maxDepth: number
    • edge: undefined | string
    • direction: undefined | ParentDirection

    Returns Promise<Record<string, any>>

  • This method is triggered when a trait callback has been activated

    Type Parameters

    • RT = any

    • Payload = any

    Parameters

    • callbackName: string

      This is the name of the callback function to call.

    • datasourceWrapper: DataSourceWrapper

      References to the Graph Hanlder

    • data: TraitDataObject<RT, Payload, Promise<any>>

      Request data passed along as part of the request.

    Returns Promise<RT>

  • This method is used to hook in the field change to the vertex that the AncestorTrait has been attached to.

    Returns

    Parameters

    • Rest ...__namedParameters: [schemaString: string, source: string]

    Returns string

Generated using TypeDoc