/** * Effect-based delete operations with relationship cascade support. * * Uses Ref for atomic state mutation and typed errors. * Supports cascade, restrict, set_null, cascade_soft, and preserve * cascade options for relationship handling during deletion. */ import { Effect, PubSub, Ref } from "effect"; import { NotFoundError, type OperationError, ValidationError } from "../../errors/crud-errors.js"; import type { DeleteWithRelationshipsOptions, DeleteWithRelationshipsResult } from "../../types/crud-relationship-types.js"; import type { ChangeEvent } from "../../types/reactive-types.js"; import type { RelationshipDef } from "../../types/types.js"; type HasId = { readonly id: string; }; type RelationshipConfig = { readonly type: "ref" | "inverse"; readonly target?: string; readonly __targetCollection?: string; readonly foreignKey?: string; }; type CollectionConfig = { readonly schema: unknown; readonly relationships: Record; }; type DatabaseConfig = Record; type CascadeResult = { readonly [collection: string]: { readonly count: number; readonly ids: ReadonlyArray; }; }; /** * Delete a single entity with relationship cascade support. * * Steps: * 1. Look up entity by ID in Ref state (O(1)) * 2. Process relationship cascades (restrict, cascade, set_null, etc.) * 3. Fail if any restrict violations exist * 4. Perform the delete (soft or hard) * 5. Return deleted entity with cascade information */ export declare const deleteWithRelationships: (collectionName: string, relationships: Record, ref: Ref.Ref>, stateRefs: Record>>, dbConfig: DatabaseConfig, changePubSub?: PubSub.PubSub) => (id: string, options?: DeleteWithRelationshipsOptions>) => Effect.Effect, NotFoundError | ValidationError | OperationError>; /** * Delete multiple entities matching a predicate with relationship cascade support. * * Steps: * 1. Find all matching entities using predicate * 2. Apply limit if specified * 3. Check all restrict violations first (fail-fast) * 4. Process cascade operations for all entities * 5. Perform the deletes (soft or hard) * 6. Return count, deleted entities, and cascade information */ export declare const deleteManyWithRelationships: (collectionName: string, relationships: Record, ref: Ref.Ref>, stateRefs: Record>>, dbConfig: DatabaseConfig, changePubSub?: PubSub.PubSub) => (predicate: (entity: T) => boolean, options?: DeleteWithRelationshipsOptions> & { readonly limit?: number; }) => Effect.Effect<{ readonly count: number; readonly deleted: ReadonlyArray; readonly cascaded?: CascadeResult; }, ValidationError | OperationError>; export {}; //# sourceMappingURL=delete-with-relationships.d.ts.map