UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

28 lines (27 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TableDTO = void 0; const index_js_1 = require("../../../table/index.js"); class TableDTO extends index_js_1.TableAction { constructor(table) { super(table); this.tableName = this.table.tableName !== undefined ? this.table.getName() : undefined; this.partitionKey = this.table.partitionKey; this.sortKey = this.table.sortKey; this.indexes = this.table.indexes; this.entityAttributeSavedAs = this.table.entityAttributeSavedAs; } toJSON() { return { ...(this.tableName !== undefined ? { tableName: this.tableName } : {}), partitionKey: this.partitionKey, ...(this.sortKey !== undefined ? { sortKey: this.sortKey } : {}), ...(this.indexes !== undefined && Object.entries(this.indexes).length > 0 ? { indexes: this.indexes } : {}), entityAttributeSavedAs: this.entityAttributeSavedAs }; } } exports.TableDTO = TableDTO; TableDTO.actionName = 'dto';