@glyphteck/veyl 0.71.0 → 0.71.1

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/account.js CHANGED
@@ -32891,6 +32891,8 @@ function createChatSession({
32891
32891
  await leaveOwnedChat(chat, { optimistic: false });
32892
32892
  assertBulkOperationCurrent(operation);
32893
32893
  await cloud.user.chats.unlink(identity.uid, chat.entryId);
32894
+ assertBulkOperationCurrent(operation);
32895
+ operation.deleteActions.commitRetirement(chat.id);
32894
32896
  } else {
32895
32897
  await operation.deleteActions.deleteChat(chat, { cleanup: false });
32896
32898
  }
@@ -32905,14 +32907,30 @@ function createChatSession({
32905
32907
  const { uid: operationUid, chatPK: operationChatPK, chatPrivateKey: operationChatPrivateKey } = operation.identity;
32906
32908
  if (!operationUid || !operationChatPK || !operationChatPrivateKey)
32907
32909
  return retiredPending;
32908
- const allChats = await loadOwnerChats(cloud, operationUid, operationChatPK, operationChatPrivateKey);
32909
- assertBulkOperationCurrent(operation);
32910
- const affected = allChats.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK));
32911
- await purgePeerChats(affected, operation);
32912
- assertBulkOperationCurrent(operation);
32913
- await options.onDeliveryRevoked?.();
32914
- assertBulkOperationCurrent(operation);
32915
- return retiredPending || affected.length > 0;
32910
+ const visible = chatsRef.current.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK) && !operation.deleteActions.isChatPendingDelete(chat.id));
32911
+ for (const chat of visible)
32912
+ operation.deleteActions.beginRetirement(chat.id);
32913
+ try {
32914
+ const allChats = await loadOwnerChats(cloud, operationUid, operationChatPK, operationChatPrivateKey);
32915
+ assertBulkOperationCurrent(operation);
32916
+ const affected = allChats.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK));
32917
+ await purgePeerChats(affected, operation);
32918
+ assertBulkOperationCurrent(operation);
32919
+ for (const chat of visible)
32920
+ operation.deleteActions.commitRetirement(chat.id);
32921
+ await options.onDeliveryRevoked?.();
32922
+ assertBulkOperationCurrent(operation);
32923
+ return retiredPending || affected.length > 0;
32924
+ } catch (error) {
32925
+ if (isBulkOperationCurrent(operation)) {
32926
+ for (const chat of visible) {
32927
+ if (operation.deleteActions.isChatPendingDelete(chat.id)) {
32928
+ operation.deleteActions.rollbackRetirement(chat.id);
32929
+ }
32930
+ }
32931
+ }
32932
+ throw error;
32933
+ }
32916
32934
  };
32917
32935
  const retireBlockedChats = async (blockedUids) => {
32918
32936
  const operation = bulkOperation(blockedUids);
package/dist/cli.js CHANGED
@@ -36450,6 +36450,8 @@ function createChatSession({
36450
36450
  await leaveOwnedChat(chat, { optimistic: false });
36451
36451
  assertBulkOperationCurrent(operation);
36452
36452
  await cloud.user.chats.unlink(identity.uid, chat.entryId);
36453
+ assertBulkOperationCurrent(operation);
36454
+ operation.deleteActions.commitRetirement(chat.id);
36453
36455
  } else {
36454
36456
  await operation.deleteActions.deleteChat(chat, { cleanup: false });
36455
36457
  }
@@ -36464,14 +36466,30 @@ function createChatSession({
36464
36466
  const { uid: operationUid, chatPK: operationChatPK, chatPrivateKey: operationChatPrivateKey } = operation.identity;
36465
36467
  if (!operationUid || !operationChatPK || !operationChatPrivateKey)
36466
36468
  return retiredPending;
36467
- const allChats = await loadOwnerChats(cloud, operationUid, operationChatPK, operationChatPrivateKey);
36468
- assertBulkOperationCurrent(operation);
36469
- const affected = allChats.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK));
36470
- await purgePeerChats(affected, operation);
36471
- assertBulkOperationCurrent(operation);
36472
- await options.onDeliveryRevoked?.();
36473
- assertBulkOperationCurrent(operation);
36474
- return retiredPending || affected.length > 0;
36469
+ const visible = chatsRef.current.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK) && !operation.deleteActions.isChatPendingDelete(chat.id));
36470
+ for (const chat of visible)
36471
+ operation.deleteActions.beginRetirement(chat.id);
36472
+ try {
36473
+ const allChats = await loadOwnerChats(cloud, operationUid, operationChatPK, operationChatPrivateKey);
36474
+ assertBulkOperationCurrent(operation);
36475
+ const affected = allChats.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK));
36476
+ await purgePeerChats(affected, operation);
36477
+ assertBulkOperationCurrent(operation);
36478
+ for (const chat of visible)
36479
+ operation.deleteActions.commitRetirement(chat.id);
36480
+ await options.onDeliveryRevoked?.();
36481
+ assertBulkOperationCurrent(operation);
36482
+ return retiredPending || affected.length > 0;
36483
+ } catch (error) {
36484
+ if (isBulkOperationCurrent(operation)) {
36485
+ for (const chat of visible) {
36486
+ if (operation.deleteActions.isChatPendingDelete(chat.id)) {
36487
+ operation.deleteActions.rollbackRetirement(chat.id);
36488
+ }
36489
+ }
36490
+ }
36491
+ throw error;
36492
+ }
36475
36493
  };
36476
36494
  const retireBlockedChats = async (blockedUids) => {
36477
36495
  const operation = bulkOperation(blockedUids);
@@ -61041,7 +61059,7 @@ var package_default;
61041
61059
  var init_package2 = __esm(() => {
61042
61060
  package_default = {
61043
61061
  name: "veyl",
61044
- version: "0.71.0",
61062
+ version: "0.71.1",
61045
61063
  packageManager: "bun@1.4.0",
61046
61064
  private: true,
61047
61065
  license: "UNLICENSED",
package/dist/index.js CHANGED
@@ -36449,6 +36449,8 @@ function createChatSession({
36449
36449
  await leaveOwnedChat(chat, { optimistic: false });
36450
36450
  assertBulkOperationCurrent(operation);
36451
36451
  await cloud.user.chats.unlink(identity.uid, chat.entryId);
36452
+ assertBulkOperationCurrent(operation);
36453
+ operation.deleteActions.commitRetirement(chat.id);
36452
36454
  } else {
36453
36455
  await operation.deleteActions.deleteChat(chat, { cleanup: false });
36454
36456
  }
@@ -36463,14 +36465,30 @@ function createChatSession({
36463
36465
  const { uid: operationUid, chatPK: operationChatPK, chatPrivateKey: operationChatPrivateKey } = operation.identity;
36464
36466
  if (!operationUid || !operationChatPK || !operationChatPrivateKey)
36465
36467
  return retiredPending;
36466
- const allChats = await loadOwnerChats(cloud, operationUid, operationChatPK, operationChatPrivateKey);
36467
- assertBulkOperationCurrent(operation);
36468
- const affected = allChats.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK));
36469
- await purgePeerChats(affected, operation);
36470
- assertBulkOperationCurrent(operation);
36471
- await options.onDeliveryRevoked?.();
36472
- assertBulkOperationCurrent(operation);
36473
- return retiredPending || affected.length > 0;
36468
+ const visible = chatsRef.current.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK) && !operation.deleteActions.isChatPendingDelete(chat.id));
36469
+ for (const chat of visible)
36470
+ operation.deleteActions.beginRetirement(chat.id);
36471
+ try {
36472
+ const allChats = await loadOwnerChats(cloud, operationUid, operationChatPK, operationChatPrivateKey);
36473
+ assertBulkOperationCurrent(operation);
36474
+ const affected = allChats.filter((chat) => chat?.members?.some((member) => member.chatPK === peerChatPK));
36475
+ await purgePeerChats(affected, operation);
36476
+ assertBulkOperationCurrent(operation);
36477
+ for (const chat of visible)
36478
+ operation.deleteActions.commitRetirement(chat.id);
36479
+ await options.onDeliveryRevoked?.();
36480
+ assertBulkOperationCurrent(operation);
36481
+ return retiredPending || affected.length > 0;
36482
+ } catch (error) {
36483
+ if (isBulkOperationCurrent(operation)) {
36484
+ for (const chat of visible) {
36485
+ if (operation.deleteActions.isChatPendingDelete(chat.id)) {
36486
+ operation.deleteActions.rollbackRetirement(chat.id);
36487
+ }
36488
+ }
36489
+ }
36490
+ throw error;
36491
+ }
36474
36492
  };
36475
36493
  const retireBlockedChats = async (blockedUids) => {
36476
36494
  const operation = bulkOperation(blockedUids);
@@ -61040,7 +61058,7 @@ var package_default;
61040
61058
  var init_package2 = __esm(() => {
61041
61059
  package_default = {
61042
61060
  name: "veyl",
61043
- version: "0.71.0",
61061
+ version: "0.71.1",
61044
61062
  packageManager: "bun@1.4.0",
61045
61063
  private: true,
61046
61064
  license: "UNLICENSED",
package/package.json CHANGED
@@ -53,5 +53,5 @@
53
53
  "start": "node src/cli.js",
54
54
  "lint": "eslint src --quiet"
55
55
  },
56
- "version": "0.71.0"
56
+ "version": "0.71.1"
57
57
  }