@travetto/model 4.0.0-rc.0 → 4.0.0-rc.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model",
3
- "version": "4.0.0-rc.0",
3
+ "version": "4.0.0-rc.1",
4
4
  "description": "Datastore abstraction for core operations.",
5
5
  "keywords": [
6
6
  "datastore",
@@ -26,14 +26,14 @@
26
26
  "directory": "module/model"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^4.0.0-rc.0",
30
- "@travetto/di": "^4.0.0-rc.0",
31
- "@travetto/registry": "^4.0.0-rc.0",
32
- "@travetto/schema": "^4.0.0-rc.0"
29
+ "@travetto/config": "^4.0.0-rc.1",
30
+ "@travetto/di": "^4.0.0-rc.1",
31
+ "@travetto/registry": "^4.0.0-rc.1",
32
+ "@travetto/schema": "^4.0.0-rc.1"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/cli": "^4.0.0-rc.0",
36
- "@travetto/test": "^4.0.0-rc.0"
35
+ "@travetto/cli": "^4.0.0-rc.1",
36
+ "@travetto/test": "^4.0.0-rc.1"
37
37
  },
38
38
  "peerDependenciesMeta": {
39
39
  "@travetto/cli": {
@@ -2,6 +2,7 @@ import fs from 'node:fs/promises';
2
2
  import assert from 'node:assert';
3
3
  import crypto from 'node:crypto';
4
4
  import { Readable } from 'node:stream';
5
+ import { pipeline } from 'node:stream/promises';
5
6
 
6
7
  import { Suite, Test, TestFixtures } from '@travetto/test';
7
8
  import { StreamUtil } from '@travetto/base';
@@ -15,14 +16,9 @@ export abstract class ModelStreamSuite extends BaseModelSuite<ModelStreamSupport
15
16
  fixture = new TestFixtures(['@travetto/model']);
16
17
 
17
18
  async getHash(stream: Readable): Promise<string> {
18
- const hash = crypto.createHash('sha1');
19
- hash.setEncoding('hex');
20
- await new Promise((res, rej) => {
21
- stream.on('end', res);
22
- stream.on('error', rej);
23
- stream.pipe(hash);
24
- });
25
- return hash.read() as string;
19
+ const hasher = crypto.createHash('sha1').setEncoding('hex');
20
+ await pipeline(stream, hasher);
21
+ return hasher.read().toString();
26
22
  }
27
23
 
28
24
  async getStream(resource: string): Promise<readonly [{ size: number, contentType: string, hash: string, filename: string }, Readable]> {