收紧后端 TypeScript:统一 Json 类型与 TaskContext 契约

关闭 allowJs;集中 JsonObject 定义并替换分散 any 别名;parseTaskContext 返回 TaskContext;任务详情 API 标注 AdminTaskDetailView;测试减少 as any。
This commit is contained in:
yml2213
2026-07-10 15:52:05 +08:00
parent e7244eaa5e
commit 8bcd9bbd81
79 changed files with 415 additions and 259 deletions
@@ -1,4 +1,5 @@
import { getCloudtentaclesAsset } from '../platforms/cloudtentacles/catalog-service.js'
import type { JsonObject } from '../../types/json.js'
import {
normalizeCloudtentaclesDeviceId,
normalizeCloudtentaclesDeviceType,
@@ -13,7 +14,6 @@ import {
notifyCloudtentaclesAuthExpired,
} from '../notification/domain-notifications.js'
type JsonObject = Record<string, any>
type CloudtentaclesHealthAccountResult = {
sourceKey: string
label: string
@@ -1,4 +1,5 @@
import path from 'node:path'
import type { JsonObject } from '../../types/json.js'
import { APP_CONFIG_KEYS } from '../../config/app-config-keys.js'
import { PROJECT_ROOT } from '../../config/runtime.js'
@@ -10,8 +11,6 @@ import {
const SCHEDULED_JOBS_FILE_PATH = path.join(PROJECT_ROOT, 'data', 'scheduled-jobs.json')
const CLOUDTENTACLES_HEALTH_JOB_ID = 'cloudtentacles-health'
type JsonObject = Record<string, any>
export function getScheduledJobsFilePath() {
return SCHEDULED_JOBS_FILE_PATH
}
@@ -1,13 +1,12 @@
import { logError, logInfo, logWarn } from '../../utils/logger.js'
import { createHttpError } from '../../utils/http.js'
import type { JsonObject } from '../../types/json.js'
import {
getCloudtentaclesHealthJob,
getScheduledJobsConfig,
} from './config-service.js'
import { runCloudtentaclesHealthJob } from './cloudtentacles-health-job.js'
type JsonObject = Record<string, any>
const timers = new Map<string, NodeJS.Timeout>()
const jobStates = new Map<string, JsonObject>()