import { Subject, Observable } from 'rxjs'; import { GraphqlWatchQueryOptions, GraphqlQueryResult, GraphqlMutationOptions, GraphqlMutationResult, GraphqlEvent, GraphqlNetworkEvent, IGraphqlClient, } from '../types'; const NOT_INITIALIZED = `The graphql client has not been initialized yet.`; /** * A stub version of the client that can be used as a strongly-typed * placeholder before the client is initialized. */ export class GraphqlClientUninitialized implements IGraphqlClient { public events$ = new Subject(); public network$ = new Subject(); public async query( options: GraphqlWatchQueryOptions, ): Promise> { throw new Error(NOT_INITIALIZED); } public query$( options: GraphqlWatchQueryOptions, ): Observable> { throw new Error(NOT_INITIALIZED); } public async mutate( options: GraphqlMutationOptions, ): Promise> { throw new Error(NOT_INITIALIZED); } }