edfcore 0.5.75 → 0.6.1
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 +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/diagnostics/format.d.ts.map +1 -1
- package/dist/diagnostics/format.js +2 -6
- package/dist/diagnostics/format.js.map +1 -1
- package/dist/format-annotations.d.ts.map +1 -1
- package/dist/format-annotations.js +2 -3
- package/dist/format-annotations.js.map +1 -1
- package/dist/options.d.ts +15 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +24 -0
- package/dist/options.js.map +1 -1
- package/docs/CHANGELOG.md +59 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/diagnostics/format.ts +2 -6
- package/src/format-annotations.ts +2 -4
- package/src/options.ts +26 -0
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ for (const event of annotations) {
|
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
> **Status: 0.
|
|
80
|
+
> **Status: 0.6.x, early.** edfcore runs 4,000+ tests on generated fixtures, and it's checked
|
|
81
81
|
> against public corpora it didn't author: the EDF, EDF+ and 24-bit BDF+ test files from
|
|
82
82
|
> teuniz.net, and PhysioNet's sleep-edfx (a real 22-hour polysomnography recording and its
|
|
83
83
|
> sleep-staging file). Those checks are numeric. Channels labelled `sine 8.5 Hz` decode to
|
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.
|
|
112
|
+
export declare const VERSION = "0.6.1";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@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G;IACjB,gBAAgB,EAAE,GAAG;IACrB,QAAQ,EAAE,GAAG;CACL,CAAC;AAEX,2EAA2E;AAC3E,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/diagnostics/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/diagnostics/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAgBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CAkBR"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* no iteration over an unordered collection, and no ANSI escapes unless `color` is requested.
|
|
10
10
|
*/
|
|
11
11
|
import { trimEdfField } from '../bytes/latin1.js';
|
|
12
|
+
import { requireItemLimit } from '../options.js';
|
|
12
13
|
import { printable } from '../text/printable.js';
|
|
13
14
|
const INDENT = ' ';
|
|
14
15
|
/** A report is a summary, not a hex dump; longer runs are elided with a count. */
|
|
@@ -26,7 +27,7 @@ const SEVERITY_COLORS = {
|
|
|
26
27
|
*/
|
|
27
28
|
export function formatDiagnostics(diagnostics, options) {
|
|
28
29
|
const color = options?.color === true;
|
|
29
|
-
const shown =
|
|
30
|
+
const shown = requireItemLimit(options?.maxItems, diagnostics.length);
|
|
30
31
|
const lines = [];
|
|
31
32
|
const redact = new Set(options?.redactFields ?? []);
|
|
32
33
|
for (let i = 0; i < shown; i++) {
|
|
@@ -41,11 +42,6 @@ export function formatDiagnostics(diagnostics, options) {
|
|
|
41
42
|
lines.push(paint(`... and ${hidden} more`, ANSI_DIM, color));
|
|
42
43
|
return lines.join('\n');
|
|
43
44
|
}
|
|
44
|
-
function resolveLimit(maxItems, total) {
|
|
45
|
-
if (maxItems === undefined || !Number.isFinite(maxItems))
|
|
46
|
-
return total;
|
|
47
|
-
return Math.max(0, Math.min(total, Math.floor(maxItems)));
|
|
48
|
-
}
|
|
49
45
|
const REDACTED = '[redacted]';
|
|
50
46
|
/**
|
|
51
47
|
* Removes a field's content from every place `appendDiagnostic` would print it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/diagnostics/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA4BjD,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,kFAAkF;AAClF,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,QAAQ,GAAG,WAAW,CAAC;AAE7B,MAAM,eAAe,GAA0C;IAC7D,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAAqC,EACrC,OAAkC;IAElC,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC,MAAM,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/diagnostics/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,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E,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-annotations.d.ts","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"format-annotations.d.ts","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AA0CD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CA6BR"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* file says. Clamping it to zero would silently move an event.
|
|
16
16
|
*/
|
|
17
17
|
import { TICKS_PER_SECOND } from './constants.js';
|
|
18
|
+
import { requireItemLimit } from './options.js';
|
|
18
19
|
import { floorDiv } from './tal/ticks.js';
|
|
19
20
|
import { printable } from './text/printable.js';
|
|
20
21
|
const TICKS_PER_MILLISECOND = TICKS_PER_SECOND / 1000n;
|
|
@@ -63,9 +64,7 @@ function duration(annotation) {
|
|
|
63
64
|
export function formatAnnotations(annotations, options) {
|
|
64
65
|
if (annotations.length === 0)
|
|
65
66
|
return '';
|
|
66
|
-
const limit = options?.maxItems
|
|
67
|
-
? annotations.length
|
|
68
|
-
: Math.max(0, Math.min(annotations.length, Math.floor(options.maxItems)));
|
|
67
|
+
const limit = requireItemLimit(options?.maxItems, annotations.length);
|
|
69
68
|
const rows = [];
|
|
70
69
|
for (let i = 0; i < limit; i += 1) {
|
|
71
70
|
const annotation = annotations[i];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-annotations.js","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAehD,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,KAAK,CAAC;AAEvD;;;;;;GAMG;AACH,SAAS,KAAK,CAAC,KAAa;IAC1B,2FAA2F;IAC3F,gGAAgG;IAChG,gGAAgG;IAChG,6FAA6F;IAC7F,wFAAwF;IACxF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,mBAAmB,GAAG,EAAE,CAAC;IAC1C,MAAM,iBAAiB,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC;IAEhF,MAAM,YAAY,GAAG,iBAAiB,GAAG,KAAK,CAAC;IAC/C,MAAM,YAAY,GAAG,iBAAiB,GAAG,KAAK,CAAC;IAC/C,MAAM,OAAO,GAAG,YAAY,GAAG,GAAG,CAAC;IACnC,MAAM,YAAY,GAAG,YAAY,GAAG,GAAG,CAAC;IACxC,MAAM,OAAO,GAAG,YAAY,GAAG,GAAG,CAAC;IACnC,MAAM,KAAK,GAAG,YAAY,GAAG,GAAG,CAAC;IAEjC,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzF,OAAO,CACL,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,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GAAG,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAEtE,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAClC,IAAI,UAAU,KAAK,SAAS;YAAE,SAAS;QACvC,0FAA0F;QAC1F,8FAA8F;QAC9F,4FAA4F;QAC5F,kFAAkF;QAClF,MAAM,KAAK,GAAG;YACZ,KAAK,CAAC,UAAU,CAAC,yBAAyB,CAAC;YAC3C,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;SAC3B,CAAC;QACF,IAAI,OAAO,EAAE,cAAc,KAAK,IAAI,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC9E,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,KAAK,CAAC;IAC1C,mFAAmF;IACnF,IAAI,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,MAAM,OAAO,CAAC,CAAC;IAEpD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
package/dist/options.d.ts
CHANGED
|
@@ -22,6 +22,21 @@
|
|
|
22
22
|
* got nothing — treating them alike would silently apply the default to a real mistake.
|
|
23
23
|
*/
|
|
24
24
|
export declare function requireFiniteOption(value: number | undefined, name: string, fallback: number): number;
|
|
25
|
+
/**
|
|
26
|
+
* `maxItems`, resolved against the number of items there actually are.
|
|
27
|
+
*
|
|
28
|
+
* The same class as `requireFiniteOption` and a different answer for `Infinity`, which is why it
|
|
29
|
+
* is a second function rather than a call to that one. `formatValidationReport` caps at 20 by
|
|
30
|
+
* default, so `Infinity` is the only spelling of "print all of them" a caller has; clamped against
|
|
31
|
+
* `total` it is exact, and refusing it would remove the option's only way to say that.
|
|
32
|
+
*
|
|
33
|
+
* `NaN` is refused. It used to mean the same as `Infinity` — both were `!Number.isFinite`, both
|
|
34
|
+
* returned `total` — so a limit computed from an absent config key printed the whole list, which
|
|
35
|
+
* is the opposite of what the caller asked for and looks like a file with a great deal wrong with
|
|
36
|
+
* it. `parseArgs` has refused a `NaN --limit` since the flag existed, and says why in a comment;
|
|
37
|
+
* the library function underneath it did the thing that comment describes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function requireItemLimit(value: number | undefined, total: number): number;
|
|
25
40
|
/**
|
|
26
41
|
* `maxMaterializeBytes`, or the 256 MiB default.
|
|
27
42
|
*
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,CAQR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQ1E"}
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,CAQR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAUjF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQ1E"}
|
package/dist/options.js
CHANGED
|
@@ -31,6 +31,30 @@ export function requireFiniteOption(value, name, fallback) {
|
|
|
31
31
|
'expression that produced it — Number() on an absent environment variable, query ' +
|
|
32
32
|
'parameter or config key yields NaN.');
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* `maxItems`, resolved against the number of items there actually are.
|
|
36
|
+
*
|
|
37
|
+
* The same class as `requireFiniteOption` and a different answer for `Infinity`, which is why it
|
|
38
|
+
* is a second function rather than a call to that one. `formatValidationReport` caps at 20 by
|
|
39
|
+
* default, so `Infinity` is the only spelling of "print all of them" a caller has; clamped against
|
|
40
|
+
* `total` it is exact, and refusing it would remove the option's only way to say that.
|
|
41
|
+
*
|
|
42
|
+
* `NaN` is refused. It used to mean the same as `Infinity` — both were `!Number.isFinite`, both
|
|
43
|
+
* returned `total` — so a limit computed from an absent config key printed the whole list, which
|
|
44
|
+
* is the opposite of what the caller asked for and looks like a file with a great deal wrong with
|
|
45
|
+
* it. `parseArgs` has refused a `NaN --limit` since the flag existed, and says why in a comment;
|
|
46
|
+
* the library function underneath it did the thing that comment describes.
|
|
47
|
+
*/
|
|
48
|
+
export function requireItemLimit(value, total) {
|
|
49
|
+
if (value === undefined)
|
|
50
|
+
return total;
|
|
51
|
+
if (Number.isNaN(value)) {
|
|
52
|
+
throw new RangeError('options.maxItems must be a number, but was NaN. Next: check the expression that produced ' +
|
|
53
|
+
'it — Number() on an absent environment variable, query parameter or config key yields ' +
|
|
54
|
+
'NaN. Pass Infinity for no cap.');
|
|
55
|
+
}
|
|
56
|
+
return Math.max(0, Math.min(total, Math.floor(value)));
|
|
57
|
+
}
|
|
34
58
|
/**
|
|
35
59
|
* `maxMaterializeBytes`, or the 256 MiB default.
|
|
36
60
|
*
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAyB,EACzB,IAAY,EACZ,QAAgB;IAEhB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACzC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,IAAI,UAAU,CAClB,WAAW,IAAI,qCAAqC,MAAM,CAAC,KAAK,CAAC,oBAAoB;QACnF,kFAAkF;QAClF,qCAAqC,CACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;IAChG,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/B,MAAM,IAAI,UAAU,CAClB,6DAA6D,MAAM,0BAA0B;QAC3F,0DAA0D;QAC1D,GAAG,6BAA6B,gBAAgB,CACnD,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAyB,EACzB,IAAY,EACZ,QAAgB;IAEhB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACzC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,IAAI,UAAU,CAClB,WAAW,IAAI,qCAAqC,MAAM,CAAC,KAAK,CAAC,oBAAoB;QACnF,kFAAkF;QAClF,qCAAqC,CACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAyB,EAAE,KAAa;IACvE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,UAAU,CAClB,2FAA2F;YACzF,wFAAwF;YACxF,gCAAgC,CACnC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;IAChG,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/B,MAAM,IAAI,UAAU,CAClB,6DAA6D,MAAM,0BAA0B;QAC3F,0DAA0D;QAC1D,GAAG,6BAA6B,gBAAgB,CACnD,CAAC;AACJ,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,65 @@ 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.1
|
|
10
|
+
|
|
11
|
+
- **Fixed** `maxItems: NaN` disabling the cap instead of being refused. `formatDiagnostics`,
|
|
12
|
+
`formatAnnotations` and `formatValidationReport` all resolved the option with
|
|
13
|
+
`!Number.isFinite(maxItems)`, which is true of `NaN` and of `Infinity` alike, and all three
|
|
14
|
+
answered it with the total — so a limit computed from an absent environment variable, query
|
|
15
|
+
parameter or config key printed the whole list. It throws `RangeError` naming `options.maxItems`
|
|
16
|
+
now.
|
|
17
|
+
- The rule was already written down one layer up. `parseArgs` refuses a `NaN --limit` and the
|
|
18
|
+
comment beside that guard says why: "a NaN limit would disable the cap silently, which is the
|
|
19
|
+
opposite of what was asked for". The library functions that flag reaches did exactly that, and
|
|
20
|
+
it is the class `options.ts` exists for — an omitted option means "use the default", a `NaN`
|
|
21
|
+
means a caller computed something and got nothing, and treating them alike applies the default
|
|
22
|
+
to a real mistake.
|
|
23
|
+
- It costs most where the cap matters most: a sweep over a damaged file can produce six figures of
|
|
24
|
+
diagnostics, `TIMEKEEPING_TAL_MISSING` is one per record, and the caller who asked for twenty
|
|
25
|
+
got all of them with no sign a limit had ever been applied.
|
|
26
|
+
- **Changed**: `maxItems: -Infinity` showed everything and now shows nothing, which is what every
|
|
27
|
+
other negative value already did. `Infinity` still means "no cap" and is what the refusal
|
|
28
|
+
recommends — `formatValidationReport` caps at twenty by default, so it is the only spelling a
|
|
29
|
+
caller has for printing the lot. That is why this is a second resolver in `options.ts` rather
|
|
30
|
+
than a call to `requireFiniteOption`, which refuses `Infinity` too.
|
|
31
|
+
|
|
32
|
+
## 0.6.0
|
|
33
|
+
|
|
34
|
+
The public API is unchanged: nothing was added, removed or renamed, and no arithmetic moved. This
|
|
35
|
+
is a series marker, cut for the same reason 0.5.0 and 0.4.0 were — the 0.5.x patches carried
|
|
36
|
+
observable changes that a consumer pinning `~0.5.x` would rather have been told about in a version
|
|
37
|
+
number. There are four, and they are the whole list: across seventy-five patch releases the only
|
|
38
|
+
files under `src/` that changed other than the version constant are `io/bytes.ts`,
|
|
39
|
+
`record-index.ts` and `validate.ts`.
|
|
40
|
+
|
|
41
|
+
- **A detached buffer is refused rather than opened.** `byteSource` used to accept a `Uint8Array`
|
|
42
|
+
whose buffer had been transferred away and build a zero-byte source over it, so `openEdf`
|
|
43
|
+
reported `[SOURCE_TOO_SMALL] the header is 0 bytes` — a diagnostic about the file, for an
|
|
44
|
+
argument the caller no longer owned. It now throws `EdfSourceError` at construction (0.5.62).
|
|
45
|
+
Code that caught the old shape sees a different one, and `postMessage(bytes, [bytes.buffer])` is
|
|
46
|
+
the ordinary way to reach it.
|
|
47
|
+
- **A detached buffer mid-read stays inside the error model.** Transferring the bytes away after
|
|
48
|
+
the source was built used to surface as a bare `TypeError` from `subarray` — outside the "either
|
|
49
|
+
parses it or throws an `EdfError`" property this package states, so a `catch` branching on
|
|
50
|
+
`isEdfError` fell through to a rethrow. It is an `EdfSourceError` with `receivedLength: 0` now
|
|
51
|
+
(0.5.66).
|
|
52
|
+
- **`onProgress` finishes.** `buildRecordIndex` never called it for a file with no data records
|
|
53
|
+
(0.5.67), and `validateRecording` never called it for a sweep that read nothing — a plain EDF
|
|
54
|
+
with `scanSamples` off, or a file with no records (0.5.68). Both report once now, so a caller's
|
|
55
|
+
progress bar reaches its total instead of sitting at zero for the files that finished fastest.
|
|
56
|
+
A caller counting calls, rather than reading the numbers in them, sees one more than before.
|
|
57
|
+
|
|
58
|
+
Everything else in the line was tests and documentation. The suite went from 2,700 written-out
|
|
59
|
+
cases at 0.5.0 to 4,000, and what it covers changed shape as much as size: the properties a caller
|
|
60
|
+
depends on but no single function states are now checked as properties — that every array handed
|
|
61
|
+
back is frozen, that every index resolves, that ticks and seconds agree on every pair of fields,
|
|
62
|
+
that nothing returned points into the caller's buffer, that the caller's bytes are never written
|
|
63
|
+
to, and that the caller's arguments come back untouched. The `AWKWARD` matrix those sweeps run over
|
|
64
|
+
grew from eight shapes to eleven, including the one this project's longest-running defect class
|
|
65
|
+
hides from: a gap and a sub-second start offset in the same file. None of that is visible from a
|
|
66
|
+
`package.json`, which is the argument for saying it here.
|
|
67
|
+
|
|
9
68
|
## 0.5.75
|
|
10
69
|
|
|
11
70
|
- **Fixed** the rule `awkward-files.ts` states and eleven of its eighteen readers did not follow.
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { trimEdfField } from '../bytes/latin1.js';
|
|
13
|
+
import { requireItemLimit } from '../options.js';
|
|
13
14
|
import { printable } from '../text/printable.js';
|
|
14
15
|
import type { EdfDiagnostic, EdfSeverity } from '../types.js';
|
|
15
16
|
|
|
@@ -61,7 +62,7 @@ export function formatDiagnostics(
|
|
|
61
62
|
options?: FormatDiagnosticsOptions,
|
|
62
63
|
): string {
|
|
63
64
|
const color = options?.color === true;
|
|
64
|
-
const shown =
|
|
65
|
+
const shown = requireItemLimit(options?.maxItems, diagnostics.length);
|
|
65
66
|
const lines: string[] = [];
|
|
66
67
|
|
|
67
68
|
const redact = new Set(options?.redactFields ?? []);
|
|
@@ -79,11 +80,6 @@ export function formatDiagnostics(
|
|
|
79
80
|
return lines.join('\n');
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
function resolveLimit(maxItems: number | undefined, total: number): number {
|
|
83
|
-
if (maxItems === undefined || !Number.isFinite(maxItems)) return total;
|
|
84
|
-
return Math.max(0, Math.min(total, Math.floor(maxItems)));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
83
|
const REDACTED = '[redacted]';
|
|
88
84
|
|
|
89
85
|
/**
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { TICKS_PER_SECOND } from './constants.js';
|
|
19
|
+
import { requireItemLimit } from './options.js';
|
|
19
20
|
import { floorDiv } from './tal/ticks.js';
|
|
20
21
|
import { printable } from './text/printable.js';
|
|
21
22
|
import type { EdfAnnotation } from './types.js';
|
|
@@ -87,10 +88,7 @@ export function formatAnnotations(
|
|
|
87
88
|
): string {
|
|
88
89
|
if (annotations.length === 0) return '';
|
|
89
90
|
|
|
90
|
-
const limit =
|
|
91
|
-
options?.maxItems === undefined || !Number.isFinite(options.maxItems)
|
|
92
|
-
? annotations.length
|
|
93
|
-
: Math.max(0, Math.min(annotations.length, Math.floor(options.maxItems)));
|
|
91
|
+
const limit = requireItemLimit(options?.maxItems, annotations.length);
|
|
94
92
|
|
|
95
93
|
const rows: string[] = [];
|
|
96
94
|
for (let i = 0; i < limit; i += 1) {
|
package/src/options.ts
CHANGED
|
@@ -38,6 +38,32 @@ export function requireFiniteOption(
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* `maxItems`, resolved against the number of items there actually are.
|
|
43
|
+
*
|
|
44
|
+
* The same class as `requireFiniteOption` and a different answer for `Infinity`, which is why it
|
|
45
|
+
* is a second function rather than a call to that one. `formatValidationReport` caps at 20 by
|
|
46
|
+
* default, so `Infinity` is the only spelling of "print all of them" a caller has; clamped against
|
|
47
|
+
* `total` it is exact, and refusing it would remove the option's only way to say that.
|
|
48
|
+
*
|
|
49
|
+
* `NaN` is refused. It used to mean the same as `Infinity` — both were `!Number.isFinite`, both
|
|
50
|
+
* returned `total` — so a limit computed from an absent config key printed the whole list, which
|
|
51
|
+
* is the opposite of what the caller asked for and looks like a file with a great deal wrong with
|
|
52
|
+
* it. `parseArgs` has refused a `NaN --limit` since the flag existed, and says why in a comment;
|
|
53
|
+
* the library function underneath it did the thing that comment describes.
|
|
54
|
+
*/
|
|
55
|
+
export function requireItemLimit(value: number | undefined, total: number): number {
|
|
56
|
+
if (value === undefined) return total;
|
|
57
|
+
if (Number.isNaN(value)) {
|
|
58
|
+
throw new RangeError(
|
|
59
|
+
'options.maxItems must be a number, but was NaN. Next: check the expression that produced ' +
|
|
60
|
+
'it — Number() on an absent environment variable, query parameter or config key yields ' +
|
|
61
|
+
'NaN. Pass Infinity for no cap.',
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return Math.max(0, Math.min(total, Math.floor(value)));
|
|
65
|
+
}
|
|
66
|
+
|
|
41
67
|
/**
|
|
42
68
|
* `maxMaterializeBytes`, or the 256 MiB default.
|
|
43
69
|
*
|