@eik/core 2.0.20 → 2.0.22

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.0.22](https://github.com/eik-lib/core/compare/v2.0.21...v2.0.22) (2025-08-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * end timer on stream end or error ([#503](https://github.com/eik-lib/core/issues/503)) ([5cea253](https://github.com/eik-lib/core/commit/5cea2535df552a9c3f9787f4e54d6f2d985808c4))
7
+
8
+ ## [2.0.21](https://github.com/eik-lib/core/compare/v2.0.20...v2.0.21) (2025-07-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @eik/sink-memory to v2.0.11 ([#499](https://github.com/eik-lib/core/issues/499)) ([808d4d0](https://github.com/eik-lib/core/commit/808d4d02ba93e21163cb1c06df626280393f8e9c))
14
+
1
15
  ## [2.0.20](https://github.com/eik-lib/core/compare/v2.0.19...v2.0.20) (2025-07-22)
2
16
 
3
17
 
@@ -96,12 +96,19 @@ const MapGet = class MapGet {
96
96
  } else {
97
97
  outgoing.statusCode = 200;
98
98
  outgoing.stream = file.stream;
99
+
100
+ outgoing.stream.on("error", (err) => {
101
+ this._log.info(`map:get - File stream error - ${err}`);
102
+ end({ labels: { success: false, status: 503, type: "map" } });
103
+ });
104
+
105
+ outgoing.stream.on("end", () => {
106
+ end({ labels: { status: outgoing.statusCode, type: "map" } });
107
+ });
99
108
  }
100
109
 
101
110
  this._log.debug(`map:get - Import map found - Pathname: ${path}`);
102
111
 
103
- end({ labels: { status: outgoing.statusCode, type: "map" } });
104
-
105
112
  return outgoing;
106
113
  // eslint-disable-next-line no-unused-vars
107
114
  } catch (error) {
@@ -105,12 +105,19 @@ const PkgGet = class PkgGet {
105
105
  } else {
106
106
  outgoing.statusCode = 200;
107
107
  outgoing.stream = file.stream;
108
+
109
+ outgoing.stream.on("error", (err) => {
110
+ this._log.info(`pkg:get - File stream error - ${err}`);
111
+ end({ labels: { success: false, status: 503, type } });
112
+ });
113
+
114
+ outgoing.stream.on("end", () => {
115
+ end({ labels: { status: outgoing.statusCode, type } });
116
+ });
108
117
  }
109
118
 
110
119
  this._log.debug(`pkg:get - Asset found - Pathname: ${path}`);
111
120
 
112
- end({ labels: { status: outgoing.statusCode, type } });
113
-
114
121
  return outgoing;
115
122
  // eslint-disable-next-line no-unused-vars
116
123
  } catch (error) {
@@ -98,12 +98,19 @@ const PkgLog = class PkgLog {
98
98
  } else {
99
99
  outgoing.statusCode = 200;
100
100
  outgoing.stream = file.stream;
101
+
102
+ outgoing.stream.on("error", (err) => {
103
+ this._log.info(`pkg:log - File stream error - ${err}`);
104
+ end({ labels: { success: false, status: 503, type } });
105
+ });
106
+
107
+ outgoing.stream.on("end", () => {
108
+ end({ labels: { status: outgoing.statusCode, type } });
109
+ });
101
110
  }
102
111
 
103
112
  this._log.debug(`pkg:log - Package log found - Pathname: ${path}`);
104
113
 
105
- end({ labels: { status: outgoing.statusCode, type } });
106
-
107
114
  return outgoing;
108
115
  // eslint-disable-next-line no-unused-vars
109
116
  } catch (error) {
@@ -90,12 +90,19 @@ const VersionsGet = class VersionsGet {
90
90
  } else {
91
91
  outgoing.statusCode = 200;
92
92
  outgoing.stream = file.stream;
93
+
94
+ outgoing.stream.on("error", (err) => {
95
+ this._log.info(`pkg:latest - File stream error - ${err}`);
96
+ end({ labels: { success: false, status: 503, type } });
97
+ });
98
+
99
+ outgoing.stream.on("end", () => {
100
+ end({ labels: { status: outgoing.statusCode, type } });
101
+ });
93
102
  }
94
103
 
95
104
  this._log.debug(`pkg:latest - Package log found - Pathname: ${path}`);
96
105
 
97
- end({ labels: { status: outgoing.statusCode, type } });
98
-
99
106
  return outgoing;
100
107
  // eslint-disable-next-line no-unused-vars
101
108
  } catch (error) {
package/lib/sinks/test.js CHANGED
@@ -13,6 +13,8 @@ const DEFAULT_ROOT_PATH = "/eik";
13
13
  * @deprecated Use eik/sink-memory or implement your own. This class will be removed in a future version of core.
14
14
  */
15
15
  export default class SinkTest extends Sink {
16
+ readDelay = 0;
17
+
16
18
  constructor({ rootPath = DEFAULT_ROOT_PATH } = {}) {
17
19
  super();
18
20
  this._rootPath = rootPath;
@@ -193,12 +195,22 @@ export default class SinkTest extends Sink {
193
195
  etag: entry.hash,
194
196
  });
195
197
 
198
+ const readDelay = this.readDelay;
196
199
  file.stream = new Readable({
197
200
  read() {
198
- payload.forEach((item) => {
199
- this.push(item);
200
- });
201
- this.push(null);
201
+ if (readDelay) {
202
+ setTimeout(() => {
203
+ payload.forEach((item) => {
204
+ this.push(item);
205
+ });
206
+ this.push(null);
207
+ }, readDelay);
208
+ } else {
209
+ payload.forEach((item) => {
210
+ this.push(item);
211
+ });
212
+ this.push(null);
213
+ }
202
214
  },
203
215
  });
204
216
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/core",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "Core server package",
5
5
  "main": "lib/main.js",
6
6
  "types": "./types/main.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@eik/common": "5.1.6",
29
29
  "@eik/sink": "1.2.5",
30
30
  "@eik/sink-file-system": "2.0.10",
31
- "@eik/sink-memory": "2.0.10",
31
+ "@eik/sink-memory": "2.0.11",
32
32
  "@metrics/client": "2.5.5",
33
33
  "abslog": "2.4.4",
34
34
  "busboy": "1.6.0",
@@ -46,14 +46,14 @@
46
46
  "@eik/semantic-release-config": "1.0.5",
47
47
  "@eik/typescript-config": "1.0.0",
48
48
  "@types/readable-stream": "4.0.21",
49
- "eslint": "9.25.1",
49
+ "eslint": "9.32.0",
50
50
  "form-data": "4.0.4",
51
51
  "mkdirp": "3.0.1",
52
52
  "node-fetch": "3.3.2",
53
53
  "npm-run-all2": "7.0.2",
54
54
  "prettier": "3.5.3",
55
55
  "rimraf": "6.0.1",
56
- "semantic-release": "24.2.5",
56
+ "semantic-release": "24.2.7",
57
57
  "tap": "21.0.1",
58
58
  "typescript": "5.6.3"
59
59
  }
@@ -5,6 +5,7 @@ export default class SinkTest extends Sink {
5
5
  constructor({ rootPath }?: {
6
6
  rootPath?: string;
7
7
  });
8
+ readDelay: number;
8
9
  _rootPath: string;
9
10
  _metrics: Metrics;
10
11
  _state: Map<any, any>;