Options
All
  • Public
  • Public/Protected
  • All
Menu

Object used in Condition, KeyCondition and Update resolver methods to create attribute names and values aliases and store the mappings for use in ExpressionAttributeNames and ExpressionAttributeValues params.

Hierarchy

  • ExpressionAttributes

Implements

Index

Constructors

Properties

isReservedName: (name: string) => boolean = ...

Type declaration

    • (name: string): boolean
    • Property function to determine if the name is a reserved word and should use an alias. For a current list of reserved words see DynamoDB-ReservedWords module in NPM. The reason to set isReservedName and isValidName is to allow the attribute names to be directly embedded into the expression string, which can make them easier to read.

      defaultvalue

      '() => false;' - To use aliases for all attribute names.

      Parameters

      • name: string

      Returns boolean

isValidName: (name: string) => boolean = ...

Type declaration

    • (name: string): boolean
    • Property function to determine if the name is valid to use without an alias. Can use ExpressionAttribute.isValidAttributeName. WARNING: Must be used with a proper isReservedName function to ensure reserved words are not used without an alias otherwise the operations will return an error.

      defaultvalue

      '() => false;' - To use aliases for all attribute names.

      Parameters

      • name: string

      Returns boolean

names: ExpressionAttributeNameMap = {}

Attribute names mapping, used to populate the ExpressionAttributeNames param.

nextName: number = 0

Auto incrementing name id used in names mapping.

defaultvalue

0

nextValue: number = 0

Auto incrementing value id used in values mapping.

defaultvalue

0

pathDelimiter: string = '.'

Delimiter to use for paths.

defaultvalue

'.' - Period is used in javascript for nested objects.

treatNameAsPath: boolean = true

Parse all names into paths by using the pathDelimiter, to make working with nested attributes easy.

defaultvalue

true - Since most all names won't contain pathDelimiter then just do this by default.

Attribute values mapping, used to populate the ExpressionAttributeValues param.

validAttributeNameRegEx: RegExp = ...

RegEx that validates an attribute name would not need to use an alias.

Methods

  • addPath(name: string): string
  • Parse an attribute path and adds the names to the names mapping as needed and hands back an alias to use in an expression. If the name already exists in the map the existing alias will be used. When this.treatNameAsPath is true the name argument will be parsed as a path and will handle arrays embedded in the path correctly, to allow access to all deep attribute.

    Parameters

    • name: string

      Attribute path that can be delimited by a pathDelimiter and contain array notations '[]'.

    Returns string

    Alias path to use for the attribute name or the name if not aliasing is needed, delimited by '.'.

  • getPaths(): void | ExpressionAttributeNameMap
  • isValidAttributeName(name: string): boolean
  • Validates that an attribute name can be used without an alias.

    Parameters

    • name: string

      Name of an attribute.

    Returns boolean

    true if the attribute name is valid.

Generated using TypeDoc