edfcore 0.6.269 → 0.6.271
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/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/format-report.d.ts.map +1 -1
- package/dist/format-report.js +52 -0
- package/dist/format-report.js.map +1 -1
- package/docs/CHANGELOG.md +36 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/format-report.ts +56 -0
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.271";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-report.d.ts","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"format-report.d.ts","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CA8PR;AAED,qFAAqF;AACrF,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/format-report.js
CHANGED
|
@@ -107,10 +107,62 @@ export function formatValidationReport(report, options) {
|
|
|
107
107
|
const named = Array.isArray(signals) &&
|
|
108
108
|
(signals.length === 0 || typeof signals[0]?.label === 'string');
|
|
109
109
|
if (!named) {
|
|
110
|
+
/*
|
|
111
|
+
* A FORGOTTEN AWAIT, which the sweep across 0.6.229–0.6.239 reached every header-taking CALL
|
|
112
|
+
* for and no header-taking OPTION. This is the only one: `options.header` is the one field in
|
|
113
|
+
* the package that holds a header, so it is the one place that sweep could not have covered by
|
|
114
|
+
* walking the entry points.
|
|
115
|
+
*
|
|
116
|
+
* `{ header: readHeader(source) }` is how it gets written, because this option "is also the
|
|
117
|
+
* one a caller adds last, to a call that already worked" — and the call it is added to is
|
|
118
|
+
* already `await`-ed, so the keyword is in the line and in the wrong place. "Nothing on it
|
|
119
|
+
* carries the labels" is true of a pending Promise and of almost everything else, and the
|
|
120
|
+
* advice names a field on a recording a caller holding a bare header may not have.
|
|
121
|
+
*
|
|
122
|
+
* A property read, never a call.
|
|
123
|
+
*/
|
|
124
|
+
if (typeof options.header?.then === 'function') {
|
|
125
|
+
throw new RangeError('formatValidationReport(): options.header is a pending Promise — readHeader(source) is ' +
|
|
126
|
+
'async, so the header is what it resolves to rather than what it returns. Next: await ' +
|
|
127
|
+
'it once into a variable and put that on the option, or pass recording.header, which ' +
|
|
128
|
+
'is already resolved.');
|
|
129
|
+
}
|
|
110
130
|
throw new RangeError('formatValidationReport(): options.header is not a header — nothing on it carries the ' +
|
|
111
131
|
'labels this names the rows with, which is all this option does. Next: pass ' +
|
|
112
132
|
'recording.header, or omit it and the rows read `signal 0`.');
|
|
113
133
|
}
|
|
134
|
+
/*
|
|
135
|
+
* And that it is THIS file's header, which nothing asked.
|
|
136
|
+
*
|
|
137
|
+
* The report and the header arrive as separate arguments and are only ever paired by a caller —
|
|
138
|
+
* the shape `resolveTimeWindow` guards for its timeline and index, where it is "not a wrong
|
|
139
|
+
* number but a wrong FILE". Here it is a wrong file's NAMES on a right file's numbers, and this
|
|
140
|
+
* option's whole job is those names: the difference between `EEG Fpz-Cz` and `signal 0`.
|
|
141
|
+
*
|
|
142
|
+
* A header from another recording labelled row 0 with its own signal 0 and left the rest reading
|
|
143
|
+
* `signal 1`, `signal 2` — so the output looks like a file where only some channels are named,
|
|
144
|
+
* which makes the wrong label harder to notice rather than easier. `validate-index-reuse.test.ts`
|
|
145
|
+
* lists the routes for the sibling mistake and they are the same here: "a viewer holding indices
|
|
146
|
+
* for several open recordings, a helper that caches one per session, a loop that forgets to
|
|
147
|
+
* rebuild".
|
|
148
|
+
*
|
|
149
|
+
* The test is the one fact the two share: every signal the report mentions has to exist in the
|
|
150
|
+
* header. A header that cannot name every row is certainly not this report's. It is a floor
|
|
151
|
+
* rather than a proof — a wrong header with enough signals still passes — and `signalStats` is
|
|
152
|
+
* only filled when `scanSamples` was on, so the diagnostics' own indices are counted too.
|
|
153
|
+
*/
|
|
154
|
+
const mentioned = [
|
|
155
|
+
...report.signalStats.map((stat) => stat.signalIndex),
|
|
156
|
+
...report.diagnostics.map((diagnostic) => diagnostic.signalIndex),
|
|
157
|
+
].filter((index) => typeof index === 'number');
|
|
158
|
+
const signalCount = options.header.signals.length;
|
|
159
|
+
const beyond = mentioned.find((index) => index >= signalCount);
|
|
160
|
+
if (beyond !== undefined) {
|
|
161
|
+
throw new RangeError(`formatValidationReport(): options.header has ${signalCount} signals and this report has ` +
|
|
162
|
+
`rows for signal ${beyond}, so it is not the header this file was validated with — the ` +
|
|
163
|
+
"rows it could name would carry another recording's channel labels. Next: pass the " +
|
|
164
|
+
'header of the recording you passed to validateRecording(recording).');
|
|
165
|
+
}
|
|
114
166
|
}
|
|
115
167
|
const header = options?.header;
|
|
116
168
|
// Before anything is rendered, and outside the `diagnostics.length > 0` branch below. A report
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-report.js","sourceRoot":"","sources":["../src/format-report.ts"],"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AC,MAAM,CAAC,CAAC,CAAC;QAEpE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,KAAK,CAAC,IAAI,CACR,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG;gBACpF,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAC/B,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACR,iBAAiB,CAAC,MAAM,CAAC,WAAW,EAAE;YACpC,QAAQ;YACR,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SACvF,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,42 @@ 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.271
|
|
10
|
+
|
|
11
|
+
- **Fixed** `formatValidationReport(report, { header })` accepting a header from a different
|
|
12
|
+
recording, and labelling the rows with it. The two arrive as separate arguments and are only ever
|
|
13
|
+
paired by a caller — the shape `resolveTimeWindow` guards for its timeline and index, where it is
|
|
14
|
+
"not a wrong number but a wrong FILE". Here it is a wrong file's names on a right file's numbers,
|
|
15
|
+
and this option's whole job is those names.
|
|
16
|
+
- It answered. Row 0 took the other recording's signal 0 label and the rows that header had no signal
|
|
17
|
+
for fell back to `signal 1`, `signal 2` — so the output read as a file where only some channels are
|
|
18
|
+
named, which makes the wrong label harder to notice rather than easier. A reader comparing an
|
|
19
|
+
observed range against a channel name was reading two recordings on one line.
|
|
20
|
+
- The check is the one fact the two share: every signal the report mentions must exist in the header,
|
|
21
|
+
counting both `signalStats` and the diagnostics' own indices, since `signalStats` is only filled
|
|
22
|
+
when `scanSamples` was on.
|
|
23
|
+
- It is a floor rather than a proof, and the test says so: a wrong header with enough signals still
|
|
24
|
+
passes, because a report and a header carry no identifier to compare. A report with no rows at all,
|
|
25
|
+
and an omitted option, are unchanged.
|
|
26
|
+
|
|
27
|
+
## 0.6.270
|
|
28
|
+
|
|
29
|
+
- **Fixed** `formatValidationReport(report, { header: readHeader(source) })` being told "options.header
|
|
30
|
+
is not a header — nothing on it carries the labels this names the rows with". True of a pending
|
|
31
|
+
Promise, and of a chunk, a recording, a number and `{}`.
|
|
32
|
+
- The forgotten-await sweep of 0.6.229–0.6.239 reached every published call that takes a header, and
|
|
33
|
+
0.6.238 recorded it as closed: "every header-taking call now names the keyword". That was true of
|
|
34
|
+
the arguments. `options.header` is the one field in the package that holds a header, so it is the
|
|
35
|
+
one place a sweep over entry points could not reach by walking their parameters.
|
|
36
|
+
- It is also where the keyword is likeliest to be on screen already and in the wrong place. This
|
|
37
|
+
option "is the one a caller adds last, to a call that already worked", and that call is awaited — so
|
|
38
|
+
a reader writing `{ header: readHeader(source) }` has an `await` in the line and no reason to look
|
|
39
|
+
at it.
|
|
40
|
+
- The old advice named `recording.header`, which a caller holding the bare header `readHeader` hands
|
|
41
|
+
back does not have. The new one says to await it once into a variable.
|
|
42
|
+
- The existing sentence is unchanged for the shapes it was written for — a chunk, whose `signals`
|
|
43
|
+
entries carry samples rather than labels, is the case 0.6.183 and 0.6.186 settled this rule for.
|
|
44
|
+
|
|
9
45
|
## 0.6.269
|
|
10
46
|
|
|
11
47
|
- **Fixed** a RegExp being described as "an object" by the guards that refuse one. `typeof` answers
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/format-report.ts
CHANGED
|
@@ -121,12 +121,68 @@ export function formatValidationReport(
|
|
|
121
121
|
Array.isArray(signals) &&
|
|
122
122
|
(signals.length === 0 || typeof (signals[0] as { label?: unknown })?.label === 'string');
|
|
123
123
|
if (!named) {
|
|
124
|
+
/*
|
|
125
|
+
* A FORGOTTEN AWAIT, which the sweep across 0.6.229–0.6.239 reached every header-taking CALL
|
|
126
|
+
* for and no header-taking OPTION. This is the only one: `options.header` is the one field in
|
|
127
|
+
* the package that holds a header, so it is the one place that sweep could not have covered by
|
|
128
|
+
* walking the entry points.
|
|
129
|
+
*
|
|
130
|
+
* `{ header: readHeader(source) }` is how it gets written, because this option "is also the
|
|
131
|
+
* one a caller adds last, to a call that already worked" — and the call it is added to is
|
|
132
|
+
* already `await`-ed, so the keyword is in the line and in the wrong place. "Nothing on it
|
|
133
|
+
* carries the labels" is true of a pending Promise and of almost everything else, and the
|
|
134
|
+
* advice names a field on a recording a caller holding a bare header may not have.
|
|
135
|
+
*
|
|
136
|
+
* A property read, never a call.
|
|
137
|
+
*/
|
|
138
|
+
if (typeof (options.header as { then?: unknown } | null | undefined)?.then === 'function') {
|
|
139
|
+
throw new RangeError(
|
|
140
|
+
'formatValidationReport(): options.header is a pending Promise — readHeader(source) is ' +
|
|
141
|
+
'async, so the header is what it resolves to rather than what it returns. Next: await ' +
|
|
142
|
+
'it once into a variable and put that on the option, or pass recording.header, which ' +
|
|
143
|
+
'is already resolved.',
|
|
144
|
+
);
|
|
145
|
+
}
|
|
124
146
|
throw new RangeError(
|
|
125
147
|
'formatValidationReport(): options.header is not a header — nothing on it carries the ' +
|
|
126
148
|
'labels this names the rows with, which is all this option does. Next: pass ' +
|
|
127
149
|
'recording.header, or omit it and the rows read `signal 0`.',
|
|
128
150
|
);
|
|
129
151
|
}
|
|
152
|
+
/*
|
|
153
|
+
* And that it is THIS file's header, which nothing asked.
|
|
154
|
+
*
|
|
155
|
+
* The report and the header arrive as separate arguments and are only ever paired by a caller —
|
|
156
|
+
* the shape `resolveTimeWindow` guards for its timeline and index, where it is "not a wrong
|
|
157
|
+
* number but a wrong FILE". Here it is a wrong file's NAMES on a right file's numbers, and this
|
|
158
|
+
* option's whole job is those names: the difference between `EEG Fpz-Cz` and `signal 0`.
|
|
159
|
+
*
|
|
160
|
+
* A header from another recording labelled row 0 with its own signal 0 and left the rest reading
|
|
161
|
+
* `signal 1`, `signal 2` — so the output looks like a file where only some channels are named,
|
|
162
|
+
* which makes the wrong label harder to notice rather than easier. `validate-index-reuse.test.ts`
|
|
163
|
+
* lists the routes for the sibling mistake and they are the same here: "a viewer holding indices
|
|
164
|
+
* for several open recordings, a helper that caches one per session, a loop that forgets to
|
|
165
|
+
* rebuild".
|
|
166
|
+
*
|
|
167
|
+
* The test is the one fact the two share: every signal the report mentions has to exist in the
|
|
168
|
+
* header. A header that cannot name every row is certainly not this report's. It is a floor
|
|
169
|
+
* rather than a proof — a wrong header with enough signals still passes — and `signalStats` is
|
|
170
|
+
* only filled when `scanSamples` was on, so the diagnostics' own indices are counted too.
|
|
171
|
+
*/
|
|
172
|
+
const mentioned = [
|
|
173
|
+
...report.signalStats.map((stat) => stat.signalIndex),
|
|
174
|
+
...report.diagnostics.map((diagnostic) => diagnostic.signalIndex),
|
|
175
|
+
].filter((index): index is number => typeof index === 'number');
|
|
176
|
+
const signalCount = (options.header as EdfHeader).signals.length;
|
|
177
|
+
const beyond = mentioned.find((index) => index >= signalCount);
|
|
178
|
+
if (beyond !== undefined) {
|
|
179
|
+
throw new RangeError(
|
|
180
|
+
`formatValidationReport(): options.header has ${signalCount} signals and this report has ` +
|
|
181
|
+
`rows for signal ${beyond}, so it is not the header this file was validated with — the ` +
|
|
182
|
+
"rows it could name would carry another recording's channel labels. Next: pass the " +
|
|
183
|
+
'header of the recording you passed to validateRecording(recording).',
|
|
184
|
+
);
|
|
185
|
+
}
|
|
130
186
|
}
|
|
131
187
|
const header = options?.header;
|
|
132
188
|
|