edfcore 0.5.37 → 0.5.39

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.
@@ -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.5.37";
112
+ export declare const VERSION = "0.5.39";
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.5.37';
82
+ export const VERSION = '0.5.39';
83
83
  //# sourceMappingURL=constants.js.map
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,55 @@ 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.5.39
10
+
11
+ - **Added** the rule that every array edfcore hands back is frozen. `src/` calls `Object.freeze`
12
+ forty-three times, in seventeen modules, and the suite asserted `Object.isFrozen` twice. That is a
13
+ policy held by convention across every module that returns a list, checked at two of its sites —
14
+ and a policy with one hole is not one, because the hole is exactly where a caller's `push` lands.
15
+ - The reason is sharing. `header.diagnostics` is the same array on every reference to that header,
16
+ `readWindow` hands one array of chunks to whoever asked, and `findSignals` returns a view of
17
+ `header.signals`. A caller who sorts one in place, or appends to it, changes what the next reader
18
+ sees — and the next reader is often the same program, later, through a different function. There
19
+ is no copy-on-read anywhere in this package, and freezing is what makes that safe.
20
+ - It is now checked as a rule: every object every entry point returns is walked to a depth of nine,
21
+ over the eight `AWKWARD` shapes and a file with a gap, and every plain `Array` found anywhere in
22
+ the graph must be frozen. 240 of them — roughly six times the number of `Object.freeze` calls,
23
+ because one call freezes an array that reaches many results.
24
+ - Two things are deliberately not frozen, and both are asserted so the rule reads as a rule rather
25
+ than as "everything is frozen". The containing objects are not: a chunk, a segment, a report are
26
+ values the caller owns, and freezing them would break the `{ ...recording, index }` spread
27
+ `discontinuous.md` tells every reader to write. Neither are the typed arrays:
28
+ `chunk.signals[0].digital` is the data, and `toPhysical(signal, digital, out)` writes into a
29
+ buffer the caller supplied.
30
+ - What the freezing buys is asserted too — a `push` and an in-place `reverse` on a shared list both
31
+ throw, and the list another reference is holding is unchanged.
32
+
33
+ ## 0.5.38
34
+
35
+ - **Added** a sweep over every `…Ticks` edfcore publishes against the `…Seconds` beside it. The
36
+ package's central arithmetic decision is that time is a `bigint` count of 100 ns ticks and the
37
+ seconds are derived from it. Twenty field pairs in `types.ts` are written that way — on the
38
+ header, the timeline, a segment, a gap, a location, a chunk, a chunk signal, an envelope chunk, an
39
+ envelope signal and an annotation — each produced by different code, and one of them was checked.
40
+ `timebase.test.ts` asserts "an exact tick counterpart for every second on a chunk", on chunks.
41
+ - The other nine kinds were computed somewhere and never compared, and the failure they would
42
+ produce is the quiet kind: the two fields sit next to each other in an autocomplete list, a caller
43
+ picks whichever the surrounding code already uses, and a disagreement shows up as a plot drawn a
44
+ fraction of a second from where the arithmetic says it is.
45
+ - The pairs are now enumerated out of `types.ts` and every object every entry point returns is
46
+ walked, over the eight `AWKWARD` shapes plus a file with a gap and a file with an overlap: 270
47
+ pairs, compared with `Object.is` against `ticksToSeconds`. `toBeCloseTo` would pass on a pair that
48
+ had drifted by exactly the thing this arithmetic exists to prevent. Every enumerated field is
49
+ asserted to have been reached, so none is checked in absentia, and the visited set is asserted to
50
+ include a negative tick count and a hundred non-zero ones.
51
+ - `EdfAnnotation` is the pair that cannot be inferred from the names, and it is why the rule is
52
+ spelled out: its four onset fields are two axes, `onsetTicks` with `onsetSecondsFromHeaderStart`
53
+ and `onsetTicksFromFirstRecord` with `onsetSecondsFromFirstRecord`. Crossing them passes on every
54
+ file with no sub-second start offset, which is most of them — so the last block builds one that
55
+ has an offset and shows the crossed pairing failing by exactly that offset. That is the trap
56
+ `annotations.md` warns about, and it is what makes this pairing a rule rather than a coincidence.
57
+
9
58
  ## 0.5.37
10
59
 
11
60
  - **Added** the safety property for the CLI. `fuzz.test.ts` states it for the library — for any byte
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.5.37",
3
+ "version": "0.5.39",
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/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.5.37';
96
+ export const VERSION = '0.5.39';