@eik/core 2.1.70 → 2.1.71
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 +7 -0
- package/lib/classes/asset.js +2 -3
- package/lib/handlers/alias.get-v2.js +15 -4
- package/lib/handlers/map.get.js +15 -4
- package/lib/handlers/pkg.get.js +15 -4
- package/lib/handlers/pkg.log.js +15 -4
- package/lib/handlers/versions.get.js +15 -4
- package/lib/sinks/test.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [2.1.71](https://github.com/eik-lib/core/compare/v2.1.70...v2.1.71) (2026-08-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* log ERR_STREAM_PREMATURE_CLOSE at debug level in GET handlers ([#630](https://github.com/eik-lib/core/issues/630)) ([48a303b](https://github.com/eik-lib/core/commit/48a303b8ee0d5124eb0506fefbee648f141a3507))
|
|
7
|
+
|
|
1
8
|
## [2.1.70](https://github.com/eik-lib/core/compare/v2.1.69...v2.1.70) (2026-08-12)
|
|
2
9
|
|
|
3
10
|
|
package/lib/classes/asset.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { lookup } from "mrmime";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { toUrlPathname } from "../utils/url.js";
|
|
4
4
|
|
|
@@ -26,8 +26,7 @@ const Asset = class Asset {
|
|
|
26
26
|
org = "",
|
|
27
27
|
} = {}) {
|
|
28
28
|
this._mimeType =
|
|
29
|
-
/** @type {string} */ (
|
|
30
|
-
"application/octet-stream";
|
|
29
|
+
/** @type {string} */ (lookup(pathname)) || "application/octet-stream";
|
|
31
30
|
this._type = type.toLowerCase();
|
|
32
31
|
this._size = -1;
|
|
33
32
|
|
|
@@ -130,10 +130,21 @@ const AliasGet = class AliasGet {
|
|
|
130
130
|
|
|
131
131
|
const outgoingStream = outgoing.stream;
|
|
132
132
|
if (outgoingStream) {
|
|
133
|
-
outgoingStream.on(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
outgoingStream.on(
|
|
134
|
+
"error",
|
|
135
|
+
(/** @type {NodeJS.ErrnoException} */ err) => {
|
|
136
|
+
// ERR_STREAM_PREMATURE_CLOSE means the client closed the
|
|
137
|
+
// connection before the transfer finished. This is normal
|
|
138
|
+
// browser behaviour (navigation, cancelled requests, etc.)
|
|
139
|
+
// and not a server-side error worth alerting on.
|
|
140
|
+
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
|
141
|
+
this._log.debug(`alias:get - File stream error - ${err}`);
|
|
142
|
+
} else {
|
|
143
|
+
this._log.info(`alias:get - File stream error - ${err}`);
|
|
144
|
+
}
|
|
145
|
+
end({ labels: { success: false, status: 503, type } });
|
|
146
|
+
},
|
|
147
|
+
);
|
|
137
148
|
|
|
138
149
|
outgoingStream.on("end", () => {
|
|
139
150
|
end({ labels: { status: outgoing.statusCode, type } });
|
package/lib/handlers/map.get.js
CHANGED
|
@@ -106,10 +106,21 @@ const MapGet = class MapGet {
|
|
|
106
106
|
|
|
107
107
|
const outgoingStream = outgoing.stream;
|
|
108
108
|
if (outgoingStream) {
|
|
109
|
-
outgoingStream.on(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
outgoingStream.on(
|
|
110
|
+
"error",
|
|
111
|
+
(/** @type {NodeJS.ErrnoException} */ err) => {
|
|
112
|
+
// ERR_STREAM_PREMATURE_CLOSE means the client closed the
|
|
113
|
+
// connection before the transfer finished. This is normal
|
|
114
|
+
// browser behaviour (navigation, cancelled requests, etc.)
|
|
115
|
+
// and not a server-side error worth alerting on.
|
|
116
|
+
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
|
117
|
+
this._log.debug(`map:get - File stream error - ${err}`);
|
|
118
|
+
} else {
|
|
119
|
+
this._log.info(`map:get - File stream error - ${err}`);
|
|
120
|
+
}
|
|
121
|
+
end({ labels: { success: false, status: 503, type: "map" } });
|
|
122
|
+
},
|
|
123
|
+
);
|
|
113
124
|
|
|
114
125
|
outgoingStream.on("end", () => {
|
|
115
126
|
end({ labels: { status: outgoing.statusCode, type: "map" } });
|
package/lib/handlers/pkg.get.js
CHANGED
|
@@ -117,10 +117,21 @@ const PkgGet = class PkgGet {
|
|
|
117
117
|
|
|
118
118
|
const outgoingStream = outgoing.stream;
|
|
119
119
|
if (outgoingStream) {
|
|
120
|
-
outgoingStream.on(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
outgoingStream.on(
|
|
121
|
+
"error",
|
|
122
|
+
(/** @type {NodeJS.ErrnoException} */ err) => {
|
|
123
|
+
// ERR_STREAM_PREMATURE_CLOSE means the client closed the
|
|
124
|
+
// connection before the transfer finished. This is normal
|
|
125
|
+
// browser behaviour (navigation, cancelled requests, etc.)
|
|
126
|
+
// and not a server-side error worth alerting on.
|
|
127
|
+
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
|
128
|
+
this._log.debug(`pkg:get - File stream error - ${err}`);
|
|
129
|
+
} else {
|
|
130
|
+
this._log.info(`pkg:get - File stream error - ${err}`);
|
|
131
|
+
}
|
|
132
|
+
end({ labels: { success: false, status: 503, type } });
|
|
133
|
+
},
|
|
134
|
+
);
|
|
124
135
|
|
|
125
136
|
outgoingStream.on("end", () => {
|
|
126
137
|
end({ labels: { status: outgoing.statusCode, type } });
|
package/lib/handlers/pkg.log.js
CHANGED
|
@@ -109,10 +109,21 @@ const PkgLog = class PkgLog {
|
|
|
109
109
|
|
|
110
110
|
const outgoingStream = outgoing.stream;
|
|
111
111
|
if (outgoingStream) {
|
|
112
|
-
outgoingStream.on(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
outgoingStream.on(
|
|
113
|
+
"error",
|
|
114
|
+
(/** @type {NodeJS.ErrnoException} */ err) => {
|
|
115
|
+
// ERR_STREAM_PREMATURE_CLOSE means the client closed the
|
|
116
|
+
// connection before the transfer finished. This is normal
|
|
117
|
+
// browser behaviour (navigation, cancelled requests, etc.)
|
|
118
|
+
// and not a server-side error worth alerting on.
|
|
119
|
+
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
|
120
|
+
this._log.debug(`pkg:log - File stream error - ${err}`);
|
|
121
|
+
} else {
|
|
122
|
+
this._log.info(`pkg:log - File stream error - ${err}`);
|
|
123
|
+
}
|
|
124
|
+
end({ labels: { success: false, status: 503, type } });
|
|
125
|
+
},
|
|
126
|
+
);
|
|
116
127
|
|
|
117
128
|
outgoingStream.on("end", () => {
|
|
118
129
|
end({ labels: { status: outgoing.statusCode, type } });
|
|
@@ -100,10 +100,21 @@ const VersionsGet = class VersionsGet {
|
|
|
100
100
|
|
|
101
101
|
const outgoingStream = outgoing.stream;
|
|
102
102
|
if (outgoingStream) {
|
|
103
|
-
outgoingStream.on(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
outgoingStream.on(
|
|
104
|
+
"error",
|
|
105
|
+
(/** @type {NodeJS.ErrnoException} */ err) => {
|
|
106
|
+
// ERR_STREAM_PREMATURE_CLOSE means the client closed the
|
|
107
|
+
// connection before the transfer finished. This is normal
|
|
108
|
+
// browser behaviour (navigation, cancelled requests, etc.)
|
|
109
|
+
// and not a server-side error worth alerting on.
|
|
110
|
+
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
|
111
|
+
this._log.debug(`pkg:latest - File stream error - ${err}`);
|
|
112
|
+
} else {
|
|
113
|
+
this._log.info(`pkg:latest - File stream error - ${err}`);
|
|
114
|
+
}
|
|
115
|
+
end({ labels: { success: false, status: 503, type } });
|
|
116
|
+
},
|
|
117
|
+
);
|
|
107
118
|
|
|
108
119
|
outgoingStream.on("end", () => {
|
|
109
120
|
end({ labels: { status: outgoing.statusCode, type } });
|
package/lib/sinks/test.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Writable, Readable } from "node:stream";
|
|
|
2
2
|
import { ReadFile } from "@eik/common";
|
|
3
3
|
import Metrics from "@metrics/client";
|
|
4
4
|
import Sink from "@eik/sink";
|
|
5
|
-
import
|
|
5
|
+
import { lookup } from "mrmime";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { toUrlPathname } from "../utils/url.js";
|
|
8
8
|
import Entry from "./mem-entry.js";
|
|
@@ -48,7 +48,7 @@ export default class SinkTest extends Sink {
|
|
|
48
48
|
*/
|
|
49
49
|
set(filePath, payload) {
|
|
50
50
|
const pathname = toUrlPathname(path.join(this._rootPath, filePath));
|
|
51
|
-
const mimeType =
|
|
51
|
+
const mimeType = lookup(pathname) || "application/octet-stream";
|
|
52
52
|
|
|
53
53
|
let entry;
|
|
54
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eik/core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.71",
|
|
4
4
|
"description": "Core server package",
|
|
5
5
|
"main": "lib/main.js",
|
|
6
6
|
"types": "./types/main.d.ts",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"abslog": "2.4.4",
|
|
38
38
|
"busboy": "1.6.0",
|
|
39
39
|
"http-errors": "2.0.1",
|
|
40
|
-
"
|
|
40
|
+
"mrmime": "2.0.1",
|
|
41
41
|
"original-url": "1.2.3",
|
|
42
42
|
"semver": "7.8.5",
|
|
43
43
|
"ssri": "14.0.0",
|
|
44
44
|
"tar": "7.5.22"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@eik/eslint-config": "2.0.
|
|
47
|
+
"@eik/eslint-config": "2.0.15",
|
|
48
48
|
"@eik/prettier-config": "1.0.2",
|
|
49
|
-
"@eik/semantic-release-config": "1.0.
|
|
49
|
+
"@eik/semantic-release-config": "1.0.18",
|
|
50
50
|
"@eik/typescript-config": "1.0.2",
|
|
51
51
|
"@types/readable-stream": "4.0.24",
|
|
52
52
|
"eslint": "10.4.1",
|