found-relay
Version:
Relay integration for found
46 lines (45 loc) • 1.6 kB
TypeScript
import { CacheConfig, Disposable, Environment, FetchPolicy, GraphQLTaggedNode, SelectorData, Snapshot, Subscription, Variables } from 'relay-runtime';
export interface QuerySubscriptionOptions {
environment: Environment;
query: GraphQLTaggedNode;
variables: Variables;
cacheConfig?: CacheConfig;
fetchPolicy?: FetchPolicy;
}
export interface ReadyState {
error: Error | null;
props: SelectorData | null;
retry: (() => void) | null;
}
export default class QuerySubscription {
environment: Environment;
query: GraphQLTaggedNode;
variables: Variables;
cacheConfig: CacheConfig | null | undefined;
fetchPolicy: FetchPolicy | null | undefined;
operation: any;
fetchPromise: Promise<void> | null;
selectionReference: Disposable | null;
pendingRequest: Subscription | null;
rootSubscription: Disposable | null;
retrying: boolean;
retryingAfterError: boolean;
readyState: ReadyState;
listeners: (() => void)[];
relayContext: {
environment: any;
variables: any;
};
constructor({ environment, query, variables, cacheConfig, fetchPolicy, }: QuerySubscriptionOptions);
updateCacheConfig(nextCacheConfig: CacheConfig | null | undefined): void;
fetch(): Promise<void>;
execute(resolve: () => void): void;
updateReadyState(readyState: ReadyState): void;
onChange: (snapshot: Snapshot) => void;
subscribe(listener: () => void): void;
unsubscribe(listener: () => void): void;
retry: () => void;
retain(): Disposable;
dispose(): void;
getQueryName(): any;
}