feat: add TypeORM, logger, schemas, hooks and stores

- Add TypeORM integration with data-source, entities and repositories
- Add logger service for structured logging
- Add Zod validation schemas for auth, cleaner and extractor
- Add custom React hooks (useAuth, useCleaner, useExtractor, useValidation)
- Add Zustand stores (useAppStore, useUserStore)
- Add UI components (Button, Modal, Toast)
- Add error types and ErpBrowserManager
- Refactor IPC handlers and services
- Add unit tests for new modules

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-03-02 23:10:15 +08:00
parent 982fb8fde6
commit a05c8a9037
57 changed files with 5150 additions and 974 deletions

View File

@@ -1,5 +1,8 @@
import { chromium, type BrowserContext, type Page } from 'playwright'
import type { ErpConfig, ErpSession } from '../../types/erp.types'
import { createLogger } from '../logger'
const log = createLogger('ErpAuthService')
/**
* ERP Authentication Service
@@ -91,7 +94,7 @@ export class ErpAuthService {
try {
await page.waitForLoadState('domcontentloaded', { timeout: 10000 })
} catch (e) {
console.log('Page load state check timed out, continuing...')
log.warn('Page load state check timed out, continuing')
}
// Handle force login confirmation dialog if present (Python: get_by_role("button", name="确定"))
@@ -99,15 +102,15 @@ export class ErpAuthService {
const confirmBtn = mainFrame.getByRole('button', { name: '确定' })
const count = await confirmBtn.count()
if (count > 0) {
console.log('Force login detected, clicking confirm button')
log.info('Force login detected, clicking confirm button')
await confirmBtn.first().click()
await page.waitForTimeout(2000)
} else {
console.log('Normal login, no confirmation dialog')
log.debug('Normal login, no confirmation dialog')
}
} catch (e) {
} catch {
// No force login dialog, continue
console.log('Normal login, no confirmation dialog')
log.debug('Normal login, no confirmation dialog')
}
// Create session with mainFrame (Python returns main_frame as part of login result)