ravendb
Version:
RavenDB client for Node.js
38 lines • 1.12 kB
JavaScript
import { RavenCommand } from "../../../Http/RavenCommand.js";
import { throwError } from "../../../Exceptions/index.js";
export class GetRevisionsCountOperation {
_docId;
constructor(docId) {
this._docId = docId;
}
createRequest() {
return new GetRevisionsCountCommand(this._docId);
}
}
class GetRevisionsCountCommand extends RavenCommand {
_id;
constructor(id) {
super();
if (!id) {
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