/** * @file batched-writes.ts * @description Handles batched write operations for entity creation and updates. * This module provides functionality to process complex entity mutation operations * with proper dependency handling across related entities. */ import { EntityMetadata } from '../metadata'; import { BaseContext, GraphQLResolveInfo } from '../types'; /** * Type representing an operation process for an entity * - 'post' processes run after the operation is complete * - 'pre' processes run before the operation */ type OperationProcess = { type: 'post'; inject: (value: (G & (object | undefined)) | null) => void; } | { type: 'pre'; fetch: any; }; /** * Generates operation batches for entity mutations * * This function analyzes the input entity and its relationships to create a * dependency graph of operations that need to be performed. It handles: * - Entity creation/updates * - Relationship management between entities * - Topological sorting of operations to maintain dependency order * * @param rootInput - The input entity data or array of entities * @param rootMeta - Metadata for the entity type * @param rootInfo - GraphQL resolve info * @param rootContext - Base context * @returns A structured object containing tasks, nodes, batches and return order */ export declare const generateOperationBatches: (rootInput: Partial | Partial[], rootMeta: EntityMetadata, rootInfo: GraphQLResolveInfo, rootContext: BaseContext) => Promise<{ tasks: Map; operations: Array<{ nodeId: string; type: "create" | "update"; processing: OperationProcess[]; }>; }>; nodes: Map>; batches: string[][]; returnOrder: string[]; }>; /** * Executes the batched write operations in the correct order * * @param batches - The batches to execute in order * @param tasks - Map of tasks to execute * @param nodes - Map of nodes to operate on * @param returnOrder - The order to return results * @returns The result of the operations */ export declare const runBatchedWrites: (batches: Array, tasks: Map; operations: Array<{ nodeId: string; type: "create" | "update"; processing: OperationProcess[]; }>; }>, nodes: Map>, returnOrder: string[]) => Promise[] | (G & object) | null | undefined>; export {};