@grouparoo/core
Version:
The Grouparoo Core
25 lines (24 loc) • 843 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLSAction = void 0;
const actionhero_1 = require("actionhero");
const apm_1 = require("../../modules/apm");
const cls_1 = require("../../modules/cls");
class CLSAction extends actionhero_1.Action {
constructor() {
super();
}
isWriteTransaction() {
var _a;
if (((_a = this.permission) === null || _a === void 0 ? void 0 : _a.mode) === "read")
return false;
return true;
}
async run(params) {
return apm_1.APM.wrap(this.name, "action", params, async () => {
const options = { write: this.isWriteTransaction(), priority: true };
return cls_1.CLS.wrap(async () => await this.runWithinTransaction(params), options);
});
}
}
exports.CLSAction = CLSAction;