import type { DatabaseSchema, DatabaseSchemaOptions } from "./schema.js"; export type DatabaseConfiguration = DatabaseSchemaOptions & { initialTitle?: string; schema: S; }; export type Database = { _tag: "database"; key: string; config: DatabaseConfiguration; }; /** Declare a Notion database that a user will attach to this app. */ export function createDatabase( key: string, config: DatabaseConfiguration, ): Database { if (typeof key !== "string" || key.length === 0) { throw new Error("Database key must be a non-empty string"); } return { _tag: "database", key, config }; }