UNPKG

@configurator/ravendb

Version:
39 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateSubscriptionCommand = void 0; const RavenCommand_1 = require("../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../Utility/RaftIdGenerator"); const Exceptions_1 = require("../../Exceptions"); class CreateSubscriptionCommand extends RavenCommand_1.RavenCommand { constructor(options, id) { super(); if (!options) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Options cannot be null"); } this._options = options; this._id = id; } createRequest(node) { let uri = node.url + "/databases/" + node.database + "/subscriptions"; if (this._id) { uri += "?id=" + this._urlEncode(this._id); } const body = this._serializer.serialize(this._options); return { uri, method: "PUT", body }; } async setResponseAsync(bodyStream, fromCache) { return this._parseResponseDefaultAsync(bodyStream); } get isReadRequest() { return false; } getRaftUniqueRequestId() { return RaftIdGenerator_1.RaftIdGenerator.newId(); } } exports.CreateSubscriptionCommand = CreateSubscriptionCommand; //# sourceMappingURL=CreateSubscriptionCommand.js.map