edfcore 0.6.296 → 0.6.297
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/node.d.ts.map +1 -1
- package/dist/node.js +23 -3
- package/dist/node.js.map +1 -1
- package/docs/CHANGELOG.md +17 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/node.ts +23 -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.297";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/node.d.ts.map
CHANGED
|
@@ -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,
|
|
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,CAmI1E"}
|
package/dist/node.js
CHANGED
|
@@ -164,9 +164,29 @@ export async function fileSource(path) {
|
|
|
164
164
|
* courtesy in the other direction (fixed in 0.6.116).
|
|
165
165
|
*/
|
|
166
166
|
if (typeof path !== 'string' && Object.prototype.toString.call(path) !== '[object URL]') {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
/*
|
|
168
|
+
* The third adapter with this hole, and the last. 0.6.295 and 0.6.296 closed it for a Blob and
|
|
169
|
+
* for an address; a path is the one left, and the advice below is the one most likely to be
|
|
170
|
+
* taken literally — "pass the path as a string" is exactly what the caller did, except that
|
|
171
|
+
* what they passed was a Promise OF one.
|
|
172
|
+
*
|
|
173
|
+
* `node:fs/promises` is where it comes from, and this adapter's whole subject is that module:
|
|
174
|
+
* `fs.realpath`, `fs.mkdtemp` and `fs.readdir` all resolve to paths, and a resolved symlink is
|
|
175
|
+
* the commonest of the three — `fileSource(fs.realpath(p))` is a line someone writes when a
|
|
176
|
+
* recording arrives through a symlinked spool directory.
|
|
177
|
+
*
|
|
178
|
+
* `byteSource(bytes)` stays in the other arm, because that is the mistake 0.6.116 wrote it for:
|
|
179
|
+
* `fs.open` accepts a `Uint8Array` as a path, so a file already in memory passed here is opened
|
|
180
|
+
* as the bytes of a filename (0.6.297).
|
|
181
|
+
*/
|
|
182
|
+
const pending = typeof path?.then === 'function';
|
|
183
|
+
throw new EdfSourceError(`fileSource() needs a path, and received ${describeValue(path)}. ` +
|
|
184
|
+
(pending
|
|
185
|
+
? 'Next: await it — fs.realpath, fs.mkdtemp and fs.readdir from "node:fs/promises" ' +
|
|
186
|
+
'all resolve to paths rather than returning them, and a resolved symlink is the usual ' +
|
|
187
|
+
'way one arrives here.'
|
|
188
|
+
: 'Next: pass the path as a string, or byteSource(bytes) for a file you have already ' +
|
|
189
|
+
'read into memory — a Uint8Array here would be opened as the bytes of a filename.'), { offset: 0, requestedLength: 0 });
|
|
170
190
|
}
|
|
171
191
|
/*
|
|
172
192
|
* And a URL that names something other than a file on disk.
|
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,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,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e,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,23 @@ 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.297
|
|
10
|
+
|
|
11
|
+
- **Fixed** the third adapter with this hole, and the last. `fileSource` answered a forgotten `await`
|
|
12
|
+
with "pass the path as a string" — which is exactly what the caller did, except that what they
|
|
13
|
+
passed was a Promise OF one. Of the three it is the advice most likely to be taken literally.
|
|
14
|
+
- `node:fs/promises` is where it comes from, and this adapter's whole subject is that module.
|
|
15
|
+
`fs.realpath`, `fs.mkdtemp` and `fs.readdir` all resolve to paths rather than returning them, and a
|
|
16
|
+
resolved symlink is the commonest of the three: `fileSource(fs.realpath(p))` is a line someone
|
|
17
|
+
writes when a recording arrives through a symlinked spool directory.
|
|
18
|
+
- `assertByteSource` has named the keyword for `fileSource` itself since 0.6.264. That is about this
|
|
19
|
+
function's RESULT; its argument is the other half, and it said nothing.
|
|
20
|
+
- `byteSource(bytes)` stays in the other arm, because that is the mistake it was written for in
|
|
21
|
+
0.6.116: `fs.open` accepts a `Uint8Array` as a path, so a file already in memory is opened as the
|
|
22
|
+
bytes of a filename.
|
|
23
|
+
- With 0.6.295 and 0.6.296, all three source adapters now name the keyword their argument was one
|
|
24
|
+
short of.
|
|
25
|
+
|
|
9
26
|
## 0.6.296
|
|
10
27
|
|
|
11
28
|
- **Fixed** `httpSource` answering a forgotten `await` with "pass the address as a string, or as
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/node.ts
CHANGED
|
@@ -210,10 +210,30 @@ export async function fileSource(path: string): Promise<ClosableByteSource> {
|
|
|
210
210
|
* courtesy in the other direction (fixed in 0.6.116).
|
|
211
211
|
*/
|
|
212
212
|
if (typeof path !== 'string' && Object.prototype.toString.call(path) !== '[object URL]') {
|
|
213
|
+
/*
|
|
214
|
+
* The third adapter with this hole, and the last. 0.6.295 and 0.6.296 closed it for a Blob and
|
|
215
|
+
* for an address; a path is the one left, and the advice below is the one most likely to be
|
|
216
|
+
* taken literally — "pass the path as a string" is exactly what the caller did, except that
|
|
217
|
+
* what they passed was a Promise OF one.
|
|
218
|
+
*
|
|
219
|
+
* `node:fs/promises` is where it comes from, and this adapter's whole subject is that module:
|
|
220
|
+
* `fs.realpath`, `fs.mkdtemp` and `fs.readdir` all resolve to paths, and a resolved symlink is
|
|
221
|
+
* the commonest of the three — `fileSource(fs.realpath(p))` is a line someone writes when a
|
|
222
|
+
* recording arrives through a symlinked spool directory.
|
|
223
|
+
*
|
|
224
|
+
* `byteSource(bytes)` stays in the other arm, because that is the mistake 0.6.116 wrote it for:
|
|
225
|
+
* `fs.open` accepts a `Uint8Array` as a path, so a file already in memory passed here is opened
|
|
226
|
+
* as the bytes of a filename (0.6.297).
|
|
227
|
+
*/
|
|
228
|
+
const pending = typeof (path as { then?: unknown } | null | undefined)?.then === 'function';
|
|
213
229
|
throw new EdfSourceError(
|
|
214
|
-
`fileSource() needs a path, and received ${describeValue(path)}.
|
|
215
|
-
|
|
216
|
-
|
|
230
|
+
`fileSource() needs a path, and received ${describeValue(path)}. ` +
|
|
231
|
+
(pending
|
|
232
|
+
? 'Next: await it — fs.realpath, fs.mkdtemp and fs.readdir from "node:fs/promises" ' +
|
|
233
|
+
'all resolve to paths rather than returning them, and a resolved symlink is the usual ' +
|
|
234
|
+
'way one arrives here.'
|
|
235
|
+
: 'Next: pass the path as a string, or byteSource(bytes) for a file you have already ' +
|
|
236
|
+
'read into memory — a Uint8Array here would be opened as the bytes of a filename.'),
|
|
217
237
|
{ offset: 0, requestedLength: 0 },
|
|
218
238
|
);
|
|
219
239
|
}
|