dyno-table 1.6.0 → 1.8.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +53 -140
  2. package/dist/batch-builder-BOBwOIUE.d.ts +398 -0
  3. package/dist/batch-builder-CKYnMRyz.d.cts +398 -0
  4. package/dist/{builder-types-DlaUSc-b.d.cts → builder-types-BTVhQSHI.d.cts} +55 -5
  5. package/dist/{builder-types-B_tCpn9F.d.ts → builder-types-CzuLR4Th.d.ts} +55 -5
  6. package/dist/builders/condition-check-builder.cjs +0 -13
  7. package/dist/builders/condition-check-builder.cjs.map +1 -1
  8. package/dist/builders/condition-check-builder.d.cts +1 -14
  9. package/dist/builders/condition-check-builder.d.ts +1 -14
  10. package/dist/builders/condition-check-builder.js +0 -13
  11. package/dist/builders/condition-check-builder.js.map +1 -1
  12. package/dist/builders/delete-builder.cjs +38 -0
  13. package/dist/builders/delete-builder.cjs.map +1 -1
  14. package/dist/builders/delete-builder.d.cts +37 -1
  15. package/dist/builders/delete-builder.d.ts +37 -1
  16. package/dist/builders/delete-builder.js +38 -0
  17. package/dist/builders/delete-builder.js.map +1 -1
  18. package/dist/builders/paginator.cjs +21 -27
  19. package/dist/builders/paginator.cjs.map +1 -1
  20. package/dist/builders/paginator.d.cts +3 -27
  21. package/dist/builders/paginator.d.ts +3 -27
  22. package/dist/builders/paginator.js +21 -27
  23. package/dist/builders/paginator.js.map +1 -1
  24. package/dist/builders/put-builder.cjs +39 -8
  25. package/dist/builders/put-builder.cjs.map +1 -1
  26. package/dist/builders/put-builder.d.cts +38 -9
  27. package/dist/builders/put-builder.d.ts +38 -9
  28. package/dist/builders/put-builder.js +39 -8
  29. package/dist/builders/put-builder.js.map +1 -1
  30. package/dist/builders/query-builder.cjs +115 -75
  31. package/dist/builders/query-builder.cjs.map +1 -1
  32. package/dist/builders/query-builder.d.cts +2 -2
  33. package/dist/builders/query-builder.d.ts +2 -2
  34. package/dist/builders/query-builder.js +115 -75
  35. package/dist/builders/query-builder.js.map +1 -1
  36. package/dist/builders/transaction-builder.cjs +0 -47
  37. package/dist/builders/transaction-builder.cjs.map +1 -1
  38. package/dist/builders/transaction-builder.d.cts +1 -48
  39. package/dist/builders/transaction-builder.d.ts +1 -48
  40. package/dist/builders/transaction-builder.js +0 -47
  41. package/dist/builders/transaction-builder.js.map +1 -1
  42. package/dist/builders/update-builder.cjs +2 -2
  43. package/dist/builders/update-builder.cjs.map +1 -1
  44. package/dist/builders/update-builder.d.cts +3 -3
  45. package/dist/builders/update-builder.d.ts +3 -3
  46. package/dist/builders/update-builder.js +2 -2
  47. package/dist/builders/update-builder.js.map +1 -1
  48. package/dist/conditions.cjs.map +1 -1
  49. package/dist/conditions.js.map +1 -1
  50. package/dist/entity.cjs +69 -37
  51. package/dist/entity.cjs.map +1 -1
  52. package/dist/entity.d.cts +30 -10
  53. package/dist/entity.d.ts +30 -10
  54. package/dist/entity.js +69 -37
  55. package/dist/entity.js.map +1 -1
  56. package/dist/index.cjs +661 -218
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +4 -3
  59. package/dist/index.d.ts +4 -3
  60. package/dist/index.js +660 -219
  61. package/dist/index.js.map +1 -1
  62. package/dist/{query-builder-BhrR31oO.d.ts → query-builder-CaHzZmDf.d.ts} +31 -63
  63. package/dist/{query-builder-CbHvimBk.d.cts → query-builder-DFkxojBM.d.cts} +31 -63
  64. package/dist/{table-CY9byPEg.d.cts → table-CHitMHXE.d.cts} +55 -169
  65. package/dist/{table-Des8C2od.d.ts → table-m7DQk5dK.d.ts} +55 -169
  66. package/dist/table.cjs +590 -181
  67. package/dist/table.cjs.map +1 -1
  68. package/dist/table.d.cts +4 -3
  69. package/dist/table.d.ts +4 -3
  70. package/dist/table.js +590 -181
  71. package/dist/table.js.map +1 -1
  72. package/dist/utils.cjs.map +1 -1
  73. package/dist/utils.js.map +1 -1
  74. package/package.json +1 -1
@@ -0,0 +1,398 @@
1
+ import { DynamoItem } from './types.cjs';
2
+ import { r as PrimaryKeyWithoutExpression } from './conditions-3ae5znV_.cjs';
3
+ import { a as PutCommandParams, D as DeleteCommandParams } from './builder-types-BTVhQSHI.cjs';
4
+
5
+ type BatchWriteOperation<T extends Record<string, unknown>> = {
6
+ type: "put";
7
+ item: T;
8
+ } | {
9
+ type: "delete";
10
+ key: PrimaryKeyWithoutExpression;
11
+ };
12
+
13
+ /**
14
+ * Parameters for the DynamoDB get command.
15
+ */
16
+ interface GetCommandParams {
17
+ /** The name of the DynamoDB table */
18
+ tableName: string;
19
+ /** The primary key of the item to get */
20
+ key: PrimaryKeyWithoutExpression;
21
+ /** Comma-separated list of attributes to return */
22
+ projectionExpression?: string;
23
+ /** Map of expression attribute name placeholders to actual names */
24
+ expressionAttributeNames?: Record<string, string>;
25
+ /** Whether to use strongly consistent reads */
26
+ consistentRead?: boolean;
27
+ }
28
+ /**
29
+ * Function type for executing DynamoDB get operations.
30
+ * @typeParam T - The type of item being retrieved
31
+ */
32
+ type GetExecutor<T extends DynamoItem> = (params: GetCommandParams) => Promise<{
33
+ item: T | undefined;
34
+ }>;
35
+ /**
36
+ * Builder for creating DynamoDB get operations.
37
+ * Use this builder when you need to:
38
+ * - Retrieve a single dinosaur by its primary key
39
+ * - Project specific dinosaur attributes
40
+ * - Use consistent reads for critical dinosaur data
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // Simple get
45
+ * const result = await new GetBuilder(executor, { pk: 'dinosaur#123', sk: 'profile' })
46
+ * .execute();
47
+ *
48
+ * // Get with projection and consistent read
49
+ * const result = await new GetBuilder(executor, { pk: 'dinosaur#123', sk: 'profile' })
50
+ * .select(['species', 'name', 'diet'])
51
+ * .consistentRead()
52
+ * .execute();
53
+ * ```
54
+ *
55
+ * @typeParam T - The type of item being retrieved
56
+ */
57
+ declare class GetBuilder<T extends DynamoItem> {
58
+ private readonly executor;
59
+ private readonly params;
60
+ private options;
61
+ private selectedFields;
62
+ /**
63
+ * Creates a new GetBuilder instance.
64
+ *
65
+ * @param executor - Function that executes the get operation
66
+ * @param key - Primary key of the item to retrieve
67
+ * @param tableName - Name of the DynamoDB table
68
+ */
69
+ constructor(executor: GetExecutor<T>, key: PrimaryKeyWithoutExpression, tableName: string);
70
+ /**
71
+ * Specifies which attributes to return in the get results.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * // Select single attribute
76
+ * builder.select('species')
77
+ *
78
+ * // Select multiple attributes
79
+ * builder.select(['id', 'species', 'diet'])
80
+ *
81
+ * // Chain multiple select calls
82
+ * builder
83
+ * .select('id')
84
+ * .select(['species', 'diet'])
85
+ * ```
86
+ *
87
+ * @param fields - A single field name or an array of field names to return
88
+ * @returns The builder instance for method chaining
89
+ */
90
+ select(fields: string | string[]): GetBuilder<T>;
91
+ /**
92
+ * Sets whether to use strongly consistent reads for the get operation.
93
+ * Use this method when you need:
94
+ * - The most up-to-date dinosaur data
95
+ * - To ensure you're reading the latest dinosaur status
96
+ * - Critical safety information about dangerous species
97
+ *
98
+ * Note: Consistent reads consume twice the throughput
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * // Get the latest T-Rex data
103
+ * const result = await new GetBuilder(executor, { pk: 'dinosaur#123', sk: 'profile' })
104
+ * .consistentRead()
105
+ * .execute();
106
+ * ```
107
+ *
108
+ * @param consistentRead - Whether to use consistent reads (defaults to true)
109
+ * @returns The builder instance for method chaining
110
+ */
111
+ consistentRead(consistentRead?: boolean): GetBuilder<T>;
112
+ /**
113
+ * Adds this get operation to a batch with optional entity type information.
114
+ *
115
+ * @example Basic Usage
116
+ * ```ts
117
+ * const batch = table.batchBuilder();
118
+ *
119
+ * // Add multiple get operations to batch
120
+ * dinosaurRepo.get({ id: 'dino-1' }).withBatch(batch);
121
+ * dinosaurRepo.get({ id: 'dino-2' }).withBatch(batch);
122
+ * dinosaurRepo.get({ id: 'dino-3' }).withBatch(batch);
123
+ *
124
+ * // Execute all gets efficiently
125
+ * const results = await batch.execute();
126
+ * ```
127
+ *
128
+ * @example Typed Usage
129
+ * ```ts
130
+ * const batch = table.batchBuilder<{
131
+ * User: UserEntity;
132
+ * Order: OrderEntity;
133
+ * }>();
134
+ *
135
+ * // Add operations with type information
136
+ * userRepo.get({ id: 'user-1' }).withBatch(batch, 'User');
137
+ * orderRepo.get({ id: 'order-1' }).withBatch(batch, 'Order');
138
+ *
139
+ * // Execute and get typed results
140
+ * const result = await batch.execute();
141
+ * const users: UserEntity[] = result.reads.itemsByType.User;
142
+ * const orders: OrderEntity[] = result.reads.itemsByType.Order;
143
+ * ```
144
+ *
145
+ * @param batch - The batch builder to add this operation to
146
+ * @param entityType - Optional entity type key for type tracking
147
+ */
148
+ withBatch<TEntities extends Record<string, DynamoItem> = Record<string, DynamoItem>, K extends keyof TEntities = keyof TEntities>(batch: BatchBuilder<TEntities>, entityType?: K): void;
149
+ /**
150
+ * Converts the builder configuration to a DynamoDB command
151
+ */
152
+ private toDynamoCommand;
153
+ /**
154
+ * Executes the get operation against DynamoDB.
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * try {
159
+ * const result = await new GetBuilder(executor, { pk: 'dinosaur#123', sk: 'profile' })
160
+ * .select(['species', 'name', 'diet'])
161
+ * .consistentRead()
162
+ * .execute();
163
+ *
164
+ * if (result.item) {
165
+ * console.log('Dinosaur found:', result.item);
166
+ * } else {
167
+ * console.log('Dinosaur not found');
168
+ * }
169
+ * } catch (error) {
170
+ * console.error('Error getting dinosaur:', error);
171
+ * }
172
+ * ```
173
+ *
174
+ * @returns A promise that resolves to an object containing:
175
+ * - item: The retrieved dinosaur or undefined if not found
176
+ */
177
+ execute(): Promise<{
178
+ item: T | undefined;
179
+ }>;
180
+ }
181
+
182
+ /**
183
+ * Configuration for batch operations
184
+ */
185
+ interface BatchConfig {
186
+ partitionKey: string;
187
+ sortKey?: string;
188
+ }
189
+ /**
190
+ * Executor function for batch write operations
191
+ */
192
+ type BatchWriteExecutor = (operations: Array<BatchWriteOperation<DynamoItem>>) => Promise<{
193
+ unprocessedItems: Array<BatchWriteOperation<DynamoItem>>;
194
+ }>;
195
+ /**
196
+ * Executor function for batch get operations
197
+ */
198
+ type BatchGetExecutor = (keys: Array<PrimaryKeyWithoutExpression>) => Promise<{
199
+ items: DynamoItem[];
200
+ unprocessedKeys: PrimaryKeyWithoutExpression[];
201
+ }>;
202
+ /**
203
+ * Error class for batch operation failures
204
+ */
205
+ declare class BatchError extends Error {
206
+ readonly operation: "write" | "read";
207
+ readonly cause?: Error;
208
+ constructor(message: string, operation: "write" | "read", cause?: Error);
209
+ }
210
+ /**
211
+ * Result structure for batch operations
212
+ */
213
+ interface BatchResult {
214
+ /** Whether the batch operation completed successfully */
215
+ success: boolean;
216
+ /** Write operation results */
217
+ writes: {
218
+ /** Number of write operations processed successfully */
219
+ processed: number;
220
+ /** Write operations that were not processed and may need retry */
221
+ unprocessed: Array<BatchWriteOperation<DynamoItem>>;
222
+ };
223
+ /** Read operation results */
224
+ reads: {
225
+ /** Items retrieved from the batch get operations */
226
+ items: DynamoItem[];
227
+ /** Number of items found and returned */
228
+ found: number;
229
+ /** Keys that were not processed and may need retry */
230
+ unprocessed: PrimaryKeyWithoutExpression[];
231
+ };
232
+ /** Total number of operations in the batch */
233
+ totalOperations: number;
234
+ /** Any errors that occurred during batch processing */
235
+ errors?: BatchError[];
236
+ }
237
+ /**
238
+ * Typed result structure for batch operations with entity type information
239
+ */
240
+ interface TypedBatchResult<TEntities extends Record<string, DynamoItem> = Record<string, DynamoItem>> {
241
+ /** Whether the batch operation completed successfully */
242
+ success: boolean;
243
+ /** Write operation results */
244
+ writes: {
245
+ /** Number of write operations processed successfully */
246
+ processed: number;
247
+ /** Write operations that were not processed and may need retry */
248
+ unprocessed: Array<BatchWriteOperation<DynamoItem>>;
249
+ };
250
+ /** Read operation results with typed items */
251
+ reads: {
252
+ /** Items retrieved from the batch get operations, grouped by entity type */
253
+ itemsByType: {
254
+ [K in keyof TEntities]: TEntities[K][];
255
+ };
256
+ /** All items retrieved (typed as union of all entity types) */
257
+ items: TEntities[keyof TEntities][];
258
+ /** Number of items found and returned */
259
+ found: number;
260
+ /** Keys that were not processed and may need retry */
261
+ unprocessed: PrimaryKeyWithoutExpression[];
262
+ };
263
+ /** Total number of operations in the batch */
264
+ totalOperations: number;
265
+ /** Any errors that occurred during batch execution */
266
+ errors?: BatchError[];
267
+ }
268
+ /**
269
+ * Builder for creating and executing DynamoDB batch operations with full entity support and type inference.
270
+ *
271
+ * Use BatchBuilder when you need to:
272
+ * - Perform multiple operations efficiently (up to 25 writes, 100 reads per batch)
273
+ * - Maintain entity validation, key generation, and type safety
274
+ * - Mix read and write operations in a single batch
275
+ * - Get typed results grouped by entity type
276
+ *
277
+ * @example Basic Usage
278
+ * ```typescript
279
+ * // Define entity types for the batch
280
+ * const batch = table.batchBuilder<{
281
+ * User: UserEntity;
282
+ * Order: OrderEntity;
283
+ * }>();
284
+ *
285
+ * // Add operations using entity repositories
286
+ * userRepo.create(newUser).withBatch(batch, 'User')
287
+ * userRepo.delete({ id: 'old-user' }).withBatch(batch, 'User')
288
+ * orderRepo.get({ id: 'existing-order' }).withBatch(batch, 'Order')
289
+ *
290
+ * // Execute all operations and get typed results
291
+ * const result = await batch.execute()
292
+ * const users: UserEntity[] = result.reads.itemsByType.User
293
+ * const orders: OrderEntity[] = result.reads.itemsByType.Order
294
+ * ```
295
+ *
296
+ * @example Error Handling
297
+ * ```typescript
298
+ * try {
299
+ * const result = await batch.execute()
300
+ *
301
+ * if (result.writes.unprocessed.length > 0) {
302
+ * console.warn('Some writes were not processed:', result.writes.unprocessed)
303
+ * }
304
+ * } catch (error) {
305
+ * if (error instanceof BatchError) {
306
+ * console.error('Batch operation failed:', error.message)
307
+ * }
308
+ * }
309
+ * ```
310
+ */
311
+ declare class BatchBuilder<TEntities extends Record<string, DynamoItem> = Record<string, DynamoItem>> {
312
+ private batchWriteExecutor;
313
+ private batchGetExecutor;
314
+ private config;
315
+ private writeItems;
316
+ private getItems;
317
+ constructor(batchWriteExecutor: BatchWriteExecutor, batchGetExecutor: BatchGetExecutor, config: BatchConfig);
318
+ /**
319
+ * Checks if the batch is empty (contains no operations)
320
+ *
321
+ * @returns true if the batch contains no operations
322
+ */
323
+ isEmpty(): boolean;
324
+ /**
325
+ * Gets the count of operations in the batch
326
+ *
327
+ * @returns Object containing the count of write and read operations
328
+ */
329
+ getOperationCount(): {
330
+ writes: number;
331
+ reads: number;
332
+ };
333
+ /**
334
+ * Validates that the batch is not empty before execution
335
+ *
336
+ * @throws {BatchError} If the batch is empty
337
+ */
338
+ private validateNotEmpty;
339
+ /**
340
+ * Adds a put operation to the batch with entity type information.
341
+ * This method is used internally by entity builders.
342
+ *
343
+ * @param command - The complete put command configuration
344
+ * @param entityType - The entity type name for type tracking
345
+ * @returns The batch builder for method chaining
346
+ * @internal
347
+ */
348
+ putWithCommand<K extends keyof TEntities>(command: PutCommandParams, entityType?: K): this;
349
+ /**
350
+ * Adds a delete operation to the batch with entity type information.
351
+ * This method is used internally by entity builders.
352
+ *
353
+ * @param command - The complete delete command configuration
354
+ * @param entityType - The entity type name for type tracking
355
+ * @returns The batch builder for method chaining
356
+ * @internal
357
+ */
358
+ deleteWithCommand<K extends keyof TEntities>(command: DeleteCommandParams, entityType?: K): this;
359
+ /**
360
+ * Adds a get operation to the batch with entity type information.
361
+ * This method is used internally by entity builders.
362
+ *
363
+ * @param command - The complete get command configuration
364
+ * @param entityType - The entity type name for type tracking
365
+ * @returns The batch builder for method chaining
366
+ * @internal
367
+ */
368
+ getWithCommand<K extends keyof TEntities>(command: GetCommandParams, entityType?: K): this;
369
+ /**
370
+ * Executes all write operations in the batch.
371
+ *
372
+ * @returns A promise that resolves to any unprocessed operations
373
+ * @private
374
+ */
375
+ private executeWrites;
376
+ /**
377
+ * Executes all get operations in the batch.
378
+ *
379
+ * @returns A promise that resolves to the retrieved items
380
+ * @private
381
+ */
382
+ private executeGets;
383
+ /**
384
+ * Groups retrieved items by their entity type.
385
+ * @private
386
+ */
387
+ private groupItemsByType;
388
+ /**
389
+ * Executes all operations in the batch with typed results.
390
+ * Performs write operations first, then get operations.
391
+ *
392
+ * @returns A promise that resolves to a TypedBatchResult with entity type information
393
+ * @throws {BatchError} If the batch is empty or if operations fail
394
+ */
395
+ execute(): Promise<TypedBatchResult<TEntities>>;
396
+ }
397
+
398
+ export { BatchBuilder as B, GetBuilder as G, BatchError as a, type BatchResult as b, type BatchWriteOperation as c };
@@ -14,6 +14,59 @@ interface DynamoCommandWithExpressions {
14
14
  [key: string]: unknown;
15
15
  }
16
16
 
17
+ /**
18
+ * Function type for executing DynamoDB operations and returning raw results.
19
+ */
20
+ type DirectExecutor<T extends DynamoItem> = () => Promise<{
21
+ items: T[];
22
+ lastEvaluatedKey?: DynamoItem;
23
+ }>;
24
+ /**
25
+ * Minimal result generator that provides async iteration over DynamoDB results with automatic pagination.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const results = await queryBuilder.execute();
30
+ *
31
+ * for await (const item of results) {
32
+ * console.log(item);
33
+ * }
34
+ * ```
35
+ */
36
+ declare class ResultIterator<T extends DynamoItem, TConfig extends TableConfig = TableConfig> {
37
+ private queryBuilder;
38
+ private directExecutor;
39
+ private lastEvaluatedKey?;
40
+ private itemsYielded;
41
+ private readonly overallLimit?;
42
+ constructor(queryBuilder: QueryBuilderInterface<T, TConfig>, directExecutor: DirectExecutor<T>);
43
+ /**
44
+ * Async iterator with automatic pagination
45
+ */
46
+ [Symbol.asyncIterator](): AsyncIterableIterator<T>;
47
+ /**
48
+ * Convert to array (loads all pages).
49
+ *
50
+ * ```ts
51
+ * const result = await table.query({ pk: "foo" }).execute();
52
+ * const allItemsFromDynamo = await result.toArray();
53
+ * ```
54
+ *
55
+ * Note: This will load all pages into memory. For large datasets, consider using async iteration instead.
56
+ *```ts
57
+ * const result = await table.query({ pk: "foo" }).execute();
58
+ * for await (const item of result) {
59
+ * // Process each item
60
+ * }
61
+ * ```
62
+ */
63
+ toArray(): Promise<T[]>;
64
+ /**
65
+ * Get the last evaluated key
66
+ */
67
+ getLastEvaluatedKey(): DynamoItem | undefined;
68
+ }
69
+
17
70
  interface DeleteCommandParams extends DynamoCommandWithExpressions {
18
71
  tableName: string;
19
72
  key: Record<string, unknown>;
@@ -77,10 +130,7 @@ interface BaseBuilderInterface<T extends DynamoItem, TConfig extends TableConfig
77
130
  limit(limit: number): B;
78
131
  getLimit(): number | undefined;
79
132
  startFrom(lastEvaluatedKey: DynamoItem): B;
80
- execute(): Promise<{
81
- items: T[];
82
- lastEvaluatedKey?: DynamoItem;
83
- }>;
133
+ execute(): Promise<ResultIterator<T, TConfig>>;
84
134
  }
85
135
  /**
86
136
  * Interface for the QueryBuilder class to be used by Paginator
@@ -116,4 +166,4 @@ interface PaginationResult<T> {
116
166
  page: number;
117
167
  }
118
168
 
119
- export type { ConditionCheckCommandParams as C, DeleteCommandParams as D, FilterBuilderInterface as F, PaginationResult as P, QueryBuilderInterface as Q, ScanBuilderInterface as S, UpdateCommandParams as U, PutCommandParams as a };
169
+ export { type ConditionCheckCommandParams as C, type DeleteCommandParams as D, type FilterBuilderInterface as F, type PaginationResult as P, type QueryBuilderInterface as Q, ResultIterator as R, type ScanBuilderInterface as S, type UpdateCommandParams as U, type PutCommandParams as a };
@@ -14,6 +14,59 @@ interface DynamoCommandWithExpressions {
14
14
  [key: string]: unknown;
15
15
  }
16
16
 
17
+ /**
18
+ * Function type for executing DynamoDB operations and returning raw results.
19
+ */
20
+ type DirectExecutor<T extends DynamoItem> = () => Promise<{
21
+ items: T[];
22
+ lastEvaluatedKey?: DynamoItem;
23
+ }>;
24
+ /**
25
+ * Minimal result generator that provides async iteration over DynamoDB results with automatic pagination.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const results = await queryBuilder.execute();
30
+ *
31
+ * for await (const item of results) {
32
+ * console.log(item);
33
+ * }
34
+ * ```
35
+ */
36
+ declare class ResultIterator<T extends DynamoItem, TConfig extends TableConfig = TableConfig> {
37
+ private queryBuilder;
38
+ private directExecutor;
39
+ private lastEvaluatedKey?;
40
+ private itemsYielded;
41
+ private readonly overallLimit?;
42
+ constructor(queryBuilder: QueryBuilderInterface<T, TConfig>, directExecutor: DirectExecutor<T>);
43
+ /**
44
+ * Async iterator with automatic pagination
45
+ */
46
+ [Symbol.asyncIterator](): AsyncIterableIterator<T>;
47
+ /**
48
+ * Convert to array (loads all pages).
49
+ *
50
+ * ```ts
51
+ * const result = await table.query({ pk: "foo" }).execute();
52
+ * const allItemsFromDynamo = await result.toArray();
53
+ * ```
54
+ *
55
+ * Note: This will load all pages into memory. For large datasets, consider using async iteration instead.
56
+ *```ts
57
+ * const result = await table.query({ pk: "foo" }).execute();
58
+ * for await (const item of result) {
59
+ * // Process each item
60
+ * }
61
+ * ```
62
+ */
63
+ toArray(): Promise<T[]>;
64
+ /**
65
+ * Get the last evaluated key
66
+ */
67
+ getLastEvaluatedKey(): DynamoItem | undefined;
68
+ }
69
+
17
70
  interface DeleteCommandParams extends DynamoCommandWithExpressions {
18
71
  tableName: string;
19
72
  key: Record<string, unknown>;
@@ -77,10 +130,7 @@ interface BaseBuilderInterface<T extends DynamoItem, TConfig extends TableConfig
77
130
  limit(limit: number): B;
78
131
  getLimit(): number | undefined;
79
132
  startFrom(lastEvaluatedKey: DynamoItem): B;
80
- execute(): Promise<{
81
- items: T[];
82
- lastEvaluatedKey?: DynamoItem;
83
- }>;
133
+ execute(): Promise<ResultIterator<T, TConfig>>;
84
134
  }
85
135
  /**
86
136
  * Interface for the QueryBuilder class to be used by Paginator
@@ -116,4 +166,4 @@ interface PaginationResult<T> {
116
166
  page: number;
117
167
  }
118
168
 
119
- export type { ConditionCheckCommandParams as C, DeleteCommandParams as D, FilterBuilderInterface as F, PaginationResult as P, QueryBuilderInterface as Q, ScanBuilderInterface as S, UpdateCommandParams as U, PutCommandParams as a };
169
+ export { type ConditionCheckCommandParams as C, type DeleteCommandParams as D, type FilterBuilderInterface as F, type PaginationResult as P, type QueryBuilderInterface as Q, ResultIterator as R, type ScanBuilderInterface as S, type UpdateCommandParams as U, type PutCommandParams as a };
@@ -252,10 +252,6 @@ var ConditionCheckBuilder = class {
252
252
  }
253
253
  /**
254
254
  * Adds a condition that must be satisfied for the check to succeed.
255
- * Use this method when you need to:
256
- * - Validate complex item states
257
- * - Check multiple attributes together
258
- * - Ensure safety conditions are met
259
255
  *
260
256
  * @example
261
257
  * ```typescript
@@ -351,10 +347,6 @@ var ConditionCheckBuilder = class {
351
347
  }
352
348
  /**
353
349
  * Adds this condition check operation to a transaction.
354
- * Use this method when you need to:
355
- * - Verify habitat safety before transfers
356
- * - Ensure proper feeding conditions
357
- * - Validate security protocols
358
350
  *
359
351
  * @example
360
352
  * ```ts
@@ -384,11 +376,6 @@ var ConditionCheckBuilder = class {
384
376
  /**
385
377
  * Gets a human-readable representation of the condition check command
386
378
  * with all expression placeholders replaced by their actual values.
387
- * Use this method when you need to:
388
- * - Debug complex condition expressions
389
- * - Verify condition parameters
390
- * - Log safety checks
391
- * - Troubleshoot condition failures
392
379
  *
393
380
  * @example
394
381
  * ```ts