edfcore 0.6.221 → 0.6.222
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/io/source.d.ts.map +1 -1
- package/dist/io/source.js +23 -0
- package/dist/io/source.js.map +1 -1
- package/docs/CHANGELOG.md +18 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/io/source.ts +23 -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.222";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/io/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/io/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC;AAMvB;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAYhG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CA8BxF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,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
|
@@ -207,6 +207,29 @@ function adapterFor(source) {
|
|
|
207
207
|
typeof candidate.arrayBuffer === 'function') {
|
|
208
208
|
return 'that looks like a Blob or a File — use blobSource(file)';
|
|
209
209
|
}
|
|
210
|
+
/*
|
|
211
|
+
* The RECORDING, which carries the source on `.source` rather than being it.
|
|
212
|
+
*
|
|
213
|
+
* No adapter turns one into a `ByteSource` — it already holds the one it was opened from — so
|
|
214
|
+
* this reader is the only one the generic list has nothing for: four adapters for bytes, a path,
|
|
215
|
+
* a File and a URL, to someone holding none of them and an open file instead.
|
|
216
|
+
*
|
|
217
|
+
* `inspectEdf(source)` is where they meet it. It is the one call in the convenience layer whose
|
|
218
|
+
* first argument is a source, and it sits in the barrel beside `readWindow`, `readRecords`,
|
|
219
|
+
* `readAnnotations`, `readEnvelope` and `readTriggers` — every one of which takes the recording.
|
|
220
|
+
* `readRecordBytes(recording.source, recording.header, records)` is the other route: the idiom
|
|
221
|
+
* `physical-values.md` and `reading-signals.md` both write out, with one field left off the
|
|
222
|
+
* argument that needs it and kept on the one beside it.
|
|
223
|
+
*
|
|
224
|
+
* `assertRecording` has named the mirror of this since 0.6.90 — "that is a header, not a
|
|
225
|
+
* recording — a recording also carries the source, the timeline and the index" — because every
|
|
226
|
+
* primitive takes the header and the shape is easy to reach for. This is that confusion pointed
|
|
227
|
+
* the other way, and it is the one direction the package answered with a list.
|
|
228
|
+
*/
|
|
229
|
+
const opened = source;
|
|
230
|
+
if (typeof opened?.source?.read === 'function' && typeof opened.header === 'object') {
|
|
231
|
+
return 'that is a recording — it carries the source on .source rather than being one, so pass recording.source';
|
|
232
|
+
}
|
|
210
233
|
return ('use byteSource(bytes) for bytes in memory, fileSource(path) from "edfcore/node" for a file, ' +
|
|
211
234
|
'blobSource(file) for a File, or httpSource(url) for a URL');
|
|
212
235
|
}
|
package/dist/io/source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/io/source.ts"],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,CAAC;IACD,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,IAAI,cAAc,CACtB,mFAAmF;QACjF,GAAG,QAAQ,WAAW,UAAU,CAAC,MAAM,CAAC,GAAG,EAC7C,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,CAClC,CAAC;AACJ,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,24 @@ 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.222
|
|
10
|
+
|
|
11
|
+
- **Fixed** the source guard offering four adapters to a caller holding an open recording.
|
|
12
|
+
`assertByteSource` answers a wrong first argument with the adapter that would have fixed it —
|
|
13
|
+
`byteSource(bytes)` for bytes, `fileSource(path)` for a path, `blobSource(file)` for a File — and
|
|
14
|
+
falls back to listing all four. A recording is the one shape no adapter applies to: it already
|
|
15
|
+
holds the source it was opened from, on `.source`. The reader least in need of one got four.
|
|
16
|
+
- `inspectEdf(source)` is where they meet it. It is the one call in the convenience layer whose
|
|
17
|
+
first argument is a source, and it sits in the barrel beside `readWindow`, `readRecords`,
|
|
18
|
+
`readAnnotations`, `readEnvelope` and `readTriggers` — every one of which takes the recording.
|
|
19
|
+
`readRecordBytes(recording.source, recording.header, records)` is the other route, reached by
|
|
20
|
+
leaving `.source` off the argument that needs it while keeping `.header` on the one beside it.
|
|
21
|
+
- 0.6.90 named the mirror of this for `assertRecording` — "that is a header, not a recording" —
|
|
22
|
+
because every primitive takes the header. This is the same confusion pointed the other way, and
|
|
23
|
+
it was the direction the package answered with a list.
|
|
24
|
+
- Only the `Next:` clause changes. It stays an `EdfSourceError` carrying `offset` and
|
|
25
|
+
`requestedLength`, and every other wrong argument keeps the adapter it always had.
|
|
26
|
+
|
|
9
27
|
## 0.6.221
|
|
10
28
|
|
|
11
29
|
- **Fixed** the record-range refusal advising a clamp to a caller who passed no numbers to clamp.
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/io/source.ts
CHANGED
|
@@ -242,6 +242,29 @@ function adapterFor(source: unknown): string {
|
|
|
242
242
|
) {
|
|
243
243
|
return 'that looks like a Blob or a File — use blobSource(file)';
|
|
244
244
|
}
|
|
245
|
+
/*
|
|
246
|
+
* The RECORDING, which carries the source on `.source` rather than being it.
|
|
247
|
+
*
|
|
248
|
+
* No adapter turns one into a `ByteSource` — it already holds the one it was opened from — so
|
|
249
|
+
* this reader is the only one the generic list has nothing for: four adapters for bytes, a path,
|
|
250
|
+
* a File and a URL, to someone holding none of them and an open file instead.
|
|
251
|
+
*
|
|
252
|
+
* `inspectEdf(source)` is where they meet it. It is the one call in the convenience layer whose
|
|
253
|
+
* first argument is a source, and it sits in the barrel beside `readWindow`, `readRecords`,
|
|
254
|
+
* `readAnnotations`, `readEnvelope` and `readTriggers` — every one of which takes the recording.
|
|
255
|
+
* `readRecordBytes(recording.source, recording.header, records)` is the other route: the idiom
|
|
256
|
+
* `physical-values.md` and `reading-signals.md` both write out, with one field left off the
|
|
257
|
+
* argument that needs it and kept on the one beside it.
|
|
258
|
+
*
|
|
259
|
+
* `assertRecording` has named the mirror of this since 0.6.90 — "that is a header, not a
|
|
260
|
+
* recording — a recording also carries the source, the timeline and the index" — because every
|
|
261
|
+
* primitive takes the header and the shape is easy to reach for. This is that confusion pointed
|
|
262
|
+
* the other way, and it is the one direction the package answered with a list.
|
|
263
|
+
*/
|
|
264
|
+
const opened = source as { source?: { read?: unknown }; header?: unknown } | null | undefined;
|
|
265
|
+
if (typeof opened?.source?.read === 'function' && typeof opened.header === 'object') {
|
|
266
|
+
return 'that is a recording — it carries the source on .source rather than being one, so pass recording.source';
|
|
267
|
+
}
|
|
245
268
|
return (
|
|
246
269
|
'use byteSource(bytes) for bytes in memory, fileSource(path) from "edfcore/node" for a file, ' +
|
|
247
270
|
'blobSource(file) for a File, or httpSource(url) for a URL'
|