ravendb
Version:
RavenDB client for Node.js
31 lines • 947 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LazyMultiLoaderWithInclude = void 0;
const Lazy_js_1 = require("../../Lazy.js");
class LazyMultiLoaderWithInclude {
_session;
_includes = [];
constructor(session) {
this._session = session;
}
/**
* Includes the specified path.
*/
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_js_1.Lazy(async () => {
const x = await result.getValue();
return x[Object.keys(x)[0]];
});
}
}
exports.LazyMultiLoaderWithInclude = LazyMultiLoaderWithInclude;
//# sourceMappingURL=LazyMultiLoaderWithInclude.js.map