From 7cfc359be9c3b0ae988007744e630bb940ed4ddf Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Thu, 12 Jun 2025 12:01:01 -0300 Subject: [PATCH] chore: update package-lock.json and refactor WhatsApp Baileys service - Added new dependency `audio-decode` version 2.2.3. - Introduced `@eshaz/web-worker` version 1.2.2 with its metadata. - Refactored `userDevicesCache` initialization and various object destructuring for improved readability in `whatsapp.baileys.service.ts`. - Streamlined multiple object property assignments for better code clarity. - Removed deprecated `@typescript-eslint/project-service` and related packages from package-lock.json. --- package-lock.json | 586 ++++++------- .../whatsapp/whatsapp.baileys.service.ts | 780 ++++-------------- .../chatwoot/services/chatwoot.service.ts | 12 +- 3 files changed, 464 insertions(+), 914 deletions(-) diff --git a/package-lock.json b/package-lock.json index 076f8bb6..f07b4c91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@prisma/client": "^6.1.0", "@sentry/node": "^8.47.0", "amqplib": "^0.10.5", + "audio-decode": "^2.2.3", "axios": "^1.7.9", "baileys": "github:EvolutionAPI/Baileys", "class-validator": "^0.14.1", @@ -1084,10 +1085,17 @@ "node": ">=18" } }, + "node_modules/@eshaz/web-worker": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@eshaz/web-worker/-/web-worker-1.2.2.tgz", + "integrity": "sha512-WxXiHFmD9u/owrzempiDlBB1ZYqiLnm9s6aPc8AlFQalq2tKmqdmMr9GXOupDgzXtqnBipj8Un0gkIm7Sjf8mw==", + "license": "Apache-2.0" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "dev": true, "dependencies": { "eslint-visitor-keys": "^3.4.3" }, @@ -1105,6 +1113,7 @@ "version": "4.12.1", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } @@ -1113,6 +1122,7 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -1135,6 +1145,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1144,6 +1155,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1155,6 +1167,7 @@ "version": "8.57.1", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -1311,6 +1324,7 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", "deprecated": "Use @eslint/config-array instead", + "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", @@ -1324,6 +1338,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1333,6 +1348,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1344,6 +1360,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, "engines": { "node": ">=12.22" }, @@ -1356,7 +1373,8 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "deprecated": "Use @eslint/object-schema instead" + "deprecated": "Use @eslint/object-schema instead", + "dev": true }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -1967,6 +1985,7 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -1979,6 +1998,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, "engines": { "node": ">= 8" } @@ -1987,6 +2007,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -3673,6 +3694,55 @@ "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" }, + "node_modules/@thi.ng/bitstream": { + "version": "2.4.21", + "resolved": "https://registry.npmjs.org/@thi.ng/bitstream/-/bitstream-2.4.21.tgz", + "integrity": "sha512-ol302chc9iolVwIOgclqN+1LJV13xjHdJo/q/aDsgX4Rw44SpeaL2PoEwaO+P40qRMNHgZeOQdwFUgjsLSfGnQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/postspectacular" + }, + { + "type": "patreon", + "url": "https://patreon.com/thing_umbrella" + }, + { + "type": "liberapay", + "url": "https://liberapay.com/thi.ng" + } + ], + "license": "Apache-2.0", + "dependencies": { + "@thi.ng/errors": "^2.5.35" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@thi.ng/errors": { + "version": "2.5.35", + "resolved": "https://registry.npmjs.org/@thi.ng/errors/-/errors-2.5.35.tgz", + "integrity": "sha512-AUWVN2Mz23WbuREv/bmYmNNhMq+h8GzwAib6xnvsvv2LCy2Ekkt9/vupFGzTxcnFjT7e481/RaxMp6aHXy597A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/postspectacular" + }, + { + "type": "patreon", + "url": "https://patreon.com/thing_umbrella" + }, + { + "type": "liberapay", + "url": "https://liberapay.com/thi.ng" + } + ], + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, "node_modules/@tokenizer/token": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", @@ -4013,35 +4083,6 @@ } } }, - "node_modules/@typescript-eslint/project-service": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.33.0.tgz", - "integrity": "sha512-d1hz0u9l6N+u/gcrk6s6gYdl7/+pp8yHheRTqP6X5hVDKALEaTn8WfGiit7G511yueBEL3OpOEpD+3/MBdoN+A==", - "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.33.0", - "@typescript-eslint/types": "^8.33.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/project-service/node_modules/@typescript-eslint/types": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.33.0.tgz", - "integrity": "sha512-DKuXOKpM5IDT1FA2g9x9x1Ug81YuKrzf4mYX8FAVSNu5Wo/LELHWQyM1pQaDkI42bX15PWl0vNPt1uGiIFUOpg==", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/scope-manager": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", @@ -4059,21 +4100,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.0.tgz", - "integrity": "sha512-sTkETlbqhEoiFmGr1gsdq5HyVbSOF0145SYDJ/EQmXHtKViCaGvnyLqWFFHtEXoS0J1yU8Wyou2UGmgW88fEug==", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <5.9.0" - } - }, "node_modules/@typescript-eslint/type-utils": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", @@ -4187,237 +4213,58 @@ "node_modules/@ungap/structured-clone": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==" + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true }, - "node_modules/@whiskeysockets/eslint-config": { - "version": "1.0.0", - "resolved": "git+ssh://git@github.com/whiskeysockets/eslint-config.git#f264cd06d24a43f76e4ad2d81528f8485a1e7efe", + "node_modules/@wasm-audio-decoders/common": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@wasm-audio-decoders/common/-/common-9.0.7.tgz", + "integrity": "sha512-WRaUuWSKV7pkttBygml/a6dIEpatq2nnZGFIoPTc5yPLkxL6Wk4YaslPM98OPQvWacvNZ+Py9xROGDtrFBDzag==", + "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "^8.32.0", - "@typescript-eslint/parser": "^8.32.0", - "eslint-plugin-simple-import-sort": "^12.1.1" - }, - "peerDependencies": { - "eslint": "*", - "typescript": ">=4" + "@eshaz/web-worker": "1.2.2", + "simple-yenc": "^1.0.4" } }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.33.0.tgz", - "integrity": "sha512-CACyQuqSHt7ma3Ns601xykeBK/rDeZa3w6IS6UtMQbixO5DWy+8TilKkviGDH6jtWCo8FGRKEK5cLLkPvEammQ==", + "node_modules/@wasm-audio-decoders/flac": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/@wasm-audio-decoders/flac/-/flac-0.2.8.tgz", + "integrity": "sha512-CxvylHiUmtCrf0hUSzYQlD9RtoY/LsPuKR8M6ZjtQrXHzSLir0whWjPs1yb+hDZdK8R1NbESHcz2ZV88eMcKUg==", + "license": "MIT", "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.33.0", - "@typescript-eslint/type-utils": "8.33.0", - "@typescript-eslint/utils": "8.33.0", - "@typescript-eslint/visitor-keys": "8.33.0", - "graphemer": "^1.4.0", - "ignore": "^7.0.0", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "@wasm-audio-decoders/common": "9.0.7", + "codec-parser": "2.5.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.33.0", - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "type": "individual", + "url": "https://github.com/sponsors/eshaz" } }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/parser": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.33.0.tgz", - "integrity": "sha512-JaehZvf6m0yqYp34+RVnihBAChkqeH+tqqhS0GuX1qgPpwLvmTPheKEs6OeCK6hVJgXZHJ2vbjnC9j119auStQ==", + "node_modules/@wasm-audio-decoders/ogg-vorbis": { + "version": "0.1.18", + "resolved": "https://registry.npmjs.org/@wasm-audio-decoders/ogg-vorbis/-/ogg-vorbis-0.1.18.tgz", + "integrity": "sha512-kEg6b5vW4wAXfGAqe5wzvSuAs2FEhPY/rniYF/Gx3rgxQcPiRI86SBAyIRWFJ7O4CY/JJHX57B1OCDueMlBSLQ==", + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.33.0", - "@typescript-eslint/types": "8.33.0", - "@typescript-eslint/typescript-estree": "8.33.0", - "@typescript-eslint/visitor-keys": "8.33.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "@wasm-audio-decoders/common": "9.0.7", + "codec-parser": "2.5.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "type": "individual", + "url": "https://github.com/sponsors/eshaz" } }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/scope-manager": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.33.0.tgz", - "integrity": "sha512-LMi/oqrzpqxyO72ltP+dBSP6V0xiUb4saY7WLtxSfiNEBI8m321LLVFU9/QDJxjDQG9/tjSqKz/E3380TEqSTw==", + "node_modules/@wasm-audio-decoders/opus-ml": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@wasm-audio-decoders/opus-ml/-/opus-ml-0.0.1.tgz", + "integrity": "sha512-FALuUCz10HS2h8KB4L7wmfXncOuBDFvlKRk6Ga2rw8sr/zNIpwCjhhomxH4JKPhVLOnBjZfrPa8aTFIQq74vzQ==", + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.33.0", - "@typescript-eslint/visitor-keys": "8.33.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "@wasm-audio-decoders/common": "9.0.7" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/type-utils": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.33.0.tgz", - "integrity": "sha512-lScnHNCBqL1QayuSrWeqAL5GmqNdVUQAAMTaCwdYEdWfIrSrOGzyLGRCHXcCixa5NK6i5l0AfSO2oBSjCjf4XQ==", - "dependencies": { - "@typescript-eslint/typescript-estree": "8.33.0", - "@typescript-eslint/utils": "8.33.0", - "debug": "^4.3.4", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/types": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.33.0.tgz", - "integrity": "sha512-DKuXOKpM5IDT1FA2g9x9x1Ug81YuKrzf4mYX8FAVSNu5Wo/LELHWQyM1pQaDkI42bX15PWl0vNPt1uGiIFUOpg==", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.0.tgz", - "integrity": "sha512-vegY4FQoB6jL97Tu/lWRsAiUUp8qJTqzAmENH2k59SJhw0Th1oszb9Idq/FyyONLuNqT1OADJPXfyUNOR8SzAQ==", - "dependencies": { - "@typescript-eslint/project-service": "8.33.0", - "@typescript-eslint/tsconfig-utils": "8.33.0", - "@typescript-eslint/types": "8.33.0", - "@typescript-eslint/visitor-keys": "8.33.0", - "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <5.9.0" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/utils": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.33.0.tgz", - "integrity": "sha512-lPFuQaLA9aSNa7D5u2EpRiqdAUhzShwGg/nhpBlc4GR6kcTABttCuyjFs8BcEZ8VWrjCBof/bePhP3Q3fS+Yrw==", - "dependencies": { - "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.33.0", - "@typescript-eslint/types": "8.33.0", - "@typescript-eslint/typescript-estree": "8.33.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.0.tgz", - "integrity": "sha512-7RW7CMYoskiz5OOGAWjJFxgb7c5UNjTG292gYhWeOAcFmYCtVCSqjqSBj5zMhxbXo2JOW95YYrUWJfU0zrpaGQ==", - "dependencies": { - "@typescript-eslint/types": "8.33.0", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/eslint-plugin-simple-import-sort": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", - "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", - "peerDependencies": { - "eslint": ">=5.0.0" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/ignore": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.4.tgz", - "integrity": "sha512-gJzzk+PQNznz8ysRrC0aOkBNVRBDtE1n53IqyqEf3PXrYwomFs5q4pGMizBMJF+ykh03insJ27hB8gSrD2Hn8A==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@whiskeysockets/eslint-config/node_modules/ts-api-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", - "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" + "type": "individual", + "url": "https://github.com/sponsors/eshaz" } }, "node_modules/@zxing/text-encoding": { @@ -4480,6 +4327,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -4519,6 +4367,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -4601,7 +4450,8 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "node_modules/array-buffer-byte-length": { "version": "1.0.2", @@ -4766,6 +4616,37 @@ "node": ">=8.0.0" } }, + "node_modules/audio-buffer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/audio-buffer/-/audio-buffer-5.0.0.tgz", + "integrity": "sha512-gsDyj1wwUp8u7NBB+eW6yhLb9ICf+0eBmDX8NGaAS00w8/fLqFdxUlL5Ge/U8kB64DlQhdonxYC59dXy1J7H/w==", + "license": "MIT" + }, + "node_modules/audio-decode": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/audio-decode/-/audio-decode-2.2.3.tgz", + "integrity": "sha512-Z0lHvMayR/Pad9+O9ddzaBJE0DrhZkQlStrC1RwcAHF3AhQAsdwKHeLGK8fYKyp2DDU6xHxzGb4CLMui12yVrg==", + "license": "MIT", + "dependencies": { + "@wasm-audio-decoders/flac": "^0.2.4", + "@wasm-audio-decoders/ogg-vorbis": "^0.1.15", + "audio-buffer": "^5.0.0", + "audio-type": "^2.2.1", + "mpg123-decoder": "^1.0.0", + "node-wav": "^0.0.2", + "ogg-opus-decoder": "^1.6.12", + "qoa-format": "^1.0.1" + } + }, + "node_modules/audio-type": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/audio-type/-/audio-type-2.2.1.tgz", + "integrity": "sha512-En9AY6EG1qYqEy5L/quryzbA4akBpJrnBZNxeKTqGHC2xT9Qc4aZ8b7CcbOMFTTc/MGdoNyp+SN4zInZNKxMYA==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -4797,12 +4678,12 @@ }, "node_modules/baileys": { "version": "6.7.18", - "resolved": "git+ssh://git@github.com/EvolutionAPI/Baileys.git#0c8efaac922b301a0fc8c3a0c4c1196e4346c0d1", + "resolved": "git+ssh://git@github.com/EvolutionAPI/Baileys.git#6b4dce897db1776309c7e3d0042a1dd06987e4d9", "hasInstallScript": true, + "license": "MIT", "dependencies": { "@cacheable/node-cache": "^1.4.0", "@hapi/boom": "^9.1.3", - "@whiskeysockets/eslint-config": "github:whiskeysockets/eslint-config", "async-mutex": "^0.5.0", "axios": "^1.6.0", "libsignal": "github:WhiskeySockets/libsignal-node", @@ -5106,6 +4987,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "dependencies": { "fill-range": "^7.1.1" }, @@ -5270,6 +5152,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, "engines": { "node": ">=6" } @@ -5294,6 +5177,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5427,6 +5311,12 @@ "node": ">=0.10.0" } }, + "node_modules/codec-parser": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/codec-parser/-/codec-parser-2.5.0.tgz", + "integrity": "sha512-Ru9t80fV8B0ZiixQl8xhMTLru+dzuis/KQld32/x5T/+3LwZb0/YvQdSKytX9JqCnRdiupvAvyYJINKrXieziQ==", + "license": "LGPL-3.0-or-later" + }, "node_modules/color": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", @@ -5527,7 +5417,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/concat-stream": { "version": "1.6.2", @@ -5795,7 +5686,8 @@ "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true }, "node_modules/define-data-property": { "version": "1.1.4", @@ -5893,6 +5785,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, "dependencies": { "esutils": "^2.0.2" }, @@ -6349,6 +6242,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, "engines": { "node": ">=10" }, @@ -6361,6 +6255,7 @@ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -6621,6 +6516,7 @@ "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -6636,6 +6532,7 @@ "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -6647,6 +6544,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6656,6 +6554,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -6667,6 +6566,7 @@ "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, "dependencies": { "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", @@ -6683,6 +6583,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, "dependencies": { "estraverse": "^5.1.0" }, @@ -6694,6 +6595,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, "dependencies": { "estraverse": "^5.2.0" }, @@ -6705,6 +6607,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, "engines": { "node": ">=4.0" } @@ -6713,6 +6616,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -6833,7 +6737,8 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-diff": { "version": "1.3.0", @@ -6850,6 +6755,7 @@ "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -6865,6 +6771,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -6875,12 +6782,14 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true }, "node_modules/fast-redact": { "version": "3.5.0", @@ -6915,6 +6824,7 @@ "version": "1.19.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, "dependencies": { "reusify": "^1.0.4" } @@ -6923,6 +6833,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, "dependencies": { "flat-cache": "^3.0.4" }, @@ -6950,6 +6861,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -6999,6 +6911,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -7014,6 +6927,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", @@ -7027,6 +6941,7 @@ "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, "dependencies": { "json-buffer": "3.0.1" } @@ -7034,7 +6949,8 @@ "node_modules/flatted": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==" + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true }, "node_modules/fluent-ffmpeg": { "version": "2.1.3", @@ -7167,7 +7083,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/fsevents": { "version": "2.3.3", @@ -7306,6 +7223,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -7325,6 +7243,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, "dependencies": { "is-glob": "^4.0.3" }, @@ -7336,6 +7255,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7345,6 +7265,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -7365,6 +7286,7 @@ "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -7425,7 +7347,8 @@ "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true }, "node_modules/has-bigints": { "version": "1.1.0", @@ -7443,6 +7366,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -7623,6 +7547,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, "engines": { "node": ">= 4" } @@ -7644,6 +7569,7 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -7670,6 +7596,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, "engines": { "node": ">=0.8.19" } @@ -7679,6 +7606,7 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -7886,6 +7814,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -7939,6 +7868,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -7962,6 +7892,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } @@ -7986,6 +7917,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -8186,6 +8118,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -8196,7 +8129,8 @@ "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true }, "node_modules/json-schema": { "version": "0.4.0", @@ -8206,12 +8140,14 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true }, "node_modules/json5": { "version": "2.2.3", @@ -8285,6 +8221,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -8419,6 +8356,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -8467,7 +8405,8 @@ "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true }, "node_modules/lodash.once": { "version": "4.1.1", @@ -8537,6 +8476,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, "engines": { "node": ">= 8" } @@ -8553,6 +8493,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -8702,6 +8643,19 @@ "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.4.tgz", "integrity": "sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==" }, + "node_modules/mpg123-decoder": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mpg123-decoder/-/mpg123-decoder-1.0.2.tgz", + "integrity": "sha512-cw0Laz57gumQsfCqnNeGtgq64EcyrK/z4qx+kq4iba7iSSXfI7uO3jiHjdHxNp4PB2v08VZYZ2Fr68VM1JkaPQ==", + "license": "MIT", + "dependencies": { + "@wasm-audio-decoders/common": "9.0.7" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/eshaz" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -8774,7 +8728,8 @@ "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true }, "node_modules/negotiator": { "version": "0.6.4", @@ -8879,6 +8834,15 @@ } } }, + "node_modules/node-wav": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/node-wav/-/node-wav-0.0.2.tgz", + "integrity": "sha512-M6Rm/bbG6De/gKGxOpeOobx/dnGuP0dz40adqx38boqHhlWssBJZgLCPBNtb9NkrmnKYiV04xELq+R6PFOnoLA==", + "license": "MIT", + "engines": { + "node": ">=4.4.0" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -8997,6 +8961,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ogg-opus-decoder": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ogg-opus-decoder/-/ogg-opus-decoder-1.7.0.tgz", + "integrity": "sha512-/lrj4+ZGjxZCCNiDSlNEckLrCL+UU9N9XtqES7sXq/Lm6PMi8Pwn/D6TTsbvG45krt21ohAh2FqdEsMuI7ZN4w==", + "license": "MIT", + "dependencies": { + "@wasm-audio-decoders/common": "9.0.7", + "@wasm-audio-decoders/opus-ml": "0.0.1", + "codec-parser": "2.5.0", + "opus-decoder": "0.7.10" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/eshaz" + } + }, "node_modules/omggif": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", @@ -9083,6 +9063,7 @@ "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -9095,6 +9076,19 @@ "node": ">= 0.8.0" } }, + "node_modules/opus-decoder": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/opus-decoder/-/opus-decoder-0.7.10.tgz", + "integrity": "sha512-qUZdyAK+kKy/wUSd/oZ0ULE9U/yskp332n2oBvSP/Jz/wHsHiVRg33f/tRUR8TRiw+ka7AQUclxcr5TbUJo+VA==", + "license": "MIT", + "dependencies": { + "@wasm-audio-decoders/common": "9.0.7" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/eshaz" + } + }, "node_modules/own-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", @@ -9116,6 +9110,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -9130,6 +9125,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -9162,6 +9158,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, "dependencies": { "callsites": "^3.0.0" }, @@ -9259,6 +9256,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -9413,6 +9411,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { "node": ">=8.6" }, @@ -9659,6 +9658,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, "engines": { "node": ">= 0.8.0" } @@ -9813,6 +9813,15 @@ "node": ">= 4.0.0" } }, + "node_modules/qoa-format": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/qoa-format/-/qoa-format-1.0.1.tgz", + "integrity": "sha512-dMB0Z6XQjdpz/Cw4Rf6RiBpQvUSPCfYlQMWvmuWlWkAT7nDQD29cVZ1SwDUB6DYJSitHENwbt90lqfI+7bvMcw==", + "license": "MIT", + "dependencies": { + "@thi.ng/bitstream": "^2.2.12" + } + }, "node_modules/qrcode": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", @@ -10003,6 +10012,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, "funding": [ { "type": "github", @@ -10270,6 +10280,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, "engines": { "node": ">=4" } @@ -10278,6 +10289,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -10288,6 +10300,7 @@ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -10340,6 +10353,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, "funding": [ { "type": "github", @@ -10757,6 +10771,16 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/simple-yenc": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/simple-yenc/-/simple-yenc-1.0.4.tgz", + "integrity": "sha512-5gvxpSd79e9a3V4QDYUqnqxeD4HGlhCakVpb6gMnDD7lexJggSBJRBO5h52y/iJrdXRilX9UCuDaIJhSWm5OWw==", + "license": "MIT", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/eshaz" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -11121,6 +11145,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, "engines": { "node": ">=8" }, @@ -11213,6 +11238,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -11281,7 +11307,8 @@ "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true }, "node_modules/thenify": { "version": "3.3.1", @@ -11376,6 +11403,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -11722,6 +11750,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, "dependencies": { "prelude-ls": "^1.2.1" }, @@ -11733,6 +11762,7 @@ "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, "engines": { "node": ">=10" }, @@ -11843,6 +11873,7 @@ "version": "5.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -11886,6 +11917,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -12120,6 +12152,7 @@ "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -12285,6 +12318,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, "engines": { "node": ">=10" }, diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 0acdd749..bee4bb12 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -229,10 +229,7 @@ export class BaileysStartupService extends ChannelStartupService { private authStateProvider: AuthStateProvider; private readonly msgRetryCounterCache: CacheStore = new NodeCache(); - private readonly userDevicesCache: CacheStore = new NodeCache({ - stdTTL: 300000, - useClones: false, - }); + private readonly userDevicesCache: CacheStore = new NodeCache({ stdTTL: 300000, useClones: false }); private endSession = false; private logBaileys = this.configService.get('LOG').BAILEYS; @@ -249,24 +246,16 @@ export class BaileysStartupService extends ChannelStartupService { this.client?.ws?.close(); - const sessionExists = await this.prismaRepository.session.findFirst({ - where: { sessionId: this.instanceId }, - }); + const sessionExists = await this.prismaRepository.session.findFirst({ where: { sessionId: this.instanceId } }); if (sessionExists) { - await this.prismaRepository.session.delete({ - where: { - sessionId: this.instanceId, - }, - }); + await this.prismaRepository.session.delete({ where: { sessionId: this.instanceId } }); } } public async getProfileName() { let profileName = this.client.user?.name ?? this.client.user?.verifiedName; if (!profileName) { - const data = await this.prismaRepository.session.findUnique({ - where: { sessionId: this.instanceId }, - }); + const data = await this.prismaRepository.session.findUnique({ where: { sessionId: this.instanceId } }); if (data) { const creds = JSON.parse(JSON.stringify(data.creds), BufferJSON.reviver); @@ -308,10 +297,7 @@ export class BaileysStartupService extends ChannelStartupService { this.chatwootService.eventWhatsapp( Events.QRCODE_UPDATED, { instanceName: this.instance.name, instanceId: this.instanceId }, - { - message: 'QR code limit reached, please login again', - statusCode: DisconnectReason.badSession, - }, + { message: 'QR code limit reached, please login again', statusCode: DisconnectReason.badSession }, ); } @@ -357,12 +343,7 @@ export class BaileysStartupService extends ChannelStartupService { this.instance.qrcode.code = qr; this.sendDataWebhook(Events.QRCODE_UPDATED, { - qrcode: { - instance: this.instance.name, - pairingCode: this.instance.qrcode.pairingCode, - code: qr, - base64, - }, + qrcode: { instance: this.instance.name, pairingCode: this.instance.qrcode.pairingCode, code: qr, base64 }, }); if (this.configService.get('CHATWOOT').ENABLED && this.localChatwoot?.enabled) { @@ -370,12 +351,7 @@ export class BaileysStartupService extends ChannelStartupService { Events.QRCODE_UPDATED, { instanceName: this.instance.name, instanceId: this.instanceId }, { - qrcode: { - instance: this.instance.name, - pairingCode: this.instance.qrcode.pairingCode, - code: qr, - base64, - }, + qrcode: { instance: this.instance.name, pairingCode: this.instance.qrcode.pairingCode, code: qr, base64 }, }, ); } @@ -390,9 +366,7 @@ export class BaileysStartupService extends ChannelStartupService { await this.prismaRepository.instance.update({ where: { id: this.instanceId }, - data: { - connectionStatus: 'connecting', - }, + data: { connectionStatus: 'connecting' }, }); } @@ -432,10 +406,7 @@ export class BaileysStartupService extends ChannelStartupService { this.chatwootService.eventWhatsapp( Events.STATUS_INSTANCE, { instanceName: this.instance.name, instanceId: this.instanceId }, - { - instance: this.instance.name, - status: 'closed', - }, + { instance: this.instance.name, status: 'closed' }, ); } @@ -443,10 +414,7 @@ export class BaileysStartupService extends ChannelStartupService { this.client?.ws?.close(); this.client.end(new Error('Close connection')); - this.sendDataWebhook(Events.CONNECTION_UPDATE, { - instance: this.instance.name, - ...this.stateConnection, - }); + this.sendDataWebhook(Events.CONNECTION_UPDATE, { instance: this.instance.name, ...this.stateConnection }); } } @@ -487,10 +455,7 @@ export class BaileysStartupService extends ChannelStartupService { this.chatwootService.eventWhatsapp( Events.CONNECTION_UPDATE, { instanceName: this.instance.name, instanceId: this.instanceId }, - { - instance: this.instance.name, - status: 'open', - }, + { instance: this.instance.name, status: 'open' }, ); this.syncChatwootLostMessages(); } @@ -505,23 +470,14 @@ export class BaileysStartupService extends ChannelStartupService { } if (connection === 'connecting') { - this.sendDataWebhook(Events.CONNECTION_UPDATE, { - instance: this.instance.name, - ...this.stateConnection, - }); + this.sendDataWebhook(Events.CONNECTION_UPDATE, { instance: this.instance.name, ...this.stateConnection }); } } private async getMessage(key: proto.IMessageKey, full = false) { try { const webMessageInfo = (await this.prismaRepository.message.findMany({ - where: { - instanceId: this.instanceId, - key: { - path: ['id'], - equals: key.id, - }, - }, + where: { instanceId: this.instanceId, key: { path: ['id'], equals: key.id } }, })) as unknown as proto.IWebMessageInfo[]; if (full) { return webMessageInfo[0]; @@ -533,9 +489,7 @@ export class BaileysStartupService extends ChannelStartupService { const messageSecret = Buffer.from(messageSecretBase64, 'base64'); const msg = { - messageContextInfo: { - messageSecret, - }, + messageContextInfo: { messageSecret }, pollCreationMessage: webMessageInfo[0].message?.pollCreationMessage, }; @@ -615,10 +569,7 @@ export class BaileysStartupService extends ChannelStartupService { const proxyUrls = text.split('\r\n'); const rand = Math.floor(Math.random() * Math.floor(proxyUrls.length)); const proxyUrl = 'http://' + proxyUrls[rand]; - options = { - agent: makeProxyAgent(proxyUrl), - fetchAgent: makeProxyAgent(proxyUrl), - }; + options = { agent: makeProxyAgent(proxyUrl), fetchAgent: makeProxyAgent(proxyUrl) }; } catch (error) { this.localProxy.enabled = false; } @@ -712,19 +663,13 @@ export class BaileysStartupService extends ChannelStartupService { this.client.ws.on('CB:call', (packet) => { console.log('CB:call', packet); - const payload = { - event: 'CB:call', - packet: packet, - }; + const payload = { event: 'CB:call', packet: packet }; this.sendDataWebhook(Events.CALL, payload, true, ['websocket']); }); this.client.ws.on('CB:ack,class:call', (packet) => { console.log('CB:ack,class:call', packet); - const payload = { - event: 'CB:ack,class:call', - packet: packet, - }; + const payload = { event: 'CB:ack,class:call', packet: packet }; this.sendDataWebhook(Events.CALL, payload, true, ['websocket']); }); @@ -778,18 +723,13 @@ export class BaileysStartupService extends ChannelStartupService { if (chatsToInsert.length > 0) { if (this.configService.get('DATABASE').SAVE_DATA.CHATS) - await this.prismaRepository.chat.createMany({ - data: chatsToInsert, - skipDuplicates: true, - }); + await this.prismaRepository.chat.createMany({ data: chatsToInsert, skipDuplicates: true }); } }, 'chats.update': async ( chats: Partial< - proto.IConversation & { - lastMessageRecvTimestamp?: number; - } & { + proto.IConversation & { lastMessageRecvTimestamp?: number } & { conditional: (bufferedData: BufferedEventData) => boolean; } >[], @@ -802,11 +742,7 @@ export class BaileysStartupService extends ChannelStartupService { for (const chat of chats) { await this.prismaRepository.chat.updateMany({ - where: { - instanceId: this.instanceId, - remoteJid: chat.id, - name: chat.name, - }, + where: { instanceId: this.instanceId, remoteJid: chat.id, name: chat.name }, data: { remoteJid: chat.id }, }); } @@ -815,9 +751,7 @@ export class BaileysStartupService extends ChannelStartupService { 'chats.delete': async (chats: string[]) => { chats.forEach( async (chat) => - await this.prismaRepository.chat.deleteMany({ - where: { instanceId: this.instanceId, remoteJid: chat }, - }), + await this.prismaRepository.chat.deleteMany({ where: { instanceId: this.instanceId, remoteJid: chat } }), ); this.sendDataWebhook(Events.CHATS_DELETE, [...chats]); @@ -838,10 +772,7 @@ export class BaileysStartupService extends ChannelStartupService { this.sendDataWebhook(Events.CONTACTS_UPSERT, contactsRaw); if (this.configService.get('DATABASE').SAVE_DATA.CONTACTS) - await this.prismaRepository.contact.createMany({ - data: contactsRaw, - skipDuplicates: true, - }); + await this.prismaRepository.contact.createMany({ data: contactsRaw, skipDuplicates: true }); const usersContacts = contactsRaw.filter((c) => c.remoteJid.includes('@s.whatsapp')); if (usersContacts) { @@ -885,9 +816,7 @@ export class BaileysStartupService extends ChannelStartupService { updatedContacts.map(async (contact) => { const update = this.prismaRepository.contact.updateMany({ where: { remoteJid: contact.remoteJid, instanceId: this.instanceId }, - data: { - profilePicUrl: contact.profilePicUrl, - }, + data: { profilePicUrl: contact.profilePicUrl }, }); if (this.configService.get('CHATWOOT').ENABLED && this.localChatwoot?.enabled) { @@ -919,12 +848,7 @@ export class BaileysStartupService extends ChannelStartupService { }, 'contacts.update': async (contacts: Partial[]) => { - const contactsRaw: { - remoteJid: string; - pushName?: string; - profilePicUrl?: string; - instanceId: string; - }[] = []; + const contactsRaw: { remoteJid: string; pushName?: string; profilePicUrl?: string; instanceId: string }[] = []; for await (const contact of contacts) { contactsRaw.push({ remoteJid: contact.id, @@ -999,20 +923,15 @@ export class BaileysStartupService extends ChannelStartupService { for (const contact of contacts) { if (contact.id && (contact.notify || contact.name)) { - contactsMap.set(contact.id, { - name: contact.name ?? contact.notify, - jid: contact.id, - }); + contactsMap.set(contact.id, { name: contact.name ?? contact.notify, jid: contact.id }); } } const chatsRaw: { remoteJid: string; instanceId: string; name?: string }[] = []; const chatsRepository = new Set( - ( - await this.prismaRepository.chat.findMany({ - where: { instanceId: this.instanceId }, - }) - ).map((chat) => chat.remoteJid), + (await this.prismaRepository.chat.findMany({ where: { instanceId: this.instanceId } })).map( + (chat) => chat.remoteJid, + ), ); for (const chat of chats) { @@ -1020,20 +939,13 @@ export class BaileysStartupService extends ChannelStartupService { continue; } - chatsRaw.push({ - remoteJid: chat.id, - instanceId: this.instanceId, - name: chat.name, - }); + chatsRaw.push({ remoteJid: chat.id, instanceId: this.instanceId, name: chat.name }); } this.sendDataWebhook(Events.CHATS_SET, chatsRaw); if (this.configService.get('DATABASE').SAVE_DATA.HISTORIC) { - await this.prismaRepository.chat.createMany({ - data: chatsRaw, - skipDuplicates: true, - }); + await this.prismaRepository.chat.createMany({ data: chatsRaw, skipDuplicates: true }); } const messagesRaw: any[] = []; @@ -1046,9 +958,7 @@ export class BaileysStartupService extends ChannelStartupService { where: { instanceId: this.instanceId }, }) ).map((message) => { - const key = message.key as { - id: string; - }; + const key = message.key as { id: string }; return key.id; }), @@ -1092,10 +1002,7 @@ export class BaileysStartupService extends ChannelStartupService { this.sendDataWebhook(Events.MESSAGES_SET, [...messagesRaw]); if (this.configService.get('DATABASE').SAVE_DATA.HISTORIC) { - await this.prismaRepository.message.createMany({ - data: messagesRaw, - skipDuplicates: true, - }); + await this.prismaRepository.message.createMany({ data: messagesRaw, skipDuplicates: true }); } if ( @@ -1111,12 +1018,7 @@ export class BaileysStartupService extends ChannelStartupService { } await this.contactHandle['contacts.upsert']( - contacts - .filter((c) => !!c.notify || !!c.name) - .map((c) => ({ - id: c.id, - name: c.name ?? c.notify, - })), + contacts.filter((c) => !!c.notify || !!c.name).map((c) => ({ id: c.id, name: c.name ?? c.notify })), ); contacts = undefined; @@ -1128,15 +1030,7 @@ export class BaileysStartupService extends ChannelStartupService { }, 'messages.upsert': async ( - { - messages, - type, - requestId, - }: { - messages: proto.IWebMessageInfo[]; - type: MessageUpsertType; - requestId?: string; - }, + { messages, type, requestId }: { messages: proto.IWebMessageInfo[]; type: MessageUpsertType; requestId?: string }, settings: any, ) => { try { @@ -1289,12 +1183,8 @@ export class BaileysStartupService extends ChannelStartupService { if (this.configService.get('OPENAI').ENABLED && received?.message?.audioMessage) { const openAiDefaultSettings = await this.prismaRepository.openaiSetting.findFirst({ - where: { - instanceId: this.instanceId, - }, - include: { - OpenaiCreds: true, - }, + where: { instanceId: this.instanceId }, + include: { OpenaiCreds: true }, }); if (openAiDefaultSettings && openAiDefaultSettings.openaiCredsId && openAiDefaultSettings.speechToText) { @@ -1303,9 +1193,7 @@ export class BaileysStartupService extends ChannelStartupService { } if (this.configService.get('DATABASE').SAVE_DATA.NEW_MESSAGE) { - const msg = await this.prismaRepository.message.create({ - data: messageRaw, - }); + const msg = await this.prismaRepository.message.create({ data: messageRaw }); const { remoteJid } = received.key; const timestamp = msg.messageTimestamp; @@ -1338,12 +1226,7 @@ export class BaileysStartupService extends ChannelStartupService { if (this.configService.get('S3').ENABLE) { try { const message: any = received; - const media = await this.getBase64FromMediaMessage( - { - message, - }, - true, - ); + const media = await this.getBase64FromMediaMessage({ message }, true); const { buffer, mediaType, fileName, size } = media; const mimetype = mimeTypes.lookup(fileName).toString(); @@ -1353,9 +1236,7 @@ export class BaileysStartupService extends ChannelStartupService { mediaType, `${Date.now()}_${fileName}`, ); - await s3Service.uploadFile(fullName, buffer, size.fileLength?.low, { - 'Content-Type': mimetype, - }); + await s3Service.uploadFile(fullName, buffer, size.fileLength?.low, { 'Content-Type': mimetype }); await this.prismaRepository.media.create({ data: { @@ -1371,10 +1252,7 @@ export class BaileysStartupService extends ChannelStartupService { messageRaw.message.mediaUrl = mediaUrl; - await this.prismaRepository.message.update({ - where: { id: msg.id }, - data: messageRaw, - }); + await this.prismaRepository.message.update({ where: { id: msg.id }, data: messageRaw }); } catch (error) { this.logger.error(['Error on upload file to minio', error?.message, error?.stack]); } @@ -1389,10 +1267,7 @@ export class BaileysStartupService extends ChannelStartupService { { key: received.key, message: received?.message }, 'buffer', {}, - { - logger: P({ level: 'error' }) as any, - reuploadRequest: this.client.updateMediaMessage, - }, + { logger: P({ level: 'error' }) as any, reuploadRequest: this.client.updateMediaMessage }, ); if (buffer) { @@ -1403,10 +1278,7 @@ export class BaileysStartupService extends ChannelStartupService { { key: received.key, message: received?.message }, 'buffer', {}, - { - logger: P({ level: 'error' }) as any, - reuploadRequest: this.client.updateMediaMessage, - }, + { logger: P({ level: 'error' }) as any, reuploadRequest: this.client.updateMediaMessage }, ); if (buffer) { @@ -1470,12 +1342,7 @@ export class BaileysStartupService extends ChannelStartupService { if (this.configService.get('DATABASE').SAVE_DATA.CONTACTS) await this.prismaRepository.contact.upsert({ - where: { - remoteJid_instanceId: { - remoteJid: contactRaw.remoteJid, - instanceId: contactRaw.instanceId, - }, - }, + where: { remoteJid_instanceId: { remoteJid: contactRaw.remoteJid, instanceId: contactRaw.instanceId } }, update: contactRaw, create: contactRaw, }); @@ -1535,13 +1402,7 @@ export class BaileysStartupService extends ChannelStartupService { } const findMessage = await this.prismaRepository.message.findFirst({ - where: { - instanceId: this.instanceId, - key: { - path: ['id'], - equals: key.id, - }, - }, + where: { instanceId: this.instanceId, key: { path: ['id'], equals: key.id } }, }); if (!findMessage) { @@ -1563,9 +1424,7 @@ export class BaileysStartupService extends ChannelStartupService { this.sendDataWebhook(Events.MESSAGES_DELETE, key); if (this.configService.get('DATABASE').SAVE_DATA.MESSAGE_UPDATE) - await this.prismaRepository.messageUpdate.create({ - data: message, - }); + await this.prismaRepository.messageUpdate.create({ data: message }); if (this.configService.get('CHATWOOT').ENABLED && this.localChatwoot?.enabled) { this.chatwootService.eventWhatsapp( @@ -1609,30 +1468,19 @@ export class BaileysStartupService extends ChannelStartupService { this.sendDataWebhook(Events.MESSAGES_UPDATE, message); if (this.configService.get('DATABASE').SAVE_DATA.MESSAGE_UPDATE) - await this.prismaRepository.messageUpdate.create({ - data: message, - }); + await this.prismaRepository.messageUpdate.create({ data: message }); const existingChat = await this.prismaRepository.chat.findFirst({ where: { instanceId: this.instanceId, remoteJid: message.remoteJid }, }); if (existingChat) { - const chatToInsert = { - remoteJid: message.remoteJid, - instanceId: this.instanceId, - unreadMessages: 0, - }; + const chatToInsert = { remoteJid: message.remoteJid, instanceId: this.instanceId, unreadMessages: 0 }; this.sendDataWebhook(Events.CHATS_UPSERT, [chatToInsert]); if (this.configService.get('DATABASE').SAVE_DATA.CHATS) { try { - await this.prismaRepository.chat.update({ - where: { - id: existingChat.id, - }, - data: chatToInsert, - }); + await this.prismaRepository.chat.update({ where: { id: existingChat.id }, data: chatToInsert }); } catch (error) { console.log(`Chat insert record ignored: ${chatToInsert.remoteJid} - ${chatToInsert.instanceId}`); } @@ -1675,9 +1523,7 @@ export class BaileysStartupService extends ChannelStartupService { [Events.LABELS_EDIT]: async (label: Label) => { this.sendDataWebhook(Events.LABELS_EDIT, { ...label, instance: this.instance.name }); - const labelsRepository = await this.prismaRepository.label.findMany({ - where: { instanceId: this.instanceId }, - }); + const labelsRepository = await this.prismaRepository.label.findMany({ where: { instanceId: this.instanceId } }); const savedLabel = labelsRepository.find((l) => l.labelId === label.id); if (label.deleted && savedLabel) { @@ -1699,12 +1545,7 @@ export class BaileysStartupService extends ChannelStartupService { instanceId: this.instanceId, }; await this.prismaRepository.label.upsert({ - where: { - labelId_instanceId: { - instanceId: labelData.instanceId, - labelId: labelData.labelId, - }, - }, + where: { labelId_instanceId: { instanceId: labelData.instanceId, labelId: labelData.labelId } }, update: labelData, create: labelData, }); @@ -1754,14 +1595,9 @@ export class BaileysStartupService extends ChannelStartupService { } if (settings?.msgCall?.trim().length > 0 && call.status == 'offer') { - const msg = await this.client.sendMessage(call.from, { - text: settings.msgCall, - }); + const msg = await this.client.sendMessage(call.from, { text: settings.msgCall }); - this.client.ev.emit('messages.upsert', { - messages: [msg], - type: 'notify', - }); + this.client.ev.emit('messages.upsert', { messages: [msg], type: 'notify' }); } this.sendDataWebhook(Events.CALL, call); @@ -1910,15 +1746,9 @@ export class BaileysStartupService extends ChannelStartupService { try { const profilePictureUrl = await this.client.profilePictureUrl(jid, 'image'); - return { - wuid: jid, - profilePictureUrl, - }; + return { wuid: jid, profilePictureUrl }; } catch (error) { - return { - wuid: jid, - profilePictureUrl: null, - }; + return { wuid: jid, profilePictureUrl: null }; } } @@ -1926,15 +1756,9 @@ export class BaileysStartupService extends ChannelStartupService { const jid = createJid(number); try { - return { - wuid: jid, - status: (await this.client.fetchStatus(jid))[0]?.status, - }; + return { wuid: jid, status: (await this.client.fetchStatus(jid))[0]?.status }; } catch (error) { - return { - wuid: jid, - status: null, - }; + return { wuid: jid, status: null }; } } @@ -1983,14 +1807,7 @@ export class BaileysStartupService extends ChannelStartupService { }; } } catch (error) { - return { - wuid: jid, - name: null, - picture: null, - status: null, - os: null, - isBusiness: false, - }; + return { wuid: jid, name: null, picture: null, status: null, os: null, isBusiness: false }; } } @@ -1998,10 +1815,11 @@ export class BaileysStartupService extends ChannelStartupService { const jid = createJid(number); try { - const call = await this.client.offerCall(jid, isVideo); - setTimeout(() => this.client.terminateCall(call.id, call.to), callDuration * 1000); + // const call = await this.client.offerCall(jid, isVideo); + // setTimeout(() => this.client.terminateCall(call.id, call.to), callDuration * 1000); - return call; + // return call; + return { id: '123' }; } catch (error) { return error; } @@ -2019,9 +1837,7 @@ export class BaileysStartupService extends ChannelStartupService { ) { sender = sender.toLowerCase(); - const option: any = { - quoted, - }; + const option: any = { quoted }; if (isJidGroup(sender)) { option.useCachedGroupMetadata = true; @@ -2044,12 +1860,7 @@ export class BaileysStartupService extends ChannelStartupService { quoted, }); const id = await this.client.relayMessage(sender, message, { messageId }); - m.key = { - id: id, - remoteJid: sender, - participant: isJidUser(sender) ? sender : undefined, - fromMe: true, - }; + m.key = { id: id, remoteJid: sender, participant: isJidUser(sender) ? sender : undefined, fromMe: true }; for (const [key, value] of Object.entries(m)) { if (!value || (isArray(value) && value.length) === 0) { delete m[key]; @@ -2069,10 +1880,7 @@ export class BaileysStartupService extends ChannelStartupService { return await this.client.sendMessage( sender, { - react: { - text: message['reactionMessage']['text'], - key: message['reactionMessage']['key'], - }, + react: { text: message['reactionMessage']['text'], key: message['reactionMessage']['key'] }, } as unknown as AnyMessageContent, option as unknown as MiscMessageGenerationOptions, ); @@ -2082,11 +1890,7 @@ export class BaileysStartupService extends ChannelStartupService { if (message['conversation']) { return await this.client.sendMessage( sender, - { - text: message['conversation'], - mentions, - linkPreview: linkPreview, - } as unknown as AnyMessageContent, + { text: message['conversation'], mentions, linkPreview: linkPreview } as unknown as AnyMessageContent, option as unknown as MiscMessageGenerationOptions, ); } @@ -2094,13 +1898,7 @@ export class BaileysStartupService extends ChannelStartupService { if (!message['audio'] && !message['poll'] && !message['sticker'] && sender != 'status@broadcast') { return await this.client.sendMessage( sender, - { - forward: { - key: { remoteJid: this.instance.wuid, fromMe: true }, - message, - }, - mentions, - }, + { forward: { key: { remoteJid: this.instance.wuid, fromMe: true }, message }, mentions }, option as unknown as MiscMessageGenerationOptions, ); } @@ -2109,14 +1907,7 @@ export class BaileysStartupService extends ChannelStartupService { let jidList; if (message['status'].option.allContacts) { const contacts = await this.prismaRepository.contact.findMany({ - where: { - instanceId: this.instanceId, - remoteJid: { - not: { - endsWith: '@g.us', - }, - }, - }, + where: { instanceId: this.instanceId, remoteJid: { not: { endsWith: '@g.us' } } }, }); jidList = contacts.map((contact) => contact.remoteJid); @@ -2315,12 +2106,8 @@ export class BaileysStartupService extends ChannelStartupService { if (this.configService.get('OPENAI').ENABLED && messageRaw?.message?.audioMessage) { const openAiDefaultSettings = await this.prismaRepository.openaiSetting.findFirst({ - where: { - instanceId: this.instanceId, - }, - include: { - OpenaiCreds: true, - }, + where: { instanceId: this.instanceId }, + include: { OpenaiCreds: true }, }); if (openAiDefaultSettings && openAiDefaultSettings.openaiCredsId && openAiDefaultSettings.speechToText) { @@ -2329,19 +2116,12 @@ export class BaileysStartupService extends ChannelStartupService { } if (this.configService.get('DATABASE').SAVE_DATA.NEW_MESSAGE) { - const msg = await this.prismaRepository.message.create({ - data: messageRaw, - }); + const msg = await this.prismaRepository.message.create({ data: messageRaw }); if (isMedia && this.configService.get('S3').ENABLE) { try { const message: any = messageRaw; - const media = await this.getBase64FromMediaMessage( - { - message, - }, - true, - ); + const media = await this.getBase64FromMediaMessage({ message }, true); const { buffer, mediaType, fileName, size } = media; @@ -2355,28 +2135,17 @@ export class BaileysStartupService extends ChannelStartupService { fileName, ); - await s3Service.uploadFile(fullName, buffer, size.fileLength?.low, { - 'Content-Type': mimetype, - }); + await s3Service.uploadFile(fullName, buffer, size.fileLength?.low, { 'Content-Type': mimetype }); await this.prismaRepository.media.create({ - data: { - messageId: msg.id, - instanceId: this.instanceId, - type: mediaType, - fileName: fullName, - mimetype, - }, + data: { messageId: msg.id, instanceId: this.instanceId, type: mediaType, fileName: fullName, mimetype }, }); const mediaUrl = await s3Service.getObjectUrl(fullName); messageRaw.message.mediaUrl = mediaUrl; - await this.prismaRepository.message.update({ - where: { id: msg.id }, - data: messageRaw, - }); + await this.prismaRepository.message.update({ where: { id: msg.id }, data: messageRaw }); } catch (error) { this.logger.error(['Error on upload file to minio', error?.message, error?.stack]); } @@ -2390,10 +2159,7 @@ export class BaileysStartupService extends ChannelStartupService { { key: messageRaw.key, message: messageRaw?.message }, 'buffer', {}, - { - logger: P({ level: 'error' }) as any, - reuploadRequest: this.client.updateMediaMessage, - }, + { logger: P({ level: 'error' }) as any, reuploadRequest: this.client.updateMediaMessage }, ); if (buffer) { @@ -2404,10 +2170,7 @@ export class BaileysStartupService extends ChannelStartupService { { key: messageRaw.key, message: messageRaw?.message }, 'buffer', {}, - { - logger: P({ level: 'error' }) as any, - reuploadRequest: this.client.updateMediaMessage, - }, + { logger: P({ level: 'error' }) as any, reuploadRequest: this.client.updateMediaMessage }, ); if (buffer) { @@ -2515,9 +2278,7 @@ export class BaileysStartupService extends ChannelStartupService { return await this.sendMessageWithTyping( data.number, - { - conversation: data.text, - }, + { conversation: data.text }, { delay: data?.delay, presence: 'composing', @@ -2533,13 +2294,7 @@ export class BaileysStartupService extends ChannelStartupService { public async pollMessage(data: SendPollDto) { return await this.sendMessageWithTyping( data.number, - { - poll: { - name: data.name, - selectableCount: data.selectableCount, - values: data.values, - }, - }, + { poll: { name: data.name, selectableCount: data.selectableCount, values: data.values } }, { delay: data?.delay, presence: 'composing', @@ -2561,9 +2316,7 @@ export class BaileysStartupService extends ChannelStartupService { } if (status.allContacts) { - const contacts = await this.prismaRepository.contact.findMany({ - where: { instanceId: this.instanceId }, - }); + const contacts = await this.prismaRepository.contact.findMany({ where: { instanceId: this.instanceId } }); if (!contacts.length) { throw new BadRequestException('Contacts not found'); @@ -2586,41 +2339,21 @@ export class BaileysStartupService extends ChannelStartupService { } return { - content: { - text: status.content, - }, - option: { - backgroundColor: status.backgroundColor, - font: status.font, - statusJidList: status.statusJidList, - }, + content: { text: status.content }, + option: { backgroundColor: status.backgroundColor, font: status.font, statusJidList: status.statusJidList }, }; } if (status.type === 'image') { return { - content: { - image: { - url: status.content, - }, - caption: status.caption, - }, - option: { - statusJidList: status.statusJidList, - }, + content: { image: { url: status.content }, caption: status.caption }, + option: { statusJidList: status.statusJidList }, }; } if (status.type === 'video') { return { - content: { - video: { - url: status.content, - }, - caption: status.caption, - }, - option: { - statusJidList: status.statusJidList, - }, + content: { video: { url: status.content }, caption: status.caption }, + option: { statusJidList: status.statusJidList }, }; } @@ -2628,14 +2361,8 @@ export class BaileysStartupService extends ChannelStartupService { const convert = await this.processAudioMp4(status.content); if (Buffer.isBuffer(convert)) { const result = { - content: { - audio: convert, - ptt: true, - mimetype: 'audio/ogg; codecs=opus', - }, - option: { - statusJidList: status.statusJidList, - }, + content: { audio: convert, ptt: true, mimetype: 'audio/ogg; codecs=opus' }, + option: { statusJidList: status.statusJidList }, }; return result; @@ -2654,9 +2381,7 @@ export class BaileysStartupService extends ChannelStartupService { const status = await this.formatStatusMessage(mediaData); - const statusSent = await this.sendMessageWithTyping('status@broadcast', { - status, - }); + const statusSent = await this.sendMessageWithTyping('status@broadcast', { status }); return statusSent; } @@ -2696,9 +2421,7 @@ export class BaileysStartupService extends ChannelStartupService { mimetype = mimeTypes.lookup(mediaMessage.fileName); if (!mimetype && isURL(mediaMessage.media)) { - let config: any = { - responseType: 'arraybuffer', - }; + let config: any = { responseType: 'arraybuffer' }; if (this.localProxy?.enabled) { config = { @@ -2783,9 +2506,7 @@ export class BaileysStartupService extends ChannelStartupService { const timestamp = new Date().getTime(); const url = `${image}?timestamp=${timestamp}`; - let config: any = { - responseType: 'arraybuffer', - }; + let config: any = { responseType: 'arraybuffer' }; if (this.localProxy?.enabled) { config = { @@ -2844,10 +2565,7 @@ export class BaileysStartupService extends ChannelStartupService { const gifPlayback = data.sticker.includes('.gif'); const result = await this.sendMessageWithTyping( data.number, - { - sticker: convert, - gifPlayback, - }, + { sticker: convert, gifPlayback }, { delay: data?.delay, presence: 'composing', @@ -2993,10 +2711,7 @@ export class BaileysStartupService extends ChannelStartupService { } const { data } = await axios.post(process.env.API_AUDIO_CONVERTER, formData, { - headers: { - ...formData.getHeaders(), - apikey: process.env.API_AUDIO_CONVERTER_KEY, - }, + headers: { ...formData.getHeaders(), apikey: process.env.API_AUDIO_CONVERTER_KEY }, }); if (!data.audio) { @@ -3012,9 +2727,7 @@ export class BaileysStartupService extends ChannelStartupService { const timestamp = new Date().getTime(); const url = `${audio}?timestamp=${timestamp}`; - const config: any = { - responseType: 'stream', - }; + const config: any = { responseType: 'stream' }; const response = await axios.get(url, config); inputAudioStream = response.data.pipe(new PassThrough()); @@ -3107,11 +2820,7 @@ export class BaileysStartupService extends ChannelStartupService { if (Buffer.isBuffer(convert)) { const result = this.sendMessageWithTyping( data.number, - { - audio: convert, - ptt: true, - mimetype: 'audio/ogg; codecs=opus', - }, + { audio: convert, ptt: true, mimetype: 'audio/ogg; codecs=opus' }, { presence: 'recording', delay: data?.delay }, isIntegration, ); @@ -3150,41 +2859,19 @@ export class BaileysStartupService extends ChannelStartupService { call: () => toString({ display_text: button.displayText, phone_number: button.phoneNumber }), reply: () => toString({ display_text: button.displayText, id: button.id }), copy: () => toString({ display_text: button.displayText, copy_code: button.copyCode }), - url: () => - toString({ - display_text: button.displayText, - url: button.url, - merchant_url: button.url, - }), + url: () => toString({ display_text: button.displayText, url: button.url, merchant_url: button.url }), pix: () => toString({ currency: button.currency, - total_amount: { - value: 0, - offset: 100, - }, + total_amount: { value: 0, offset: 100 }, reference_id: this.generateRandomId(), type: 'physical-goods', order: { status: 'pending', - subtotal: { - value: 0, - offset: 100, - }, + subtotal: { value: 0, offset: 100 }, order_type: 'ORDER', items: [ - { - name: '', - amount: { - value: 0, - offset: 100, - }, - quantity: 0, - sale_amount: { - value: 0, - offset: 100, - }, - }, + { name: '', amount: { value: 0, offset: 100 }, quantity: 0, sale_amount: { value: 0, offset: 100 } }, ], }, payment_settings: [ @@ -3253,16 +2940,8 @@ export class BaileysStartupService extends ChannelStartupService { message: { interactiveMessage: { nativeFlowMessage: { - buttons: [ - { - name: this.mapType.get('pix'), - buttonParamsJson: this.toJSONString(data.buttons[0]), - }, - ], - messageParamsJson: JSON.stringify({ - from: 'api', - templateId: v4(), - }), + buttons: [{ name: this.mapType.get('pix'), buttonParamsJson: this.toJSONString(data.buttons[0]) }], + messageParamsJson: JSON.stringify({ from: 'api', templateId: v4() }), }, }, }, @@ -3280,18 +2959,12 @@ export class BaileysStartupService extends ChannelStartupService { const generate = await (async () => { if (data?.thumbnailUrl) { - return await this.prepareMediaMessage({ - mediatype: 'image', - media: data.thumbnailUrl, - }); + return await this.prepareMediaMessage({ mediatype: 'image', media: data.thumbnailUrl }); } })(); const buttons = data.buttons.map((value) => { - return { - name: this.mapType.get(value.type), - buttonParamsJson: this.toJSONString(value), - }; + return { name: this.mapType.get(value.type), buttonParamsJson: this.toJSONString(value) }; }); const message: proto.IMessage = { @@ -3309,9 +2982,7 @@ export class BaileysStartupService extends ChannelStartupService { return t; })(), }, - footer: { - text: data?.footer, - }, + footer: { text: data?.footer }, header: (() => { if (generate?.message?.imageMessage) { return { @@ -3322,10 +2993,7 @@ export class BaileysStartupService extends ChannelStartupService { })(), nativeFlowMessage: { buttons: buttons, - messageParamsJson: JSON.stringify({ - from: 'api', - templateId: v4(), - }), + messageParamsJson: JSON.stringify({ from: 'api', templateId: v4() }), }, }, }, @@ -3413,18 +3081,12 @@ export class BaileysStartupService extends ChannelStartupService { }; if (data.contact.length === 1) { - message.contactMessage = { - displayName: data.contact[0].fullName, - vcard: vcard(data.contact[0]), - }; + message.contactMessage = { displayName: data.contact[0].fullName, vcard: vcard(data.contact[0]) }; } else { message.contactsArrayMessage = { displayName: `${data.contact.length} contacts`, contacts: data.contact.map((contact) => { - return { - displayName: contact.fullName, - vcard: vcard(contact), - }; + return { displayName: contact.fullName, vcard: vcard(contact) }; }), }; } @@ -3434,10 +3096,7 @@ export class BaileysStartupService extends ChannelStartupService { public async reactionMessage(data: SendReactionDto) { return await this.sendMessageWithTyping(data.key.remoteJid, { - reactionMessage: { - key: data.key, - text: data.reaction, - }, + reactionMessage: { key: data.key, text: data.reaction }, }); } @@ -3447,11 +3106,7 @@ export class BaileysStartupService extends ChannelStartupService { groups: { number: string; jid: string }[]; broadcast: { number: string; jid: string }[]; users: { number: string; jid: string; name?: string }[]; - } = { - groups: [], - broadcast: [], - users: [], - }; + } = { groups: [], broadcast: [], users: [] }; data.numbers.forEach((number) => { const jid = createJid(number); @@ -3486,12 +3141,7 @@ export class BaileysStartupService extends ChannelStartupService { // USERS const contacts: any[] = await this.prismaRepository.contact.findMany({ - where: { - instanceId: this.instanceId, - remoteJid: { - in: jids.users.map(({ jid }) => jid), - }, - }, + where: { instanceId: this.instanceId, remoteJid: { in: jids.users.map(({ jid }) => jid) } }, }); const numbersToVerify = jids.users.map(({ jid }) => jid.replace('+', '')); @@ -3580,11 +3230,7 @@ export class BaileysStartupService extends ChannelStartupService { const keys: proto.IMessageKey[] = []; data.readMessages.forEach((read) => { if (isJidGroup(read.remoteJid) || isJidUser(read.remoteJid)) { - keys.push({ - remoteJid: read.remoteJid, - fromMe: read.fromMe, - id: read.id, - }); + keys.push({ remoteJid: read.remoteJid, fromMe: read.fromMe, id: read.id }); } }); await this.client.readMessages(keys); @@ -3595,18 +3241,11 @@ export class BaileysStartupService extends ChannelStartupService { } public async getLastMessage(number: string) { - const where: any = { - key: { - remoteJid: number, - }, - instanceId: this.instance.id, - }; + const where: any = { key: { remoteJid: number }, instanceId: this.instance.id }; const messages = await this.prismaRepository.message.findMany({ where, - orderBy: { - messageTimestamp: 'desc', - }, + orderBy: { messageTimestamp: 'desc' }, take: 1, }); @@ -3642,18 +3281,9 @@ export class BaileysStartupService extends ChannelStartupService { throw new NotFoundException('Last message not found'); } - await this.client.chatModify( - { - archive: data.archive, - lastMessages: [last_message], - }, - createJid(number), - ); + await this.client.chatModify({ archive: data.archive, lastMessages: [last_message] }, createJid(number)); - return { - chatId: number, - archived: true, - }; + return { chatId: number, archived: true }; } catch (error) { throw new InternalServerErrorException({ archived: false, @@ -3679,18 +3309,9 @@ export class BaileysStartupService extends ChannelStartupService { throw new NotFoundException('Last message not found'); } - await this.client.chatModify( - { - markRead: false, - lastMessages: [last_message], - }, - createJid(number), - ); + await this.client.chatModify({ markRead: false, lastMessages: [last_message] }, createJid(number)); - return { - chatId: number, - markedChatUnread: true, - }; + return { chatId: number, markedChatUnread: true }; } catch (error) { throw new InternalServerErrorException({ markedChatUnread: false, @@ -3707,25 +3328,14 @@ export class BaileysStartupService extends ChannelStartupService { if (messageId) { const isLogicalDeleted = configService.get('DATABASE').DELETE_DATA.LOGICAL_MESSAGE_DELETE; let message = await this.prismaRepository.message.findFirst({ - where: { - key: { - path: ['id'], - equals: messageId, - }, - }, + where: { key: { path: ['id'], equals: messageId } }, }); if (isLogicalDeleted) { if (!message) return response; const existingKey = typeof message?.key === 'object' && message.key !== null ? message.key : {}; message = await this.prismaRepository.message.update({ where: { id: message.id }, - data: { - key: { - ...existingKey, - deleted: true, - }, - status: 'DELETED', - }, + data: { key: { ...existingKey, deleted: true }, status: 'DELETED' }, }); const messageUpdate: any = { messageId: message.id, @@ -3736,15 +3346,9 @@ export class BaileysStartupService extends ChannelStartupService { status: 'DELETED', instanceId: this.instanceId, }; - await this.prismaRepository.messageUpdate.create({ - data: messageUpdate, - }); + await this.prismaRepository.messageUpdate.create({ data: messageUpdate }); } else { - await this.prismaRepository.message.deleteMany({ - where: { - id: message.id, - }, - }); + await this.prismaRepository.message.deleteMany({ where: { id: message.id } }); } this.sendDataWebhook(Events.MESSAGES_DELETE, { id: message.id, @@ -3811,10 +3415,7 @@ export class BaileysStartupService extends ChannelStartupService { { key: msg?.key, message: msg?.message }, 'buffer', {}, - { - logger: P({ level: 'error' }) as any, - reuploadRequest: this.client.updateMediaMessage, - }, + { logger: P({ level: 'error' }) as any, reuploadRequest: this.client.updateMediaMessage }, ); const typeMessage = getContentType(msg.message); @@ -3853,11 +3454,7 @@ export class BaileysStartupService extends ChannelStartupService { mediaType, fileName, caption: mediaMessage['caption'], - size: { - fileLength: mediaMessage['fileLength'], - height: mediaMessage['height'], - width: mediaMessage['width'], - }, + size: { fileLength: mediaMessage['fileLength'], height: mediaMessage['height'], width: mediaMessage['width'] }, mimetype: mediaMessage['mimetype'], base64: buffer.toString('base64'), buffer: getBuffer ? buffer : null, @@ -3918,17 +3515,10 @@ export class BaileysStartupService extends ChannelStartupService { if (!profile) { const info = await this.whatsappNumber({ numbers: [jid] }); - return { - isBusiness: false, - message: 'Not is business profile', - ...info?.shift(), - }; + return { isBusiness: false, message: 'Not is business profile', ...info?.shift() }; } - return { - isBusiness: true, - ...profile, - }; + return { isBusiness: true, ...profile }; } catch (error) { throw new InternalServerErrorException('Error updating profile name', error.toString()); } @@ -3961,9 +3551,7 @@ export class BaileysStartupService extends ChannelStartupService { const timestamp = new Date().getTime(); const url = `${picture}?timestamp=${timestamp}`; - let config: any = { - responseType: 'arraybuffer', - }; + let config: any = { responseType: 'arraybuffer' }; if (this.localProxy?.enabled) { config = { @@ -4032,23 +3620,15 @@ export class BaileysStartupService extends ChannelStartupService { const msg: any = await this.getMessage(data.key, true); if (msg?.messageType === 'conversation' || msg?.messageType === 'extendedTextMessage') { - return { - text: data.text, - }; + return { text: data.text }; } if (msg?.messageType === 'imageMessage') { - return { - image: msg?.message?.imageMessage, - caption: data.text, - }; + return { image: msg?.message?.imageMessage, caption: data.text }; } if (msg?.messageType === 'videoMessage') { - return { - video: msg?.message?.videoMessage, - caption: data.text, - }; + return { video: msg?.message?.videoMessage, caption: data.text }; } return null; @@ -4079,10 +3659,7 @@ export class BaileysStartupService extends ChannelStartupService { throw new BadRequestException('Message is older than 15 minutes'); } - const messageSent = await this.client.sendMessage(jid, { - ...(options as any), - edit: data.key, - }); + const messageSent = await this.client.sendMessage(jid, { ...(options as any), edit: data.key }); if (messageSent) { const editedMessage = messageSent?.message?.protocolMessage || messageSent?.message?.editedMessage?.message?.protocolMessage; @@ -4099,12 +3676,7 @@ export class BaileysStartupService extends ChannelStartupService { const messageId = messageSent.message?.protocolMessage?.key?.id; if (messageId) { let message = await this.prismaRepository.message.findFirst({ - where: { - key: { - path: ['id'], - equals: messageId, - }, - }, + where: { key: { path: ['id'], equals: messageId } }, }); if (!message) throw new NotFoundException('Message not found'); @@ -4136,9 +3708,7 @@ export class BaileysStartupService extends ChannelStartupService { status: 'EDITED', instanceId: this.instanceId, }; - await this.prismaRepository.messageUpdate.create({ - data: messageUpdate, - }); + await this.prismaRepository.messageUpdate.create({ data: messageUpdate }); } } } @@ -4151,11 +3721,7 @@ export class BaileysStartupService extends ChannelStartupService { } public async fetchLabels(): Promise { - const labels = await this.prismaRepository.label.findMany({ - where: { - instanceId: this.instanceId, - }, - }); + const labels = await this.prismaRepository.label.findMany({ where: { instanceId: this.instanceId } }); return labels.map((label) => ({ color: label.color, @@ -4202,10 +3768,7 @@ export class BaileysStartupService extends ChannelStartupService { if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) { this.logger.verbose(`Updating cache for group: ${groupJid}`); - await groupMetadataCache.set(groupJid, { - timestamp: Date.now(), - data: meta, - }); + await groupMetadataCache.set(groupJid, { timestamp: Date.now(), data: meta }); } return meta; @@ -4251,11 +3814,7 @@ export class BaileysStartupService extends ChannelStartupService { } if (create?.promoteParticipants) { - await this.updateGParticipant({ - groupJid: id, - action: 'promote', - participants: participants, - }); + await this.updateGParticipant({ groupJid: id, action: 'promote', participants: participants }); } const group = await this.client.groupMetadata(id); @@ -4274,9 +3833,7 @@ export class BaileysStartupService extends ChannelStartupService { const timestamp = new Date().getTime(); const url = `${picture.image}?timestamp=${timestamp}`; - let config: any = { - responseType: 'arraybuffer', - }; + let config: any = { responseType: 'arraybuffer' }; if (this.localProxy?.enabled) { config = { @@ -4425,9 +3982,7 @@ export class BaileysStartupService extends ChannelStartupService { const msg = `${description}\n\n${inviteUrl}`; - const message = { - conversation: msg, - }; + const message = { conversation: msg }; for await (const number of numbers) { await this.sendMessageWithTyping(number, message); @@ -4461,12 +4016,7 @@ export class BaileysStartupService extends ChannelStartupService { try { const participants = (await this.client.groupMetadata(id.groupJid)).participants; const contacts = await this.prismaRepository.contact.findMany({ - where: { - instanceId: this.instanceId, - remoteJid: { - in: participants.map((p) => p.id), - }, - }, + where: { instanceId: this.instanceId, remoteJid: { in: participants.map((p) => p.id) } }, }); const parsedParticipants = participants.map((participant) => { const contact = contacts.find((c) => c.remoteJid === participant.id); @@ -4608,9 +4158,7 @@ export class BaileysStartupService extends ChannelStartupService { { key: { path: ['remoteJid'], equals: remoteJid } }, { key: { path: ['fromMe'], equals: false } }, { messageTimestamp: { lte: timestamp } }, - { - OR: [{ status: null }, { status: status[3] }], - }, + { OR: [{ status: null }, { status: status[3] }] }, ], }, data: { status: status[4] }, @@ -4642,10 +4190,7 @@ export class BaileysStartupService extends ChannelStartupService { ]); if (chat && chat.unreadMessages !== unreadMessages) { - await this.prismaRepository.chat.update({ - where: { id: chat.id }, - data: { unreadMessages }, - }); + await this.prismaRepository.chat.update({ where: { id: chat.id }, data: { unreadMessages } }); } return unreadMessages; @@ -4757,11 +4302,7 @@ export class BaileysStartupService extends ChannelStartupService { try { const ciphertextBuffer = Buffer.from(ciphertext, 'base64'); - const response = await this.client.signalRepository.decryptMessage({ - jid, - type, - ciphertext: ciphertextBuffer, - }); + const response = await this.client.signalRepository.decryptMessage({ jid, type, ciphertext: ciphertextBuffer }); return response instanceof Uint8Array ? Buffer.from(response).toString('base64') : response; } catch (error) { @@ -4772,10 +4313,7 @@ export class BaileysStartupService extends ChannelStartupService { } public async baileysGetAuthState() { - const response = { - me: this.client.authState.creds.me, - account: this.client.authState.creds.account, - }; + const response = { me: this.client.authState.creds.me, account: this.client.authState.creds.account }; return response; } @@ -4827,11 +4365,7 @@ export class BaileysStartupService extends ChannelStartupService { }; } catch (error) { console.log(error); - return { - wuid: jid, - name: null, - isBusiness: false, - }; + return { wuid: jid, name: null, isBusiness: false }; } } @@ -4846,10 +4380,7 @@ export class BaileysStartupService extends ChannelStartupService { const catalog = await this.client.getCatalog({ jid, limit: limit, cursor: cursor }); if (!catalog) { - return { - products: undefined, - nextPageCursor: undefined, - }; + return { products: undefined, nextPageCursor: undefined }; } return catalog; @@ -4882,11 +4413,7 @@ export class BaileysStartupService extends ChannelStartupService { collections: collections, }; } catch (error) { - return { - wuid: jid, - name: null, - isBusiness: false, - }; + return { wuid: jid, name: null, isBusiness: false }; } } @@ -4897,14 +4424,7 @@ export class BaileysStartupService extends ChannelStartupService { const result = await this.client.getCollections(jid, limit); if (!result) { - return [ - { - id: undefined, - name: undefined, - products: [], - status: undefined, - }, - ]; + return [{ id: undefined, name: undefined, products: [], status: undefined }]; } return result.collections; @@ -4969,9 +4489,7 @@ export class BaileysStartupService extends ChannelStartupService { keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {}, ], }, - orderBy: { - messageTimestamp: 'desc', - }, + orderBy: { messageTimestamp: 'desc' }, skip: query.offset * (query?.page === 1 ? 0 : (query?.page as number) - 1), take: query.offset, select: { @@ -4984,11 +4502,7 @@ export class BaileysStartupService extends ChannelStartupService { instanceId: true, source: true, contextInfo: true, - MessageUpdate: { - select: { - status: true, - }, - }, + MessageUpdate: { select: { status: true } }, }, }); diff --git a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts index ab3f419d..7dbba743 100644 --- a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts +++ b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts @@ -415,8 +415,9 @@ export class ChatwootService { let query: any; const isGroup = phoneNumber.includes('@g.us'); + const isLid = phoneNumber.includes('@lid'); - if (!isGroup) { + if (!isGroup && !isLid) { query = `+${phoneNumber}`; } else { query = phoneNumber; @@ -424,7 +425,7 @@ export class ChatwootService { let contact: any; - if (isGroup) { + if (isGroup || isLid) { contact = await client.contacts.search({ accountId: this.provider.accountId, q: query, @@ -444,7 +445,7 @@ export class ChatwootService { return null; } - if (!isGroup) { + if (!isGroup && !isLid) { return contact.payload.length > 1 ? this.findContactInContactList(contact.payload, query) : contact.payload[0]; } else { return contact.payload.find((contact) => contact.identifier === query); @@ -594,12 +595,13 @@ export class ChatwootService { if (!client) return null; const isGroup = remoteJid.includes('@g.us'); - const chatId = isGroup ? remoteJid : remoteJid.split('@')[0]; + const isLid = remoteJid.includes('@lid'); + const chatId = isGroup || isLid ? remoteJid : remoteJid.split('@')[0]; let nameContact = !body.key.fromMe ? body.pushName : chatId; const filterInbox = await this.getInbox(instance); if (!filterInbox) return null; - if (isGroup) { + if (isGroup || isLid) { this.logger.verbose(`Processing group conversation`); const group = await this.waMonitor.waInstances[instance.instanceName].client.groupMetadata(chatId); this.logger.verbose(`Group metadata: ${JSON.stringify(group)}`);