ravendb
Version:
RavenDB client for Node.js
42 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetRevisionsCountOperation = void 0;
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
const index_js_1 = require("../../../Exceptions/index.js");
class GetRevisionsCountOperation {
_docId;
constructor(docId) {
this._docId = docId;
}
createRequest() {
return new GetRevisionsCountCommand(this._docId);
}
}
exports.GetRevisionsCountOperation = GetRevisionsCountOperation;
class GetRevisionsCountCommand extends RavenCommand_js_1.RavenCommand {
_id;
constructor(id) {
super();
if (!id) {
(0, index_js_1.throwError)("InvalidArgumentException", "Id cannot be null");
}
this._id = id;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database + "/revisions/count?&id=" + this._urlEncode(this._id);
return {
method: "GET",
uri
};
}
async setResponseAsync(bodyStream, fromCache) {
let body = null;
const result = await this._defaultPipeline(_ => body = _).process(bodyStream);
this.result = result.revisionsCount;
return body;
}
get isReadRequest() {
return true;
}
}
//# sourceMappingURL=GetRevisionsCountOperation.js.map