UNPKG

@configurator/ravendb

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