Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IModel

Default Model interface.

export
interface

IModel

Hierarchy

Implemented by

Index

Properties

documentClient

documentClient: DocumentClient

Optional hasTenantRegExp

hasTenantRegExp: RegExp

Regular expression to use when checking if the hash key has the tenant prefixed.

type

{RegExp}

memberof

IModel

hash

hash: string

The name of the hash key.

type

{string}

memberof

IDynamoDBModelConfig

hashType

hashType: string

The type of the hash key.

type

{string}

memberof

IDynamoDBModelConfig

indexName

indexName: string

The name of the index to use when running an index operation. By default if will be called byGSIK. If the index is not created before hand, and the model is configured with a tenant, then the method will fail.

type

{string}

memberof

IModel

maxGSIK

maxGSIK: number

The maximum GSIK values to use to index the models. This is necessary when configuring a tenant, since you can't configure an IAM policy to restrict access to an item with a prefix on its hash ID. So, a GSIK will be configured on every item by the library, using the tenant value plus a number between 0 and maxGSIK. Then you can create an IAM policy that restrict access on the index (called by defaylt byGSIK) with access only on the items with the appropiate GSIK value.

type

{number}

memberof

IModel

Optional range

range: string

The name of the range key.

type

{string}

memberof

IModel

rangeType

rangeType: string

The type of the range key.

type

{string}

memberof

IModel

struct

The struct representing the model. Should be configured followin the superstruct configuration guide.

table

table: string

DynamoDB table name to store the model.

type

{string}

memberof

IModel

Optional tenant

tenant: string

The tenant unique identifier.

type

{string}

memberof

IModel

track

track: boolean

Value used to track the dates where modifications were done to the item.

type

{boolean}

memberof

IModel

Methods

addTenant

  • Adds the gsik value to the item, created by joining the tenant value with a random value between 0 and maxGSIK.

    memberof

    Model

    Returns IItem

getKey

  • Gets the hash and range key from the model. If tenant is defined, it also adds it to the hash key.

    memberof

    Model

    Parameters

    Returns IDynamoDBKey

removeTenant

  • Removes all tenant data from an item.

    memberof

    IModel

    Parameters

    Returns IItem

  • Removes all tenant data from a list of items.

    memberof

    IModel

    Parameters

    Returns IItem[]

trackChanges

validate

  • validate(body: IItem): boolean

Generated using TypeDoc