/** * metadata-filter.ts — Structured metadata tags + predicate filtering (#84). * * Tags are serialized as a JSON suffix appended to the stored text: * "\n[tags:{"key":"val","priority":3}]" * * This is backward compatible: rows without a [tags:{...}] suffix simply have * no tags and will not match any tag predicate (they remain visible when no * filter is specified). * * Supported filter predicates (mirroring MongoDB-style operators): * { "key": "value" } — equality ($eq) * { "key": { "$eq": "value" } } — explicit equality * { "key": { "$ne": "value" } } — not-equal * { "key": { "$in": ["a","b"] } } — membership * { "key": { "$nin": ["a","b"] } } — not-in * { "key": { "$gte": 1, "$lte": 5 } } — range (numeric or string lex) * { "key": { "$gt": 0 } } — exclusive lower bound * { "key": { "$lt": 10 } } — exclusive upper bound * { "key": { "$exists": true } } — key presence check * * Multiple top-level keys are ANDed together. */ export type TagValue = string | number | boolean | null; export type Tags = Record; type ScalarPredicate = { $eq?: TagValue; $ne?: TagValue; $in?: TagValue[]; $nin?: TagValue[]; $gt?: number | string; $gte?: number | string; $lt?: number | string; $lte?: number | string; $exists?: boolean; }; export type FilterPredicate = Record; /** Append tags to text for storage. Idempotent (replaces any existing suffix). */ export declare function serializeTags(text: string, tags: Tags): string; /** Remove a [tags:{...}] suffix if present, returning the original text. */ export declare function stripTagsSuffix(text: string): string; /** Parse tags from stored text. Returns null if no tags suffix present. */ export declare function parseTags(text: string | null | undefined): Tags | null; export declare function validateTags(raw: unknown): Tags; export declare function validateFilter(raw: unknown): FilterPredicate; /** * Returns true if `tags` satisfies all predicates in `filter`. * Top-level keys are ANDed. Missing tags match only $exists:false and $nin. */ export declare function matchesFilter(tags: Tags | null, filter: FilterPredicate): boolean; export {}; //# sourceMappingURL=metadata-filter.d.ts.map