From 3967c26ebc0d568a6c2b328f4192b4edcae663e0 Mon Sep 17 00:00:00 2001 From: geekgeekrun Date: Sun, 17 Mar 2024 23:45:04 +0800 Subject: [PATCH] import db in ui project --- packages/ui/package.json | 1 + .../flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index.ts | 2 -- .../main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index.ts | 7 ++++++- pnpm-lock.yaml | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/ui/package.json b/packages/ui/package.json index cfa2717..1a1dbd2 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -30,6 +30,7 @@ "@geekgeekrun/dingtalk-plugin": "workspace:*", "@geekgeekrun/geek-auto-start-chat-with-boss": "workspace:*", "@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension": "workspace:*", + "@geekgeekrun/sqlite-plugin": "workspace:*", "@geekgeekrun/utils": "workspace:*", "@puppeteer/browsers": "^2.0.0", "JSONStream": "^1.3.5", diff --git a/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index.ts b/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index.ts index 055a157..4d4feab 100644 --- a/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index.ts +++ b/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index.ts @@ -1,5 +1,3 @@ -import path from 'node:path' -import * as url from 'url' import { sleep } from '@geekgeekrun/utils/sleep.mjs' import childProcess from 'node:child_process' import { AUTO_CHAT_ERROR_EXIT_CODE } from '../../../common/enums/auto-start-chat' diff --git a/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index.ts b/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index.ts index 79f3f6f..1b44e74 100644 --- a/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index.ts +++ b/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index.ts @@ -8,10 +8,14 @@ import { getAnyAvailablePuppeteerExecutable } from '../CHECK_AND_DOWNLOAD_DEPEND import { sleep } from '@geekgeekrun/utils/sleep.mjs' import { AUTO_CHAT_ERROR_EXIT_CODE } from '../../../common/enums/auto-start-chat' +import SqlitePluginModule from '@geekgeekrun/sqlite-plugin' +const { default: SqlitePlugin } = SqlitePluginModule + const { groupRobotAccessToken: dingTalkAccessToken } = readConfigFile('dingtalk.json') const initPlugins = (hooks) => { new DingtalkPlugin(dingTalkAccessToken).apply(hooks) + new SqlitePlugin().apply(hooks) } let isParentProcessDisconnect = false @@ -62,8 +66,9 @@ export const runAutoChat = async () => { puppeteerLaunched: new SyncHook(), pageLoaded: new SyncHook(), cookieWillSet: new SyncHook(['cookies']), + userInfoResponse: new AsyncSeriesHook(['userInfo']), newChatWillStartup: new AsyncSeriesHook(['positionInfoDetail']), - newChatStartup: new SyncHook(['positionInfoDetail']), + newChatStartup: new AsyncSeriesHook(['positionInfoDetail']), noPositionFoundForCurrentJob: new SyncHook(), noPositionFoundAfterTraverseAllJob: new SyncHook(), errorEncounter: new SyncHook(['errorInfo']) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ffb9158..12278ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -103,6 +103,9 @@ importers: '@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension': specifier: workspace:* version: link:../launch-bosszhipin-login-page-with-preload-extension + '@geekgeekrun/sqlite-plugin': + specifier: workspace:* + version: link:../sqlite-plugin '@geekgeekrun/utils': specifier: workspace:* version: link:../utils