edfcore 0.3.40 → 0.3.41

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 CHANGED
@@ -6,6 +6,22 @@ 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.3.41
10
+
11
+ - **Fixed** `mergeChunks` refusing an overlap with *"chunk 1 is preceded by a gap of -0.2 s"* — a
12
+ gap of negative duration — and explaining it as the inverse of what happened. Across a GAP two
13
+ samples either side of the join are seconds apart; across an OVERLAP they cover the same time,
14
+ so concatenating stores it twice rather than skipping it. The message asserted the first.
15
+ - **0.3.33's own headline was "in the two places that still said it was", and it named exactly
16
+ two.** This is a third. `src/chunks.ts` contained no mention of an overlap anywhere, so the
17
+ partition 0.3.3 stated — *a gap is time no record covers; an overlap is one instant two records
18
+ both claim* — had never reached it. Counting the sites from memory was the mistake, twice now.
19
+ - The refusal is unchanged and correct either way; only the wording branches on the sign, and the
20
+ magnitude is printed positive.
21
+ - `api-reading.md`'s `precededByGap` example printed `gap of ${durationSeconds} s` unconditionally,
22
+ which produces `gap of -0.2 s` on the same file. It branches on the sign now, since that is what
23
+ a reader will copy.
24
+
9
25
  ## 0.3.40
10
26
 
11
27
  - **Fixed a regression introduced two releases ago.** 0.3.37 split the 206 `Content-Range` guard on
@@ -1 +1 @@
1
- {"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;AA8F1E;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,CA6EjE"}
1
+ {"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;AA8G1E;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,CA6EjE"}
package/dist/chunks.js CHANGED
@@ -44,10 +44,26 @@ function at(chunks, index) {
44
44
  */
45
45
  function assertJoinable(previous, next, index) {
46
46
  if (next.precededByGap !== undefined) {
47
- throw new RangeError(`mergeChunks: chunk ${index} is preceded by a gap of ${next.precededByGap.durationSeconds} s. ` +
48
- 'Concatenating across it would put two samples that are seconds apart next to each other ' +
49
- 'in one array, and every time computed from an index after the join would be wrong by the ' +
50
- 'gap. Merge each contiguous run separately.');
47
+ // Branch on the sign. An overlap travels in `index.gaps` with a NEGATIVE duration (0.2.69), so
48
+ // `chunk.precededByGap` carries it too, and a hardcoded gap reading produced "preceded by a
49
+ // gap of -0.2 s" a gap of negative duration with an explanation that inverts what an
50
+ // overlap does: across a gap two samples are seconds APART, across an overlap they cover the
51
+ // SAME time, so concatenating duplicates it rather than skipping it.
52
+ //
53
+ // 0.3.3 stated the partition and 0.3.33 applied it to "the two places that still said it was".
54
+ // This is the third; `src/chunks.ts` contained no mention of an overlap at all (fixed in
55
+ // 0.3.41). The refusal itself is unchanged and right either way.
56
+ const gap = next.precededByGap;
57
+ const overlapping = gap.durationTicks < 0n;
58
+ throw new RangeError(overlapping
59
+ ? `mergeChunks: chunk ${index} is preceded by an overlap of ${-gap.durationSeconds} s — ` +
60
+ 'the records on either side of the join both claim that time. Concatenating them would ' +
61
+ 'store it twice and date every sample after the join late by it. Merge each contiguous ' +
62
+ 'run separately.'
63
+ : `mergeChunks: chunk ${index} is preceded by a gap of ${gap.durationSeconds} s. ` +
64
+ 'Concatenating across it would put two samples that are seconds apart next to each ' +
65
+ 'other in one array, and every time computed from an index after the join would be ' +
66
+ 'wrong by the gap. Merge each contiguous run separately.');
51
67
  }
52
68
  const expectedStart = previous.records.start + previous.records.count;
53
69
  if (next.records.start !== expectedStart) {
@@ -1 +1 @@
1
- {"version":3,"file":"chunks.js","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,mGAAmG;AACnG,SAAS,EAAE,CAAC,MAA2B,EAAE,KAAa;IACpD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,KAAK,GAAG,CAAC,CAAC;IACpF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,cAAc,CAAC,QAAkB,EAAE,IAAc,EAAE,KAAa;IACvE,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,IAAI,UAAU,CAClB,sBAAsB,KAAK,4BAA4B,IAAI,CAAC,aAAa,CAAC,eAAe,MAAM;YAC7F,0FAA0F;YAC1F,2FAA2F;YAC3F,4CAA4C,CAC/C,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;IACtE,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,aAAa,EAAE,CAAC;QACzC,MAAM,IAAI,UAAU,CAClB,sBAAsB,KAAK,qBAAqB,IAAI,CAAC,OAAO,CAAC,KAAK,yBAAyB;YACzF,cAAc,aAAa,yCAAyC,CACvE,CAAC;IACJ,CAAC;IAED,uFAAuF;IACvF,oEAAoE;IACpE,EAAE;IACF,4FAA4F;IAC5F,2FAA2F;IAC3F,8FAA8F;IAC9F,0EAA0E;IAC1E,MAAM,gBAAgB,GA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AE,KAAK,CAAC,UAAU;QAC5B,UAAU;QACV,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/B,wFAAwF;QACxF,sDAAsD;QACtD,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;KACxC,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.3.40";
112
+ export declare const VERSION = "0.3.41";
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.3.40';
82
+ export const VERSION = '0.3.41';
83
83
  //# sourceMappingURL=constants.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.3.40",
3
+ "version": "0.3.41",
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",
package/src/chunks.ts CHANGED
@@ -47,11 +47,27 @@ function at(chunks: readonly EdfChunk[], index: number): EdfChunk {
47
47
  */
48
48
  function assertJoinable(previous: EdfChunk, next: EdfChunk, index: number): void {
49
49
  if (next.precededByGap !== undefined) {
50
+ // Branch on the sign. An overlap travels in `index.gaps` with a NEGATIVE duration (0.2.69), so
51
+ // `chunk.precededByGap` carries it too, and a hardcoded gap reading produced "preceded by a
52
+ // gap of -0.2 s" — a gap of negative duration — with an explanation that inverts what an
53
+ // overlap does: across a gap two samples are seconds APART, across an overlap they cover the
54
+ // SAME time, so concatenating duplicates it rather than skipping it.
55
+ //
56
+ // 0.3.3 stated the partition and 0.3.33 applied it to "the two places that still said it was".
57
+ // This is the third; `src/chunks.ts` contained no mention of an overlap at all (fixed in
58
+ // 0.3.41). The refusal itself is unchanged and right either way.
59
+ const gap = next.precededByGap;
60
+ const overlapping = gap.durationTicks < 0n;
50
61
  throw new RangeError(
51
- `mergeChunks: chunk ${index} is preceded by a gap of ${next.precededByGap.durationSeconds} s. ` +
52
- 'Concatenating across it would put two samples that are seconds apart next to each other ' +
53
- 'in one array, and every time computed from an index after the join would be wrong by the ' +
54
- 'gap. Merge each contiguous run separately.',
62
+ overlapping
63
+ ? `mergeChunks: chunk ${index} is preceded by an overlap of ${-gap.durationSeconds} s ` +
64
+ 'the records on either side of the join both claim that time. Concatenating them would ' +
65
+ 'store it twice and date every sample after the join late by it. Merge each contiguous ' +
66
+ 'run separately.'
67
+ : `mergeChunks: chunk ${index} is preceded by a gap of ${gap.durationSeconds} s. ` +
68
+ 'Concatenating across it would put two samples that are seconds apart next to each ' +
69
+ 'other in one array, and every time computed from an index after the join would be ' +
70
+ 'wrong by the gap. Merge each contiguous run separately.',
55
71
  );
56
72
  }
57
73
 
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.3.40';
96
+ export const VERSION = '0.3.41';