Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace requestBuilder

Index

Functions

  • addCondition<T>(tableSchema: TableSchema, conditionableRequest: T, ...conditions: Condition[]): void
  • Adds a condition expression to an input object. A condition expression defines under what conditions the item can be put/deleted.

    Any existing condition expression will be amended.

    Type parameters

    • T: { ConditionExpression?: string; ExpressionAttributeNames?: ExpressionAttributeNameMap; ExpressionAttributeValues?: ExpressionAttributeValueMap }

    Parameters

    • tableSchema: TableSchema
    • conditionableRequest: T

      The input to add a condition expression to.

    • Rest ...conditions: Condition[]

      One or more conditions to turn into a condition expression.

    Returns void

    A copy of conditionableRequest with the condition expression set.

  • Adds a filter expression to an input object. A filter expression refines results returned from a scan or query. The filter applies after the search and you will be billed for the bandwidth of all results before the filter is applied.

    Any existing filter expression will be amended.

    Type parameters

    • T: { ExpressionAttributeNames?: ExpressionAttributeNameMap; ExpressionAttributeValues?: ExpressionAttributeValueMap; FilterExpression?: string }

    Parameters

    • tableSchema: TableSchema
    • filterableRequest: T

      The input to add a filter expression to.

    • Rest ...filters: Condition[]

      One or more filters to turn into a filter expression.

    Returns void

    A copy of filterableRequest with the condition expression set.

  • addProjection<T>(tableSchema: TableSchema, projectableRequest: T, attributes: string[]): void
  • Add a projection expression to an input object. A projection expression defines what attributes are returned in the result. This can save on bandwidth.

    Type parameters

    • T: { ExpressionAttributeNames?: ExpressionAttributeNameMap; ProjectionExpression?: string }

    Parameters

    • tableSchema: TableSchema
    • projectableRequest: T

      The input to add a projection expression to.

    • attributes: string[]

      An array of attribute names to fetch.

    Returns void

    A copy of projectableRequest with the projection expression set.

  • addTransactWriteItems(request: TransactWriteItemsInput, ...input: (PutItemInput | UpdateItemInput | DeleteItemInput)[]): void
  • Add more items to an existing TransactWriteItemsInput object.

    Parameters

    • request: TransactWriteItemsInput

      An existing TransactWriteItemsInput object.

    • Rest ...input: (PutItemInput | UpdateItemInput | DeleteItemInput)[]

      Any combination of inputs into putItem, deleteItem and updateItem.

    Returns void

  • Build a request object that can be passed into batchWriteItem.

    Parameters

    Returns aws.DynamoDB.BatchWriteItemInput

    Input for the batchWriteItem method.

  • Build a request object that can be passed into batchGetItem.

    Parameters

    Returns aws.DynamoDB.BatchGetItemInput

    Input for the batchGetItem method.

  • buildBatchPutInput(tableSchema: TableSchema, items: object[]): aws.DynamoDB.BatchWriteItemInput
  • Build a request object that can be passed into batchWriteItem.

    Parameters

    • tableSchema: TableSchema
    • items: object[]

      The items to put.

    Returns aws.DynamoDB.BatchWriteItemInput

    Input for the batchWriteItem method.

  • buildCreateTableInput(tableSchema: TableSchema | TableSchema[], readCapacity?: number, writeCapacity?: number): aws.DynamoDB.CreateTableInput
  • Build a request object that can be passed into createTable. This is most useful for setting up testing.

    Parameters

    • tableSchema: TableSchema | TableSchema[]

      A single TableSchema or an array of TableSchemas when including secondary indexes.

    • readCapacity: number = 1

      Represents one strongly consistent read per second, or two eventually consistent reads per second, for an item up to 4 KB in size.

    • writeCapacity: number = 1

      Represents one write per second for an item up to 1 KB in size.

    Returns aws.DynamoDB.CreateTableInput

    Input for the createTable method.

  • buildDeleteInput(tableSchema: TableSchema, itemToDelete: object): aws.DynamoDB.DeleteItemInput
  • Build a request object that can be passed into deleteItem

    If TableSchema.versionKeyField is set the delete will only succeed if the item in the database has the same value.

    Parameters

    • tableSchema: TableSchema
    • itemToDelete: object

      The item to delete. Must at least have the partition key, the sort key if applicable, and the version field if applicable.

    Returns aws.DynamoDB.DeleteItemInput

    Input for the deleteItem method.

  • buildDeleteTableInput(tableSchema: TableSchema): aws.DynamoDB.DeleteTableInput
  • Build a request object that can be passed into deleteTable. This is most useful for setting up testing.

    Parameters

    Returns aws.DynamoDB.DeleteTableInput

    Input for the deleteTable method.

  • buildDescribeTableInput(tableSchema: TableSchema): aws.DynamoDB.DescribeTableInput
  • buildDescribeTimeToLiveInput(tableSchema: TableSchema): aws.DynamoDB.DescribeTimeToLiveInput
  • Build a request object that can be passed into getItem.

    Parameters

    • tableSchema: TableSchema
    • partitionKeyValue: DynamoKey

      The key of the item to get.

    • Optional sortKeyValue: DynamoKey

      Sort key of the item to get, if set in the schema.

    Returns aws.DynamoDB.GetItemInput

    Input for the getItem method.

  • buildPutInput(tableSchema: TableSchema, item: object): aws.DynamoDB.PutItemInput
  • Build a request object that can be passed into putItem.

    If TableSchema.versionKeyField is set the put will only succeed if the item in the database has the same value (and then the version will be incremented).

    Parameters

    • tableSchema: TableSchema
    • item: object

      The item to put to the database.

    Returns aws.DynamoDB.PutItemInput

    Input for the putItem method.

  • Build a request object that can be passed into query. The query operation performs an efficient search on one partition key value with an optional condition on the sort key.

    If tableSchema.indexName is set the query will be performed on the secondary index with that name.

    Parameters

    • tableSchema: TableSchema
    • partitionKeyValue: DynamoKey

      The hash key of the item to get.

    • Optional sortKeyOp: DynamoQueryConditionOperator

      The operator that can be used to constrain results. Must be one of: "=", "<", "<=", ">", ">=", "BETWEEN", "begins_with". If not defined all sort key values will be returned.

    • Rest ...sortKeyValues: DynamoKey[]

      Values the sortKeyOp works on. This must be 2 values for BETWEEN and 1 for all other operators.

    Returns aws.DynamoDB.QueryInput

    Input for the query method.

  • buildRequestPutItem(tableSchema: TableSchema, item: any): aws.DynamoDB.AttributeValue
  • Build a serialized item that can be put in DynamoDB. This syntax is also used for expression and key values.

    Parameters

    • tableSchema: TableSchema
    • item: any

      The item to serialize.

    Returns aws.DynamoDB.AttributeValue

    A put item.

  • Build a request object that can be passed into scan. The scan operation performs a linear search through all objects in the table. It can be filtered to only return some values, though all objects in the database will still be read and your account billed accordingly.

    If tableSchema.indexName is set the scan will be performed on the secondary index with that name.

    see

    addFilter

    Parameters

    • tableSchema: TableSchema
    • Rest ...filters: Condition[]

      One or more filters to turn into a filter expression.

    Returns aws.DynamoDB.ScanInput

    Input for the scan method.

  • buildTransactWriteItemsInput(...input: (PutItemInput | UpdateItemInput | DeleteItemInput)[]): aws.DynamoDB.TransactWriteItemsInput
  • Build a request object that can be passed into transactWriteItems.

    Parameters

    • Rest ...input: (PutItemInput | UpdateItemInput | DeleteItemInput)[]

      Any combination of inputs into putItem, deleteItem and updateItem.

    Returns aws.DynamoDB.TransactWriteItemsInput

  • Build a request object that can be passed into updateItem based upon a set of UpdateExpressionActions. Each UpdateExpressionAction defines an operation to take as part of updating in the database.

    If TableSchema.versionKeyField is set the update will only succeed if the item in the database has the same value (and then the version will be incremented).

    Parameters

    • tableSchema: TableSchema
    • itemToUpdate: object

      The item being updated. This item is only used for its keys and may already be updated. This item will not be modified.

    • Rest ...updateActions: UpdateExpressionAction[]

      An array of actions to turn into an UpdateExpression.

    Returns aws.DynamoDB.UpdateItemInput

    Input for the updateItem method.

  • buildUpdateTimeToLiveInput(tableSchema: TableSchema): aws.DynamoDB.UpdateTimeToLiveInput
  • Build a request object that can be passed into updateTimeToLive. Time to live settings will be enabled if tableSchema.ttlField is defined and disabled otherwise.

    Parameters

    Returns aws.DynamoDB.UpdateTimeToLiveInput

    Input for the updateTimeToLive method.

Generated using TypeDoc