/** @category Legacy Incremental Execution */ import type { ObjMap } from "../../jsutils/ObjMap.mjs"; import type { GraphQLError, GraphQLFormattedError } from "../../error/GraphQLError.mjs"; import type { GroupedFieldSet } from "../collectFields.mjs"; import type { ExecutionResult, FormattedExecutionResult } from "../Executor.mjs"; import type { DeferUsageSet, ExecutionPlan } from "../incremental/buildExecutionPlan.mjs"; import { IncrementalExecutor } from "../incremental/IncrementalExecutor.mjs"; /** * Results for an operation that produced legacy incremental payloads. * @typeParam TInitialData - Shape of the initial result data payload. * @typeParam TDeferredData - Shape of deferred fragment data payloads. * @typeParam TStreamItem - Shape of streamed list items. * @typeParam TExtensions - Shape of extensions payloads. */ export interface LegacyExperimentalIncrementalExecutionResults, TDeferredData = ObjMap, TStreamItem = unknown, TExtensions = ObjMap> { /** Initial execution result delivered before subsequent legacy incremental payloads. */ initialResult: LegacyInitialIncrementalExecutionResult; /** Async stream of legacy incremental payloads delivered after the initial result. */ subsequentResults: AsyncGenerator, void, void>; } /** * Initial execution result for an operation that produced legacy incremental payloads. * * Unlike `InitialIncrementalExecutionResult`, the legacy initial result does * not include a `pending` list. Subsequent payloads identify their location * directly with `path` and optional `label` fields. * @typeParam TInitialData - Shape of the initial data payload. * @typeParam TExtensions - Shape of the extensions payload. */ export interface LegacyInitialIncrementalExecutionResult, TExtensions = ObjMap> extends ExecutionResult { /** Data produced by the initial execution payload. */ data: TInitialData; /** Indicates that subsequent legacy incremental payloads will follow. */ hasNext: true; /** Additional non-standard metadata included in the initial result. */ extensions?: TExtensions; } /** * Subsequent payload produced by legacy incremental execution. * * Legacy subsequent payloads may contain deferred fragment data, streamed list * items, or only `hasNext: false` to complete the response stream. * @typeParam TDeferredData - Shape of deferred fragment data payloads. * @typeParam TStreamItem - Shape of streamed list items. * @typeParam TExtensions - Shape of the extensions payload. */ export interface LegacySubsequentIncrementalExecutionResult, TStreamItem = unknown, TExtensions = ObjMap> { /** Deferred or streamed payloads delivered by this response. */ incremental?: ReadonlyArray>; /** Indicates whether more legacy incremental payloads will follow. */ hasNext: boolean; /** Additional non-standard metadata included in this payload. */ extensions?: TExtensions; } /** * Deferred fragment or streamed list payload produced by legacy incremental execution. * @typeParam TDeferredData - Shape of deferred fragment data. * @typeParam TStreamItem - Shape of streamed list items. * @typeParam TExtensions - Shape of extensions payloads. */ export type LegacyIncrementalResult, TStreamItem = unknown, TExtensions = ObjMap> = LegacyIncrementalDeferResult | LegacyIncrementalStreamResult; /** * Legacy incremental payload produced by a deferred fragment. * * The payload location is identified directly by `path` and optional `label` * instead of by an `id` from a pending entry. * @typeParam TDeferredData - Shape of deferred fragment data. * @typeParam TExtensions - Shape of extensions payloads. */ export interface LegacyIncrementalDeferResult, TExtensions = ObjMap> extends ExecutionResult { /** Response path to the deferred fragment payload. */ path: ReadonlyArray; /** Label from the `@defer` directive. */ label?: string; } /** * Legacy incremental payload produced by a streamed list field. * @typeParam TStreamItem - Shape of streamed list items. * @typeParam TExtensions - Shape of extensions payloads. */ export interface LegacyIncrementalStreamResult> { /** Errors raised while producing streamed items. */ errors?: ReadonlyArray; /** Streamed list items delivered by this payload. */ items: ReadonlyArray | null; /** Response path to the first streamed list item in this payload. */ path: ReadonlyArray; /** Label from the `@stream` directive. */ label?: string; /** Additional non-standard metadata included in this payload. */ extensions?: TExtensions; } /** * JSON-serializable form of legacy incremental execution results. * @typeParam TInitialData - Shape of the formatted initial result data payload. * @typeParam TDeferredData - Shape of formatted deferred fragment data payloads. * @typeParam TStreamItem - Shape of formatted streamed list items. * @typeParam TExtensions - Shape of formatted extensions payloads. */ export interface FormattedLegacyExperimentalIncrementalExecutionResults, TDeferredData = ObjMap, TStreamItem = unknown, TExtensions = ObjMap> { /** Formatted initial execution result. */ initialResult: FormattedLegacyInitialIncrementalExecutionResult; /** Async stream of formatted legacy incremental payloads. */ subsequentResults: AsyncGenerator, void, void>; } /** * JSON-serializable form of a legacy initial incremental execution result. * @typeParam TInitialData - Shape of the formatted initial data payload. * @typeParam TExtensions - Shape of the formatted extensions payload. */ export interface FormattedLegacyInitialIncrementalExecutionResult, TExtensions = ObjMap> extends FormattedExecutionResult { /** Formatted data produced by the initial execution payload. */ data: TInitialData; /** Indicates that subsequent legacy incremental payloads will follow. */ hasNext: true; /** Additional non-standard metadata included in the formatted initial result. */ extensions?: TExtensions; } /** * JSON-serializable form of a legacy subsequent incremental execution payload. * @typeParam TDeferredData - Shape of formatted deferred fragment data payloads. * @typeParam TStreamItem - Shape of formatted streamed list items. * @typeParam TExtensions - Shape of formatted extensions payloads. */ export interface FormattedLegacySubsequentIncrementalExecutionResult, TStreamItem = unknown, TExtensions = ObjMap> { /** Formatted deferred or streamed payloads delivered by this response. */ incremental?: ReadonlyArray>; /** Indicates whether more legacy incremental payloads will follow. */ hasNext: boolean; /** Additional non-standard metadata included in this formatted payload. */ extensions?: TExtensions; } /** * JSON-serializable deferred fragment or streamed list payload produced by * legacy incremental execution. * @typeParam TDeferredData - Shape of formatted deferred fragment data. * @typeParam TStreamItem - Shape of formatted streamed list items. * @typeParam TExtensions - Shape of formatted extensions payloads. */ export type FormattedLegacyIncrementalResult, TStreamItem = unknown, TExtensions = ObjMap> = FormattedLegacyIncrementalDeferResult | FormattedLegacyIncrementalStreamResult; /** * JSON-serializable form of a legacy deferred fragment payload. * @typeParam TDeferredData - Shape of formatted deferred fragment data. * @typeParam TExtensions - Shape of formatted extensions payloads. */ export interface FormattedLegacyIncrementalDeferResult, TExtensions = ObjMap> extends FormattedExecutionResult { /** Response path to the formatted deferred fragment payload. */ path: ReadonlyArray; /** Label from the `@defer` directive. */ label?: string; } /** * JSON-serializable form of a legacy streamed list payload. * @typeParam TStreamItem - Shape of formatted streamed list items. * @typeParam TExtensions - Shape of formatted extensions payloads. */ export interface FormattedLegacyIncrementalStreamResult> { /** Formatted errors raised while producing streamed items. */ errors?: ReadonlyArray; /** Formatted streamed list items delivered by this payload. */ items: ReadonlyArray | null; /** Response path to the first streamed list item in this formatted payload. */ path: ReadonlyArray; /** Label from the `@stream` directive. */ label?: string; /** Additional non-standard metadata included in this formatted payload. */ extensions?: TExtensions; } /** @internal */ export declare class BranchingIncrementalExecutor extends IncrementalExecutor { getCreateSubExecutor(): (deferUsageSet?: DeferUsageSet) => BranchingIncrementalExecutor; buildResponse(data: ObjMap | null): ExecutionResult | LegacyExperimentalIncrementalExecutionResults; buildRootExecutionPlan(originalGroupedFieldSet: GroupedFieldSet): ExecutionPlan; buildSubExecutionPlan(originalGroupedFieldSet: GroupedFieldSet): ExecutionPlan; }