edfcore 0.6.263 → 0.6.264
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 +19 -10
- package/dist/io/source.js.map +1 -1
- package/docs/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/io/source.ts +19 -10
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.264";
|
|
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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
@@ -263,21 +263,30 @@ function adapterFor(source) {
|
|
|
263
263
|
/*
|
|
264
264
|
* A FORGOTTEN AWAIT, and the one whose advice named the call that produced it.
|
|
265
265
|
*
|
|
266
|
-
* `fileSource(
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
266
|
+
* `openEdf(fileSource("recording.edf"))` is the Node quickstart with one keyword missing, and the
|
|
267
|
+
* list below answered it with `fileSource(path) from "edfcore/node" for a file` — the call the
|
|
268
|
+
* reader had just made. 0.6.215 named that shape for the index guard: advice a reader follows and
|
|
269
|
+
* arrives back where they started.
|
|
270
|
+
*
|
|
271
|
+
* TWO adapters are async, not one. 0.6.222 wrote "fileSource(path) is the only async adapter in
|
|
272
|
+
* the package" into this branch and listed `httpSource` among the ones that do not need awaiting;
|
|
273
|
+
* `httpSource` is declared `async` and its own docblock gives the reason — "async because it
|
|
274
|
+
* probes the server for range support and a length before returning". So the reader who wrote
|
|
275
|
+
* `openEdf(httpSource(url))`, which is the browser and remote quickstart with the same keyword
|
|
276
|
+
* missing, was told in the same sentence that their adapter is not one of the ones this is about.
|
|
277
|
+
*
|
|
278
|
+
* That is worse than saying nothing. The shape is already named correctly — "that is a pending
|
|
279
|
+
* Promise" — and the clause after it then argued the reader out of the fix.
|
|
280
|
+
*
|
|
281
|
+
* `byteSource`, `blobSource` and `cachedSource` are synchronous, which is why naming the keyword
|
|
282
|
+
* is worth it at all: the two that need it are the two that touch something outside the process.
|
|
271
283
|
*
|
|
272
284
|
* Four published entry points take a source — `openEdf`, `readHeader`, `readRecordBytes`,
|
|
273
285
|
* `inspectEdf` — and `cachedSource` wraps one, so all five said it.
|
|
274
|
-
*
|
|
275
|
-
* The other adapters are synchronous, which is why the keyword is worth naming rather than just
|
|
276
|
-
* the shape: there is exactly one call in this package whose result needs awaiting here.
|
|
277
286
|
*/
|
|
278
287
|
if (typeof source?.then === 'function') {
|
|
279
|
-
return ('that is a pending Promise — fileSource(path) from "edfcore/node"
|
|
280
|
-
'
|
|
288
|
+
return ('that is a pending Promise — fileSource(path) from "edfcore/node" and httpSource(url) are ' +
|
|
289
|
+
'both async, so both need awaiting; byteSource, blobSource and cachedSource do not');
|
|
281
290
|
}
|
|
282
291
|
const opened = source;
|
|
283
292
|
if (typeof opened?.source?.read === 'function' && typeof opened.header === 'object') {
|
package/dist/io/source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/io/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,SAAS,gBAAgB,CAAC,QAAiB;IACzC,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAoB,EAAE,MAAc,EAAE,MAAc;IAClF,MAAM,cAAc,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,cAAc,KAAK,MAAM;QAAE,OAAO,QAAQ,CAAC;IAC/C,MAAM,GAAG,GACP,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,GAAG,cAAc,QAAQ,CAAC;IAChG,MAAM,IAAI,cAAc,CACtB,0BAA0B,MAAM,YAAY,MAAM,mBAAmB,GAAG,iBAAiB;QACvF,gFAAgF;QAChF,oFAAoF;QACpF,6EAA6E,EAC/E,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,CACpD,CAA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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,22 @@ 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.264
|
|
10
|
+
|
|
11
|
+
- **Fixed** the forgotten-await advice every source guard gives listing `httpSource` among the adapters
|
|
12
|
+
that do **not** need awaiting. It does: `httpSource` is declared `async`, and its own docblock says
|
|
13
|
+
why — "async because it probes the server for range support and a length before returning".
|
|
14
|
+
- So `openEdf(httpSource(url))` — the browser and remote quickstart with exactly the keyword this
|
|
15
|
+
branch exists to name left off — was told "that is a pending Promise", correctly, and then told in
|
|
16
|
+
the same sentence that its adapter is not one of the ones that is async. Saying nothing would have
|
|
17
|
+
been better: the list this branch replaced in 0.6.222 at least did not contradict the mistake.
|
|
18
|
+
- Both async adapters are now named together, and `byteSource`, `blobSource` and `cachedSource` are
|
|
19
|
+
named as the synchronous ones. `cachedSource` was missing from either side.
|
|
20
|
+
- Five published surfaces share the sentence — `openEdf`, `readHeader`, `readRecordBytes`,
|
|
21
|
+
`inspectEdf` and `cachedSource` — so all five were saying it, and all five are pinned.
|
|
22
|
+
- 0.6.222's own test recorded the claim under the heading "names the pending Promise and the one
|
|
23
|
+
adapter that is async". That assertion is corrected here rather than left standing.
|
|
24
|
+
|
|
9
25
|
## 0.6.263
|
|
10
26
|
|
|
11
27
|
- **Fixed** `httpSource` accepting its options as the Promise that will produce them. Every field is
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/io/source.ts
CHANGED
|
@@ -302,22 +302,31 @@ function adapterFor(source: unknown): string {
|
|
|
302
302
|
/*
|
|
303
303
|
* A FORGOTTEN AWAIT, and the one whose advice named the call that produced it.
|
|
304
304
|
*
|
|
305
|
-
* `fileSource(
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
305
|
+
* `openEdf(fileSource("recording.edf"))` is the Node quickstart with one keyword missing, and the
|
|
306
|
+
* list below answered it with `fileSource(path) from "edfcore/node" for a file` — the call the
|
|
307
|
+
* reader had just made. 0.6.215 named that shape for the index guard: advice a reader follows and
|
|
308
|
+
* arrives back where they started.
|
|
309
|
+
*
|
|
310
|
+
* TWO adapters are async, not one. 0.6.222 wrote "fileSource(path) is the only async adapter in
|
|
311
|
+
* the package" into this branch and listed `httpSource` among the ones that do not need awaiting;
|
|
312
|
+
* `httpSource` is declared `async` and its own docblock gives the reason — "async because it
|
|
313
|
+
* probes the server for range support and a length before returning". So the reader who wrote
|
|
314
|
+
* `openEdf(httpSource(url))`, which is the browser and remote quickstart with the same keyword
|
|
315
|
+
* missing, was told in the same sentence that their adapter is not one of the ones this is about.
|
|
316
|
+
*
|
|
317
|
+
* That is worse than saying nothing. The shape is already named correctly — "that is a pending
|
|
318
|
+
* Promise" — and the clause after it then argued the reader out of the fix.
|
|
319
|
+
*
|
|
320
|
+
* `byteSource`, `blobSource` and `cachedSource` are synchronous, which is why naming the keyword
|
|
321
|
+
* is worth it at all: the two that need it are the two that touch something outside the process.
|
|
310
322
|
*
|
|
311
323
|
* Four published entry points take a source — `openEdf`, `readHeader`, `readRecordBytes`,
|
|
312
324
|
* `inspectEdf` — and `cachedSource` wraps one, so all five said it.
|
|
313
|
-
*
|
|
314
|
-
* The other adapters are synchronous, which is why the keyword is worth naming rather than just
|
|
315
|
-
* the shape: there is exactly one call in this package whose result needs awaiting here.
|
|
316
325
|
*/
|
|
317
326
|
if (typeof (source as { then?: unknown } | null | undefined)?.then === 'function') {
|
|
318
327
|
return (
|
|
319
|
-
'that is a pending Promise — fileSource(path) from "edfcore/node"
|
|
320
|
-
'
|
|
328
|
+
'that is a pending Promise — fileSource(path) from "edfcore/node" and httpSource(url) are ' +
|
|
329
|
+
'both async, so both need awaiting; byteSource, blobSource and cachedSource do not'
|
|
321
330
|
);
|
|
322
331
|
}
|
|
323
332
|
const opened = source as { source?: { read?: unknown }; header?: unknown } | null | undefined;
|