common-core-pkg
Version:
Common package for all the utils
17 lines • 599 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestContext = void 0;
exports.setRequestId = setRequestId;
exports.getRequestId = getRequestId;
const async_hooks_1 = require("async_hooks");
exports.requestContext = new async_hooks_1.AsyncLocalStorage();
function setRequestId(requestId) {
const store = new Map();
store.set('requestId', requestId);
exports.requestContext.run(store, () => { });
}
function getRequestId() {
const store = exports.requestContext.getStore();
return store?.get('requestId');
}
//# sourceMappingURL=index.js.map