UNPKG

ravendb

Version:
45 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultiLoaderWithInclude = void 0; const TypeUtil_js_1 = require("../../../Utility/TypeUtil.js"); /** * Fluent implementation for specifying include paths * for loading documents */ class MultiLoaderWithInclude { _session; _includes = []; /** * Includes the specified path. */ include(path) { this._includes.push(path); return this; } /** * Loads the specified ids. */ async load(ids, documentType) { let singleResult = false; if (TypeUtil_js_1.TypeUtil.isString(ids)) { ids = [ids]; singleResult = true; } const entityType = this._session.conventions.getJsTypeByDocumentType(documentType); const results = await this._session.loadInternal(ids, { includes: this._includes, documentType: entityType }); return singleResult ? Object.keys(results).map(x => results[x]).find(x => x) : results; } /** * Initializes a new instance of the MultiLoaderWithInclude class */ constructor(session) { this._session = session; } } exports.MultiLoaderWithInclude = MultiLoaderWithInclude; //# sourceMappingURL=MultiLoaderWithInclude.js.map