Skip to content

Commit 61d8252

Browse files
committed
use as lib
1 parent cc8bc88 commit 61d8252

File tree

8 files changed

+48
-35
lines changed

8 files changed

+48
-35
lines changed

.eslintrc.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"plugin:@typescript-eslint/recommended",
5+
"prettier",
6+
"plugin:prettier/recommended"
7+
],
8+
"parserOptions": {
9+
"ecmaVersion": 2022,
10+
"sourceType": "module"
11+
},
12+
"env": {
13+
"node": true
14+
},
15+
"rules": {
16+
"no-var": "error",
17+
"indent": [
18+
"error",
19+
2,
20+
{
21+
"SwitchCase": 1
22+
}
23+
],
24+
"no-multi-spaces": "error",
25+
"space-in-parens": "error",
26+
"no-multiple-empty-lines": "error",
27+
"prefer-const": "error"
28+
}
29+
}

jest.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

jest.config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"preset": "ts-jest",
3+
"testEnvironment": "node"
4+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "unoapi-cloud",
3-
"version": "0.7.1",
3+
"version": "0.7.2",
44
"description": "Unoapi Cloud",
55
"main": "src/index.ts",
66
"repository": "github.com/clairton/unoapi-cloud",
77
"author": "Clairton Rodrig Heinzen<clairton.rodrigo@gmail.com>",
88
"license": "GPL-3.0",
99
"private": false,
1010
"scripts": {
11-
"dev": "./node_modules/nodemon/bin/nodemon.js",
11+
"dev": "ts-node ./src/index.ts",
1212
"start": "node dist/index.js",
1313
"lint": "eslint src",
1414
"test": "ENV_FILE=./.env.test jest --coverage",

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const cloudApi: Outgoing = new OutgoingCloudApi(
2929
WEBHOOK_HEADER || 'Authorization',
3030
)
3131

32-
const _undefined = undefined
32+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33+
const _undefined: any = undefined
3334
const config: ClientConfig = defaultClientConfig
3435
config.ignoreGroupMessages = IGNORE_GROUP_MESSAGES == _undefined ? true : IGNORE_GROUP_MESSAGES === 'true'
3536
config.ignoreBroadcastStatuses = IGNORE_BROADCAST_STATUSES === _undefined ? true : IGNORE_BROADCAST_STATUSES === 'true'

src/services/transformer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ export const fromBaileysMessageContent = (phone: string, payload: any): any => {
176176
const statuses: any[] = []
177177
// eslint-disable-next-line @typescript-eslint/no-explicit-any
178178
const messages: any[] = []
179+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
180+
const errors: any[] = []
179181
const change = {
180182
value: {
181183
messaging_product: 'whatsapp',
@@ -194,7 +196,7 @@ export const fromBaileysMessageContent = (phone: string, payload: any): any => {
194196
},
195197
],
196198
statuses,
197-
errors: [],
199+
errors,
198200
},
199201
field: 'messages',
200202
}

tsconfig.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"exclude": ["./coverage", "./dist", "__tests__", "jest.config.js"],
33
"compilerOptions": {
4-
"target": "esnext",
54
"module": "commonjs",
6-
"lib": ["esnext"],
7-
"allowJs": true,
5+
"target": "ESNext",
6+
"lib": ["ESNext"],
87
"outDir": "./dist",
98
"rootDir": "./src",
10-
"strict": true,
11-
"noImplicitAny": true,
129
"esModuleInterop": true,
13-
"resolveJsonModule": true,
14-
"moduleResolution": "node"
10+
"noImplicitAny": false,
11+
},
12+
"ts-node": {
13+
"compilerOptions": {
14+
"module": "commonjs"
15+
}
1516
}
1617
}

0 commit comments

Comments
 (0)