edfcore 0.6.113 → 0.6.114
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/options.d.ts +2 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +17 -2
- package/dist/options.js.map +1 -1
- package/docs/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/options.ts +17 -2
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.114";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/options.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Numeric options, refused rather than silently coerced.
|
|
3
3
|
*
|
|
4
|
-
* Layer 1. Imports one constant and nothing
|
|
4
|
+
* Layer 1. Imports one constant and one Layer 1 helper that imports nothing, so every layer can
|
|
5
|
+
* reach it — which is the
|
|
5
6
|
* point: `maxMaterializeBytes` is resolved in six modules spread across the stack — `io/read.ts`,
|
|
6
7
|
* `decode/digital.ts`, `decode/physical.ts`, `record-index.ts`, `envelope.ts` and `validate.ts` —
|
|
7
8
|
* and read raw and handed on in two more, `io/cached.ts` and `biosemi.ts`. A guard that only one
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,CAqBR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAUjF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQ1E"}
|
package/dist/options.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Numeric options, refused rather than silently coerced.
|
|
3
3
|
*
|
|
4
|
-
* Layer 1. Imports one constant and nothing
|
|
4
|
+
* Layer 1. Imports one constant and one Layer 1 helper that imports nothing, so every layer can
|
|
5
|
+
* reach it — which is the
|
|
5
6
|
* point: `maxMaterializeBytes` is resolved in six modules spread across the stack — `io/read.ts`,
|
|
6
7
|
* `decode/digital.ts`, `decode/physical.ts`, `record-index.ts`, `envelope.ts` and `validate.ts` —
|
|
7
8
|
* and read raw and handed on in two more, `io/cached.ts` and `biosemi.ts`. A guard that only one
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
* with the file, which is the same split `isEdfError` documents.
|
|
18
19
|
*/
|
|
19
20
|
import { DEFAULT_MAX_MATERIALIZE_BYTES } from './constants.js';
|
|
21
|
+
import { describeValue } from './text/describe.js';
|
|
20
22
|
/**
|
|
21
23
|
* `undefined` takes the default; anything non-finite throws. The two are kept apart deliberately:
|
|
22
24
|
* an omitted option means "use the default", while a `NaN` means a caller computed something and
|
|
@@ -27,7 +29,20 @@ export function requireFiniteOption(value, name, fallback) {
|
|
|
27
29
|
return fallback;
|
|
28
30
|
if (Number.isFinite(value))
|
|
29
31
|
return value;
|
|
30
|
-
|
|
32
|
+
/*
|
|
33
|
+
* `describeValue`, not `String(value)`. The module note above is about a `number` that admits
|
|
34
|
+
* `NaN` and `Infinity`, and both read correctly when printed bare. A string does not:
|
|
35
|
+
* `Number.isFinite('1e9')` is false, so `maxMaterializeBytes: '1e9'` was refused — correctly —
|
|
36
|
+
* and then reported as "must be a finite number, but was 1e9", which is a finite number. That is
|
|
37
|
+
* the shape 0.6.92, 0.6.94 and 0.6.99 were spent on, in the one module whose whole subject is
|
|
38
|
+
* options "refused rather than silently coerced"; its own sweep reached six guards and not this
|
|
39
|
+
* one, which sits under eight (fixed in 0.6.114).
|
|
40
|
+
*
|
|
41
|
+
* A string is also the value this guard most often meets. Every source the note names —
|
|
42
|
+
* `process.env`, `searchParams.get`, a JSON config — hands over a string, and the note's own
|
|
43
|
+
* example wraps it in `Number()` precisely because the raw value is one.
|
|
44
|
+
*/
|
|
45
|
+
throw new RangeError(`options.${name} must be a finite number, but was ${describeValue(value)}. Next: check the ` +
|
|
31
46
|
'expression that produced it — Number() on an absent environment variable, query ' +
|
|
32
47
|
'parameter or config key yields NaN.');
|
|
33
48
|
}
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAyB,EACzB,IAAY,EACZ,QAAgB;IAEhB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACzC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,MAAM,IAAI,UAAU,CAClB,WAAW,IAAI,qCAAqC,aAAa,CAAC,KAAK,CAAC,oBAAoB;QAC1F,kFAAkF;QAClF,qCAAqC,CACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAyB,EAAE,KAAa;IACvE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,UAAU,CAClB,2FAA2F;YACzF,wFAAwF;YACxF,gCAAgC,CACnC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;IAChG,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/B,MAAM,IAAI,UAAU,CAClB,6DAA6D,MAAM,0BAA0B;QAC3F,0DAA0D;QAC1D,GAAG,6BAA6B,gBAAgB,CACnD,CAAC;AACJ,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ 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.114
|
|
10
|
+
|
|
11
|
+
- **Changed** how `options.ts` describes a rejected option value. It printed with `String(value)`, so
|
|
12
|
+
`maxMaterializeBytes: '1e9'` was refused — correctly, `Number.isFinite('1e9')` is false — and then
|
|
13
|
+
reported as "must be a finite number, but was 1e9", which is a finite number.
|
|
14
|
+
- This is the module under eight of the guards 0.6.99 swept and it was not one of them.
|
|
15
|
+
`maxMaterializeBytes` is resolved in six modules; `blockBytes`, `maxBytes` and `maxConcurrency` in
|
|
16
|
+
two more.
|
|
17
|
+
- A string is the value this guard most often meets. Every source its own module note names —
|
|
18
|
+
`process.env`, `searchParams.get`, a JSON config — hands over a string, and the note's example
|
|
19
|
+
wraps it in `Number()` precisely because the raw value is one.
|
|
20
|
+
- The sweep now reaches an options path, so the guard under the guards is covered by the check that
|
|
21
|
+
found the rest.
|
|
22
|
+
|
|
9
23
|
## 0.6.113
|
|
10
24
|
|
|
11
25
|
- **Fixed** `edfcore/validate`, the third entry point, which had no argument checks at all.
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/options.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Numeric options, refused rather than silently coerced.
|
|
3
3
|
*
|
|
4
|
-
* Layer 1. Imports one constant and nothing
|
|
4
|
+
* Layer 1. Imports one constant and one Layer 1 helper that imports nothing, so every layer can
|
|
5
|
+
* reach it — which is the
|
|
5
6
|
* point: `maxMaterializeBytes` is resolved in six modules spread across the stack — `io/read.ts`,
|
|
6
7
|
* `decode/digital.ts`, `decode/physical.ts`, `record-index.ts`, `envelope.ts` and `validate.ts` —
|
|
7
8
|
* and read raw and handed on in two more, `io/cached.ts` and `biosemi.ts`. A guard that only one
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
import { DEFAULT_MAX_MATERIALIZE_BYTES } from './constants.js';
|
|
22
|
+
import { describeValue } from './text/describe.js';
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* `undefined` takes the default; anything non-finite throws. The two are kept apart deliberately:
|
|
@@ -31,8 +33,21 @@ export function requireFiniteOption(
|
|
|
31
33
|
): number {
|
|
32
34
|
if (value === undefined) return fallback;
|
|
33
35
|
if (Number.isFinite(value)) return value;
|
|
36
|
+
/*
|
|
37
|
+
* `describeValue`, not `String(value)`. The module note above is about a `number` that admits
|
|
38
|
+
* `NaN` and `Infinity`, and both read correctly when printed bare. A string does not:
|
|
39
|
+
* `Number.isFinite('1e9')` is false, so `maxMaterializeBytes: '1e9'` was refused — correctly —
|
|
40
|
+
* and then reported as "must be a finite number, but was 1e9", which is a finite number. That is
|
|
41
|
+
* the shape 0.6.92, 0.6.94 and 0.6.99 were spent on, in the one module whose whole subject is
|
|
42
|
+
* options "refused rather than silently coerced"; its own sweep reached six guards and not this
|
|
43
|
+
* one, which sits under eight (fixed in 0.6.114).
|
|
44
|
+
*
|
|
45
|
+
* A string is also the value this guard most often meets. Every source the note names —
|
|
46
|
+
* `process.env`, `searchParams.get`, a JSON config — hands over a string, and the note's own
|
|
47
|
+
* example wraps it in `Number()` precisely because the raw value is one.
|
|
48
|
+
*/
|
|
34
49
|
throw new RangeError(
|
|
35
|
-
`options.${name} must be a finite number, but was ${
|
|
50
|
+
`options.${name} must be a finite number, but was ${describeValue(value)}. Next: check the ` +
|
|
36
51
|
'expression that produced it — Number() on an absent environment variable, query ' +
|
|
37
52
|
'parameter or config key yields NaN.',
|
|
38
53
|
);
|