import { Resource } from './resource' ; import type { FetchMoreOptions , FetchMoreQueryOptions , ObservableQuery , SubscribeToMoreOptions , UpdateQueryOptions } from '@apollo/client/core' ; import type { TemplateArgs } from './types' ; export default class ObservableResource < TData , TVariables , Args extends TemplateArgs > extends Resource < Args > { private observable ? : ObservableQuery < TData > ; protected _setObservable ( observable ) { this . observable = observable ; } refetch = ( variables ? ) => this . observable ?. refetch ( variables ) ; fetchMore = ( fetchMoreOptions ) => this . observable ?. fetchMore ( fetchMoreOptions ) ; updateQuery = < TVars = TVariables > ( mapFn ) => this . observable ?. updateQuery ( mapFn ) ; startPolling = ( pollInterval ) => { this . observable ?. startPolling ( pollInterval ) ; } ; stopPolling = ( ) => { this . observable ?. stopPolling ( ) ; } ; subscribeToMore = < TSubscriptionData = TData , TSubscriptionVariables = TVariables > ( options ) => this . observable ?. subscribeToMore ( options ) ; }