diff --git a/.env.example b/.env.example index 73a3b40d35..f8fce85765 100644 --- a/.env.example +++ b/.env.example @@ -114,6 +114,7 @@ RABBITMQ_EVENTS_TYPEBOT_CHANGE_STATUS=false # SQS - Environment variables SQS_ENABLED=false +SQS_GLOBAL_QUEUE_NAME= SQS_ACCESS_KEY_ID= SQS_SECRET_ACCESS_KEY= SQS_ACCOUNT_ID= diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..0ec09ac8af --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,34 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Debug Evolution API (dev:server)", + "runtimeExecutable": "npm", + "runtimeArgs": ["run", "dev:server"], + "console": "integratedTerminal", + "cwd": "${workspaceFolder}", + "env": { + "NODE_OPTIONS": "--inspect" + }, + "skipFiles": ["/**"], + "resolveSourceMapLocations": [ + "${workspaceFolder}/**", + "!**/node_modules/**" + ] + }, + { + "type": "node", + "request": "attach", + "name": "Attach Evolution API (porta 9229)", + "port": 9229, + "restart": true, + "skipFiles": ["/**"], + "resolveSourceMapLocations": [ + "${workspaceFolder}/**", + "!**/node_modules/**" + ] + } + ] +} diff --git a/Docker/swarm/evolution_api_v2.yaml b/Docker/swarm/evolution_api_v2.yaml index 2c826a51bf..e3267a023e 100644 --- a/Docker/swarm/evolution_api_v2.yaml +++ b/Docker/swarm/evolution_api_v2.yaml @@ -51,6 +51,7 @@ services: - RABBITMQ_EVENTS_TYPEBOT_START=false - RABBITMQ_EVENTS_TYPEBOT_CHANGE_STATUS=false - SQS_ENABLED=false + - SQS_GLOBAL_QUEUE_NAME= - SQS_ACCESS_KEY_ID= - SQS_SECRET_ACCESS_KEY= - SQS_ACCOUNT_ID= diff --git a/Dockerfile b/Dockerfile index 996b3e048d..02e67d6274 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM node:24-alpine AS builder +# Instalar dependências incluindo openssh RUN apk update && \ - apk add --no-cache git ffmpeg wget curl bash openssl + apk add --no-cache git ffmpeg wget curl bash openssl openssh-client LABEL version="2.3.1" description="Api to control whatsapp features through http requests." LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes" @@ -9,12 +10,21 @@ LABEL contact="contato@evolution-api.com" WORKDIR /evolution +# Configurar SSH para GitHub +RUN mkdir -p -m 0700 ~/.ssh && \ + ssh-keyscan github.com >> ~/.ssh/known_hosts + +# Montar a chave SSH durante o build (usando BuildKit) +RUN --mount=type=ssh,id=default \ + git config --global url."git@github.com:".insteadOf https://github.com/ + COPY ./package*.json ./ +COPY ./patches ./patches COPY ./tsconfig.json ./ COPY ./tsup.config.ts ./ COPY ./patches ./patches -RUN npm ci --silent +RUN --mount=type=ssh,id=default npm ci COPY ./src ./src COPY ./public ./public @@ -58,4 +68,4 @@ ENV DOCKER_ENV=true EXPOSE 8080 -ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ] +ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ] \ No newline at end of file diff --git a/UNO_DEPLOY.md b/UNO_DEPLOY.md new file mode 100644 index 0000000000..6c3f91b98e --- /dev/null +++ b/UNO_DEPLOY.md @@ -0,0 +1,12 @@ +Para fazer o deploy + +Deve fazer o login no ECR + +# Dar permissão de execução (só precisa fazer uma vez) +chmod +x build.sh + +# Build de teste +./build.sh uno/evolution-test + +# Build de produção +./build.sh uno/evolution \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..9f85f88d41 --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Script para build do Docker com SSH Agent +# chmod +x build.sh +# Uso: ./build.sh +# Exemplo: ./build.sh uno/evolution-test +# Exemplo: ./build.sh uno/evolution + +set -e # Parar em caso de erro + +# Verificar se foi passado o nome da imagem +if [ -z "$1" ]; then + echo "❌ Erro: Você precisa especificar o nome da imagem!" + echo "" + echo "Uso: ./build.sh " + echo "" + echo "Exemplos:" + echo " ./build.sh uno/evolution-test" + echo " ./build.sh uno/evolution" + exit 1 +fi + +IMAGE_NAME=$1 + +echo "🔑 Iniciando SSH Agent..." +eval $(ssh-agent -s) + +echo "🔐 Adicionando chave SSH (você precisará digitar a senha)..." +ssh-add ~/.ssh/id_ed25519 + +echo "🐳 Fazendo build da imagem: $IMAGE_NAME" +export DOCKER_BUILDKIT=1 +docker build --ssh default -t "$IMAGE_NAME" . + +echo "✅ Build concluído com sucesso!" +echo "" +echo "🧹 Limpando SSH Agent..." +ssh-agent -k + +echo "🎉 Pronto! Imagem criada: $IMAGE_NAME" \ No newline at end of file diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 35868ab71a..e3cefe43ae 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -1,35 +1,18 @@ services: - api: - container_name: evolution_api - image: evolution/api:local - build: . + postgres: + image: postgres restart: always ports: - - 8080:8080 - volumes: - - evolution_instances:/evolution/instances - networks: - - evolution-net - env_file: - - .env - expose: - - 8080 - - frontend: - container_name: evolution_frontend - image: evolution/manager:local - build: ./evolution-manager-v2 + - '5438:5432' + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=andand123 + + redis: + image: redis:latest restart: always + container_name: redis + command: > + redis-server --port 6379 --appendonly yes ports: - - "3000:80" - networks: - - evolution-net - -volumes: - evolution_instances: - - -networks: - evolution-net: - name: evolution-net - driver: bridge + - 6379:6379 diff --git a/evolution-manager-v2 b/evolution-manager-v2 deleted file mode 160000 index 3137df4695..0000000000 --- a/evolution-manager-v2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3137df469504ce211c68e7b35f0706497ac1b95f diff --git a/package-lock.json b/package-lock.json index f4bc94f63a..7252d98788 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "evolution-api", "version": "2.3.8", + "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@adiwajshing/keyed-db": "^0.2.4", @@ -21,7 +22,7 @@ "amqplib": "^0.10.5", "audio-decode": "^2.2.3", "axios": "^1.7.9", - "baileys": "7.0.0-rc.9", + "baileys": "github:unobject-dev/Baileys#version/7.0.0-rc.13", "class-validator": "^0.14.1", "compression": "^1.7.5", "cors": "^2.8.5", @@ -830,9 +831,9 @@ } }, "node_modules/@borewit/text-codec": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.0.tgz", - "integrity": "sha512-X999CKBxGwX8wW+4gFibsbiNdwqmdQEXmUejIWaIqdrHBgS5ARIOOeyiQbHjP9G58xVEPcuvP6VwwH3A0OFTOA==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz", + "integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==", "license": "MIT", "funding": { "type": "github", @@ -2373,17 +2374,17 @@ } }, "node_modules/@jimp/core": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-1.6.0.tgz", - "integrity": "sha512-EQQlKU3s9QfdJqiSrZWNTxBs3rKXgO2W+GxNXDtwchF3a4IqxDheFX1ti+Env9hdJXDiYLp2jTRjlxhPthsk8w==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-1.6.1.tgz", + "integrity": "sha512-+BoKC5G6hkrSy501zcJ2EpfnllP+avPevcBfRcZe/CW+EwEfY6X1EZ8QWyT7NpDIvEEJb1fdJnMMfUnFkxmw9A==", "license": "MIT", "dependencies": { - "@jimp/file-ops": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/file-ops": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "await-to-js": "^3.0.0", "exif-parser": "^0.1.12", - "file-type": "^16.0.0", + "file-type": "^21.3.3", "mime": "3" }, "engines": { @@ -2403,14 +2404,14 @@ } }, "node_modules/@jimp/diff": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/diff/-/diff-1.6.0.tgz", - "integrity": "sha512-+yUAQ5gvRC5D1WHYxjBHZI7JBRusGGSLf8AmPRPCenTzh4PA+wZ1xv2+cYqQwTfQHU5tXYOhA0xDytfHUf1Zyw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/diff/-/diff-1.6.1.tgz", + "integrity": "sha512-YkKDPdHjLgo1Api3+Bhc0GLAygldlpt97NfOKoNg1U6IUNXA6X2MgosCjPfSBiSvJvrrz1fsIR+/4cfYXBI/HQ==", "license": "MIT", "dependencies": { - "@jimp/plugin-resize": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/plugin-resize": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "pixelmatch": "^5.3.0" }, "engines": { @@ -2418,23 +2419,23 @@ } }, "node_modules/@jimp/file-ops": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/file-ops/-/file-ops-1.6.0.tgz", - "integrity": "sha512-Dx/bVDmgnRe1AlniRpCKrGRm5YvGmUwbDzt+MAkgmLGf+jvBT75hmMEZ003n9HQI/aPnm/YKnXjg/hOpzNCpHQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/file-ops/-/file-ops-1.6.1.tgz", + "integrity": "sha512-T+gX6osHjprbDRad0/B71Evyre7ZdVY1z/gFGEG9Z8KOtZPKboWvPeP2UjbZYWQLy9UKCPQX1FNAnDiOPkJL7w==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/@jimp/js-bmp": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/js-bmp/-/js-bmp-1.6.0.tgz", - "integrity": "sha512-FU6Q5PC/e3yzLyBDXupR3SnL3htU7S3KEs4e6rjDP6gNEOXRFsWs6YD3hXuXd50jd8ummy+q2WSwuGkr8wi+Gw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/js-bmp/-/js-bmp-1.6.1.tgz", + "integrity": "sha512-xzWzNT4/u5zGrTT3Tme9sGU7YzIKxi13+BCQwLqACbt5DXf9SAfdzRkopZQnmDko+6In5nqaT89Gjs43/WdnYQ==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "bmp-ts": "^1.0.9" }, "engines": { @@ -2442,13 +2443,13 @@ } }, "node_modules/@jimp/js-gif": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/js-gif/-/js-gif-1.6.0.tgz", - "integrity": "sha512-N9CZPHOrJTsAUoWkWZstLPpwT5AwJ0wge+47+ix3++SdSL/H2QzyMqxbcDYNFe4MoI5MIhATfb0/dl/wmX221g==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/js-gif/-/js-gif-1.6.1.tgz", + "integrity": "sha512-YjY2W26rQa05XhanYhRZ7dingCiNN+T2Ymb1JiigIbABY0B28wHE3v3Cf1/HZPWGu0hOg36ylaKgV5KxF2M58w==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", "gifwrap": "^0.10.1", "omggif": "^1.0.10" }, @@ -2457,13 +2458,13 @@ } }, "node_modules/@jimp/js-jpeg": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/js-jpeg/-/js-jpeg-1.6.0.tgz", - "integrity": "sha512-6vgFDqeusblf5Pok6B2DUiMXplH8RhIKAryj1yn+007SIAQ0khM1Uptxmpku/0MfbClx2r7pnJv9gWpAEJdMVA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/js-jpeg/-/js-jpeg-1.6.1.tgz", + "integrity": "sha512-HT9H3yOmlOFzYmdI15IYdfy6ggQhSRIaHeA+OTJSEORXBqEo97sUZu/DsgHIcX5NJ7TkJBTgZ9BZXsV6UbsyMg==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", "jpeg-js": "^0.4.4" }, "engines": { @@ -2471,13 +2472,13 @@ } }, "node_modules/@jimp/js-png": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/js-png/-/js-png-1.6.0.tgz", - "integrity": "sha512-AbQHScy3hDDgMRNfG0tPjL88AV6qKAILGReIa3ATpW5QFjBKpisvUaOqhzJ7Reic1oawx3Riyv152gaPfqsBVg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/js-png/-/js-png-1.6.1.tgz", + "integrity": "sha512-SZ/KVhI5UjcSzzlXsXdIi/LhJ7UShf2NkMOtVrbZQcGzsqNtynAelrOXeoTxcanfVqmNhAoVHg8yR2cYoqrYjA==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", "pngjs": "^7.0.0" }, "engines": { @@ -2485,13 +2486,13 @@ } }, "node_modules/@jimp/js-tiff": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/js-tiff/-/js-tiff-1.6.0.tgz", - "integrity": "sha512-zhReR8/7KO+adijj3h0ZQUOiun3mXUv79zYEAKvE0O+rP7EhgtKvWJOZfRzdZSNv0Pu1rKtgM72qgtwe2tFvyw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/js-tiff/-/js-tiff-1.6.1.tgz", + "integrity": "sha512-jDG/eJquID1M4MBlKMmDRBmz2TpXMv7TUyu2nIRUxhlUc2ogC82T+VQUkca9GJH1BBJ9dx5sSE5dGkWNjIbZxw==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", "utif2": "^4.1.0" }, "engines": { @@ -2499,13 +2500,13 @@ } }, "node_modules/@jimp/plugin-blit": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-1.6.0.tgz", - "integrity": "sha512-M+uRWl1csi7qilnSK8uxK4RJMSuVeBiO1AY0+7APnfUbQNZm6hCe0CCFv1Iyw1D/Dhb8ph8fQgm5mwM0eSxgVA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-1.6.1.tgz", + "integrity": "sha512-MwnI7C7K81uWddY9FLw1fCOIy6SsPIUftUz36Spt7jisCn8/40DhQMlSxpxTNelnZb/2SnloFimQfRZAmHLOqQ==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2513,25 +2514,25 @@ } }, "node_modules/@jimp/plugin-blur": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-1.6.0.tgz", - "integrity": "sha512-zrM7iic1OTwUCb0g/rN5y+UnmdEsT3IfuCXCJJNs8SZzP0MkZ1eTvuwK9ZidCuMo4+J3xkzCidRwYXB5CyGZTw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-1.6.1.tgz", + "integrity": "sha512-lIo7Tzp5jQu30EFFSK/phXANK3citKVEjepDjQ6ljHoIFtuMRrnybnmI2Md24ulvWlDaz+hh3n6qrMb8ydwhZQ==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/utils": "1.6.0" + "@jimp/core": "1.6.1", + "@jimp/utils": "1.6.1" }, "engines": { "node": ">=18" } }, "node_modules/@jimp/plugin-circle": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-1.6.0.tgz", - "integrity": "sha512-xt1Gp+LtdMKAXfDp3HNaG30SPZW6AQ7dtAtTnoRKorRi+5yCJjKqXRgkewS5bvj8DEh87Ko1ydJfzqS3P2tdWw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-1.6.1.tgz", + "integrity": "sha512-kK1PavY6cKHNNKce37vdV4Tmpc1/zDKngGoeOV3j+EMatoHFZUinV3s6F9aWryPs3A0xhCLZgdJ6Zeea1d5LCQ==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", + "@jimp/types": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2539,14 +2540,14 @@ } }, "node_modules/@jimp/plugin-color": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-1.6.0.tgz", - "integrity": "sha512-J5q8IVCpkBsxIXM+45XOXTrsyfblyMZg3a9eAo0P7VPH4+CrvyNQwaYatbAIamSIN1YzxmO3DkIZXzRjFSz1SA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-1.6.1.tgz", + "integrity": "sha512-LtUN1vAP+LRlZAtTNVhDRSiXx+26Kbz3zJaG6a5k59gQ95jgT5mknnF8lxkHcqJthM4MEk3/tPxkdJpEybyF/A==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "tinycolor2": "^1.6.0", "zod": "^3.23.8" }, @@ -2555,16 +2556,16 @@ } }, "node_modules/@jimp/plugin-contain": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-1.6.0.tgz", - "integrity": "sha512-oN/n+Vdq/Qg9bB4yOBOxtY9IPAtEfES8J1n9Ddx+XhGBYT1/QTU/JYkGaAkIGoPnyYvmLEDqMz2SGihqlpqfzQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-1.6.1.tgz", + "integrity": "sha512-m0qhrfA8jkTqretGv4w+T/ADFR4GwBpE0sCOC2uJ0dzr44/ddOMsIdrpi89kabqYiPYIrxkgdCVCLm3zn1Vkkg==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/plugin-blit": "1.6.0", - "@jimp/plugin-resize": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/plugin-blit": "1.6.1", + "@jimp/plugin-resize": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2572,15 +2573,15 @@ } }, "node_modules/@jimp/plugin-cover": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-1.6.0.tgz", - "integrity": "sha512-Iow0h6yqSC269YUJ8HC3Q/MpCi2V55sMlbkkTTx4zPvd8mWZlC0ykrNDeAy9IJegrQ7v5E99rJwmQu25lygKLA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-1.6.1.tgz", + "integrity": "sha512-hZytnsth0zoll6cPf434BrT+p/v569Wr5tyO6Dp0dH1IDPhzhB5F38sZGMLDo7bzQiN9JFVB3fxkcJ/WYCJ3Mg==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/plugin-crop": "1.6.0", - "@jimp/plugin-resize": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/plugin-crop": "1.6.1", + "@jimp/plugin-resize": "1.6.1", + "@jimp/types": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2588,14 +2589,14 @@ } }, "node_modules/@jimp/plugin-crop": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-1.6.0.tgz", - "integrity": "sha512-KqZkEhvs+21USdySCUDI+GFa393eDIzbi1smBqkUPTE+pRwSWMAf01D5OC3ZWB+xZsNla93BDS9iCkLHA8wang==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-1.6.1.tgz", + "integrity": "sha512-EerRSLlclXyKDnYc/H9w/1amZW7b7v3OGi/VlerPd2M/pAu5X8TkyYWtfqYCXnNp1Ixtd8oCo9zGfY9zoXT4rg==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2603,13 +2604,13 @@ } }, "node_modules/@jimp/plugin-displace": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-1.6.0.tgz", - "integrity": "sha512-4Y10X9qwr5F+Bo5ME356XSACEF55485j5nGdiyJ9hYzjQP9nGgxNJaZ4SAOqpd+k5sFaIeD7SQ0Occ26uIng5Q==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-1.6.1.tgz", + "integrity": "sha512-K07QVl7xQwIfD6KfxRV/c3E9e7ZBXxUXdWuvoTWcKHL2qV48MOF5Nqbz/aJW4ThnQARIsxvYlZjPFiqkCjlU+g==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2617,25 +2618,25 @@ } }, "node_modules/@jimp/plugin-dither": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-1.6.0.tgz", - "integrity": "sha512-600d1RxY0pKwgyU0tgMahLNKsqEcxGdbgXadCiVCoGd6V6glyCvkNrnnwC0n5aJ56Htkj88PToSdF88tNVZEEQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-1.6.1.tgz", + "integrity": "sha512-+2V+GCV2WycMoX1/z977TkZ8Zq/4MVSKElHYatgUqtwXMi2fDK2gKYU2g9V39IqFvTJsTIsK0+58VFz/ROBVew==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0" + "@jimp/types": "1.6.1" }, "engines": { "node": ">=18" } }, "node_modules/@jimp/plugin-fisheye": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-1.6.0.tgz", - "integrity": "sha512-E5QHKWSCBFtpgZarlmN3Q6+rTQxjirFqo44ohoTjzYVrDI6B6beXNnPIThJgPr0Y9GwfzgyarKvQuQuqCnnfbA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-1.6.1.tgz", + "integrity": "sha512-XtS5ZyoZ0vxZxJ6gkqI63SivhtI58vX95foMPM+cyzYkRsJXMOYCr8DScxF5bp4Xr003NjYm/P+7+08tibwzHA==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2643,12 +2644,12 @@ } }, "node_modules/@jimp/plugin-flip": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-1.6.0.tgz", - "integrity": "sha512-/+rJVDuBIVOgwoyVkBjUFHtP+wmW0r+r5OQ2GpatQofToPVbJw1DdYWXlwviSx7hvixTWLKVgRWQ5Dw862emDg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-1.6.1.tgz", + "integrity": "sha512-ws38W/sGj7LobNRayQ83garxiktOyWxM5vO/y4a/2cy9v65SLEUzVkrj+oeAaUSSObdz4HcCEla7XtGlnAGAaA==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", + "@jimp/types": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2656,20 +2657,20 @@ } }, "node_modules/@jimp/plugin-hash": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-hash/-/plugin-hash-1.6.0.tgz", - "integrity": "sha512-wWzl0kTpDJgYVbZdajTf+4NBSKvmI3bRI8q6EH9CVeIHps9VWVsUvEyb7rpbcwVLWYuzDtP2R0lTT6WeBNQH9Q==", - "license": "MIT", - "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/js-bmp": "1.6.0", - "@jimp/js-jpeg": "1.6.0", - "@jimp/js-png": "1.6.0", - "@jimp/js-tiff": "1.6.0", - "@jimp/plugin-color": "1.6.0", - "@jimp/plugin-resize": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-hash/-/plugin-hash-1.6.1.tgz", + "integrity": "sha512-sZt6ZcMX6i8vFWb4GYnw0pR/o9++ef0dTVcboTB5B/g7nrxCODIB4wfEkJ/YqZM5wUvol77K1qeS0/rVO6z21A==", + "license": "MIT", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/js-bmp": "1.6.1", + "@jimp/js-jpeg": "1.6.1", + "@jimp/js-png": "1.6.1", + "@jimp/js-tiff": "1.6.1", + "@jimp/plugin-color": "1.6.1", + "@jimp/plugin-resize": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "any-base": "^1.1.0" }, "engines": { @@ -2677,12 +2678,12 @@ } }, "node_modules/@jimp/plugin-mask": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-1.6.0.tgz", - "integrity": "sha512-Cwy7ExSJMZszvkad8NV8o/Z92X2kFUFM8mcDAhNVxU0Q6tA0op2UKRJY51eoK8r6eds/qak3FQkXakvNabdLnA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-1.6.1.tgz", + "integrity": "sha512-SIG0/FcmEj3tkwFxc7fAGLO8o4uNzMpSOdQOhbCgxefQKq5wOVMk9BQx/sdMPBwtMLr9WLq0GzLA/rk6t2v20A==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", + "@jimp/types": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2690,16 +2691,16 @@ } }, "node_modules/@jimp/plugin-print": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-1.6.0.tgz", - "integrity": "sha512-zarTIJi8fjoGMSI/M3Xh5yY9T65p03XJmPsuNet19K/Q7mwRU6EV2pfj+28++2PV2NJ+htDF5uecAlnGyxFN2A==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-1.6.1.tgz", + "integrity": "sha512-BYVz/X3Xzv8XYilVeDy11NOp0h7BTDjlOtu0BekIFHP1yHVd24AXNzbOy52XlzYZWQ0Dl36HOHEpl/nSNrzc6w==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/js-jpeg": "1.6.0", - "@jimp/js-png": "1.6.0", - "@jimp/plugin-blit": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/js-jpeg": "1.6.1", + "@jimp/js-png": "1.6.1", + "@jimp/plugin-blit": "1.6.1", + "@jimp/types": "1.6.1", "parse-bmfont-ascii": "^1.0.6", "parse-bmfont-binary": "^1.0.6", "parse-bmfont-xml": "^1.1.6", @@ -2711,9 +2712,9 @@ } }, "node_modules/@jimp/plugin-quantize": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-quantize/-/plugin-quantize-1.6.0.tgz", - "integrity": "sha512-EmzZ/s9StYQwbpG6rUGBCisc3f64JIhSH+ncTJd+iFGtGo0YvSeMdAd+zqgiHpfZoOL54dNavZNjF4otK+mvlg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-quantize/-/plugin-quantize-1.6.1.tgz", + "integrity": "sha512-J2En9PLURfP+vwYDtuZ9T8yBW6BWYZBScydAjRiPBmJfEhTcNQqiiQODrZf7EqbbX/Sy5H6dAeRiqkgoV9N6Ww==", "license": "MIT", "dependencies": { "image-q": "^4.0.0", @@ -2724,13 +2725,13 @@ } }, "node_modules/@jimp/plugin-resize": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-1.6.0.tgz", - "integrity": "sha512-uSUD1mqXN9i1SGSz5ov3keRZ7S9L32/mAQG08wUwZiEi5FpbV0K8A8l1zkazAIZi9IJzLlTauRNU41Mi8IF9fA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-1.6.1.tgz", + "integrity": "sha512-CLkrtJoIz2HdWnpYiN6p8KYcPc00rCH/SUu6o+lfZL05Q4uhecJlnvXuj9x+U6mDn3ldPmJj6aZqMHuUJzdVqg==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/types": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2738,16 +2739,16 @@ } }, "node_modules/@jimp/plugin-rotate": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-1.6.0.tgz", - "integrity": "sha512-JagdjBLnUZGSG4xjCLkIpQOZZ3Mjbg8aGCCi4G69qR+OjNpOeGI7N2EQlfK/WE8BEHOW5vdjSyglNqcYbQBWRw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-1.6.1.tgz", + "integrity": "sha512-nOjVjbbj705B02ksysKnh0POAwEBXZtJ9zQ5qC+X7Tavl3JNn+P3BzQovbBxLPSbUSld6XID9z5ijin4PtOAUg==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/plugin-crop": "1.6.0", - "@jimp/plugin-resize": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/plugin-crop": "1.6.1", + "@jimp/plugin-resize": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2755,16 +2756,16 @@ } }, "node_modules/@jimp/plugin-threshold": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-1.6.0.tgz", - "integrity": "sha512-M59m5dzLoHOVWdM41O8z9SyySzcDn43xHseOH0HavjsfQsT56GGCC4QzU1banJidbUrePhzoEdS42uFE8Fei8w==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-1.6.1.tgz", + "integrity": "sha512-JOKv9F8s6tnVLf4sB/2fF0F339EFnHvgEdFYugO6VhowKLsap0pEZmLyE/DlRnYtIj2RddHZVxVMp/eKJ04l2Q==", "license": "MIT", "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/plugin-color": "1.6.0", - "@jimp/plugin-hash": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0", + "@jimp/core": "1.6.1", + "@jimp/plugin-color": "1.6.1", + "@jimp/plugin-hash": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", "zod": "^3.23.8" }, "engines": { @@ -2772,9 +2773,9 @@ } }, "node_modules/@jimp/types": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-1.6.0.tgz", - "integrity": "sha512-7UfRsiKo5GZTAATxm2qQ7jqmUXP0DxTArztllTcYdyw6Xi5oT4RaoXynVtCD4UyLK5gJgkZJcwonoijrhYFKfg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-1.6.1.tgz", + "integrity": "sha512-leI7YbveTNi565m910XgIOwXyuu074H5qazAD1357HImJSv2hqxnWXpwxQbadGWZ7goZRYBDZy5lpqud0p7q5w==", "license": "MIT", "dependencies": { "zod": "^3.23.8" @@ -2784,12 +2785,12 @@ } }, "node_modules/@jimp/utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-1.6.0.tgz", - "integrity": "sha512-gqFTGEosKbOkYF/WFj26jMHOI5OH2jeP1MmC/zbK6BF6VJBf8rIC5898dPfSzZEbSA0wbbV5slbntWVc5PKLFA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-veFPRd93FCnS7AgmCkPgARVGoDRrJ9cm1ujuNyA+UfQ5VKbED2002sm5XfFLFwTsKC8j04heTrwe+tU1dluXOw==", "license": "MIT", "dependencies": { - "@jimp/types": "1.6.0", + "@jimp/types": "1.6.1", "tinycolor2": "^1.6.0" }, "engines": { @@ -3579,25 +3580,24 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", "license": "BSD-3-Clause" }, "node_modules/@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", + "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", "license": "BSD-3-Clause" }, "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", "license": "BSD-3-Clause", "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" + "@protobufjs/aspromise": "^1.1.1" } }, "node_modules/@protobufjs/float": { @@ -3606,12 +3606,6 @@ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", "license": "BSD-3-Clause" }, - "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", - "license": "BSD-3-Clause" - }, "node_modules/@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", @@ -3625,9 +3619,9 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz", + "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==", "license": "BSD-3-Clause" }, "node_modules/@redis/bloom": { @@ -4759,34 +4753,6 @@ "url": "https://github.com/sponsors/Borewit" } }, - "node_modules/@tokenizer/inflate/node_modules/@borewit/text-codec": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.1.1.tgz", - "integrity": "sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/@tokenizer/inflate/node_modules/token-types": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.1.tgz", - "integrity": "sha512-kh9LVIWH5CnL63Ipf0jhlBIy0UsrMj/NJDfpsy1SqOXlLKEVyXXYrnFxFT1yOOYVGBSApeVnjPw/sBz5BfEjAQ==", - "license": "MIT", - "dependencies": { - "@borewit/text-codec": "^0.1.0", - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, "node_modules/@tokenizer/token": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", @@ -4896,12 +4862,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", - "license": "MIT" - }, "node_modules/@types/mime": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-4.0.0.tgz", @@ -5822,21 +5782,21 @@ } }, "node_modules/baileys": { - "version": "7.0.0-rc.9", - "resolved": "https://registry.npmjs.org/baileys/-/baileys-7.0.0-rc.9.tgz", - "integrity": "sha512-Txd2dZ9MHbojvsHckeuCnAKPO/bQjKxua/0tQSJwOKXffK5vpS82k4eA/Nb46K0cK0Bx+fyY0zhnQHYMBriQcw==", + "version": "7.0.0-rc13", + "resolved": "git+ssh://git@github.com/unobject-dev/Baileys.git#1ed21e256995415eb4d49cb13967c8056b0b57af", "hasInstallScript": true, "license": "MIT", "dependencies": { "@cacheable/node-cache": "^1.4.0", "@hapi/boom": "^9.1.3", "async-mutex": "^0.5.0", - "libsignal": "git+https://github.com/whiskeysockets/libsignal-node.git", + "libsignal": "^6.0.0", "lru-cache": "^11.1.0", - "music-metadata": "^11.7.0", + "music-metadata": "^11.12.3", "p-queue": "^9.0.0", "pino": "^9.6", - "protobufjs": "^7.2.4", + "protobufjs": "^7.5.6", + "whatsapp-rust-bridge": "0.5.4", "ws": "^8.13.0" }, "engines": { @@ -5844,7 +5804,7 @@ }, "peerDependencies": { "audio-decode": "^2.1.3", - "jimp": "^1.6.0", + "jimp": "^1.6.1", "link-preview-js": "^3.0.0", "sharp": "*" }, @@ -5885,6 +5845,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, "funding": [ { "type": "github", @@ -8360,15 +8321,6 @@ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", "license": "MIT" }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "license": "MIT", - "engines": { - "node": ">=0.8.x" - } - }, "node_modules/exif-parser": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", @@ -8653,17 +8605,18 @@ } }, "node_modules/file-type": { - "version": "16.5.4", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", - "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "version": "21.3.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.4.tgz", + "integrity": "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==", "license": "MIT", "dependencies": { - "readable-web-to-node-stream": "^3.0.0", - "strtok3": "^6.2.4", - "token-types": "^4.1.1" + "@tokenizer/inflate": "^0.4.1", + "strtok3": "^10.3.4", + "token-types": "^6.1.1", + "uint8array-extras": "^1.4.0" }, "engines": { - "node": ">=10" + "node": ">=20" }, "funding": { "url": "https://github.com/sindresorhus/file-type?sponsor=1" @@ -10414,38 +10367,38 @@ "license": "ISC" }, "node_modules/jimp": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-1.6.0.tgz", - "integrity": "sha512-YcwCHw1kiqEeI5xRpDlPPBGL2EOpBKLwO4yIBJcXWHPj5PnA5urGq0jbyhM5KoNpypQ6VboSoxc9D8HyfvngSg==", - "license": "MIT", - "dependencies": { - "@jimp/core": "1.6.0", - "@jimp/diff": "1.6.0", - "@jimp/js-bmp": "1.6.0", - "@jimp/js-gif": "1.6.0", - "@jimp/js-jpeg": "1.6.0", - "@jimp/js-png": "1.6.0", - "@jimp/js-tiff": "1.6.0", - "@jimp/plugin-blit": "1.6.0", - "@jimp/plugin-blur": "1.6.0", - "@jimp/plugin-circle": "1.6.0", - "@jimp/plugin-color": "1.6.0", - "@jimp/plugin-contain": "1.6.0", - "@jimp/plugin-cover": "1.6.0", - "@jimp/plugin-crop": "1.6.0", - "@jimp/plugin-displace": "1.6.0", - "@jimp/plugin-dither": "1.6.0", - "@jimp/plugin-fisheye": "1.6.0", - "@jimp/plugin-flip": "1.6.0", - "@jimp/plugin-hash": "1.6.0", - "@jimp/plugin-mask": "1.6.0", - "@jimp/plugin-print": "1.6.0", - "@jimp/plugin-quantize": "1.6.0", - "@jimp/plugin-resize": "1.6.0", - "@jimp/plugin-rotate": "1.6.0", - "@jimp/plugin-threshold": "1.6.0", - "@jimp/types": "1.6.0", - "@jimp/utils": "1.6.0" + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-1.6.1.tgz", + "integrity": "sha512-hNQh6rZtWfSVWSNVmvq87N5BPJsNH7k7I7qyrXf9DOma9xATQk3fsyHazCQe51nCjdkoWdTmh0vD7bjVSLoxxw==", + "license": "MIT", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/diff": "1.6.1", + "@jimp/js-bmp": "1.6.1", + "@jimp/js-gif": "1.6.1", + "@jimp/js-jpeg": "1.6.1", + "@jimp/js-png": "1.6.1", + "@jimp/js-tiff": "1.6.1", + "@jimp/plugin-blit": "1.6.1", + "@jimp/plugin-blur": "1.6.1", + "@jimp/plugin-circle": "1.6.1", + "@jimp/plugin-color": "1.6.1", + "@jimp/plugin-contain": "1.6.1", + "@jimp/plugin-cover": "1.6.1", + "@jimp/plugin-crop": "1.6.1", + "@jimp/plugin-displace": "1.6.1", + "@jimp/plugin-dither": "1.6.1", + "@jimp/plugin-fisheye": "1.6.1", + "@jimp/plugin-flip": "1.6.1", + "@jimp/plugin-hash": "1.6.1", + "@jimp/plugin-mask": "1.6.1", + "@jimp/plugin-print": "1.6.1", + "@jimp/plugin-quantize": "1.6.1", + "@jimp/plugin-resize": "1.6.1", + "@jimp/plugin-rotate": "1.6.1", + "@jimp/plugin-threshold": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1" }, "engines": { "node": ">=18" @@ -10713,51 +10666,13 @@ "license": "MIT" }, "node_modules/libsignal": { - "name": "@whiskeysockets/libsignal-node", - "version": "2.0.1", - "resolved": "git+ssh://git@github.com/whiskeysockets/libsignal-node.git#1c30d7d7e76a3b0aa120b04dc6a26f5a12dccf67", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/libsignal/-/libsignal-6.0.0.tgz", + "integrity": "sha512-d/5V3YFtDljbFMufz4ncyUYGYhJl+vzAe+c2EFFBQ6bz1h8Q3IOMEGXYMzlibU60I+e8GagMMpji18iez3P1hA==", "license": "GPL-3.0", "dependencies": { "curve25519-js": "^0.0.4", - "protobufjs": "6.8.8" - } - }, - "node_modules/libsignal/node_modules/@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==", - "license": "MIT" - }, - "node_modules/libsignal/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "license": "Apache-2.0" - }, - "node_modules/libsignal/node_modules/protobufjs": { - "version": "6.8.8", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", - "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", - "hasInstallScript": true, - "license": "BSD-3-Clause", - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "@types/node": "^10.1.0", - "long": "^4.0.0" - }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" + "protobufjs": "^7.5.5" } }, "node_modules/lilconfig": { @@ -11335,12 +11250,16 @@ } }, "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-2.0.0.tgz", + "integrity": "sha512-kOy3OxT2HH39N70UnKgu4NWDZjLOz8W/mfyvniHjRH/DrL3f2pOfvWQ4p60offbbtDAnXWp0v9LfMIqMec269Q==", "license": "MIT", "engines": { - "node": ">= 0.8" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/mediainfo.js": { @@ -11759,9 +11678,9 @@ } }, "node_modules/music-metadata": { - "version": "11.10.3", - "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-11.10.3.tgz", - "integrity": "sha512-j0g/x4cNNZW6I5gdcPAY+GFkJY9WHTpkFDMBJKQLxJQyvSfQbXm57fTE3haGFFuOzCgtsTd4Plwc49Sn9RacDQ==", + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-11.13.0.tgz", + "integrity": "sha512-uXRaov9dfjSpQufXIU7sMxVZnh+FilCQv2mXn+K5EJ/decP3dTWrgvPYa5r6MtRbieNSCE708Da4J0u1UGfQIw==", "funding": [ { "type": "github", @@ -11774,80 +11693,32 @@ ], "license": "MIT", "dependencies": { - "@borewit/text-codec": "^0.2.0", + "@borewit/text-codec": "^0.2.2", "@tokenizer/token": "^0.3.0", - "content-type": "^1.0.5", + "content-type": "^2.0.0", "debug": "^4.4.3", - "file-type": "^21.1.1", - "media-typer": "^1.1.0", - "strtok3": "^10.3.4", - "token-types": "^6.1.1", - "uint8array-extras": "^1.5.0" + "file-type": "^21.3.4", + "media-typer": "^2.0.0", + "strtok3": "^10.3.5", + "token-types": "^6.1.2", + "uint8array-extras": "^1.5.0", + "win-guid": "^0.2.1" }, "engines": { "node": ">=18" } }, - "node_modules/music-metadata/node_modules/file-type": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.1.1.tgz", - "integrity": "sha512-ifJXo8zUqbQ/bLbl9sFoqHNTNWbnPY1COImFfM6CCy7z+E+jC1eY9YfOKkx0fckIg+VljAy2/87T61fp0+eEkg==", - "license": "MIT", - "dependencies": { - "@tokenizer/inflate": "^0.4.1", - "strtok3": "^10.3.4", - "token-types": "^6.1.1", - "uint8array-extras": "^1.4.0" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sindresorhus/file-type?sponsor=1" - } - }, - "node_modules/music-metadata/node_modules/strtok3": { - "version": "10.3.4", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.4.tgz", - "integrity": "sha512-KIy5nylvC5le1OdaaoCJ07L+8iQzJHGH6pWDuzS+d07Cu7n1MZ2x26P8ZKIWfbK02+XIL8Mp4RkWeqdUCrDMfg==", + "node_modules/music-metadata/node_modules/content-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", + "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", "license": "MIT", - "dependencies": { - "@tokenizer/token": "^0.3.0" - }, "engines": { "node": ">=18" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/music-metadata/node_modules/token-types": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.1.tgz", - "integrity": "sha512-kh9LVIWH5CnL63Ipf0jhlBIy0UsrMj/NJDfpsy1SqOXlLKEVyXXYrnFxFT1yOOYVGBSApeVnjPw/sBz5BfEjAQ==", - "license": "MIT", - "dependencies": { - "@borewit/text-codec": "^0.1.0", - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/music-metadata/node_modules/token-types/node_modules/@borewit/text-codec": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.1.1.tgz", - "integrity": "sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/mute-stream": { @@ -12827,19 +12698,6 @@ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", "license": "MIT" }, - "node_modules/peek-readable": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", - "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, "node_modules/perfect-debounce": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", @@ -13208,15 +13066,6 @@ } } }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/process-warning": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz", @@ -13234,24 +13083,23 @@ "license": "MIT" }, "node_modules/protobufjs": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz", - "integrity": "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==", + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.4.tgz", + "integrity": "sha512-RJJPTTpvFfHcWLkIa2JFWK4XvtSzS0yEWDmunqHXli1h3JlkbcQZXDZdcWxv+JK3Xsl5/UFDPZ0iGm7DAengYw==", "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", + "@protobufjs/codegen": "^2.0.5", + "@protobufjs/eventemitter": "^1.1.1", + "@protobufjs/fetch": "^1.1.1", "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", "@types/node": ">=13.7.0", - "long": "^5.0.0" + "long": "^5.3.2" }, "engines": { "node": ">=12.0.0" @@ -13662,62 +13510,6 @@ "node": ">= 6" } }, - "node_modules/readable-web-to-node-stream": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.4.tgz", - "integrity": "sha512-9nX56alTf5bwXQ3ZDipHJhusu9NTQJ/CVPtb/XHAJCXihZeitfJvIRS4GqQ/mfIoOE3IelHMrpayVrosdHBuLw==", - "license": "MIT", - "dependencies": { - "readable-stream": "^4.7.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/readable-web-to-node-stream/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/readable-web-to-node-stream/node_modules/readable-stream": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", - "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, "node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -14427,9 +14219,9 @@ "license": "ISC" }, "node_modules/simple-xml-to-json": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/simple-xml-to-json/-/simple-xml-to-json-1.2.3.tgz", - "integrity": "sha512-kWJDCr9EWtZ+/EYYM5MareWj2cRnZGF93YDNpH4jQiHB+hBIZnfPFSQiVMzZOdk+zXWqTZ/9fTeQNu2DqeiudA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/simple-xml-to-json/-/simple-xml-to-json-1.2.7.tgz", + "integrity": "sha512-mz9VXphOxQWX3eQ/uXCtm6upltoN0DLx8Zb5T4TFC4FHB7S9FDPGre8CfLWqPWQQH/GrQYd2AXhhVM5LDpYx6Q==", "license": "MIT", "engines": { "node": ">=20.12.2" @@ -14901,16 +14693,15 @@ "license": "MIT" }, "node_modules/strtok3": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", - "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "version": "10.3.5", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz", + "integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==", "license": "MIT", "dependencies": { - "@tokenizer/token": "^0.3.0", - "peek-readable": "^4.1.0" + "@tokenizer/token": "^0.3.0" }, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "type": "github", @@ -15175,16 +14966,17 @@ } }, "node_modules/token-types": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", - "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz", + "integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==", "license": "MIT", "dependencies": { + "@borewit/text-codec": "^0.2.1", "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" }, "engines": { - "node": ">=10" + "node": ">=14.16" }, "funding": { "type": "github", @@ -16205,6 +15997,12 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "license": "BSD-2-Clause" }, + "node_modules/whatsapp-rust-bridge": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/whatsapp-rust-bridge/-/whatsapp-rust-bridge-0.5.4.tgz", + "integrity": "sha512-yYO1qSs0Fe7tGtnxOFHomocUD6IZtoAgmA4oDFyGIRZ67D3QZk3w7swA6XXFXNQngiyrg2k7tul6IrM3eUFh7A==", + "license": "MIT" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -16325,6 +16123,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/win-guid": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/win-guid/-/win-guid-0.2.1.tgz", + "integrity": "sha512-gEIQU4mkgl2OPeoNrWflcJFJ3Ae2BPd4eCsHHA/XikslkIVms/nHhvnvzIZV7VLmBvtFlDOzLt9rrZT+n6D67A==", + "license": "MIT" + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 292e8f53c4..54e7c1b75a --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "amqplib": "^0.10.5", "audio-decode": "^2.2.3", "axios": "^1.7.9", - "baileys": "7.0.0-rc.9", + "baileys": "github:unobject-dev/Baileys#version/7.0.0-rc.13", "class-validator": "^0.14.1", "compression": "^1.7.5", "cors": "^2.8.5", @@ -88,10 +88,10 @@ "eventemitter2": "^6.4.9", "express": "^4.21.2", "express-async-errors": "^3.1.1", + "fetch-socks": "^1.3.2", "fluent-ffmpeg": "^2.1.3", "form-data": "^4.0.1", "https-proxy-agent": "^7.0.6", - "fetch-socks": "^1.3.2", "i18next": "^23.7.19", "jimp": "^1.6.0", "json-schema": "^0.4.0", diff --git a/patches/baileys+7.0.0-rc.9.patch b/patches/baileys+7.0.0-rc13.patch similarity index 61% rename from patches/baileys+7.0.0-rc.9.patch rename to patches/baileys+7.0.0-rc13.patch index 63622b2cdb..ebb3e3789f 100644 --- a/patches/baileys+7.0.0-rc.9.patch +++ b/patches/baileys+7.0.0-rc13.patch @@ -1,9 +1,9 @@ diff --git a/node_modules/baileys/lib/Socket/messages-recv.js b/node_modules/baileys/lib/Socket/messages-recv.js -index f2e2e10..b9d82c2 100644 +index f2003ac..c96b0f5 --- a/node_modules/baileys/lib/Socket/messages-recv.js +++ b/node_modules/baileys/lib/Socket/messages-recv.js -@@ -911,6 +911,15 @@ export const makeMessagesRecvSocket = (config) => { - await sendMessageAck(node); +@@ -1232,6 +1232,15 @@ export const makeMessagesRecvSocket = (config) => { + await sendMessageAck(node).catch(ackErr => logger.error({ ackErr }, 'failed to ack receipt')); } }; + const handleStatus = async (node) => { @@ -17,18 +17,18 @@ index f2e2e10..b9d82c2 100644 + }; const handleNotification = async (node) => { const remoteJid = node.attrs.from; - if (shouldIgnoreJid(remoteJid) && remoteJid !== S_WHATSAPP_NET) { -@@ -1171,7 +1180,8 @@ export const makeMessagesRecvSocket = (config) => { - ['message', handleMessage], - ['call', handleCall], - ['receipt', handleReceipt], -- ['notification', handleNotification] -+ ['notification', handleNotification], -+ ['status', handleStatus] - ]); - const nodes = []; - let isProcessing = false; -@@ -1220,6 +1230,9 @@ export const makeMessagesRecvSocket = (config) => { + try { +@@ -1580,7 +1589,8 @@ export const makeMessagesRecvSocket = (config) => { + ['message', handleMessage], + ['call', handleCall], + ['receipt', handleReceipt], +- ['notification', handleNotification] ++ ['notification', handleNotification], ++ ['status', handleStatus] + ]), { + isWsOpen: () => ws.isOpen, + onUnexpectedError, +@@ -1621,6 +1631,9 @@ export const makeMessagesRecvSocket = (config) => { ws.on('CB:notification', async (node) => { await processNode('notification', node, 'handling notification', handleNotification); }); diff --git a/patches/whatsapp-rust-bridge+0.5.4.patch b/patches/whatsapp-rust-bridge+0.5.4.patch new file mode 100644 index 0000000000..1344f002e6 --- /dev/null +++ b/patches/whatsapp-rust-bridge+0.5.4.patch @@ -0,0 +1,94 @@ +diff --git a/node_modules/whatsapp-rust-bridge/package.json b/node_modules/whatsapp-rust-bridge/package.json +index 5739f7b..f98953a 100644 +--- a/node_modules/whatsapp-rust-bridge/package.json ++++ b/node_modules/whatsapp-rust-bridge/package.json +@@ -1,45 +1,46 @@ + { +- "name": "whatsapp-rust-bridge", +- "version": "0.5.4", +- "description": "A high-performance utilities for WhatsApp, powered by Rust and WebAssembly.", +- "author": "João Lucas ", +- "license": "MIT", +- "repository": { +- "type": "git", +- "url": "https://github.com/jlucaso1/whatsapp-rust-bridge.git" +- }, +- "type": "module", +- "files": [ +- "dist/index.js", +- "dist/index.d.ts", +- "pkg/whatsapp_rust_bridge.d.ts" +- ], +- "exports": { +- ".": { +- "import": "./dist/index.js", +- "types": "./dist/index.d.ts" +- } +- }, +- "scripts": { +- "bench": "bun run build && bun run benches/binary.ts && bun run benches/signal.ts && bun run benches/curve.ts && bun run benches/crypto.ts", +- "bench:node": "bun run build && node --expose-gc benches/binary.ts && node --expose-gc benches/signal.ts && node --expose-gc benches/curve.ts && node --expose-gc benches/crypto.ts", +- "build:wasm": "node scripts/build-wasm.mjs", +- "build:ts": "bun build ts/index.ts --outfile dist/index.js", +- "prebuild": "rm -rf dist", +- "postbuild": "tsc -p tsconfig.json --outDir dist", +- "build": "bun run prebuild && bun run build:wasm && bun run build:ts && bun run postbuild", +- "prepublishOnly": "bun run build" +- }, +- "devDependencies": { +- "@mitata/counters": "^0.0.8", +- "@types/bun": "^1.3.2", +- "@types/node": "^24.10.1", +- "@whiskeysockets/libsignal-node": "git+https://github.com/whiskeysockets/libsignal-node", +- "audio-decode": "^2.1.3", +- "baileys": "^7.0.0-rc.9", +- "mitata": "^1.0.34", +- "sharp": "^0.34.5", +- "typescript": "^5.9.3" +- }, +- "private": false ++ "name": "whatsapp-rust-bridge", ++ "version": "0.5.4", ++ "description": "A high-performance utilities for WhatsApp, powered by Rust and WebAssembly.", ++ "author": "João Lucas ", ++ "license": "MIT", ++ "repository": { ++ "type": "git", ++ "url": "https://github.com/jlucaso1/whatsapp-rust-bridge.git" ++ }, ++ "type": "module", ++ "files": [ ++ "dist/index.js", ++ "dist/index.d.ts", ++ "pkg/whatsapp_rust_bridge.d.ts" ++ ], ++ "exports": { ++ ".": { ++ "import": "./dist/index.js", ++ "types": "./dist/index.d.ts", ++ "require": "./dist/index.js" ++ } ++ }, ++ "scripts": { ++ "bench": "bun run build && bun run benches/binary.ts && bun run benches/signal.ts && bun run benches/curve.ts && bun run benches/crypto.ts", ++ "bench:node": "bun run build && node --expose-gc benches/binary.ts && node --expose-gc benches/signal.ts && node --expose-gc benches/curve.ts && node --expose-gc benches/crypto.ts", ++ "build:wasm": "node scripts/build-wasm.mjs", ++ "build:ts": "bun build ts/index.ts --outfile dist/index.js", ++ "prebuild": "rm -rf dist", ++ "postbuild": "tsc -p tsconfig.json --outDir dist", ++ "build": "bun run prebuild && bun run build:wasm && bun run build:ts && bun run postbuild", ++ "prepublishOnly": "bun run build" ++ }, ++ "devDependencies": { ++ "@mitata/counters": "^0.0.8", ++ "@types/bun": "^1.3.2", ++ "@types/node": "^24.10.1", ++ "@whiskeysockets/libsignal-node": "git+https://github.com/whiskeysockets/libsignal-node", ++ "audio-decode": "^2.1.3", ++ "baileys": "^7.0.0-rc.9", ++ "mitata": "^1.0.34", ++ "sharp": "^0.34.5", ++ "typescript": "^5.9.3" ++ }, ++ "private": false + } diff --git a/prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql b/prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql new file mode 100644 index 0000000000..3f61eff0ce --- /dev/null +++ b/prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql @@ -0,0 +1,30 @@ +-- Criar novas tabelas +CREATE TABLE "WhatsappContact" ( + id VARCHAR(36) PRIMARY KEY DEFAULT gen_random_uuid()::text, + remote_jid VARCHAR(100) UNIQUE NOT NULL, + lid VARCHAR(100), + created_at TIMESTAMP DEFAULT NOW() NOT NULL, + updated_at TIMESTAMP DEFAULT NOW() NOT NULL +); + +CREATE TABLE "WhatsappJidVariation" ( + id VARCHAR(36) PRIMARY KEY DEFAULT gen_random_uuid()::text, + contact_id VARCHAR(36) NOT NULL REFERENCES "WhatsappContact"(id) ON DELETE CASCADE, + jid_variation VARCHAR(150) UNIQUE NOT NULL, + created_at TIMESTAMP DEFAULT NOW() NOT NULL +); + +CREATE INDEX idx_contact_id ON "WhatsappJidVariation"(contact_id); +CREATE INDEX idx_jid_variation ON "WhatsappJidVariation"(jid_variation); + +-- Migrar dados da tabela antiga (OPCIONAL - rode depois de testar) +-- INSERT INTO "WhatsappContact" (remote_jid, lid, created_at, updated_at) +-- SELECT "remoteJid", lid, "createdAt", "updatedAt" +-- FROM public."IsOnWhatsapp"; + +-- INSERT INTO "WhatsappJidVariation" (contact_id, jid_variation) +-- SELECT +-- wc.id, +-- UNNEST(string_to_array(iow."jidOptions", ',')) +-- FROM public."IsOnWhatsapp" iow +-- JOIN "WhatsappContact" wc ON wc.remote_jid = iow."remoteJid"; \ No newline at end of file diff --git a/prisma/postgresql-migrations/20251029195234_add_whatssapp_variations/migration.sql b/prisma/postgresql-migrations/20251029195234_add_whatssapp_variations/migration.sql new file mode 100644 index 0000000000..d2e36bf6a2 --- /dev/null +++ b/prisma/postgresql-migrations/20251029195234_add_whatssapp_variations/migration.sql @@ -0,0 +1,32 @@ +/* + Warnings: + + - The primary key for the `WhatsappContact` table will be changed. If it partially fails, the table could be left without primary key constraint. + - The primary key for the `WhatsappJidVariation` table will be changed. If it partially fails, the table could be left without primary key constraint. + +*/ +-- DropForeignKey +ALTER TABLE "public"."WhatsappJidVariation" DROP CONSTRAINT "WhatsappJidVariation_contact_id_fkey"; + +-- DropIndex +DROP INDEX "public"."idx_jid_variation"; + +-- AlterTable +ALTER TABLE "WhatsappContact" DROP CONSTRAINT "WhatsappContact_pkey", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE TEXT, +ALTER COLUMN "created_at" SET DATA TYPE TIMESTAMP(3), +ALTER COLUMN "updated_at" DROP DEFAULT, +ALTER COLUMN "updated_at" SET DATA TYPE TIMESTAMP(3), +ADD CONSTRAINT "WhatsappContact_pkey" PRIMARY KEY ("id"); + +-- AlterTable +ALTER TABLE "WhatsappJidVariation" DROP CONSTRAINT "WhatsappJidVariation_pkey", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE TEXT, +ALTER COLUMN "contact_id" SET DATA TYPE TEXT, +ALTER COLUMN "created_at" SET DATA TYPE TIMESTAMP(3), +ADD CONSTRAINT "WhatsappJidVariation_pkey" PRIMARY KEY ("id"); + +-- AddForeignKey +ALTER TABLE "WhatsappJidVariation" ADD CONSTRAINT "WhatsappJidVariation_contact_id_fkey" FOREIGN KEY ("contact_id") REFERENCES "WhatsappContact"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/postgresql-migrations/migration_lock.toml b/prisma/postgresql-migrations/migration_lock.toml index 648c57fd59..044d57cdb0 100644 --- a/prisma/postgresql-migrations/migration_lock.toml +++ b/prisma/postgresql-migrations/migration_lock.toml @@ -1,3 +1,3 @@ # Please do not edit this file manually # It should be added in your version-control system (e.g., Git) -provider = "postgresql" \ No newline at end of file +provider = "postgresql" diff --git a/prisma/postgresql-schema.prisma b/prisma/postgresql-schema.prisma index 6b98f88da4..a960b9f844 100644 --- a/prisma/postgresql-schema.prisma +++ b/prisma/postgresql-schema.prisma @@ -665,6 +665,31 @@ model IsOnWhatsapp { updatedAt DateTime @updatedAt @db.Timestamp } +model WhatsappContact { + id String @id @default(uuid()) + remoteJid String @unique @map("remote_jid") @db.VarChar(100) + lid String? @db.VarChar(100) + createdAt DateTime @default(now()) @map("created_at") + updatedAt DateTime @updatedAt @map("updated_at") + + variations WhatsappJidVariation[] + + @@map("WhatsappContact") +} + +model WhatsappJidVariation { + id String @id @default(uuid()) + contactId String @map("contact_id") + jidVariation String @map("jid_variation") @db.VarChar(150) + createdAt DateTime @default(now()) @map("created_at") + + contact WhatsappContact @relation(fields: [contactId], references: [id], onDelete: Cascade) + + @@unique([jidVariation]) // Garante que cada variação é única globalmente + @@index([contactId], name: "idx_contact_id") + @@map("WhatsappJidVariation") +} + model N8n { id String @id @default(cuid()) enabled Boolean @default(true) @db.Boolean diff --git a/src/api/controllers/instance.controller.ts b/src/api/controllers/instance.controller.ts index 6a69106881..f23ba9b88e 100644 --- a/src/api/controllers/instance.controller.ts +++ b/src/api/controllers/instance.controller.ts @@ -399,6 +399,10 @@ export class InstanceController { }; } + public async instanceProfile({ instanceName }: InstanceDto) { + return this.waMonitor.instanceProfile(instanceName); + } + public async fetchInstances({ instanceName, instanceId, number }: InstanceDto, key: string) { const env = this.configService.get('AUTHENTICATION').API_KEY; @@ -445,7 +449,7 @@ export class InstanceController { return { status: 'SUCCESS', error: false, response: { message: 'Instance logged out' } }; } catch (error) { - throw new InternalServerErrorException(error.toString()); + throw new InternalServerErrorException(error); } } @@ -471,7 +475,7 @@ export class InstanceController { this.eventEmitter.emit('remove.instance', instanceName, 'inner'); return { status: 'SUCCESS', error: false, response: { message: 'Instance deleted' } }; } catch (error) { - throw new BadRequestException(error.toString()); + throw new BadRequestException(error); } } } diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 60e857fcc1..55bc9bb164 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -92,6 +92,7 @@ import { useMultiFileAuthStateRedisDb } from '@utils/use-multi-file-auth-state-r import axios from 'axios'; import makeWASocket, { AnyMessageContent, + BinaryNode, BufferedEventData, BufferJSON, CacheStore, @@ -252,6 +253,8 @@ export class BaileysStartupService extends ChannelStartupService { private logBaileys = this.configService.get('LOG').BAILEYS; private eventProcessingQueue: Promise = Promise.resolve(); + private static readonly connectionUpdateTimeouts: Map = new Map(); + private static readonly connectionUpdateData: Map = new Map(); // Cache TTL constants (in seconds) private readonly MESSAGE_CACHE_TTL_SECONDS = 5 * 60; // 5 minutes - avoid duplicate message processing private readonly UPDATE_CACHE_TTL_SECONDS = 30 * 60; // 30 minutes - avoid duplicate status updates @@ -265,10 +268,22 @@ export class BaileysStartupService extends ChannelStartupService { } public async logoutInstance() { - this.messageProcessor.onDestroy(); - await this.client?.logout('Log out instance: ' + this.instanceName); + try { + this.messageProcessor.onDestroy(); + await this.client?.logout('Log out instance: ' + this.instanceName); - this.client?.ws?.close(); + this.client?.ws?.close(); + } catch (error) { + if (error?.output?.statusCode === 428) { + if (['connecting', 'open'].includes(this.connectionStatus.state)) { + await this.connectionUpdate({ connection: 'close', lastDisconnect: error }); + } else { + throw error; + } + } else { + throw error; + } + } const db = this.configService.get('DATABASE'); const cache = this.configService.get('CACHE'); @@ -331,6 +346,27 @@ export class BaileysStartupService extends ChannelStartupService { }; } + private debouncedConnectionUpdateWebhook(data: any) { + const instanceName = this.instance.name; + + if (BaileysStartupService.connectionUpdateTimeouts.has(instanceName)) { + clearTimeout(BaileysStartupService.connectionUpdateTimeouts.get(instanceName)); + } + + BaileysStartupService.connectionUpdateData.set(instanceName, data); + + const timeout = setTimeout(() => { + const storedData = BaileysStartupService.connectionUpdateData.get(instanceName); + if (storedData) { + this.sendDataWebhook(Events.CONNECTION_UPDATE, storedData); + BaileysStartupService.connectionUpdateData.delete(instanceName); + } + BaileysStartupService.connectionUpdateTimeouts.delete(instanceName); + }, 30000); + + BaileysStartupService.connectionUpdateTimeouts.set(instanceName, timeout); + } + private async connectionUpdate({ qr, connection, lastDisconnect }: Partial) { if (qr) { if (this.instance.qrcode.count === this.configService.get('QRCODE').LIMIT) { @@ -347,7 +383,7 @@ export class BaileysStartupService extends ChannelStartupService { ); } - this.sendDataWebhook(Events.CONNECTION_UPDATE, { + this.debouncedConnectionUpdateWebhook({ instance: this.instance.name, state: 'refused', statusReason: DisconnectReason.connectionClosed, @@ -460,7 +496,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.debouncedConnectionUpdateWebhook({ instance: this.instance.name, ...this.stateConnection }); } } @@ -506,7 +542,7 @@ export class BaileysStartupService extends ChannelStartupService { this.syncChatwootLostMessages(); } - this.sendDataWebhook(Events.CONNECTION_UPDATE, { + this.debouncedConnectionUpdateWebhook({ instance: this.instance.name, wuid: this.instance.wuid, profileName: await this.getProfileName(), @@ -516,7 +552,7 @@ export class BaileysStartupService extends ChannelStartupService { } if (connection === 'connecting') { - this.sendDataWebhook(Events.CONNECTION_UPDATE, { instance: this.instance.name, ...this.stateConnection }); + this.debouncedConnectionUpdateWebhook({ instance: this.instance.name, ...this.stateConnection }); } } @@ -715,6 +751,25 @@ export class BaileysStartupService extends ChannelStartupService { this.sendDataWebhook(Events.CALL, payload, true, ['websocket']); }); + for (const passkeyNotificationType of ['passkey_prologue_request', 'crsc_continuation']) { + this.client.ws.on(`CB:notification,type:${passkeyNotificationType}`, async (notificationNode: BinaryNode) => { + try { + await this.client.sendNode({ + tag: 'ack', + attrs: { + id: notificationNode.attrs.id, + class: 'notification', + to: notificationNode.attrs.from, + type: notificationNode.attrs.type, + }, + }); + console.log(`🔑 ${this.phoneNumber} ACKed ${passkeyNotificationType} (passkey pairing flow)`); + } catch (ackError) { + console.error(`❌ ${this.phoneNumber} failed to ACK ${passkeyNotificationType}:`, ackError); + } + }); + } + this.phoneNumber = number; return this.client; @@ -2399,11 +2454,7 @@ export class BaileysStartupService extends ChannelStartupService { mentionedJid: [], groupMentions: [], //expiration: 7776000, - ephemeralSettingTimestamp: { - low: Math.floor(Date.now() / 1000) - 172800, - high: 0, - unsigned: false, - }, + ephemeralSettingTimestamp: Long.fromNumber(Math.floor(Date.now() / 1000) - 172800), disappearingMode: { initiator: 0 }, }; messageSent = await this.sendMessage( @@ -4757,6 +4808,9 @@ export class BaileysStartupService extends ChannelStartupService { } private async updateChatUnreadMessages(remoteJid: string): Promise { + // Desabilitar a atualização de mensagens não lidas + if (remoteJid) return null; + const [chat, unreadMessages] = await Promise.all([ this.prismaRepository.chat.findFirst({ where: { remoteJid } }), // Use raw SQL to avoid JSON path issues diff --git a/src/api/integrations/event/sqs/sqs.controller.ts b/src/api/integrations/event/sqs/sqs.controller.ts index 2b0398ef21..1039eb9a6f 100644 --- a/src/api/integrations/event/sqs/sqs.controller.ts +++ b/src/api/integrations/event/sqs/sqs.controller.ts @@ -23,15 +23,22 @@ export class SqsController extends EventController implements EventControllerInt const awsConfig = configService.get('SQS'); - this.sqs = new SQS({ - credentials: { - accessKeyId: awsConfig.ACCESS_KEY_ID, - secretAccessKey: awsConfig.SECRET_ACCESS_KEY, - }, - - region: awsConfig.REGION, - }); + if (awsConfig.DEV_QUEUE_URL) { + this.sqs = new SQS({ + endpoint: awsConfig.DEV_QUEUE_URL, + region: awsConfig.REGION, + credentials: { + accessKeyId: awsConfig.ACCESS_KEY_ID || 'local', + secretAccessKey: awsConfig.SECRET_ACCESS_KEY || 'local', + }, + }); + } else { + this.sqs = new SQS({ + credentials: { accessKeyId: awsConfig.ACCESS_KEY_ID, secretAccessKey: awsConfig.SECRET_ACCESS_KEY }, + region: awsConfig.REGION, + }); + } this.logger.info('SQS initialized'); const sqsConfig = configService.get('SQS'); @@ -62,16 +69,9 @@ export class SqsController extends EventController implements EventControllerInt } } - await this.saveQueues(instanceName, data[this.name].events, data[this.name]?.enabled); - const payload: any = { - where: { - instanceId: this.monitor.waInstances[instanceName].instanceId, - }, - update: { - enabled: data[this.name]?.enabled, - events: data[this.name].events, - }, + where: { instanceId: this.monitor.waInstances[instanceName].instanceId }, + update: { enabled: data[this.name]?.enabled, events: data[this.name].events }, create: { enabled: data[this.name]?.enabled, events: data[this.name].events, @@ -168,14 +168,11 @@ export class SqsController extends EventController implements EventControllerInt const messageGroupId = sqsConfig.GLOBAL_ENABLED ? `${serverConfig.NAME}-${eventFormatted}-${instanceName}` : 'evolution'; - const isGlobalEnabled = sqsConfig.GLOBAL_ENABLED; const params = { MessageBody: JSON.stringify(message), MessageGroupId: messageGroupId, QueueUrl: sqsUrl, - ...(!isGlobalEnabled && { - MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`, - }), + MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`, }; this.sqs.sendMessage(params, (err) => { diff --git a/src/api/routes/instance.router.ts b/src/api/routes/instance.router.ts index 3559893e68..822b4b42e9 100644 --- a/src/api/routes/instance.router.ts +++ b/src/api/routes/instance.router.ts @@ -54,6 +54,16 @@ export class InstanceRouter extends RouterBroker { return res.status(HttpStatus.OK).json(response); }) + .get(this.routerPath('profile'), ...guards, async (req, res) => { + const response = await this.dataValidate({ + request: req, + schema: null, + ClassRef: InstanceDto, + execute: (instance) => instanceController.instanceProfile(instance), + }); + + return res.status(HttpStatus.OK).json(response); + }) .get(this.routerPath('fetchInstances', false), ...guards, async (req, res) => { const key = req.get('apikey'); diff --git a/src/api/services/monitor.service.ts b/src/api/services/monitor.service.ts index 438530b57e..aad441e6b9 100644 --- a/src/api/services/monitor.service.ts +++ b/src/api/services/monitor.service.ts @@ -76,6 +76,16 @@ export class WAMonitoringService { } } + public async instanceProfile(instanceName: string) { + const instance = await this.prismaRepository.instance.findFirst({ where: { name: instanceName } }); + + if (instanceName && !instance && !this.waInstances[instanceName]) { + throw new NotFoundException(`Instance "${instanceName}" not found`); + } + + return instance; + } + public clearDelInstanceTime(instance: string) { if (this.delInstanceTimeouts[instance]) { clearTimeout(this.delInstanceTimeouts[instance]); @@ -305,6 +315,7 @@ export class WAMonitoringService { } this.waInstances[instanceData.instanceName] = instance; + this.delInstanceTime(instance.instanceName); } private async loadInstancesFromRedis() { diff --git a/src/config/env.config.ts b/src/config/env.config.ts index 7c4e382e7e..405121cfa7 100644 --- a/src/config/env.config.ts +++ b/src/config/env.config.ts @@ -121,6 +121,7 @@ export type Sqs = { SECRET_ACCESS_KEY: string; ACCOUNT_ID: string; REGION: string; + DEV_QUEUE_URL: string; MAX_PAYLOAD_SIZE: number; EVENTS: { APPLICATION_STARTUP: boolean; @@ -585,6 +586,7 @@ export class ConfigService { SECRET_ACCESS_KEY: process.env.SQS_SECRET_ACCESS_KEY || '', ACCOUNT_ID: process.env.SQS_ACCOUNT_ID || '', REGION: process.env.SQS_REGION || '', + DEV_QUEUE_URL: process.env.SQS_DEV_QUEUE_URL || '', MAX_PAYLOAD_SIZE: Number.parseInt(process.env.SQS_MAX_PAYLOAD_SIZE ?? '1048576'), EVENTS: { APPLICATION_STARTUP: process.env?.SQS_GLOBAL_APPLICATION_STARTUP === 'true', diff --git a/src/utils/onWhatsappCache.ts b/src/utils/onWhatsappCache.ts index 08de0714e2..e810a1dcd1 100644 --- a/src/utils/onWhatsappCache.ts +++ b/src/utils/onWhatsappCache.ts @@ -14,9 +14,8 @@ function getAvailableNumbers(remoteJid: string) { const [number, domain] = remoteJid.split('@'); - // TODO: Se já for @lid, retornar apenas ele mesmo SEM adicionar @domain novamente if (domain === 'lid' || domain === 'g.us') { - return [remoteJid]; // Retorna direto para @lid e @g.us + return [remoteJid]; } // Brazilian numbers @@ -28,9 +27,7 @@ function getAvailableNumbers(remoteJid: string) { numbersAvailable.push(numberWithDigit); numbersAvailable.push(numberWithoutDigit); } - // Mexican/Argentina numbers - // Ref: https://faq.whatsapp.com/1294841057948784 else if (number.startsWith('52') || number.startsWith('54')) { let prefix = ''; if (number.startsWith('52')) { @@ -49,13 +46,11 @@ function getAvailableNumbers(remoteJid: string) { numbersAvailable.push(numberWithDigit); numbersAvailable.push(numberWithoutDigit); } - // Other countries else { numbersAvailable.push(remoteJid); } - // TODO: Adiciona @domain apenas para números que não são @lid return numbersAvailable.map((number) => `${number}@${domain}`); } @@ -65,118 +60,100 @@ interface ISaveOnWhatsappCacheParams { lid?: 'lid' | undefined; } -function normalizeJid(jid: string | null | undefined): string | null { - if (!jid) return null; - return jid.startsWith('+') ? jid.slice(1) : jid; -} - export async function saveOnWhatsappCache(data: ISaveOnWhatsappCacheParams[]) { - if (!configService.get('DATABASE').SAVE_DATA.IS_ON_WHATSAPP) { - return; - } + if (!configService.get('DATABASE').SAVE_DATA.IS_ON_WHATSAPP) return; - // Processa todos os itens em paralelo para melhor performance - const processingPromises = data.map(async (item) => { - try { - const remoteJid = normalizeJid(item.remoteJid); - if (!remoteJid) { - logger.warn('[saveOnWhatsappCache] Item skipped, missing remoteJid.'); - return; - } + for (const item of data) { + const remoteJid = item.remoteJid.startsWith('+') ? item.remoteJid.slice(1) : item.remoteJid; + const allJids = [remoteJid]; - const altJidNormalized = normalizeJid(item.remoteJidAlt); - const lidAltJid = altJidNormalized && altJidNormalized.includes('@lid') ? altJidNormalized : null; + const altJid = + item.remoteJidAlt && item.remoteJidAlt.includes('@lid') + ? item.remoteJidAlt.startsWith('+') + ? item.remoteJidAlt.slice(1) + : item.remoteJidAlt + : null; - const baseJids = [remoteJid]; // Garante que o remoteJid esteja na lista inicial - if (lidAltJid) { - baseJids.push(lidAltJid); - } + if (altJid) { + allJids.push(altJid); + } - const expandedJids = baseJids.flatMap((jid) => getAvailableNumbers(jid)); - - // 1. Busca entrada por jidOptions e também remoteJid - // Às vezes acontece do remoteJid atual NÃO ESTAR no jidOptions ainda, ocasionando o erro: - // 'Unique constraint failed on the fields: (`remoteJid`)' - // Isso acontece principalmente em grupos que possuem o número do criador no ID (ex.: '559911223345-1234567890@g.us') - const existingRecord = await prismaRepository.isOnWhatsapp.findFirst({ - where: { - OR: [ - ...expandedJids.map((jid) => ({ jidOptions: { contains: jid } })), - { remoteJid: remoteJid }, // TODO: Descobrir o motivo que causa o remoteJid não estar (às vezes) incluso na lista de jidOptions - ], + const expandedJids = allJids.flatMap((jid) => getAvailableNumbers(jid)); + const uniqueJids = Array.from(new Set(expandedJids)); + + // 🎯 NOVA LÓGICA: Busca por variação em vez de LIKE + const existingVariation = await prismaRepository.whatsappJidVariation.findFirst({ + where: { + jidVariation: { + in: uniqueJids, }, - }); + }, + include: { + contact: { + include: { + variations: true, + }, + }, + }, + }); - logger.verbose( - `[saveOnWhatsappCache] Register exists for [${expandedJids.join(',')}]? => ${existingRecord ? existingRecord.remoteJid : 'Not found'}`, - ); + const existingContact = existingVariation?.contact; - // 2. Unifica todos os JIDs usando um Set para garantir valores únicos - const finalJidOptions = new Set(expandedJids); + logger.verbose(`Register exists: ${existingContact ? existingContact.remoteJid : 'not found'}`); - if (lidAltJid) { - finalJidOptions.add(lidAltJid); - } + const lidValue = item.lid === 'lid' || item.remoteJid?.includes('@lid') ? 'lid' : null; - if (existingRecord?.jidOptions) { - existingRecord.jidOptions.split(',').forEach((jid) => finalJidOptions.add(jid)); - } + if (existingContact) { + // Atualiza contato existente + await prismaRepository.whatsappContact.update({ + where: { id: existingContact.id }, + data: { + remoteJid, + lid: lidValue, + updatedAt: new Date(), + }, + }); - // 3. Prepara o payload final - // Ordena os JIDs para garantir consistência na string final - const sortedJidOptions = [...finalJidOptions].sort(); - const newJidOptionsString = sortedJidOptions.join(','); - const newLid = item.lid === 'lid' || item.remoteJid?.includes('@lid') ? 'lid' : null; - - const dataPayload = { - remoteJid: remoteJid, - jidOptions: newJidOptionsString, - lid: newLid, - }; - - // 4. Decide entre Criar ou Atualizar - if (existingRecord) { - // Compara a string de JIDs ordenada existente com a nova - const existingJidOptionsString = existingRecord.jidOptions - ? existingRecord.jidOptions.split(',').sort().join(',') - : ''; - - const isDataSame = - existingRecord.remoteJid === dataPayload.remoteJid && - existingJidOptionsString === dataPayload.jidOptions && - existingRecord.lid === dataPayload.lid; - - if (isDataSame) { - logger.verbose(`[saveOnWhatsappCache] Data for ${remoteJid} is already up-to-date. Skipping update.`); - return; // Pula para o próximo item - } - - // Os dados são diferentes, então atualiza - logger.verbose( - `[saveOnWhatsappCache] Register exists, updating: remoteJid=${remoteJid}, jidOptions=${dataPayload.jidOptions}, lid=${dataPayload.lid}`, - ); - await prismaRepository.isOnWhatsapp.update({ - where: { id: existingRecord.id }, - data: dataPayload, - }); - } else { - // Cria nova entrada - logger.verbose( - `[saveOnWhatsappCache] Register does not exist, creating: remoteJid=${remoteJid}, jidOptions=${dataPayload.jidOptions}, lid=${dataPayload.lid}`, - ); - await prismaRepository.isOnWhatsapp.create({ - data: dataPayload, + // Pega variações existentes + const existingVariations = new Set(existingContact.variations.map((v) => v.jidVariation)); + + // Identifica novas variações + const newVariations = uniqueJids.filter((jid) => !existingVariations.has(jid)); + + // Insere apenas as novas + if (newVariations.length > 0) { + await prismaRepository.whatsappJidVariation.createMany({ + data: newVariations.map((jid) => ({ + contactId: existingContact.id, + jidVariation: jid, + })), + skipDuplicates: true, }); + + logger.verbose(`Added ${newVariations.length} new variations for ${remoteJid}`); } - } catch (e) { - // Loga o erro mas não para a execução dos outros promises - logger.error(`[saveOnWhatsappCache] Error processing item for ${item.remoteJid}: `); - logger.error(e); + } else { + // Cria novo contato com todas as variações + await prismaRepository.whatsappContact.create({ + data: { + remoteJid, + lid: lidValue, + variations: { + createMany: { + data: uniqueJids.map((jid) => ({ + jidVariation: jid, + })), + skipDuplicates: true, + }, + }, + }, + }); + + logger.verbose(`Created new contact: ${remoteJid} with ${uniqueJids.length} variations`); } - }); - // Espera todas as operações paralelas terminarem - await Promise.allSettled(processingPromises); + logger.verbose(`Saving: remoteJid=${remoteJid}, variations=${uniqueJids.length}, lid=${lidValue}`); + } } export async function getOnWhatsappCache(remoteJids: string[]) { @@ -187,25 +164,42 @@ export async function getOnWhatsappCache(remoteJids: string[]) { lid?: string; }[] = []; - if (configService.get('DATABASE').SAVE_DATA.IS_ON_WHATSAPP) { - const remoteJidsWithoutPlus = remoteJids.map((remoteJid) => getAvailableNumbers(remoteJid)).flat(); + if (!configService.get('DATABASE').SAVE_DATA.IS_ON_WHATSAPP) { + return results; + } - const onWhatsappCache = await prismaRepository.isOnWhatsapp.findMany({ - where: { - OR: remoteJidsWithoutPlus.map((remoteJid) => ({ jidOptions: { contains: remoteJid } })), - updatedAt: { - gte: dayjs().subtract(configService.get('DATABASE').SAVE_DATA.IS_ON_WHATSAPP_DAYS, 'days').toDate(), + const remoteJidsExpanded = remoteJids.map((remoteJid) => getAvailableNumbers(remoteJid)).flat(); + const uniqueJids = Array.from(new Set(remoteJidsExpanded)); + + const dateLimit = dayjs() + .subtract(configService.get('DATABASE').SAVE_DATA.IS_ON_WHATSAPP_DAYS, 'days') + .toDate(); + + // 🎯 NOVA LÓGICA: Busca direta por índice + const contacts = await prismaRepository.whatsappContact.findMany({ + where: { + variations: { + some: { + jidVariation: { + in: uniqueJids, + }, }, }, - }); + updatedAt: { + gte: dateLimit, + }, + }, + include: { + variations: true, + }, + }); - results = onWhatsappCache.map((item) => ({ - remoteJid: item.remoteJid, - number: item.remoteJid.split('@')[0], - jidOptions: item.jidOptions.split(','), - lid: item.lid, - })); - } + results = contacts.map((contact) => ({ + remoteJid: contact.remoteJid, + number: contact.remoteJid.split('@')[0], + jidOptions: contact.variations.map((v) => v.jidVariation), + lid: contact.lid, + })); return results; }