@osqd/jql 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/conformance/cases.json +2 -0
  3. package/dist/chunk-2ZMIVDES.cjs +1661 -0
  4. package/dist/chunk-2ZMIVDES.cjs.map +1 -0
  5. package/dist/chunk-6PWYYYWU.js +1637 -0
  6. package/dist/chunk-6PWYYYWU.js.map +1 -0
  7. package/dist/chunk-74QKHM6Y.cjs +145 -0
  8. package/dist/chunk-74QKHM6Y.cjs.map +1 -0
  9. package/dist/chunk-ATRXHPBJ.js +112 -0
  10. package/dist/chunk-ATRXHPBJ.js.map +1 -0
  11. package/dist/chunk-EJFHVGBC.cjs +63 -0
  12. package/dist/chunk-EJFHVGBC.cjs.map +1 -0
  13. package/dist/chunk-ITPY6VTV.cjs +115 -0
  14. package/dist/chunk-ITPY6VTV.cjs.map +1 -0
  15. package/dist/chunk-JK6OYDLX.js +712 -0
  16. package/dist/chunk-JK6OYDLX.js.map +1 -0
  17. package/dist/chunk-N7DS4QNW.js +60 -0
  18. package/dist/chunk-N7DS4QNW.js.map +1 -0
  19. package/dist/chunk-PNBQ2HIJ.js +133 -0
  20. package/dist/chunk-PNBQ2HIJ.js.map +1 -0
  21. package/dist/chunk-VMFEQXBB.js +578 -0
  22. package/dist/chunk-VMFEQXBB.js.map +1 -0
  23. package/dist/cjs/text/index.d.ts +1 -1
  24. package/dist/cjs/text/parse.d.ts +2 -1
  25. package/dist/cjs/text/quote.d.ts +17 -0
  26. package/dist/cjs/text/suggest.d.ts +27 -5
  27. package/dist/cli.js +13 -2395
  28. package/dist/cli.js.map +1 -1
  29. package/dist/global.cjs +26 -1849
  30. package/dist/global.cjs.map +1 -1
  31. package/dist/global.js +8 -1831
  32. package/dist/global.js.map +1 -1
  33. package/dist/index.cjs +143 -1996
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.js +5 -2493
  36. package/dist/index.js.map +1 -1
  37. package/dist/mongo.cjs +20 -119
  38. package/dist/mongo.cjs.map +1 -1
  39. package/dist/mongo.js +2 -101
  40. package/dist/mongo.js.map +1 -1
  41. package/dist/text/index.d.ts +1 -1
  42. package/dist/text/parse.d.ts +2 -1
  43. package/dist/text/quote.d.ts +17 -0
  44. package/dist/text/suggest.d.ts +27 -5
  45. package/dist/text.cjs +146 -101
  46. package/dist/text.cjs.map +1 -1
  47. package/dist/text.js +3 -665
  48. package/dist/text.js.map +1 -1
  49. package/docs/course/11-the-search-box.md +49 -2
  50. package/docs/course/16-extending.md +1 -1
  51. package/docs/reference/api.md +14 -1
  52. package/docs/reference/specification.md +9 -2
  53. package/docs/reference/text-syntax.md +41 -6
  54. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/group.ts","../src/explain.ts","../src/canonical.ts","../src/plan.ts","../src/async.ts"],"names":["key","text","search","values","join","why","operand","condition","plan","collect"],"mappings":";;;;;AAyDO,SAAS,KAAA,CAAS,MAAA,EAAkB,EAAA,EAAY,OAAA,GAAmC,EAAC,EAAiB;AAC1G,EAAA,IAAI,OAAO,EAAA,KAAO,QAAA,EAAU,MAAM,IAAI,QAAA,CAAS,CAAA,iCAAA,EAAoC,QAAA,CAAS,EAAE,CAAC,CAAA,CAAA,EAAI,IAAI,CAAA;AACvG,EAAA,IAAI,OAAA,CAAQ,KAAA,KAAU,MAAA,KAAc,CAAC,MAAA,CAAO,SAAA,CAAU,OAAA,CAAQ,KAAK,CAAA,IAAK,OAAA,CAAQ,KAAA,GAAQ,CAAA,CAAA,EAAI;AAC1F,IAAA,MAAM,IAAI,SAAS,CAAA,+CAAA,EAAkD,QAAA,CAAS,QAAQ,KAAK,CAAC,IAAI,OAAO,CAAA;AAAA,EACzG;AACA,EAAA,IAAI,OAAA,CAAQ,KAAA,KAAU,MAAA,IAAa,OAAO,QAAQ,KAAA,KAAU,SAAA,KAAc,CAAC,MAAA,CAAO,UAA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QAAAA,GAAUD,MAAK,OAAA,EAAQ;AAC7B,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,WAAA,MAAiB,IAAA,IAAQ,OAAA,CAAQ,MAAM,CAAA,EAAG;AACxC,IAAA,MAAM,QAAA,GAAW,KAAA,EAAA;AACjB,IAAA,IAAIA,MAAK,IAAA,KAAS,MAAA,IAAa,CAACA,KAAAA,CAAK,IAAA,CAAK,IAAI,CAAA,EAAG;AACjD,IAAA,IAAIC,QAAAA,CAAQ,KAAA,CAAM,IAAA,EAAM,QAAQ,CAAA,EAAG;AAAA,EACrC;AACA,EAAA,OAAOD,KAAAA,CAAK,KAAA,CAAMC,QAAAA,CAAQ,MAAA,EAAQ,CAAA;AACpC","file":"chunk-VMFEQXBB.js","sourcesContent":["import { compile, type CompileOptions, reachField } from \"./core.js\";\nimport { JqlError } from \"./errors.js\";\nimport { compareValues } from \"./internal/order.js\";\nimport { describe } from \"./internal/values.js\";\nimport type { QueryLike, Source } from \"./types.js\";\nimport { checkVocabulary, type Vocabulary } from \"./vocabulary.js\";\n\n/**\n * Counting the matches by one field.\n *\n * Every dashboard in this family ends up doing this: a thousand requests become a dozen\n * actors you can read down, a feed becomes counts per verdict, per rule, per path. Each\n * one used to write the tally loop itself, which is where the disagreements crept in —\n * whether an item with two tags counts twice, what happens to the items with no value at\n * all, and what order the groups come back in. It is one answer now.\n *\n * One pass over the source, one `Map` of counts, and the items kept only when asked for.\n */\n\nexport interface Grouped<T> {\n /** The value that names the group. `null` covers everything that cannot name one — see below. */\n readonly key: unknown;\n readonly count: number;\n /** Present only when `items` asked for them. */\n readonly items?: readonly T[] | undefined;\n}\n\nexport interface GroupOptions<T, Extra extends object = {}> extends CompileOptions<Extra> {\n /** Which items to count. Absent counts them all. */\n readonly where?: QueryLike<T, NoInfer<Extra>> | undefined;\n /** How many groups to return. Absent returns all of them. */\n readonly limit?: number | undefined;\n /** Keep the items too: `true` for all of them, a number for the first few. Default: counts only. */\n readonly items?: boolean | number | undefined;\n /** `\"count\"` (default) puts the largest group first; `\"key\"` orders by the value itself. */\n readonly sort?: \"count\" | \"key\" | undefined;\n}\n\ntype Items<T> = Source<T> | ReadonlyMap<unknown, T>;\n\n/**\n * Groups the matching items by the value at `by`, largest group first.\n *\n * Three rules worth knowing, each because leaving it unsaid is how two dashboards came to\n * disagree about the same feed:\n *\n * - **An item counts once in each group it belongs to.** A path that reaches an array —\n * tags, say — puts the item in a group per distinct tag, and a repeated value inside one\n * item counts once.\n * - **Everything that cannot name a group shares `null`**: a missing field, a `null`, a value\n * that is an object, and an empty list. That is the \"no rule matched\" heading, and it is a\n * real answer rather than a silently dropped row — which is the point, because it is what\n * makes the counts add up to the number of rows there are.\n * - **Ties break by the key**, so the same data always comes back in the same order.\n */\nexport function group<K, V, Extra extends object = {}>(source: ReadonlyMap<K, V>, by: string, options?: GroupOptions<V, Extra>): Grouped<V>[];\nexport function group<T, Extra extends object = {}>(source: Source<T>, by: string, options?: GroupOptions<T, Extra>): Grouped<T>[];\nexport function group<T>(source: Items<T>, by: string, options: GroupOptions<T, object> = {}): Grouped<T>[] {\n if (typeof by !== \"string\") throw new JqlError(`a group is named by a field, not ${describe(by)}`, \"by\");\n if (options.limit !== undefined && (!Number.isInteger(options.limit) || options.limit < 0)) {\n throw new JqlError(`is a whole number of groups, zero or more, not ${describe(options.limit)}`, \"limit\");\n }\n if (options.items !== undefined && typeof options.items !== \"boolean\" && (!Number.isInteger(options.items) || options.items < 0)) {\n throw new JqlError(`is true, false, or how many items to keep, not ${describe(options.items)}`, \"items\");\n }\n const reach = reachField(by, checkVocabulary(options.vocabulary) as Vocabulary<unknown, object> | undefined, \"by\");\n const test = options.where === undefined ? undefined : compile(options.where, options);\n const keep = options.items === true ? Number.POSITIVE_INFINITY : options.items === undefined || options.items === false ? 0 : options.items;\n\n const groups = new Map<unknown, { key: unknown; count: number; items: T[] }>();\n const keys: unknown[] = [];\n const visit = (item: T): void => {\n if (test !== undefined && !test(item)) return;\n keys.length = 0;\n reach(item, (value) => {\n collect(value, keys);\n return false;\n });\n for (const key of keys) {\n let held = groups.get(key);\n if (held === undefined) {\n held = { key, count: 0, items: [] };\n groups.set(key, held);\n }\n held.count++;\n if (held.items.length < keep) held.items.push(item);\n }\n };\n\n if (Array.isArray(source)) for (let i = 0; i < source.length; i++) visit(source[i] as T);\n else if (source instanceof Map) for (const item of source.values()) visit(item as T);\n else if (typeof (source as Iterable<T>)[Symbol.iterator] === \"function\") for (const item of source as Iterable<T>) visit(item);\n else {\n const list = source as ArrayLike<T>;\n for (let i = 0; i < list.length; i++) visit(list[i] as T);\n }\n\n const byKey = options.sort === \"key\";\n const found = [...groups.values()].sort((a, b) => (byKey ? compareValues(a.key, b.key) : b.count - a.count || compareValues(a.key, b.key)));\n const limited = options.limit === undefined ? found : found.slice(0, options.limit);\n return limited.map((held) => (keep > 0 ? { key: held.key, count: held.count, items: held.items } : { key: held.key, count: held.count }));\n}\n\n/** The keys one reached value stands for, without repeating one this item has already earned. */\nfunction collect(value: unknown, into: unknown[]): void {\n if (Array.isArray(value)) {\n // An empty array names no group — and belonging to none is not the same as not being\n // there. Counting by a tag used to leave every untagged row out of the tally altogether,\n // so the numbers above a table did not add up to the number of rows in it, and nothing\n // said which rows had gone. It is a value that cannot name a group, so it shares `null`\n // with the others.\n if (value.length === 0) {\n if (!into.includes(null)) into.push(null);\n return;\n }\n for (const element of value) collect(element, into);\n return;\n }\n const key = value === undefined || value === null || typeof value === \"object\" ? null : value;\n if (!into.includes(key)) into.push(key);\n}\n","import { CASE_AWARE, compile, type CompileOptions, FIELD_OPERATORS, reachField } from \"./core.js\";\nimport { isFieldReference, isPlainObject } from \"./internal/values.js\";\nimport type { QueryLike } from \"./types.js\";\nimport type { Vocabulary } from \"./vocabulary.js\";\n\n/**\n * Why one item does or does not match a query.\n *\n * A filter that returns nothing tells you nothing about which part of it was wrong. This\n * takes the query apart and answers for each piece separately, with the values it actually\n * read, so an operator looking at a row and a saved filter that disagree can see the clause\n * that decided it.\n *\n * **It runs the real engine on every piece.** Each clause is compiled on its own and tested,\n * rather than interpreted here by a second reading of the language — a second reading would\n * be a second set of semantics, and the one thing worse than a filter you cannot explain is\n * an explanation that does not match what the filter did. The cost is one small compile per\n * clause, which is why this is for one item at a time and `compile` is for the collection.\n */\n\nexport interface Explanation {\n /** Whether this clause holds for the item. */\n readonly matched: boolean;\n /** Where the clause is in the query, written as it would be reached in code: `$or[1].age.$gt`. */\n readonly at: string;\n /** The clause itself, as the JSON fragment that was evaluated. */\n readonly clause: unknown;\n /** One sentence: what was read, or how the parts came out. */\n readonly because: string;\n /** The clauses this one is made of. */\n readonly parts?: readonly Explanation[];\n}\n\nconst FIELD_OPERATOR_SET = new Set(FIELD_OPERATORS);\n\n/** Explains one item against one query. */\nexport function explain<T, Extra extends object = {}>(query: QueryLike<T, NoInfer<Extra>>, item: T, options: CompileOptions<Extra> = {}): Explanation {\n return node(query, item, \"\", options as CompileOptions<object>);\n}\n\nfunction matchedBy(clause: unknown, item: unknown, options: CompileOptions<object>): boolean {\n return compile(clause as QueryLike<unknown, object>, options)(item);\n}\n\n/**\n * Explains one clause.\n *\n * `at` is where the clause's *contents* live — the path of whatever holds it — and each\n * key appends itself. Written the other way round, with the caller appending the key and\n * the callee appending it again, every nested location came out doubled: `score.score.$gt`.\n */\nfunction node(clause: unknown, item: unknown, at: string, options: CompileOptions<object>): Explanation {\n if (typeof clause === \"function\" || !isPlainObject(clause)) {\n return leaf(clause, item, at, options, typeof clause === \"function\" ? \"a predicate of your own\" : \"the whole query\");\n }\n const keys = Object.keys(clause);\n if (keys.length === 0) return { matched: true, at, clause, because: \"an empty query matches everything\" };\n if (keys.length > 1) {\n // Field operators at the top of a query are one condition on the item itself. Split a\n // key at a time they came apart, and `{ $contains: \"ABC\", $options: \"i\" }` was explained\n // as an `$options` with nothing beside it — which the engine refuses, so explaining a\n // perfectly good query threw.\n const self = keys.filter((key) => key !== \"$not\" && FIELD_OPERATOR_SET.has(key));\n const rest = keys.filter((key) => !self.includes(key));\n const parts = rest.map((key) => node({ [key]: clause[key] }, item, at, options));\n if (self.length > 0) {\n const whole: Record<string, unknown> = {};\n for (const key of self) whole[key] = clause[key];\n parts.push(leaf(whole, item, at, options, self[0] as string));\n }\n return branch(clause, at, parts, \"and\");\n }\n\n const key = keys[0] as string;\n const value = clause[key];\n const here = join(at, key);\n switch (key) {\n case \"$and\":\n case \"$or\":\n case \"$nor\": {\n if (!Array.isArray(value)) break;\n const parts = value.map((part, index) => node(part, item, `${here}[${index}]`, options));\n return branch(clause, here, parts, key === \"$and\" ? \"and\" : key === \"$or\" ? \"or\" : \"nor\");\n }\n case \"$not\": {\n const inner = node(value, item, here, options);\n return {\n matched: !inner.matched,\n at: here,\n clause,\n because: inner.matched ? \"what it negates holds\" : \"what it negates does not hold\",\n parts: [inner],\n };\n }\n default:\n break;\n }\n\n // A field with several operators explains one operator at a time: which of them failed is\n // the question somebody is asking.\n if (!key.startsWith(\"$\") && isPlainObject(value) && !isFieldReference(value) && Object.keys(value).length > 1 && Object.keys(value).every((name) => name.startsWith(\"$\"))) {\n const operators = Object.keys(value).filter((name) => name !== \"$options\");\n // `$options` travels with each operator it changes — and only those. Carried onto the\n // others it made a piece the engine refuses (\"$options has nothing to apply to\"), so a\n // valid query like `{ b: { $contains: \"x\", $exists: true, $options: \"i\" } }` threw\n // instead of being explained.\n const flags = value.$options === undefined ? {} : { $options: value.$options };\n const parts = operators.map((name) => leaf({ [key]: { [name]: value[name], ...(CASE_AWARE.has(name) ? flags : {}) } }, item, join(here, name), options, key));\n return branch(clause, here, parts, \"and\");\n }\n return leaf(clause, item, here, options, key);\n}\n\nfunction branch(clause: unknown, at: string, parts: Explanation[], kind: \"and\" | \"or\" | \"nor\"): Explanation {\n const held = parts.filter((part) => part.matched).length;\n const matched = kind === \"and\" ? held === parts.length : kind === \"or\" ? held > 0 : held === 0;\n const many = parts.length === 1 ? \"part\" : \"parts\";\n const because =\n kind === \"nor\" ? `${held} of ${parts.length} ${many} hold, and none may` : `${held} of ${parts.length} ${many} hold${kind === \"or\" ? \", and one is enough\" : \"\"}`;\n return { matched, at, clause, because, parts };\n}\n\nfunction leaf(clause: unknown, item: unknown, at: string, options: CompileOptions<object>, key: string): Explanation {\n const matched = matchedBy(clause, item, options);\n return { matched, at, clause, because: reason(clause, item, options, key) };\n}\n\n/** What the item holds where this clause looked. */\nfunction reason(clause: unknown, item: unknown, options: CompileOptions<object>, key: string): string {\n if (key === \"$text\") return matchedBy(clause, item, options) ? \"the item holds that text\" : \"no value of the item holds that text\";\n if (key === \"$comment\") return \"a comment decides nothing\";\n if (key.startsWith(\"$\") && FIELD_OPERATOR_SET.has(key)) return `the item itself is ${values(item === undefined ? [] : [item])}`;\n if (!isPlainObject(clause)) return \"the clause was run as given\";\n const path = Object.keys(clause)[0];\n if (path === undefined || path.startsWith(\"$\")) return \"the clause was run as given\";\n const found: unknown[] = [];\n try {\n reachField(path, options.vocabulary as Vocabulary<unknown, object> | undefined, path)(item, (value) => {\n if (found.length < 4) found.push(value);\n return false;\n });\n } catch {\n // A name the query resolves but this walk cannot is not worth failing an explanation for.\n return \"the clause was run as given\";\n }\n return `${path} is ${values(found)}`;\n}\n\nfunction values(found: readonly unknown[]): string {\n if (found.length === 0 || (found.length === 1 && found[0] === undefined)) return \"missing\";\n const written = found.map((value) => (value === undefined ? \"missing\" : shorten(value)));\n return written.length === 1 ? (written[0] as string) : `each of ${written.join(\", \")}`;\n}\n\nfunction shorten(value: unknown): string {\n if (value instanceof Date) return value.toISOString();\n let text: string;\n try {\n text = JSON.stringify(value) ?? String(value);\n } catch {\n // A value that will not serialise — something cyclic — still has a name worth printing.\n return \"a value that cannot be written out\";\n }\n return text.length > 60 ? `${text.slice(0, 60)}…` : text;\n}\n\nfunction join(at: string, key: string): string {\n return at === \"\" ? key : `${at}.${key}`;\n}\n","import { compile, type CompileOptions } from \"./core.js\";\nimport { isDateLiteral, isFieldReference, isPlainObject } from \"./internal/values.js\";\nimport type { QueryLike, UntypedQuery } from \"./types.js\";\n\n/**\n * One shape per meaning, so two queries that ask the same thing look the same.\n *\n * Saved filters arrive written in whatever way somebody typed them: `{ a: 1 }` and\n * `{ a: { $eq: 1 } }`, `{ $and: [x, y] }` and `{ ...x, ...y }`, the same keys in a\n * different order. Storing them raw means a list of \"saved filters\" with three copies of\n * one filter in it, and a cache that misses on every one of them.\n *\n * `canonical` rewrites a query into a fixed form, and `fingerprint` names that form in\n * sixteen characters. The rewritten query is still a query, and matches exactly what the\n * original matched — a property the tests hold it to on random queries.\n *\n * What it does **not** do is decide whether two queries are equivalent in general. That\n * question has no cheap answer: `{ $gt: 3 }` and `{ $gte: 4 }` agree on every integer and\n * disagree on 3.5, and nothing here will notice. Equal fingerprints mean the same query;\n * different fingerprints mean only that the queries are written differently.\n */\n\n/** Operators whose list of values is a set: order and repetition change nothing. */\nconst SETS = new Set([\"$in\", \"$nin\", \"$all\", \"$contains\", \"$startsWith\", \"$endsWith\", \"$word\", \"$glob\"]);\n\n/** Operators whose operand is a query rather than a value. */\nconst QUERIES = new Set([\"$elemMatch\"]);\n/** Operators whose list is a set of queries. */\nconst LOGIC = new Set([\"$and\", \"$or\", \"$nor\"]);\n\n/**\n * The canonical form of a query.\n *\n * Refuses anything that is not a valid query, because a canonical form of nonsense would\n * be nonsense somebody had stored deliberately.\n */\nexport function canonical<T, Extra extends object = {}>(query: QueryLike<T, NoInfer<Extra>>, options?: CompileOptions<Extra>): UntypedQuery {\n if (typeof query === \"function\") throw new TypeError(\"a compiled predicate has no canonical form: it is code, not a query\");\n compile(query, options);\n return rewrite(query) as UntypedQuery;\n}\n\n/**\n * A short, stable name for a query's canonical form.\n *\n * For cache keys, for telling two saved filters apart, and for noticing that the filter\n * somebody is saving is one they already have. Not a cryptographic hash: it is a\n * 64-bit checksum written as hex, so two different queries can collide — rarely, and never\n * in a way that matters for a cache you can miss.\n */\nexport function fingerprint<T, Extra extends object = {}>(query: QueryLike<T, NoInfer<Extra>>, options?: CompileOptions<Extra>): string {\n return checksum(JSON.stringify(canonical(query, options)) ?? \"\");\n}\n\nfunction rewrite(value: unknown): unknown {\n if (!isPlainObject(value)) return value;\n if (isDateLiteral(value) || isFieldReference(value)) return value;\n const out: Record<string, unknown> = {};\n // `$comment` is dropped below, so it does not count towards \"is this operator the whole\n // query?\" either. Counting it kept `{ $and: [x], $comment: \"why\" }` wrapped on the first\n // pass and unwrapped it on the second, so a canonical query was not settled.\n const keys = Object.keys(value)\n .sort()\n .filter((key) => key !== \"$comment\");\n // `{ $or: [x] }` is `x`, but only when the `$or` is the whole query. Unwrapping it while\n // it had siblings returned `x` for the entire object and threw the siblings away, so\n // `{ \"a\": 1, \"$or\": [x] }` canonicalised to `x` — a saved filter quietly missing a\n // constraint, and two different queries with one fingerprint.\n const alone = keys.length === 1;\n // Keys in one order, so the serialised form of two queries that say the same thing is\n // the same string.\n for (const key of keys) {\n const held = value[key];\n if (LOGIC.has(key) && Array.isArray(held)) {\n const parts = flatten(key, held).map(rewrite).sort(byText);\n // `$and` and `$or` of one part are that part; `$nor` of one is not, so it stays.\n if (parts.length === 1 && key !== \"$nor\" && alone) return parts[0];\n out[key] = parts;\n continue;\n }\n if (key === \"$not\") {\n out[key] = rewrite(held);\n continue;\n }\n if (key === \"$text\") {\n out[key] = text(held);\n continue;\n }\n if (key.startsWith(\"$\")) {\n out[key] = operand(key, held);\n continue;\n }\n out[key] = condition(held);\n }\n return fold(out);\n}\n\n/**\n * `{ \"$and\": [x, y] }` and `{ …x, …y }` are the same filter, so they get the same form.\n *\n * This is the everyday case rather than a curiosity: the search box writes the first — every\n * multi-term search compiles to an `$and` — and a person writing JSON writes the second. Left\n * apart, the same question saved from the box and from the API had two names, which is the\n * duplicate this module exists to prevent.\n *\n * Only a part whose keys are still free can be lifted. Two conditions on one field cannot\n * become one key, and merging them would be wrong even if JSON allowed it: `$options` applies\n * to every case-aware operator beside it, so folding `{ \"$eq\": \"X\", \"$options\": \"i\" }` and\n * `{ \"$contains\": \"y\" }` together would quietly make the second ignore case too. Those parts\n * stay in the `$and`, which keeps the form idempotent — running it again lifts nothing new.\n */\nfunction fold(out: Record<string, unknown>): Record<string, unknown> {\n const parts = out.$and;\n if (!Array.isArray(parts) || parts.length === 0) return out;\n const taken = new Set(Object.keys(out).filter((key) => key !== \"$and\"));\n const lifted: Record<string, unknown> = {};\n const kept: unknown[] = [];\n for (const part of parts) {\n const keys = isPlainObject(part) ? Object.keys(part) : undefined;\n if (keys === undefined || keys.length === 0 || keys.some((key) => taken.has(key))) {\n kept.push(part);\n continue;\n }\n for (const key of keys) {\n taken.add(key);\n lifted[key] = (part as Record<string, unknown>)[key];\n }\n }\n if (Object.keys(lifted).length === 0) return out;\n const merged: Record<string, unknown> = { ...lifted };\n for (const [key, value] of Object.entries(out)) if (key !== \"$and\") merged[key] = value;\n if (kept.length > 0) merged.$and = kept;\n // Keys in one order again, now that there are more of them.\n const sorted: Record<string, unknown> = {};\n for (const key of Object.keys(merged).sort()) sorted[key] = merged[key];\n return sorted;\n}\n\n/** A field's value, always as a condition: `{ a: 1 }` and `{ a: { $eq: 1 } }` are one query. */\nfunction condition(value: unknown): unknown {\n if (isPlainObject(value) && !isDateLiteral(value) && !isFieldReference(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => key.startsWith(\"$\"))) {\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(value).sort()) out[key] = key === \"$not\" ? condition(value[key]) : operand(key, value[key]);\n return out;\n }\n return { $eq: literal(value) };\n}\n\nfunction operand(key: string, value: unknown): unknown {\n if (SETS.has(key) && Array.isArray(value)) return unique(value.map(literal));\n if (QUERIES.has(key)) return rewrite(value);\n if (key === \"$type\" && Array.isArray(value)) {\n const types = unique(value);\n return types.length === 1 ? types[0] : types;\n }\n // `$options: \"iu\"` and `\"ui\"` are the same flags.\n if (key === \"$options\" && typeof value === \"string\") return [...value].sort().join(\"\");\n // A condition on a length is a condition; anything else here is a value.\n if ((key === \"$size\" || key === \"$length\") && isPlainObject(value)) return condition(value);\n return literal(value);\n}\n\n/**\n * A value being compared with, rewritten only in ways that cannot change what it equals.\n *\n * Keys are sorted, because JQL compares objects without regard to key order, so two filters\n * written with the keys the other way round are one filter. Nothing else is touched — and in\n * particular a literal is **not** walked as a query. Run through the query rewriter,\n * `{ a: { x: 1 } }` became `{ a: { $eq: { x: { $eq: 1 } } } }`: a filter for a document\n * holding `{ x: 1 }` turned into a filter for one holding `{ x: { $eq: 1 } }`, which is a\n * different question with the same fingerprint.\n */\nfunction literal(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(literal);\n if (!isPlainObject(value) || isDateLiteral(value) || isFieldReference(value)) return value;\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(value).sort()) out[key] = literal(value[key]);\n return out;\n}\n\nfunction text(value: unknown): unknown {\n const search = typeof value === \"string\" ? { $search: value } : isPlainObject(value) ? value : undefined;\n if (search === undefined) return value;\n const out: Record<string, unknown> = { $search: search.$search };\n // A list of fields is a set, like `$in`; searching two fields is the same question in\n // either order.\n if (Array.isArray(search.$fields)) out.$fields = unique(search.$fields);\n if (search.$caseSensitive === true) out.$caseSensitive = true;\n return out;\n}\n\n/** `$and` inside `$and` is one `$and`; the same for `$or`. Not for `$nor`, which does not nest that way. */\nfunction flatten(key: string, parts: readonly unknown[]): unknown[] {\n if (key === \"$nor\") return [...parts];\n const out: unknown[] = [];\n for (const part of parts) {\n const inner = isPlainObject(part) && Object.keys(part).length === 1 ? part[key] : undefined;\n if (Array.isArray(inner)) out.push(...flatten(key, inner));\n else out.push(part);\n }\n return out;\n}\n\nfunction byText(a: unknown, b: unknown): number {\n const left = JSON.stringify(a) ?? \"\";\n const right = JSON.stringify(b) ?? \"\";\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction unique(values: readonly unknown[]): unknown[] {\n const seen = new Map<string, unknown>();\n for (const value of values) {\n const written = JSON.stringify(value) ?? String(value);\n if (!seen.has(written)) seen.set(written, value);\n }\n return [...seen.values()].sort(byText);\n}\n\n/**\n * A 64-bit checksum as sixteen hex characters: two FNV-1a passes with different offsets.\n *\n * No dependency, no `node:crypto` — this has to run in a browser as well — and nothing\n * here is a security claim. It only needs to be stable across processes and versions,\n * which a fixed arithmetic over a fixed string is.\n */\nfunction checksum(text: string): string {\n let low = 0x811c9dc5;\n let high = 0x01000193;\n for (let i = 0; i < text.length; i++) {\n const code = text.charCodeAt(i);\n low = Math.imul(low ^ code, 0x01000193) >>> 0;\n high = Math.imul(high ^ (code + i), 0x85ebca6b) >>> 0;\n }\n return low.toString(16).padStart(8, \"0\") + high.toString(16).padStart(8, \"0\");\n}\n","import { type CompileOptions, FIELD_OPERATORS, QUERY_OPERATORS, validate } from \"./core.js\";\nimport { JqlError } from \"./errors.js\";\nimport { isDateLiteral, isFieldReference, isPlainObject, resolveDate } from \"./internal/values.js\";\nimport type { LooseQuery, QueryLike, UntypedQuery } from \"./types.js\";\nimport type { Vocabulary } from \"./vocabulary.js\";\n\n/**\n * Splitting a query between a store and this engine.\n *\n * A backend can usually answer part of a question — an index on a field, an operator it has\n * natively — and nothing of the rest. The shape that works is the one HackerPot's stores\n * already use: push what the store can do, keep what it cannot, and make sure the two\n * together are exactly the question that was asked.\n *\n * That last part is the whole contract, and it is why this splits only on **conjunctions**.\n * A query's keys all have to hold, and so do the parts of an `$and`, so each one can go to\n * either side independently. Anything else — a branch of an `$or`, an operator inside a\n * condition — cannot be split without widening or narrowing what is asked, so a conjunct is\n * pushed whole or not at all:\n *\n * pushed ∧ remaining ≡ query\n *\n * The store filters with `pushed` and this engine filters what comes back with `remaining`.\n * Neither side is ever wider than the query, so a caller that runs only `pushed` gets too\n * many items rather than too few — but `complete` says when that is safe, and it is the only\n * thing worth checking before skipping the second pass.\n */\n\nexport interface Capabilities {\n /**\n * The fields the store can filter on, as the store names them — a path, after any\n * vocabulary alias is resolved. `\"all\"` for a store that can filter on anything.\n *\n * A vocabulary field that is *computed* is never pushed whatever this says: the store has\n * no way to run a function that lives here.\n */\n readonly fields?: readonly string[] | \"all\" | undefined;\n /** The operators the store can answer, or `\"all\"`. Names are JQL's, not the store's. */\n readonly operators?: readonly string[] | \"all\" | undefined;\n /** Whether the store can answer `$or`. Default `false`: plenty of key-value stores cannot. */\n readonly or?: boolean | undefined;\n /** Whether it can answer a negation — `$not`, `$nor`, `$ne`, `$nin`, `$exists: false`. Default `false`. */\n readonly not?: boolean | undefined;\n /**\n * A last word on one field's condition, for a store whose limits depend on the values\n * rather than only on the operator names.\n *\n * MongoDB is the example this exists for: it answers `$eq` exactly, but not `$eq` against\n * an embedded document (its equality is key-order sensitive where JQL's is not), and not\n * the case-insensitive form of one. Without a say on the values, a target has to choose\n * between dropping `$eq` altogether and pushing a clause that comes back with the wrong\n * rows.\n *\n * The condition is given as written, with a bare value shown as `{ $eq: value }`, and the\n * field under the name the store knows. Returning `false` keeps the clause here.\n */\n readonly accepts?: ((field: string, condition: Readonly<Record<string, unknown>>) => boolean) | undefined;\n}\n\nexport interface Kept {\n /** Where the conjunct is in the query. */\n readonly at: string;\n /** The conjunct itself. */\n readonly clause: unknown;\n /** Why the store cannot answer it. */\n readonly why: string;\n}\n\nexport interface Plan {\n /** What the store should filter by, or `undefined` when it can answer nothing. */\n readonly pushed: UntypedQuery | undefined;\n /** What this engine must still filter, or `undefined` when the store answers everything. */\n readonly remaining: UntypedQuery | undefined;\n /** True when `remaining` is `undefined`: the store's answer needs no second pass. */\n readonly complete: boolean;\n /** One entry per conjunct that stayed here, and why. */\n readonly kept: readonly Kept[];\n}\n\nconst KNOWN = new Set([...FIELD_OPERATORS, ...QUERY_OPERATORS, \"$field\"]);\n\n/**\n * Splits a query into the part a store can answer and the part that stays here.\n *\n * Relative dates in the pushed part are resolved to instants, so what the store receives is\n * self-contained: `{ \"$ago\": \"1h\" }` means nothing to a backend, and resolving it here keeps\n * both halves of the split judged against the same moment.\n */\nexport function plan<T, Extra extends object = {}>(query: QueryLike<T, NoInfer<Extra>>, capabilities: Capabilities, options: CompileOptions<Extra> = {}): Plan {\n if (typeof query === \"function\") throw new TypeError(\"a compiled predicate cannot be split: it is code, not a query\");\n // Refusing an invalid query here rather than handing half of it to a store, which would\n // find out later and with less to say about it.\n const verdict = validate(query, options as CompileOptions<object>);\n if (!verdict.valid) throw verdict.error;\n\n const now = options.now === undefined ? Date.now() : options.now();\n const vocabulary = options.vocabulary as Vocabulary<unknown, object> | undefined;\n const fields = capabilities.fields ?? \"all\";\n const operators = capabilities.operators ?? \"all\";\n const context: Splitting = {\n vocabulary,\n now,\n fields: fields === \"all\" ? \"all\" : new Set(fields),\n operators: operators === \"all\" ? \"all\" : new Set(operators),\n or: capabilities.or ?? false,\n not: capabilities.not ?? false,\n accepts: capabilities.accepts,\n };\n\n const pushed: Record<string, unknown>[] = [];\n const stays: Record<string, unknown>[] = [];\n const kept: Kept[] = [];\n for (const { clause, at } of conjuncts(query as LooseQuery, \"\")) {\n const why = unpushable(clause, context, at);\n if (why === undefined) pushed.push(resolve(clause, context) as Record<string, unknown>);\n else {\n stays.push(clause);\n kept.push({ at, clause, why });\n }\n }\n return {\n pushed: join(pushed),\n remaining: join(stays),\n complete: stays.length === 0,\n kept,\n };\n}\n\ninterface Splitting {\n readonly vocabulary: Vocabulary<unknown, object> | undefined;\n readonly now: number;\n readonly fields: ReadonlySet<string> | \"all\";\n readonly operators: ReadonlySet<string> | \"all\";\n readonly or: boolean;\n readonly not: boolean;\n readonly accepts: ((field: string, condition: Readonly<Record<string, unknown>>) => boolean) | undefined;\n}\n\n/** The parts of a query that all have to hold: its keys, and the parts of any `$and`. */\nfunction conjuncts(query: LooseQuery, at: string): { clause: Record<string, unknown>; at: string }[] {\n const out: { clause: Record<string, unknown>; at: string }[] = [];\n for (const [key, value] of Object.entries(query as Record<string, unknown>)) {\n const here = at === \"\" ? key : `${at}.${key}`;\n // A comment asks nothing, so neither side needs it.\n if (key === \"$comment\") continue;\n if (key === \"$and\" && Array.isArray(value)) {\n value.forEach((part, index) => {\n if (isPlainObject(part)) out.push(...conjuncts(part as LooseQuery, `${here}[${index}]`));\n });\n continue;\n }\n out.push({ clause: { [key]: value }, at: here });\n }\n return out;\n}\n\nfunction join(parts: readonly Record<string, unknown>[]): UntypedQuery | undefined {\n if (parts.length === 0) return undefined;\n const query = parts.length === 1 ? (parts[0] as Record<string, unknown>) : { $and: parts };\n return query as unknown as UntypedQuery;\n}\n\n/** Why the store cannot answer this conjunct, or `undefined` when it can. */\nfunction unpushable(clause: Record<string, unknown>, context: Splitting, at: string): string | undefined {\n for (const [key, value] of Object.entries(clause)) {\n const here = at === \"\" ? key : `${at}.${key}`;\n if (key.startsWith(\"$\")) {\n const why = unpushableOperator(key, value, context, here);\n if (why !== undefined) return why;\n continue;\n }\n const why = unpushableField(key, value, context, here);\n if (why !== undefined) return why;\n }\n return undefined;\n}\n\nfunction unpushableOperator(key: string, value: unknown, context: Splitting, at: string): string | undefined {\n switch (key) {\n case \"$and\":\n if (!Array.isArray(value)) return \"the clause is malformed\";\n for (const part of value) {\n if (!isPlainObject(part)) return \"the clause is malformed\";\n const why = unpushable(part as Record<string, unknown>, context, at);\n if (why !== undefined) return why;\n }\n return undefined;\n case \"$or\":\n case \"$nor\": {\n if (!context.or && key === \"$or\") return \"the store cannot answer an $or\";\n if (!context.not && key === \"$nor\") return \"the store cannot answer a negation\";\n if (!context.or && key === \"$nor\") return \"the store cannot answer an $or\";\n if (!Array.isArray(value) || value.length === 0) return \"the clause is malformed\";\n for (const part of value) {\n if (!isPlainObject(part)) return \"the clause is malformed\";\n // Every branch, because a branch left here would widen the other half.\n const why = unpushable(part as Record<string, unknown>, context, at);\n if (why !== undefined) return why;\n }\n return undefined;\n }\n case \"$not\": {\n if (!context.not) return \"the store cannot answer a negation\";\n if (!isPlainObject(value)) return \"the clause is malformed\";\n return unpushable(value as Record<string, unknown>, context, at);\n }\n case \"$text\":\n return allows(context, \"$text\") ? undefined : \"the store cannot answer a text search\";\n default:\n // A field operator at the top of a query tests the item itself, which no store does.\n return `the store cannot test the item itself with \"${key}\"`;\n }\n}\n\nfunction unpushableField(name: string, value: unknown, context: Splitting, at: string): string | undefined {\n const field = context.vocabulary?.lookup.get(name.toLowerCase());\n if (field?.get !== undefined) return `\"${name}\" is computed here, so the store has no such field`;\n // The same resolution the pushed clause gets, so what is checked against the capabilities\n // is the name the store will actually be asked about. Checked one way and pushed another,\n // `city.zone` was tested as itself and sent as `address.city.zone`.\n const stored = storedName(name, context);\n if (context.fields !== \"all\" && !context.fields.has(stored)) return `the store cannot filter on \"${stored}\"`;\n\n if (isFieldReference(value)) return allows(context, \"$field\") ? undefined : \"the store cannot compare two fields\";\n if (!isPlainObject(value) || isDateLiteral(value)) {\n if (!allows(context, \"$eq\")) return 'the store cannot answer \"$eq\"';\n return accepted(context, stored, { $eq: value });\n }\n const keys = Object.keys(value);\n if (!keys.every((key) => key.startsWith(\"$\"))) {\n if (!allows(context, \"$eq\")) return 'the store cannot answer \"$eq\"';\n return accepted(context, stored, { $eq: value });\n }\n\n for (const key of keys) {\n if (key === \"$options\" || key === \"$comment\") continue;\n if (!KNOWN.has(key)) return `\"${key}\" is an added operator, which only this engine has`;\n if (!allows(context, key)) return `the store cannot answer \"${key}\"`;\n if ((key === \"$ne\" || key === \"$nin\" || key === \"$not\" || (key === \"$exists\" && value[key] === false)) && !context.not) {\n return \"the store cannot answer a negation\";\n }\n const operand = value[key];\n if (isFieldReference(operand) && !allows(context, \"$field\")) return \"the store cannot compare two fields\";\n if (key === \"$elemMatch\") {\n if (!isPlainObject(operand)) return \"the clause is malformed\";\n const why = unpushable(operand as Record<string, unknown>, context, at);\n if (why !== undefined) return why;\n }\n if (key === \"$not\") {\n if (!isPlainObject(operand)) return \"the clause is malformed\";\n const why = unpushableField(name, operand, context, at);\n if (why !== undefined) return why;\n }\n }\n return accepted(context, stored, value);\n}\n\n/** The store's own last word on a condition it could otherwise answer. */\nfunction accepted(context: Splitting, field: string, condition: Readonly<Record<string, unknown>>): string | undefined {\n if (context.accepts === undefined || context.accepts(field, condition)) return undefined;\n return \"the store cannot answer this condition's values\";\n}\n\nfunction allows(context: Splitting, operator: string): boolean {\n return context.operators === \"all\" || context.operators.has(operator);\n}\n\n/**\n * The clause as the store should receive it: field names it knows, and instants rather than\n * durations.\n *\n * Both rewrites exist for the same reason — what is pushed has to stand on its own. A store\n * cannot read `{ \"$ago\": \"1h\" }`, and resolving it here, once, from the same clock the\n * engine uses, keeps both halves of the split talking about the same hour.\n *\n * And a **vocabulary name is local to this process.** The capability check asks whether the\n * store can filter on `customer.country`; handing it `{ \"cc\": \"GB\" }` afterwards asks about\n * a field the store has never heard of, which answers nothing — while `complete` says no\n * second pass is needed. That combination is a filter that looks answered and returns an\n * empty page, so the names go out resolved.\n */\nfunction resolve(value: unknown, context: Splitting): unknown {\n if (!isPlainObject(value)) return value;\n const out: Record<string, unknown> = {};\n for (const [key, held] of Object.entries(value)) {\n switch (key) {\n case \"$and\":\n case \"$or\":\n case \"$nor\":\n out[key] = Array.isArray(held) ? held.map((part) => resolve(part, context)) : held;\n break;\n case \"$not\":\n out[key] = resolve(held, context);\n break;\n case \"$text\":\n out[key] = resolveText(held, context);\n break;\n default:\n // A field key is renamed to what the store calls it; anything else at this level is\n // an operator testing the item itself, whose operand is a condition's like any other.\n if (key.startsWith(\"$\")) out[key] = resolveOperand(key, held, context);\n else out[storedName(key, context)] = resolveCondition(held, context);\n break;\n }\n }\n return out;\n}\n\n/** A field's condition, with its operands resolved and its *literals* left alone. */\nfunction resolveCondition(value: unknown, context: Splitting): unknown {\n if (!isPlainObject(value)) return resolveLiteral(value, context);\n if (isDateLiteral(value) || isFieldReference(value)) return resolveOperand(\"$eq\", value, context);\n const keys = Object.keys(value);\n if (keys.length === 0 || !keys.every((key) => key.startsWith(\"$\"))) return resolveLiteral(value, context);\n const out: Record<string, unknown> = {};\n for (const key of keys) out[key] = resolveOperand(key, value[key], context);\n return out;\n}\n\nfunction resolveOperand(key: string, operand: unknown, context: Splitting): unknown {\n // A query, not a value.\n if (key === \"$elemMatch\") return resolve(operand, context);\n if (key === \"$not\") return resolveCondition(operand, context);\n // The one place a field name stands where a value would: it names a field, so it is\n // resolved like one. Left as written, the store was asked to compare with a field it has\n // no name for, and matched nothing.\n if (isFieldReference(operand)) return { $field: storedName(operand.$field, context) };\n if (Array.isArray(operand)) return operand.map((item) => (isFieldReference(item) ? { $field: storedName(item.$field, context) } : resolveLiteral(item, context)));\n return resolveLiteral(operand, context);\n}\n\n/** A text search: the fields it names are fields, and are resolved as such. */\nfunction resolveText(value: unknown, context: Splitting): unknown {\n if (!isPlainObject(value) || !Array.isArray(value.$fields)) return value;\n return { ...value, $fields: value.$fields.map((name) => (typeof name === \"string\" ? storedName(name, context) : name)) };\n}\n\n/**\n * A value being compared with: dates become instants, and nothing else is touched.\n *\n * Its keys in particular are **not** renamed. Walked as though it were a query,\n * `{ name: { $eq: { city: \"Paris\" } } }` was pushed as a comparison with\n * `{ \"address.city\": \"Paris\" }` — an object no document holds — while `complete` said the\n * store had answered.\n */\nfunction resolveLiteral(value: unknown, context: Splitting): unknown {\n if (Array.isArray(value)) return value.map((item) => resolveLiteral(item, context));\n if (!isPlainObject(value)) return value;\n if (isDateLiteral(value)) {\n const time = resolveDate(value.$date, context.now);\n if (Number.isNaN(time)) throw new JqlError(`${JSON.stringify(value.$date)} is not a date`);\n return { $date: time };\n }\n const out: Record<string, unknown> = {};\n for (const [key, held] of Object.entries(value)) out[key] = resolveLiteral(held, context);\n return out;\n}\n\n/** A field name as the store knows it: the vocabulary's path, or the name as written. */\nfunction storedName(key: string, context: Splitting): string {\n if (key.startsWith(\"$\") || context.vocabulary === undefined) return key;\n const field = context.vocabulary.lookup.get(key.toLowerCase());\n if (field !== undefined) return field.path;\n // A path that begins with a vocabulary name — `country.region` — is that field's path and\n // the rest of the walk.\n const dot = key.indexOf(\".\");\n if (dot > 0) {\n const head = context.vocabulary.lookup.get(key.slice(0, dot).toLowerCase());\n if (head !== undefined && head.get === undefined) return `${head.path}${key.slice(dot)}`;\n }\n return key;\n}\n","import { compile, type CompileOptions } from \"./core.js\";\nimport { planRequest } from \"./search.js\";\nimport type { FieldName, QueryLike, Request, Source } from \"./types.js\";\n\n/**\n * The same questions, asked of something that arrives over time.\n *\n * A log file read line by line, a cursor over a store, a stream of events: the items are\n * the same shape, and the query that filters an array should filter these. Everything here\n * is the ordinary engine with an `await` in the loop — the query is compiled once, before\n * the first item, and the helpers stop reading as soon as the answer cannot change.\n *\n * That last property is the point of `filterStream` and of a limit: a source that never\n * ends still answers \"the first twenty matches\", because nothing pulls from it afterwards.\n * Sorting is the exception and says so — an order over items you have not seen yet is not\n * an order — so `searchAsync` with a sort reads the whole source, keeping only the page it\n * was asked for.\n */\n\n/** Anything that yields items, now or later. */\nexport type AsyncSource<T> = AsyncIterable<T> | Source<T> | ReadonlyMap<unknown, T>;\n\n/** One loop over any of the shapes a source can take. */\nasync function* iterate<T>(source: AsyncSource<T>): AsyncGenerator<T> {\n if (Array.isArray(source)) {\n for (let i = 0; i < source.length; i++) yield source[i] as T;\n return;\n }\n if (source instanceof Map) {\n for (const item of source.values()) yield item as T;\n return;\n }\n if (typeof (source as AsyncIterable<T>)[Symbol.asyncIterator] === \"function\") {\n for await (const item of source as AsyncIterable<T>) yield item;\n return;\n }\n if (typeof (source as Iterable<T>)[Symbol.iterator] === \"function\") {\n for (const item of source as Iterable<T>) yield item;\n return;\n }\n const list = source as ArrayLike<T>;\n for (let i = 0; i < list.length; i++) yield list[i] as T;\n}\n\n/** Every matching item, as they arrive. The caller can stop at any point, and the source stops with it. */\nexport async function* filterStream<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n query: QueryLike<T, NoInfer<Extra>>,\n options?: CompileOptions<Extra>,\n): AsyncGenerator<T> {\n const test = compile(query, options);\n for await (const item of iterate(source)) if (test(item)) yield item;\n}\n\n/** The first match, or `undefined`. Stops reading at it. */\nexport async function findAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n query: QueryLike<T, NoInfer<Extra>>,\n options?: CompileOptions<Extra>,\n): Promise<T | undefined> {\n for await (const item of filterStream(source, query, options)) return item;\n return undefined;\n}\n\n/** Every match, as an array. Reads the whole source, so give an endless one a limit through `searchAsync`. */\nexport async function filterAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n query: QueryLike<T, NoInfer<Extra>>,\n options?: CompileOptions<Extra>,\n): Promise<T[]> {\n const out: T[] = [];\n for await (const item of filterStream(source, query, options)) out.push(item);\n return out;\n}\n\n/** How many match. */\nexport async function countAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n query: QueryLike<T, NoInfer<Extra>>,\n options?: CompileOptions<Extra>,\n): Promise<number> {\n let total = 0;\n const test = compile(query, options);\n for await (const item of iterate(source)) if (test(item)) total++;\n return total;\n}\n\n/** Whether any item matches. Stops at the first. */\nexport async function someAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n query: QueryLike<T, NoInfer<Extra>>,\n options?: CompileOptions<Extra>,\n): Promise<boolean> {\n // Not `findAsync(…) !== undefined`: an item that *is* `undefined` matched `{}` and was\n // then reported as nothing found, where the synchronous `some` said true.\n const test = compile(query, options);\n for await (const item of iterate(source)) if (test(item)) return true;\n return false;\n}\n\n/** Whether every item matches. True for an empty source. Stops at the first that does not. */\nexport async function everyAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n query: QueryLike<T, NoInfer<Extra>>,\n options?: CompileOptions<Extra>,\n): Promise<boolean> {\n const test = compile(query, options);\n for await (const item of iterate(source)) if (!test(item)) return false;\n return true;\n}\n\n/**\n * A whole request over a source that arrives over time.\n *\n * Without a sort it stops as soon as the page is full, so an endless source still answers.\n * With a sort it reads everything — it has to — but holds only `skip + limit` items while\n * it does, the same bounded heap the synchronous version uses.\n */\nexport async function searchAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n request: Request<T, NoInfer<Extra>> & { readonly fields: readonly FieldName<T, NoInfer<Extra>>[] },\n options?: CompileOptions<Extra>,\n): Promise<Record<string, unknown>[]>;\nexport async function searchAsync<T, Extra extends object = {}>(\n source: AsyncSource<T>,\n request: Request<T, NoInfer<Extra>> & { readonly omit: readonly FieldName<T, NoInfer<Extra>>[] },\n options?: CompileOptions<Extra>,\n): Promise<Partial<T>[]>;\nexport async function searchAsync<T, Extra extends object = {}>(source: AsyncSource<T>, request?: Request<T, NoInfer<Extra>>, options?: CompileOptions<Extra>): Promise<T[]>;\nexport async function searchAsync<T>(source: AsyncSource<T>, request: Request<T, object> = {}, options: CompileOptions<object> = {}): Promise<unknown[]> {\n const plan = planRequest<T>(request, options);\n const collect = plan.collect();\n let index = 0;\n for await (const item of iterate(source)) {\n const position = index++;\n if (plan.test !== undefined && !plan.test(item)) continue;\n if (collect.offer(item, position)) break;\n }\n return plan.shape(collect.finish());\n}\n"]}
@@ -8,5 +8,5 @@ export { parseText, MAX_TEXT_CHARS, MAX_TEXT_DEPTH, TEXT_OPERATORS } from "./par
8
8
  export { suggest } from "./suggest.js";
9
9
  export { toText } from "./write.js";
10
10
  export type { TextOptions } from "./parse.js";
11
- export type { Suggestions } from "./suggest.js";
11
+ export type { Suggestions, SuggestOptions } from "./suggest.js";
12
12
  export type { TextForm, Unexpressed } from "./write.js";
@@ -20,7 +20,8 @@ import { type Vocabulary } from "../vocabulary.js";
20
20
  * at:>-1h the last hour, and it stays the last hour
21
21
  * has:rule -has:rule the field is set, or is not
22
22
  * (verdict:human $or score:<20) $and $not path:/health
23
- * "GET /api/v2/orders" a phrase, spaces and all
23
+ * "connection reset" a phrase, spaces and all — matched against one
24
+ * value, never joined across two fields
24
25
  * ```
25
26
  *
26
27
  * **Adjacent terms mean AND**, which is what narrowing means. `$or` binds more loosely than
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Writing a value so the tokenizer reads it back whole.
3
+ *
4
+ * Shared by the writer and by completion, because both hand a value to somebody who will
5
+ * feed it straight back to the parser. They disagreed once: `toText` quoted a value with a
6
+ * space in it and `suggest` did not, so completing `status:` with `in progress` produced
7
+ * `status:in progress` — which parses as `status:in` and a loose search word. A completion
8
+ * that changes the query is worse than no completion at all, and one copy of this rule is
9
+ * how the two stay honest.
10
+ */
11
+ /**
12
+ * The value, quoted if it has to be — or `undefined` when the syntax cannot write it.
13
+ *
14
+ * `inSet` is for a value inside `$in(…)`, where a comma separates values and so has to be
15
+ * quoted as well.
16
+ */
17
+ export declare function quote(value: string, inSet: boolean): string | undefined;
@@ -3,14 +3,36 @@ import { type Vocabulary } from "../vocabulary.js";
3
3
  * What to offer for the token the caret is in.
4
4
  *
5
5
  * Returns the completions and the span they replace, so a caller can put one in without
6
- * disturbing the rest of the input. A token that already names a field with a closed set
7
- * of values completes the value; anything else completes the field name. Every name
8
- * offered comes from the vocabulary the parser reads, so nothing offered is something the
9
- * language would not accept.
6
+ * disturbing the rest of the input. A token that already names a field with a known set of
7
+ * values completes the value; anything else completes the field name. Every name offered
8
+ * comes from the vocabulary the parser reads, so nothing offered is something the language
9
+ * would not accept.
10
+ *
11
+ * The rule the whole module is written to: **what is offered, inserted, means what it
12
+ * says.** A completion is text somebody will press Tab on without reading, so one that
13
+ * parses into a different query is worse than no completion — the box looks as though it
14
+ * filled itself in correctly and the result is wrong.
10
15
  */
11
16
  export interface Suggestions {
12
17
  readonly options: readonly string[];
13
18
  readonly from: number;
14
19
  readonly to: number;
15
20
  }
16
- export declare function suggest(input: string, caret: number, vocabulary?: Vocabulary<never, object>): Suggestions;
21
+ /** Anything completion needs that the vocabulary cannot know when it is written. */
22
+ export interface SuggestOptions {
23
+ /**
24
+ * Values seen at run time, by field name — the statuses actually in the table, the paths
25
+ * actually in the log.
26
+ *
27
+ * A vocabulary's `values` is a *closed set*: what the field is allowed to hold, known
28
+ * when the vocabulary is written. Plenty of fields have no such set and still have a
29
+ * handful of values in practice, and a console that has just listed a thousand rows knows
30
+ * them. Passing them here completes the field; leaving them out still offers nothing,
31
+ * because guessing is inventing options rather than completing them.
32
+ *
33
+ * Declared values come first and the two are merged, so a field may have both. Names are
34
+ * resolved through the vocabulary, so an alias works.
35
+ */
36
+ readonly values?: Readonly<Record<string, readonly string[]>> | undefined;
37
+ }
38
+ export declare function suggest(input: string, caret: number, vocabulary?: Vocabulary<never, object>, options?: SuggestOptions): Suggestions;