How to use the offix-conflicts-client.ConflictHandler function in offix-conflicts-client

To help you get started, we’ve selected a few offix-conflicts-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerogear / offix / packages / offix-client / src / apollo / conflicts / ConflictLink.ts View on Github external
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);

  }

offix-conflicts-client

adds client side conflict detection and resolution

Apache-2.0
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages