Class ImmutableTrait

The Immutable Trait is used to Stop properties of a schema vertex from being updated after being created. A check is made at the preUpdate Stage.

Usage:

traits:
- type: immutable
properties:
- email
- username

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
_type?: "immutable"

Trait type.

Methods

  • Takes the stored data and updated data and checks whether any changed properties are immutable Throws an error if an immutable property is changed

    Parameters

    • dataSourceWrapper: DataSourceWrapper

      dataSourceWrapper Object

    • data: TraitDataObject<unknown, Record<string, any>, Promise<any>>

      requires context for user permissions

    • item: any

      Contains variables used in query

    Returns Promise<void>

  • 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>

Generated using TypeDoc