UNPKG

dynamodb-toolbox

Version:

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

26 lines (25 loc) 802 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DatabaseAction = exports.Database = void 0; const registry_js_1 = require("../table/actions/registry/registry.js"); const index_js_1 = require("../table/index.js"); class Database { constructor(tables, { meta = {} } = {}) { this.tables = register(tables); this.meta = meta; } build(Action) { return new Action(this); } } exports.Database = Database; class DatabaseAction { constructor(database) { this.database = database; } } exports.DatabaseAction = DatabaseAction; const register = (tables) => Object.fromEntries(Object.entries(tables).map(([key, table]) => [ key, table instanceof index_js_1.Table ? table.build(registry_js_1.Registry) : table ]));