ravendb
Version:
RavenDB client for Node.js
55 lines • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetIndexErrorsCommand = exports.GetIndexErrorsOperation = void 0;
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
class GetIndexErrorsOperation {
_indexNames;
constructor(indexNames = null) {
this._indexNames = indexNames;
}
getCommand(conventions) {
return new GetIndexErrorsCommand(this._indexNames, conventions);
}
get resultType() {
return "CommandResult";
}
}
exports.GetIndexErrorsOperation = GetIndexErrorsOperation;
class GetIndexErrorsCommand extends RavenCommand_js_1.RavenCommand {
_indexNames;
_conventions;
constructor(indexNames, conventions) {
super();
this._indexNames = indexNames;
this._conventions = conventions;
}
createRequest(node) {
let uri = node.url + "/databases/" + node.database + "/indexes/errors";
if (this._indexNames && this._indexNames.length) {
uri += "?";
for (const indexName of this._indexNames) {
uri += "&name=" + this._urlEncode(indexName);
}
}
return { uri };
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
const typeInfo = {
nestedTypes: {
"results[].errors[].timestamp": "date"
}
};
let body = null;
const results = await this._defaultPipeline(_ => body = _).process(bodyStream);
this.result = this._reviveResultTypes(results, this._conventions, typeInfo)["results"];
return body;
}
get isReadRequest() {
return true;
}
}
exports.GetIndexErrorsCommand = GetIndexErrorsCommand;
//# sourceMappingURL=GetIndexErrorsOperation.js.map