@secrecy/lib 1.69.2-fix-node-sharing.1 → 1.69.2-fix-node-sharing.3
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.
|
@@ -348,15 +348,14 @@ export class SecrecyCloudClient {
|
|
|
348
348
|
.filter((node) => !node.includeKeys)
|
|
349
349
|
.map((node) => {
|
|
350
350
|
return {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
},
|
|
351
|
+
id: node.nodeId,
|
|
352
|
+
data: [],
|
|
353
|
+
nameKey: null,
|
|
354
|
+
rights: node.rights,
|
|
355
|
+
addAccess: node.addAccess,
|
|
356
|
+
delAccess: node.delAccess,
|
|
357
|
+
sharingAddAccess: node.sharingAddAccess,
|
|
358
|
+
sharingDelAccess: node.sharingDelAccess,
|
|
360
359
|
};
|
|
361
360
|
}),
|
|
362
361
|
]));
|
|
@@ -388,10 +387,19 @@ export class SecrecyCloudClient {
|
|
|
388
387
|
},
|
|
389
388
|
];
|
|
390
389
|
}));
|
|
391
|
-
const finishInput =
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
390
|
+
const finishInput = [];
|
|
391
|
+
for (const [userId, nodes] of Object.entries(withKeys)) {
|
|
392
|
+
if (nodes.nodes.length === 0) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
finishInput.push({ userId, nodes: nodes.nodes });
|
|
396
|
+
}
|
|
397
|
+
for (const [userId, nodes] of Object.entries(nodesToUpdateRights)) {
|
|
398
|
+
if (nodes.length === 0) {
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
finishInput.push({ userId, nodes });
|
|
402
|
+
}
|
|
395
403
|
const subState = finishInput.length > 0
|
|
396
404
|
? await this.#apiClient.cloud.shareNodeFinish.mutate(finishInput)
|
|
397
405
|
: { isFinished: true, details: {} };
|
|
@@ -663,9 +671,11 @@ export class SecrecyCloudClient {
|
|
|
663
671
|
}
|
|
664
672
|
// Retrieve all missing nodes from cache to api.
|
|
665
673
|
const missingNodeIds = nodeIds.filter((nodeId) => !nodes.some((node) => node.id === nodeId));
|
|
666
|
-
const fetchedNodes =
|
|
667
|
-
|
|
668
|
-
|
|
674
|
+
const fetchedNodes = missingNodeIds.length > 0
|
|
675
|
+
? await this.#apiClient.cloud.nodesForEncryption.query({
|
|
676
|
+
ids: missingNodeIds,
|
|
677
|
+
})
|
|
678
|
+
: [];
|
|
669
679
|
if (fetchedNodes.length !== missingNodeIds.length) {
|
|
670
680
|
const diff = missingNodeIds.filter((id) => !fetchedNodes.some((node) => node.id === id));
|
|
671
681
|
throw new Error(`Unable to fetch some node infos (${diff.join(', ')})`);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.69.2-fix-node-sharing.
|
|
5
|
+
"version": "1.69.2-fix-node-sharing.3",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|