Class ComputedTrait

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

Trait instance configuration.

_dataSourceWrapper: DataSourceWrapper
_global: boolean = false

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

_graphqlSchemaManager: GraphQLSchemaManager
_schemaManager: SchemaManager
_type?: "computed"

Trait type.

Methods

  • This method to compute the traversal

    Parameters

    • fieldConfig: undefined | ComputedFields<string>
    • data: Record<string, any>

    Returns string

  • This method to compute the traversal

    Parameters

    • fieldConfig: undefined | ComputedFields<string>
    • data: Record<string, any>
    • context: KosmosUserContext<object>

    Returns Promise<null | string | number | boolean>

  • This method is used to format traversal to a given type

    Parameters

    • type: string
    • query: TraitGraphQuery<any>
    • excludeFields: Record<string, any>

    Returns Promise<null | string | number | boolean>

  • This private method is used to map type to for query schema.

    Type Parameters

    • T extends keyof ReturnTypeMap

    Parameters

    • type: {
          type: keyof ReturnTypeMap;
      }[]

    Returns MapType<T>

  • 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

  • Helper function for updating vertex field.

    Parameters

    • context: KosmosUserContext<object>
    • id: string
    • fieldName: string
    • change: undefined | null | string | number | boolean

    Returns Promise<void>

Generated using TypeDoc