edfcore 0.6.274 → 0.6.275
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/dist/annotations-query.d.ts.map +1 -1
- package/dist/annotations-query.js +27 -0
- package/dist/annotations-query.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/docs/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/src/annotations-query.ts +29 -0
- package/src/constants.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAmDrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CA6E1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAmDrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CA6E1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,CA8C1B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,aAAa,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CASlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,EAAE,MAAM,GACd,SAAS,aAAa,EAAE,CA2B1B"}
|
|
@@ -172,6 +172,33 @@ export function filterAnnotationsByText(annotations, match) {
|
|
|
172
172
|
matchesText(match)
|
|
173
173
|
: assertMatcher(match, 'filterAnnotationsByText', 'a string matched verbatim, a RegExp, or a predicate on the text', 'pass the label as a string, or (text) => text.trim() === label for a file whose ' +
|
|
174
174
|
'vocabulary is padded');
|
|
175
|
+
/*
|
|
176
|
+
* An ASYNC predicate, which keeps EVERYTHING.
|
|
177
|
+
*
|
|
178
|
+
* 0.6.274 closed this in `matchSignals`, where an async predicate matched every channel. Here the
|
|
179
|
+
* cost points the other way: the three query helpers in this module "answer with a list", and this
|
|
180
|
+
* module's own note says why that matters — "a wrong one reads as a recording with nothing in it".
|
|
181
|
+
* A filter that keeps everything reads as a recording where every event matched, which on a
|
|
182
|
+
* scoring file is a listing nobody can tell from a correct one.
|
|
183
|
+
*
|
|
184
|
+
* A Promise is always truthy, so the answer never mattered. `isScoredEvent(text)` against a
|
|
185
|
+
* database or a server is where it comes from, and the predicate wrapping it is the obvious thing
|
|
186
|
+
* to write.
|
|
187
|
+
*
|
|
188
|
+
* Tested on the first annotation's answer rather than by inspecting the function, for the reason
|
|
189
|
+
* 0.6.274 gives: `AsyncFunction` is not the only way to return a Promise. A `.then` property read,
|
|
190
|
+
* never a call.
|
|
191
|
+
*/
|
|
192
|
+
const first = annotations[0];
|
|
193
|
+
if (first !== undefined) {
|
|
194
|
+
const answered = test(first.text);
|
|
195
|
+
if (typeof answered?.then === 'function') {
|
|
196
|
+
throw new RangeError('filterAnnotationsByText(): the predicate returned a pending Promise, and a Promise is ' +
|
|
197
|
+
'always truthy — so every annotation would have been kept, and a list that kept ' +
|
|
198
|
+
'everything reads as a recording where everything matched. Next: make the predicate ' +
|
|
199
|
+
'synchronous; resolve whatever it needs first, then match against the resolved value.');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
175
202
|
return Object.freeze(annotations.filter((annotation) => test(annotation.text)));
|
|
176
203
|
}
|
|
177
204
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations-query.js","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;;GAYG;AACH,SAAS,iBAAiB,CAAC,WAAqC,EAAE,IAAY;IAC5E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,2BAA2B,aAAa,CAAC,WAAW,CAAC,iCAAiC;YAC3F,0FAA0F;YAC1F,4CAA4C,CAC/C,CAAC;IACJ,CAAC;IACD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAwD,CAAC;IACpF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,EAAE,yBAAyB,KAAK,QAAQ;QAAE,OAAO;IAC7F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,GAAG,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC;QAChD,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC/E,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -109,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
|
|
|
109
109
|
readonly reserved: 224;
|
|
110
110
|
};
|
|
111
111
|
/** Published package version. Kept in sync with package.json by a test. */
|
|
112
|
-
export declare const VERSION = "0.6.
|
|
112
|
+
export declare const VERSION = "0.6.275";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ alone does not tell you whether you were affected.
|
|
|
6
6
|
edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
|
|
7
7
|
defect; those are called out below.
|
|
8
8
|
|
|
9
|
+
## 0.6.275
|
|
10
|
+
|
|
11
|
+
- **Fixed** `filterAnnotationsByText(annotations, async (text) => …)` keeping every event. 0.6.274
|
|
12
|
+
closed this in `matchSignals`; here the cost points the other way. This module's note says what
|
|
13
|
+
makes a wrong answer dangerous in these calls — three of them "answer with a list, so a wrong one
|
|
14
|
+
reads as a recording with nothing in it" — and a filter that keeps everything is the same confusion
|
|
15
|
+
from the other side: on a scoring file with fifty thousand events, a listing nobody can tell from a
|
|
16
|
+
correct one.
|
|
17
|
+
- A Promise is always truthy, so the predicate's answer never mattered. `isScoredEvent(text)` against
|
|
18
|
+
a database or a server is async, and the predicate wrapping it is the obvious thing to write.
|
|
19
|
+
- Tested on the first annotation's answer rather than by inspecting the function, because
|
|
20
|
+
`AsyncFunction` is not the only way to return a Promise. A `.then` property read, never a call.
|
|
21
|
+
- The string and RegExp forms never had this problem and are unchanged, a truthy non-boolean is still
|
|
22
|
+
accepted, and an empty list has no first answer to test, so nothing changes for it.
|
|
23
|
+
|
|
9
24
|
## 0.6.274
|
|
10
25
|
|
|
11
26
|
- **Fixed** `matchSignals(header, async (label) => …)` matching every channel in the file.
|
package/package.json
CHANGED
package/src/annotations-query.ts
CHANGED
|
@@ -198,6 +198,35 @@ export function filterAnnotationsByText(
|
|
|
198
198
|
'pass the label as a string, or (text) => text.trim() === label for a file whose ' +
|
|
199
199
|
'vocabulary is padded',
|
|
200
200
|
);
|
|
201
|
+
/*
|
|
202
|
+
* An ASYNC predicate, which keeps EVERYTHING.
|
|
203
|
+
*
|
|
204
|
+
* 0.6.274 closed this in `matchSignals`, where an async predicate matched every channel. Here the
|
|
205
|
+
* cost points the other way: the three query helpers in this module "answer with a list", and this
|
|
206
|
+
* module's own note says why that matters — "a wrong one reads as a recording with nothing in it".
|
|
207
|
+
* A filter that keeps everything reads as a recording where every event matched, which on a
|
|
208
|
+
* scoring file is a listing nobody can tell from a correct one.
|
|
209
|
+
*
|
|
210
|
+
* A Promise is always truthy, so the answer never mattered. `isScoredEvent(text)` against a
|
|
211
|
+
* database or a server is where it comes from, and the predicate wrapping it is the obvious thing
|
|
212
|
+
* to write.
|
|
213
|
+
*
|
|
214
|
+
* Tested on the first annotation's answer rather than by inspecting the function, for the reason
|
|
215
|
+
* 0.6.274 gives: `AsyncFunction` is not the only way to return a Promise. A `.then` property read,
|
|
216
|
+
* never a call.
|
|
217
|
+
*/
|
|
218
|
+
const first = annotations[0];
|
|
219
|
+
if (first !== undefined) {
|
|
220
|
+
const answered = test(first.text) as unknown;
|
|
221
|
+
if (typeof (answered as { then?: unknown } | null | undefined)?.then === 'function') {
|
|
222
|
+
throw new RangeError(
|
|
223
|
+
'filterAnnotationsByText(): the predicate returned a pending Promise, and a Promise is ' +
|
|
224
|
+
'always truthy — so every annotation would have been kept, and a list that kept ' +
|
|
225
|
+
'everything reads as a recording where everything matched. Next: make the predicate ' +
|
|
226
|
+
'synchronous; resolve whatever it needs first, then match against the resolved value.',
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
201
230
|
return Object.freeze(annotations.filter((annotation) => test(annotation.text)));
|
|
202
231
|
}
|
|
203
232
|
|
package/src/constants.ts
CHANGED