deno.land / x / pothos@release-1713397530 / packages / plugin-smart-subscriptions / manager / field.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
// @ts-nocheckimport { SchemaTypes } from '../../core/index.ts';import type CacheNode from '../cache-node.ts';import { RegisterFieldSubscriptionOptions } from '../types.ts';import BaseSubscriptionManager from './base.ts';import type SubscriptionManager from './index.ts';export default class FieldSubscriptionManager<Types extends SchemaTypes> extends BaseSubscriptionManager { cacheNode: CacheNode<Types>; constructor(manager: SubscriptionManager, cacheNode: CacheNode<Types>) { super(manager); this.cacheNode = cacheNode; } register<T>(name: string, { filter, invalidateCache }: RegisterFieldSubscriptionOptions<T> = {}) { this.addRegistration<T>({ name, filter, onValue: (value) => { if (invalidateCache) { invalidateCache(value); } return this.cacheNode.refetch(); }, }); }}
pothos

Version Info

Tagged at
a year ago