Skip to content

Commit fcc8748

Browse files
committed
Merge branch 'release/1.4.6'
2 parents fb6e58b + 312ee24 commit fcc8748

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+672
-1257
lines changed

.eslintrc.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ module.exports = {
33
parserOptions: {
44
sourceType: 'CommonJS',
55
},
6-
plugins: ['@typescript-eslint/eslint-plugin'],
6+
plugins: [
7+
'@typescript-eslint',
8+
'simple-import-sort',
9+
'import'
10+
],
711
extends: [
12+
'eslint:recommended',
813
'plugin:@typescript-eslint/recommended',
9-
'plugin:prettier/recommended',
1014
'plugin:prettier/recommended'
1115
],
1216
globals: {
@@ -26,7 +30,11 @@ module.exports = {
2630
'@typescript-eslint/no-explicit-any': 'off',
2731
'@typescript-eslint/no-empty-function': 'off',
2832
'@typescript-eslint/no-non-null-assertion': 'off',
29-
'@typescript-eslint/no-unused-vars': 'off',
33+
'@typescript-eslint/no-unused-vars': 'error',
34+
'import/first': 'error',
35+
'import/no-duplicates': 'error',
36+
'simple-import-sort/imports': 'error',
37+
'simple-import-sort/exports': 'error',
3038
'@typescript-eslint/ban-types': [
3139
'error',
3240
{

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ docker-compose.yaml
2222
/yarn.lock
2323
/package-lock.json
2424

25-
# IDE - VSCode
25+
# IDEs
2626
.vscode/*
2727
!.vscode/settings.json
2828
!.vscode/tasks.json
2929
!.vscode/launch.json
3030
!.vscode/extensions.json
31+
.nova/*
3132

3233
# Prisma
3334
/prisma/migrations
@@ -40,3 +41,6 @@ docker-compose.yaml
4041
/store
4142

4243
/temp/*
44+
45+
.DS_Store
46+
*.DS_Store

.prettierrc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ module.exports = {
22
semi: true,
33
trailingComma: 'all',
44
singleQuote: true,
5-
printWidth: 90,
5+
printWidth: 120,
6+
arrowParens: 'always',
67
tabWidth: 2,
7-
bracketSameLine: true,
8-
bracketSpacing: true
8+
useTabs: false,
9+
bracketSameLine: false,
10+
bracketSpacing: true,
11+
parser: 'typescript'
912
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 1.4.6 (homolog)
2+
3+
* Fixed bug of creating new inbox by chatwoot
4+
* When conversation reopens is pending when conversation pending is true
5+
* Added docker-compose file with dockerhub image
6+
17
# 1.4.5 (2023-07-26 09:32)
28

39
### Fixed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3.3'
2+
3+
services:
4+
api:
5+
container_name: evolution_api
6+
image: davidsongomes/evolution-api:latest
7+
restart: always
8+
ports:
9+
- 8080:8080
10+
volumes:
11+
- evolution_instances:/evolution/instances
12+
- evolution_store:/evolution/store
13+
networks:
14+
- evolution-net
15+
env_file:
16+
- ./Docker/.env
17+
command: ['node', './dist/src/main.js']
18+
expose:
19+
- 8080
20+
21+
volumes:
22+
evolution_instances:
23+
evolution_store:
24+
25+
networks:
26+
evolution-net:
27+
external: true
28+

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"name": "evolution-api",
3-
"version": "1.4.5",
3+
"version": "1.4.6",
44
"description": "Rest api for communication with WhatsApp",
55
"main": "./dist/src/main.js",
66
"scripts": {
77
"build": "tsc",
88
"start": "ts-node --files --transpile-only ./src/main.ts",
99
"start:prod": "bash start.sh",
1010
"dev:server": "clear && tsnd --files --transpile-only --respawn --ignore-watch node_modules ./src/main.ts",
11-
"test": "clear && tsnd --files --transpile-only --respawn --ignore-watch node_modules ./test/all.test.ts"
11+
"test": "clear && tsnd --files --transpile-only --respawn --ignore-watch node_modules ./test/all.test.ts",
12+
"lint": "eslint --fix --ext .ts src"
1213
},
1314
"repository": {
1415
"type": "git",
@@ -80,16 +81,19 @@
8081
"@types/express": "^4.17.17",
8182
"@types/js-yaml": "^4.0.5",
8283
"@types/jsonwebtoken": "^8.5.9",
84+
"@types/mime-types": "^2.1.1",
8385
"@types/node": "^18.15.11",
8486
"@types/qrcode": "^1.5.0",
8587
"@types/qrcode-terminal": "^0.12.0",
8688
"@types/uuid": "^8.3.4",
87-
"@typescript-eslint/eslint-plugin": "^5.57.1",
88-
"@typescript-eslint/parser": "^5.57.1",
89-
"eslint": "^8.38.0",
89+
"@typescript-eslint/eslint-plugin": "^5.62.0",
90+
"@typescript-eslint/parser": "^5.62.0",
91+
"eslint": "^8.45.0",
9092
"eslint-config-prettier": "^8.8.0",
93+
"eslint-plugin-import": "^2.27.5",
9194
"eslint-plugin-prettier": "^4.2.1",
92-
"prettier": "^2.8.7",
95+
"eslint-plugin-simple-import-sort": "^10.0.0",
96+
"prettier": "^2.8.8",
9397
"ts-node-dev": "^2.0.0",
9498
"typescript": "^4.9.5"
9599
}

src/config/env.config.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { isBooleanString } from 'class-validator';
12
import { readFileSync } from 'fs';
23
import { load } from 'js-yaml';
34
import { join } from 'path';
4-
import { isBooleanString } from 'class-validator';
55

66
export type HttpServer = { TYPE: 'http' | 'https'; PORT: number; URL: string };
77

@@ -14,15 +14,7 @@ export type Cors = {
1414

1515
export type LogBaileys = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
1616

17-
export type LogLevel =
18-
| 'ERROR'
19-
| 'WARN'
20-
| 'DEBUG'
21-
| 'INFO'
22-
| 'LOG'
23-
| 'VERBOSE'
24-
| 'DARK'
25-
| 'WEBHOOKS';
17+
export type LogLevel = 'ERROR' | 'WARN' | 'DEBUG' | 'INFO' | 'LOG' | 'VERBOSE' | 'DARK' | 'WEBHOOKS';
2618

2719
export type Log = {
2820
LEVEL: LogLevel[];
@@ -156,9 +148,7 @@ export class ConfigService {
156148
}
157149

158150
private envYaml(): Env {
159-
return load(
160-
readFileSync(join(process.cwd(), 'src', 'env.yml'), { encoding: 'utf-8' }),
161-
) as Env;
151+
return load(readFileSync(join(process.cwd(), 'src', 'env.yml'), { encoding: 'utf-8' })) as Env;
162152
}
163153

164154
private envProcess(): Env {
@@ -244,8 +234,7 @@ export class ConfigService {
244234
CONNECTION_UPDATE: process.env?.WEBHOOK_EVENTS_CONNECTION_UPDATE === 'true',
245235
GROUPS_UPSERT: process.env?.WEBHOOK_EVENTS_GROUPS_UPSERT === 'true',
246236
GROUP_UPDATE: process.env?.WEBHOOK_EVENTS_GROUPS_UPDATE === 'true',
247-
GROUP_PARTICIPANTS_UPDATE:
248-
process.env?.WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE === 'true',
237+
GROUP_PARTICIPANTS_UPDATE: process.env?.WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE === 'true',
249238
CALL: process.env?.WEBHOOK_EVENTS_CALL === 'true',
250239
NEW_JWT_TOKEN: process.env?.WEBHOOK_EVENTS_NEW_JWT_TOKEN === 'true',
251240
},
@@ -262,8 +251,7 @@ export class ConfigService {
262251
API_KEY: {
263252
KEY: process.env.AUTHENTICATION_API_KEY,
264253
},
265-
EXPOSE_IN_FETCH_INSTANCES:
266-
process.env?.AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES === 'true',
254+
EXPOSE_IN_FETCH_INSTANCES: process.env?.AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES === 'true',
267255
JWT: {
268256
EXPIRIN_IN: Number.isInteger(process.env?.AUTHENTICATION_JWT_EXPIRIN_IN)
269257
? Number.parseInt(process.env.AUTHENTICATION_JWT_EXPIRIN_IN)

src/config/logger.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { configService, Log } from './env.config';
21
import dayjs from 'dayjs';
32

3+
import { configService, Log } from './env.config';
4+
45
const formatDateLog = (timestamp: number) =>
56
dayjs(timestamp)
67
.toDate()

src/db/db.connect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import mongoose from 'mongoose';
2+
23
import { configService, Database } from '../config/env.config';
34
import { Logger } from '../config/logger.config';
45

src/db/redis.client.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { createClient, RedisClientType } from '@redis/client';
2-
import { Logger } from '../config/logger.config';
32
import { BufferJSON } from '@whiskeysockets/baileys';
3+
44
import { Redis } from '../config/env.config';
5+
import { Logger } from '../config/logger.config';
56

67
export class RedisCache {
78
constructor() {
@@ -59,11 +60,7 @@ export class RedisCache {
5960
this.logger.verbose('writeData: ' + field);
6061
const json = JSON.stringify(data, BufferJSON.replacer);
6162

62-
return await this.client.hSet(
63-
this.redisEnv.PREFIX_KEY + ':' + this.instanceName,
64-
field,
65-
json,
66-
);
63+
return await this.client.hSet(this.redisEnv.PREFIX_KEY + ':' + this.instanceName, field, json);
6764
} catch (error) {
6865
this.logger.error(error);
6966
}
@@ -72,10 +69,7 @@ export class RedisCache {
7269
public async readData(field: string) {
7370
try {
7471
this.logger.verbose('readData: ' + field);
75-
const data = await this.client.hGet(
76-
this.redisEnv.PREFIX_KEY + ':' + this.instanceName,
77-
field,
78-
);
72+
const data = await this.client.hGet(this.redisEnv.PREFIX_KEY + ':' + this.instanceName, field);
7973

8074
if (data) {
8175
this.logger.verbose('readData: ' + field + ' success');
@@ -92,10 +86,7 @@ export class RedisCache {
9286
public async removeData(field: string) {
9387
try {
9488
this.logger.verbose('removeData: ' + field);
95-
return await this.client.hDel(
96-
this.redisEnv.PREFIX_KEY + ':' + this.instanceName,
97-
field,
98-
);
89+
return await this.client.hDel(this.redisEnv.PREFIX_KEY + ':' + this.instanceName, field);
9990
} catch (error) {
10091
this.logger.error(error);
10192
}
@@ -104,9 +95,7 @@ export class RedisCache {
10495
public async delAll(hash?: string) {
10596
try {
10697
this.logger.verbose('instance delAll: ' + hash);
107-
const result = await this.client.del(
108-
hash || this.redisEnv.PREFIX_KEY + ':' + this.instanceName,
109-
);
98+
const result = await this.client.del(hash || this.redisEnv.PREFIX_KEY + ':' + this.instanceName);
11099

111100
return result;
112101
} catch (error) {

0 commit comments

Comments
 (0)