import { DynamoEntity } from '../core/entity.js'; import { ObjectLikeZodType, EntitySchema, TransactWriteOperation } from '../core/index.js'; import { ReturnValue, ReturnItemCollectionMetrics, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb'; import { UpdateValues } from '../updates/index.js'; import { BaseConfig, BaseResult, BaseCommand, WriteTransactable } from './index.js'; /** * Configuration for the Update command. * * @template Schema - The Zod schema defining the structure of the entity. */ type UpdateConfig = BaseConfig & { key: Partial>; update: UpdateValues; returnValues?: ReturnValue; returnItemCollectionMetrics?: ReturnItemCollectionMetrics; }; /** * Result of the Update command. * * @template Schema - The Zod schema defining the structure of the entity. */ type UpdateResult = BaseResult & { updatedItem?: Partial> | undefined; itemCollectionMetrics?: ItemCollectionMetrics; }; /** * Command to modify existing item attributes in a DynamoDB table. * * @template Schema - The Zod schema defining the structure of the entity. * * @example * ```typescript * import { DynamoTable, DynamoEntity, key, Update, add } 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(), * loginCount: z.number(), * }), * partitionKey: user => key('USER', user.userId), * sortKey: () => 'METADATA', * }); * * const updateCommand = new Update({ * key: { userId: 'user123' }, * update: { * name: 'Jane Doe', * loginCount: add(1), * }, * returnValues: 'ALL_NEW', * }); * * const { updatedItem } = await userEntity.send(updateCommand); * ``` */ declare class Update implements BaseCommand, Schema>, WriteTransactable { #private; constructor(config: UpdateConfig); execute(entity: DynamoEntity): Promise>; prepareWriteTransaction(entity: DynamoEntity): Promise; } export { Update }; export type { UpdateConfig, UpdateResult };