feat(logging): Wave 2 - integrate logging throughout application
This commit integrates the logging infrastructure across the entire application: IPC Layer: - Add logger-handler.ts with centralized IPC logging channels - Integrate audit logging into auth, cleaner, extractor handlers - Add structured logging for IPC operations and data flow Service Layer: - Add logger integration to ERP services (extractor, cleaner) - Integrate logging into excel-parser and user DAO - Add operation tracking and error logging Renderer Layer: - Add useLogger hook for component-level logging - Update App.tsx with session and user activity logging - Enable frontend audit trail for critical actions Testing: - Add comprehensive IPC logging integration tests - Enhance unit test coverage for logger and audit-logger - Add end-to-end logging flow validation Types: - Update preload type definitions for logging APIs Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
34
src/preload/index.d.ts
vendored
34
src/preload/index.d.ts
vendored
@@ -20,10 +20,13 @@ import type {
|
||||
SaveSettingsResult
|
||||
} from '../main/types/settings.types'
|
||||
import type { IpcResult } from '../main/ipc'
|
||||
import type { LogLevel } from '../shared/ipc-channels'
|
||||
|
||||
export interface ResolverAPI {
|
||||
resolve: (input: ResolverInput) => Promise<IpcResult<ResolverResponse>>
|
||||
validateFormat: (inputs: string[]) => Promise<
|
||||
validateFormat: (
|
||||
inputs: string[]
|
||||
) => Promise<
|
||||
IpcResult<Array<{ input: string; type: 'productionId' | 'orderNumber' | 'unknown' }>>
|
||||
>
|
||||
}
|
||||
@@ -52,9 +55,9 @@ export interface ValidationAPI {
|
||||
}
|
||||
|
||||
export interface MaterialsAPI {
|
||||
upsertBatch: (materials: { materialCode: string; managerName: string }[]) => Promise<
|
||||
IpcResult<{ stats: { total: number; success: number; failed: number } }>
|
||||
>
|
||||
upsertBatch: (
|
||||
materials: { materialCode: string; managerName: string }[]
|
||||
) => Promise<IpcResult<{ stats: { total: number; success: number; failed: number } }>>
|
||||
delete: (materialCodes: string[]) => Promise<IpcResult<{ count: number }>>
|
||||
getManagers: () => Promise<IpcResult<{ managers: string[] }>>
|
||||
getByManager: (managerName: string) => Promise<IpcResult<{ materials: unknown[] }>>
|
||||
@@ -69,7 +72,9 @@ export interface MaterialsAPI {
|
||||
export interface SettingsAPI {
|
||||
getUserType: () => Promise<IpcResult<UserType>>
|
||||
getSettings: () => Promise<IpcResult<{ erp: { username: string; password: string } }>>
|
||||
saveSettings: (settings: { erp?: { username?: string; password?: string } }) => Promise<IpcResult<SaveSettingsResult>>
|
||||
saveSettings: (settings: {
|
||||
erp?: { username?: string; password?: string }
|
||||
}) => Promise<IpcResult<SaveSettingsResult>>
|
||||
resetDefaults: () => Promise<IpcResult<SaveSettingsResult>>
|
||||
testDbConnection: () => Promise<IpcResult<ConnectionTestResult>>
|
||||
}
|
||||
@@ -80,9 +85,9 @@ export interface MaterialTypeAPI {
|
||||
getManagers: () => Promise<IpcResult<string[]>>
|
||||
upsert: (materialName: string, managerName: string) => Promise<IpcResult<{ updated: boolean }>>
|
||||
delete: (materialName: string, managerName: string) => Promise<IpcResult<{ deleted: boolean }>>
|
||||
upsertBatch: (request: MaterialTypeBatchRequest) => Promise<
|
||||
IpcResult<{ stats: { total: number; success: number; failed: number } }>
|
||||
>
|
||||
upsertBatch: (
|
||||
request: MaterialTypeBatchRequest
|
||||
) => Promise<IpcResult<{ stats: { total: number; success: number; failed: number } }>>
|
||||
}
|
||||
|
||||
export interface UserErpConfigAPI {
|
||||
@@ -96,12 +101,18 @@ export interface UserErpConfigAPI {
|
||||
config: { url: string; username: string; password: string }
|
||||
}>
|
||||
>
|
||||
testConnection: (config: { url: string; username: string; password: string }) => Promise<
|
||||
IpcResult<{ message: string }>
|
||||
>
|
||||
testConnection: (config: {
|
||||
url: string
|
||||
username: string
|
||||
password: string
|
||||
}) => Promise<IpcResult<{ message: string }>>
|
||||
getAll: () => Promise<IpcResult<Array<{ username: string; erpUrl: string; erpUsername: string }>>>
|
||||
}
|
||||
|
||||
export interface LoggerAPI {
|
||||
log: (level: LogLevel, message: string, context?: Record<string, unknown>) => void
|
||||
}
|
||||
|
||||
export interface ProcessAPI {
|
||||
versions: {
|
||||
electron: string
|
||||
@@ -125,6 +136,7 @@ declare global {
|
||||
settings: SettingsAPI
|
||||
materialType: MaterialTypeAPI
|
||||
userErpConfig: UserErpConfigAPI
|
||||
logger: LoggerAPI
|
||||
}
|
||||
api: unknown
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user