import { Condition } from '../conditions/index.js'; import { DynamoEntity } from '../core/entity.js'; import { ObjectLikeZodType, EntitySchema } from '../core/index.js'; import { Select } from '@aws-sdk/client-dynamodb'; import { BaseConfig, BaseResult, BaseCommand, BasePaginatable } from './index.js'; import { ScanCommandInput, NativeAttributeValue, ScanCommandOutput } from '@aws-sdk/lib-dynamodb'; /** * Configuration for the Scan command. * * @template Schema - The Zod schema defining the structure of the entity. */ type ScanConfig = BaseConfig & { indexName?: string; filter?: Condition; limit?: number; selectAttributes?: Select; consistent?: boolean; validationConcurrency?: number; segment?: number; totalSegments?: number; exclusiveStartKey?: Partial>; pageSize?: number; }; /** * Result of the Scan command. * * @template Schema - The Zod schema defining the structure of the entity. */ type ScanResult = BaseResult & { items: EntitySchema[]; count: number; scannedCount: number; lastEvaluatedKey?: Partial> | undefined; }; /** * Command to scan entire table or index (expensive operation). * * @template Schema - The Zod schema defining the structure of the entity. * * @example * ```typescript * import { DynamoTable, DynamoEntity, key, Scan } from 'dynamo-document-builder'; * * const table = new DynamoTable({ * tableName: 'ExampleTable', * documentClient, * }); * * const todoEntity = new DynamoEntity({ * table, * schema: z.object({ * userId: z.string(), * todoId: z.string(), * isComplete: z.boolean(), * }), * partitionKey: todo => key('USER', todo.userId), * sortKey: todo => key('TODO', todo.todoId), * }); * * const scanCommand = new Scan({ * filter: { isComplete: false }, * limit: 100, * }); * * const { items, scannedCount } = await todoEntity.send(scanCommand); * ``` */ declare class Scan implements BaseCommand, Schema>, BasePaginatable, Schema> { #private; constructor(config?: ScanConfig); buildCommandInput(entity: DynamoEntity): ScanCommandInput; validateItems(entity: DynamoEntity, items: Record[] | undefined): Promise[]>; buildResult(items: EntitySchema[], scanResult: ScanCommandOutput): ScanResult; execute(entity: DynamoEntity): Promise>; executePaginated(entity: DynamoEntity): AsyncGenerator, void, unknown>; } export { Scan }; export type { ScanConfig, ScanResult };