@apollo-elements/fast
Version:
👩🚀🌛 FastElements for Apollo GraphQL 🚀👨🚀
89 lines (88 loc) • 3.1 kB
TypeScript
import type * as C from '@apollo/client/core';
import type { ComponentDocument, Data, OnSubscriptionDataParams, Variables, VariablesOf } from '@apollo-elements/core/types';
import { ApolloElement } from './apollo-element.js';
import { ApolloSubscriptionBehavior } from '../apollo-subscription-behavior.js';
/**
* `ApolloSubscription`
*
* 🚀 FASTElement base class that updates with an Apollo GraphQL subscription.
*
* @element
*
* See [`ApolloSubscriptionInterface`](https://apolloelements.dev/api/core/interfaces/subscription) for more information on events
*
*/
export declare class ApolloSubscription<D, V = VariablesOf<D>> extends ApolloElement<D, V> {
controller: ApolloSubscriptionBehavior<D, V>;
/** @summary Flags an element that's ready and able to auto subscribe */
get canAutoSubscribe(): boolean;
/**
* Latest subscription data.
*/
data: Data<D> | null;
/**
* An object that maps from the name of a variable as used in the subscription GraphQL document to that variable's value.
*
* @summary Subscription variables.
*/
variables: Variables<D, V> | null;
/**
* @summary A GraphQL document containing a single subscription.
*/
subscription: ComponentDocument<D, V> | null;
/**
* @summary If true, the element will not begin querying data until you manually call `subscribe`
* @attr no-auto-subscribe
*/
noAutoSubscribe: boolean;
/**
* @summary Whether or not updates to the network status should trigger next on the observer of this subscription.
*/
notifyOnNetworkStatusChange?: boolean;
/**
* @summary Determines if your subscription should be unsubscribed and subscribed again.
*/
shouldResubscribe: boolean;
/**
* @summary If true, the query will be skipped entirely
*/
skip: boolean;
/**
* @summary Error policy for the subscription
*/
errorPolicy?: C.ErrorPolicy;
/**
* @summary Specifies the FetchPolicy to be used for this subscription.
* @attr fetch-policy
*/
fetchPolicy?: C.FetchPolicy;
/**
* @summary The time interval (in milliseconds) on which this subscription should be refetched from the server.
*/
pollInterval?: number;
/**
* @summary Resets the observable and subscribes.
*/
subscribe(...args: Parameters<this['controller']['subscribe']>): void;
/**
* @summary Cancels and clears the subscription
*/
cancel(): void;
/**
* Determines whether the element should attempt to subscribe automatically
* Override to prevent subscribing unless your conditions are met
*/
shouldSubscribe(options?: Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>): boolean;
/**
* Callback for when data is updated
*/
onSubscriptionData?(result: OnSubscriptionDataParams<Data<D>>): void;
/**
* Callback for when error is updated
*/
onError?(error: C.ApolloError): void;
/**
* Callback for when subscription completes.
*/
onSubscriptionComplete?(): void;
}