Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #11

Merged
merged 7 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4.0.2
with:
node-version: 18.x

Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR Comment

on:
pull_request:
types:
- opened
- synchronize
- reopened
- unlocked

jobs:
pr-comment:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions: write-all
steps:
- uses: actions/checkout@v3
- uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message-id: pr-comment
message: |
Thanks for your contribution.

The next step is to wait for review and approval to merge it to main repository

The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it.
message-failure: |
Your PR failed, please check it before continuing to the next step.
20 changes: 15 additions & 5 deletions .github/workflows/update-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.4
with:
fetch-depth: 0

- name: Fetching tags
run: git fetch --tags -f || true

- name: Setup Node
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v4.0.2
with:
node-version: 18.x
registry-url: "https://registry.npmjs.org"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4.0.2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -39,6 +42,13 @@ jobs:

- name: Install Dependencies
run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish in NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Build NPM package
run: yarn pack && mv mysql-baileys-*.tgz mysql-baileys-nightly.tgz
Expand All @@ -52,14 +62,14 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT

- name: Update Nightly TAG
uses: richardsimko/update-tag@v1
uses: richardsimko/update-tag@v1.0.11
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly

- name: Update Nightly Release
uses: meeDamian/github-release@2.0
uses: meeDamian/github-release@v2.0.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "bobslavtriev",
"name": "mysql-baileys",
"version": "1.2.0",
"version": "1.2.1",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"description": "Implementation of MySQL in Baileys.",
Expand All @@ -12,7 +12,9 @@
],
"scripts": {
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --fix --ext .ts",
"build": "tsc",
"prepack": "tsc",
"prepare": "tsc"
},
"repository": {
Expand All @@ -24,11 +26,12 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@whiskeysockets/baileys": "github:whiskeysockets/baileys",
"@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
"@types/node": "^16.18.69",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"@whiskeysockets/baileys": "^6.7.0",
"eslint": "^8.56.0",
"ts-node": "^10.8.1",
"typescript": "^4.6.4"
Expand Down
4 changes: 2 additions & 2 deletions src/Mysql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { MySQLConfig, sqlData, sqlConnection, AuthenticationCreds } from '../Typ
*/

let conn: sqlConnection
let pending: boolean = true
let pending: boolean | undefined
let taskKeepAlive: NodeJS.Timeout | undefined
const DEFAULT_TABLE_NAME = 'auth';

Expand Down Expand Up @@ -73,7 +73,7 @@ export const useMySQLAuthState = async(config: MySQLConfig): Promise<{ state: ob

taskKeepAlive = setInterval(async () => {
await conn.ping().catch(async () => await reconnect())
if (!!conn?.connection?._closing){
if (conn?.connection?._closing){
await reconnect()
}
}, keepAliveIntervalMs)
Expand Down
3 changes: 2 additions & 1 deletion src/Types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { proto } from '@whiskeysockets/baileys'
import { Connection } from 'mysql2/promise'
import type { SslOptions } from 'mysql2/promise'

export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>

Expand All @@ -26,7 +27,7 @@ export type MySQLConfig = {
keepAliveIntervalMs: number | undefined
retryRequestDelayMs: number | undefined
maxtRetries: number | undefined
ssl?: any
ssl?: string | SslOptions | undefined
}

export type valueReplacer = {
Expand Down
Loading