优化后端鉴权与日志安全
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
replaceFulfillmentProfileRequirements,
|
||||
upsertFulfillmentProfile,
|
||||
upsertSkuFulfillmentBinding,
|
||||
type FulfillmentProfileRequirementInput,
|
||||
} from '../../repositories/fulfillment-profile-repo.js'
|
||||
import { upsertProductMatchRule } from '../../repositories/product-match-rule-repo.js'
|
||||
import { normalizeProductName } from '../order/product-match-service.js'
|
||||
@@ -14,7 +15,18 @@ import {
|
||||
} from '../order/kuaishou-cloud-fulfillment-config-service.js'
|
||||
import { nowIso } from '../../utils/time.js'
|
||||
|
||||
const CORE_PROFILES = [
|
||||
type JsonObject = Record<string, any>
|
||||
type CoreProfile = {
|
||||
profileKey: string
|
||||
name: string
|
||||
executorKey: string
|
||||
requiresClaim: boolean
|
||||
autoDispatch: boolean
|
||||
inventoryStrategy: string
|
||||
requirements: FulfillmentProfileRequirementInput[]
|
||||
}
|
||||
|
||||
const CORE_PROFILES: CoreProfile[] = [
|
||||
{
|
||||
profileKey: 'manual_review',
|
||||
name: '人工发货',
|
||||
@@ -35,8 +47,6 @@ const CORE_PROFILES = [
|
||||
},
|
||||
]
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
|
||||
export async function ensureFulfillmentCatalogBootstrapped() {
|
||||
const profileMap = await ensureCoreProfiles()
|
||||
await syncConfiguredFulfillmentBindings(profileMap)
|
||||
@@ -44,7 +54,7 @@ export async function ensureFulfillmentCatalogBootstrapped() {
|
||||
|
||||
async function ensureCoreProfiles() {
|
||||
const timestamp = nowIso()
|
||||
const profileMap = {}
|
||||
const profileMap: JsonObject = {}
|
||||
|
||||
for (const profile of CORE_PROFILES) {
|
||||
const saved = await upsertFulfillmentProfile({
|
||||
@@ -148,6 +158,6 @@ function resolveBindingRuntimeConfig(binding: JsonObject = {}) {
|
||||
return baseConfig
|
||||
}
|
||||
|
||||
function isPlainObject(value) {
|
||||
function isPlainObject(value: unknown): value is JsonObject {
|
||||
return Object.prototype.toString.call(value) === '[object Object]'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user