edfcore 0.6.180 → 0.6.181
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/read.d.ts.map +1 -1
- package/dist/io/read.js +23 -0
- package/dist/io/read.js.map +1 -1
- package/docs/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/io/read.ts +29 -0
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.181";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/io/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/io/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoBhG;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAuC9F;AAiHD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/io/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoBhG;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAuC9F;AAiHD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CA0CrB"}
|
package/dist/io/read.js
CHANGED
|
@@ -198,6 +198,29 @@ function assertWithinBudget(requiredBytes, records, options) {
|
|
|
198
198
|
*/
|
|
199
199
|
export async function readRecordBytes(source, header, records, options) {
|
|
200
200
|
assertByteSource(source);
|
|
201
|
+
/*
|
|
202
|
+
* The HEADER, before the range is measured against it.
|
|
203
|
+
*
|
|
204
|
+
* `assertRecordRange` reads `header.recordCount` and prints it, so a wrong header put the blame
|
|
205
|
+
* on the argument that was right: `readRecordBytes(source, recording, records)` — the recording
|
|
206
|
+
* being the object the source came off — answered `records { start: 0, count: 1 } is not inside
|
|
207
|
+
* the undefined data records this file contains`, and told the caller to clamp a range that was
|
|
208
|
+
* already inside the file. A chunk gave the same sentence.
|
|
209
|
+
*
|
|
210
|
+
* The timeline is worse and reaches further. It HAS a `recordCount`, so the range check passes
|
|
211
|
+
* and `records.count * header.recordByteLength` is `NaN` — reported as an `EdfBudgetError`,
|
|
212
|
+
* "needs a NaN-byte buffer, above the 268435456-byte maxMaterializeBytes budget", advising a
|
|
213
|
+
* smaller read. An `EdfError`, so `isEdfError` sent a caller mistake down the file-or-budget
|
|
214
|
+
* branch, which is the one distinction `errors.ts` exists to keep.
|
|
215
|
+
*
|
|
216
|
+
* `recordByteLength` is the field to test: it is the one this function multiplies by, and
|
|
217
|
+
* `decode/digital.ts` already names it for the same reason.
|
|
218
|
+
*/
|
|
219
|
+
if (!Number.isInteger(header?.recordByteLength)) {
|
|
220
|
+
throw new RangeError('readRecordBytes(): that is not a header — it has no recordByteLength, which is the record ' +
|
|
221
|
+
'size every offset and length below is measured in. Next: pass recording.header, or what ' +
|
|
222
|
+
'parseHeader(bytes, sourceByteLength) returned.');
|
|
223
|
+
}
|
|
201
224
|
assertRecordRange(header, records);
|
|
202
225
|
const byteLength = records.count * header.recordByteLength;
|
|
203
226
|
if (byteLength === 0)
|
package/dist/io/read.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/io/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,WAAuB;IAC9C,IAAI,WAAW,CAAC,MAAM,GAAG,sBAAsB;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,EAAE,M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Ac,CACtB,mBAAmB,mBAAmB,CAAC,OAAO,CAAC,YAAY,aAAa,0BAA0B;QAChG,GAAG,WAAW,4EAA4E;QAC1F,wBAAwB,MAAM,EAAE,EAClC,EAAE,aAAa,EAAE,WAAW,EAAE,CAC/B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAkB,EAClB,MAAiB,EACjB,OAAoB,EACpB,OAAqB;IAErB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB;;;;;;;;;;;;;;;;;OAiBG;IACH,IACE,CAAC,MAAM,CAAC,SAAS,CACd,MAA4D,EAAE,gBAAgB,CAChF,EACD,CAAC;QACD,MAAM,IAAI,UAAU,CAClB,4FAA4F;YAC1F,0FAA0F;YAC1F,gDAAgD,CACnD,CAAC;IACJ,CAAC;IACD,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAC3D,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/C,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACrF,OAAO,eAAe,CACpB,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAClD,UAAU,EACV,UAAU,CACX,CAAC;AACJ,CAAC"}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ 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.181
|
|
10
|
+
|
|
11
|
+
- **Fixed** `readRecordBytes` blaming the record range for a wrong header. It is the lowest
|
|
12
|
+
published read in the package and it takes `(source, header, records)` — and the source almost
|
|
13
|
+
always comes off a recording, so `readRecordBytes(recording.source, recording, records)` is one
|
|
14
|
+
field short and nothing checked it.
|
|
15
|
+
- `assertRecordRange` reads `header.recordCount` and prints it, so the answer was `records
|
|
16
|
+
{ start: 0, count: 1 } is not inside the undefined data records this file contains`, followed by
|
|
17
|
+
advice to clamp a range that was already inside the file. A chunk gave the same sentence.
|
|
18
|
+
- The timeline reached further, because it HAS a `recordCount`: the range check passed and
|
|
19
|
+
`records.count * header.recordByteLength` was `NaN`, reported as an `EdfBudgetError` about a
|
|
20
|
+
"NaN-byte buffer" above the budget. That one is an `EdfError`, so `isEdfError` sent a caller
|
|
21
|
+
mistake down the file-or-budget branch.
|
|
22
|
+
- The check names `recordByteLength`, which is the field this call multiplies by.
|
|
23
|
+
|
|
9
24
|
## 0.6.180
|
|
10
25
|
|
|
11
26
|
- **Fixed** `toPhysical` and `clampToDigitalRange` accepting raw record bytes as samples. The
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/io/read.ts
CHANGED
|
@@ -229,6 +229,35 @@ export async function readRecordBytes(
|
|
|
229
229
|
options?: ReadOptions,
|
|
230
230
|
): Promise<Uint8Array> {
|
|
231
231
|
assertByteSource(source);
|
|
232
|
+
/*
|
|
233
|
+
* The HEADER, before the range is measured against it.
|
|
234
|
+
*
|
|
235
|
+
* `assertRecordRange` reads `header.recordCount` and prints it, so a wrong header put the blame
|
|
236
|
+
* on the argument that was right: `readRecordBytes(source, recording, records)` — the recording
|
|
237
|
+
* being the object the source came off — answered `records { start: 0, count: 1 } is not inside
|
|
238
|
+
* the undefined data records this file contains`, and told the caller to clamp a range that was
|
|
239
|
+
* already inside the file. A chunk gave the same sentence.
|
|
240
|
+
*
|
|
241
|
+
* The timeline is worse and reaches further. It HAS a `recordCount`, so the range check passes
|
|
242
|
+
* and `records.count * header.recordByteLength` is `NaN` — reported as an `EdfBudgetError`,
|
|
243
|
+
* "needs a NaN-byte buffer, above the 268435456-byte maxMaterializeBytes budget", advising a
|
|
244
|
+
* smaller read. An `EdfError`, so `isEdfError` sent a caller mistake down the file-or-budget
|
|
245
|
+
* branch, which is the one distinction `errors.ts` exists to keep.
|
|
246
|
+
*
|
|
247
|
+
* `recordByteLength` is the field to test: it is the one this function multiplies by, and
|
|
248
|
+
* `decode/digital.ts` already names it for the same reason.
|
|
249
|
+
*/
|
|
250
|
+
if (
|
|
251
|
+
!Number.isInteger(
|
|
252
|
+
(header as { recordByteLength?: unknown } | null | undefined)?.recordByteLength,
|
|
253
|
+
)
|
|
254
|
+
) {
|
|
255
|
+
throw new RangeError(
|
|
256
|
+
'readRecordBytes(): that is not a header — it has no recordByteLength, which is the record ' +
|
|
257
|
+
'size every offset and length below is measured in. Next: pass recording.header, or what ' +
|
|
258
|
+
'parseHeader(bytes, sourceByteLength) returned.',
|
|
259
|
+
);
|
|
260
|
+
}
|
|
232
261
|
assertRecordRange(header, records);
|
|
233
262
|
const byteLength = records.count * header.recordByteLength;
|
|
234
263
|
if (byteLength === 0) return new Uint8Array(0);
|