core-3nweb-client-lib 0.45.1 → 0.45.2
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.
|
@@ -143,6 +143,7 @@ export declare class FolderNode extends NodeInFS<FolderPersistance> {
|
|
|
143
143
|
createFile(name: string, exclusive: boolean): Promise<FileNode>;
|
|
144
144
|
createLink(name: string, params: LinkParameters<any>): Promise<void>;
|
|
145
145
|
removeChild(f: NodeInFS<any>): Promise<void>;
|
|
146
|
+
removeChildEntryUnconditionally(name: string): Promise<void>;
|
|
146
147
|
private changeChildName;
|
|
147
148
|
moveChildTo(childName: string, dst: FolderNode, nameInDst: string): Promise<void>;
|
|
148
149
|
private moveChildOut;
|
|
@@ -612,6 +612,16 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
612
612
|
// stays consistent
|
|
613
613
|
this.callRemoveObjOn('local', f);
|
|
614
614
|
}
|
|
615
|
+
async removeChildEntryUnconditionally(name) {
|
|
616
|
+
await this.doTransition(async (state, version) => {
|
|
617
|
+
const child = state.nodes[name];
|
|
618
|
+
if (!child) {
|
|
619
|
+
return [];
|
|
620
|
+
}
|
|
621
|
+
delete state.nodes[name];
|
|
622
|
+
return this.makeEntryRemovalEvent(version, 'local', child);
|
|
623
|
+
});
|
|
624
|
+
}
|
|
615
625
|
changeChildName(oldName, newName) {
|
|
616
626
|
return this.doTransition(async (state, version) => {
|
|
617
627
|
const child = state.nodes[oldName];
|
|
@@ -146,32 +146,62 @@ class XspFS {
|
|
|
146
146
|
if (typeof folderName !== 'string') {
|
|
147
147
|
throw new Error('Cannot remove root folder');
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
.
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
try {
|
|
150
|
+
const folder = (await parentFolder.getFolder(folderName)
|
|
151
|
+
.catch(setExcPath(path)));
|
|
152
|
+
if (!removeContent && !folder.isEmpty()) {
|
|
153
|
+
throw (0, file_1.makeFileException)('notEmpty', path);
|
|
154
|
+
}
|
|
155
|
+
// note that internal folder.delete() removes all children as a matter
|
|
156
|
+
// of not leaving inaccessible nodes, i.e. content is removed implicitly
|
|
157
|
+
await parentFolder.removeChild(folder);
|
|
158
|
+
}
|
|
159
|
+
catch (exc) {
|
|
160
|
+
if (exc.type === 'secondary') {
|
|
161
|
+
await parentFolder.removeChildEntryUnconditionally(folderName);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
throw exc;
|
|
165
|
+
}
|
|
153
166
|
}
|
|
154
|
-
// note that internal folder.delete() removes all children as a matter
|
|
155
|
-
// of not leaving inaccessible nodes, i.e. content is removed implicitly
|
|
156
|
-
await parentFolder.removeChild(folder);
|
|
157
167
|
}
|
|
158
168
|
async deleteFile(path) {
|
|
159
169
|
const { fileName, folderPath } = split(path);
|
|
160
170
|
const root = this.v.getRootIfNotClosed(path);
|
|
161
171
|
const parentFolder = await root.getFolderInThisSubTree(folderPath)
|
|
162
172
|
.catch(setExcPath(path));
|
|
163
|
-
|
|
164
|
-
.
|
|
165
|
-
|
|
173
|
+
try {
|
|
174
|
+
const file = await parentFolder.getFile(fileName)
|
|
175
|
+
.catch(setExcPath(path));
|
|
176
|
+
await parentFolder.removeChild(file);
|
|
177
|
+
}
|
|
178
|
+
catch (exc) {
|
|
179
|
+
if (exc.type === 'secondary') {
|
|
180
|
+
await parentFolder.removeChildEntryUnconditionally(fileName);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
throw exc;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
166
186
|
}
|
|
167
187
|
async deleteLink(path) {
|
|
168
188
|
const { fileName, folderPath } = split(path);
|
|
169
189
|
const root = this.v.getRootIfNotClosed(path);
|
|
170
190
|
const parentFolder = await root.getFolderInThisSubTree(folderPath)
|
|
171
191
|
.catch(setExcPath(path));
|
|
172
|
-
|
|
173
|
-
.
|
|
174
|
-
|
|
192
|
+
try {
|
|
193
|
+
const link = await parentFolder.getLink(fileName)
|
|
194
|
+
.catch(setExcPath(path));
|
|
195
|
+
await parentFolder.removeChild(link);
|
|
196
|
+
}
|
|
197
|
+
catch (exc) {
|
|
198
|
+
if (exc.type === 'secondary') {
|
|
199
|
+
await parentFolder.removeChildEntryUnconditionally(fileName);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
throw exc;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
175
205
|
}
|
|
176
206
|
async move(initPath, newPath) {
|
|
177
207
|
const srcFolderPath = splitPathIntoParts(initPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-3nweb-client-lib",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.2",
|
|
4
4
|
"description": "3NWeb client core library, embeddable into different environments",
|
|
5
5
|
"main": "build/lib-index.js",
|
|
6
6
|
"types": "build/lib-index.d.ts",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@types/node": "^22.13.14",
|
|
48
48
|
"@types/punycode": "^2.1.1",
|
|
49
49
|
"@types/ws": "^8.18.1",
|
|
50
|
-
"napi-nacl": "^1.2.0",
|
|
51
50
|
"jasmine": "^5.13.0",
|
|
51
|
+
"napi-nacl": "^1.2.1",
|
|
52
52
|
"protobufjs-cli": "^1.0.2",
|
|
53
53
|
"spec-3nweb-server": "^1.8.5",
|
|
54
54
|
"tsuml2": "^0.17.1",
|