import { BaseConfig, WriteTransactable, BaseCommand } from './index.js'; import { ReturnItemCollectionMetrics, ConsumedCapacity, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb'; import { DynamoEntity } from '../core/entity.js'; import { ResponseMetadata } from '@aws-sdk/types'; import { ObjectLikeZodType } from '../core/index.js'; /** * Configuration for the TransactWrite command. * * @template Schema - The Zod schema defining the structure of the entity. */ type TransactWriteConfig = BaseConfig & { writes: WriteTransactable[]; idempotencyToken?: string; returnItemCollectionMetrics?: ReturnItemCollectionMetrics; }; /** * Result of the TransactWrite command. */ type TransactWriteResult = { responseMetadata?: ResponseMetadata; consumedCapacity?: ConsumedCapacity[] | undefined; itemCollectionMetrics?: ItemCollectionMetrics; }; /** * Command to perform an atomic multi-item write transaction (all-or-nothing). * * @template Schema - The Zod schema defining the structure of the entity. * * @example * ```typescript * import { DynamoTable, DynamoEntity, key, TransactWrite, Put, Update, Delete } from 'dynamo-document-builder'; * * const table = new DynamoTable({ * tableName: 'ExampleTable', * documentClient, * }); * * const userEntity = new DynamoEntity({ * table, * schema: z.object({ * userId: z.string(), * name: z.string(), * balance: z.number(), * }), * partitionKey: user => key('USER', user.userId), * sortKey: () => 'METADATA', * }); * * const transactWriteCommand = new TransactWrite({ * writes: [ * new Put({ item: { userId: 'user1', name: 'John', balance: 100 } }), * new Update({ key: { userId: 'user2' }, update: { balance: add(50) } }), * new Delete({ key: { userId: 'user3' } }), * ], * idempotencyToken: 'unique-token', * }); * * await userEntity.send(transactWriteCommand); * ``` */ declare class TransactWrite implements BaseCommand { #private; constructor(config: TransactWriteConfig); execute(entity: DynamoEntity): Promise; } export { TransactWrite }; export type { TransactWriteConfig, TransactWriteResult };