UNPKG

diffusion

Version:

Diffusion JavaScript client

47 lines (46 loc) 1.64 kB
"use strict"; /** * @module LogRetrieval */ Object.defineProperty(exports, "__esModule", { value: true }); exports.LogRetrieval = void 0; var Services = require("./../services/log-retrieval-services"); var entries_fetch_request_1 = require("./../services/log-retrieval/entries-fetch-request"); /** * Internal feature for fetching log entries from the server */ var LogRetrieval = /** @class */ (function () { /** * Create a new LogRetrieval instance * * @param internal the internal session */ function LogRetrieval(internal) { this.internal = internal; this.FETCH_LOG_ENTRIES_SERVICE = internal.getServiceLocator().obtain(Services.FETCH_LOG_ENTRIES_SERVICE); } /** * Fetch log entries * * @param firstEntry the index of the first entry to fetch * @param entryCount the number of entries to fetch * @return a result that resolves with the fetched log entries */ LogRetrieval.prototype.fetchEntries = function (firstEntry, entryCount) { var _this = this; return new Promise(function (resolve, reject) { if (_this.internal.checkConnected(reject)) { _this.FETCH_LOG_ENTRIES_SERVICE.send(new entries_fetch_request_1.EntriesFetchRequest(firstEntry, entryCount), function (err, response) { if (err) { reject(err); } else { resolve(response); } }); } }); }; return LogRetrieval; }()); exports.LogRetrieval = LogRetrieval;