后端迁移履约初始化服务

This commit is contained in:
yml
2026-05-21 15:57:52 +08:00
parent 711112790e
commit ed659ea232
2 changed files with 13 additions and 3 deletions
@@ -68,6 +68,8 @@ const CORE_PROFILES = [
}, },
] ]
type JsonObject = Record<string, any>
export async function ensureFulfillmentCatalogBootstrapped() { export async function ensureFulfillmentCatalogBootstrapped() {
const profileMap = await ensureCoreProfiles() const profileMap = await ensureCoreProfiles()
await syncConfiguredFulfillmentBindings(profileMap) await syncConfiguredFulfillmentBindings(profileMap)
@@ -104,7 +106,7 @@ async function ensureCoreProfiles() {
return profileMap return profileMap
} }
export async function syncConfiguredFulfillmentBindings(profileMap = {}) { export async function syncConfiguredFulfillmentBindings(profileMap: JsonObject = {}) {
const timestamp = nowIso() const timestamp = nowIso()
const bindingsToApply = [ const bindingsToApply = [
...getLegacyOrderFulfillmentBindingConfigs(), ...getLegacyOrderFulfillmentBindingConfigs(),
@@ -164,11 +166,11 @@ export async function syncConfiguredFulfillmentBindings(profileMap = {}) {
} }
} }
export function resolveBindingMatchShopIds(binding = {}) { export function resolveBindingMatchShopIds(binding: JsonObject = {}) {
return [String(binding.shopId || '').trim()] return [String(binding.shopId || '').trim()]
} }
function resolveBindingRuntimeConfig(binding = {}) { function resolveBindingRuntimeConfig(binding: JsonObject = {}) {
const baseConfig = isPlainObject(binding.config) ? { ...binding.config } : {} const baseConfig = isPlainObject(binding.config) ? { ...binding.config } : {}
if (String(binding.provider || '').trim() === '91kaquan' && String(binding.platform || '').trim() === 'kuaishou') { if (String(binding.provider || '').trim() === '91kaquan' && String(binding.platform || '').trim() === 'kuaishou') {
@@ -570,6 +570,14 @@
- `npm run typecheck` - `npm run typecheck`
- `npm run build` - `npm run build`
- `npm test` 共 139 个用例通过 - `npm test` 共 139 个用例通过
132. 履约目录初始化服务迁移到 `.ts`
- `src/services/bootstrap/fulfillment-bootstrap-service.ts`
133. 核心履约 profile 初始化、配置绑定同步、SKU 绑定与商品匹配规则重建已进入 TS 编译链路;profileMap、binding 与运行时 config 补齐动态对象类型
134. Docker 内验证通过:
- `src/services/bootstrap/fulfillment-bootstrap-service.test.js` 共 2 个用例通过
- `npm run typecheck`
- `npm run build`
- `npm test` 共 139 个用例通过
## 下一步建议 ## 下一步建议