UNPKG

dynamodb-toolbox

Version:

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

22 lines (21 loc) 963 B
import { Registry } from '../table/actions/registry/registry.js'; import { Table } from '../table/index.js'; import type { DatabaseMetadata } from './types.js'; export declare class Database<TABLES extends Record<string, Table | Registry> = Record<string, Table | Registry>> { readonly tables: Register<TABLES>; meta: DatabaseMetadata; constructor(tables: TABLES, { meta }?: { meta?: DatabaseMetadata; }); build<ACTION extends DatabaseAction<this> = DatabaseAction<this>>(Action: new (table: this) => ACTION): ACTION; } export declare class DatabaseAction<DATABASE extends Database = Database> { readonly database: DATABASE; static actionName: string; constructor(database: DATABASE); } type Register<TABLES extends Record<string, Table | Registry>> = { [KEY in keyof TABLES]: RegisterTable<TABLES[KEY]>; }; type RegisterTable<TABLE extends Table | Registry> = TABLE extends Table ? Registry<TABLE> : TABLE; export {};