How to use the offix-cache.generateClientId function in offix-cache

To help you get started, we’ve selected a few offix-cache 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-scheduler / src / queue / OfflineQueue.ts View on Github external
public async enqueueOperation(op: T): Promise {

    const entry: QueueEntry = {
      operation: {
        qid: generateClientId(),
        op
      }
    };

    // enqueue and persist
    this.queue.push(entry);
    // notify listeners
    this.onOperationEnqueued(entry.operation);

    if (this.store) {
      try {
        await this.store.saveEntry(entry.operation);
      } catch (err) {
        console.error(err);
      }
    }
github aerogear / offix / packages / offix-offline / src / offline / OperationQueueEntry.ts View on Github external
constructor(operation: Operation, offlineId?: number) {
    this.query = operation.query;
    this.variables = operation.variables;
    this.operationName = operation.operationName;
    if (offlineId) {
      this.id = offlineId.toString();
    } else {
      this.id = generateClientId();
    }
    if (typeof operation.getContext === "function") {
      const context = operation.getContext();
      this.conflictBase = context.conflictBase;
      this.returnType = context.returnType;
      this.idField = context.idField;
      this.optimisticResponse = context.optimisticResponse;
      if (context.conflictStrategy) {
        this.conflictStrategy = context.conflictStrategy.id;
      }
    }
  }

offix-cache

GraphQL Mutation and Subscription Helpers

Apache-2.0
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages