open-agreements
Version:
Open-source legal template filling CLI and library
36 lines • 1.07 kB
TypeScript
/**
* BM25 template search via MiniSearch.
*
* Builds an in-memory index from the template list on each call (sub-millisecond
* at 100+ templates). No caching, no persistence — stateless and serverless-safe.
*/
export interface TemplateSearchResult {
template_id: string;
display_name: string;
category: string;
description: string;
source: string | null;
field_count: number;
score: number;
}
export interface TemplateSearchOptions {
query: string;
category?: string;
source?: string;
max_results?: number;
}
/** Minimal shape required from TemplateItem — avoids coupling to the deploy's listing types. */
interface TemplateItemLike {
name: string;
display_name: string;
category: string;
description: string;
source: string | null;
fields: {
name: string;
section: string | null;
}[];
}
export declare function searchTemplates(templates: TemplateItemLike[], options: TemplateSearchOptions): TemplateSearchResult[];
export {};
//# sourceMappingURL=template-search.d.ts.map