收紧后端 TypeScript:统一 Json 类型与 TaskContext 契约
关闭 allowJs;集中 JsonObject 定义并替换分散 any 别名;parseTaskContext 返回 TaskContext;任务详情 API 标注 AdminTaskDetailView;测试减少 as any。
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export function pickFirstNonEmpty(values: unknown[]) {
|
||||
for (const value of values) {
|
||||
const normalized = String(value || "").trim();
|
||||
@@ -17,6 +15,7 @@ export function isPlainObject(value: unknown): value is JsonObject {
|
||||
|
||||
import { getCloudtentaclesSourceByKey } from "../../../platforms/cloudtentacles/source-config-service.js";
|
||||
import { getCloudtentaclesSessionStateByKey } from "../../../platforms/cloudtentacles/session-state-service.js";
|
||||
import type { JsonObject } from '../../../../types/json.js'
|
||||
import {
|
||||
normalizeCloudtentaclesDeviceId,
|
||||
normalizeCloudtentaclesDeviceType,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { JsonObject } from '../../../../types/json.js'
|
||||
import {
|
||||
getCloudtentaclesSourceByKey,
|
||||
getCloudtentaclesSourcesFilePath,
|
||||
@@ -79,8 +80,6 @@ import type {
|
||||
AdminCloudtentaclesVirtualNumberInput,
|
||||
} from "../../../../types/admin/write-inputs.js";
|
||||
|
||||
type JsonObject = Record<string, any>;
|
||||
|
||||
type LocalCloudtentaclesTask = {
|
||||
taskId: number;
|
||||
taskNo: string;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { JsonObject } from '../../../../types/json.js'
|
||||
import {
|
||||
maskPhone as maskPhoneValue,
|
||||
maskSecret as maskSecretValue,
|
||||
@@ -7,8 +8,6 @@ import {
|
||||
normalizeCloudtentaclesDeviceType,
|
||||
} from "../../../platforms/cloudtentacles/defaults.js";
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export function maskSecret(value: unknown) {
|
||||
return maskSecretValue(value);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getCloudtentaclesSourceByKey } from "../../../platforms/cloudtentacles/source-config-service.js";
|
||||
import { getCloudtentaclesSessionStateByKey } from "../../../platforms/cloudtentacles/session-state-service.js";
|
||||
import type { JsonObject } from '../../../../types/json.js'
|
||||
import {
|
||||
normalizeCloudtentaclesDeviceId,
|
||||
normalizeCloudtentaclesDeviceType,
|
||||
@@ -12,8 +13,6 @@ import { maskPhone, maskSecret } from "./mappers.js";
|
||||
|
||||
const DEFAULT_CLOUDTENTACLES_BASE_URL = "https://123.207.217.176";
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
function _resolveSourceKey(payload: JsonObject = {}) {
|
||||
return String(payload.sourceKey || "").trim() || "default";
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import type { JsonObject } from '../../../../types/json.js'
|
||||
import {
|
||||
normalizeCloudtentaclesDeviceId,
|
||||
normalizeCloudtentaclesDeviceType,
|
||||
} from "../../../platforms/cloudtentacles/defaults.js";
|
||||
|
||||
type JsonObject = Record<string, any>;
|
||||
|
||||
export function normalizeAdminCloudtentaclesSourceConfigPayload(
|
||||
payload: JsonObject = {}
|
||||
) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { getKuaishouFeifeiConfig } from '../../platforms/kuaishou-feifei/config.js'
|
||||
import type { JsonObject } from '../../../types/json.js'
|
||||
import {
|
||||
createKuaishouFeifeiOrder,
|
||||
listKuaishouFeifeiProducts,
|
||||
@@ -16,8 +17,6 @@ import {
|
||||
import { normalizeCloudtentaclesMatchName } from '../../order/cloudtentacles-match-utils.js'
|
||||
import { createHttpError } from '../../../utils/http.js'
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export function getAdminKuaishouFeifeiConfig() {
|
||||
const source = getAdminEditableKuaishouFeifeiConfig()
|
||||
const effective = getKuaishouFeifeiConfig()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { maskSecret } from '../../../utils/masking.js'
|
||||
import { createHttpError } from '../../../utils/http.js'
|
||||
import type { JsonObject } from '../../../types/json.js'
|
||||
import {
|
||||
findKuaishouIndustryShopConfig,
|
||||
getKuaishouIndustrySourceConfig,
|
||||
@@ -13,8 +14,6 @@ import {
|
||||
refreshKuaishouIndustryAccessToken,
|
||||
} from '../../platforms/kuaishou-industry/token-service.js'
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
const SECRET_FIELDS = [
|
||||
'appSecret',
|
||||
'signSecret',
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import type { JsonObject } from '../../../types/json.js'
|
||||
import {
|
||||
failOpen91Order,
|
||||
listOpen91Orders,
|
||||
retryOpen91Order,
|
||||
} from '../../platforms/ninetyone/order-service.js'
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export async function getAdminNinetyoneOrders(query: JsonObject = {}) {
|
||||
return listOpen91Orders({
|
||||
page: Number(query.page || 1) || 1,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { JsonObject } from '../../../types/json.js'
|
||||
import {
|
||||
getNotificationConfig,
|
||||
getNotificationConfigFilePath,
|
||||
@@ -24,8 +25,6 @@ import type {
|
||||
AdminScheduledJobsConfigInput,
|
||||
} from '../../../types/admin/write-inputs.js'
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export function getAdminNotificationConfig() {
|
||||
const config = getNotificationConfig()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user