// Template + Record CRUD. A "record" = multiple entries composed via a template's slots. // Base, D1 only. (Ported clean from KBDB; no vectorize/triplet imports.) import type { Template } from '../types'; import { createEntry } from './entry-crud'; function uid(prefix: string): string { return `${prefix}_${crypto.randomUUID()}`; } // ---- Templates ---- export interface CreateTemplateInput { name: string; description?: string | null; slots: string[]; created_by?: string | null; id?: string; } export async function createTemplate(db: D1Database, input: CreateTemplateInput): Promise