UNPKG

@athenox/talos

Version:

Talos: a backend you describe instead of write. Declare a schema, write the rules in plain language, map URLs to sentences; a small built-in model turns them into query plans.

22 lines (21 loc) • 985 B
import type { Schema, Store } from './runtime.ts'; /** * Talos's own database, for an app that gives it none: a SQLite file * (TALOS_DB, default `.talos/data.db` in the working directory) whose tables * are the schema's. Nothing to configure — the schema already says it: * * - every physical column of a table (and of its relations' keys) exists; * - `id` is the integer primary key; * - a declared value column defaults to its first value (`role: ['member', 'admin']`); * - `types: { minutes: 'number' }` makes it numeric; the rest keeps what is written. * * Run on every start: missing tables are created and missing columns added, * nothing is ever dropped. `seed` rows (logical or physical column names) go * into tables that are still empty, hashed and defaulted as the schema says. */ export declare function localStore(schema: Schema, o?: { file?: string; seed?: Record<string, Record<string, unknown>[]>; }): Promise<Store & { file: string; }>;