@whanext/core 0.19.20 → 0.19.22
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 +13 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +22 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.19.22
|
|
4
|
+
### Fixed
|
|
5
|
+
- Corrige falsos `duplicate` em mensagens de grupo quando o Zapo emite primeiro um shell interno de Sender Key/protocolo sem conteúdo e depois a mensagem real reutilizando o mesmo stanza ID.
|
|
6
|
+
- Shells vazios `unknown` não são mais publicados nem consomem a chave de deduplicação; a mensagem real de texto/mídia continua chegando normalmente ao dispatcher.
|
|
7
|
+
|
|
8
|
+
## 0.19.21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `MessageService.edit()` accepts an optional protocol-level `id` override for the outgoing edit envelope.
|
|
12
|
+
|
|
13
|
+
### Zapo
|
|
14
|
+
- Forwards the optional edit `id` to `WaSendMessageOptions.id`, enabling specialized moderation workflows without exposing the provider client.
|
|
15
|
+
|
|
3
16
|
## 0.19.20
|
|
4
17
|
|
|
5
18
|
### Ingress diagnostics
|
package/dist/index.d.ts
CHANGED
|
@@ -163,6 +163,13 @@ type MentionTarget = string | User;
|
|
|
163
163
|
interface RepostMessageOptions {
|
|
164
164
|
mentions?: readonly MentionTarget[];
|
|
165
165
|
}
|
|
166
|
+
interface EditMessageOptions {
|
|
167
|
+
/**
|
|
168
|
+
* Overrides the stanza id used by the outgoing edit envelope.
|
|
169
|
+
* Advanced/protocol-level option; omitted for normal edits.
|
|
170
|
+
*/
|
|
171
|
+
id?: string;
|
|
172
|
+
}
|
|
166
173
|
interface TextContent {
|
|
167
174
|
text: string;
|
|
168
175
|
mentions?: MentionTarget[];
|
|
@@ -480,7 +487,7 @@ interface WhatsAppProvider {
|
|
|
480
487
|
repostMessage(source: MessageKey, chatId: string, options?: RepostMessageOptions): Promise<SentMessage>;
|
|
481
488
|
reactToMessage(key: MessageKey, emoji?: string): Promise<SentMessage>;
|
|
482
489
|
downloadMedia(key: MessageKey): Promise<DownloadedMedia>;
|
|
483
|
-
editMessage(key: MessageKey, content: string): Promise<SentMessage>;
|
|
490
|
+
editMessage(key: MessageKey, content: string, options?: EditMessageOptions): Promise<SentMessage>;
|
|
484
491
|
deleteMessage(key: MessageKey): Promise<void>;
|
|
485
492
|
getGroup(groupId: string): Promise<GroupSnapshot>;
|
|
486
493
|
setGroupAccess(groupId: string, access: GroupAccess): Promise<void>;
|
|
@@ -686,7 +693,7 @@ declare class MessageService {
|
|
|
686
693
|
* media and structured WhatsApp messages as well as text.
|
|
687
694
|
*/
|
|
688
695
|
repost(source: Message | MessageKey, chatId: string, options?: RepostMessageOptions): Promise<SentMessage>;
|
|
689
|
-
edit(message: Message | SentMessage | MessageKey, text: string): Promise<SentMessage>;
|
|
696
|
+
edit(message: Message | SentMessage | MessageKey, text: string, options?: EditMessageOptions): Promise<SentMessage>;
|
|
690
697
|
delete(message: Message | SentMessage | MessageKey): Promise<void>;
|
|
691
698
|
react(message: Message | SentMessage | MessageKey, emoji: string): Promise<SentMessage>;
|
|
692
699
|
unreact(message: Message | SentMessage | MessageKey): Promise<SentMessage>;
|
|
@@ -1207,4 +1214,4 @@ declare class SqliteMuteStore implements MuteStore {
|
|
|
1207
1214
|
close(): void;
|
|
1208
1215
|
}
|
|
1209
1216
|
|
|
1210
|
-
export { AccountService, type AddMuteOptions, type AddMuteResult, type AppEvents, type AppHealth, type AppHealthStatus, ArgsParser, type AudioContent, type BooleanOption, Browser, type ButtonsContent, type CacheOptions, type CacheStore, type CallEvent, type CallStatus, type ChangeResult, type CommandAccountContext, type CommandCatalogOptions, type CommandCatalogView, type CommandChatContext, type CommandConcurrency, type CommandConcurrencyContext, type CommandConcurrencyEvent, type CommandConcurrencyHealth, type CommandContext, type CommandCooldown, type CommandDefinition, type CommandErrorHandler, type CommandGroupContext, type CommandGroupDefinition, type CommandGuard, type CommandHelpOptions, type CommandHooks, type CommandLocalization, type CommandMetadata, type CommandMiddleware, type CommandOptionDefinition, type CommandOptionSchema, type CommandOptionValue, type CommandOptionValues, type CommandQueueFullEvent, type CommandQueueTimeoutEvent, type CommandRegistrar, CommandRouter, type CommandRouterEvents, type CommandRuntimeServices, type CommandScope, type ConcurrencyStrategy, type ConnectionRecoveredEvent, type ConnectionState, type ConnectionUpdate, type CopyCodeButton, type CreateMultiOptions, type CreateOptions, type CryptoAccelerationBackend, type CryptoDegradationKind, type CryptoDegradedEvent, DeferredReply, type DownloadedMedia, type DurationOption, type EnumOption, type ExecutableCommandDefinition, type GroupAccess, type GroupAddressingMode, type GroupMetadataRecoveredEvent, type GroupParticipant, type GroupParticipantAction, type GroupParticipantsChanged, type GroupRole, type GroupSnapshot, type GuardResult, type HealthChangedEvent, type ImageContent, type InteractiveResponse, type InteractiveResponseKind, type InviteResult, type LinkButton, type ListContent, type ListRow, type ListSection, type LoadCommandsOptions, type LoadCommandsResult, type LoadedCommand, type LogContext, type LogEntry, type LogFormat, type LogLevel, type LogWriter, Logger, type LoggerConfig, type LoggerOptions, type LoginOptions, type MediaKind, type MediaSource, type MemberActionState, MemoryCache, type MemoryCacheStats, type MentionTarget, type Message, type MessageButton, type MessageContent, type MessageContentKind, type MessageDecodeFailureEvent, type MessageDeleted, type MessageDiscardReason, type MessageDiscardedEvent, type MessageEdited, type MessageIngressStage, type MessageIngressStalledEvent, type MessageKey, type MessageMedia, type MessagePayloadKind, type MessageProtocolKind, type MessageRecoveredEvent, type MessageRecoveryFailedEvent, type MessageUnavailableEvent, type MultiAccountOptions, type MultiAppEvent, type MultiAppHealth, MultiCommandRouter, type MultiLoadCommandsResult, type MultiLoginOptions, type MuteChangeResult, type MuteEnforcement, type MuteOptions, type MuteRecord, MuteService, type MuteStore, type NumberOption, ParsedCommandOptions, type ParticipantUpdateResult, type PollContent, type PresenceState, type ProviderConnectionHealth, type ProviderCryptoHealth, type ProviderDiagnosticsOptions, type ProviderGroupHealth, type ProviderHealth, type ProviderMessagingHealth, type ProviderStabilityEvent, type ProviderTimeoutHealth, type ProviderTimeoutOptions, type QuickReplyButton, type QuotedMessage, type ReconnectOptions, type RegisteredCommand, type RemoveMuteResult, type ReplyOptions, type RepostMessageOptions, type RouterOptions, type SentMessage, SqliteMuteStore, type StabilityHealthStatus, type StickerContent, type StoredMute, type StringOption, type TextContent, type TransportDecodeFailureEvent, User, type UserData, type UserOption, type VideoContent, WhaNextApp, WhaNextError, type WhaNextErrorCode, WhaNextMultiApp, type WhatsAppProvider, create, createMulti, defineCommand, defineCommandGroup, defineCommands, defineSubcommand, guards, isCommandGroup, loadCommands, option, toWhaNextError };
|
|
1217
|
+
export { AccountService, type AddMuteOptions, type AddMuteResult, type AppEvents, type AppHealth, type AppHealthStatus, ArgsParser, type AudioContent, type BooleanOption, Browser, type ButtonsContent, type CacheOptions, type CacheStore, type CallEvent, type CallStatus, type ChangeResult, type CommandAccountContext, type CommandCatalogOptions, type CommandCatalogView, type CommandChatContext, type CommandConcurrency, type CommandConcurrencyContext, type CommandConcurrencyEvent, type CommandConcurrencyHealth, type CommandContext, type CommandCooldown, type CommandDefinition, type CommandErrorHandler, type CommandGroupContext, type CommandGroupDefinition, type CommandGuard, type CommandHelpOptions, type CommandHooks, type CommandLocalization, type CommandMetadata, type CommandMiddleware, type CommandOptionDefinition, type CommandOptionSchema, type CommandOptionValue, type CommandOptionValues, type CommandQueueFullEvent, type CommandQueueTimeoutEvent, type CommandRegistrar, CommandRouter, type CommandRouterEvents, type CommandRuntimeServices, type CommandScope, type ConcurrencyStrategy, type ConnectionRecoveredEvent, type ConnectionState, type ConnectionUpdate, type CopyCodeButton, type CreateMultiOptions, type CreateOptions, type CryptoAccelerationBackend, type CryptoDegradationKind, type CryptoDegradedEvent, DeferredReply, type DownloadedMedia, type DurationOption, type EditMessageOptions, type EnumOption, type ExecutableCommandDefinition, type GroupAccess, type GroupAddressingMode, type GroupMetadataRecoveredEvent, type GroupParticipant, type GroupParticipantAction, type GroupParticipantsChanged, type GroupRole, type GroupSnapshot, type GuardResult, type HealthChangedEvent, type ImageContent, type InteractiveResponse, type InteractiveResponseKind, type InviteResult, type LinkButton, type ListContent, type ListRow, type ListSection, type LoadCommandsOptions, type LoadCommandsResult, type LoadedCommand, type LogContext, type LogEntry, type LogFormat, type LogLevel, type LogWriter, Logger, type LoggerConfig, type LoggerOptions, type LoginOptions, type MediaKind, type MediaSource, type MemberActionState, MemoryCache, type MemoryCacheStats, type MentionTarget, type Message, type MessageButton, type MessageContent, type MessageContentKind, type MessageDecodeFailureEvent, type MessageDeleted, type MessageDiscardReason, type MessageDiscardedEvent, type MessageEdited, type MessageIngressStage, type MessageIngressStalledEvent, type MessageKey, type MessageMedia, type MessagePayloadKind, type MessageProtocolKind, type MessageRecoveredEvent, type MessageRecoveryFailedEvent, type MessageUnavailableEvent, type MultiAccountOptions, type MultiAppEvent, type MultiAppHealth, MultiCommandRouter, type MultiLoadCommandsResult, type MultiLoginOptions, type MuteChangeResult, type MuteEnforcement, type MuteOptions, type MuteRecord, MuteService, type MuteStore, type NumberOption, ParsedCommandOptions, type ParticipantUpdateResult, type PollContent, type PresenceState, type ProviderConnectionHealth, type ProviderCryptoHealth, type ProviderDiagnosticsOptions, type ProviderGroupHealth, type ProviderHealth, type ProviderMessagingHealth, type ProviderStabilityEvent, type ProviderTimeoutHealth, type ProviderTimeoutOptions, type QuickReplyButton, type QuotedMessage, type ReconnectOptions, type RegisteredCommand, type RemoveMuteResult, type ReplyOptions, type RepostMessageOptions, type RouterOptions, type SentMessage, SqliteMuteStore, type StabilityHealthStatus, type StickerContent, type StoredMute, type StringOption, type TextContent, type TransportDecodeFailureEvent, User, type UserData, type UserOption, type VideoContent, WhaNextApp, WhaNextError, type WhaNextErrorCode, WhaNextMultiApp, type WhatsAppProvider, create, createMulti, defineCommand, defineCommandGroup, defineCommands, defineSubcommand, guards, isCommandGroup, loadCommands, option, toWhaNextError };
|
package/dist/index.js
CHANGED
|
@@ -2239,9 +2239,9 @@ var MessageService = class {
|
|
|
2239
2239
|
const key = "keys" in source ? source.keys : source;
|
|
2240
2240
|
return this.#provider.repostMessage(key, chatId, options);
|
|
2241
2241
|
}
|
|
2242
|
-
edit(message, text) {
|
|
2242
|
+
edit(message, text, options = {}) {
|
|
2243
2243
|
const key = "keys" in message ? message.keys : message;
|
|
2244
|
-
return this.#provider.editMessage(key, text);
|
|
2244
|
+
return this.#provider.editMessage(key, text, options);
|
|
2245
2245
|
}
|
|
2246
2246
|
delete(message) {
|
|
2247
2247
|
const key = "keys" in message ? message.keys : message;
|
|
@@ -3491,12 +3491,15 @@ var ZapoProvider = class {
|
|
|
3491
3491
|
);
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
async editMessage(key, content) {
|
|
3494
|
+
async editMessage(key, content, options = {}) {
|
|
3495
3495
|
return this.#trackOutgoing(async () => {
|
|
3496
3496
|
const result = await this.#requireClient().message.send(
|
|
3497
3497
|
key.chatId,
|
|
3498
3498
|
content,
|
|
3499
|
-
{
|
|
3499
|
+
{
|
|
3500
|
+
editKey: this.#toZapoKey(key),
|
|
3501
|
+
...options.id ? { id: options.id } : {}
|
|
3502
|
+
}
|
|
3500
3503
|
);
|
|
3501
3504
|
return this.#sent(result, key.chatId);
|
|
3502
3505
|
});
|
|
@@ -3922,15 +3925,6 @@ var ZapoProvider = class {
|
|
|
3922
3925
|
});
|
|
3923
3926
|
return;
|
|
3924
3927
|
}
|
|
3925
|
-
if (stored.key.id && this.#deliveredMessageStore.has(deliveryKey)) {
|
|
3926
|
-
this.#duplicateMessages += 1;
|
|
3927
|
-
this.#emitMessageDiscarded("duplicate", stored.key);
|
|
3928
|
-
this.#logger.debug("Ignored duplicate Zapo message event.", {
|
|
3929
|
-
messageId: stored.key.id,
|
|
3930
|
-
chatId: stored.key.remoteJid ?? void 0
|
|
3931
|
-
});
|
|
3932
|
-
return;
|
|
3933
|
-
}
|
|
3934
3928
|
const message = normalizeZapoMessage(event);
|
|
3935
3929
|
if (!message) {
|
|
3936
3930
|
this.#normalizationFailures += 1;
|
|
@@ -3941,6 +3935,18 @@ var ZapoProvider = class {
|
|
|
3941
3935
|
});
|
|
3942
3936
|
return;
|
|
3943
3937
|
}
|
|
3938
|
+
if (this.#isEmptyMessageShell(message)) {
|
|
3939
|
+
return;
|
|
3940
|
+
}
|
|
3941
|
+
if (stored.key.id && this.#deliveredMessageStore.has(deliveryKey)) {
|
|
3942
|
+
this.#duplicateMessages += 1;
|
|
3943
|
+
this.#emitMessageDiscarded("duplicate", stored.key);
|
|
3944
|
+
this.#logger.debug("Ignored duplicate Zapo message event.", {
|
|
3945
|
+
messageId: stored.key.id,
|
|
3946
|
+
chatId: stored.key.remoteJid ?? void 0
|
|
3947
|
+
});
|
|
3948
|
+
return;
|
|
3949
|
+
}
|
|
3944
3950
|
if (stored.key.id) this.#rememberDeliveredMessage(deliveryKey);
|
|
3945
3951
|
this.#receivedMessages += 1;
|
|
3946
3952
|
this.#lastIncomingAt = /* @__PURE__ */ new Date();
|
|
@@ -5063,6 +5069,9 @@ var ZapoProvider = class {
|
|
|
5063
5069
|
return void 0;
|
|
5064
5070
|
}
|
|
5065
5071
|
}
|
|
5072
|
+
#isEmptyMessageShell(message) {
|
|
5073
|
+
return message.contentKind === "unknown" && message.text === void 0 && message.caption === void 0 && message.media === void 0 && message.interactive === void 0 && (message.protocolKinds?.length ?? 0) === 0 && (message.payloadKinds?.length ?? 0) === 0;
|
|
5074
|
+
}
|
|
5066
5075
|
#messageStoreKey(key) {
|
|
5067
5076
|
return `${key.remoteJid ?? ""}:${key.id ?? ""}:${key.participant ?? key.participantAlt ?? ""}`;
|
|
5068
5077
|
}
|