idea-aws
    Preparing search index...

    Class DynamoDB

    A wrapper for AWS DynamoDB.

    Index

    Constructors

    Properties

    client: DynamoDBDocument
    logger: LambdaLogger = ...

    Methods

    • Delete an array of items from a DynamoDB table, avoiding the limits of DynamoDB's BatchWriteItem. In case of errors, it will retry with a random back-off mechanism until the timeout. Therefore, in case of timeout, there may be some elements deleted and some not.

      Parameters

      • table: string

        the target DynamoDB table

      • keys: Record<string, any>[]

        the keys to delete

      Returns Promise<void>

    • Get group of items based on their keys from DynamoDB table, avoiding the limits of DynamoDB's BatchGetItem.

      Parameters

      • table: string

        the target DynamoDB table

      • keys: Record<string, any>[]

        the keys of the objects to retrieve

      • OptionalignoreErr: boolean

        if set, ignore the errors and continue the bulk op.

      Returns Promise<any[]>

    • Parameters

      • table: string
      • keys: Record<string, any>[]
      • resultElements: Record<string, any>[]
      • ignoreErr: boolean
      • currentChunk: number = 0
      • chunkSize: number = 100

      Returns Promise<Record<string, any>[]>

    • Put an array of items in a DynamoDB table, avoiding the limits of DynamoDB's BatchWriteItem. In case of errors, it will retry with a random back-off mechanism until the timeout. Therefore, in case of timeout, there may be some elements written and some not.

      Parameters

      • table: string

        the target DynamoDB table

      • items: Record<string, any>[]

        the objects to insert

      Returns Promise<void>

    • Parameters

      • table: string
      • params: BatchWriteCommandInput

      Returns Promise<void>

    • Parameters

      • table: string
      • itemsOrKeys: Record<string, any>[]
      • isPut: boolean
      • currentChunk: number = 0
      • chunkSize: number = 25

      Returns Promise<void>

    • Delete an item of a DynamoDB table.

      Parameters

      • params: DeleteCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<DeleteCommandOutput>

    • Get an item of a DynamoDB table.

      Parameters

      • params: GetCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<any>

    • Manage atomic counters (atomic autoincrement values) in IDEA's projects. They key of an atomic counter should be composed as the following: DynamoDBTableName_uniqueKey.

      Parameters

      • key: string

        the key of the counter

      Returns Promise<number>

    • Returns an IUNID: IDEA's Unique Nano IDentifier, which is an id unique through an AWS region inside an account. Note: no need of an auth check for external uses: the permissions depend from the context in which it's executed.

      Parameters

      • project: string

        project code

      Returns Promise<string>

      the IUNID

    • Parameters

      • project: string
      • attempt: number
      • maxAttempts: number

      Returns Promise<string>

    • Put an item in a DynamoDB table.

      Parameters

      • params: PutCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<PutCommandOutput>

    • Query a DynamoDB table, avoiding the limits of DynamoDB's Query.

      Parameters

      • params: QueryCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<any[]>

    • Query a DynamoDB table in the traditional way (no pagination or data mapping).

      Parameters

      • params: QueryCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<QueryCommandOutput>

    • Parameters

      • params: QueryCommandInput | ScanCommandInput
      • items: Record<string, any>[]
      • isQuery: boolean

      Returns Promise<Record<string, any>[]>

    • Scan a DynamoDB table, avoiding the limits of DynamoDB's Query.

      Parameters

      • params: ScanCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<any[]>

    • Scan a DynamoDB table in the traditional way (no pagination or data mapping).

      Parameters

      • params: ScanCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<ScanCommandOutput>

    • Execute a series of write operations in a single transaction.

      Parameters

      • ops: { ConditionCheck?: any; Delete?: any; Put?: any; Update?: any }[]

        the operations to execute in the transaction

      Returns Promise<void>

    • Convert a JSON object from DynamoDB format to simple JSON.

      Parameters

      • data: Record<string, any>

        the data in DynamoDB's original format to convert in plain objects

      • Optionaloptions: unmarshallOptions

        the options to use to convert the data

      Returns Record<string, any>

    • Update an item of a DynamoDB table.

      Parameters

      • params: UpdateCommandInput

        the params to apply to DynamoDB's function

      Returns Promise<UpdateCommandOutput>