grafast
Version:
Cutting edge GraphQL planning and execution engine
38 lines • 1.96 kB
TypeScript
import type { ExecutionDetails, GrafastResultStreamList, GrafastSubscriber } from "../interfaces.ts";
import { Step } from "../step.ts";
import type { __ItemStep } from "./__item.ts";
/**
* Subscribes to the given `pubsubOrPlan` to get realtime updates on a given
* topic (`topicOrPlan`), mapping the resulting event via the `itemPlan`
* callback.
*/
export declare class ListenStep<TTopics extends {
[topic: string]: any;
}, TTopic extends keyof TTopics, TPayloadStep extends Step> extends Step<TTopics[TTopic][]> {
static $$export: {
moduleName: string;
exportName: string;
};
isSyncAndSafe: boolean;
/**
* The id for the PostgreSQL context plan.
*/
private pubsubDep;
/**
* The plan that will tell us which topic we're subscribing to.
*/
private topicDep;
private initialEventDep;
itemPlan: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep;
constructor(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan?: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep, $initialEvent?: Step<TTopics[TTopic]>);
execute({ indexMap, values, stream, }: ExecutionDetails<readonly [GrafastSubscriber<TTopics>, TTopic]>): GrafastResultStreamList<TTopics[TTopic]>;
}
/**
* Subscribes to the given `pubsubOrPlan` to get realtime updates on a given
* topic (`topicOrPlan`), mapping the resulting event via the `itemPlan`
* callback.
*/
export declare function listen<TTopics extends {
[topic: string]: any;
}, TTopic extends keyof TTopics, TPayloadStep extends Step>(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan?: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep, $initialEvent?: Step<TTopics[TTopic]>): ListenStep<TTopics, TTopic, TPayloadStep>;
//# sourceMappingURL=listen.d.ts.map