@configurator/ravendb
Version:
RavenDB client for Node.js
32 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeleteDocumentCommand = void 0;
const RavenCommand_1 = require("../../Http/RavenCommand");
const Exceptions_1 = require("../../Exceptions");
class DeleteDocumentCommand extends RavenCommand_1.RavenCommand {
constructor(id, changeVector = null) {
super();
if (!id) {
(0, Exceptions_1.throwError)("InvalidArgumentException", "Id cannot be null.");
}
this._responseType = "Empty";
this._id = id;
this._changeVector = changeVector;
}
createRequest(node) {
RavenCommand_1.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;
}
}
exports.DeleteDocumentCommand = DeleteDocumentCommand;
//# sourceMappingURL=DeleteDocumentCommand.js.map