ravendb
Version:
RavenDB client for Node.js
30 lines • 1 kB
JavaScript
import { RavenCommand } from "../../Http/RavenCommand.js";
import { throwError } from "../../Exceptions/index.js";
export class DeleteDocumentCommand extends RavenCommand {
_id;
_changeVector;
constructor(id, changeVector = null) {
super();
if (!id) {
throwError("InvalidArgumentException", "Id cannot be null.");
}
this._responseType = "Empty";
this._id = id;
this._changeVector = changeVector;
}
createRequest(node) {
RavenCommand.ensureIsNotNullOrEmpty(this._id, "id");
const uri = node.url + "/databases/" + node.database + "/docs?id=" + encodeURIComponent(this._id);
const request = {
method: "DELETE",
uri,
headers: this._headers().build()
};
this._addChangeVectorIfNotNull(this._changeVector, request);
return request;
}
get isReadRequest() {
return false;
}
}
//# sourceMappingURL=DeleteDocumentCommand.js.map