@hardkas/core 0.7.4-alpha → 0.7.5-alpha

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/dist/index.d.ts CHANGED
@@ -787,7 +787,7 @@ declare class AppendCoordinator {
787
787
  };
788
788
  }
789
789
 
790
- declare const CURRENT_RUNTIME_VERSION = "0.7.4-alpha";
790
+ declare const CURRENT_RUNTIME_VERSION = "0.7.5-alpha";
791
791
  declare const MIN_SUPPORTED_VERSION = "0.5.0-alpha";
792
792
  interface MigrationStatus {
793
793
  needsMigration: boolean;
package/dist/index.js CHANGED
@@ -280,7 +280,23 @@ var AppendCoordinator = class _AppendCoordinator {
280
280
  } catch (err) {
281
281
  const truncateTo = lastLineStart;
282
282
  const discardedBytes = stat.size - truncateTo;
283
- fs.truncateSync(filePath, truncateTo);
283
+ let truncated = false;
284
+ let retries = 5;
285
+ let lastError = null;
286
+ while (retries > 0 && !truncated) {
287
+ try {
288
+ fs.truncateSync(filePath, truncateTo);
289
+ truncated = true;
290
+ } catch (e) {
291
+ lastError = e;
292
+ retries--;
293
+ if (retries > 0) {
294
+ const sharedBuf = new Int32Array(new SharedArrayBuffer(4));
295
+ Atomics.wait(sharedBuf, 0, 0, 10);
296
+ }
297
+ }
298
+ }
299
+ if (!truncated) throw lastError;
284
300
  return {
285
301
  repaired: true,
286
302
  linesDiscarded: discardedBytes,
@@ -940,7 +956,7 @@ async function createSnapshot(options) {
940
956
  const manifest = {
941
957
  snapshotVersion: 1,
942
958
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
943
- hardkasVersion: "0.7.4-alpha",
959
+ hardkasVersion: "0.7.5-alpha",
944
960
  stateAuthority: "filesystem",
945
961
  projectionAuthority: "sqlite",
946
962
  deterministicScope,
@@ -1189,7 +1205,7 @@ Resolution Command: ${report.exactReplayCommand}`
1189
1205
  // src/migrations.ts
1190
1206
  import fs6 from "fs";
1191
1207
  import path8 from "path";
1192
- var CURRENT_RUNTIME_VERSION = "0.7.4-alpha";
1208
+ var CURRENT_RUNTIME_VERSION = "0.7.5-alpha";
1193
1209
  var MIN_SUPPORTED_VERSION = "0.5.0-alpha";
1194
1210
  var MigrationManager = class {
1195
1211
  static checkVersion(rootDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/core",
3
- "version": "0.7.4-alpha",
3
+ "version": "0.7.5-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",