@eik/core 2.1.81 → 2.1.83
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 +14 -0
- package/lib/multipart/parser.js +3 -1
- package/lib/utils/utils.js +24 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.1.83](https://github.com/eik-lib/core/compare/v2.1.82...v2.1.83) (2026-08-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* reduce MAX_CONCURRENT_WRITES from 16 to 8 ([#642](https://github.com/eik-lib/core/issues/642)) ([8ab90c6](https://github.com/eik-lib/core/commit/8ab90c62123ac0d2001d8e0dff5ae4d21a194531))
|
|
7
|
+
|
|
8
|
+
## [2.1.82](https://github.com/eik-lib/core/compare/v2.1.81...v2.1.82) (2026-08-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* reclassify GCS 412 errors in writeJSONWithOptions rather than via stream re-emission ([#641](https://github.com/eik-lib/core/issues/641)) ([5094866](https://github.com/eik-lib/core/commit/5094866a9f47cfd75a3252e3b9d160df6bfc442b))
|
|
14
|
+
|
|
1
15
|
## [2.1.81](https://github.com/eik-lib/core/compare/v2.1.80...v2.1.81) (2026-08-19)
|
|
2
16
|
|
|
3
17
|
|
package/lib/multipart/parser.js
CHANGED
|
@@ -162,7 +162,9 @@ const MultipartParser = class MultipartParser {
|
|
|
162
162
|
// Without a cap, a tar with thousands of files would open an equal
|
|
163
163
|
// number of concurrent GCS resumable uploads or filesystem write
|
|
164
164
|
// streams, exhausting the connection pool or file descriptor limit.
|
|
165
|
-
|
|
165
|
+
// 8 keeps the peak concurrent GCS API calls below the default
|
|
166
|
+
// EventEmitter maxListeners threshold of 10.
|
|
167
|
+
const MAX_CONCURRENT_WRITES = 8;
|
|
166
168
|
let runningWrites = 0;
|
|
167
169
|
/** @type {import("tar").ReadEntry[]} */
|
|
168
170
|
const pendingEntries = [];
|
package/lib/utils/utils.js
CHANGED
|
@@ -174,7 +174,30 @@ const writeJSONWithOptions = (sink, path, obj, contentType, options = {}) =>
|
|
|
174
174
|
const to = await sink.write(path, contentType, options);
|
|
175
175
|
|
|
176
176
|
pipeline(from, to, (error) => {
|
|
177
|
-
if (error)
|
|
177
|
+
if (error) {
|
|
178
|
+
// GCS returns HTTP 412 Precondition Failed when a conditional
|
|
179
|
+
// write constraint was not met. Reclassify using the options
|
|
180
|
+
// that triggered the condition so callers receive a meaningful
|
|
181
|
+
// error code rather than the raw HTTP status.
|
|
182
|
+
const err = /** @type {any} */ (error);
|
|
183
|
+
if (err.code === 412) {
|
|
184
|
+
if (options.ifNotExists) {
|
|
185
|
+
return reject(
|
|
186
|
+
Object.assign(new Error(`File already exists: ${path}`), {
|
|
187
|
+
code: "ALREADY_EXISTS",
|
|
188
|
+
}),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
if (options.ifGenerationMatch !== undefined) {
|
|
192
|
+
return reject(
|
|
193
|
+
Object.assign(new Error(`Generation mismatch: ${path}`), {
|
|
194
|
+
code: "CONFLICT",
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return reject(error);
|
|
200
|
+
}
|
|
178
201
|
return resolve(buffer);
|
|
179
202
|
});
|
|
180
203
|
} catch (error) {
|