import { generateNewId } from 'oak-domain/lib/utils/uuid'; // 当注入一个新的account entity时,将withdrawChannel的删除与之相关联 export function registerAccountEntity(entity) { accountEntities.push(entity); } export const accountEntities = ['offlineAccount']; const triggers = [ ...accountEntities.filter(ele => !!ele).map((entity) => [ { entity, action: 'remove', type: 'logical', checker: (operation, context) => { const { filter } = operation; return context.operate('withdrawChannel', { id: generateNewId(), action: 'remove', data: {}, filter: { [entity]: filter, } }, { dontCollect: true }); } }, ]).flat(), ]; export default triggers;