@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.
19 lines (18 loc) • 932 B
TypeScript
import type { Table } from './runtime.ts';
/**
* Talos tables read off a Drizzle schema, so an app does not declare its
* data twice.
*
* const tables = fromDrizzle(schema, { blogPosts: { as: 'articles', says: ['blog'] } })
*
* Every table of the module becomes a Talos table: its columns (logical name =
* the column's own name with spaces for underscores, physical = the column),
* enum domains, and how booleans, dates and JSON read back. Keys of `extra` are
* the module's export names; what they hold is merged over the derived table —
* the word the model sees (`as`), synonyms, rules, relations, lists. `false`
* leaves a table out.
*
* Duck-typed on Drizzle's `Symbol.for('drizzle:…')` markers, so Talos does not
* depend on drizzle-orm and works with any of its dialects.
*/
export declare function fromDrizzle(schema: Record<string, unknown>, extra?: Record<string, Partial<Table> | false>): Table[];