Member Junction
    Preparing search index...

    FieldMapper is used to map fields from one name to another. This is useful when we need to map fields from one system to another, or when we need to map fields from one version of a system to another. Uses an internal field mapping but may be overridden or extended as needed.

    Index

    Constructors

    Methods

    • Maps a field name for GraphQL transport. Fields starting with __mj_ are transformed to _mj__ because GraphQL reserves the __ prefix.

      Parameters

      • fieldName: string

        The field name to map.

      Returns string

      The mapped field name, or the original field name if no mapping is needed.

    • Maps fields from one name to another mutating the object in place. Any field starting with __mj_ is renamed to _mj__ for GraphQL transport.

      Parameters

      • Optionalobj: Record<string, unknown>

        The object to mutate

      Returns Record<string, unknown>

    • Reverse-maps a GraphQL field name back to the database column name. Fields starting with _mj__ are transformed back to __mj_.

      Parameters

      • fieldName: string

        The field name to reverse-map.

      Returns string

      The original database field name.

    • Maps fields from one name to another mutating the object in place using the reverse mapping. Any field starting with _mj__ is renamed back to __mj_.

      Parameters

      • obj: Record<string, unknown>

        The object to mutate

      Returns Record<string, unknown>