@tangle-network/sdk-session-persistence 0.7.10 → 0.7.11
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 +3 -6
- package/dist/index.mjs +5 -3
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -29,13 +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.
|
|
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.
|
|
33
34
|
*/
|
|
34
|
-
declare function writeFileDurably(target: string, contents: string,
|
|
35
|
-
mode,
|
|
36
|
-
owner,
|
|
37
|
-
directory
|
|
38
|
-
}?: DurableWriteOptions): Promise<void>;
|
|
35
|
+
declare function writeFileDurably(target: string, contents: string, modeOrOptions?: number | DurableWriteOptions): Promise<void>;
|
|
39
36
|
//#endregion
|
|
40
37
|
//#region src/types.d.ts
|
|
41
38
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -35,9 +35,11 @@ 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.
|
|
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.
|
|
39
40
|
*/
|
|
40
|
-
async function writeFileDurably(target, contents,
|
|
41
|
+
async function writeFileDurably(target, contents, modeOrOptions = {}) {
|
|
42
|
+
const { mode = 384, owner, directory } = typeof modeOrOptions === "number" ? { mode: modeOrOptions } : modeOrOptions;
|
|
41
43
|
if (directory && !/^(?!\.\.?$)[^/]+$/.test(target)) throw new Error(`Not an entry name in the open directory: ${target}`);
|
|
42
44
|
const path = directory ? `/proc/self/fd/${directory.fd}/${target}` : target;
|
|
43
45
|
const temporary = temporarySibling(path);
|
|
@@ -45,7 +47,7 @@ async function writeFileDurably(target, contents, { mode = 384, owner, directory
|
|
|
45
47
|
const handle = await fs.open(temporary, "wx", mode);
|
|
46
48
|
try {
|
|
47
49
|
if (owner) await handle.chown(owner.uid, owner.gid);
|
|
48
|
-
await handle.chmod(mode);
|
|
50
|
+
if (typeof modeOrOptions !== "number") await handle.chmod(mode);
|
|
49
51
|
await handle.writeFile(contents, "utf-8");
|
|
50
52
|
await handle.sync();
|
|
51
53
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sdk-session-persistence",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.11",
|
|
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",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"registry": "https://registry.npmjs.org"
|
|
30
30
|
},
|
|
31
31
|
"tangleRelease": {
|
|
32
|
-
"sourceSha": "
|
|
33
|
-
"mergedAt": "2026-11-
|
|
32
|
+
"sourceSha": "fbf8a5286a06be64d577a2eaeca2ec6c8956c28e",
|
|
33
|
+
"mergedAt": "2026-11-15T16:25:34-08:00"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown",
|