@ournet/domain
Version:
Ournet domain
25 lines (24 loc) • 769 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UseCase = void 0;
const debug = require("debug")("ournet:domain");
class UseCase {
execute(data, options) {
const name = this.constructor.name;
debug(`start executing of use case ${name}`);
return this.initData(data)
.then((idata) => this.validateData(idata))
.then((vdata) => this.innerExecute(vdata, options))
.then((result) => {
debug(`end execution of use case ${name}`);
return result;
});
}
initData(data) {
return Promise.resolve(data);
}
validateData(data) {
return Promise.resolve(data);
}
}
exports.UseCase = UseCase;