import type { Diagnostic } from '../diagnostics/index.js'; import type { EngineHost, RequestAnswer, RequestQuery, RequestRefusal } from './host.js'; import type { ResolvedInput } from './inputs.js'; import type { Request, RequestField } from './types.js'; import type { Timeframe } from './timeframe.js'; /** What a read holds once its identity, its timeframe and its source are fixed. */ export interface RequestPlan { readonly request: Request; readonly query: RequestQuery; readonly timeframe: Timeframe; /** The zone a calendar bucket is dated in, or nothing when none was stated. */ readonly zone: string | null; } export type PlanResult = { readonly ok: true; readonly plans: readonly RequestPlan[]; } | { readonly ok: false; readonly diagnostic: Diagnostic; }; /** * One of the three identity fields, resolved. * * Three forms and no fourth: the string the script wrote, the value of the * setting it named, and one of the three chart facts that identify a chart * rather than describe it. */ export declare function identityOf(field: RequestField, inputs: readonly ResolvedInput[], host: EngineHost): string | null; /** * Every read the program makes, with its identity settled. * * Walks the nested reads as well, because a read written inside another is part * of the program and a host handed a list with one missing would fetch less * than the file asks for. */ export declare function planRequests(requests: readonly Request[], inputs: readonly ResolvedInput[], host: EngineHost): PlanResult; /** * What the host says about one read. * * A host with no provider is not asked. A read of the chart's own instrument is * then folded from the bars the engine already holds, and a read of another * instrument cannot be: the engine holds none of that instrument's bars, so * nothing to serve is the same answer as an instrument the host does not know. */ export declare function askHost(plan: RequestPlan, host: EngineHost): RequestAnswer | undefined; /** * Whether this read can date a bucket at all. * * A day, week or month request is folded by the calendar, and a calendar * boundary is a civil date read in a zone (`timeframe.ts`). A host that stated * no timezone leaves the fold with no key for any bar, so the read is absent on * every bar of the run and will be on every future one: nothing that arrives * later supplies a fact the instrument record does not hold. * * That is a dead read, and a dead read a study cannot explain is the worst of * the three: the trader has already looked at the blank pane. So it is answered * here rather than left as absence, and `req.isReady` and `req.error` say it. */ export declare function undatable(plan: RequestPlan): boolean; /** * What `req.error(read)` says about a read with no zone to date its buckets. * * OS6012's own message, because the zone is an instrument fact the host did not * supply and that is exactly what this read needs and cannot default. Nothing * is raised: a fact the host did not state leaves the read absent, as * `host-interface.md` 4.5 settles it, and this is the sentence that explains * the absence rather than a second answer to it. */ export declare function undatableReason(query: RequestQuery): string; /** * The reason a refusal reads as through `req.error(read)`. * * The catalogue's own message, filled with the identity the read asked for and * with the host's own words where it gave them. The host's words are carried * and not paraphrased, because "the account's data subscription does not cover * this instrument" is actionable and "the request failed" is not. */ export declare function reasonFor(refusal: RequestRefusal, query: RequestQuery): string; //# sourceMappingURL=request-plan.d.ts.map