UNPKG

ravendb

Version:
58 lines 2.12 kB
import { DateUtil } from "../../../Utility/DateUtil.js"; import { RavenCommand } from "../../../Http/RavenCommand.js"; import { throwError } from "../../../Exceptions/index.js"; export class NextHiloCommand extends RavenCommand { _tag; _lastBatchSize; _lastRangeAt; _identityPartsSeparator; _lastRangeMax; _conventions; constructor(tag, lastBatchSize, lastRangeAt, identityPartsSeparator, lastRangeMax, conventions) { super(); if (!tag) { throwError("InvalidArgumentException", "tag cannot be null."); } if (!identityPartsSeparator) { throwError("InvalidArgumentException", "identityPartsSeparator cannot be null."); } this._tag = tag; this._lastBatchSize = lastBatchSize; this._lastRangeAt = lastRangeAt; this._identityPartsSeparator = identityPartsSeparator; this._lastRangeMax = lastRangeMax; this._conventions = conventions; } createRequest(node) { const lastRangeAt = this._lastRangeAt ? DateUtil.utc.stringify(this._lastRangeAt) : ""; let uri = `${node.url}/databases/${node.database}/hilo/next?`; uri += "lastBatchSize=" + this._lastBatchSize; if (this._tag) { uri += "&tag=" + this._urlEncode(this._tag); } uri += "&lastRangeAt=" + this._urlEncode(lastRangeAt); if (this._identityPartsSeparator) { uri += "&identityPartsSeparator=" + this._identityPartsSeparator; } if (this._lastRangeMax) { uri += "&lastMax=" + this._lastRangeMax; } return { uri }; } async setResponseAsync(bodyStream, fromCache) { let body = null; const results = await this._defaultPipeline(_ => body = _).process(bodyStream); this.result = this._reviveResultTypes(results, this._conventions, { nestedTypes: { lastRangeAt: "date" } }); return body; } get isReadRequest() { return true; } } //# sourceMappingURL=NextHiloCommand.js.map