"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultHttpContextProvider = void 0;
exports.setHttpContextResolver = setHttpContextResolver;
exports.getHttpContextResolver = getHttpContextResolver;
exports.applyHttpContext = applyHttpContext;
const node_crypto_1 = require("node:crypto");
const DefaultHttpContextProvider = () => ({
    reqId: (0, node_crypto_1.randomUUID)()
});
exports.DefaultHttpContextProvider = DefaultHttpContextProvider;
let httpContextProvider = exports.DefaultHttpContextProvider;
function setHttpContextResolver(provider) {
    httpContextProvider = provider;
}
function getHttpContextResolver() {
    return httpContextProvider;
}
function applyHttpContext(request) {
    request.context = {
        ...httpContextProvider(request),
        ...request.context
    };
    return request.context;
}
//# sourceMappingURL=context.js.map