32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
"use strict";
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.accountEntities = void 0;
|
||
exports.registerAccountEntity = registerAccountEntity;
|
||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||
// 当注入一个新的account entity时,将withdrawChannel的删除与之相关联
|
||
function registerAccountEntity(entity) {
|
||
exports.accountEntities.push(entity);
|
||
}
|
||
exports.accountEntities = ['offlineAccount'];
|
||
const triggers = [
|
||
...exports.accountEntities.filter(ele => !!ele).map((entity) => [
|
||
{
|
||
entity,
|
||
action: 'remove',
|
||
type: 'logical',
|
||
checker: (operation, context) => {
|
||
const { filter } = operation;
|
||
return context.operate('withdrawChannel', {
|
||
id: (0, uuid_1.generateNewId)(),
|
||
action: 'remove',
|
||
data: {},
|
||
filter: {
|
||
[entity]: filter,
|
||
}
|
||
}, { dontCollect: true });
|
||
}
|
||
},
|
||
]).flat(),
|
||
];
|
||
exports.default = triggers;
|