edfcore 0.6.286 → 0.6.287

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.
@@ -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.286";
112
+ export declare const VERSION = "0.6.287";
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.286';
82
+ export const VERSION = '0.6.287';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../src/tal/ticks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAwED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAOxD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAQ1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAA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OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2EpE"}
package/dist/tal/ticks.js CHANGED
@@ -260,6 +260,39 @@ export function secondsToTicks(seconds, name) {
260
260
  'variable, query parameter or config key yields NaN, and a division by zero yields ' +
261
261
  'Infinity.'));
262
262
  }
263
- return BigInt(Math.round(seconds * TICKS_PER_SECOND_FLOAT));
263
+ /*
264
+ * The PRODUCT, which the finiteness check above cannot see.
265
+ *
266
+ * A tick is 100 ns, so this multiplies by ten million — and above about 1.8e301 seconds the
267
+ * result is `Infinity` for an argument that was finite. `Math.round(Infinity)` is `Infinity`, and
268
+ * `BigInt(Infinity)` is V8's "The number Infinity cannot be converted to a BigInt because it is
269
+ * not an integer": no `Next:` clause, no mention of edfcore, naming an internal conversion and
270
+ * saying "is not an integer" about a value the caller never produced. It escaped on eleven public
271
+ * calls — `readWindow` on either bound, `readEnvelope`, `readEnvelopeAtResolution`,
272
+ * `streamRecords`, `resolveTimeWindow`, `trimToWindow`, `segmentAt`, `filterAnnotationsByTime`,
273
+ * `annotationsAt` and `gridSampleIndexAt`.
274
+ *
275
+ * `nan-seconds-reaches.test.ts` is the sweep this belongs to and states the premise: "The
276
+ * guarantee is that a `NaN` cannot get PAST it." A finite bound that overflows inside the
277
+ * conversion is the fourth value, and the one the guard above lets through.
278
+ *
279
+ * `Number.MAX_VALUE` is how it arrives, and the check above is what sends a caller to it. Asking
280
+ * for "as much as there is" is what a sentinel is for, and this package accepts one for a row
281
+ * limit — so `Infinity` is the first thing tried on a time bound, it is refused here with advice
282
+ * to go and audit the expression that produced it, and `Number.MAX_VALUE` is the second. That one
283
+ * broke the contract instead of refusing.
284
+ *
285
+ * No caller-specific advice: the docblock above records what that costs — the old wording was
286
+ * "right for five of the fifteen call sites and wrong for the rest" — so this names the mistake
287
+ * itself, which is the same for a window, an instant and a bucket width (0.6.287).
288
+ */
289
+ const ticks = Math.round(seconds * TICKS_PER_SECOND_FLOAT);
290
+ if (!Number.isFinite(ticks)) {
291
+ throw new RangeError(`${name} is ${seconds} seconds, which is finite but has no tick count — a tick is 100 ns, ` +
292
+ 'so the conversion overflows float64 above about 1.8e301 seconds. Next: pass the value ' +
293
+ 'you mean rather than a sentinel for as much as possible — a bound past the end of the ' +
294
+ 'recording is clamped to it, so none of them has to be large.');
295
+ }
296
+ return BigInt(ticks);
264
297
  }
265
298
  //# sourceMappingURL=ticks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ticks.js","sourceRoot":"","sources":["../../src/tal/ticks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAoBnD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,gGAAgG;AAChG,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAQxD,MAAM,gBAAgB,GAAmB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAElE,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC;AAClD,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,IAAY,EAAE,KAAa;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IACxB,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,IAAI,KAAK,GAAG,EAAE,CAAC;IAEf,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,YA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SAAS;gBACpB,CAAC,CAAC,gFAAgF;oBAChF,iFAAiF;oBACjF,0CAA0C;gBAC5C,CAAC,CAAC,4EAA4E;oBAC5E,oFAAoF;oBACpF,WAAW,CAAC,CACnB,CAAC;IACJ,CAAC;IACD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,sBAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,OAAO,OAAO,sEAAsE;YACzF,wFAAwF;YACxF,wFAAwF;YACxF,8DAA8D,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,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.287
10
+
11
+ - **Fixed** a finite time bound escaping as V8's "The number Infinity cannot be converted to a BigInt
12
+ because it is not an integer" — no `Next:` clause, no mention of edfcore, naming an internal
13
+ conversion and saying "is not an integer" about a value the caller never produced.
14
+ - A tick is 100 ns, so `secondsToTicks` multiplies by ten million, and above about 1.8e301 seconds
15
+ that product is `Infinity` for an argument `Number.isFinite` had just accepted. The finiteness check
16
+ sits one line above the multiplication that creates one.
17
+ - It escaped on eleven public calls: `readWindow` on either bound, `readEnvelope`,
18
+ `readEnvelopeAtResolution`, `streamRecords`, `resolveTimeWindow`, `trimToWindow`, `segmentAt`,
19
+ `filterAnnotationsByTime`, `annotationsAt` and `gridSampleIndexAt`.
20
+ - `Number.MAX_VALUE` is how it arrives, and the existing check is what sends a caller to it: asking
21
+ for "as much as there is" is what a sentinel is for, `Infinity` is refused with advice to audit the
22
+ expression that produced it, and `Number.MAX_VALUE` is the next thing tried.
23
+ - No sentinel was ever needed — a duration past the end of the recording is clamped to it, which is
24
+ what the new advice says. The message names the mistake rather than a window, because fifteen call
25
+ sites share this resolver and the resolver's docblock records what caller-specific advice costs.
26
+
9
27
  ## 0.6.286
10
28
 
11
29
  - **Fixed** the second of the two calls that dispatched on `match instanceof RegExp`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.286",
3
+ "version": "0.6.287",
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.286';
96
+ export const VERSION = '0.6.287';
package/src/tal/ticks.ts CHANGED
@@ -298,5 +298,40 @@ export function secondsToTicks(seconds: number, name: string): bigint {
298
298
  'Infinity.'),
299
299
  );
300
300
  }
301
- return BigInt(Math.round(seconds * TICKS_PER_SECOND_FLOAT));
301
+ /*
302
+ * The PRODUCT, which the finiteness check above cannot see.
303
+ *
304
+ * A tick is 100 ns, so this multiplies by ten million — and above about 1.8e301 seconds the
305
+ * result is `Infinity` for an argument that was finite. `Math.round(Infinity)` is `Infinity`, and
306
+ * `BigInt(Infinity)` is V8's "The number Infinity cannot be converted to a BigInt because it is
307
+ * not an integer": no `Next:` clause, no mention of edfcore, naming an internal conversion and
308
+ * saying "is not an integer" about a value the caller never produced. It escaped on eleven public
309
+ * calls — `readWindow` on either bound, `readEnvelope`, `readEnvelopeAtResolution`,
310
+ * `streamRecords`, `resolveTimeWindow`, `trimToWindow`, `segmentAt`, `filterAnnotationsByTime`,
311
+ * `annotationsAt` and `gridSampleIndexAt`.
312
+ *
313
+ * `nan-seconds-reaches.test.ts` is the sweep this belongs to and states the premise: "The
314
+ * guarantee is that a `NaN` cannot get PAST it." A finite bound that overflows inside the
315
+ * conversion is the fourth value, and the one the guard above lets through.
316
+ *
317
+ * `Number.MAX_VALUE` is how it arrives, and the check above is what sends a caller to it. Asking
318
+ * for "as much as there is" is what a sentinel is for, and this package accepts one for a row
319
+ * limit — so `Infinity` is the first thing tried on a time bound, it is refused here with advice
320
+ * to go and audit the expression that produced it, and `Number.MAX_VALUE` is the second. That one
321
+ * broke the contract instead of refusing.
322
+ *
323
+ * No caller-specific advice: the docblock above records what that costs — the old wording was
324
+ * "right for five of the fifteen call sites and wrong for the rest" — so this names the mistake
325
+ * itself, which is the same for a window, an instant and a bucket width (0.6.287).
326
+ */
327
+ const ticks = Math.round(seconds * TICKS_PER_SECOND_FLOAT);
328
+ if (!Number.isFinite(ticks)) {
329
+ throw new RangeError(
330
+ `${name} is ${seconds} seconds, which is finite but has no tick count — a tick is 100 ns, ` +
331
+ 'so the conversion overflows float64 above about 1.8e301 seconds. Next: pass the value ' +
332
+ 'you mean rather than a sentinel for as much as possible — a bound past the end of the ' +
333
+ 'recording is clamped to it, so none of them has to be large.',
334
+ );
335
+ }
336
+ return BigInt(ticks);
302
337
  }