UNPKG

@nestdevx/database

Version:

Database module designed to work with mongodb for multi-tenant NestJS applications.

15 lines 545 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.requestStorage = void 0; exports.runWithContext = runWithContext; exports.currentTenantId = currentTenantId; const async_hooks_1 = require("async_hooks"); exports.requestStorage = new async_hooks_1.AsyncLocalStorage(); function runWithContext(ctx, fn) { exports.requestStorage.run(ctx, fn); } function currentTenantId() { const store = exports.requestStorage.getStore(); return store?.tenantId ?? null; } //# sourceMappingURL=request-context.js.map