UNPKG

@configurator/ravendb

Version:
27 lines 881 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LazyMultiLoaderWithInclude = void 0; const Lazy_1 = require("../../Lazy"); class LazyMultiLoaderWithInclude { constructor(session) { this._includes = []; this._session = session; } include(path) { this._includes.push(path); return this; } load(ids, clazz) { const isMultiple = Array.isArray(ids); const result = this._session.lazyLoadInternal(isMultiple ? ids : [ids], this._includes, clazz); if (isMultiple) { return result; } return new Lazy_1.Lazy(async () => { const x = await result.getValue(); return x[Object.keys(x)[0]]; }); } } exports.LazyMultiLoaderWithInclude = LazyMultiLoaderWithInclude; //# sourceMappingURL=LazyMultiLoaderWithInclude.js.map