trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
46 lines • 1.94 kB
TypeScript
/**
* EQL-S query builders shared by every typed read adapter (React/Vue/Svelte).
*
* Centralised so filter encoding has one home — typed reads, live subscriptions,
* and HTTP `/query` all share the same `find ?e where …` shape.
*
* @module trellis/schema
*/
/** Escape a value for inclusion in a double-quoted EQL literal. */
export declare function escapeValue(v: string): string;
/** Comparison operators supported by {@link parseSimple}. */
export type WhereOp = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith';
/** Structured filter for one attribute (TRL-7). */
export type WhereFilter = {
eq?: unknown;
ne?: unknown;
lt?: number | string;
lte?: number | string;
gt?: number | string;
gte?: number | string;
contains?: string;
startsWith?: string;
endsWith?: string;
};
/** Equality shorthand or a {@link WhereFilter} object. */
export type WhereValue = unknown | WhereFilter;
export declare function isWhereFilter(value: unknown): value is WhereFilter;
/** Format a JS value as an EQL-S literal (quoted string, bare number, or boolean). */
export declare function formatEqlLiteral(value: unknown): string;
/**
* One `attr op value` fragment for `find ?e where …`.
* Throws when a filter object specifies more than one operator.
*/
export declare function whereCondition(attr: string, value: WhereValue): string;
export type WhereInput = Record<string, WhereValue>;
/**
* `find ?e where type = "<Type>" [and <k> <op> <v> …]` — entities of a type,
* optionally narrowed by attribute filters (ANDed).
*/
export declare function entitiesQuery(type: string, where?: WhereInput): string;
/**
* Single-entity live subscription query (TRL-9).
* Narrows the type pattern to one entity id — avoids full-type fan-out on the wire.
*/
export declare function entityQuery(type: string, entityId: string): string;
//# sourceMappingURL=eql.d.ts.map