Skip to content

API reference > @kontsedal/olas-core > QueryHost

QueryHost type ​

The root's query cache, addressed by query id and entry key (the output of the query's key(...)). Writes are stamped with the calling plugin's name as their origin.

Signature:

typescript
type QueryHost = {
  get(id: string): QueryRef | undefined;
  keys(id: string): ReadonlyArray<readonly unknown[]>;
  peek(id: string, key: readonly unknown[]): unknown;
  write(id: string, key: readonly unknown[], updater: (prev: unknown) => unknown, options?: WriteOptions): void;
  replace(id: string, key: readonly unknown[], value: unknown, options?: WriteOptions): void;
  setData(id: string, key: readonly unknown[], updater: (prev: unknown) => unknown, options?: WriteOptions): Snapshot | undefined;
  invalidate(id: string, key: readonly unknown[]): Promise<void>;
  hydrate(state: DehydratedState): void;
  dehydrate(): DehydratedState;
  hashKey(key: readonly unknown[]): string;
};

References: QueryRef, WriteOptions, Snapshot, DehydratedState

Released under the MIT License.