@tangle-network/sdk-session-persistence 0.7.11 → 0.7.13

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.mts CHANGED
@@ -29,8 +29,10 @@ interface DurableWriteOptions {
29
29
  }
30
30
  /**
31
31
  * Durably replaces `target` with `contents`; its directory must exist. A crash
32
- * can leave a `.tmp-` sibling that readers skip. A numeric mode is filtered by
33
- * the process umask; options and the default use an exact mode.
32
+ * can leave a `.tmp-` sibling that readers skip. Options and the default keep
33
+ * incomplete bytes owner-private, then apply the exact mode and owner before
34
+ * publication. A numeric mode retains its creation mode filtered by the umask.
35
+ * A directory-sync failure rejects even though the complete file was renamed.
34
36
  */
35
37
  declare function writeFileDurably(target: string, contents: string, modeOrOptions?: number | DurableWriteOptions): Promise<void>;
36
38
  //#endregion
package/dist/index.mjs CHANGED
@@ -35,8 +35,10 @@ function syncDirectory(path) {
35
35
  }
36
36
  /**
37
37
  * Durably replaces `target` with `contents`; its directory must exist. A crash
38
- * can leave a `.tmp-` sibling that readers skip. A numeric mode is filtered by
39
- * the process umask; options and the default use an exact mode.
38
+ * can leave a `.tmp-` sibling that readers skip. Options and the default keep
39
+ * incomplete bytes owner-private, then apply the exact mode and owner before
40
+ * publication. A numeric mode retains its creation mode filtered by the umask.
41
+ * A directory-sync failure rejects even though the complete file was renamed.
40
42
  */
41
43
  async function writeFileDurably(target, contents, modeOrOptions = {}) {
42
44
  const { mode = 384, owner, directory } = typeof modeOrOptions === "number" ? { mode: modeOrOptions } : modeOrOptions;
@@ -44,11 +46,11 @@ async function writeFileDurably(target, contents, modeOrOptions = {}) {
44
46
  const path = directory ? `/proc/self/fd/${directory.fd}/${target}` : target;
45
47
  const temporary = temporarySibling(path);
46
48
  try {
47
- const handle = await fs.open(temporary, "wx", mode);
49
+ const handle = await fs.open(temporary, "wx", typeof modeOrOptions === "number" ? mode : 384);
48
50
  try {
51
+ await handle.writeFile(contents, "utf-8");
49
52
  if (owner) await handle.chown(owner.uid, owner.gid);
50
53
  if (typeof modeOrOptions !== "number") await handle.chmod(mode);
51
- await handle.writeFile(contents, "utf-8");
52
54
  await handle.sync();
53
55
  } finally {
54
56
  await handle.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sdk-session-persistence",
3
- "version": "0.7.11",
3
+ "version": "0.7.13",
4
4
  "description": "File-based session and message storage for CLI providers without built-in persistence",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -16,7 +16,7 @@
16
16
  "!dist/**/*.map"
17
17
  ],
18
18
  "dependencies": {
19
- "@tangle-network/agent-interface": "^5.10.23"
19
+ "@tangle-network/agent-interface": "^5.10.27"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "25.6.0",
@@ -29,8 +29,8 @@
29
29
  "registry": "https://registry.npmjs.org"
30
30
  },
31
31
  "tangleRelease": {
32
- "sourceSha": "fbf8a5286a06be64d577a2eaeca2ec6c8956c28e",
33
- "mergedAt": "2026-11-15T16:25:34-08:00"
32
+ "sourceSha": "50f13b2b8a50016865e76b70e37eb345c0ccbefc",
33
+ "mergedAt": "2026-11-16T16:24:51-08:00"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsdown",