mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
chore: Bump version to 1.8.4 and update logging in services
- Updated package version from 1.8.2 to 1.8.4 in package.json. - Refactored instance.controller.ts to allow logout for both 'connecting' and 'open' states, improving instance management. - Commented out unnecessary logging in channel.service.ts to enhance code clarity. - Enhanced logging in whatsapp.baileys.service.ts to include instance details in CONNECTION_UPDATE events, improving webhook data sent during connection state changes. These changes improve versioning, code clarity, and logging functionality across the application.
This commit is contained in:
parent
6ddad8e85a
commit
03ee40388c
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "evolution-api",
|
"name": "evolution-api",
|
||||||
"version": "1.8.2",
|
"version": "1.8.4",
|
||||||
"description": "Rest api for communication with WhatsApp",
|
"description": "Rest api for communication with WhatsApp",
|
||||||
"main": "./dist/src/main.js",
|
"main": "./dist/src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -737,16 +737,11 @@ export class InstanceController {
|
|||||||
this.logger.verbose('requested deleteInstance from ' + instanceName + ' instance');
|
this.logger.verbose('requested deleteInstance from ' + instanceName + ' instance');
|
||||||
const { instance } = await this.connectionState({ instanceName });
|
const { instance } = await this.connectionState({ instanceName });
|
||||||
|
|
||||||
if (instance.state === 'open') {
|
|
||||||
throw new BadRequestException('The "' + instanceName + '" instance needs to be disconnected');
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
this.waMonitor.waInstances[instanceName]?.removeRabbitmqQueues();
|
this.waMonitor.waInstances[instanceName]?.removeRabbitmqQueues();
|
||||||
this.waMonitor.waInstances[instanceName]?.clearCacheChatwoot();
|
this.waMonitor.waInstances[instanceName]?.clearCacheChatwoot();
|
||||||
|
|
||||||
if (instance.state === 'connecting') {
|
if (instance.state === 'connecting' || instance.state === 'open') {
|
||||||
this.logger.verbose('logging out instance: ' + instanceName);
|
|
||||||
|
|
||||||
await this.logout({ instanceName });
|
await this.logout({ instanceName });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = instanceApikey;
|
logData['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -834,7 +834,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = instanceApikey;
|
logData['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -907,7 +907,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = instanceApikey;
|
logData['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -951,7 +951,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = instanceApikey;
|
logData['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = instanceApikey;
|
logData['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1017,7 +1017,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = instanceApikey;
|
logData['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1088,7 +1088,7 @@ export class ChannelStartupService {
|
|||||||
logData['apikey'] = globalApiKey;
|
logData['apikey'] = globalApiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log(logData);
|
// this.logger.log(logData);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -379,12 +379,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
state: connection,
|
state: connection,
|
||||||
statusReason: (lastDisconnect?.error as Boom)?.output?.statusCode ?? 200,
|
statusReason: (lastDisconnect?.error as Boom)?.output?.statusCode ?? 200,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.logger.verbose('Sending data to webhook in event CONNECTION_UPDATE');
|
|
||||||
this.sendDataWebhook(Events.CONNECTION_UPDATE, {
|
|
||||||
instance: this.instance.name,
|
|
||||||
...this.stateConnection,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection === 'close') {
|
if (connection === 'close') {
|
||||||
@ -417,6 +411,15 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
this.client?.ws?.close();
|
this.client?.ws?.close();
|
||||||
this.client.end(new Error('Close connection'));
|
this.client.end(new Error('Close connection'));
|
||||||
this.logger.verbose('Connection closed');
|
this.logger.verbose('Connection closed');
|
||||||
|
|
||||||
|
this.logger.verbose('Sending data to webhook in event CONNECTION_UPDATE');
|
||||||
|
this.sendDataWebhook(Events.CONNECTION_UPDATE, {
|
||||||
|
instance: this.instance.name,
|
||||||
|
wuid: this.instance.wuid,
|
||||||
|
profileName: await this.getProfileName(),
|
||||||
|
profilePictureUrl: this.instance.profilePictureUrl,
|
||||||
|
...this.stateConnection,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,13 +449,34 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
{
|
{
|
||||||
instance: this.instance.name,
|
instance: this.instance.name,
|
||||||
status: 'open',
|
status: 'open',
|
||||||
|
wuid: this.instance.wuid,
|
||||||
|
profileName: await this.getProfileName(),
|
||||||
|
profilePictureUrl: this.instance.profilePictureUrl,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.logger.verbose('Sending data to webhook in event CONNECTION_UPDATE');
|
||||||
|
this.sendDataWebhook(Events.CONNECTION_UPDATE, {
|
||||||
|
instance: this.instance.name,
|
||||||
|
wuid: this.instance.wuid,
|
||||||
|
profileName: await this.getProfileName(),
|
||||||
|
profilePictureUrl: this.instance.profilePictureUrl,
|
||||||
|
...this.stateConnection,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection === 'connecting') {
|
if (connection === 'connecting') {
|
||||||
if (this.mobile) this.sendMobileCode();
|
if (this.mobile) this.sendMobileCode();
|
||||||
|
|
||||||
|
this.logger.verbose('Sending data to webhook in event CONNECTION_UPDATE');
|
||||||
|
this.sendDataWebhook(Events.CONNECTION_UPDATE, {
|
||||||
|
instance: this.instance.name,
|
||||||
|
wuid: this.instance.wuid,
|
||||||
|
profileName: await this.getProfileName(),
|
||||||
|
profilePictureUrl: this.instance.profilePictureUrl,
|
||||||
|
...this.stateConnection,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user