@whanext/core 0.19.12 → 0.19.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.13
4
+
5
+ - Group edits now preserve the original message author's participant identities instead of replacing them with identities carried by the edit-addon envelope.
6
+ - Archived mutation recovery now prefers the original stored participant and `fromMe` values over fallback mutation metadata.
7
+ - Fixed external edits being incorrectly classified as owner edits in multi-account/group sessions.
8
+
3
9
  ## 0.19.12
4
10
 
5
11
  - Added end-to-end AntiEdit diagnostics for encrypted addons, protocol events, direct edit envelopes, normalization, previous-message recovery, and final `messageEdited` emission.
package/dist/index.js CHANGED
@@ -3403,13 +3403,14 @@ var ZapoProvider = class {
3403
3403
  const remoteJid = protocolKey.remoteJid ?? event.key.remoteJid;
3404
3404
  const participant = protocolKey.participant ?? event.key.participant;
3405
3405
  const participantAlt = protocolKey.participantAlt ?? event.key.participantAlt;
3406
- const target = {
3406
+ let target = {
3407
3407
  ...protocolKey,
3408
3408
  ...remoteJid !== void 0 ? { remoteJid } : {},
3409
3409
  ...participant !== void 0 ? { participant } : {},
3410
3410
  ...participantAlt !== void 0 ? { participantAlt } : {}
3411
3411
  };
3412
3412
  const stored = await this.#findStoredMessage(target);
3413
+ if (stored) target = this.#targetKeyFromStoredMessage(target, stored.key);
3413
3414
  if (!target.remoteJid && stored?.key.remoteJid) target.remoteJid = stored.key.remoteJid;
3414
3415
  if (!target.remoteJid) {
3415
3416
  if (protocol.type === proto.Message.ProtocolMessage.Type.MESSAGE_EDIT) {
@@ -3508,6 +3509,20 @@ var ZapoProvider = class {
3508
3509
  const wrapper = message.editedMessage;
3509
3510
  return wrapper?.message ?? message;
3510
3511
  }
3512
+ #targetKeyFromStoredMessage(fallback, stored) {
3513
+ const id = stored.id ?? fallback.id;
3514
+ const remoteJid = stored.remoteJid ?? fallback.remoteJid;
3515
+ const fromMe = stored.fromMe ?? fallback.fromMe;
3516
+ return {
3517
+ ...id !== void 0 ? { id } : {},
3518
+ ...remoteJid !== void 0 ? { remoteJid } : {},
3519
+ ...stored.remoteJidAlt !== void 0 ? { remoteJidAlt: stored.remoteJidAlt } : {},
3520
+ ...fromMe !== void 0 ? { fromMe } : {},
3521
+ ...stored.participant !== void 0 ? { participant: stored.participant } : {},
3522
+ ...stored.participantAlt !== void 0 ? { participantAlt: stored.participantAlt } : {},
3523
+ ...stored.senderUsername !== void 0 ? { senderUsername: stored.senderUsername } : {}
3524
+ };
3525
+ }
3511
3526
  #handleGroupEvent(event) {
3512
3527
  const groupId = event.groupJid;
3513
3528
  if (!groupId) return;
@@ -4056,10 +4071,10 @@ var ZapoProvider = class {
4056
4071
  const archivedChatId = stringValue(archived.chat_id);
4057
4072
  const remoteJid = key.remoteJid ?? archivedChatId;
4058
4073
  if (!remoteJid) return void 0;
4059
- const participant = key.participant ?? key.participantAlt ?? stringValue(archived.participant_id);
4074
+ const participant = stringValue(archived.participant_id) ?? key.participant ?? key.participantAlt;
4060
4075
  const archivedFromMe = booleanValue(archived.from_me);
4061
4076
  const timestampSeconds = numberValue(archived.timestamp_seconds);
4062
- const fromMe = key.fromMe ?? archivedFromMe;
4077
+ const fromMe = archivedFromMe ?? key.fromMe;
4063
4078
  const restored = {
4064
4079
  key: {
4065
4080
  ...key,