ravendb
Version:
RavenDB client for Node.js
39 lines • 1.19 kB
JavaScript
import { RavenCommand } from "../../Http/RavenCommand.js";
import { DateUtil } from "../../Utility/DateUtil.js";
export class GetConflictsCommand extends RavenCommand {
_id;
_conventions;
constructor(id, conventions) {
super();
this._id = id;
this._conventions = conventions;
}
get isReadRequest() {
return true;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database
+ "/replication/conflicts?docId=" + encodeURIComponent(this._id);
return {
method: "GET",
uri
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
let body = null;
const payload = await this._defaultPipeline(_ => body = _).process(bodyStream);
const { results, ...otherProps } = payload;
this.result = {
...otherProps,
results: results.map(r => ({
...r,
lastModified: DateUtil.utc.parse(r.lastModified)
}))
};
return body;
}
}
//# sourceMappingURL=GetConflictsCommand.js.map