import { ExpressionAttributeNameMap } from 'aws-sdk/clients/dynamodb'; import { Table } from './Table'; /** * 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. * @public */ export declare class ExpressionAttributes implements Table.ExpressionAttributes { /** * RegEx that validates an attribute name would not need to use an alias. */ static validAttributeNameRegEx: RegExp; /** * Validates that an attribute name can be used without an alias. * @param name - Name of an attribute. * @returns true if the attribute name is valid. */ static isValidAttributeName(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. */ isReservedName: (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. */ isValidName: (name: string) => boolean; /** * 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. */ treatNameAsPath: boolean; /** * Delimiter to use for paths. * @defaultValue '.' - Period is used in javascript for nested objects. */ pathDelimiter: string; /** * Attribute names mapping, used to populate the ExpressionAttributeNames param. */ names: ExpressionAttributeNameMap; /** * Auto incrementing name id used in names mapping. * @defaultValue 0 */ nextName: number; /** * Attribute values mapping, used to populate the ExpressionAttributeValues param. */ values: Table.AttributeValuesMap; /** * Auto incrementing value id used in values mapping. * @defaultValue 0 */ nextValue: number; /** * 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. * @param name - Attribute path that can be delimited by a pathDelimiter and contain array notations '[]'. * @returns Alias path to use for the attribute name or the name if not aliasing is needed, delimited by '.'. */ addPath(name: string): string; /** * Adds the value to the values map and hands back an alias to use in ab expression. * A new alias will always be created every time addValue is called. * @param value - Value to add to the values map. * @returns Alias to use in place of the value. */ addValue(value: Table.AttributeValues): string; /** * Gets the names map to assign to ExpressionAttributeNames. * @returns The map of all names added. */ getPaths(): ExpressionAttributeNameMap | void; /** * Gets the values map to assign to ExpressionAttributeValues. * @returns The map of all values added. */ getValues(): Table.AttributeValuesMap | void; /** * Helper method to set ExpressionAttributeNames and ExpressionAttributeValues values on the input argument. * @param params - Input params used for DocumentClient put, delete, update, query and scan methods. * @returns The input params argument passed in. */ static addParams(params: Table.ExpressionAttributeParams, attributes: Table.ExpressionAttributes): void; /** * Private method to add an attribute name to the names mapping if needed and hand back an alias to use in * an expression. * @param name - Attribute name. * @returns Alias to use for the attribute name or the name if not aliasing is needed. */ private addName; }