Options
All
  • Public
  • Public/Protected
  • All
Menu

@aerogear/voyager-client

Index

Type aliases

AuthContextProvider

AuthContextProvider: function

Provides pluggable way to retrieve auth tokens for sync. Clients can pass this interface to supply custom headers or auth tokens that will be used to authenticate GraphQL Requests on the server

Type declaration

ConflictResolutionData

ConflictResolutionData: any

ConflictResolutionData - defined type that abstract type of data being handled by conflict resolution engine. Data can take any form factor and contain different fields, however it should always be used in unmodified state (no new fields are added or removed)

ConflictResolutionStrategy

ConflictResolutionStrategy: function

Interface for strategy that can be used to resolve conflict

param

server data

param

client data

OperationQueueChangeHandler

OperationQueueChangeHandler: function

Type declaration

PersistedData

PersistedData: string | null | object

Variables

Const CLIENT_ID_PREFIX

CLIENT_ID_PREFIX: "client:" = "client:"

Const MUTATION_QUEUE_LOGGER

MUTATION_QUEUE_LOGGER: "AeroGearSync:OfflineMutations" = "AeroGearSync:OfflineMutations"

Const QUEUE_LOGGER

QUEUE_LOGGER: "AeroGearSync:Link" = "AeroGearSync:Link"

Const TYPE

TYPE: string = "sync-app"

document

document: any

Const localDirectivesArray

localDirectivesArray: ONLINE_ONLY[] = [ localDirectives.ONLINE_ONLY ]

Const logger

logger: Debugger = debug.default(MUTATION_QUEUE_LOGGER)

window

window: any

Functions

Const buildCachePersistence

Const clientWins

Const conflictLink

Const createAuditLoggingLink

Const createAuthLink

Const createClient

Const createDefaultCacheStorage

  • createDefaultCacheStorage(): Store

Const createDefaultLink

  • createDefaultLink(config: DataSyncConfig, offlineLink: ApolloLink): Promise<ApolloLink>
  • Method for creating "uber" composite Apollo Link implementation including:

    • Http support
    • Websocket support
    • Offline handling
    • Conflict resolution
    • Audit logging
    • File uploads

    Parameters

    Returns Promise<ApolloLink>

Const createDefaultOfflineStorage

  • createDefaultOfflineStorage(): Store

Const createOfflineLink

Const createOptimisticResponse

  • createOptimisticResponse(operation: string, typeName: string, data: any, addId?: boolean, idField?: string): any
  • Create optimistic response. For example:

    optimisticResponse: { __typename: "Mutation", updateComment: { id: commentId, __typename: "Comment", content: commentContent } }

    For more info and examples see: https://www.apollographql.com/docs/react/features/optimistic-ui.html

    Parameters

    • operation: string

      operation that is being performed (update)

    • typeName: string

      type that is going to be returned

    • data: any

      actual data passed to function

    • Default value addId: boolean = true

      generate client id for response

    • Default value idField: string = "id"

      name of id field (default:id)

    Returns any

Const defaultHttpLinks

  • defaultHttpLinks(config: DataSyncConfig, offlineLink: ApolloLink): Promise<ApolloLink>
  • Default HTTP Apollo Links Provides out of the box functionality for:

    • Offline/Online queue
    • Conflict resolution
    • Error handling
    • Audit logging

    Parameters

    Returns Promise<ApolloLink>

Const defaultWebSocketLink

  • defaultWebSocketLink(userOptions: DataSyncConfig, config: Configuration): WebSocketLink

Const generateId

  • generateId(length?: number): string

Const getMutationName

  • getMutationName(mutation: DocumentNode): undefined | string

Const isClientGeneratedId

  • isClientGeneratedId(id: string): false | true | ""

Const isMutation

  • isMutation(op: Operation): boolean

Const isNetworkError

  • isNetworkError(error: any): boolean

Const isOnlineOnly

  • isOnlineOnly(op: Operation): boolean

Const isSubscription

  • isSubscription(op: Operation): boolean

Generated using TypeDoc