@eik/core 2.1.80 → 2.1.82

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.1.82](https://github.com/eik-lib/core/compare/v2.1.81...v2.1.82) (2026-08-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 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))
7
+
8
+ ## [2.1.81](https://github.com/eik-lib/core/compare/v2.1.80...v2.1.81) (2026-08-19)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update eik packages to v2.1.0 ([#640](https://github.com/eik-lib/core/issues/640)) ([4ee2d69](https://github.com/eik-lib/core/commit/4ee2d69491e287f5a719973c3b20cf11f9c327ad))
14
+
1
15
  ## [2.1.80](https://github.com/eik-lib/core/compare/v2.1.79...v2.1.80) (2026-08-19)
2
16
 
3
17
 
@@ -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) return reject(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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/core",
3
- "version": "2.1.80",
3
+ "version": "2.1.82",
4
4
  "description": "Core server package",
5
5
  "main": "lib/main.js",
6
6
  "types": "./types/main.d.ts",
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "@eik/common": "5.2.0",
33
33
  "@eik/sink": "1.2.7",
34
- "@eik/sink-file-system": "2.0.41",
35
- "@eik/sink-memory": "2.0.37",
34
+ "@eik/sink-file-system": "2.1.0",
35
+ "@eik/sink-memory": "2.1.0",
36
36
  "@metrics/client": "2.5.5",
37
37
  "abslog": "2.4.4",
38
38
  "busboy": "1.6.0",