import { Condition } from '../conditions/index.js'; import { DeleteConfig } from './delete.js'; import { DynamoEntity } from '../core/entity.js'; import { ObjectLikeZodType, EntitySchema, TransactWriteOperation } from '../core/index.js'; import { ReturnValuesOnConditionCheckFailure, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb'; import { BaseResult, BaseCommand, WriteTransactable } from './index.js'; /** * Configuration for the ConditionalDelete command. * * @template Schema - The Zod schema defining the structure of the entity. */ type ConditionalDeleteConfig = DeleteConfig & { condition: Condition; returnValuesOnConditionCheckFailure?: ReturnValuesOnConditionCheckFailure; }; /** * Result of the ConditionalDelete command. * * @template Schema - The Zod schema defining the structure of the entity. */ type ConditionalDeleteResult = BaseResult & { deletedItem?: Partial> | undefined; itemCollectionMetrics?: ItemCollectionMetrics; }; /** * Command to remove an item with a condition expression. * * @template Schema - The Zod schema defining the structure of the entity. * * @example * ```typescript * import { DynamoTable, DynamoEntity, key, ConditionalDelete } from 'dynamo-document-builder'; * * const table = new DynamoTable({ * tableName: 'ExampleTable', * documentClient, * }); * * const userEntity = new DynamoEntity({ * table, * schema: z.object({ * userId: z.string(), * status: z.string(), * }), * partitionKey: user => key('USER', user.userId), * sortKey: () => 'METADATA', * }); * * const conditionalDeleteCommand = new ConditionalDelete({ * key: { userId: 'user123' }, * condition: { status: 'inactive' }, * returnValues: 'ALL_OLD', * }); * * const { deletedItem } = await userEntity.send(conditionalDeleteCommand); * ``` */ declare class ConditionalDelete implements BaseCommand, Schema>, WriteTransactable { #private; constructor(config: ConditionalDeleteConfig); execute(entity: DynamoEntity): Promise>; prepareWriteTransaction(entity: DynamoEntity): Promise; } export { ConditionalDelete }; export type { ConditionalDeleteConfig, ConditionalDeleteResult };