Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Model

Abstract class used to bootstrap a new Model.

export
abstract
class

Model

implements

{IModel}

Hierarchy

Implements

Index

Constructors

constructor

Properties

documentClient

documentClient: DocumentClient

DynamoDBDocument client instance. Must be declared before configuring the model.

type

{DocumentClient}

memberof

Model

Optional hasTenantRegExp

hasTenantRegExp: RegExp

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

type

{RegExp}

memberof

Model

hash

hash: string

The name of the hash key.

type

{string}

memberof

Model

hashType

hashType: string = "string"

The type of the hash key.

type

{string}

memberof

Model

indexName

indexName: string = "byGSIK"

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

Model

maxGSIK

maxGSIK: number = 10

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

Model

Optional range

range: string

The name of the range key.

type

{string}

memberof

Model

rangeType

rangeType: string = "string"

The type of the range key.

type

{string}

memberof

Model

struct

struct: any

Struct instance created from the struct data passed through the model configuration.

type

{*}

memberof

Model

table

table: string

The table name. If not provided it will try to use the table name globally configured.

type

{string}

memberof

Model

Optional tenant

tenant: string

The tenant unique identifier.

type

{string}

memberof

Model

track

track: boolean = false

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

type

{boolean}

memberof

Model

Methods

addTenant

getKey

removeTenant

trackChanges

validate

  • validate(body: IItem): boolean

Generated using TypeDoc