edfcore 0.6.140 → 0.6.141
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/chunks.d.ts.map +1 -1
- package/dist/chunks.js +18 -0
- package/dist/chunks.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/docs/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/chunks.ts +22 -0
- package/src/constants.ts +1 -1
package/dist/chunks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;AAsI1E;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,CAmGjE"}
|
package/dist/chunks.js
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import { appendDiagnostics } from './diagnostics/collector.js';
|
|
24
24
|
import { ticksToSeconds } from './tal/ticks.js';
|
|
25
25
|
import { pluralise } from './text/counted.js';
|
|
26
|
+
import { describeValue } from './text/describe.js';
|
|
26
27
|
/** Reads as one line at the call site, and keeps the `chunks[i]` non-null assertions out of it. */
|
|
27
28
|
function at(chunks, index) {
|
|
28
29
|
const chunk = chunks[index];
|
|
@@ -146,6 +147,23 @@ function assertJoinable(previous, next, index) {
|
|
|
146
147
|
* separate call rather than something `readWindow` does on the way out.
|
|
147
148
|
*/
|
|
148
149
|
export function mergeChunks(chunks) {
|
|
150
|
+
/*
|
|
151
|
+
* The ARRAY, before a length is read off it.
|
|
152
|
+
*
|
|
153
|
+
* `readWindow` resolves to one chunk per contiguous run, and on a continuous file that is an
|
|
154
|
+
* array of one — so a caller who has only ever seen one chunk holds a chunk, and
|
|
155
|
+
* `mergeChunks(chunk)` is what they write. `chunks.length` was then `undefined`, which is not
|
|
156
|
+
* `0`, and `at(chunks, 0)` refused with "no chunk at 0. Next: pass the array readWindow()
|
|
157
|
+
* returned, with no holes and nothing spliced out of it" — a message about holes in an array,
|
|
158
|
+
* to someone who never had one. `null` did not even get that far: `Cannot read properties of
|
|
159
|
+
* null (reading 'length')`.
|
|
160
|
+
*/
|
|
161
|
+
if (!Array.isArray(chunks)) {
|
|
162
|
+
throw new RangeError(`mergeChunks: the chunks are ${typeof chunks?.records === 'object'
|
|
163
|
+
? 'one chunk rather than an array of them'
|
|
164
|
+
: `${describeValue(chunks)}, not an array`}. Next: pass what readWindow() resolved to — it is the array this takes even on a ` +
|
|
165
|
+
'continuous file, where it holds exactly one chunk.');
|
|
166
|
+
}
|
|
149
167
|
if (chunks.length === 0) {
|
|
150
168
|
throw new RangeError('mergeChunks: nothing to merge. `readWindow` returns [] for a window that lands past the ' +
|
|
151
169
|
'end of the recording, and for one that lands entirely inside a gap. Next: check the ' +
|
package/dist/chunks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.js","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"chunks.js","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE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AAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,UAAU;QACtE,eAAe,EAAE,cAAc,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC;QACxF,UAAU,EAAE,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"}
|
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.141";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ 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.141
|
|
10
|
+
|
|
11
|
+
- **Fixed** `mergeChunks(chunk)` — one chunk where the array belongs — being refused with "no chunk
|
|
12
|
+
at 0. Next: pass the array readWindow() returned, with no holes and nothing spliced out of it", a
|
|
13
|
+
message about holes in an array the caller never had. `null` did not reach even that: `Cannot
|
|
14
|
+
read properties of null (reading 'length')`.
|
|
15
|
+
- On a continuous file `readWindow` resolves to an array of exactly one, so a caller who has only
|
|
16
|
+
ever seen one chunk holds a chunk. The refusal now says that, and says the array is what this
|
|
17
|
+
takes even then.
|
|
18
|
+
|
|
9
19
|
## 0.6.140
|
|
10
20
|
|
|
11
21
|
- **Fixed** `cachedSource(source, 4 * 1024 * 1024)` — a bare number where the cache options belong
|
package/package.json
CHANGED
package/src/chunks.ts
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import { appendDiagnostics } from './diagnostics/collector.js';
|
|
25
25
|
import { ticksToSeconds } from './tal/ticks.js';
|
|
26
26
|
import { pluralise } from './text/counted.js';
|
|
27
|
+
import { describeValue } from './text/describe.js';
|
|
27
28
|
import type { EdfChunk, EdfChunkSignal, EdfDiagnostic } from './types.js';
|
|
28
29
|
|
|
29
30
|
/** Reads as one line at the call site, and keeps the `chunks[i]` non-null assertions out of it. */
|
|
@@ -169,6 +170,27 @@ function assertJoinable(previous: EdfChunk, next: EdfChunk, index: number): void
|
|
|
169
170
|
* separate call rather than something `readWindow` does on the way out.
|
|
170
171
|
*/
|
|
171
172
|
export function mergeChunks(chunks: readonly EdfChunk[]): EdfChunk {
|
|
173
|
+
/*
|
|
174
|
+
* The ARRAY, before a length is read off it.
|
|
175
|
+
*
|
|
176
|
+
* `readWindow` resolves to one chunk per contiguous run, and on a continuous file that is an
|
|
177
|
+
* array of one — so a caller who has only ever seen one chunk holds a chunk, and
|
|
178
|
+
* `mergeChunks(chunk)` is what they write. `chunks.length` was then `undefined`, which is not
|
|
179
|
+
* `0`, and `at(chunks, 0)` refused with "no chunk at 0. Next: pass the array readWindow()
|
|
180
|
+
* returned, with no holes and nothing spliced out of it" — a message about holes in an array,
|
|
181
|
+
* to someone who never had one. `null` did not even get that far: `Cannot read properties of
|
|
182
|
+
* null (reading 'length')`.
|
|
183
|
+
*/
|
|
184
|
+
if (!Array.isArray(chunks)) {
|
|
185
|
+
throw new RangeError(
|
|
186
|
+
`mergeChunks: the chunks are ${
|
|
187
|
+
typeof (chunks as unknown as EdfChunk | undefined)?.records === 'object'
|
|
188
|
+
? 'one chunk rather than an array of them'
|
|
189
|
+
: `${describeValue(chunks)}, not an array`
|
|
190
|
+
}. Next: pass what readWindow() resolved to — it is the array this takes even on a ` +
|
|
191
|
+
'continuous file, where it holds exactly one chunk.',
|
|
192
|
+
);
|
|
193
|
+
}
|
|
172
194
|
if (chunks.length === 0) {
|
|
173
195
|
throw new RangeError(
|
|
174
196
|
'mergeChunks: nothing to merge. `readWindow` returns [] for a window that lands past the ' +
|
package/src/constants.ts
CHANGED