import { createOid } from '@verdant-web/common'; import { BaseQuery, BaseQueryOptions } from './BaseQuery.js'; export class GetQuery extends BaseQuery { private hydrate; private oid; constructor({ id, hydrate, ...rest }: { id: string; hydrate: (oid: string) => Promise; } & Omit, 'initial'>) { super({ initial: null, ...rest, }); this.oid = createOid(rest.collection, id); this.hydrate = hydrate; } protected run = async () => { const value = await this.measureHydration(() => this.hydrate(this.oid)); this.setValue(value); }; }