@configurator/ravendb
Version:
RavenDB client for Node.js
27 lines • 881 B
JavaScript
;
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