edfcore 0.6.138 → 0.6.139
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 +11 -3
- package/dist/io/source.js.map +1 -1
- package/docs/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/io/source.ts +11 -3
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.139";
|
|
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;
|
|
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,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAKnE;AAmDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,CAS9E"}
|
package/dist/io/source.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { isByteArray } from '../bytes/latin1.js';
|
|
19
19
|
import { EdfSourceError } from '../errors.js';
|
|
20
|
+
import { describeValue } from '../text/describe.js';
|
|
20
21
|
/**
|
|
21
22
|
* The byte count of a genuine byte array, or `undefined` for anything else — which is why
|
|
22
23
|
* `EdfSourceError.receivedLength` is `number | undefined` rather than `number`.
|
|
@@ -67,13 +68,20 @@ export function assertExactRead(received, offset, length) {
|
|
|
67
68
|
* safe-integer-ness rather than truncating with `| 0`, which silently wraps past 2 GiB.
|
|
68
69
|
*/
|
|
69
70
|
export function assertReadRange(offset, length, byteLength) {
|
|
71
|
+
// `describeValue`, not `${offset}`. A string interpolates as its digits, so a `'0'` out of a
|
|
72
|
+
// query parameter or a JSON range was refused with "was given offset 0, which is not a
|
|
73
|
+
// non-negative safe integer" — naming a rule that 0 satisfies, about the first byte of the file.
|
|
74
|
+
// The same sentence about the same value, printed two ways, is the defect 0.6.114 fixed for
|
|
75
|
+
// `maxMaterializeBytes` and 0.6.131 for a record index; these are the two numbers every read in
|
|
76
|
+
// the package passes through.
|
|
70
77
|
if (!Number.isSafeInteger(offset) || offset < 0) {
|
|
71
|
-
throw new EdfSourceError(`ByteSource.read was given
|
|
78
|
+
throw new EdfSourceError(`ByteSource.read was given ${describeValue(offset)} as its offset, which is not a ` +
|
|
79
|
+
'non-negative safe integer. ' +
|
|
72
80
|
'Next: pass a plain integer byte offset; edfcore never truncates offsets to 32 bits.', { offset, requestedLength: length });
|
|
73
81
|
}
|
|
74
82
|
if (!Number.isSafeInteger(length) || length < 0) {
|
|
75
|
-
throw new EdfSourceError(`ByteSource.read was given
|
|
76
|
-
'Next: pass a plain integer byte count.', { offset, requestedLength: length });
|
|
83
|
+
throw new EdfSourceError(`ByteSource.read was given ${describeValue(length)} as its length, which is not a ` +
|
|
84
|
+
'non-negative safe integer. Next: pass a plain integer byte count.', { offset, requestedLength: length });
|
|
77
85
|
}
|
|
78
86
|
if (offset + length > byteLength) {
|
|
79
87
|
throw new EdfSourceError(`ByteSource.read(offset ${offset}, length ${length}) ends at byte ${offset + length}, ` +
|
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;
|
|
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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S,aAAa,CAAC,MAAe;IACpC,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3C,wFAAwF;IACxF,0BAA0B;IAC1B,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,UAAU;QAC/D,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACrD,CAAC,CAAC,OAAO,MAAM,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAe;IAC9C,MAAM,SAAS,GAAG,MAAqE,CAAC;IACxF,IAAI,OAAO,SAAS,EAAE,IAAI,KAAK,UAAU,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,QAAQ;QAAE,OAAO;IAC9F,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,15 @@ 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.139
|
|
10
|
+
|
|
11
|
+
- **Fixed** `ByteSource.read` describing an offset or a length it refused as the number its digits
|
|
12
|
+
spell. A `'0'` out of a query parameter, a JSON range or a config key came back as "was given
|
|
13
|
+
offset 0, which is not a non-negative safe integer" — about the first byte of the file.
|
|
14
|
+
- Offset and length are the two numbers every read in the package passes through, so they are the
|
|
15
|
+
pair most likely to arrive from outside a TypeScript call site. Both now name the value as
|
|
16
|
+
itself; every numeric refusal reads as before.
|
|
17
|
+
|
|
9
18
|
## 0.6.138
|
|
10
19
|
|
|
11
20
|
- **Fixed** `getStatusSignal` returning the first of two channels labelled `Status` with nothing
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/io/source.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { isByteArray } from '../bytes/latin1.js';
|
|
20
20
|
import { EdfSourceError } from '../errors.js';
|
|
21
|
+
import { describeValue } from '../text/describe.js';
|
|
21
22
|
import type { AbortSignalLike, ByteSource, ReadOptions } from '../types.js';
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -76,17 +77,24 @@ export function assertExactRead(received: Uint8Array, offset: number, length: nu
|
|
|
76
77
|
* safe-integer-ness rather than truncating with `| 0`, which silently wraps past 2 GiB.
|
|
77
78
|
*/
|
|
78
79
|
export function assertReadRange(offset: number, length: number, byteLength: number): void {
|
|
80
|
+
// `describeValue`, not `${offset}`. A string interpolates as its digits, so a `'0'` out of a
|
|
81
|
+
// query parameter or a JSON range was refused with "was given offset 0, which is not a
|
|
82
|
+
// non-negative safe integer" — naming a rule that 0 satisfies, about the first byte of the file.
|
|
83
|
+
// The same sentence about the same value, printed two ways, is the defect 0.6.114 fixed for
|
|
84
|
+
// `maxMaterializeBytes` and 0.6.131 for a record index; these are the two numbers every read in
|
|
85
|
+
// the package passes through.
|
|
79
86
|
if (!Number.isSafeInteger(offset) || offset < 0) {
|
|
80
87
|
throw new EdfSourceError(
|
|
81
|
-
`ByteSource.read was given
|
|
88
|
+
`ByteSource.read was given ${describeValue(offset)} as its offset, which is not a ` +
|
|
89
|
+
'non-negative safe integer. ' +
|
|
82
90
|
'Next: pass a plain integer byte offset; edfcore never truncates offsets to 32 bits.',
|
|
83
91
|
{ offset, requestedLength: length },
|
|
84
92
|
);
|
|
85
93
|
}
|
|
86
94
|
if (!Number.isSafeInteger(length) || length < 0) {
|
|
87
95
|
throw new EdfSourceError(
|
|
88
|
-
`ByteSource.read was given
|
|
89
|
-
'Next: pass a plain integer byte count.',
|
|
96
|
+
`ByteSource.read was given ${describeValue(length)} as its length, which is not a ` +
|
|
97
|
+
'non-negative safe integer. Next: pass a plain integer byte count.',
|
|
90
98
|
{ offset, requestedLength: length },
|
|
91
99
|
);
|
|
92
100
|
}
|