edfcore 0.6.168 → 0.6.170

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/README.md CHANGED
@@ -81,7 +81,7 @@ for (const event of annotations) {
81
81
  }
82
82
  ```
83
83
 
84
- > **Status: 0.6.x, early.** edfcore runs 4,000+ tests on generated fixtures, and it's checked
84
+ > **Status: 0.6.x, early.** edfcore runs 4,500+ tests on generated fixtures, and it's checked
85
85
  > against public corpora it didn't author: the EDF, EDF+ and 24-bit BDF+ test files from
86
86
  > teuniz.net, and PhysioNet's sleep-edfx (a real 22-hour polysomnography recording and its
87
87
  > sleep-staging file). Those checks are numeric. Channels labelled `sine 8.5 Hz` decode to
@@ -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;AAwBrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CAkC1B;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,CAiB1B;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,CAU1B"}
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;AAwBrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CAwD1B;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,CAiB1B;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,CAU1B"}
@@ -60,6 +60,26 @@ export function filterAnnotationsByTime(annotations, window) {
60
60
  throw new RangeError(`filterAnnotationsByTime(): the window is ${describeValue(window)}, not an object. ` +
61
61
  'Next: pass a window carrying startSeconds and durationSeconds.');
62
62
  }
63
+ /*
64
+ * An ARRAY, which is an object and therefore walked straight past the check above.
65
+ *
66
+ * 0.6.167 closed this route for the reading API's selection and recorded what it costs: an array
67
+ * "reproduced the exact failure 0.6.79 removed — each call named whichever field it happened to
68
+ * read first". Here that field is `window.startSeconds`, and the advice attached to an absent
69
+ * bound is about "an object whose bounds are spelled something else" — which sends a reader to
70
+ * rename fields on a value that has none.
71
+ *
72
+ * The array a caller has in hand is the one this function's own neighbour returns.
73
+ * `resolveTimeWindow` is named for the window and returns the RECORD RANGES it maps to, so
74
+ * `const window = resolveTimeWindow(timeline, index, from, span)` reads exactly like the argument
75
+ * this takes.
76
+ */
77
+ if (Array.isArray(window)) {
78
+ throw new RangeError('filterAnnotationsByTime(): the window is an array, and this call bounds events by time ' +
79
+ 'rather than by record. resolveTimeWindow() returns the record ranges a window maps to, ' +
80
+ 'not the window. Next: pass the startSeconds and durationSeconds you gave that call, on ' +
81
+ 'an object.');
82
+ }
63
83
  const from = secondsToTicks(window.startSeconds, 'window.startSeconds');
64
84
  const to = from + secondsToTicks(window.durationSeconds, 'window.durationSeconds');
65
85
  if (to <= from)
@@ -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,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO;IACvC,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,2BAA2B,aAAa,CAAC,WAAW,CAAC,iCAAiC;QAC3F,0FAA0F;QAC1F,4CAA4C,CAC/C,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAqC,EACrC,MAA2B;IAE3B,iBAAiB,CAAC,WAAW,EAAE,yBAAyB,CAAC,CAAC;IAC1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MAAM,UAAU,aAAa,CAC3B,WAAqC,EACrC,OAAe;IAEf,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,MAAM,CAClB,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACnD,MAAM,QAAQ,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"}
@@ -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.168";
112
+ export declare const VERSION = "0.6.170";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.6.168';
82
+ export const VERSION = '0.6.170';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAe,eAAe,EAAE,MAAM,YAAY,CAAC;AAKpG;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,eAAe,EAC1B,OAAO,CAAC,EAAE,WAAW,GACpB,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CA+C3C"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAe,eAAe,EAAE,MAAM,YAAY,CAAC;AAKpG;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,YAAY,EACvB,SAAS,EAAE,eAAe,EAC1B,OAAO,CAAC,EAAE,WAAW,GACpB,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAiE3C"}
package/dist/stream.js CHANGED
@@ -12,6 +12,7 @@
12
12
  * Chunks arrive in time order, never span a gap, and carry the same `precededByGap` a
13
13
  * `readWindow` chunk would, so a consumer sees the discontinuities rather than a smooth lie.
14
14
  */
15
+ import { assertReadOptions } from './io/source.js';
15
16
  import { assertRecording, assertSelection, readRecords, resolveSignals } from './recording.js';
16
17
  import { describeValue } from './text/describe.js';
17
18
  import { assertMonotonicOnsets } from './time/timeline.js';
@@ -50,6 +51,23 @@ export function streamRecords(recording, selection, options) {
50
51
  `${describeValue(chunkRecords)}. ` +
51
52
  'Next: omit it for the default, or pass how many records you want to hold at once.');
52
53
  }
54
+ /*
55
+ * The OPTIONS, here rather than on the first read.
56
+ *
57
+ * `readRecords` refuses a bare value — 0.6.155 for an `AbortSignal` handed over in place of the
58
+ * options, 0.6.166 for any other — but this function does not read; the generator below does, and
59
+ * only once someone iterates it. So `streamRecords(recording, selection, controller.signal)` was
60
+ * built without complaint and refused in the `for await`, which is the split 0.6.118 was spent
61
+ * closing: "a caller who builds the stream in one place and consumes it in another gets the
62
+ * refusal in the second".
63
+ *
64
+ * And on a window that resolves to no records — past the end, inside an EDF+D gap, of zero
65
+ * duration — the loop body never runs, so it was never refused at all: the stream simply
66
+ * completed, empty. That is the same data-dependent guard 0.6.118 found here, one argument over,
67
+ * and for the signal case it is the worst version of it. An abort that was never wired up and a
68
+ * window with nothing in it both end as a stream that yielded nothing.
69
+ */
70
+ assertReadOptions(options);
53
71
  // Validated BEFORE the window is resolved, for the reason `readWindow` and `readEnvelope` both
54
72
  // state: a caller mistake is a caller mistake wherever the window lands. Resolving first meant
55
73
  // that a window past the end, one inside an EDF+D gap, or one of zero duration produced no
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAuB,EACvB,SAA0B,EAC1B,OAAqB;IAErB;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5C,eAAe,CACb,SAAS,EACT,eAAe,EACf,8EAA8E,CAC/E,CAAC;IACF,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,IAAI,sBAAsB,CAAC;IACtE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,UAAU,CAClB,0EAA0E;YACxE,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI;YAClC,mFAAmF,CACtF,CAAC;IACJ,CAAC;IAED,+FAA+F;IAC/F,+FAA+F;IAC/F,2FAA2F;IAC3F,s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AE,EACnD,OAAO,CACR,CAAC;YAEF;;;;;;;;;;;;;;;;;;;eAmBG;YACH,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;gBACjC,qBAAqB,CAAC,cAAc,EAAE;oBACpC,WAAW,EAAE,OAAO,CAAC,KAAK;oBAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;iBAC7B,CAAC,CAAC;YACL,CAAC;YACD,cAAc,GAAG;gBACf,WAAW,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC;gBAC9C,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,aAAa,GAAG,mBAAmB;aACzE,CAAC;YAEF,MAAM,KAAK,CAAC;YACZ,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ 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.170
10
+
11
+ - **Fixed** an array taken as a time window by `filterAnnotationsByTime`, the one function left in
12
+ the package that takes a window object. An array is an object, so it walked past the check added
13
+ for the absent case and was read for bounds it does not have.
14
+ - The array a caller holds comes from the neighbour this module is documented against.
15
+ `resolveTimeWindow` is named for the window and returns the record RANGES it maps to, so
16
+ `filterAnnotationsByTime(annotations, resolveTimeWindow(...))` is the call that reads correctly
17
+ and is not.
18
+ - The refusal it got named `window.startSeconds` and advised "an object whose bounds are spelled
19
+ something else" — a clause written in 0.6.158 for a bound that is genuinely absent, which here
20
+ sends a reader to rename fields on a value that has none. Same shape as 0.6.167, in the window.
21
+ - The three places that print the size of the suite say 4,500 rather than 4,000, which the tests
22
+ added here took it past. As at 0.4.415, a floor claim can never be wrong and is therefore never
23
+ re-read, so it is checked against the suite in the direction it rots.
24
+
25
+ ## 0.6.169
26
+
27
+ - **Fixed** `streamRecords` handing the read options to the generator unchecked. `readRecords`
28
+ refuses a bare value where they belong, but it is the generator that calls it, so
29
+ `streamRecords(recording, selection, controller.signal)` was built without complaint and refused
30
+ on the first `for await` — the split 0.6.118 turned this function inside out to close.
31
+ - On a window that resolves to no records — past the end, inside an EDF+D gap, of zero duration —
32
+ the loop body never runs, so nothing was ever refused: the stream completed, empty, with the
33
+ options dropped. Whether a caller mistake was reported depended on where the window landed.
34
+ - The `AbortSignal` case is the pair that cannot be told apart: a cancellation that was never wired
35
+ up, and a stream that yields nothing, which is what an abort looks like from outside.
36
+
9
37
  ## 0.6.168
10
38
 
11
39
  - **Fixed** a by-code summary counted as a diagnostics list. `summarizeDiagnostics` reads `code`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.168",
3
+ "version": "0.6.170",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
@@ -70,6 +70,28 @@ export function filterAnnotationsByTime(
70
70
  'Next: pass a window carrying startSeconds and durationSeconds.',
71
71
  );
72
72
  }
73
+ /*
74
+ * An ARRAY, which is an object and therefore walked straight past the check above.
75
+ *
76
+ * 0.6.167 closed this route for the reading API's selection and recorded what it costs: an array
77
+ * "reproduced the exact failure 0.6.79 removed — each call named whichever field it happened to
78
+ * read first". Here that field is `window.startSeconds`, and the advice attached to an absent
79
+ * bound is about "an object whose bounds are spelled something else" — which sends a reader to
80
+ * rename fields on a value that has none.
81
+ *
82
+ * The array a caller has in hand is the one this function's own neighbour returns.
83
+ * `resolveTimeWindow` is named for the window and returns the RECORD RANGES it maps to, so
84
+ * `const window = resolveTimeWindow(timeline, index, from, span)` reads exactly like the argument
85
+ * this takes.
86
+ */
87
+ if (Array.isArray(window)) {
88
+ throw new RangeError(
89
+ 'filterAnnotationsByTime(): the window is an array, and this call bounds events by time ' +
90
+ 'rather than by record. resolveTimeWindow() returns the record ranges a window maps to, ' +
91
+ 'not the window. Next: pass the startSeconds and durationSeconds you gave that call, on ' +
92
+ 'an object.',
93
+ );
94
+ }
73
95
  const from = secondsToTicks(window.startSeconds, 'window.startSeconds');
74
96
  const to = from + secondsToTicks(window.durationSeconds, 'window.durationSeconds');
75
97
  if (to <= from) return Object.freeze([]);
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.6.168';
96
+ export const VERSION = '0.6.170';
package/src/stream.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  * `readWindow` chunk would, so a consumer sees the discontinuities rather than a smooth lie.
14
14
  */
15
15
 
16
+ import { assertReadOptions } from './io/source.js';
16
17
  import { assertRecording, assertSelection, readRecords, resolveSignals } from './recording.js';
17
18
  import { describeValue } from './text/describe.js';
18
19
  import { assertMonotonicOnsets } from './time/timeline.js';
@@ -65,6 +66,24 @@ export function streamRecords(
65
66
  );
66
67
  }
67
68
 
69
+ /*
70
+ * The OPTIONS, here rather than on the first read.
71
+ *
72
+ * `readRecords` refuses a bare value — 0.6.155 for an `AbortSignal` handed over in place of the
73
+ * options, 0.6.166 for any other — but this function does not read; the generator below does, and
74
+ * only once someone iterates it. So `streamRecords(recording, selection, controller.signal)` was
75
+ * built without complaint and refused in the `for await`, which is the split 0.6.118 was spent
76
+ * closing: "a caller who builds the stream in one place and consumes it in another gets the
77
+ * refusal in the second".
78
+ *
79
+ * And on a window that resolves to no records — past the end, inside an EDF+D gap, of zero
80
+ * duration — the loop body never runs, so it was never refused at all: the stream simply
81
+ * completed, empty. That is the same data-dependent guard 0.6.118 found here, one argument over,
82
+ * and for the signal case it is the worst version of it. An abort that was never wired up and a
83
+ * window with nothing in it both end as a stream that yielded nothing.
84
+ */
85
+ assertReadOptions(options);
86
+
68
87
  // Validated BEFORE the window is resolved, for the reason `readWindow` and `readEnvelope` both
69
88
  // state: a caller mistake is a caller mistake wherever the window lands. Resolving first meant
70
89
  // that a window past the end, one inside an EDF+D gap, or one of zero duration produced no