@secrecy/lib 1.69.2-fix-node-sharing.2 → 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.
@@ -389,9 +389,15 @@ export class SecrecyCloudClient {
389
389
  }));
390
390
  const finishInput = [];
391
391
  for (const [userId, nodes] of Object.entries(withKeys)) {
392
+ if (nodes.nodes.length === 0) {
393
+ continue;
394
+ }
392
395
  finishInput.push({ userId, nodes: nodes.nodes });
393
396
  }
394
397
  for (const [userId, nodes] of Object.entries(nodesToUpdateRights)) {
398
+ if (nodes.length === 0) {
399
+ continue;
400
+ }
395
401
  finishInput.push({ userId, nodes });
396
402
  }
397
403
  const subState = finishInput.length > 0
@@ -665,9 +671,11 @@ export class SecrecyCloudClient {
665
671
  }
666
672
  // Retrieve all missing nodes from cache to api.
667
673
  const missingNodeIds = nodeIds.filter((nodeId) => !nodes.some((node) => node.id === nodeId));
668
- const fetchedNodes = await this.#apiClient.cloud.nodesForEncryption.query({
669
- ids: missingNodeIds,
670
- });
674
+ const fetchedNodes = missingNodeIds.length > 0
675
+ ? await this.#apiClient.cloud.nodesForEncryption.query({
676
+ ids: missingNodeIds,
677
+ })
678
+ : [];
671
679
  if (fetchedNodes.length !== missingNodeIds.length) {
672
680
  const diff = missingNodeIds.filter((id) => !fetchedNodes.some((node) => node.id === id));
673
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.2",
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"