UNPKG

unified-query

Version:

Composable search input with autocompletion and a rich query-language parser for the Unified Data System

38 lines (37 loc) 1.5 kB
import type { ParseResult } from './parsers/types.js'; export interface SearchQuery { id?: string[]; kind?: string[]; name?: string; content?: string; created_at?: [number, number]; deleted_at?: [number, number]; updated_at?: [number, number]; changed_at?: [number, number]; archived_at?: [number, number]; completed_at?: [number, number]; /** For entities with `date` field like log. The date string is YYYY/MM/DD format */ date?: [string, string]; /** For entities with `time` field like log. The time string is HH:mm format. */ time?: [string, string]; /** Returns entities that have been completed/resolved: tasks, issues, projects; this field when specified automatically narrows down the query to completeable/resolvable entities */ completed?: boolean; /** Self explanatory*/ archived?: boolean; deleted?: boolean; draft?: boolean; /** Return entities in either of the parents. */ parent?: string[]; limit?: number; /** Sorted from by priority from first to last field*/ sort?: SortArg[]; /** Whether to include the entity in the SearchResult or only the id */ include_entity?: boolean; } interface SortArg { field: SortField; dir?: 'asc' | 'desc'; } type SortField = 'created_at' | 'updated_at' | 'deleted_at' | 'changed_at' | 'archived_at' | 'completed_at' | 'date' | 'kind'; export declare function toQuery(res: ParseResult, head?: 'content' | 'name'): SearchQuery; export {};