UNPKG

arrow-store

Version:
37 lines (36 loc) 2.05 kB
import { ParserNode } from "../parser/nodes"; import { AttributeValue } from "aws-sdk/clients/dynamodb"; import { DYNAMODB_ATTRIBUTE_TYPE, DynamoDBAttributeSchema } from "../mappers/schemaBuilders"; export declare type ExpressionAttribute = { accessor: string; schema: DynamoDBAttributeSchema; }; export declare type TraversalContext = { stack: string[]; contextParameters: any | undefined; rootParameterName?: string; contextParameterName?: string; recordSchema: ReadonlyMap<string, DynamoDBAttributeSchema>; attributeNames: Map<string, string>; attributeNameAliases: Map<string, ExpressionAttribute>; attributeValues: Map<string, AttributeValue>; attributeValueAliases: Map<string, string>; }; export declare type ObjectAccessorValue = { isRecordAccessor: boolean; value: string | null; }; export declare type ExpressionTransformer = { transform(recordSchema: ReadonlyMap<string, DynamoDBAttributeSchema>, expression: ParserNode, context?: any): string; }; export declare abstract class ExpressionTransformerBase implements ExpressionTransformer { private readonly _attributeNamePrefix; private readonly _attributePathSchema; protected constructor(attributeNamePrefix: string, attributePathSchema: Map<string, DynamoDBAttributeSchema>); abstract transform(recordSchema: ReadonlyMap<string, DynamoDBAttributeSchema>, expression: ParserNode, context?: any): string; protected getOrSetAttributeReference(expression: ParserNode, context: TraversalContext): ObjectAccessorValue; protected getAttributeTypeByPath(attributePath: string | null, context: TraversalContext): DYNAMODB_ATTRIBUTE_TYPE; protected getOrSetAttributeValue(accessorValue: ObjectAccessorValue, attributeType: DYNAMODB_ATTRIBUTE_TYPE, context: TraversalContext): string; protected getOrSetAttributePath(memberPath: string, context: TraversalContext): string | null; protected evaluateContextValue(accessors: string[], contextParameters: any): string; }