mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
fix: reorganization of files and folders
This commit is contained in:
parent
794213b5c6
commit
8ece6fb998
@ -13,6 +13,7 @@
|
|||||||
* Fix conversation read on chatwoot version 3.7
|
* Fix conversation read on chatwoot version 3.7
|
||||||
* Fix when receiving/sending messages from whatsapp desktop with ephemeral messages enabled
|
* Fix when receiving/sending messages from whatsapp desktop with ephemeral messages enabled
|
||||||
* Changed returned sessions on typebot status change
|
* Changed returned sessions on typebot status change
|
||||||
|
* Reorganization of files and folders
|
||||||
|
|
||||||
# 1.7.1 (2024-04-03 10:19)
|
# 1.7.1 (2024-04-03 10:19)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "evolution-api",
|
"name": "evolution-api",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"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": {
|
||||||
|
@ -8,18 +8,18 @@ import { Logger } from '../../config/logger.config';
|
|||||||
import { BadRequestException, InternalServerErrorException } from '../../exceptions';
|
import { BadRequestException, InternalServerErrorException } from '../../exceptions';
|
||||||
import { RedisCache } from '../../libs/redis.client';
|
import { RedisCache } from '../../libs/redis.client';
|
||||||
import { InstanceDto, SetPresenceDto } from '../dto/instance.dto';
|
import { InstanceDto, SetPresenceDto } from '../dto/instance.dto';
|
||||||
|
import { ChatwootService } from '../integrations/chatwoot/services/chatwoot.service';
|
||||||
|
import { RabbitmqService } from '../integrations/rabbitmq/services/rabbitmq.service';
|
||||||
|
import { SqsService } from '../integrations/sqs/services/sqs.service';
|
||||||
|
import { TypebotService } from '../integrations/typebot/services/typebot.service';
|
||||||
|
import { WebsocketService } from '../integrations/websocket/services/websocket.service';
|
||||||
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 { ChatwootService } from '../services/chatwoot.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 { RabbitmqService } from '../services/rabbitmq.service';
|
|
||||||
import { SettingsService } from '../services/settings.service';
|
import { SettingsService } from '../services/settings.service';
|
||||||
import { SqsService } from '../services/sqs.service';
|
|
||||||
import { TypebotService } from '../services/typebot.service';
|
|
||||||
import { WebhookService } from '../services/webhook.service';
|
import { WebhookService } from '../services/webhook.service';
|
||||||
import { WebsocketService } from '../services/websocket.service';
|
|
||||||
import { BaileysStartupService } from '../services/whatsapp.baileys.service';
|
import { BaileysStartupService } from '../services/whatsapp.baileys.service';
|
||||||
import { BusinessStartupService } from '../services/whatsapp.business.service';
|
import { BusinessStartupService } from '../services/whatsapp.business.service';
|
||||||
import { Events, Integration, wa } from '../types/wa.types';
|
import { Events, Integration, wa } from '../types/wa.types';
|
@ -7,8 +7,8 @@ import { Auth, configService } from '../../config/env.config';
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../config/logger.config';
|
||||||
import { ForbiddenException, UnauthorizedException } from '../../exceptions';
|
import { ForbiddenException, UnauthorizedException } from '../../exceptions';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../dto/instance.dto';
|
||||||
|
import { repository } from '../server.module';
|
||||||
import { JwtPayload } from '../services/auth.service';
|
import { JwtPayload } from '../services/auth.service';
|
||||||
import { repository } from '../whatsapp.module';
|
|
||||||
|
|
||||||
const logger = new Logger('GUARD');
|
const logger = new Logger('GUARD');
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
|||||||
} from '../../exceptions';
|
} from '../../exceptions';
|
||||||
import { dbserver } from '../../libs/db.connect';
|
import { dbserver } from '../../libs/db.connect';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../dto/instance.dto';
|
||||||
import { cache, waMonitor } from '../whatsapp.module';
|
import { cache, waMonitor } from '../server.module';
|
||||||
|
|
||||||
async function getInstance(instanceName: string) {
|
async function getInstance(instanceName: string) {
|
||||||
try {
|
try {
|
@ -1,5 +1,5 @@
|
|||||||
import { CacheConf, ConfigService } from '../config/env.config';
|
import { CacheConf, ConfigService } from '../../../../config/env.config';
|
||||||
import { ICache } from '../whatsapp/abstract/abstract.cache';
|
import { ICache } from '../../../abstract/abstract.cache';
|
||||||
import { LocalCache } from './localcache';
|
import { LocalCache } from './localcache';
|
||||||
import { RedisCache } from './rediscache';
|
import { RedisCache } from './rediscache';
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import NodeCache from 'node-cache';
|
import NodeCache from 'node-cache';
|
||||||
|
|
||||||
import { CacheConf, CacheConfLocal, ConfigService } from '../config/env.config';
|
import { CacheConf, CacheConfLocal, ConfigService } from '../../../../config/env.config';
|
||||||
import { ICache } from '../whatsapp/abstract/abstract.cache';
|
import { ICache } from '../../../abstract/abstract.cache';
|
||||||
|
|
||||||
export class LocalCache implements ICache {
|
export class LocalCache implements ICache {
|
||||||
private conf: CacheConfLocal;
|
private conf: CacheConfLocal;
|
@ -1,7 +1,7 @@
|
|||||||
import { createClient, RedisClientType } from 'redis';
|
import { createClient, RedisClientType } from 'redis';
|
||||||
|
|
||||||
import { CacheConf, CacheConfRedis, configService } from '../config/env.config';
|
import { CacheConf, CacheConfRedis, configService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
|
|
||||||
class Redis {
|
class Redis {
|
||||||
private logger = new Logger(Redis.name);
|
private logger = new Logger(Redis.name);
|
@ -1,8 +1,8 @@
|
|||||||
import { RedisClientType } from 'redis';
|
import { RedisClientType } from 'redis';
|
||||||
|
|
||||||
import { CacheConf, CacheConfRedis, ConfigService } from '../config/env.config';
|
import { CacheConf, CacheConfRedis, ConfigService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { ICache } from '../whatsapp/abstract/abstract.cache';
|
import { ICache } from '../../../abstract/abstract.cache';
|
||||||
import { redisClient } from './rediscache.client';
|
import { redisClient } from './rediscache.client';
|
||||||
|
|
||||||
export class RedisCache implements ICache {
|
export class RedisCache implements ICache {
|
@ -1,15 +1,15 @@
|
|||||||
import { isURL } from 'class-validator';
|
import { isURL } from 'class-validator';
|
||||||
|
|
||||||
import { ConfigService, HttpServer } from '../../config/env.config';
|
import { ConfigService, HttpServer } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { BadRequestException } from '../../exceptions';
|
import { BadRequestException } from '../../../../exceptions';
|
||||||
import { CacheEngine } from '../../libs/cacheengine';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { RepositoryBroker } from '../../../repository/repository.manager';
|
||||||
|
import { waMonitor } from '../../../server.module';
|
||||||
|
import { CacheService } from '../../../services/cache.service';
|
||||||
|
import { CacheEngine } from '../cache/cacheengine';
|
||||||
import { ChatwootDto } from '../dto/chatwoot.dto';
|
import { ChatwootDto } from '../dto/chatwoot.dto';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
|
||||||
import { RepositoryBroker } from '../repository/repository.manager';
|
|
||||||
import { CacheService } from '../services/cache.service';
|
|
||||||
import { ChatwootService } from '../services/chatwoot.service';
|
import { ChatwootService } from '../services/chatwoot.service';
|
||||||
import { waMonitor } from '../whatsapp.module';
|
|
||||||
|
|
||||||
const logger = new Logger('ChatwootController');
|
const logger = new Logger('ChatwootController');
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import postgresql from 'pg';
|
import postgresql from 'pg';
|
||||||
|
|
||||||
import { Chatwoot, configService } from '../config/env.config';
|
import { Chatwoot, configService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
|
|
||||||
const { Pool } = postgresql;
|
const { Pool } = postgresql;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Schema } from 'mongoose';
|
import { Schema } from 'mongoose';
|
||||||
|
|
||||||
import { dbserver } from '../../libs/db.connect';
|
import { dbserver } from '../../../../libs/db.connect';
|
||||||
|
|
||||||
export class ChatwootRaw {
|
export class ChatwootRaw {
|
||||||
_id?: string;
|
_id?: string;
|
@ -1,10 +1,10 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { ConfigService } from '../../config/env.config';
|
import { ConfigService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { IInsert, Repository } from '../abstract/abstract.repository';
|
import { IInsert, Repository } from '../../../abstract/abstract.repository';
|
||||||
import { ChatwootRaw, IChatwootModel } from '../models';
|
import { ChatwootRaw, IChatwootModel } from '../../../models';
|
||||||
|
|
||||||
export class ChatwootRepository extends Repository {
|
export class ChatwootRepository extends Repository {
|
||||||
constructor(private readonly chatwootModel: IChatwootModel, private readonly configService: ConfigService) {
|
constructor(private readonly chatwootModel: IChatwootModel, private readonly configService: ConfigService) {
|
@ -1,12 +1,12 @@
|
|||||||
import { RequestHandler, Router } from 'express';
|
import { RequestHandler, Router } from 'express';
|
||||||
|
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { chatwootSchema, instanceNameSchema } from '../../validate/validate.schema';
|
import { chatwootSchema, instanceNameSchema } from '../../../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../../../abstract/abstract.router';
|
||||||
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { HttpStatus } from '../../../routers/index.router';
|
||||||
|
import { chatwootController } from '../../../server.module';
|
||||||
import { ChatwootDto } from '../dto/chatwoot.dto';
|
import { ChatwootDto } from '../dto/chatwoot.dto';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
|
||||||
import { chatwootController } from '../whatsapp.module';
|
|
||||||
import { HttpStatus } from './index.router';
|
|
||||||
|
|
||||||
const logger = new Logger('ChatwootRouter');
|
const logger = new Logger('ChatwootRouter');
|
||||||
|
|
@ -15,18 +15,18 @@ import Jimp from 'jimp';
|
|||||||
import mimeTypes from 'mime-types';
|
import mimeTypes from 'mime-types';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { Chatwoot, ConfigService, HttpServer } from '../../config/env.config';
|
import { Chatwoot, ConfigService, HttpServer } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { chatwootImport } from '../../utils/chatwoot-import-helper';
|
import i18next from '../../../../utils/i18n';
|
||||||
import i18next from '../../utils/i18n';
|
import { ICache } from '../../../abstract/abstract.cache';
|
||||||
import { ICache } from '../abstract/abstract.cache';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { Options, Quoted, SendAudioDto, SendMediaDto, SendTextDto } from '../../../dto/sendMessage.dto';
|
||||||
|
import { ChatwootRaw, ContactRaw, MessageRaw } from '../../../models';
|
||||||
|
import { RepositoryBroker } from '../../../repository/repository.manager';
|
||||||
|
import { WAMonitoringService } from '../../../services/monitor.service';
|
||||||
|
import { Events } from '../../../types/wa.types';
|
||||||
import { ChatwootDto } from '../dto/chatwoot.dto';
|
import { ChatwootDto } from '../dto/chatwoot.dto';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { chatwootImport } from '../utils/chatwoot-import-helper';
|
||||||
import { Options, Quoted, SendAudioDto, SendMediaDto, SendTextDto } from '../dto/sendMessage.dto';
|
|
||||||
import { ChatwootRaw, ContactRaw, MessageRaw } from '../models';
|
|
||||||
import { RepositoryBroker } from '../repository/repository.manager';
|
|
||||||
import { Events } from '../types/wa.types';
|
|
||||||
import { WAMonitoringService } from './monitor.service';
|
|
||||||
|
|
||||||
export class ChatwootService {
|
export class ChatwootService {
|
||||||
private readonly logger = new Logger(ChatwootService.name);
|
private readonly logger = new Logger(ChatwootService.name);
|
@ -1,12 +1,12 @@
|
|||||||
import { inbox } from '@figuro/chatwoot-sdk';
|
import { inbox } from '@figuro/chatwoot-sdk';
|
||||||
import { proto } from '@whiskeysockets/baileys';
|
import { proto } from '@whiskeysockets/baileys';
|
||||||
|
|
||||||
import { Chatwoot, configService } from '../config/env.config';
|
import { InstanceDto } from '../../../../api/dto/instance.dto';
|
||||||
import { Logger } from '../config/logger.config';
|
import { ChatwootRaw, ContactRaw, MessageRaw } from '../../../../api/models';
|
||||||
|
import { Chatwoot, configService } from '../../../../config/env.config';
|
||||||
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { postgresClient } from '../libs/postgres.client';
|
import { postgresClient } from '../libs/postgres.client';
|
||||||
import { InstanceDto } from '../whatsapp/dto/instance.dto';
|
import { ChatwootService } from '../services/chatwoot.service';
|
||||||
import { ChatwootRaw, ContactRaw, MessageRaw } from '../whatsapp/models';
|
|
||||||
import { ChatwootService } from '../whatsapp/services/chatwoot.service';
|
|
||||||
|
|
||||||
type ChatwootUser = {
|
type ChatwootUser = {
|
||||||
user_type: string;
|
user_type: string;
|
42
src/api/integrations/chatwoot/validate/chatwoot.schema.ts
Normal file
42
src/api/integrations/chatwoot/validate/chatwoot.schema.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { JSONSchema7 } from 'json-schema';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => {
|
||||||
|
const properties = {};
|
||||||
|
propertyNames.forEach(
|
||||||
|
(property) =>
|
||||||
|
(properties[property] = {
|
||||||
|
minLength: 1,
|
||||||
|
description: `The "${property}" cannot be empty`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
if: {
|
||||||
|
propertyNames: {
|
||||||
|
enum: [...propertyNames],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
then: { properties },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const chatwootSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
enabled: { type: 'boolean', enum: [true, false] },
|
||||||
|
account_id: { type: 'string' },
|
||||||
|
token: { type: 'string' },
|
||||||
|
url: { type: 'string' },
|
||||||
|
sign_msg: { type: 'boolean', enum: [true, false] },
|
||||||
|
sign_delimiter: { type: ['string', 'null'] },
|
||||||
|
reopen_conversation: { type: 'boolean', enum: [true, false] },
|
||||||
|
conversation_pending: { type: 'boolean', enum: [true, false] },
|
||||||
|
auto_create: { type: 'boolean', enum: [true, false] },
|
||||||
|
import_contacts: { type: 'boolean', enum: [true, false] },
|
||||||
|
import_messages: { type: 'boolean', enum: [true, false] },
|
||||||
|
days_limit_import_messages: { type: 'number' },
|
||||||
|
},
|
||||||
|
required: ['enabled', 'account_id', 'token', 'url', 'sign_msg', 'reopen_conversation', 'conversation_pending'],
|
||||||
|
...isNotEmpty('account_id', 'token', 'url', 'sign_msg', 'reopen_conversation', 'conversation_pending'),
|
||||||
|
};
|
@ -1,5 +1,5 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
import { RabbitmqDto } from '../dto/rabbitmq.dto';
|
import { RabbitmqDto } from '../dto/rabbitmq.dto';
|
||||||
import { RabbitmqService } from '../services/rabbitmq.service';
|
import { RabbitmqService } from '../services/rabbitmq.service';
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import * as amqp from 'amqplib/callback_api';
|
import * as amqp from 'amqplib/callback_api';
|
||||||
|
|
||||||
import { configService, Rabbitmq } from '../config/env.config';
|
import { configService, Rabbitmq } from '../../../../config/env.config';
|
||||||
import { Logger } from '../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
|
|
||||||
const logger = new Logger('AMQP');
|
const logger = new Logger('AMQP');
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Schema } from 'mongoose';
|
import { Schema } from 'mongoose';
|
||||||
|
|
||||||
import { dbserver } from '../../libs/db.connect';
|
import { dbserver } from '../../../../libs/db.connect';
|
||||||
|
|
||||||
export class RabbitmqRaw {
|
export class RabbitmqRaw {
|
||||||
_id?: string;
|
_id?: string;
|
@ -1,10 +1,10 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { ConfigService } from '../../config/env.config';
|
import { ConfigService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { IInsert, Repository } from '../abstract/abstract.repository';
|
import { IInsert, Repository } from '../../../abstract/abstract.repository';
|
||||||
import { IRabbitmqModel, RabbitmqRaw } from '../models';
|
import { IRabbitmqModel, RabbitmqRaw } from '../../../models';
|
||||||
|
|
||||||
export class RabbitmqRepository extends Repository {
|
export class RabbitmqRepository extends Repository {
|
||||||
constructor(private readonly rabbitmqModel: IRabbitmqModel, private readonly configService: ConfigService) {
|
constructor(private readonly rabbitmqModel: IRabbitmqModel, private readonly configService: ConfigService) {
|
@ -1,12 +1,12 @@
|
|||||||
import { RequestHandler, Router } from 'express';
|
import { RequestHandler, Router } from 'express';
|
||||||
|
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { instanceNameSchema, rabbitmqSchema } from '../../validate/validate.schema';
|
import { instanceNameSchema, rabbitmqSchema } from '../../../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../../../abstract/abstract.router';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { HttpStatus } from '../../../routers/index.router';
|
||||||
|
import { rabbitmqController } from '../../../server.module';
|
||||||
import { RabbitmqDto } from '../dto/rabbitmq.dto';
|
import { RabbitmqDto } from '../dto/rabbitmq.dto';
|
||||||
import { rabbitmqController } from '../whatsapp.module';
|
|
||||||
import { HttpStatus } from './index.router';
|
|
||||||
|
|
||||||
const logger = new Logger('RabbitmqRouter');
|
const logger = new Logger('RabbitmqRouter');
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { initQueues } from '../../libs/amqp.server';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { RabbitmqRaw } from '../../../models';
|
||||||
|
import { WAMonitoringService } from '../../../services/monitor.service';
|
||||||
import { RabbitmqDto } from '../dto/rabbitmq.dto';
|
import { RabbitmqDto } from '../dto/rabbitmq.dto';
|
||||||
import { RabbitmqRaw } from '../models';
|
import { initQueues } from '../libs/amqp.server';
|
||||||
import { WAMonitoringService } from './monitor.service';
|
|
||||||
|
|
||||||
export class RabbitmqService {
|
export class RabbitmqService {
|
||||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
constructor(private readonly waMonitor: WAMonitoringService) {}
|
66
src/api/integrations/rabbitmq/validate/rabbitmq.schema.ts
Normal file
66
src/api/integrations/rabbitmq/validate/rabbitmq.schema.ts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import { JSONSchema7 } from 'json-schema';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => {
|
||||||
|
const properties = {};
|
||||||
|
propertyNames.forEach(
|
||||||
|
(property) =>
|
||||||
|
(properties[property] = {
|
||||||
|
minLength: 1,
|
||||||
|
description: `The "${property}" cannot be empty`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
if: {
|
||||||
|
propertyNames: {
|
||||||
|
enum: [...propertyNames],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
then: { properties },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const rabbitmqSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
enabled: { type: 'boolean', enum: [true, false] },
|
||||||
|
events: {
|
||||||
|
type: 'array',
|
||||||
|
minItems: 0,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
enum: [
|
||||||
|
'APPLICATION_STARTUP',
|
||||||
|
'QRCODE_UPDATED',
|
||||||
|
'MESSAGES_SET',
|
||||||
|
'MESSAGES_UPSERT',
|
||||||
|
'MESSAGES_UPDATE',
|
||||||
|
'MESSAGES_DELETE',
|
||||||
|
'SEND_MESSAGE',
|
||||||
|
'CONTACTS_SET',
|
||||||
|
'CONTACTS_UPSERT',
|
||||||
|
'CONTACTS_UPDATE',
|
||||||
|
'PRESENCE_UPDATE',
|
||||||
|
'CHATS_SET',
|
||||||
|
'CHATS_UPSERT',
|
||||||
|
'CHATS_UPDATE',
|
||||||
|
'CHATS_DELETE',
|
||||||
|
'GROUPS_UPSERT',
|
||||||
|
'GROUP_UPDATE',
|
||||||
|
'GROUP_PARTICIPANTS_UPDATE',
|
||||||
|
'CONNECTION_UPDATE',
|
||||||
|
'LABELS_EDIT',
|
||||||
|
'LABELS_ASSOCIATION',
|
||||||
|
'CALL',
|
||||||
|
'NEW_JWT_TOKEN',
|
||||||
|
'TYPEBOT_START',
|
||||||
|
'TYPEBOT_CHANGE_STATUS',
|
||||||
|
'CHAMA_AI_ACTION',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['enabled'],
|
||||||
|
...isNotEmpty('enabled'),
|
||||||
|
};
|
@ -1,5 +1,5 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
import { SqsDto } from '../dto/sqs.dto';
|
import { SqsDto } from '../dto/sqs.dto';
|
||||||
import { SqsService } from '../services/sqs.service';
|
import { SqsService } from '../services/sqs.service';
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import { SQS } from 'aws-sdk';
|
import { SQS } from 'aws-sdk';
|
||||||
|
|
||||||
import { configService, Sqs } from '../config/env.config';
|
import { configService, Sqs } from '../../../../config/env.config';
|
||||||
import { Logger } from '../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
|
|
||||||
const logger = new Logger('SQS');
|
const logger = new Logger('SQS');
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Schema } from 'mongoose';
|
import { Schema } from 'mongoose';
|
||||||
|
|
||||||
import { dbserver } from '../../libs/db.connect';
|
import { dbserver } from '../../../../libs/db.connect';
|
||||||
|
|
||||||
export class SqsRaw {
|
export class SqsRaw {
|
||||||
_id?: string;
|
_id?: string;
|
@ -1,10 +1,10 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { ConfigService } from '../../config/env.config';
|
import { ConfigService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { IInsert, Repository } from '../abstract/abstract.repository';
|
import { IInsert, Repository } from '../../../abstract/abstract.repository';
|
||||||
import { ISqsModel, SqsRaw } from '../models';
|
import { ISqsModel, SqsRaw } from '../../../models';
|
||||||
|
|
||||||
export class SqsRepository extends Repository {
|
export class SqsRepository extends Repository {
|
||||||
constructor(private readonly sqsModel: ISqsModel, private readonly configService: ConfigService) {
|
constructor(private readonly sqsModel: ISqsModel, private readonly configService: ConfigService) {
|
@ -1,12 +1,12 @@
|
|||||||
import { RequestHandler, Router } from 'express';
|
import { RequestHandler, Router } from 'express';
|
||||||
|
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { instanceNameSchema, sqsSchema } from '../../validate/validate.schema';
|
import { instanceNameSchema, sqsSchema } from '../../../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../../../abstract/abstract.router';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { HttpStatus } from '../../../routers/index.router';
|
||||||
|
import { sqsController } from '../../../server.module';
|
||||||
import { SqsDto } from '../dto/sqs.dto';
|
import { SqsDto } from '../dto/sqs.dto';
|
||||||
import { sqsController } from '../whatsapp.module';
|
|
||||||
import { HttpStatus } from './index.router';
|
|
||||||
|
|
||||||
const logger = new Logger('SqsRouter');
|
const logger = new Logger('SqsRouter');
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { initQueues } from '../../libs/sqs.server';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { SqsRaw } from '../../../models';
|
||||||
|
import { WAMonitoringService } from '../../../services/monitor.service';
|
||||||
import { SqsDto } from '../dto/sqs.dto';
|
import { SqsDto } from '../dto/sqs.dto';
|
||||||
import { SqsRaw } from '../models';
|
import { initQueues } from '../libs/sqs.server';
|
||||||
import { WAMonitoringService } from './monitor.service';
|
|
||||||
|
|
||||||
export class SqsService {
|
export class SqsService {
|
||||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
constructor(private readonly waMonitor: WAMonitoringService) {}
|
66
src/api/integrations/sqs/validate/sqs.schema.ts
Normal file
66
src/api/integrations/sqs/validate/sqs.schema.ts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import { JSONSchema7 } from 'json-schema';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => {
|
||||||
|
const properties = {};
|
||||||
|
propertyNames.forEach(
|
||||||
|
(property) =>
|
||||||
|
(properties[property] = {
|
||||||
|
minLength: 1,
|
||||||
|
description: `The "${property}" cannot be empty`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
if: {
|
||||||
|
propertyNames: {
|
||||||
|
enum: [...propertyNames],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
then: { properties },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const sqsSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
enabled: { type: 'boolean', enum: [true, false] },
|
||||||
|
events: {
|
||||||
|
type: 'array',
|
||||||
|
minItems: 0,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
enum: [
|
||||||
|
'APPLICATION_STARTUP',
|
||||||
|
'QRCODE_UPDATED',
|
||||||
|
'MESSAGES_SET',
|
||||||
|
'MESSAGES_UPSERT',
|
||||||
|
'MESSAGES_UPDATE',
|
||||||
|
'MESSAGES_DELETE',
|
||||||
|
'SEND_MESSAGE',
|
||||||
|
'CONTACTS_SET',
|
||||||
|
'CONTACTS_UPSERT',
|
||||||
|
'CONTACTS_UPDATE',
|
||||||
|
'PRESENCE_UPDATE',
|
||||||
|
'CHATS_SET',
|
||||||
|
'CHATS_UPSERT',
|
||||||
|
'CHATS_UPDATE',
|
||||||
|
'CHATS_DELETE',
|
||||||
|
'GROUPS_UPSERT',
|
||||||
|
'GROUP_UPDATE',
|
||||||
|
'GROUP_PARTICIPANTS_UPDATE',
|
||||||
|
'CONNECTION_UPDATE',
|
||||||
|
'LABELS_EDIT',
|
||||||
|
'LABELS_ASSOCIATION',
|
||||||
|
'CALL',
|
||||||
|
'NEW_JWT_TOKEN',
|
||||||
|
'TYPEBOT_START',
|
||||||
|
'TYPEBOT_CHANGE_STATUS',
|
||||||
|
'CHAMA_AI_ACTION',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['enabled'],
|
||||||
|
...isNotEmpty('enabled'),
|
||||||
|
};
|
@ -1,5 +1,5 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
import { TypebotDto } from '../dto/typebot.dto';
|
import { TypebotDto } from '../dto/typebot.dto';
|
||||||
import { TypebotService } from '../services/typebot.service';
|
import { TypebotService } from '../services/typebot.service';
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Schema } from 'mongoose';
|
import { Schema } from 'mongoose';
|
||||||
|
|
||||||
import { dbserver } from '../../libs/db.connect';
|
import { dbserver } from '../../../../libs/db.connect';
|
||||||
|
|
||||||
class Session {
|
class Session {
|
||||||
remoteJid?: string;
|
remoteJid?: string;
|
@ -1,10 +1,10 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { ConfigService } from '../../config/env.config';
|
import { ConfigService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { IInsert, Repository } from '../abstract/abstract.repository';
|
import { IInsert, Repository } from '../../../abstract/abstract.repository';
|
||||||
import { ITypebotModel, TypebotRaw } from '../models';
|
import { ITypebotModel, TypebotRaw } from '../../../models';
|
||||||
|
|
||||||
export class TypebotRepository extends Repository {
|
export class TypebotRepository extends Repository {
|
||||||
constructor(private readonly typebotModel: ITypebotModel, private readonly configService: ConfigService) {
|
constructor(private readonly typebotModel: ITypebotModel, private readonly configService: ConfigService) {
|
@ -1,17 +1,17 @@
|
|||||||
import { RequestHandler, Router } from 'express';
|
import { RequestHandler, Router } from 'express';
|
||||||
|
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import {
|
import {
|
||||||
instanceNameSchema,
|
instanceNameSchema,
|
||||||
typebotSchema,
|
typebotSchema,
|
||||||
typebotStartSchema,
|
typebotStartSchema,
|
||||||
typebotStatusSchema,
|
typebotStatusSchema,
|
||||||
} from '../../validate/validate.schema';
|
} from '../../../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../../../abstract/abstract.router';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { HttpStatus } from '../../../routers/index.router';
|
||||||
|
import { typebotController } from '../../../server.module';
|
||||||
import { TypebotDto } from '../dto/typebot.dto';
|
import { TypebotDto } from '../dto/typebot.dto';
|
||||||
import { typebotController } from '../whatsapp.module';
|
|
||||||
import { HttpStatus } from './index.router';
|
|
||||||
|
|
||||||
const logger = new Logger('TypebotRouter');
|
const logger = new Logger('TypebotRouter');
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import EventEmitter2 from 'eventemitter2';
|
import EventEmitter2 from 'eventemitter2';
|
||||||
|
|
||||||
import { ConfigService, Typebot } from '../../config/env.config';
|
import { ConfigService, Typebot } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { MessageRaw } from '../../../models';
|
||||||
|
import { WAMonitoringService } from '../../../services/monitor.service';
|
||||||
|
import { Events } from '../../../types/wa.types';
|
||||||
import { Session, TypebotDto } from '../dto/typebot.dto';
|
import { Session, TypebotDto } from '../dto/typebot.dto';
|
||||||
import { MessageRaw } from '../models';
|
|
||||||
import { Events } from '../types/wa.types';
|
|
||||||
import { WAMonitoringService } from './monitor.service';
|
|
||||||
|
|
||||||
export class TypebotService {
|
export class TypebotService {
|
||||||
constructor(
|
constructor(
|
60
src/api/integrations/typebot/validate/typebot.schema.ts
Normal file
60
src/api/integrations/typebot/validate/typebot.schema.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import { JSONSchema7 } from 'json-schema';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => {
|
||||||
|
const properties = {};
|
||||||
|
propertyNames.forEach(
|
||||||
|
(property) =>
|
||||||
|
(properties[property] = {
|
||||||
|
minLength: 1,
|
||||||
|
description: `The "${property}" cannot be empty`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
if: {
|
||||||
|
propertyNames: {
|
||||||
|
enum: [...propertyNames],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
then: { properties },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const typebotSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
enabled: { type: 'boolean', enum: [true, false] },
|
||||||
|
url: { type: 'string' },
|
||||||
|
typebot: { type: 'string' },
|
||||||
|
expire: { type: 'integer' },
|
||||||
|
delay_message: { type: 'integer' },
|
||||||
|
unknown_message: { type: 'string' },
|
||||||
|
listening_from_me: { type: 'boolean', enum: [true, false] },
|
||||||
|
},
|
||||||
|
required: ['enabled', 'url', 'typebot', 'expire', 'delay_message', 'unknown_message', 'listening_from_me'],
|
||||||
|
...isNotEmpty('enabled', 'url', 'typebot', 'expire', 'delay_message', 'unknown_message', 'listening_from_me'),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const typebotStatusSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
remoteJid: { type: 'string' },
|
||||||
|
status: { type: 'string', enum: ['opened', 'closed', 'paused'] },
|
||||||
|
},
|
||||||
|
required: ['remoteJid', 'status'],
|
||||||
|
...isNotEmpty('remoteJid', 'status'),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const typebotStartSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
remoteJid: { type: 'string' },
|
||||||
|
url: { type: 'string' },
|
||||||
|
typebot: { type: 'string' },
|
||||||
|
},
|
||||||
|
required: ['remoteJid', 'url', 'typebot'],
|
||||||
|
...isNotEmpty('remoteJid', 'url', 'typebot'),
|
||||||
|
};
|
@ -1,5 +1,5 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
import { WebsocketDto } from '../dto/websocket.dto';
|
import { WebsocketDto } from '../dto/websocket.dto';
|
||||||
import { WebsocketService } from '../services/websocket.service';
|
import { WebsocketService } from '../services/websocket.service';
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
import { Server } from 'http';
|
import { Server } from 'http';
|
||||||
import { Server as SocketIO } from 'socket.io';
|
import { Server as SocketIO } from 'socket.io';
|
||||||
|
|
||||||
import { configService, Cors, Websocket } from '../config/env.config';
|
import { configService, Cors, Websocket } from '../../../../config/env.config';
|
||||||
import { Logger } from '../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
|
|
||||||
const logger = new Logger('Socket');
|
const logger = new Logger('Socket');
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Schema } from 'mongoose';
|
import { Schema } from 'mongoose';
|
||||||
|
|
||||||
import { dbserver } from '../../libs/db.connect';
|
import { dbserver } from '../../../../libs/db.connect';
|
||||||
|
|
||||||
export class WebsocketRaw {
|
export class WebsocketRaw {
|
||||||
_id?: string;
|
_id?: string;
|
@ -1,10 +1,10 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { ConfigService } from '../../config/env.config';
|
import { ConfigService } from '../../../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { IInsert, Repository } from '../abstract/abstract.repository';
|
import { IInsert, Repository } from '../../../abstract/abstract.repository';
|
||||||
import { IWebsocketModel, WebsocketRaw } from '../models';
|
import { IWebsocketModel, WebsocketRaw } from '../../../models';
|
||||||
|
|
||||||
export class WebsocketRepository extends Repository {
|
export class WebsocketRepository extends Repository {
|
||||||
constructor(private readonly websocketModel: IWebsocketModel, private readonly configService: ConfigService) {
|
constructor(private readonly websocketModel: IWebsocketModel, private readonly configService: ConfigService) {
|
@ -1,12 +1,12 @@
|
|||||||
import { RequestHandler, Router } from 'express';
|
import { RequestHandler, Router } from 'express';
|
||||||
|
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { instanceNameSchema, websocketSchema } from '../../validate/validate.schema';
|
import { instanceNameSchema, websocketSchema } from '../../../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../../../abstract/abstract.router';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { HttpStatus } from '../../../routers/index.router';
|
||||||
|
import { websocketController } from '../../../server.module';
|
||||||
import { WebsocketDto } from '../dto/websocket.dto';
|
import { WebsocketDto } from '../dto/websocket.dto';
|
||||||
import { websocketController } from '../whatsapp.module';
|
|
||||||
import { HttpStatus } from './index.router';
|
|
||||||
|
|
||||||
const logger = new Logger('WebsocketRouter');
|
const logger = new Logger('WebsocketRouter');
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../../../config/logger.config';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../../../dto/instance.dto';
|
||||||
|
import { WebsocketRaw } from '../../../models';
|
||||||
|
import { WAMonitoringService } from '../../../services/monitor.service';
|
||||||
import { WebsocketDto } from '../dto/websocket.dto';
|
import { WebsocketDto } from '../dto/websocket.dto';
|
||||||
import { WebsocketRaw } from '../models';
|
|
||||||
import { WAMonitoringService } from './monitor.service';
|
|
||||||
|
|
||||||
export class WebsocketService {
|
export class WebsocketService {
|
||||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
constructor(private readonly waMonitor: WAMonitoringService) {}
|
66
src/api/integrations/websocket/validate/websocket.schema.ts
Normal file
66
src/api/integrations/websocket/validate/websocket.schema.ts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import { JSONSchema7 } from 'json-schema';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => {
|
||||||
|
const properties = {};
|
||||||
|
propertyNames.forEach(
|
||||||
|
(property) =>
|
||||||
|
(properties[property] = {
|
||||||
|
minLength: 1,
|
||||||
|
description: `The "${property}" cannot be empty`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
if: {
|
||||||
|
propertyNames: {
|
||||||
|
enum: [...propertyNames],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
then: { properties },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const websocketSchema: JSONSchema7 = {
|
||||||
|
$id: v4(),
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
enabled: { type: 'boolean', enum: [true, false] },
|
||||||
|
events: {
|
||||||
|
type: 'array',
|
||||||
|
minItems: 0,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
enum: [
|
||||||
|
'APPLICATION_STARTUP',
|
||||||
|
'QRCODE_UPDATED',
|
||||||
|
'MESSAGES_SET',
|
||||||
|
'MESSAGES_UPSERT',
|
||||||
|
'MESSAGES_UPDATE',
|
||||||
|
'MESSAGES_DELETE',
|
||||||
|
'SEND_MESSAGE',
|
||||||
|
'CONTACTS_SET',
|
||||||
|
'CONTACTS_UPSERT',
|
||||||
|
'CONTACTS_UPDATE',
|
||||||
|
'PRESENCE_UPDATE',
|
||||||
|
'CHATS_SET',
|
||||||
|
'CHATS_UPSERT',
|
||||||
|
'CHATS_UPDATE',
|
||||||
|
'CHATS_DELETE',
|
||||||
|
'GROUPS_UPSERT',
|
||||||
|
'GROUP_UPDATE',
|
||||||
|
'GROUP_PARTICIPANTS_UPDATE',
|
||||||
|
'CONNECTION_UPDATE',
|
||||||
|
'LABELS_EDIT',
|
||||||
|
'LABELS_ASSOCIATION',
|
||||||
|
'CALL',
|
||||||
|
'NEW_JWT_TOKEN',
|
||||||
|
'TYPEBOT_START',
|
||||||
|
'TYPEBOT_CHANGE_STATUS',
|
||||||
|
'CHAMA_AI_ACTION',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['enabled'],
|
||||||
|
...isNotEmpty('enabled'),
|
||||||
|
};
|
@ -1,15 +1,15 @@
|
|||||||
|
export * from '../integrations/chatwoot/models/chatwoot.model';
|
||||||
|
export * from '../integrations/rabbitmq/models/rabbitmq.model';
|
||||||
|
export * from '../integrations/sqs/models/sqs.model';
|
||||||
|
export * from '../integrations/typebot/models/typebot.model';
|
||||||
|
export * from '../integrations/websocket/models/websocket.model';
|
||||||
export * from './auth.model';
|
export * from './auth.model';
|
||||||
export * from './chamaai.model';
|
export * from './chamaai.model';
|
||||||
export * from './chat.model';
|
export * from './chat.model';
|
||||||
export * from './chatwoot.model';
|
|
||||||
export * from './contact.model';
|
export * from './contact.model';
|
||||||
export * from './integration.model';
|
export * from './integration.model';
|
||||||
export * from './label.model';
|
export * from './label.model';
|
||||||
export * from './message.model';
|
export * from './message.model';
|
||||||
export * from './proxy.model';
|
export * from './proxy.model';
|
||||||
export * from './rabbitmq.model';
|
|
||||||
export * from './settings.model';
|
export * from './settings.model';
|
||||||
export * from './sqs.model';
|
|
||||||
export * from './typebot.model';
|
|
||||||
export * from './webhook.model';
|
export * from './webhook.model';
|
||||||
export * from './websocket.model';
|
|
@ -4,22 +4,22 @@ import { join } from 'path';
|
|||||||
|
|
||||||
import { Auth, ConfigService, Database } from '../../config/env.config';
|
import { Auth, ConfigService, Database } from '../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../config/logger.config';
|
||||||
|
import { ChatwootRepository } from '../integrations/chatwoot/repository/chatwoot.repository';
|
||||||
|
import { RabbitmqRepository } from '../integrations/rabbitmq/repository/rabbitmq.repository';
|
||||||
|
import { SqsRepository } from '../integrations/sqs/repository/sqs.repository';
|
||||||
|
import { TypebotRepository } from '../integrations/typebot/repository/typebot.repository';
|
||||||
|
import { WebsocketRepository } from '../integrations/websocket/repository/websocket.repository';
|
||||||
import { AuthRepository } from './auth.repository';
|
import { AuthRepository } from './auth.repository';
|
||||||
import { ChamaaiRepository } from './chamaai.repository';
|
import { ChamaaiRepository } from './chamaai.repository';
|
||||||
import { ChatRepository } from './chat.repository';
|
import { ChatRepository } from './chat.repository';
|
||||||
import { ChatwootRepository } from './chatwoot.repository';
|
|
||||||
import { ContactRepository } from './contact.repository';
|
import { ContactRepository } from './contact.repository';
|
||||||
import { IntegrationRepository } from './integration.repository';
|
import { IntegrationRepository } from './integration.repository';
|
||||||
import { LabelRepository } from './label.repository';
|
import { LabelRepository } from './label.repository';
|
||||||
import { MessageRepository } from './message.repository';
|
import { MessageRepository } from './message.repository';
|
||||||
import { MessageUpRepository } from './messageUp.repository';
|
import { MessageUpRepository } from './messageUp.repository';
|
||||||
import { ProxyRepository } from './proxy.repository';
|
import { ProxyRepository } from './proxy.repository';
|
||||||
import { RabbitmqRepository } from './rabbitmq.repository';
|
|
||||||
import { SettingsRepository } from './settings.repository';
|
import { SettingsRepository } from './settings.repository';
|
||||||
import { SqsRepository } from './sqs.repository';
|
|
||||||
import { TypebotRepository } from './typebot.repository';
|
|
||||||
import { WebhookRepository } from './webhook.repository';
|
import { WebhookRepository } from './webhook.repository';
|
||||||
import { WebsocketRepository } from './websocket.repository';
|
|
||||||
export class RepositoryBroker {
|
export class RepositoryBroker {
|
||||||
constructor(
|
constructor(
|
||||||
public readonly message: MessageRepository,
|
public readonly message: MessageRepository,
|
@ -5,7 +5,7 @@ import { chamaaiSchema, instanceNameSchema } from '../../validate/validate.schem
|
|||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../abstract/abstract.router';
|
||||||
import { ChamaaiDto } from '../dto/chamaai.dto';
|
import { ChamaaiDto } from '../dto/chamaai.dto';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../dto/instance.dto';
|
||||||
import { chamaaiController } from '../whatsapp.module';
|
import { chamaaiController } from '../server.module';
|
||||||
import { HttpStatus } from './index.router';
|
import { HttpStatus } from './index.router';
|
||||||
|
|
||||||
const logger = new Logger('ChamaaiRouter');
|
const logger = new Logger('ChamaaiRouter');
|
@ -38,7 +38,7 @@ import { InstanceDto } from '../dto/instance.dto';
|
|||||||
import { ContactQuery } from '../repository/contact.repository';
|
import { ContactQuery } from '../repository/contact.repository';
|
||||||
import { MessageQuery } from '../repository/message.repository';
|
import { MessageQuery } from '../repository/message.repository';
|
||||||
import { MessageUpQuery } from '../repository/messageUp.repository';
|
import { MessageUpQuery } from '../repository/messageUp.repository';
|
||||||
import { chatController } from '../whatsapp.module';
|
import { chatController } from '../server.module';
|
||||||
import { HttpStatus } from './index.router';
|
import { HttpStatus } from './index.router';
|
||||||
|
|
||||||
const logger = new Logger('ChatRouter');
|
const logger = new Logger('ChatRouter');
|
@ -30,7 +30,7 @@ import {
|
|||||||
GroupUpdateParticipantDto,
|
GroupUpdateParticipantDto,
|
||||||
GroupUpdateSettingDto,
|
GroupUpdateSettingDto,
|
||||||
} from '../dto/group.dto';
|
} from '../dto/group.dto';
|
||||||
import { groupController } from '../whatsapp.module';
|
import { groupController } from '../server.module';
|
||||||
import { HttpStatus } from './index.router';
|
import { HttpStatus } from './index.router';
|
||||||
|
|
||||||
const logger = new Logger('GroupRouter');
|
const logger = new Logger('GroupRouter');
|
@ -4,21 +4,21 @@ import fs from 'fs';
|
|||||||
import { Auth, configService } from '../../config/env.config';
|
import { Auth, configService } from '../../config/env.config';
|
||||||
import { authGuard } from '../guards/auth.guard';
|
import { authGuard } from '../guards/auth.guard';
|
||||||
import { instanceExistsGuard, instanceLoggedGuard } from '../guards/instance.guard';
|
import { instanceExistsGuard, instanceLoggedGuard } from '../guards/instance.guard';
|
||||||
|
import { ChatwootRouter } from '../integrations/chatwoot/routes/chatwoot.router';
|
||||||
|
import { RabbitmqRouter } from '../integrations/rabbitmq/routes/rabbitmq.router';
|
||||||
|
import { SqsRouter } from '../integrations/sqs/routes/sqs.router';
|
||||||
|
import { TypebotRouter } from '../integrations/typebot/routes/typebot.router';
|
||||||
|
import { WebsocketRouter } from '../integrations/websocket/routes/websocket.router';
|
||||||
import { ChamaaiRouter } from './chamaai.router';
|
import { ChamaaiRouter } from './chamaai.router';
|
||||||
import { ChatRouter } from './chat.router';
|
import { ChatRouter } from './chat.router';
|
||||||
import { ChatwootRouter } from './chatwoot.router';
|
|
||||||
import { GroupRouter } from './group.router';
|
import { GroupRouter } from './group.router';
|
||||||
import { InstanceRouter } from './instance.router';
|
import { InstanceRouter } from './instance.router';
|
||||||
import { LabelRouter } from './label.router';
|
import { LabelRouter } from './label.router';
|
||||||
import { ProxyRouter } from './proxy.router';
|
import { ProxyRouter } from './proxy.router';
|
||||||
import { RabbitmqRouter } from './rabbitmq.router';
|
|
||||||
import { MessageRouter } from './sendMessage.router';
|
import { MessageRouter } from './sendMessage.router';
|
||||||
import { SettingsRouter } from './settings.router';
|
import { SettingsRouter } from './settings.router';
|
||||||
import { SqsRouter } from './sqs.router';
|
|
||||||
import { TypebotRouter } from './typebot.router';
|
|
||||||
import { ViewsRouter } from './view.router';
|
import { ViewsRouter } from './view.router';
|
||||||
import { WebhookRouter } from './webhook.router';
|
import { WebhookRouter } from './webhook.router';
|
||||||
import { WebsocketRouter } from './websocket.router';
|
|
||||||
|
|
||||||
enum HttpStatus {
|
enum HttpStatus {
|
||||||
OK = 200,
|
OK = 200,
|
@ -6,8 +6,8 @@ import { dbserver } from '../../libs/db.connect';
|
|||||||
import { instanceNameSchema, oldTokenSchema, presenceOnlySchema } from '../../validate/validate.schema';
|
import { instanceNameSchema, oldTokenSchema, presenceOnlySchema } from '../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../abstract/abstract.router';
|
||||||
import { InstanceDto, SetPresenceDto } from '../dto/instance.dto';
|
import { InstanceDto, SetPresenceDto } from '../dto/instance.dto';
|
||||||
|
import { instanceController } from '../server.module';
|
||||||
import { OldToken } from '../services/auth.service';
|
import { OldToken } from '../services/auth.service';
|
||||||
import { instanceController } from '../whatsapp.module';
|
|
||||||
import { HttpStatus } from './index.router';
|
import { HttpStatus } from './index.router';
|
||||||
|
|
||||||
const logger = new Logger('InstanceRouter');
|
const logger = new Logger('InstanceRouter');
|
@ -4,7 +4,7 @@ import { Logger } from '../../config/logger.config';
|
|||||||
import { handleLabelSchema } from '../../validate/validate.schema';
|
import { handleLabelSchema } from '../../validate/validate.schema';
|
||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../abstract/abstract.router';
|
||||||
import { HandleLabelDto, LabelDto } from '../dto/label.dto';
|
import { HandleLabelDto, LabelDto } from '../dto/label.dto';
|
||||||
import { labelController } from '../whatsapp.module';
|
import { labelController } from '../server.module';
|
||||||
import { HttpStatus } from './index.router';
|
import { HttpStatus } from './index.router';
|
||||||
|
|
||||||
const logger = new Logger('LabelRouter');
|
const logger = new Logger('LabelRouter');
|
@ -5,7 +5,7 @@ import { instanceNameSchema, proxySchema } from '../../validate/validate.schema'
|
|||||||
import { RouterBroker } from '../abstract/abstract.router';
|
import { RouterBroker } from '../abstract/abstract.router';
|
||||||
import { InstanceDto } from '../dto/instance.dto';
|
import { InstanceDto } from '../dto/instance.dto';
|
||||||
import { ProxyDto } from '../dto/proxy.dto';
|
import { ProxyDto } from '../dto/proxy.dto';
|
||||||
import { proxyController } from '../whatsapp.module';
|
import { proxyController } from '../server.module';
|
||||||
import { HttpStatus } from './index.router';
|
import { HttpStatus } from './index.router';
|
||||||
|
|
||||||
const logger = new Logger('ProxyRouter');
|
const logger = new Logger('ProxyRouter');
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user