import { DynamoEntity } from '../core/entity.js'; import { ObjectLikeZodType, EntitySchema, TransactWriteOperation } from '../core/index.js'; import { ReturnValue, ReturnItemCollectionMetrics, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb'; import { BaseConfig, BaseResult, BaseCommand, WriteTransactable } from './index.js'; /** * Configuration for the Put command. * * @template Schema - The Zod schema defining the structure of the entity. */ type PutConfig = BaseConfig & { item: EntitySchema; returnValues?: ReturnValue; returnItemCollectionMetrics?: ReturnItemCollectionMetrics; }; /** * Result of the Put command. * * @template Schema - The Zod schema defining the structure of the entity. */ type PutResult = BaseResult & { returnItem: Partial> | undefined; itemCollectionMetrics?: ItemCollectionMetrics; }; /** * Command to create or replace an item in a DynamoDB table. * * @template Schema - The Zod schema defining the structure of the entity. * * @example * ```typescript * import { DynamoTable, DynamoEntity, key, Put } 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(), * email: z.string(), * }), * partitionKey: user => key('USER', user.userId), * sortKey: () => 'METADATA', * }); * * const putCommand = new Put({ * item: { * userId: 'user123', * name: 'John Doe', * email: 'john@example.com', * }, * returnValues: 'ALL_OLD', * }); * * const { returnItem } = await userEntity.send(putCommand); * ``` */ declare class Put implements BaseCommand, Schema>, WriteTransactable { #private; constructor(config: PutConfig); buildItem(entity: DynamoEntity): Promise<{ [x: string]: unknown; }>; execute(entity: DynamoEntity): Promise>; prepareWriteTransaction(entity: DynamoEntity): Promise; } export { Put }; export type { PutConfig, PutResult };