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
* Adjusts in proxy on fetchAgent
@ -6,6 +6,7 @@
* Log when init redis cache service
* Recovering messages lost with redis cache
* Chatwoot inbox name
* Update Baileys version
# 1.7.3 (2024-04-18 12:07)

View File

@ -46,10 +46,10 @@
"@figuro/chatwoot-sdk": "^1.1.16",
"@hapi/boom": "^10.0.1",
"@sentry/node": "^7.59.2",
"@whiskeysockets/baileys": "github:WhiskeySockets/Baileys#fix/missing-messages",
"amqplib": "^0.10.3",
"aws-sdk": "^2.1499.0",
"axios": "^1.6.5",
"baileys": "^6.7.0",
"class-validator": "^0.14.1",
"compression": "^1.7.4",
"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 EventEmitter2 from 'eventemitter2';
import { v4 } from 'uuid';
@ -15,12 +15,12 @@ import { WebsocketService } from '../integrations/websocket/services/websocket.s
import { RepositoryBroker } from '../repository/repository.manager';
import { AuthService, OldToken } from '../services/auth.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 { WAMonitoringService } from '../services/monitor.service';
import { SettingsService } from '../services/settings.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 { 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 {
constructor(

View File

@ -1,4 +1,4 @@
import { WAPresence } from '@whiskeysockets/baileys';
import { WAPresence } from 'baileys';
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 {
key: proto.IMessageKey;

View File

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

View File

@ -1,5 +1,5 @@
import { inbox } from '@figuro/chatwoot-sdk';
import { proto } from '@whiskeysockets/baileys';
import { proto } from 'baileys';
import { InstanceDto } from '../../../../api/dto/instance.dto';
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 { ICache } from '../abstract/abstract.cache';

View File

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

View File

@ -1,5 +1,6 @@
import ffmpegPath from '@ffmpeg-installer/ffmpeg';
import { Boom } from '@hapi/boom';
import axios from 'axios';
import makeWASocket, {
AnyMessageContent,
BufferedEventData,
@ -35,10 +36,9 @@ import makeWASocket, {
WAMessageUpdate,
WAPresence,
WASocket,
} from '@whiskeysockets/baileys';
import { Label } from '@whiskeysockets/baileys/lib/Types/Label';
import { LabelAssociation } from '@whiskeysockets/baileys/lib/Types/LabelAssociation';
import axios from 'axios';
} from 'baileys';
import { Label } from 'baileys/lib/Types/Label';
import { LabelAssociation } from 'baileys/lib/Types/LabelAssociation';
import { exec } from 'child_process';
import { arrayUnique, isBase64, isURL } from 'class-validator';
import EventEmitter2 from 'eventemitter2';
@ -118,9 +118,9 @@ import { RepositoryBroker } from '../../repository/repository.manager';
import { waMonitor } from '../../server.module';
import { Events, MessageSubtype, TypeMediaMessage, wa } from '../../types/wa.types';
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(
public readonly configService: ConfigService,
public readonly eventEmitter: EventEmitter2,

View File

@ -26,9 +26,9 @@ import { ContactRaw, MessageRaw, MessageUpdateRaw, SettingsRaw } from '../../mod
import { RepositoryBroker } from '../../repository/repository.manager';
import { Events, wa } from '../../types/wa.types';
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(
public readonly configService: ConfigService,
public readonly eventEmitter: EventEmitter2,

View File

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

View File

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

View File

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

View File

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

View File

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