@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.
- package/CHANGELOG.md +44 -1
- package/conformance/cases.json +2 -0
- package/dist/chunk-2ZMIVDES.cjs +1661 -0
- package/dist/chunk-2ZMIVDES.cjs.map +1 -0
- package/dist/chunk-6PWYYYWU.js +1637 -0
- package/dist/chunk-6PWYYYWU.js.map +1 -0
- package/dist/chunk-74QKHM6Y.cjs +145 -0
- package/dist/chunk-74QKHM6Y.cjs.map +1 -0
- package/dist/chunk-ATRXHPBJ.js +112 -0
- package/dist/chunk-ATRXHPBJ.js.map +1 -0
- package/dist/chunk-EJFHVGBC.cjs +63 -0
- package/dist/chunk-EJFHVGBC.cjs.map +1 -0
- package/dist/chunk-ITPY6VTV.cjs +115 -0
- package/dist/chunk-ITPY6VTV.cjs.map +1 -0
- package/dist/chunk-JK6OYDLX.js +712 -0
- package/dist/chunk-JK6OYDLX.js.map +1 -0
- package/dist/chunk-N7DS4QNW.js +60 -0
- package/dist/chunk-N7DS4QNW.js.map +1 -0
- package/dist/chunk-PNBQ2HIJ.js +133 -0
- package/dist/chunk-PNBQ2HIJ.js.map +1 -0
- package/dist/chunk-VMFEQXBB.js +578 -0
- package/dist/chunk-VMFEQXBB.js.map +1 -0
- package/dist/cjs/text/index.d.ts +1 -1
- package/dist/cjs/text/parse.d.ts +2 -1
- package/dist/cjs/text/quote.d.ts +17 -0
- package/dist/cjs/text/suggest.d.ts +27 -5
- package/dist/cli.js +13 -2395
- package/dist/cli.js.map +1 -1
- package/dist/global.cjs +26 -1849
- package/dist/global.cjs.map +1 -1
- package/dist/global.js +8 -1831
- package/dist/global.js.map +1 -1
- package/dist/index.cjs +143 -1996
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2493
- package/dist/index.js.map +1 -1
- package/dist/mongo.cjs +20 -119
- package/dist/mongo.cjs.map +1 -1
- package/dist/mongo.js +2 -101
- package/dist/mongo.js.map +1 -1
- package/dist/text/index.d.ts +1 -1
- package/dist/text/parse.d.ts +2 -1
- package/dist/text/quote.d.ts +17 -0
- package/dist/text/suggest.d.ts +27 -5
- package/dist/text.cjs +146 -101
- package/dist/text.cjs.map +1 -1
- package/dist/text.js +3 -665
- package/dist/text.js.map +1 -1
- package/docs/course/11-the-search-box.md +49 -2
- package/docs/course/16-extending.md +1 -1
- package/docs/reference/api.md +14 -1
- package/docs/reference/specification.md +9 -2
- package/docs/reference/text-syntax.md +41 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
### Added
|
|
6
6
|
|
|
7
7
|
- **The JSON Query Language, version 1.1.** A specification in `docs/reference/specification.md`
|
|
8
|
-
and a conformance suite in `conformance/cases.json` of
|
|
8
|
+
and a conformance suite in `conformance/cases.json` of 158 matching cases and 27 request
|
|
9
9
|
cases that any implementation, in any language, must pass. The operator names are the
|
|
10
10
|
conventional ones, and the array rules are written out in full rather than left to a
|
|
11
11
|
reader's memory of another system. 1.1 is 1.0 plus `$glob`, `$length`, `{ "$field": … }`, relative dates and `omit`;
|
|
@@ -82,8 +82,51 @@
|
|
|
82
82
|
against the packed tarball so they cannot drift from what the library does. Writing it found
|
|
83
83
|
two defects, both listed below.
|
|
84
84
|
|
|
85
|
+
- **`suggest` takes the values you have seen.** A vocabulary's `values` is a closed set,
|
|
86
|
+
decided when the vocabulary is written; plenty of fields have no such set and still have a
|
|
87
|
+
handful of values in practice, and the console that has just listed a thousand rows is the
|
|
88
|
+
only thing that knows them. `suggest(input, caret, vocabulary, { values: { owner: [...] } })`
|
|
89
|
+
completes from those. A field with neither still offers nothing, because guessing is
|
|
90
|
+
inventing options rather than completing them; declared values come first and the two
|
|
91
|
+
merge, and a name resolves through the vocabulary so an alias works.
|
|
92
|
+
|
|
85
93
|
### Fixed
|
|
86
94
|
|
|
95
|
+
- **A completion could change the query it completed.** `suggest` offered a value exactly as
|
|
96
|
+
the vocabulary spelled it, so a field whose values hold a space completed `status:` to
|
|
97
|
+
`status:in progress` — which parses as `status:in` *and* a loose search word, a different
|
|
98
|
+
question with nothing on screen to say so. Completions are now written the way the parser
|
|
99
|
+
reads them back: quoted where they have to be, with the quote picked so it does not clash
|
|
100
|
+
with the value, and a value the syntax cannot write at all (one holding both kinds of
|
|
101
|
+
quote) left out rather than offered in a form that means less. The writer and completion
|
|
102
|
+
now share one copy of that rule, which is what let them disagree in the first place.
|
|
103
|
+
- **Completion stopped the moment a quote was opened.** The token under the caret was found
|
|
104
|
+
by splitting on the last space, so `status:"in pro` looked like a fresh token `pro`
|
|
105
|
+
starting after the space: nothing was offered, and the span handed back would have cut the
|
|
106
|
+
input in half. It now replays the parser's own tokenizer, so the two agree about where a
|
|
107
|
+
token begins — and completion works inside an open quote and inside a `$in(…)` set, where
|
|
108
|
+
it keeps the values already chosen.
|
|
109
|
+
- **A phrase spanning two fields was documented as something it never matched.** `$text`
|
|
110
|
+
matches a phrase against one value at a time and never joins values first, so
|
|
111
|
+
`"GET /api/v2"` finds nothing when `GET` is the `method` and `/api/v2` is the `path` — and
|
|
112
|
+
naming both in a vocabulary's `text` list does not change that. The reference said
|
|
113
|
+
otherwise by example. Specification §6.3 now states the rule, two conformance cases pin it,
|
|
114
|
+
and the guide shows the way to ask that question: a computed field holding the joined
|
|
115
|
+
value, which is then one field like any other.
|
|
116
|
+
- **The tarball check read one npm's output and not the next one's.** `npm pack --json`
|
|
117
|
+
reports a package as an array of one entry up to npm 11 and as an object keyed by package
|
|
118
|
+
name from npm 12, so on a newer npm the list of packed files came back empty and the check
|
|
119
|
+
announced that `conformance/cases.json` was not in the package — about a file that was
|
|
120
|
+
plainly in it. It reads either shape now, and refuses a third it does not recognise rather
|
|
121
|
+
than reporting every required file as missing.
|
|
122
|
+
- **Two entry points carried two copies of the library.** Each was built on its own with code
|
|
123
|
+
splitting off, so every entry inlined whatever it reached: twenty of twenty-seven source
|
|
124
|
+
modules were compiled into more than one bundle, and an application importing `@osqd/jql`
|
|
125
|
+
and `@osqd/jql/global` — the documented way to get the array methods — loaded the engine
|
|
126
|
+
twice. They are built together now and share their code, which took the ES-module output
|
|
127
|
+
from 315 KB to 152 KB, and `check:package` reads the source maps and fails if any module
|
|
128
|
+
is ever compiled into two outputs again.
|
|
129
|
+
|
|
87
130
|
- **A path longer than 64 segments matched but was left out of the result.** The engine
|
|
88
131
|
followed a path to any depth while `fields` walked its own tree and stopped at sixty-four,
|
|
89
132
|
silently, so a request could match an item on `a.b.c…` and hand back a copy without it —
|
package/conformance/cases.json
CHANGED
|
@@ -228,6 +228,8 @@
|
|
|
228
228
|
{ "group": "text", "name": "$text never reads a key as text", "documents": "people", "query": { "$text": "languages" }, "matches": [] },
|
|
229
229
|
{ "group": "text", "name": "$text in named fields only", "documents": "people", "query": { "$text": { "$search": "tor", "$fields": ["nick"] } }, "matches": [3] },
|
|
230
230
|
{ "group": "text", "name": "$text case-sensitive", "documents": "people", "query": { "$text": { "$search": "Tor", "$caseSensitive": true } }, "matches": [3] },
|
|
231
|
+
{ "group": "text", "name": "a phrase is matched against one value, never across two", "documents": "people", "query": { "$text": "Lovelace London" }, "matches": [] },
|
|
232
|
+
{ "group": "text", "name": "naming several fields does not join them either", "documents": "people", "query": { "$text": { "$search": "Lovelace London", "$fields": ["name", "address.city"] } }, "matches": [] },
|
|
231
233
|
{ "group": "text", "name": "an empty $text matches everything", "documents": "people", "query": { "$text": "" }, "matches": [0, 1, 2, 3] },
|
|
232
234
|
{ "group": "references", "name": "one field greater than another", "documents": "pairs", "query": { "out": { "$gt": { "$field": "in" } } }, "matches": [0, 5] },
|
|
233
235
|
{ "group": "references", "name": "one field equal to another, written as a value", "documents": "pairs", "query": { "out": { "$field": "in" } }, "matches": [2] },
|