import { DynamoEntity } from '../core/entity.js'; import { ObjectLikeZodType, EntitySchema } from '../core/index.js'; import { ScanConfig } from './scan.js'; import { Projection } from '../projections/index.js'; import { BaseResult, BaseCommand, BasePaginatable } from './index.js'; import { ScanCommandInput, NativeAttributeValue, ScanCommandOutput } from '@aws-sdk/lib-dynamodb'; /** * Configuration for the ProjectedScan command. * * @template ProjectionSchema - The Zod schema defining the structure of the projected attributes. */ type ProjectedScanConfig = ScanConfig & { projection: Projection; projectionSchema: ProjectionSchema; }; /** * Result of the ProjectedScan command. * * @template Schema - The Zod schema defining the structure of the entity. * @template ProjectionSchema - The Zod schema defining the structure of the projected attributes. */ type ProjectedScanResult = BaseResult & { items: EntitySchema[]; count: number; scannedCount: number; lastEvaluatedKey?: Partial> | undefined; }; /** * Command to scan entire table or index and retrieve specific attributes (expensive operation). * * @template Schema - The Zod schema defining the structure of the entity. * @template ProjectionSchema - The Zod schema defining the structure of the projected attributes. * * @example * ```typescript * import { DynamoTable, DynamoEntity, key, ProjectedScan } 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(), * title: z.string(), * description: z.string(), * isComplete: z.boolean(), * }), * partitionKey: todo => key('USER', todo.userId), * sortKey: todo => key('TODO', todo.todoId), * }); * * const projectedScanCommand = new ProjectedScan({ * projection: ['title', 'isComplete'], * projectionSchema: z.object({ * title: z.string(), * isComplete: z.boolean(), * }), * filter: { isComplete: false }, * limit: 100, * }); * * const { items, scannedCount } = await todoEntity.send(projectedScanCommand); * ``` */ declare class ProjectedScan implements BaseCommand, Schema>, BasePaginatable, Schema> { #private; constructor(config: ProjectedScanConfig); buildCommandInput(entity: DynamoEntity): ScanCommandInput; validateItems(items: Record[] | undefined): Promise[]>; buildResult(items: EntitySchema[], scanResult: ScanCommandOutput): ProjectedScanResult; execute(entity: DynamoEntity): Promise>; executePaginated(entity: DynamoEntity): AsyncGenerator, void, unknown>; } export { ProjectedScan }; export type { ProjectedScanConfig, ProjectedScanResult };