core-3nweb-client-lib 0.44.6 → 0.44.8
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/build/api-defs/files.d.ts +1 -0
- package/build/api-defs/web3n.d.ts +2 -1
- package/build/core/asmail/inbox/inbox-events.d.ts +0 -1
- package/build/core/asmail/inbox/inbox-events.js +3 -5
- package/build/core/asmail/inbox/index.js +1 -1
- package/build/core/asmail/inbox/msg-downloader.d.ts +1 -2
- package/build/core/asmail/inbox/msg-downloader.js +3 -4
- package/build/core/storage/synced/obj-files.js +1 -1
- package/build/core/storage/synced/obj-status.d.ts +2 -0
- package/build/core/storage/synced/obj-status.js +9 -5
- package/build/core/storage/synced/remote-events.d.ts +0 -1
- package/build/core/storage/synced/remote-events.js +5 -7
- package/build/core/storage/synced/storage.js +2 -2
- package/build/core/storage/synced/upsyncer.d.ts +1 -2
- package/build/core/storage/synced/upsyncer.js +49 -25
- package/build/lib-client/3nstorage/storage-owner.js +1 -1
- package/build/lib-client/asmail/recipient.js +8 -4
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/worker-js.js +4 -2
- package/build/lib-client/local-files/dev-file-sink.js +30 -28
- package/build/lib-client/local-files/dev-file-src.js +7 -6
- package/build/lib-client/local-files/device-fs.js +23 -23
- package/build/lib-client/objs-on-disk/obj-folders.js +6 -3
- package/build/lib-client/request-utils.d.ts +2 -1
- package/build/lib-client/request-utils.js +8 -19
- package/build/lib-client/user-with-mid-session.d.ts +2 -0
- package/build/lib-client/user-with-mid-session.js +33 -22
- package/build/lib-client/xsp-fs/attrs.js +4 -2
- package/build/lib-client/xsp-fs/exceptions.js +5 -2
- package/build/lib-client/xsp-fs/folder-node-serialization.js +4 -2
- package/build/lib-client/xsp-fs/node-in-fs.js +2 -5
- package/build/lib-common/async-fs-node.d.ts +30 -46
- package/build/lib-common/async-fs-node.js +71 -309
- package/build/lib-common/awaitable-state.js +3 -1
- package/build/lib-common/exceptions/file.d.ts +1 -1
- package/build/lib-common/exceptions/file.js +11 -6
- package/build/lib-common/exceptions/runtime.d.ts +7 -1
- package/build/lib-common/exceptions/runtime.js +16 -2
- package/build/lib-common/objs-on-disk/obj-version-file.d.ts +1 -1
- package/build/lib-common/objs-on-disk/obj-version-file.js +35 -33
- package/build/lib-index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -268,14 +268,11 @@ class NodeInFS {
|
|
|
268
268
|
this.writeProc = new synced_1.SingleProc();
|
|
269
269
|
}
|
|
270
270
|
if (!awaitPrevChange && this.writeProc.isProcessing()) {
|
|
271
|
-
throw (0, runtime_1.makeRuntimeException)('file', { path: this.name, fsEtityType: this.type }, { concurrentUpdate: true });
|
|
271
|
+
throw (0, runtime_1.makeRuntimeException)('file', { path: this.name, fsEtityType: this.type }, { concurrentUpdate: true }, true);
|
|
272
272
|
}
|
|
273
273
|
const res = await this.writeProc.startOrChain(async () => {
|
|
274
274
|
if (this.isMarkedRemoved) {
|
|
275
|
-
throw (0, runtime_1.makeRuntimeException)('file', {
|
|
276
|
-
path: this.name, fsEtityType: this.type,
|
|
277
|
-
message: `NodeInFS is marked removed`
|
|
278
|
-
}, { notFound: true });
|
|
275
|
+
throw (0, runtime_1.makeRuntimeException)('file', { path: this.name, fsEtityType: this.type, message: `NodeInFS is marked removed` }, { notFound: true });
|
|
279
276
|
}
|
|
280
277
|
try {
|
|
281
278
|
const res = await change();
|
|
@@ -1,40 +1,24 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import { Readable, Writable } from 'stream';
|
|
3
|
-
export { Stats } from 'fs';
|
|
4
|
-
export { FileException } from './exceptions/file';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare function mkdir(path: string, options?: number | string | fs.MakeDirectoryOptions | null): Promise<void>;
|
|
23
|
-
export declare function open(path: string, flags: string): Promise<number>;
|
|
24
|
-
export declare function close(fd: number): Promise<void>;
|
|
25
|
-
export declare function symlink(target: string, path: string, type?: 'dir' | 'file' | 'junction'): Promise<void>;
|
|
26
|
-
export declare function readlink(path: string): Promise<string>;
|
|
27
|
-
export declare function lstat(path: string): Promise<fs.Stats>;
|
|
28
|
-
export declare function stat(path: string): Promise<fs.Stats>;
|
|
29
|
-
export declare function fstat(fd: number): Promise<fs.Stats>;
|
|
30
|
-
export declare function readdir(path: string): Promise<string[]>;
|
|
31
|
-
export declare function rmdir(path: string): Promise<void>;
|
|
32
|
-
export declare function unlink(path: string): Promise<void>;
|
|
33
|
-
export declare function rename(oldPath: string, newPath: string): Promise<void>;
|
|
34
|
-
export declare function truncate(path: string, size: number): Promise<void>;
|
|
35
|
-
export declare function ftruncate(fd: number, size: number): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* @param fd is an open file descriptor
|
|
3
|
+
export type { Stats } from 'fs';
|
|
4
|
+
export type { FileException } from './exceptions/file';
|
|
5
|
+
export type FileHandle = fs.promises.FileHandle;
|
|
6
|
+
export declare const readFile: typeof fs.promises.readFile;
|
|
7
|
+
export declare const writeFile: typeof fs.promises.writeFile;
|
|
8
|
+
export declare const appendFile: typeof fs.promises.appendFile;
|
|
9
|
+
export declare const mkdir: typeof fs.promises.mkdir;
|
|
10
|
+
export declare const open: typeof fs.promises.open;
|
|
11
|
+
export declare const symlink: typeof fs.promises.symlink;
|
|
12
|
+
export declare const readlink: typeof fs.promises.readlink;
|
|
13
|
+
export declare const lstat: typeof fs.promises.lstat;
|
|
14
|
+
export declare const stat: typeof fs.promises.stat;
|
|
15
|
+
export declare const readdir: typeof fs.promises.readdir;
|
|
16
|
+
export declare const rmdir: typeof fs.promises.rmdir;
|
|
17
|
+
export declare const unlink: typeof fs.promises.unlink;
|
|
18
|
+
export declare const rename: typeof fs.promises.rename;
|
|
19
|
+
export declare const truncate: typeof fs.promises.truncate;
|
|
20
|
+
/**
|
|
21
|
+
* @param fh is an open file handle
|
|
38
22
|
* @param pos is a position in the file, from which reading should start
|
|
39
23
|
* @param buf is a buffer, into which bytes should be read from start to
|
|
40
24
|
* the end, i.e. number of bytes that must be read is equal to the buffer's
|
|
@@ -44,14 +28,14 @@ export declare function ftruncate(fd: number, size: number): Promise<void>;
|
|
|
44
28
|
* The promise fails, if an end of file is encountered before entire buffer is
|
|
45
29
|
* filled up with bytes.
|
|
46
30
|
*/
|
|
47
|
-
export declare function readToBuf(
|
|
31
|
+
export declare function readToBuf(fh: FileHandle, pos: number, buf: Buffer): Promise<void>;
|
|
48
32
|
/**
|
|
49
|
-
* @param
|
|
33
|
+
* @param fh is an open file handle
|
|
50
34
|
* @param pos is a position in the file, from which writing should start
|
|
51
35
|
* @param buf is a buffer, from which all bytes should be written into the file.
|
|
52
36
|
* @returns a promise, resolvable when all bytes were written to the file.
|
|
53
37
|
*/
|
|
54
|
-
export declare function writeFromBuf(
|
|
38
|
+
export declare function writeFromBuf(fh: FileHandle, pos: number, buf: Buffer): Promise<void>;
|
|
55
39
|
/**
|
|
56
40
|
* This will create a new file of a given size, and will fail, if a file
|
|
57
41
|
* with a given path already exists.
|
|
@@ -59,10 +43,10 @@ export declare function writeFromBuf(fd: number, pos: number, buf: Buffer): Prom
|
|
|
59
43
|
* @param fileSize
|
|
60
44
|
* @param keepFileOpen
|
|
61
45
|
* @returns a promise, resolvable, when a new empty file has been created.
|
|
62
|
-
* When keep open flag was passed, live
|
|
46
|
+
* When keep open flag was passed, live file handle is returned,
|
|
63
47
|
* else return value is undefined and should be ignored.
|
|
64
48
|
*/
|
|
65
|
-
export declare function createEmptyFile(filePath: string, fileSize: number, keepFileOpen?: boolean): Promise<
|
|
49
|
+
export declare function createEmptyFile(filePath: string, fileSize: number, keepFileOpen?: boolean): Promise<FileHandle | undefined>;
|
|
66
50
|
/**
|
|
67
51
|
* @param path
|
|
68
52
|
* @return a promise, resolvable to true, if given path represents directory,
|
|
@@ -91,18 +75,18 @@ export declare function getFileSize(filePath: string): Promise<number>;
|
|
|
91
75
|
*/
|
|
92
76
|
export declare function getFolderContentSize(folderPath: string): Promise<number>;
|
|
93
77
|
/**
|
|
94
|
-
* @param
|
|
78
|
+
* @param fh is an open file handle
|
|
95
79
|
* @param pos is a position in the file, from which writing should start
|
|
96
80
|
* @param buf is a buffer, from which all bytes should be written into the file.
|
|
97
81
|
* @returns a promise, resolvable when all bytes were written to it.
|
|
98
82
|
*/
|
|
99
|
-
export declare function write(
|
|
83
|
+
export declare function write(fh: FileHandle, pos: number, buf: Buffer): Promise<void>;
|
|
100
84
|
/**
|
|
101
|
-
* @param
|
|
85
|
+
* @param fh is an open file handle in append mode.
|
|
102
86
|
* @param buf is a buffer, from which all bytes should be written into the file.
|
|
103
87
|
* @returns a promise, resolvable when all bytes were written to it.
|
|
104
88
|
*/
|
|
105
|
-
export declare function append(
|
|
89
|
+
export declare function append(fh: FileHandle, buf: Buffer): Promise<void>;
|
|
106
90
|
/**
|
|
107
91
|
* @param filePath
|
|
108
92
|
* @param pos is a position in the file, from which writting should start
|
|
@@ -115,7 +99,7 @@ export declare function append(fd: number, buf: Buffer): Promise<void>;
|
|
|
115
99
|
*/
|
|
116
100
|
export declare function streamToExistingFile(filePath: string, pos: number, len: number, src: Readable, bufSize: number): Promise<void>;
|
|
117
101
|
/**
|
|
118
|
-
* @param
|
|
102
|
+
* @param fh is an open file handle
|
|
119
103
|
* @param pos is a position in the file, from which reading should start
|
|
120
104
|
* @param buf is a buffer, into which bytes should be read from start to
|
|
121
105
|
* the end, i.e. number of bytes that must be read is equal to the buffer's
|
|
@@ -125,7 +109,7 @@ export declare function streamToExistingFile(filePath: string, pos: number, len:
|
|
|
125
109
|
* The promise fails, if an end of file is encountered before entire buffer is
|
|
126
110
|
* filled up with bytes.
|
|
127
111
|
*/
|
|
128
|
-
export declare function read(
|
|
112
|
+
export declare function read(fh: FileHandle, pos: number, buf: Buffer): Promise<void>;
|
|
129
113
|
/**
|
|
130
114
|
* @param folder is a path to a folder, which should be recursively removed,
|
|
131
115
|
* together with all files.
|