UNPKG

ravendb

Version:
37 lines 1.15 kB
import { RavenCommand } from "../../Http/RavenCommand.js"; import { RaftIdGenerator } from "../../Utility/RaftIdGenerator.js"; import { throwError } from "../../Exceptions/index.js"; export class CreateSubscriptionCommand extends RavenCommand { _options; _id; constructor(options, id) { super(); if (!options) { 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.newId(); } } //# sourceMappingURL=CreateSubscriptionCommand.js.map