edfcore 0.6.265 → 0.6.266

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 CHANGED
@@ -81,7 +81,7 @@ for (const event of annotations) {
81
81
  }
82
82
  ```
83
83
 
84
- > **Status: 0.6.x, early.** edfcore runs 4,700+ tests on generated fixtures, and it's checked
84
+ > **Status: 0.6.x, early.** edfcore runs 4,800+ tests on generated fixtures, and it's checked
85
85
  > against public corpora it didn't author: the EDF, EDF+ and 24-bit BDF+ test files from
86
86
  > teuniz.net, and PhysioNet's sleep-edfx (a real 22-hour polysomnography recording and its
87
87
  > sleep-staging file). Those checks are numeric. Channels labelled `sine 8.5 Hz` decode to
@@ -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.265";
112
+ export declare const VERSION = "0.6.266";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.6.265';
82
+ export const VERSION = '0.6.266';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAQH,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,YAAY,CAAC;AAElE;;;;;;GAMG;AACH,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CACF,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAYD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CA2F/F;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmF1E"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAQH,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,YAAY,CAAC;AAElE;;;;;;GAMG;AACH,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CACF,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAYD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CA2F/F;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+G1E"}
package/dist/node.js CHANGED
@@ -190,6 +190,31 @@ export async function fileSource(path) {
190
190
  'address. Next: use httpSource(url) from "edfcore" for one served over HTTP, blobSource(file) ' +
191
191
  'for one a browser handed you, or pass the filesystem path with no scheme on it.', { offset: 0, requestedLength: 0 });
192
192
  }
193
+ /*
194
+ * And a path that is BLANK, which `fs.open` answers with a sentence about nothing.
195
+ *
196
+ * `ENOENT: no such file or directory, open ''` is a plain `Error`: no `Next:` clause, not an
197
+ * `EdfSourceError`, so `isEdfError` says false and a caller's file-or-bug branch takes the wrong
198
+ * arm. The two guards above exist because Node's own error "names a path nobody meant"; this is
199
+ * the case where it names no path at all, and "no such file or directory" is not what went wrong —
200
+ * there was never a name to look up.
201
+ *
202
+ * It is the shape a shell and an argv produce, which is why it is worth its own sentence rather
203
+ * than an `ENOENT`. `edfcore "$FILE"` with the variable unset, `process.argv[2]` on a bare
204
+ * invocation, and a form field nobody filled in all arrive here as the empty string, and
205
+ * whitespace arrives the same way from a trimmed-to-nothing config value. 0.6.246 and 0.6.255
206
+ * closed both halves of this for `--limit`: a blank value reads as zero rather than as the
207
+ * default, and a missing one printed the word `undefined`.
208
+ *
209
+ * Only blank. Every other path that does not exist keeps Node's `ENOENT`, which names the path and
210
+ * is the most useful thing anyone can say about it.
211
+ */
212
+ if (typeof path === 'string' && path.trim() === '') {
213
+ throw new EdfSourceError(`fileSource() was given ${path === '' ? 'an empty path' : 'a path of only whitespace'}, ` +
214
+ 'which names no file — an unset shell variable, a missing argv entry and an empty form ' +
215
+ 'field all arrive this way. Next: pass the path to the recording, and check the expression ' +
216
+ 'that produced it rather than the filesystem.', { offset: 0, requestedLength: 0 });
217
+ }
193
218
  const handle = await fs.open(path, 'r');
194
219
  try {
195
220
  const stats = await handle.stat();
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,4FAA4F;AAC5F,2FAA2F;AAC3F,OAAO,KAAK,cAAc,MAAM,kBAA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oDAAoD;gBACvF,uFAAuF;gBACvF,6EAA6E,EAC/E,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,CAClC,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,cAAc,CACtB,yDAAyD,UAAU,aAAa;gBAC9E,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mEAAmE;gBAC1F,mEAAmE,EACrE,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,CAClC,CAAC;QACJ,CAAC;QACD,OAAO,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,wFAAwF;QACxF,0FAA0F;QAC1F,kFAAkF;QAClF,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,25 @@ 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.266
10
+
11
+ - **Fixed** `fileSource('')` escaping as Node's own `ENOENT: no such file or directory, open ''`. That
12
+ is a plain `Error`: no `Next:` clause, not an `EdfSourceError`, so `isEdfError` said false and a
13
+ caller's file-or-bug branch took the wrong arm. It is also not true in the way it reads — "no such
14
+ file or directory" describes a lookup that failed, and there was never a name to look up.
15
+ - Both guards above it exist because Node's error "names a path nobody meant". This is the case where
16
+ it names no path at all, which is the one a reader can do least with.
17
+ - It is the shape a shell and an argv produce, which is why it earns its own sentence: `edfcore
18
+ "$FILE"` with the variable unset, `process.argv[2]` on a bare invocation, and an empty form field
19
+ all arrive as the empty string, and a config value trimmed to nothing arrives as whitespace. 0.6.246
20
+ and 0.6.255 closed both halves of this for `--limit`.
21
+ - Only blank. Every other path that does not exist keeps Node's `ENOENT`, because that error names the
22
+ path, and the path is the most useful thing anyone can say about it. The non-string and wrong-scheme
23
+ guards keep their own sentences and still run first.
24
+ - The suite's test-count claim goes from 4,700+ to 4,800+ in the README, `installation.md` and
25
+ `browser-safety.test.ts`. As in 0.6.253 it has to move in the same release as the tests that push it
26
+ over, because `test-count-claims.test.ts` reads the written-out cases.
27
+
9
28
  ## 0.6.265
10
29
 
11
30
  - **Fixed** `toPhysicalEnvelope` scaling one channel's bounds by another channel's gain, silently.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.265",
3
+ "version": "0.6.266",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.6.265';
96
+ export const VERSION = '0.6.266';
package/src/node.ts CHANGED
@@ -243,6 +243,34 @@ export async function fileSource(path: string): Promise<ClosableByteSource> {
243
243
  { offset: 0, requestedLength: 0 },
244
244
  );
245
245
  }
246
+ /*
247
+ * And a path that is BLANK, which `fs.open` answers with a sentence about nothing.
248
+ *
249
+ * `ENOENT: no such file or directory, open ''` is a plain `Error`: no `Next:` clause, not an
250
+ * `EdfSourceError`, so `isEdfError` says false and a caller's file-or-bug branch takes the wrong
251
+ * arm. The two guards above exist because Node's own error "names a path nobody meant"; this is
252
+ * the case where it names no path at all, and "no such file or directory" is not what went wrong —
253
+ * there was never a name to look up.
254
+ *
255
+ * It is the shape a shell and an argv produce, which is why it is worth its own sentence rather
256
+ * than an `ENOENT`. `edfcore "$FILE"` with the variable unset, `process.argv[2]` on a bare
257
+ * invocation, and a form field nobody filled in all arrive here as the empty string, and
258
+ * whitespace arrives the same way from a trimmed-to-nothing config value. 0.6.246 and 0.6.255
259
+ * closed both halves of this for `--limit`: a blank value reads as zero rather than as the
260
+ * default, and a missing one printed the word `undefined`.
261
+ *
262
+ * Only blank. Every other path that does not exist keeps Node's `ENOENT`, which names the path and
263
+ * is the most useful thing anyone can say about it.
264
+ */
265
+ if (typeof path === 'string' && path.trim() === '') {
266
+ throw new EdfSourceError(
267
+ `fileSource() was given ${path === '' ? 'an empty path' : 'a path of only whitespace'}, ` +
268
+ 'which names no file — an unset shell variable, a missing argv entry and an empty form ' +
269
+ 'field all arrive this way. Next: pass the path to the recording, and check the expression ' +
270
+ 'that produced it rather than the filesystem.',
271
+ { offset: 0, requestedLength: 0 },
272
+ );
273
+ }
246
274
  const handle = await fs.open(path, 'r');
247
275
  try {
248
276
  const stats = await handle.stat();