dyno-table 2.2.0 → 2.3.0

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 (106) hide show
  1. package/README.md +200 -1860
  2. package/dist/builders.cjs +55 -0
  3. package/dist/builders.d.cts +4 -0
  4. package/dist/builders.d.ts +4 -0
  5. package/dist/builders.js +2 -0
  6. package/dist/chunk-2EWNZOUK.js +618 -0
  7. package/dist/chunk-2WIBY7PZ.js +46 -0
  8. package/dist/chunk-7UJJ7JXM.cjs +63 -0
  9. package/dist/chunk-DTFJJASK.js +3200 -0
  10. package/dist/chunk-EODPMYPE.js +558 -0
  11. package/dist/chunk-KA3VPIPS.cjs +560 -0
  12. package/dist/chunk-NTA6GDPP.cjs +622 -0
  13. package/dist/chunk-PB7BBCZO.cjs +32 -0
  14. package/dist/chunk-QVRMYGC4.js +29 -0
  15. package/dist/chunk-XYL43FDX.cjs +3217 -0
  16. package/dist/{conditions-CC3NDfUU.d.cts → conditions-CcZL0sR2.d.cts} +1 -1
  17. package/dist/{conditions-DD0bvyHm.d.ts → conditions-D_w7vVYG.d.ts} +1 -1
  18. package/dist/conditions.cjs +67 -62
  19. package/dist/conditions.d.cts +1 -1
  20. package/dist/conditions.d.ts +1 -1
  21. package/dist/conditions.js +1 -48
  22. package/dist/entity.cjs +14 -625
  23. package/dist/entity.d.cts +5 -13
  24. package/dist/entity.d.ts +5 -13
  25. package/dist/entity.js +2 -626
  26. package/dist/index-2cbm07Bi.d.ts +2797 -0
  27. package/dist/index-DlN8G9hd.d.cts +2797 -0
  28. package/dist/index.cjs +111 -4446
  29. package/dist/index.d.cts +3 -11
  30. package/dist/index.d.ts +3 -11
  31. package/dist/index.js +5 -4428
  32. package/dist/standard-schema.cjs +0 -2
  33. package/dist/standard-schema.js +0 -2
  34. package/dist/table.cjs +7 -3782
  35. package/dist/table.d.cts +163 -12
  36. package/dist/table.d.ts +163 -12
  37. package/dist/table.js +3 -3785
  38. package/dist/types.cjs +0 -2
  39. package/dist/types.js +0 -2
  40. package/dist/utils.cjs +10 -30
  41. package/dist/utils.js +1 -31
  42. package/package.json +12 -67
  43. package/dist/batch-builder-BPoHyN_Q.d.cts +0 -398
  44. package/dist/batch-builder-Cdo49C2r.d.ts +0 -398
  45. package/dist/builder-types-BTVhQSHI.d.cts +0 -169
  46. package/dist/builder-types-CzuLR4Th.d.ts +0 -169
  47. package/dist/builders/condition-check-builder.cjs +0 -422
  48. package/dist/builders/condition-check-builder.cjs.map +0 -1
  49. package/dist/builders/condition-check-builder.d.cts +0 -153
  50. package/dist/builders/condition-check-builder.d.ts +0 -153
  51. package/dist/builders/condition-check-builder.js +0 -420
  52. package/dist/builders/condition-check-builder.js.map +0 -1
  53. package/dist/builders/delete-builder.cjs +0 -484
  54. package/dist/builders/delete-builder.cjs.map +0 -1
  55. package/dist/builders/delete-builder.d.cts +0 -211
  56. package/dist/builders/delete-builder.d.ts +0 -211
  57. package/dist/builders/delete-builder.js +0 -482
  58. package/dist/builders/delete-builder.js.map +0 -1
  59. package/dist/builders/paginator.cjs +0 -193
  60. package/dist/builders/paginator.cjs.map +0 -1
  61. package/dist/builders/paginator.d.cts +0 -155
  62. package/dist/builders/paginator.d.ts +0 -155
  63. package/dist/builders/paginator.js +0 -191
  64. package/dist/builders/paginator.js.map +0 -1
  65. package/dist/builders/put-builder.cjs +0 -554
  66. package/dist/builders/put-builder.cjs.map +0 -1
  67. package/dist/builders/put-builder.d.cts +0 -319
  68. package/dist/builders/put-builder.d.ts +0 -319
  69. package/dist/builders/put-builder.js +0 -552
  70. package/dist/builders/put-builder.js.map +0 -1
  71. package/dist/builders/query-builder.cjs +0 -743
  72. package/dist/builders/query-builder.cjs.map +0 -1
  73. package/dist/builders/query-builder.d.cts +0 -6
  74. package/dist/builders/query-builder.d.ts +0 -6
  75. package/dist/builders/query-builder.js +0 -741
  76. package/dist/builders/query-builder.js.map +0 -1
  77. package/dist/builders/transaction-builder.cjs +0 -906
  78. package/dist/builders/transaction-builder.cjs.map +0 -1
  79. package/dist/builders/transaction-builder.d.cts +0 -464
  80. package/dist/builders/transaction-builder.d.ts +0 -464
  81. package/dist/builders/transaction-builder.js +0 -904
  82. package/dist/builders/transaction-builder.js.map +0 -1
  83. package/dist/builders/update-builder.cjs +0 -668
  84. package/dist/builders/update-builder.cjs.map +0 -1
  85. package/dist/builders/update-builder.d.cts +0 -374
  86. package/dist/builders/update-builder.d.ts +0 -374
  87. package/dist/builders/update-builder.js +0 -666
  88. package/dist/builders/update-builder.js.map +0 -1
  89. package/dist/conditions.cjs.map +0 -1
  90. package/dist/conditions.js.map +0 -1
  91. package/dist/entity.cjs.map +0 -1
  92. package/dist/entity.js.map +0 -1
  93. package/dist/index.cjs.map +0 -1
  94. package/dist/index.js.map +0 -1
  95. package/dist/query-builder-CUWdavZw.d.ts +0 -477
  96. package/dist/query-builder-DoZzZz_c.d.cts +0 -477
  97. package/dist/standard-schema.cjs.map +0 -1
  98. package/dist/standard-schema.js.map +0 -1
  99. package/dist/table-CZBMkW2Z.d.ts +0 -276
  100. package/dist/table-f-3wsT7K.d.cts +0 -276
  101. package/dist/table.cjs.map +0 -1
  102. package/dist/table.js.map +0 -1
  103. package/dist/types.cjs.map +0 -1
  104. package/dist/types.js.map +0 -1
  105. package/dist/utils.cjs.map +0 -1
  106. package/dist/utils.js.map +0 -1
@@ -1,398 +0,0 @@
1
- import { r as PrimaryKeyWithoutExpression, s as Path } from './conditions-DD0bvyHm.js';
2
- import { DynamoItem } from './types.js';
3
- import { a as PutCommandParams, D as DeleteCommandParams } from './builder-types-CzuLR4Th.js';
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<K extends Path<T>>(fields: K | K[]): 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 };
@@ -1,169 +0,0 @@
1
- import { DynamoItem, TableConfig } from './types.cjs';
2
-
3
- /**
4
- * Interface for DynamoDB command objects that can contain expressions
5
- */
6
- interface DynamoCommandWithExpressions {
7
- conditionExpression?: string;
8
- updateExpression?: string;
9
- filterExpression?: string;
10
- keyConditionExpression?: string;
11
- projectionExpression?: string;
12
- expressionAttributeNames?: Record<string, string>;
13
- expressionAttributeValues?: Record<string, unknown>;
14
- [key: string]: unknown;
15
- }
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
-
70
- interface DeleteCommandParams extends DynamoCommandWithExpressions {
71
- tableName: string;
72
- key: Record<string, unknown>;
73
- conditionExpression?: string;
74
- expressionAttributeNames?: Record<string, string>;
75
- expressionAttributeValues?: DynamoItem;
76
- returnValues?: "ALL_OLD";
77
- }
78
- /**
79
- * Parameters for the DynamoDB put command.
80
- *
81
- * These parameters are used when executing the operation against DynamoDB.
82
- *
83
- * The `returnValues` property can be:
84
- * - `"ALL_OLD"`: Return the attributes of the item as they were before the operation
85
- * - `"NONE"`: Return nothing
86
- * - `"CONSISTENT"`: Triggers a GET operation after the put to retrieve the updated item state
87
- * - `"INPUT"`: Return the input values that were passed to the operation (useful for create operations)
88
- */
89
- interface PutCommandParams extends DynamoCommandWithExpressions {
90
- tableName: string;
91
- item: DynamoItem;
92
- conditionExpression?: string;
93
- expressionAttributeNames?: Record<string, string>;
94
- expressionAttributeValues?: Record<string, unknown>;
95
- returnValues?: "ALL_OLD" | "NONE" | "CONSISTENT" | "INPUT";
96
- }
97
- /**
98
- * Parameters for the DynamoDB update command.
99
- * These parameters are used when executing the operation against DynamoDB.
100
- */
101
- interface UpdateCommandParams extends DynamoCommandWithExpressions {
102
- /** The name of the DynamoDB table */
103
- tableName: string;
104
- /** The primary key of the item to update */
105
- key: Record<string, unknown>;
106
- /** The update expression (SET, REMOVE, ADD, DELETE clauses) */
107
- updateExpression: string;
108
- /** Optional condition expression that must be satisfied */
109
- conditionExpression?: string;
110
- /** Map of expression attribute name placeholders to actual names */
111
- expressionAttributeNames?: Record<string, string>;
112
- /** Map of expression attribute value placeholders to actual values */
113
- expressionAttributeValues?: DynamoItem;
114
- /** Which item attributes to include in the response */
115
- returnValues?: "ALL_NEW" | "UPDATED_NEW" | "ALL_OLD" | "UPDATED_OLD" | "NONE";
116
- }
117
- interface ConditionCheckCommandParams extends DynamoCommandWithExpressions {
118
- tableName: string;
119
- key: Record<string, unknown>;
120
- conditionExpression: string;
121
- expressionAttributeNames?: Record<string, string>;
122
- expressionAttributeValues?: DynamoItem;
123
- }
124
- /**
125
- * Base interface for all builder classes that support pagination
126
- * to be used by Paginator without creating circular dependencies.
127
- */
128
- interface BaseBuilderInterface<T extends DynamoItem, TConfig extends TableConfig = TableConfig, B = unknown> {
129
- clone(): B;
130
- limit(limit: number): B;
131
- getLimit(): number | undefined;
132
- startFrom(lastEvaluatedKey: DynamoItem): B;
133
- execute(): Promise<ResultIterator<T, TConfig>>;
134
- }
135
- /**
136
- * Interface for the QueryBuilder class to be used by Paginator
137
- * without creating a circular dependency.
138
- */
139
- interface QueryBuilderInterface<T extends DynamoItem, TConfig extends TableConfig = TableConfig> extends BaseBuilderInterface<T, TConfig, QueryBuilderInterface<T, TConfig>> {
140
- }
141
- /**
142
- * Interface for the ScanBuilder class to be used by Paginator
143
- * without creating a circular dependency.
144
- */
145
- interface ScanBuilderInterface<T extends DynamoItem, TConfig extends TableConfig = TableConfig> extends BaseBuilderInterface<T, TConfig, ScanBuilderInterface<T, TConfig>> {
146
- }
147
- /**
148
- * Interface for the FilterBuilder class to be used by Paginator
149
- * without creating a circular dependency.
150
- */
151
- interface FilterBuilderInterface<T extends DynamoItem, TConfig extends TableConfig = TableConfig> extends BaseBuilderInterface<T, TConfig, FilterBuilderInterface<T, TConfig>> {
152
- }
153
- /**
154
- * Represents the result of a single page query operation.
155
- * This interface provides all necessary information about the current page
156
- * and the availability of subsequent pages.
157
- */
158
- interface PaginationResult<T> {
159
- /** The items (dinosaurs, habitats, etc.) retrieved for the current page */
160
- items: T[];
161
- /** DynamoDB's last evaluated key, used internally for pagination */
162
- lastEvaluatedKey?: DynamoItem;
163
- /** Indicates whether there are more pages available */
164
- hasNextPage: boolean;
165
- /** The current page number (1-indexed) */
166
- page: number;
167
- }
168
-
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 };