Options
All
  • Public
  • Public/Protected
  • All
Menu

@aws/dynamodb-data-marshaller

Index

Type aliases

KeyType

KeyType: keyof object

A type of DynamoDB key.

ScalarAttributeType

ScalarAttributeType: "S" | "N" | "B"

SchemaType

A node in a Schema used by this marshaller package.

TypeTag

TypeTag: keyof object

A type understood by this marshaller package.

Functions

getSchemaName

  • getSchemaName(propertyName: string, schema: Schema): string

isKey

  • isKey(fieldSchema: SchemaType, indexName?: undefined | string): boolean
  • Parameters

    • fieldSchema: SchemaType
    • Optional indexName: undefined | string

    Returns boolean

isSchema

  • isSchema(arg: any): boolean
  • Evaluates whether the provided argument is a Schema object

    Parameters

    • arg: any

    Returns boolean

isSchemaType

  • isSchemaType(arg: any, alreadyVisited?: Set<any>): boolean
  • Parameters

    • arg: any
    • Default value alreadyVisited: Set<any> = new Set()

    Returns boolean

keysFromSchema

marshallConditionExpression

  • marshallConditionExpression(expression: ConditionExpression, schema: Schema, attributes?: ExpressionAttributes): MarshalledExpression
  • Serialize a condition expression, substituting any property names for the corresponding attribute names in the provided schema.

    Parameters

    • expression: ConditionExpression

      The expression object to marshall.

    • schema: Schema

      The schema of the table to which the expression pertains.

    • Default value attributes: ExpressionAttributes = new ExpressionAttributes

      An optional ExpressionAttributes object to synchronize substitutions across multiple expressions.

    Returns MarshalledExpression

marshallFunctionExpression

  • marshallFunctionExpression(expression: FunctionExpression, schema: Schema, attributes?: ExpressionAttributes): MarshalledExpression
  • Serialize a function expression, substituting any property names for the corresponding attribute names in the provided schema.

    Parameters

    • expression: FunctionExpression

      The expression object to marshall.

    • schema: Schema

      The schema of the table to which the expression pertains.

    • Default value attributes: ExpressionAttributes = new ExpressionAttributes

      An optional ExpressionAttributes object to synchronize substitutions across multiple expressions.

    Returns MarshalledExpression

marshallItem

  • marshallItem(schema: Schema, input: object): AttributeMap
  • Converts a JavaScript object into a DynamoDB Item.

    Parameters

    • schema: Schema

      Metadata explaining how the provided input is to be marshalled

    • input: object

      JavaScript object to convert

      • [key: string]: any

    Returns AttributeMap

marshallKey

  • marshallKey(schema: Schema, input: object, indexName?: undefined | string): AttributeMap
  • Parameters

    • schema: Schema
    • input: object
      • [key: string]: any
    • Optional indexName: undefined | string

    Returns AttributeMap

marshallMathematicalExpression

  • marshallMathematicalExpression(expression: MathematicalExpression, schema: Schema, attributes?: ExpressionAttributes): MarshalledExpression
  • Serialize a mathematical expression, substituting any property names for the corresponding attribute names in the provided schema.

    Parameters

    • expression: MathematicalExpression

      The expression object to marshall.

    • schema: Schema

      The schema of the table to which the expression pertains.

    • Default value attributes: ExpressionAttributes = new ExpressionAttributes

      An optional ExpressionAttributes object to synchronize substitutions across multiple expressions.

    Returns MarshalledExpression

marshallProjectionExpression

  • marshallProjectionExpression(expression: ProjectionExpression, schema: Schema, attributes?: ExpressionAttributes): MarshalledExpression
  • Serialize a projection expression, substituting any property names for the corresponding attribute names in the provided schema.

    Parameters

    • expression: ProjectionExpression

      The expression object to marshall.

    • schema: Schema

      The schema of the table to which the expression pertains.

    • Default value attributes: ExpressionAttributes = new ExpressionAttributes

      An optional ExpressionAttributes object to synchronize substitutions across multiple expressions.

    Returns MarshalledExpression

marshallUpdateExpression

  • Serialize an update expression, substituting any property names for the corresponding attribute names in the provided schema.

    Parameters

    • expression: UpdateExpression

      The expression object to marshall.

    • schema: Schema

      The schema of the table to which the expression pertains.

    • Default value attributes: ExpressionAttributes = new ExpressionAttributes

      An optional ExpressionAttributes object to synchronize substitutions across multiple expressions.

    Returns MarshalledExpression

marshallValue

  • marshallValue(schemaType: SchemaType, input: any): AttributeValue | undefined
  • Converts a value into a DynamoDB AttributeValue.

    Parameters

    • schemaType: SchemaType

      Metadata outlining how the value is to be understood and converted

    • input: any

      Value to convert

    Returns AttributeValue | undefined

toSchemaName

  • toSchemaName(path: AttributePath | string, schema: Schema): AttributePath

unmarshallItem

  • Unmarshall a DynamoDB item into a JavaScript value.

    Type parameters

    • T

    Parameters

    • schema: Schema

      Metadata outlining the types to be expected throughout the input

    • input: AttributeMap

      The value to unmarshall

    • Optional valueConstructor: ZeroArgumentsConstructor<T>

      A zero-argument constructor used to create the object onto which the input should be unmarshalled

    Returns T

Object literals

Const KeyTypes

KeyTypes: object

The types of keys a given attribute can represent.

HASH

HASH: string = "HASH"

RANGE

RANGE: string = "RANGE"

Const TypeTags

TypeTags: object

The enumeration of types supported by this marshaller package.

Any

Any: string = "Any"

Binary

Binary: string = "Binary"

Boolean

Boolean: string = "Boolean"

Collection

Collection: string = "Collection"

Custom

Custom: string = "Custom"

Date

Date: string = "Date"

Document

Document: string = "Document"

Hash

Hash: string = "Hash"

List

List: string = "List"

Map

Map: string = "Map"

Null

Null: string = "Null"

Number

Number: string = "Number"

Set

Set: string = "Set"

String

String: string = "String"

Tuple

Tuple: string = "Tuple"