@unicitylabs/sphere-sdk 0.16.0-dev.2 → 0.16.0

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.
@@ -12663,7 +12663,7 @@ var require_snapshot_recorder = __commonJS({
12663
12663
  "node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
12664
12664
  "use strict";
12665
12665
  var { writeFile, readFile, mkdir } = __require("fs/promises");
12666
- var { dirname, resolve: resolve2 } = __require("path");
12666
+ var { dirname: dirname2, resolve: resolve2 } = __require("path");
12667
12667
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("timers");
12668
12668
  var { InvalidArgumentError, UndiciError } = require_errors();
12669
12669
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -12894,7 +12894,7 @@ var require_snapshot_recorder = __commonJS({
12894
12894
  throw new InvalidArgumentError("Snapshot path is required");
12895
12895
  }
12896
12896
  const resolvedPath = resolve2(path2);
12897
- await mkdir(dirname(resolvedPath), { recursive: true });
12897
+ await mkdir(dirname2(resolvedPath), { recursive: true });
12898
12898
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
12899
12899
  hash,
12900
12900
  snapshot
@@ -23813,6 +23813,22 @@ function mergeTrackedAddresses(onDisk, incoming) {
23813
23813
  }
23814
23814
 
23815
23815
  // impl/nodejs/storage/FileStorageProvider.ts
23816
+ function canonicalPath(p) {
23817
+ const resolved = path.resolve(p);
23818
+ const tail = [];
23819
+ let cursor = resolved;
23820
+ while (!fs.existsSync(cursor)) {
23821
+ const parent = path.dirname(cursor);
23822
+ if (parent === cursor) return resolved;
23823
+ tail.unshift(path.basename(cursor));
23824
+ cursor = parent;
23825
+ }
23826
+ try {
23827
+ return path.join(fs.realpathSync(cursor), ...tail);
23828
+ } catch {
23829
+ return resolved;
23830
+ }
23831
+ }
23816
23832
  var FileStorageProvider = class {
23817
23833
  id = "file-storage";
23818
23834
  name = "File Storage";
@@ -23836,7 +23852,7 @@ var FileStorageProvider = class {
23836
23852
  this.network = config.network;
23837
23853
  }
23838
23854
  this.isTxtMode = this.filePath.endsWith(".txt");
23839
- this.backingStoreId = `file:${this.filePath}`;
23855
+ this.backingStoreId = `file:${path.join(canonicalPath(this.dataDir), path.basename(this.filePath))}`;
23840
23856
  }
23841
23857
  setIdentity(identity) {
23842
23858
  this._identity = identity;