From a150cbc5333bc59e56aded039d50229c867a6753 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sat, 21 Jun 2025 11:09:58 +0800 Subject: [PATCH] update --- package.json | 25 +- packages/xhs/readme.md | 0 packages/xhs/src/app.ts | 5 +- packages/xhs/src/libs/parse.ts | 3 + packages/xhs/src/routes/notes/create-note.ts | 14 + packages/xhs/src/routes/notes/index.ts | 1 + pnpm-lock.yaml | 363 ++++++++++++++----- src/app.ts | 2 +- src/modules/redis.ts | 44 +-- src/modules/sequelize.ts | 2 +- src/test/ai.ts | 2 +- 11 files changed, 332 insertions(+), 129 deletions(-) create mode 100644 packages/xhs/readme.md create mode 100644 packages/xhs/src/routes/notes/create-note.ts create mode 100644 packages/xhs/src/routes/notes/index.ts diff --git a/package.json b/package.json index df7cd88..d1c33cc 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,11 @@ "access": "public" }, "dependencies": { - "@kevisual/code-center-module": "0.0.18", - "@kevisual/router": "0.0.13", - "@kevisual/use-config": "^1.0.12", + "@kevisual/ai": "^0.0.6", + "@kevisual/code-center-module": "0.0.23", + "@kevisual/context": "^0.0.3", + "@kevisual/router": "0.0.23", + "@kevisual/use-config": "^1.0.19", "cookie": "^1.0.2", "dayjs": "^1.11.13", "formidable": "^3.5.4", @@ -44,30 +46,29 @@ "nanoid": "^5.1.5" }, "devDependencies": { - "@kevisual/ai-center": "^0.0.3", "@kevisual/app-assistant": "workspace:*", "@kevisual/social-prompts": "workspace:*", - "@kevisual/types": "^0.0.9", - "@kevisual/use-config": "^1.0.12", + "@kevisual/types": "^0.0.10", + "@kevisual/use-config": "^1.0.19", "@kevisual/xhs": "workspace:*", - "@types/bun": "^1.2.11", + "@types/bun": "^1.2.16", "@types/crypto-js": "^4.2.2", "@types/formidable": "^3.4.5", "@types/lodash-es": "^4.17.12", - "@types/node": "^22.15.3", - "bullmq": "^5.51.1", - "commander": "^13.1.0", + "@types/node": "^24.0.3", + "bullmq": "^5.54.3", + "commander": "^14.0.0", "concurrently": "^9.1.2", "cross-env": "^7.0.3", "dotenv": "^16.5.0", "inquire": "^0.4.8", "ioredis": "^5.6.1", "nodemon": "^3.1.10", - "pg": "^8.15.6", + "pg": "^8.16.2", "rimraf": "^6.0.1", "sequelize": "^6.37.7", "tape": "^5.9.0", "typescript": "^5.8.3" }, - "packageManager": "pnpm@10.10.0" + "packageManager": "pnpm@10.12.1" } \ No newline at end of file diff --git a/packages/xhs/readme.md b/packages/xhs/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/packages/xhs/src/app.ts b/packages/xhs/src/app.ts index 4919720..80af588 100644 --- a/packages/xhs/src/app.ts +++ b/packages/xhs/src/app.ts @@ -2,9 +2,10 @@ import { QueryRouterServer } from '@kevisual/router/browser'; import { XhsServices } from '@kevisual/xhs/services/xhs-services.ts'; export const app = new QueryRouterServer(); -export const xhsServices = new XhsServices(); +export const xhsServices = new XhsServices();// Semicolon separated Cookie File + const cookie = - 'a1=1969a2df762vy6p46vet3jjpwfvnoce52hge24v0430000640615;abRequestId=48bccb63-a540-5533-8215-546916a6386f;gid=yjKj0JdyjKJ4yjKj0JfiWx4hKJhvKU4Khd9qk84VVUEihdq8IlSd2J888K48Ky28SSqJKYSK;loadts=1746343425888;sec_poison_id=32d8febc-7543-41e7-8a1f-c652d32a1e1a;unread={%22ub%22:%2267f73e21000000001b0384ea%22%2C%22ue%22:%226812f08300000000090166d7%22%2C%22uc%22:32};web_session=040069b6528dbc23c355705e223a4b27b6660a;webBuild=4.62.3;webId=05b45ad626037308d58668196c6af47d;websectiga=8886be45f388a1ee7bf611a69f3e174cae48f1ea02c0f8ec3256031b8be9c7ee;xsecappid=xhs-pc-web;acw_tc=0a00d14717463434250061733e8b2fcd3804e9b06020e1f339ebd8b7e80fc4;'; + 'a1=1978d0cdcb7p5neac7cesgfm9yat0b4a7hnesexkp30000220066;abRequestId=f98f27d6-cceb-53d9-a9ef-dbd68786231b;access-token-creator.xiaohongshu.com=customer.creator.AT-68c517518075239703025713copo06lnusenqic1;customer-sso-sid=68c517518075239698553486mipyx4lwk2ac5jaj;customerClientId=716985104518687;galaxy_creator_session_id=wda55FJhoiAWZ8cekT2aGiM9fuztft3mOdRM;galaxy.creator.beaker.session.id=1750438297110093146037;gid=yjWYf8Si4SWjyjWYf8SfSxdCDWU2Id0SWSdMITUki6jv0dq898D40M888JJ88KK8fdKS8jiy;loadts=1750444792784;sec_poison_id=2f592adb-ec34-48cd-a6ce-22b90bd67c3b;unread={%22ub%22:%226852a4100000000022030063%22%2C%22ue%22:%226854e0db00000000100251f6%22%2C%22uc%22:28};web_session=040069b6528dbc23c355980a603a4b3e03bb6a;webBuild=4.68.0;webId=1dbb23b746393db622165a22357897d5;websectiga=10f9a40ba454a07755a08f27ef8194c53637eba4551cf9751c009d9afb564467;x-user-id-creator.xiaohongshu.com=6726cef4000000001c019303;xsecappid=xhs-pc-web;acw_tc=0a00d41117504447915317110e41effee63c597aa77f2c9f0dc1b0a10248f8;'; xhsServices.createRoot({ cookie, diff --git a/packages/xhs/src/libs/parse.ts b/packages/xhs/src/libs/parse.ts index 26debfe..8ce815e 100644 --- a/packages/xhs/src/libs/parse.ts +++ b/packages/xhs/src/libs/parse.ts @@ -10,6 +10,9 @@ const parseComment = (comment: CommonentInfo) => { content: comment.content, }; }; +/** + * 格式化评论信息 + */ export class Parse { static getComment(mention: Mention) { const typeList = ['comment/item', 'mention/comment', 'comment/comment']; diff --git a/packages/xhs/src/routes/notes/create-note.ts b/packages/xhs/src/routes/notes/create-note.ts new file mode 100644 index 0000000..2c484ae --- /dev/null +++ b/packages/xhs/src/routes/notes/create-note.ts @@ -0,0 +1,14 @@ +import { app, xhsServices } from '@kevisual/xhs/app.ts'; + +app + .route({ + path: 'note', + key: 'create', + }) + .define(async (ctx) => { + const client = xhsServices.getClient(); + const res = await client.c + if (res.code === 0) { + } + }) + .addTo(app); diff --git a/packages/xhs/src/routes/notes/index.ts b/packages/xhs/src/routes/notes/index.ts new file mode 100644 index 0000000..3137afe --- /dev/null +++ b/packages/xhs/src/routes/notes/index.ts @@ -0,0 +1 @@ +import './create-note.ts' \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44c22b0..ca27266 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,15 +8,21 @@ importers: .: dependencies: + '@kevisual/ai': + specifier: ^0.0.6 + version: 0.0.6 '@kevisual/code-center-module': - specifier: 0.0.18 - version: 0.0.18(@kevisual/auth@1.0.5)(@kevisual/router@0.0.13)(@kevisual/use-config@1.0.14(dotenv@16.5.0))(ioredis@5.6.1)(pg@8.15.6)(sequelize@6.37.7(pg@8.15.6)) + specifier: 0.0.23 + version: 0.0.23(dotenv@16.5.0) + '@kevisual/context': + specifier: ^0.0.3 + version: 0.0.3 '@kevisual/router': - specifier: 0.0.13 - version: 0.0.13 + specifier: 0.0.23 + version: 0.0.23 '@kevisual/use-config': - specifier: ^1.0.12 - version: 1.0.14(dotenv@16.5.0) + specifier: ^1.0.19 + version: 1.0.19(dotenv@16.5.0) cookie: specifier: ^1.0.2 version: 1.0.2 @@ -33,9 +39,6 @@ importers: specifier: ^5.1.5 version: 5.1.5 devDependencies: - '@kevisual/ai-center': - specifier: ^0.0.3 - version: 0.0.3 '@kevisual/app-assistant': specifier: workspace:* version: link:packages/app-assistant @@ -43,14 +46,14 @@ importers: specifier: workspace:* version: link:packages/social-prompts '@kevisual/types': - specifier: ^0.0.9 - version: 0.0.9 + specifier: ^0.0.10 + version: 0.0.10 '@kevisual/xhs': specifier: workspace:* version: link:packages/xhs '@types/bun': - specifier: ^1.2.11 - version: 1.2.11 + specifier: ^1.2.16 + version: 1.2.16 '@types/crypto-js': specifier: ^4.2.2 version: 4.2.2 @@ -61,14 +64,14 @@ importers: specifier: ^4.17.12 version: 4.17.12 '@types/node': - specifier: ^22.15.3 - version: 22.15.3 + specifier: ^24.0.3 + version: 24.0.3 bullmq: - specifier: ^5.51.1 - version: 5.51.1 + specifier: ^5.54.3 + version: 5.54.3 commander: - specifier: ^13.1.0 - version: 13.1.0 + specifier: ^14.0.0 + version: 14.0.0 concurrently: specifier: ^9.1.2 version: 9.1.2 @@ -88,14 +91,14 @@ importers: specifier: ^3.1.10 version: 3.1.10 pg: - specifier: ^8.15.6 - version: 8.15.6 + specifier: ^8.16.2 + version: 8.16.2 rimraf: specifier: ^6.0.1 version: 6.0.1 sequelize: specifier: ^6.37.7 - version: 6.37.7(pg@8.15.6)(sqlite3@5.1.7) + version: 6.37.7(pg@8.16.2)(sqlite3@5.1.7) tape: specifier: ^5.9.0 version: 5.9.0 @@ -128,7 +131,7 @@ importers: version: 5.1.5 sequelize: specifier: ^6.37.7 - version: 6.37.7(pg@8.15.6)(sqlite3@5.1.7) + version: 6.37.7(pg@8.16.2)(sqlite3@5.1.7) sqlite3: specifier: ^5.1.7 version: 5.1.7 @@ -212,21 +215,17 @@ packages: '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - '@kevisual/ai-center@0.0.3': - resolution: {integrity: sha512-GYY8PyOxh8G9VYkm5rBCmOabrdIdN5b5kyx15OaX0fZEi1rG5bzDTL4BTqx5KhurG01HHbXiq32BbCv4ZaSMVA==} + '@kevisual/ai@0.0.6': + resolution: {integrity: sha512-khTCGsDMjGL9VN8ZB2HzEPUXcSTHu1fHXKBRmyojxy9gt+lMCx7JFgqLKiENkekOUwS2Xg6Fe5jwQDNJRwGwDA==} '@kevisual/auth@1.0.5': resolution: {integrity: sha512-GwsLj7unKXi7lmMiIIgdig4LwwLiDJnOy15HHZR5gMbyK6s5/uJiMY5RXPB2+onGzTNDqFo/hXjsD2wkerHPVg==} - '@kevisual/code-center-module@0.0.18': - resolution: {integrity: sha512-BfANmxLEO1AwVmqpa6VDgxk//YN8asf1r5jIPpyKDQm12kyyrYgHND9AgGCDRH8lvq6rYVe0svCZXD5b06UPWQ==} - peerDependencies: - '@kevisual/auth': ^1.0.5 - '@kevisual/router': ^0.0.7 - '@kevisual/use-config': ^1.0.8 - ioredis: ^5.5.0 - pg: ^8.13.3 - sequelize: ^6.37.5 + '@kevisual/code-center-module@0.0.23': + resolution: {integrity: sha512-qusUc+BdheJAKFSCOfRJATxKOgE7uqhwMtB8fEI+N9NdbGAX7mshn3Pcq082RFFYrWLMNICsWq/6WczEFamgYw==} + + '@kevisual/context@0.0.3': + resolution: {integrity: sha512-cYpqVmoHVjv3NrGMU1e6iyiPDKRtNnK2wOWgbBU5d+8IHuC8VYHTg2GY5bnD/272GK7EYdr9x/c3QgsCIqR2BQ==} '@kevisual/db@0.0.1': resolution: {integrity: sha512-FgDS5FzcU5Um2UV6EYQN4+D4R24M6/A7DANMPpvTpRioS94apKsnthZQWNL65e6gPc4ca3ys8zygrF6rd3ZA7Q==} @@ -238,17 +237,28 @@ packages: '@kevisual/load@0.0.6': resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==} - '@kevisual/router@0.0.13': - resolution: {integrity: sha512-raji8aKXr0jigmJVOKBXb5gpstiAuyoIDy9m6SyPf4lRjCU3pspVI1bpscOUCBlaPICo6TLzPQxXhyTvvvtdWw==} + '@kevisual/logger@0.0.4': + resolution: {integrity: sha512-+fpr92eokSxoGOW1SIRl/27lPuO+zyY+feR5o2Q4YCNlAdt2x64NwC/w8r/3NEC5QenLgd4K0azyKTI2mHbARw==} - '@kevisual/types@0.0.9': - resolution: {integrity: sha512-SDJ7GMbOx7Ghz2kreHqym56ccAJS3t93y+NS0+afTLxcq2+cKcoEy2F8WXEv0mnJ6EsDp5AbA7Jv5TZA1Jbc3A==} + '@kevisual/router@0.0.22': + resolution: {integrity: sha512-Cqv2vV+hPBHrMMfvWlfDIuNrQcmd260oQZ4S5QR/R4tV35XtMKiseqhnC9uR09oVBJUh+d5rW3YucDDddheeDQ==} + + '@kevisual/router@0.0.23': + resolution: {integrity: sha512-W6ehlhAzNe58vq4QeQt2XFoO84Qaw34A0PVOByJsJ2ICj4YKBTclAt+rOAoISCvUeSbeNOIuhUE3sLyPfplzUw==} + + '@kevisual/types@0.0.10': + resolution: {integrity: sha512-Q73uzzjk9UidumnmCvOpgzqDDvQxsblz22bIFuoiioUFJWwaparx8bpd8ArRyFojicYL1YJoFDzDZ9j9NN8grA==} '@kevisual/use-config@1.0.14': resolution: {integrity: sha512-U4fmPFJre+Ph+hdg+EKVaRGxdpD4T4ZoOz5QLEyC6o3ekg8NC4n1i7Myo1ektqATyoG9Y0q/bJdOhiJwnLEt4g==} peerDependencies: dotenv: ^16.4.7 + '@kevisual/use-config@1.0.19': + resolution: {integrity: sha512-Q1IH4eMqUe5w6Bq8etoqOSls9FPIy0xwwD3wHf26EsQLZadhccI9qkDuFzP/rFWDa57mwFPEfwbGE5UlqWOCkw==} + peerDependencies: + dotenv: ^16.4.7 + '@ljharb/resumer@0.1.3': resolution: {integrity: sha512-d+tsDgfkj9X5QTriqM4lKesCkMMJC3IrbPKHvayP00ELx2axdXvDfWkqjxrLXIzGcQzmj7VAUT1wopqARTvafw==} engines: {node: '>= 0.4'} @@ -409,8 +419,8 @@ packages: resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} engines: {node: '>= 6'} - '@types/bun@1.2.11': - resolution: {integrity: sha512-ZLbbI91EmmGwlWTRWuV6J19IUiUC5YQ3TCEuSHI3usIP75kuoA8/0PVF+LTrbEnVc8JIhpElWOxv1ocI1fJBbw==} + '@types/bun@1.2.16': + resolution: {integrity: sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ==} '@types/cors@2.8.17': resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} @@ -442,6 +452,9 @@ packages: '@types/node@22.15.3': resolution: {integrity: sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==} + '@types/node@24.0.3': + resolution: {integrity: sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==} + '@types/validator@13.12.2': resolution: {integrity: sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==} @@ -561,8 +574,11 @@ packages: bullmq@5.51.1: resolution: {integrity: sha512-JEZokH5Sb6p66HRjbfQjPNYuSilDRcB8UREmJzOBqTTaJFza8I92vsBF3J/zmtzd7KVv3dxhZyH9CYSLOJALRA==} - bun-types@1.2.11: - resolution: {integrity: sha512-dbkp5Lo8HDrXkLrONm6bk+yiiYQSntvFUzQp0v3pzTAsXk6FtgVMjdQ+lzFNVAmQFUkPQZ3WMZqH5tTo+Dp/IA==} + bullmq@5.54.3: + resolution: {integrity: sha512-MVK2pOkB3hvrIcubwI8dS4qWHJLNKakKPpgRBTw91sIpPZArmvZ4t2hvryyEaJXJbAS/JHd6pKYOUd+RGRkWQQ==} + + bun-types@1.2.16: + resolution: {integrity: sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A==} cacache@15.3.0: resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} @@ -622,9 +638,9 @@ packages: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} - commander@13.1.0: - resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} - engines: {node: '>=18'} + commander@14.0.0: + resolution: {integrity: sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==} + engines: {node: '>=20'} concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -743,6 +759,10 @@ packages: resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} engines: {node: '>=0.10'} + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + detect-libc@2.0.4: resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==} engines: {node: '>=8'} @@ -768,12 +788,19 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + encodeurl@2.0.0: + resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} + engines: {node: '>= 0.8'} + encoding@0.1.13: resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} @@ -830,6 +857,13 @@ packages: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} @@ -869,6 +903,10 @@ packages: resolution: {integrity: sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==} engines: {node: '>=14.0.0'} + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} + fs-constants@1.0.0: resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} @@ -991,6 +1029,10 @@ packages: http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} + http-errors@2.0.0: + resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} + engines: {node: '>= 0.8'} + http-proxy-agent@4.0.1: resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} engines: {node: '>= 6'} @@ -1242,10 +1284,18 @@ packages: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} + mime-types@3.0.1: + resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==} + engines: {node: '>= 0.6'} + mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} @@ -1401,6 +1451,10 @@ packages: resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} engines: {node: '>= 0.4'} + on-finished@2.4.1: + resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} + engines: {node: '>= 0.8'} + once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -1437,31 +1491,34 @@ packages: resolution: {integrity: sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==} engines: {node: '>=16'} - pg-cloudflare@1.2.5: - resolution: {integrity: sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==} + pg-cloudflare@1.2.6: + resolution: {integrity: sha512-uxmJAnmIgmYgnSFzgOf2cqGQBzwnRYcrEgXuFjJNEkpedEIPBSEzxY7ph4uA9k1mI+l/GR0HjPNS6FKNZe8SBQ==} pg-connection-string@2.8.5: resolution: {integrity: sha512-Ni8FuZ8yAF+sWZzojvtLE2b03cqjO5jNULcHFfM9ZZ0/JXrgom5pBREbtnAw7oxsxJqHw9Nz/XWORUEL3/IFow==} + pg-connection-string@2.9.1: + resolution: {integrity: sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==} + pg-int8@1.0.1: resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} engines: {node: '>=4.0.0'} - pg-pool@3.9.6: - resolution: {integrity: sha512-rFen0G7adh1YmgvrmE5IPIqbb+IgEzENUm+tzm6MLLDSlPRoZVhzU1WdML9PV2W5GOdRA9qBKURlbt1OsXOsPw==} + pg-pool@3.10.1: + resolution: {integrity: sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==} peerDependencies: pg: '>=8.0' - pg-protocol@1.9.5: - resolution: {integrity: sha512-DYTWtWpfd5FOro3UnAfwvhD8jh59r2ig8bPtc9H8Ds7MscE/9NYruUQWFAOuraRl29jwcT2kyMFQ3MxeaVjUhg==} + pg-protocol@1.10.2: + resolution: {integrity: sha512-Ci7jy8PbaWxfsck2dwZdERcDG2A0MG8JoQILs+uZNjABFuBuItAZCWUNz8sXRDMoui24rJw7WlXqgpMdBSN/vQ==} pg-types@2.2.0: resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} engines: {node: '>=4'} - pg@8.15.6: - resolution: {integrity: sha512-yvao7YI3GdmmrslNVsZgx9PfntfWrnXwtR+K/DjI0I/sTKif4Z623um+sjVZ1hk5670B+ODjvHDAckKdjmPTsg==} - engines: {node: '>= 8.0.0'} + pg@8.16.2: + resolution: {integrity: sha512-OtLWF0mKLmpxelOt9BqVq83QV6bTfsS0XLegIeAKqKjurRnRKie1Dc1iL89MugmSLhftxw6NNCyZhm1yQFLMEQ==} + engines: {node: '>= 16.0.0'} peerDependencies: pg-native: '>=3.0.1' peerDependenciesMeta: @@ -1528,6 +1585,10 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + range-parser@1.2.1: + resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} + engines: {node: '>= 0.6'} + rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true @@ -1630,6 +1691,10 @@ packages: engines: {node: '>=10'} hasBin: true + send@1.2.0: + resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==} + engines: {node: '>= 18'} + sequelize-pool@7.1.0: resolution: {integrity: sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==} engines: {node: '>= 10.0.0'} @@ -1682,6 +1747,9 @@ packages: resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==} engines: {node: '>= 0.4'} + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -1767,6 +1835,14 @@ packages: standard-as-callback@2.1.0: resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==} + statuses@2.0.1: + resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} + engines: {node: '>= 0.8'} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + stop-iteration-iterator@1.1.0: resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} engines: {node: '>= 0.4'} @@ -1851,6 +1927,10 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + toposort-class@1.0.1: resolution: {integrity: sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg==} @@ -1907,6 +1987,9 @@ packages: undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici-types@7.8.0: + resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==} + unique-filename@1.1.1: resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} @@ -2040,8 +2123,8 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} - zod@3.24.2: - resolution: {integrity: sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==} + zod@3.25.67: + resolution: {integrity: sha512-idA2YXwpCdqUSKRCACDE6ItZD9TZzy3OZMtpfLoh6oPR47lipysRrJfjzMqFxQ3uJuUPyUeWe1r9vLH33xO/Qw==} snapshots: @@ -2099,26 +2182,41 @@ snapshots: '@jridgewell/sourcemap-codec@1.5.0': {} - '@kevisual/ai-center@0.0.3': {} + '@kevisual/ai@0.0.6': + dependencies: + '@kevisual/logger': 0.0.4 '@kevisual/auth@1.0.5': {} - '@kevisual/code-center-module@0.0.18(@kevisual/auth@1.0.5)(@kevisual/router@0.0.13)(@kevisual/use-config@1.0.14(dotenv@16.5.0))(ioredis@5.6.1)(pg@8.15.6)(sequelize@6.37.7(pg@8.15.6))': + '@kevisual/code-center-module@0.0.23(dotenv@16.5.0)': dependencies: '@kevisual/auth': 1.0.5 - '@kevisual/router': 0.0.13 - '@kevisual/use-config': 1.0.14(dotenv@16.5.0) + '@kevisual/context': 0.0.3 + '@kevisual/router': 0.0.22 + '@kevisual/use-config': 1.0.19(dotenv@16.5.0) ioredis: 5.6.1 nanoid: 5.1.5 - pg: 8.15.6 - sequelize: 6.37.7(pg@8.15.6)(sqlite3@5.1.7) + pg: 8.16.2 + sequelize: 6.37.7(pg@8.16.2)(sqlite3@5.1.7) socket.io: 4.8.1 - zod: 3.24.2 + zod: 3.25.67 transitivePeerDependencies: - bufferutil + - dotenv + - ibm_db + - mariadb + - mysql2 + - oracledb + - pg-hstore + - pg-native + - snowflake-sdk + - sqlite3 - supports-color + - tedious - utf-8-validate + '@kevisual/context@0.0.3': {} + '@kevisual/db@0.0.1': {} '@kevisual/dts@0.0.2(typescript@5.8.3)': @@ -2132,18 +2230,33 @@ snapshots: dependencies: eventemitter3: 5.0.1 - '@kevisual/router@0.0.13': + '@kevisual/logger@0.0.4': {} + + '@kevisual/router@0.0.22': dependencies: path-to-regexp: 8.2.0 selfsigned: 2.4.1 - '@kevisual/types@0.0.9': {} + '@kevisual/router@0.0.23': + dependencies: + path-to-regexp: 8.2.0 + selfsigned: 2.4.1 + send: 1.2.0 + transitivePeerDependencies: + - supports-color + + '@kevisual/types@0.0.10': {} '@kevisual/use-config@1.0.14(dotenv@16.5.0)': dependencies: '@kevisual/load': 0.0.6 dotenv: 16.5.0 + '@kevisual/use-config@1.0.19(dotenv@16.5.0)': + dependencies: + '@kevisual/load': 0.0.6 + dotenv: 16.5.0 + '@ljharb/resumer@0.1.3': dependencies: '@ljharb/through': 2.3.14 @@ -2254,13 +2367,13 @@ snapshots: '@tootallnate/once@1.1.2': optional: true - '@types/bun@1.2.11': + '@types/bun@1.2.16': dependencies: - bun-types: 1.2.11 + bun-types: 1.2.16 '@types/cors@2.8.17': dependencies: - '@types/node': 22.15.3 + '@types/node': 24.0.3 '@types/crypto-js@4.2.2': {} @@ -2272,7 +2385,7 @@ snapshots: '@types/formidable@3.4.5': dependencies: - '@types/node': 22.15.3 + '@types/node': 24.0.3 '@types/lodash-es@4.17.12': dependencies: @@ -2284,12 +2397,16 @@ snapshots: '@types/node-forge@1.3.11': dependencies: - '@types/node': 22.15.3 + '@types/node': 24.0.3 '@types/node@22.15.3': dependencies: undici-types: 6.21.0 + '@types/node@24.0.3': + dependencies: + undici-types: 7.8.0 + '@types/validator@13.12.2': {} abbrev@1.1.1: @@ -2433,9 +2550,21 @@ snapshots: transitivePeerDependencies: - supports-color - bun-types@1.2.11: + bullmq@5.54.3: dependencies: - '@types/node': 22.15.3 + cron-parser: 4.9.0 + ioredis: 5.6.1 + msgpackr: 1.11.2 + node-abort-controller: 3.1.1 + semver: 7.7.1 + tslib: 2.8.1 + uuid: 9.0.1 + transitivePeerDependencies: + - supports-color + + bun-types@1.2.16: + dependencies: + '@types/node': 24.0.3 cacache@15.3.0: dependencies: @@ -2523,7 +2652,7 @@ snapshots: dependencies: delayed-stream: 1.0.0 - commander@13.1.0: {} + commander@14.0.0: {} concat-map@0.0.1: {} @@ -2655,6 +2784,8 @@ snapshots: denque@2.1.0: {} + depd@2.0.0: {} + detect-libc@2.0.4: {} dezalgo@1.0.4: @@ -2678,10 +2809,14 @@ snapshots: eastasianwidth@0.2.0: {} + ee-first@1.1.1: {} + emoji-regex@8.0.0: {} emoji-regex@9.2.2: {} + encodeurl@2.0.0: {} + encoding@0.1.13: dependencies: iconv-lite: 0.6.3 @@ -2696,7 +2831,7 @@ snapshots: engine.io@6.6.4: dependencies: '@types/cors': 2.8.17 - '@types/node': 22.15.3 + '@types/node': 24.0.3 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.7.2 @@ -2806,6 +2941,10 @@ snapshots: escalade@3.2.0: {} + escape-html@1.0.3: {} + + etag@1.8.1: {} + eventemitter3@5.0.1: {} expand-template@2.0.3: {} @@ -2840,6 +2979,8 @@ snapshots: dezalgo: 1.0.4 once: 1.4.0 + fresh@2.0.0: {} + fs-constants@1.0.0: {} fs-minipass@2.1.0: @@ -2978,6 +3119,14 @@ snapshots: http-cache-semantics@4.1.1: optional: true + http-errors@2.0.0: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.1 + toidentifier: 1.0.1 + http-proxy-agent@4.0.1: dependencies: '@tootallnate/once': 1.1.2 @@ -3282,10 +3431,16 @@ snapshots: mime-db@1.52.0: {} + mime-db@1.54.0: {} + mime-types@2.1.35: dependencies: mime-db: 1.52.0 + mime-types@3.0.1: + dependencies: + mime-db: 1.54.0 + mimic-response@3.1.0: {} minimatch@10.0.1: @@ -3466,6 +3621,10 @@ snapshots: has-symbols: 1.1.0 object-keys: 1.1.1 + on-finished@2.4.1: + dependencies: + ee-first: 1.1.1 + once@1.4.0: dependencies: wrappy: 1.0.2 @@ -3500,18 +3659,20 @@ snapshots: path-to-regexp@8.2.0: {} - pg-cloudflare@1.2.5: + pg-cloudflare@1.2.6: optional: true pg-connection-string@2.8.5: {} + pg-connection-string@2.9.1: {} + pg-int8@1.0.1: {} - pg-pool@3.9.6(pg@8.15.6): + pg-pool@3.10.1(pg@8.16.2): dependencies: - pg: 8.15.6 + pg: 8.16.2 - pg-protocol@1.9.5: {} + pg-protocol@1.10.2: {} pg-types@2.2.0: dependencies: @@ -3521,15 +3682,15 @@ snapshots: postgres-date: 1.0.7 postgres-interval: 1.2.0 - pg@8.15.6: + pg@8.16.2: dependencies: - pg-connection-string: 2.8.5 - pg-pool: 3.9.6(pg@8.15.6) - pg-protocol: 1.9.5 + pg-connection-string: 2.9.1 + pg-pool: 3.10.1(pg@8.16.2) + pg-protocol: 1.10.2 pg-types: 2.2.0 pgpass: 1.0.5 optionalDependencies: - pg-cloudflare: 1.2.5 + pg-cloudflare: 1.2.6 pgpass@1.0.5: dependencies: @@ -3587,6 +3748,8 @@ snapshots: punycode@2.3.1: {} + range-parser@1.2.1: {} + rc@1.2.8: dependencies: deep-extend: 0.6.0 @@ -3727,9 +3890,25 @@ snapshots: semver@7.7.1: {} + send@1.2.0: + dependencies: + debug: 4.4.0(supports-color@5.5.0) + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 2.0.0 + http-errors: 2.0.0 + mime-types: 3.0.1 + ms: 2.1.3 + on-finished: 2.4.1 + range-parser: 1.2.1 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + sequelize-pool@7.1.0: {} - sequelize@6.37.7(pg@8.15.6)(sqlite3@5.1.7): + sequelize@6.37.7(pg@8.16.2)(sqlite3@5.1.7): dependencies: '@types/debug': 4.1.12 '@types/validator': 13.12.2 @@ -3748,7 +3927,7 @@ snapshots: validator: 13.12.0 wkx: 0.5.0 optionalDependencies: - pg: 8.15.6 + pg: 8.16.2 sqlite3: 5.1.7 transitivePeerDependencies: - supports-color @@ -3778,6 +3957,8 @@ snapshots: es-errors: 1.3.0 es-object-atoms: 1.1.1 + setprototypeof@1.2.0: {} + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -3903,6 +4084,10 @@ snapshots: standard-as-callback@2.1.0: {} + statuses@2.0.1: {} + + statuses@2.0.2: {} + stop-iteration-iterator@1.1.0: dependencies: es-errors: 1.3.0 @@ -4032,6 +4217,8 @@ snapshots: dependencies: is-number: 7.0.0 + toidentifier@1.0.1: {} + toposort-class@1.0.1: {} touch@3.1.1: {} @@ -4098,6 +4285,8 @@ snapshots: undici-types@6.21.0: {} + undici-types@7.8.0: {} + unique-filename@1.1.1: dependencies: unique-slug: 2.0.2 @@ -4186,7 +4375,7 @@ snapshots: wkx@0.5.0: dependencies: - '@types/node': 22.15.3 + '@types/node': 24.0.3 wrap-ansi@7.0.0: dependencies: @@ -4228,4 +4417,4 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 - zod@3.24.2: {} + zod@3.25.67: {} diff --git a/src/app.ts b/src/app.ts index cd3952c..18f4102 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,5 +1,5 @@ import { App } from '@kevisual/router'; -import { useContextKey } from '@kevisual/use-config/context'; +import { useContextKey } from '@kevisual/context'; const init = () => { return new App(); diff --git a/src/modules/redis.ts b/src/modules/redis.ts index 335257e..e3ca6fc 100644 --- a/src/modules/redis.ts +++ b/src/modules/redis.ts @@ -1,15 +1,16 @@ import { Redis } from 'ioredis'; import { config } from './config.ts'; -import { useContextKey } from '@kevisual/use-config/context'; +import { useContextKey } from '@kevisual/context'; -type initRedisOpts = { - onConnect?: () => void; // 连接成功的回调函数 - onError?: (msg?: any) => void; // 连接断开的回调函数 +const redisConfig = { + host: config.REDIS_HOST || 'localhost', + port: parseInt(config.REDIS_PORT || '6379'), + password: config.REDIS_PASSWORD, }; -const initRedis = (config?: any, options?: initRedisOpts) => { - const redis = new Redis({ - host: config?.REDIS_HOST || 'localhost', // Redis 服务器的主机名或 IP 地址 - port: config?.REDIS_PORT || 6379, // Redis 服务器的端口号 +export const createRedisClient = (options = {}) => { + const redisClient = new Redis({ + host: 'localhost', // Redis 服务器的主机名或 IP 地址 + port: 6379, // Redis 服务器的端口号 // password: 'your_password', // Redis 的密码 (如果有) db: 0, // 要使用的 Redis 数据库索引 (0-15) keyPrefix: '', // key 前缀 @@ -18,27 +19,20 @@ const initRedis = (config?: any, options?: initRedisOpts) => { return Math.min(times * 50, 2000); // 每次重试时延迟增加 }, maxRetriesPerRequest: null, // 允许请求重试的次数 (如果需要无限次重试) - ...config, // 其他配置项 + ...redisConfig, + ...options, }); - // 监听连接事件 - redis.on('connect', () => { - if (options?.onConnect) { - options.onConnect(); - console.log('Redis 连接成功'); - } + redisClient.on('connect', () => { + console.log('Redis client connected successfully'); }); - - redis.on('error', (err) => { - console.error('Redis 连接错误', err); - if (options?.onError) { - options.onError(err); - } + redisClient.on('error', (err) => { + console.error('Redis client error:', err); }); - return redis; + return redisClient; }; // 配置 Redis 连接 -export const redis = useContextKey('redis', () => initRedis(config)); +export const redis = useContextKey('redis', () => createRedisClient()); // 初始化 Redis 客户端 -export const redisPublisher = new Redis(); // 用于发布消息 -export const redisSubscriber = new Redis(); // 用于订阅消息 +// export const redisPublisher = createRedisClient(); // 用于发布消息 +// export const redisSubscriber = createRedisClient(); // 用于订阅消息 diff --git a/src/modules/sequelize.ts b/src/modules/sequelize.ts index 0a7daa6..0a0ca57 100644 --- a/src/modules/sequelize.ts +++ b/src/modules/sequelize.ts @@ -1,6 +1,6 @@ import { Sequelize } from 'sequelize'; import { config } from './config.ts'; -import { useContextKey } from '@kevisual/use-config/context'; +import { useContextKey } from '@kevisual/context'; export type PostgresConfig = { postgres: { diff --git a/src/test/ai.ts b/src/test/ai.ts index 2b1f62c..ebf419e 100644 --- a/src/test/ai.ts +++ b/src/test/ai.ts @@ -1,4 +1,4 @@ -import { ProviderManager, SiliconFlowProvider } from '@kevisual/ai-center'; +import { ProviderManager, SiliconFlowProvider } from '@kevisual/ai'; import dotenv from 'dotenv'; import util from 'node:util'; dotenv.config();