fix: new version baileys

This commit is contained in:
Davidson Gomes 2024-04-28 09:41:22 -03:00
parent 00e7fcc46b
commit 14c210c771
17 changed files with 39 additions and 51 deletions

View File

@ -1,4 +1,4 @@
# 1.8.0 (develop) # 1.7.4 (develop)
### Fixed ### Fixed
* Adjusts in proxy on fetchAgent * Adjusts in proxy on fetchAgent
@ -6,6 +6,7 @@
* Log when init redis cache service * Log when init redis cache service
* Recovering messages lost with redis cache * Recovering messages lost with redis cache
* Chatwoot inbox name * Chatwoot inbox name
* Update Baileys version
# 1.7.3 (2024-04-18 12:07) # 1.7.3 (2024-04-18 12:07)

View File

@ -46,10 +46,10 @@
"@figuro/chatwoot-sdk": "^1.1.16", "@figuro/chatwoot-sdk": "^1.1.16",
"@hapi/boom": "^10.0.1", "@hapi/boom": "^10.0.1",
"@sentry/node": "^7.59.2", "@sentry/node": "^7.59.2",
"@whiskeysockets/baileys": "github:WhiskeySockets/Baileys#fix/missing-messages",
"amqplib": "^0.10.3", "amqplib": "^0.10.3",
"aws-sdk": "^2.1499.0", "aws-sdk": "^2.1499.0",
"axios": "^1.6.5", "axios": "^1.6.5",
"baileys": "^6.7.0",
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
"compression": "^1.7.4", "compression": "^1.7.4",
"cors": "^2.8.5", "cors": "^2.8.5",

View File

@ -1,4 +1,4 @@
import { delay } from '@whiskeysockets/baileys'; import { delay } from 'baileys';
import { isURL } from 'class-validator'; import { isURL } from 'class-validator';
import EventEmitter2 from 'eventemitter2'; import EventEmitter2 from 'eventemitter2';
import { v4 } from 'uuid'; import { v4 } from 'uuid';
@ -15,12 +15,12 @@ import { WebsocketService } from '../integrations/websocket/services/websocket.s
import { RepositoryBroker } from '../repository/repository.manager'; import { RepositoryBroker } from '../repository/repository.manager';
import { AuthService, OldToken } from '../services/auth.service'; import { AuthService, OldToken } from '../services/auth.service';
import { CacheService } from '../services/cache.service'; import { CacheService } from '../services/cache.service';
import { BaileysStartupService } from '../services/channels/whatsapp.baileys.service';
import { BusinessStartupService } from '../services/channels/whatsapp.business.service';
import { IntegrationService } from '../services/integration.service'; import { IntegrationService } from '../services/integration.service';
import { WAMonitoringService } from '../services/monitor.service'; import { WAMonitoringService } from '../services/monitor.service';
import { SettingsService } from '../services/settings.service'; import { SettingsService } from '../services/settings.service';
import { WebhookService } from '../services/webhook.service'; import { WebhookService } from '../services/webhook.service';
import { BaileysStartupService } from '../services/whatsapp/whatsapp.baileys.service';
import { BusinessStartupService } from '../services/whatsapp/whatsapp.business.service';
import { Events, Integration, wa } from '../types/wa.types'; import { Events, Integration, wa } from '../types/wa.types';
import { ProxyController } from './proxy.controller'; import { ProxyController } from './proxy.controller';

View File

@ -1,4 +1,4 @@
import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '@whiskeysockets/baileys'; import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from 'baileys';
export class OnWhatsAppDto { export class OnWhatsAppDto {
constructor( constructor(

View File

@ -1,4 +1,4 @@
import { WAPresence } from '@whiskeysockets/baileys'; import { WAPresence } from 'baileys';
import { ProxyDto } from './proxy.dto'; import { ProxyDto } from './proxy.dto';

View File

@ -1,4 +1,4 @@
import { proto, WAPresence } from '@whiskeysockets/baileys'; import { proto, WAPresence } from 'baileys';
export class Quoted { export class Quoted {
key: proto.IMessageKey; key: proto.IMessageKey;

View File

@ -8,8 +8,8 @@ import ChatwootClient, {
inbox, inbox,
} from '@figuro/chatwoot-sdk'; } from '@figuro/chatwoot-sdk';
import { request as chatwootRequest } from '@figuro/chatwoot-sdk/dist/core/request'; import { request as chatwootRequest } from '@figuro/chatwoot-sdk/dist/core/request';
import { proto } from '@whiskeysockets/baileys';
import axios from 'axios'; import axios from 'axios';
import { proto } from 'baileys';
import FormData from 'form-data'; import FormData from 'form-data';
import { createReadStream, unlinkSync, writeFileSync } from 'fs'; import { createReadStream, unlinkSync, writeFileSync } from 'fs';
import Jimp from 'jimp'; import Jimp from 'jimp';

View File

@ -1,5 +1,5 @@
import { inbox } from '@figuro/chatwoot-sdk'; import { inbox } from '@figuro/chatwoot-sdk';
import { proto } from '@whiskeysockets/baileys'; import { proto } from 'baileys';
import { InstanceDto } from '../../../../api/dto/instance.dto'; import { InstanceDto } from '../../../../api/dto/instance.dto';
import { ChatwootRaw, ContactRaw, MessageRaw } from '../../../../api/models'; import { ChatwootRaw, ContactRaw, MessageRaw } from '../../../../api/models';

View File

@ -1,4 +1,4 @@
import { BufferJSON } from '@whiskeysockets/baileys'; import { BufferJSON } from 'baileys';
import { Logger } from '../../config/logger.config'; import { Logger } from '../../config/logger.config';
import { ICache } from '../abstract/abstract.cache'; import { ICache } from '../abstract/abstract.cache';

View File

@ -1,5 +1,5 @@
import { WASocket } from '@whiskeysockets/baileys';
import axios from 'axios'; import axios from 'axios';
import { WASocket } from 'baileys';
import { execSync } from 'child_process'; import { execSync } from 'child_process';
import { isURL } from 'class-validator'; import { isURL } from 'class-validator';
import EventEmitter2 from 'eventemitter2'; import EventEmitter2 from 'eventemitter2';
@ -38,17 +38,17 @@ import { waMonitor } from '../server.module';
import { Events, wa } from '../types/wa.types'; import { Events, wa } from '../types/wa.types';
import { CacheService } from './cache.service'; import { CacheService } from './cache.service';
export class WAStartupService { export class ChannelStartupService {
constructor( constructor(
public readonly configService: ConfigService, public readonly configService: ConfigService,
public readonly eventEmitter: EventEmitter2, public readonly eventEmitter: EventEmitter2,
public readonly repository: RepositoryBroker, public readonly repository: RepositoryBroker,
public readonly chatwootCache: CacheService, public readonly chatwootCache: CacheService,
) { ) {
this.logger.verbose('WAStartupService initialized'); this.logger.verbose('ChannelStartupService initialized');
} }
public readonly logger = new Logger(WAStartupService.name); public readonly logger = new Logger(ChannelStartupService.name);
public client: WASocket; public client: WASocket;
public readonly instance: wa.Instance = {}; public readonly instance: wa.Instance = {};
@ -742,7 +742,7 @@ export class WAStartupService {
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) { if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = { const logData = {
local: WAStartupService.name + '.sendData-RabbitMQ', local: ChannelStartupService.name + '.sendData-RabbitMQ',
event, event,
instance: this.instance.name, instance: this.instance.name,
data, data,
@ -798,7 +798,7 @@ export class WAStartupService {
sqs.sendMessage(params, (err, data) => { sqs.sendMessage(params, (err, data) => {
if (err) { if (err) {
this.logger.error({ this.logger.error({
local: WAStartupService.name + '.sendData-SQS', local: ChannelStartupService.name + '.sendData-SQS',
message: err?.message, message: err?.message,
hostName: err?.hostname, hostName: err?.hostname,
code: err?.code, code: err?.code,
@ -810,7 +810,7 @@ export class WAStartupService {
} else { } else {
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) { if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = { const logData = {
local: WAStartupService.name + '.sendData-SQS', local: ChannelStartupService.name + '.sendData-SQS',
event, event,
instance: this.instance.name, instance: this.instance.name,
data, data,
@ -854,7 +854,7 @@ export class WAStartupService {
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) { if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = { const logData = {
local: WAStartupService.name + '.sendData-WebsocketGlobal', local: ChannelStartupService.name + '.sendData-WebsocketGlobal',
event, event,
instance: this.instance.name, instance: this.instance.name,
data, data,
@ -884,7 +884,7 @@ export class WAStartupService {
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) { if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = { const logData = {
local: WAStartupService.name + '.sendData-Websocket', local: ChannelStartupService.name + '.sendData-Websocket',
event, event,
instance: this.instance.name, instance: this.instance.name,
data, data,
@ -918,7 +918,7 @@ export class WAStartupService {
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) { if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = { const logData = {
local: WAStartupService.name + '.sendDataWebhook-local', local: ChannelStartupService.name + '.sendDataWebhook-local',
url: baseURL, url: baseURL,
event, event,
instance: this.instance.name, instance: this.instance.name,
@ -958,7 +958,7 @@ export class WAStartupService {
} }
} catch (error) { } catch (error) {
this.logger.error({ this.logger.error({
local: WAStartupService.name + '.sendDataWebhook-local', local: ChannelStartupService.name + '.sendDataWebhook-local',
message: error?.message, message: error?.message,
hostName: error?.hostname, hostName: error?.hostname,
syscall: error?.syscall, syscall: error?.syscall,
@ -990,7 +990,7 @@ export class WAStartupService {
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) { if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = { const logData = {
local: WAStartupService.name + '.sendDataWebhook-global', local: ChannelStartupService.name + '.sendDataWebhook-global',
url: globalURL, url: globalURL,
event, event,
instance: this.instance.name, instance: this.instance.name,
@ -1029,7 +1029,7 @@ export class WAStartupService {
} }
} catch (error) { } catch (error) {
this.logger.error({ this.logger.error({
local: WAStartupService.name + '.sendDataWebhook-global', local: ChannelStartupService.name + '.sendDataWebhook-global',
message: error?.message, message: error?.message,
hostName: error?.hostname, hostName: error?.hostname,
syscall: error?.syscall, syscall: error?.syscall,

View File

@ -1,5 +1,6 @@
import ffmpegPath from '@ffmpeg-installer/ffmpeg'; import ffmpegPath from '@ffmpeg-installer/ffmpeg';
import { Boom } from '@hapi/boom'; import { Boom } from '@hapi/boom';
import axios from 'axios';
import makeWASocket, { import makeWASocket, {
AnyMessageContent, AnyMessageContent,
BufferedEventData, BufferedEventData,
@ -35,10 +36,9 @@ import makeWASocket, {
WAMessageUpdate, WAMessageUpdate,
WAPresence, WAPresence,
WASocket, WASocket,
} from '@whiskeysockets/baileys'; } from 'baileys';
import { Label } from '@whiskeysockets/baileys/lib/Types/Label'; import { Label } from 'baileys/lib/Types/Label';
import { LabelAssociation } from '@whiskeysockets/baileys/lib/Types/LabelAssociation'; import { LabelAssociation } from 'baileys/lib/Types/LabelAssociation';
import axios from 'axios';
import { exec } from 'child_process'; import { exec } from 'child_process';
import { arrayUnique, isBase64, isURL } from 'class-validator'; import { arrayUnique, isBase64, isURL } from 'class-validator';
import EventEmitter2 from 'eventemitter2'; import EventEmitter2 from 'eventemitter2';
@ -118,9 +118,9 @@ import { RepositoryBroker } from '../../repository/repository.manager';
import { waMonitor } from '../../server.module'; import { waMonitor } from '../../server.module';
import { Events, MessageSubtype, TypeMediaMessage, wa } from '../../types/wa.types'; import { Events, MessageSubtype, TypeMediaMessage, wa } from '../../types/wa.types';
import { CacheService } from './../cache.service'; import { CacheService } from './../cache.service';
import { WAStartupService } from './../whatsapp.service'; import { ChannelStartupService } from './../channel.service';
export class BaileysStartupService extends WAStartupService { export class BaileysStartupService extends ChannelStartupService {
constructor( constructor(
public readonly configService: ConfigService, public readonly configService: ConfigService,
public readonly eventEmitter: EventEmitter2, public readonly eventEmitter: EventEmitter2,

View File

@ -26,9 +26,9 @@ import { ContactRaw, MessageRaw, MessageUpdateRaw, SettingsRaw } from '../../mod
import { RepositoryBroker } from '../../repository/repository.manager'; import { RepositoryBroker } from '../../repository/repository.manager';
import { Events, wa } from '../../types/wa.types'; import { Events, wa } from '../../types/wa.types';
import { CacheService } from './../cache.service'; import { CacheService } from './../cache.service';
import { WAStartupService } from './../whatsapp.service'; import { ChannelStartupService } from './../channel.service';
export class BusinessStartupService extends WAStartupService { export class BusinessStartupService extends ChannelStartupService {
constructor( constructor(
public readonly configService: ConfigService, public readonly configService: ConfigService,
public readonly eventEmitter: EventEmitter2, public readonly eventEmitter: EventEmitter2,

View File

@ -25,8 +25,8 @@ import {
import { RepositoryBroker } from '../repository/repository.manager'; import { RepositoryBroker } from '../repository/repository.manager';
import { Integration } from '../types/wa.types'; import { Integration } from '../types/wa.types';
import { CacheService } from './cache.service'; import { CacheService } from './cache.service';
import { BaileysStartupService } from './whatsapp/whatsapp.baileys.service'; import { BaileysStartupService } from './channels/whatsapp.baileys.service';
import { BusinessStartupService } from './whatsapp/whatsapp.business.service'; import { BusinessStartupService } from './channels/whatsapp.business.service';
export class WAMonitoringService { export class WAMonitoringService {
constructor( constructor(

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-namespace */ /* eslint-disable @typescript-eslint/no-namespace */
import { AuthenticationState, WAConnectionState } from '@whiskeysockets/baileys'; import { AuthenticationState, WAConnectionState } from 'baileys';
export enum Events { export enum Events {
APPLICATION_STARTUP = 'application.startup', APPLICATION_STARTUP = 'application.startup',

View File

@ -1,4 +1,4 @@
import { BufferJSON } from '@whiskeysockets/baileys'; import { BufferJSON } from 'baileys';
import { RedisClientType } from 'redis'; import { RedisClientType } from 'redis';
import { ICache } from '../api/abstract/abstract.cache'; import { ICache } from '../api/abstract/abstract.cache';

View File

@ -1,11 +1,4 @@
import { import { AuthenticationCreds, AuthenticationState, BufferJSON, initAuthCreds, proto, SignalDataTypeMap } from 'baileys';
AuthenticationCreds,
AuthenticationState,
BufferJSON,
initAuthCreds,
proto,
SignalDataTypeMap,
} from '@whiskeysockets/baileys';
import { configService, Database } from '../config/env.config'; import { configService, Database } from '../config/env.config';
import { Logger } from '../config/logger.config'; import { Logger } from '../config/logger.config';

View File

@ -1,10 +1,4 @@
import { import { AuthenticationCreds, AuthenticationState, initAuthCreds, proto, SignalDataTypeMap } from 'baileys';
AuthenticationCreds,
AuthenticationState,
initAuthCreds,
proto,
SignalDataTypeMap,
} from '@whiskeysockets/baileys';
import { CacheService } from '../api/services/cache.service'; import { CacheService } from '../api/services/cache.service';
import { Logger } from '../config/logger.config'; import { Logger } from '../config/logger.config';