deno.land / x / pothos@release-1713397530 / packages / plugin-smart-subscriptions / types.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// @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;
pothos

Version Info

Tagged at
a year ago