import { ExFlowSafeData, ExFlowOptions, ExNode, ExecutionPlan, ExFlowExecutionDetails, ExFlowMetrics, ExFlowPresetName, ExFlowDiagnostics, ExFlowDiagnosticsMapperOptions, ExFlowObservabilityEvent, ExFlowCustomMappedFields, ExFlowDatadogLogFields, ExFlowOpenTelemetryAttributes } from './types/index.js'; export { DeadlineStrategy, ExFlowCloneMode, ExFlowFairnessPolicy, ExFlowResultItem, ExFlowSchedulerMode, ExFlowTieBreaker, ExFlowTieFallbackPolicy, SafeTask, WeightStrategy } from './types/index.js'; /** * Standardized error codes emitted by ExFlow. */ declare const EXFLOW_ERROR: { /** Node id already exists in the graph. */ readonly DUPLICATE_NODE: "EXFLOW_DUPLICATE_NODE"; /** Input data contains reserved `exFlowPriority` field. */ readonly RESERVED_FIELD: "EXFLOW_RESERVED_FIELD"; /** A dependency id does not exist in the graph. */ readonly UNKNOWN_DEPENDENCY: "EXFLOW_UNKNOWN_DEPENDENCY"; /** Graph contains at least one cycle. */ readonly CYCLE_DETECTED: "EXFLOW_CYCLE_DETECTED"; /** cloneMode is `custom` but cloneFn was not provided. */ readonly CUSTOM_CLONE_FN_REQUIRED: "EXFLOW_CUSTOM_CLONE_FN_REQUIRED"; /** Deep clone was requested in a runtime without structuredClone. */ readonly DEEP_CLONE_UNAVAILABLE: "EXFLOW_DEEP_CLONE_UNAVAILABLE"; /** Runtime options contain invalid values. */ readonly INVALID_OPTION: "EXFLOW_INVALID_OPTION"; }; /** * Priority-aware DAG execution planner based on Kahn's Algorithm. */ declare class ExFlow { private readonly options; private nodes; private nodeOrder; private nextNodeOrder; private lastMetrics; /** * @param options Runtime options that control output cloning behavior. */ constructor(options?: ExFlowOptions); /** * Adds a node into the graph. * @throws Error if the node id already exists. * @throws Error if `data` contains the reserved `exFlowPriority` field. */ addEntity(node: ExNode): void; /** * Resolves the graph into execution batches and a flattened full sequence. * @throws Error if a dependency id does not exist. * @throws Error if the graph contains a cycle. */ resolveExecutionPlan(): ExecutionPlan; /** * Resolves the graph and returns plan with execution metrics. */ resolveExecutionDetails(): ExFlowExecutionDetails; getLastMetrics(): ExFlowMetrics | null; private buildGraphState; private calculateLevelPlan; private calculateThroughputPlan; private toPlannedNode; private validateOptions; private sortBatch; private comparePlannedNodes; private compareByTieFallbackPolicy; private compareByDeadline; private compareByWeight; private applyBatchConstraints; private selectConstrainedBatch; private getFairnessScore; private applyDeferrals; private canUseResource; private resolveNeighbors; private toResultItem; private getNodeOrder; private assertNoCycle; private findCyclePath; private createMetrics; private recordReadyQueueSize; private recordConstraintHits; private cloneData; private raiseError; } /** * Fluent builder for ExFlow runtime options. */ declare class ExFlowConfigBuilder { private options; useShallowClone(): this; useDeepClone(): this; useCustomClone(cloneFn: (data: T) => T): this; withPriorityAscending(priorityAscending: boolean): this; withTieBreaker(tieBreaker: NonNullable["tieBreaker"]>): this; withConcurrencyCap(concurrencyCap: number): this; withResourceCaps(resourceCaps: Record): this; withDeadlineStrategy(deadlineStrategy: NonNullable["deadlineStrategy"]>): this; withWeightStrategy(weightStrategy: NonNullable["weightStrategy"]>): this; withFairnessPolicy(fairnessPolicy: NonNullable["fairnessPolicy"]>): this; withMaxDeferralRounds(maxDeferralRounds: number): this; requireResourceCapForAllClasses(requireResourceCapForAllClasses?: boolean): this; withSchedulerMode(schedulerMode: NonNullable["schedulerMode"]>): this; withTieFallbackPolicy(tieFallbackPolicy: NonNullable["tieFallbackPolicy"]>): this; withPreset(presetName: NonNullable["presetName"]>): this; build(): ExFlowOptions; } declare const createExFlowConfigBuilder: () => ExFlowConfigBuilder; type PresetOptions = Pick, "schedulerMode" | "priorityAscending" | "tieFallbackPolicy" | "fairnessPolicy" | "maxDeferralRounds" | "concurrencyCap">; declare const getExFlowPreset: (preset: ExFlowPresetName) => PresetOptions; declare class ExFlowRuntimeError extends Error { readonly code: string; readonly diagnostics?: ExFlowDiagnostics; constructor(code: string, message: string, diagnostics?: ExFlowDiagnostics); } /** * Normalizes unknown errors into a consistent observability payload. */ declare const serializeExFlowError: (error: unknown, timestamp?: string) => ExFlowObservabilityEvent; /** * Creates a configurable diagnostics field mapper. */ declare const createDiagnosticsMapper: (options?: ExFlowDiagnosticsMapperOptions) => ((event: ExFlowObservabilityEvent) => ExFlowCustomMappedFields); /** * Maps an observability payload to OpenTelemetry attributes. */ declare const toOpenTelemetryAttributes: (event: ExFlowObservabilityEvent) => ExFlowOpenTelemetryAttributes; /** * Maps an observability payload to Datadog-style log fields. */ declare const toDatadogLogFields: (event: ExFlowObservabilityEvent) => ExFlowDatadogLogFields; export { EXFLOW_ERROR, ExFlow, ExFlowConfigBuilder, ExFlowCustomMappedFields, ExFlowDatadogLogFields, ExFlowDiagnostics, ExFlowDiagnosticsMapperOptions, ExFlowExecutionDetails, ExFlowMetrics, ExFlowObservabilityEvent, ExFlowOpenTelemetryAttributes, ExFlowOptions, ExFlowPresetName, ExFlowRuntimeError, ExNode, ExecutionPlan, createDiagnosticsMapper, createExFlowConfigBuilder, getExFlowPreset, serializeExFlowError, toDatadogLogFields, toOpenTelemetryAttributes };