UNPKG

ravendb

Version:
55 lines 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EnableIndexCommand = exports.EnableIndexOperation = void 0; const index_js_1 = require("../../../Exceptions/index.js"); const RavenCommand_js_1 = require("../../../Http/RavenCommand.js"); const RaftIdGenerator_js_1 = require("../../../Utility/RaftIdGenerator.js"); class EnableIndexOperation { _indexName; _clusterWide; constructor(indexName, clusterWide = false) { if (!indexName) { (0, index_js_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_js_1.RavenCommand { _indexName; _clusterWide; constructor(indexName, clusterWide) { super(); if (!indexName) { (0, index_js_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_js_1.RaftIdGenerator.newId(); } } exports.EnableIndexCommand = EnableIndexCommand; //# sourceMappingURL=EnableIndexOperation.js.map