UNPKG

@configurator/ravendb

Version:
44 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeleteIndexCommand = exports.DeleteIndexOperation = void 0; const Exceptions_1 = require("../../../Exceptions"); const RavenCommand_1 = require("../../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator"); class DeleteIndexOperation { constructor(indexName) { if (!indexName) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Index name cannot be null."); } this._indexName = indexName; } getCommand(conventions) { return new DeleteIndexCommand(this._indexName); } get resultType() { return "CommandResult"; } } exports.DeleteIndexOperation = DeleteIndexOperation; class DeleteIndexCommand extends RavenCommand_1.RavenCommand { constructor(indexName) { super(); this._responseType = "Empty"; if (!indexName) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Index name cannot be null."); } this._indexName = indexName; } createRequest(node) { const uri = node.url + "/databases/" + node.database + "/indexes?name=" + encodeURIComponent(this._indexName); return { method: "DELETE", uri }; } get isReadRequest() { return false; } getRaftUniqueRequestId() { return RaftIdGenerator_1.RaftIdGenerator.newId(); } } exports.DeleteIndexCommand = DeleteIndexCommand; //# sourceMappingURL=DeleteIndexOperation.js.map