Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private conflictHandler(errorResponse: ErrorResponse): Observable {
const { response, operation, forward, graphQLErrors } = errorResponse;
const data = this.getConflictData(graphQLErrors);
const individualStrategy = this.strategy || UseClient;
if (data && operation.getContext().returnType) {
const base = operation.getContext().conflictBase;
const conflictHandler = new ConflictHandler({
base,
client: data.clientState,
server: data.serverState,
strategy: individualStrategy,
listener: this.listener,
objectState: this.config.conflictProvider as ObjectState,
operationName: operation.operationName
});
const resolvedConflict = conflictHandler.executeStrategy();
if (resolvedConflict) {
operation.variables = resolvedConflict;
}
}
return forward(operation);
}