"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const uuid_1 = require("oak-domain/lib/utils/uuid"); const watchers = [ { //settle 更新order时filter不允许携带iState故使用fn方式 name: '当settlePlan达到结算时间时,结算settlePlan', entity: 'settlePlan', filter: async () => { const now = Date.now(); return { iState: 'unsettled', when: { $lte: now, }, }; }, projection: { id: 1, }, fn: async (context, data) => { if (data.length > 0) { const ids = data.map((ele) => ele.id); await context.operate('settlePlan', { id: await (0, uuid_1.generateNewIdAsync)(), action: 'settle', data: {}, filter: { id: { $in: ids, } } }, {}); } return context.opResult; } } ]; exports.default = watchers;