deno.land / x / pothos@release-1713397530 / packages / plugin-smart-subscriptions / types.ts
123456789101112131415161718192021222324252627282930313233343536// @ts-nocheckimport type { GraphQLFieldResolver, GraphQLResolveInfo } from 'https://cdn.skypack.dev/graphql?dts';import type { MaybePromise, SchemaTypes } from '../core/index.ts';import type SubscriptionManager from './manager/index.ts';import type FieldSubscriptionManager from './manager/field.ts';export interface SmartSubscriptionOptions<Context extends object> { debounceDelay?: number | null; subscribe: (name: string, context: Context, cb: (err: unknown, data?: unknown) => void) => Promise<void> | void; unsubscribe: (name: string, context: Context) => Promise<void> | void;}export type WrappedResolver<Context = object> = GraphQLFieldResolver<unknown, Context> & { unwrap: () => GraphQLFieldResolver<unknown, Context>;};export type RefetchFunction<T, ParentShape> = (val: T) => MaybePromise<ParentShape>;export type IteratorFilterFunction<T = unknown> = (val: T) => boolean;export type IteratorCallback<T = unknown> = (val: T) => MaybePromise<void>;export type IteratorCacheInvalidator<T = unknown> = (val: T) => void;export interface RegisterOptions<T = unknown> { name: string; filter?: IteratorFilterFunction<T>; onValue?: IteratorCallback<T>;}export interface RegisterFieldSubscriptionOptions<T> { filter?: IteratorFilterFunction<T>; invalidateCache?: IteratorCacheInvalidator<T>;}export interface RegisterTypeSubscriptionOptions<T, ParentShape> { refetch?: RefetchFunction<T, ParentShape>; filter?: IteratorFilterFunction<T>; invalidateCache?: IteratorCacheInvalidator<T>;}export interface RequestData { manager?: SubscriptionManager;}export type FieldSubscriber<Types extends SchemaTypes> = (subscriptions: FieldSubscriptionManager<Types>, parent: unknown, args: {}, context: object, info: GraphQLResolveInfo) => void;
Version Info