@nr1e/aws 1.0.6 → 1.0.7

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 (97) hide show
  1. package/dist/{bedrock-runtime.d.mts → bedrock-runtime.d.ts} +1 -1
  2. package/dist/bedrock-runtime.d.ts.map +1 -0
  3. package/dist/{bedrock-runtime.mjs → bedrock-runtime.js} +2 -2
  4. package/dist/bedrock-runtime.js.map +1 -0
  5. package/dist/{dynamodb-stream.d.mts → dynamodb-stream.d.ts} +1 -1
  6. package/dist/dynamodb-stream.d.ts.map +1 -0
  7. package/dist/{dynamodb-stream.mjs → dynamodb-stream.js} +1 -1
  8. package/dist/dynamodb-stream.js.map +1 -0
  9. package/dist/dynamodb.d.ts +307 -0
  10. package/dist/dynamodb.d.ts.map +1 -0
  11. package/dist/dynamodb.js +603 -0
  12. package/dist/dynamodb.js.map +1 -0
  13. package/dist/empty.test.d.ts +2 -0
  14. package/dist/empty.test.d.ts.map +1 -0
  15. package/dist/{empty.test.mjs → empty.test.js} +1 -1
  16. package/dist/empty.test.js.map +1 -0
  17. package/dist/{event-bridge.d.mts → event-bridge.d.ts} +1 -1
  18. package/dist/event-bridge.d.ts.map +1 -0
  19. package/dist/{event-bridge.mjs → event-bridge.js} +1 -1
  20. package/dist/event-bridge.js.map +1 -0
  21. package/dist/{geo-places.d.mts → geo-places.d.ts} +1 -1
  22. package/dist/geo-places.d.ts.map +1 -0
  23. package/dist/{geo-places.mjs → geo-places.js} +2 -2
  24. package/dist/geo-places.js.map +1 -0
  25. package/dist/index.d.ts +13 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +13 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/{lambda.d.mts → lambda.d.ts} +1 -1
  30. package/dist/lambda.d.ts.map +1 -0
  31. package/dist/{lambda.mjs → lambda.js} +2 -2
  32. package/dist/lambda.js.map +1 -0
  33. package/dist/lambda.test.d.ts +2 -0
  34. package/dist/lambda.test.d.ts.map +1 -0
  35. package/dist/{lambda.test.mjs → lambda.test.js} +2 -2
  36. package/dist/lambda.test.js.map +1 -0
  37. package/dist/{region.d.mts → region.d.ts} +1 -1
  38. package/dist/region.d.ts.map +1 -0
  39. package/dist/{region.mjs → region.js} +1 -1
  40. package/dist/region.js.map +1 -0
  41. package/dist/{s3.d.mts → s3.d.ts} +1 -1
  42. package/dist/s3.d.ts.map +1 -0
  43. package/dist/{s3.mjs → s3.js} +1 -1
  44. package/dist/s3.js.map +1 -0
  45. package/dist/{secrets-manager.d.mts → secrets-manager.d.ts} +1 -1
  46. package/dist/secrets-manager.d.ts.map +1 -0
  47. package/dist/{secrets-manager.mjs → secrets-manager.js} +2 -2
  48. package/dist/secrets-manager.js.map +1 -0
  49. package/dist/{ses.d.mts → ses.d.ts} +1 -1
  50. package/dist/ses.d.ts.map +1 -0
  51. package/dist/{ses.mjs → ses.js} +1 -1
  52. package/dist/ses.js.map +1 -0
  53. package/dist/{sqs.d.mts → sqs.d.ts} +1 -1
  54. package/dist/sqs.d.ts.map +1 -0
  55. package/dist/{sqs.mjs → sqs.js} +1 -1
  56. package/dist/sqs.js.map +1 -0
  57. package/dist/{sts.d.mts → sts.d.ts} +1 -1
  58. package/dist/sts.d.ts.map +1 -0
  59. package/dist/{sts.mjs → sts.js} +2 -2
  60. package/dist/sts.js.map +1 -0
  61. package/package.json +5 -5
  62. package/dist/bedrock-runtime.d.mts.map +0 -1
  63. package/dist/bedrock-runtime.mjs.map +0 -1
  64. package/dist/dynamodb-stream.d.mts.map +0 -1
  65. package/dist/dynamodb-stream.mjs.map +0 -1
  66. package/dist/dynamodb.d.mts +0 -107
  67. package/dist/dynamodb.d.mts.map +0 -1
  68. package/dist/dynamodb.mjs +0 -302
  69. package/dist/dynamodb.mjs.map +0 -1
  70. package/dist/empty.test.d.mts +0 -2
  71. package/dist/empty.test.d.mts.map +0 -1
  72. package/dist/empty.test.mjs.map +0 -1
  73. package/dist/event-bridge.d.mts.map +0 -1
  74. package/dist/event-bridge.mjs.map +0 -1
  75. package/dist/geo-places.d.mts.map +0 -1
  76. package/dist/geo-places.mjs.map +0 -1
  77. package/dist/index.d.mts +0 -13
  78. package/dist/index.d.mts.map +0 -1
  79. package/dist/index.mjs +0 -13
  80. package/dist/index.mjs.map +0 -1
  81. package/dist/lambda.d.mts.map +0 -1
  82. package/dist/lambda.mjs.map +0 -1
  83. package/dist/lambda.test.d.mts +0 -2
  84. package/dist/lambda.test.d.mts.map +0 -1
  85. package/dist/lambda.test.mjs.map +0 -1
  86. package/dist/region.d.mts.map +0 -1
  87. package/dist/region.mjs.map +0 -1
  88. package/dist/s3.d.mts.map +0 -1
  89. package/dist/s3.mjs.map +0 -1
  90. package/dist/secrets-manager.d.mts.map +0 -1
  91. package/dist/secrets-manager.mjs.map +0 -1
  92. package/dist/ses.d.mts.map +0 -1
  93. package/dist/ses.mjs.map +0 -1
  94. package/dist/sqs.d.mts.map +0 -1
  95. package/dist/sqs.mjs.map +0 -1
  96. package/dist/sts.d.mts.map +0 -1
  97. package/dist/sts.mjs.map +0 -1
@@ -0,0 +1,603 @@
1
+ import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
2
+ import { DeleteCommand, DynamoDBDocumentClient, QueryCommand, ScanCommand, GetCommand, PutCommand, UpdateCommand, } from '@aws-sdk/lib-dynamodb';
3
+ import { getAwsRegion } from './region.js';
4
+ /**
5
+ * Re-exporting commands to be helpful so clients may not have to import the AWS SDK directly.
6
+ */
7
+ export { DynamoDBDocumentClient, DynamoDBClient, DeleteCommand, GetCommand, QueryCommand, ScanCommand, PutCommand, UpdateCommand, };
8
+ const dynamoDBClients = new Map();
9
+ const dynamoDBDocumentClients = new Map();
10
+ export function getDynamoDBClient(region) {
11
+ const regionKey = region || getAwsRegion();
12
+ let client = dynamoDBClients.get(regionKey);
13
+ if (!client) {
14
+ client = new DynamoDBClient({ region: regionKey });
15
+ dynamoDBClients.set(regionKey, client);
16
+ }
17
+ return client;
18
+ }
19
+ export function getDynamoDBDocumentClient(region) {
20
+ const regionKey = region || getAwsRegion();
21
+ let client = dynamoDBDocumentClients.get(regionKey);
22
+ if (!client) {
23
+ client = DynamoDBDocumentClient.from(getDynamoDBClient(regionKey), {
24
+ marshallOptions: {
25
+ removeUndefinedValues: true,
26
+ },
27
+ });
28
+ dynamoDBDocumentClients.set(regionKey, client);
29
+ }
30
+ return client;
31
+ }
32
+ function dedupe(arr) {
33
+ return Array.from(new Set(arr));
34
+ }
35
+ /**
36
+ * Builds a DynamoDB `ExclusiveStartKey` or `LastEvaluatedKey` object
37
+ * from a given item and a list of key attribute names.
38
+ *
39
+ * This is useful when performing paginated `Query` or `Scan` operations
40
+ * and you only have the last returned item from the previous page rather
41
+ * than the full `LastEvaluatedKey` returned by DynamoDB.
42
+ *
43
+ * The function copies the specified key attributes from the provided item
44
+ * into a new object suitable for use as `ExclusiveStartKey` in a
45
+ * subsequent query. For Global Secondary Index (GSI) queries, include
46
+ * both the table’s primary key attributes and the index’s key attributes.
47
+ *
48
+ * @param item - The DynamoDB item (from a previous page) to extract key values from.
49
+ * @param keyNames - The list of key attribute names that uniquely identify an item
50
+ * (e.g., `["Pk", "Sk"]` for a table, or
51
+ * `["Pk", "Sk", "Gs1Pk", "Gs1Sk"]` for a GSI).
52
+ * @returns A plain JavaScript object representing the `ExclusiveStartKey`.
53
+ *
54
+ * @throws {Error} If any specified key attribute is missing on the provided item.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const lastItem = { Pk: "User#123", Sk: "Order#456", Gs1Pk: "User#123", Gs1Sk: "Order#456" };
59
+ * const keyNames = ["Pk", "Sk", "Gs1Pk", "Gs1Sk"];
60
+ * const eks = makeExclusiveStartKeyFromItem(lastItem, keyNames);
61
+ *
62
+ * await ddbDoc.query({
63
+ * TableName: "MyTable",
64
+ * IndexName: "GSI1",
65
+ * Limit: 100,
66
+ * ExclusiveStartKey: eks,
67
+ * });
68
+ * ```
69
+ */
70
+ function makeExclusiveStartKeyFromItem(item, keyNames) {
71
+ if (item) {
72
+ const eks = {};
73
+ for (const name of dedupe(keyNames)) {
74
+ if (!(name in item)) {
75
+ throw new Error(`ExclusiveStartKey: item is missing key attribute "${name}"`);
76
+ }
77
+ eks[name] = item[name];
78
+ }
79
+ return eks;
80
+ }
81
+ return undefined;
82
+ }
83
+ function encodeCursor(cursor) {
84
+ return Buffer.from(JSON.stringify(cursor)).toString('base64url');
85
+ }
86
+ function decodeCursor(encoded) {
87
+ if (encoded) {
88
+ return JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8'));
89
+ }
90
+ return undefined;
91
+ }
92
+ function getExclusiveStartKey(previous, direction) {
93
+ if (!direction) {
94
+ direction = 'next';
95
+ }
96
+ if (previous) {
97
+ if (previous.d === 'p' && previous.p === 1) {
98
+ return undefined;
99
+ }
100
+ if (previous.p === 1 && direction === 'prev') {
101
+ return undefined;
102
+ }
103
+ if (previous.d === 'n' && direction === 'next') {
104
+ // If trying to go next but there's no LastEvaluatedKey, we're past the last page
105
+ // Return the first key to query from there with ScanIndexForward=true
106
+ // This will return an empty result set instead of wrapping to page 1
107
+ if (previous.l === undefined) {
108
+ return previous.f;
109
+ }
110
+ return previous.l;
111
+ }
112
+ if (previous.d === 'n' && direction === 'prev') {
113
+ return previous.f;
114
+ }
115
+ if (previous.d === 'p' && direction === 'prev') {
116
+ return previous.l;
117
+ }
118
+ if (previous.d === 'p' && direction === 'next') {
119
+ return previous.f;
120
+ }
121
+ }
122
+ return undefined;
123
+ }
124
+ function getNextPage(previous, direction) {
125
+ if (previous) {
126
+ if (direction === 'next') {
127
+ return previous.p + 1;
128
+ }
129
+ if (direction === 'prev') {
130
+ return previous.p - 1;
131
+ }
132
+ }
133
+ return 1;
134
+ }
135
+ function encodeDirection(direction) {
136
+ if (direction === 'prev') {
137
+ return 'p';
138
+ }
139
+ return 'n';
140
+ }
141
+ function getDirection(previous, direction) {
142
+ if (direction === 'prev' && previous?.p === 1) {
143
+ return 'next';
144
+ }
145
+ if (direction === 'prev') {
146
+ return 'prev';
147
+ }
148
+ return 'next';
149
+ }
150
+ /**
151
+ * Executes a paginated DynamoDB query with full cursor-based pagination support.
152
+ *
153
+ * This helper encapsulates all pagination logic including:
154
+ * - Cursor encoding/decoding
155
+ * - ExclusiveStartKey calculation
156
+ * - Bidirectional pagination (next/prev)
157
+ * - First/last key tracking
158
+ * - Automatic item ordering
159
+ *
160
+ * @param params Configuration for the query and item mapping
161
+ * @param params.client DynamoDB Document Client instance
162
+ * @param params.query QueryCommand input (without ExclusiveStartKey, Limit, ScanIndexForward)
163
+ * @param params.keyAttributes Array of key attribute names for the table/index being queried
164
+ * @param params.mapItem Function to transform raw DynamoDB items into desired format
165
+ * @param pagination Pagination parameters from the client
166
+ * @param pagination.cursor Base64-encoded cursor from previous request
167
+ * @param pagination.direction Direction to paginate ('next' or 'prev')
168
+ * @param pagination.limit Number of items per page (locked after first request)
169
+ * @param defaultScanForward Controls the default scan direction. When true, 'next' scans forward (ascending) and 'prev' scans backward (descending). When false, the behavior is inverted.
170
+ * @returns Paginated result with items, cursor, hasNext flag, and page number
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * return executePaginatedQuery(
175
+ * {
176
+ * client: getDynamoDBDocumentClient(),
177
+ * query: {
178
+ * TableName: 'MyTable',
179
+ * IndexName: 'Gs1',
180
+ * KeyConditionExpression: 'Gs1Pk = :pk',
181
+ * ExpressionAttributeValues: { ':pk': 'Agency#123' },
182
+ * },
183
+ * keyAttributes: ['Pk', 'Sk', 'Gs1Pk', 'Gs1Sk'],
184
+ * mapItem: (item) => item.Detail,
185
+ * },
186
+ * { cursor: '...', direction: 'next', limit: 10 },
187
+ * true // defaultScanForward
188
+ * );
189
+ * ```
190
+ */
191
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
192
+ export async function executePaginatedQuery(params, pagination, defaultScanForward) {
193
+ const { client, query, keyAttributes, mapItem } = params;
194
+ // Decode cursor and calculate pagination parameters
195
+ const decodedCursor = decodeCursor(pagination?.cursor);
196
+ const limit = decodedCursor?.i ?? pagination?.limit ?? 25;
197
+ // Validate limit
198
+ if (limit <= 0) {
199
+ throw new Error('Pagination limit must be a positive number');
200
+ }
201
+ const exclusiveStartKey = getExclusiveStartKey(decodedCursor, pagination?.direction);
202
+ const direction = getDirection(decodedCursor, pagination?.direction);
203
+ // Execute query with calculated pagination parameters
204
+ const result = await client.send(new QueryCommand({
205
+ ...query,
206
+ Limit: limit,
207
+ ScanIndexForward: defaultScanForward
208
+ ? direction === 'next'
209
+ : direction === 'prev',
210
+ ExclusiveStartKey: exclusiveStartKey,
211
+ }));
212
+ // Build cursor for next request
213
+ const page = getNextPage(decodedCursor, direction);
214
+ const firstItem = result.Items?.[0];
215
+ const newCursor = {
216
+ l: result.LastEvaluatedKey,
217
+ f: makeExclusiveStartKeyFromItem(firstItem, keyAttributes),
218
+ p: page,
219
+ d: encodeDirection(direction),
220
+ i: limit,
221
+ };
222
+ // Map and order items
223
+ const items = (result.Items ?? []).map(mapItem);
224
+ return {
225
+ items: direction === 'next' ? items : items.reverse(),
226
+ cursor: encodeCursor(newCursor),
227
+ hasNext: !!result.LastEvaluatedKey,
228
+ page,
229
+ };
230
+ }
231
+ /**
232
+ * Executes a paginated DynamoDB scan with cursor-based pagination support.
233
+ *
234
+ * Similar to executePaginatedQuery but for Scan operations. Note that Scan operations
235
+ * are unordered by nature and do not support scan direction control (unlike Query operations).
236
+ * Scan operations only support forward pagination (no bidirectional navigation).
237
+ *
238
+ * @param params Configuration for the scan and item mapping
239
+ * @param params.client DynamoDB Document Client instance
240
+ * @param params.scan ScanCommand input (without ExclusiveStartKey or Limit)
241
+ * @param params.keyNames Array of key attribute names for the table
242
+ * @param params.mapItem Function to transform raw DynamoDB items into desired format
243
+ * @param pagination Pagination parameters from the client
244
+ * @param pagination.cursor Base64-encoded cursor from previous request
245
+ * @param pagination.limit Number of items per page (locked after first request)
246
+ * @returns Paginated result with items, cursor, hasNext flag, and page number
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * return executePaginatedScan(
251
+ * {
252
+ * client: getDynamoDBDocumentClient(),
253
+ * scan: {
254
+ * TableName: 'MyTable',
255
+ * FilterExpression: 'attribute_exists(#attr)',
256
+ * ExpressionAttributeNames: { '#attr': 'myAttribute' },
257
+ * },
258
+ * keyNames: ['Pk', 'Sk'],
259
+ * mapItem: (item) => item.Detail,
260
+ * },
261
+ * { cursor: '...', limit: 10 }
262
+ * );
263
+ * ```
264
+ */
265
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
+ export async function executePaginatedScan(params, pagination) {
267
+ const { client, scan, keyNames, mapItem } = params;
268
+ // Decode cursor and calculate pagination parameters
269
+ const decodedCursor = decodeCursor(pagination?.cursor);
270
+ const limit = decodedCursor?.i ?? pagination?.limit ?? 25;
271
+ // Validate limit
272
+ if (limit <= 0) {
273
+ throw new Error('Pagination limit must be a positive number');
274
+ }
275
+ // For scans, only forward pagination is supported
276
+ const exclusiveStartKey = decodedCursor?.l;
277
+ // Execute scan with calculated pagination parameters
278
+ const result = await client.send(new ScanCommand({
279
+ ...scan,
280
+ Limit: limit,
281
+ ExclusiveStartKey: exclusiveStartKey,
282
+ }));
283
+ // Build cursor for next request
284
+ const page = (decodedCursor?.p ?? 0) + 1;
285
+ const firstItem = result.Items?.[0];
286
+ const newCursor = {
287
+ l: result.LastEvaluatedKey,
288
+ f: makeExclusiveStartKeyFromItem(firstItem, keyNames),
289
+ p: page,
290
+ d: 'n', // Scans only support forward direction
291
+ i: limit,
292
+ };
293
+ // Map items
294
+ const items = (result.Items ?? []).map(mapItem);
295
+ return {
296
+ items,
297
+ cursor: encodeCursor(newCursor),
298
+ hasNext: !!result.LastEvaluatedKey,
299
+ page,
300
+ };
301
+ }
302
+ /**
303
+ * Builds a dynamic DynamoDB update expression from an input object.
304
+ * Only includes fields that are defined (not undefined) and not in the excluded list.
305
+ *
306
+ * @param input - The input object containing fields to update
307
+ * @param options - Configuration options
308
+ * @param options.excludedFields - Fields to exclude from the update expression (e.g., 'id', 'createdAt')
309
+ * @param options.prefix - Prefix for nested objects (e.g., 'Detail', 'Data'). Set to empty string for no prefix. Default: 'Detail'
310
+ * @returns Object containing UpdateExpression, ExpressionAttributeNames, and ExpressionAttributeValues
311
+ */
312
+ export function buildUpdateExpression(input, options = {}) {
313
+ const { excludedFields = [], prefix = 'Detail' } = options;
314
+ const updateExpression = [];
315
+ const expressionAttributeNames = {};
316
+ const expressionAttributeValues = {};
317
+ // Add prefix to attribute names if provided
318
+ const prefixKey = prefix ? `#${prefix.toLowerCase()}` : '';
319
+ if (prefix) {
320
+ expressionAttributeNames[prefixKey] = prefix;
321
+ }
322
+ // Build update expressions for all provided fields
323
+ for (const [key, value] of Object.entries(input)) {
324
+ if (!excludedFields.includes(key) && value !== undefined) {
325
+ const prefixPart = prefix ? `${prefixKey}.` : '';
326
+ updateExpression.push(`${prefixPart}#${key} = :${key}`);
327
+ expressionAttributeNames[`#${key}`] = key;
328
+ expressionAttributeValues[`:${key}`] = value;
329
+ }
330
+ }
331
+ return {
332
+ UpdateExpression: `SET ${updateExpression.join(', ')}`,
333
+ ExpressionAttributeNames: expressionAttributeNames,
334
+ ExpressionAttributeValues: expressionAttributeValues,
335
+ };
336
+ }
337
+ /**
338
+ * Executes a DynamoDB update operation that only succeeds if the item already exists.
339
+ *
340
+ * This function builds a dynamic update expression from the input object and applies
341
+ * an existence check condition. Unlike DynamoDB's default upsert behavior, this function
342
+ * will throw an error if you attempt to update a non-existent item.
343
+ *
344
+ * @template T - The type of the returned item or nested object
345
+ * @param input - Object containing the fields to update. Only defined values are included.
346
+ * @param tableName - The name of the DynamoDB table
347
+ * @param key - The primary key of the item to update (e.g., `{ Pk: 'User#123', Sk: 'Profile' }`)
348
+ * @param options - Configuration options
349
+ * @param options.client - Custom DynamoDB Document Client instance (defaults to singleton client)
350
+ * @param options.excludedFields - Fields to exclude from the update (e.g., `['id', 'createdAt']`)
351
+ * @param options.prefix - Prefix for nested object updates (default: 'Detail'). Set to empty string for no prefix.
352
+ * @returns The updated item or nested object (based on prefix setting)
353
+ *
354
+ * @throws {ConditionalCheckFailedException} When the item doesn't exist in the table
355
+ * @throws {Error} When the key object is empty
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * // Update a user profile (with default 'Detail' prefix)
360
+ * const updated = await executeUpdate<UserProfile>(
361
+ * { name: 'John Doe', email: 'john@example.com', updatedAt: new Date().toISOString() },
362
+ * 'MyTable',
363
+ * { Pk: 'User#123', Sk: 'Profile' }
364
+ * );
365
+ * // Returns: updated.name, updated.email, etc. from the Detail object
366
+ *
367
+ * // Update without prefix (top-level attributes)
368
+ * const updated = await executeUpdate<User>(
369
+ * { status: 'active', lastLogin: Date.now() },
370
+ * 'MyTable',
371
+ * { Pk: 'User#123', Sk: 'Metadata' },
372
+ * { prefix: '' }
373
+ * );
374
+ * // Returns: full item with top-level attributes
375
+ *
376
+ * // Exclude certain fields and add timestamp
377
+ * const updated = await executeUpdate<Product>(
378
+ * { ...productData, updatedAt: new Date().toISOString() },
379
+ * 'Products',
380
+ * { Pk: 'Product#456' },
381
+ * { excludedFields: ['id', 'createdAt'] }
382
+ * );
383
+ * ```
384
+ */
385
+ export async function executeUpdate(input, tableName, key, options = {}) {
386
+ const { UpdateExpression, ExpressionAttributeNames, ExpressionAttributeValues, } = buildUpdateExpression(input, {
387
+ excludedFields: options.excludedFields,
388
+ prefix: options.prefix,
389
+ });
390
+ // Get the first key attribute name to use for existence check
391
+ const firstKeyName = Object.keys(key)[0];
392
+ if (!firstKeyName) {
393
+ throw new Error('Key object must contain at least one attribute');
394
+ }
395
+ // Add the key attribute to ExpressionAttributeNames for the condition
396
+ const conditionKeyAlias = '#__existsKey';
397
+ ExpressionAttributeNames[conditionKeyAlias] = firstKeyName;
398
+ const dynamoDBDocumentClient = options.client ?? getDynamoDBDocumentClient();
399
+ const result = await dynamoDBDocumentClient.send(new UpdateCommand({
400
+ TableName: tableName,
401
+ Key: key,
402
+ UpdateExpression,
403
+ ExpressionAttributeNames,
404
+ ExpressionAttributeValues,
405
+ ConditionExpression: `attribute_exists(${conditionKeyAlias})`,
406
+ ReturnValues: 'ALL_NEW',
407
+ }));
408
+ if (!result.Attributes) {
409
+ throw new Error('Update failed: No attributes returned');
410
+ }
411
+ if (!options.prefix) {
412
+ return result.Attributes;
413
+ }
414
+ else {
415
+ return result.Attributes?.[options.prefix];
416
+ }
417
+ }
418
+ /**
419
+ * Executes a DynamoDB put operation to create or replace an item in the table.
420
+ *
421
+ * This function puts an entire item into DynamoDB. By default, it will NOT overwrite
422
+ * existing items (preventOverwrite is true by default). Set preventOverwrite to false
423
+ * if you want to allow replacing existing items.
424
+ *
425
+ * @template T - The type of the returned item
426
+ * @param item - The complete item to put into the table, including the primary key
427
+ * @param tableName - The name of the DynamoDB table
428
+ * @param key - The primary key of the item (e.g., `{ Pk: 'User#123', Sk: 'Profile' }`). Used for the preventOverwrite condition.
429
+ * @param options - Configuration options
430
+ * @param options.client - Custom DynamoDB Document Client instance (defaults to singleton client)
431
+ * @param options.preventOverwrite - If true, the put will fail if an item with the same key already exists (default: true)
432
+ * @param options.returnValues - Specify what values to return. 'NONE' (default) or 'ALL_OLD' to return the previous item
433
+ * @returns The item that was put (or the old item if returnValues is 'ALL_OLD')
434
+ *
435
+ * @throws {ConditionalCheckFailedException} When preventOverwrite is true and the item already exists
436
+ * @throws {Error} When the key object is empty
437
+ *
438
+ * @example
439
+ * ```typescript
440
+ * // Create a new user (will fail if already exists - default behavior)
441
+ * const user = await executePut<User>(
442
+ * {
443
+ * Pk: 'User#123',
444
+ * Sk: 'Profile',
445
+ * Detail: {
446
+ * name: 'John Doe',
447
+ * email: 'john@example.com',
448
+ * createdAt: new Date().toISOString()
449
+ * }
450
+ * },
451
+ * 'MyTable',
452
+ * { Pk: 'User#123', Sk: 'Profile' }
453
+ * );
454
+ * // Throws ConditionalCheckFailedException if User#123 already exists
455
+ *
456
+ * // Allow overwriting existing item
457
+ * const user = await executePut<User>(
458
+ * {
459
+ * Pk: 'User#456',
460
+ * Sk: 'Profile',
461
+ * Detail: { name: 'Jane Doe', email: 'jane@example.com' }
462
+ * },
463
+ * 'MyTable',
464
+ * { Pk: 'User#456', Sk: 'Profile' },
465
+ * { preventOverwrite: false }
466
+ * );
467
+ * // Will replace the item if User#456 already exists
468
+ *
469
+ * // Replace item and return the old version
470
+ * const oldUser = await executePut<User>(
471
+ * {
472
+ * Pk: 'User#789',
473
+ * Sk: 'Profile',
474
+ * Detail: { name: 'Updated Name', email: 'updated@example.com' }
475
+ * },
476
+ * 'MyTable',
477
+ * { Pk: 'User#789', Sk: 'Profile' },
478
+ * { preventOverwrite: false, returnValues: 'ALL_OLD' }
479
+ * );
480
+ * // Returns the previous item data
481
+ * ```
482
+ */
483
+ export async function executePut(item, tableName, key, options = {}) {
484
+ const { client, preventOverwrite = true, returnValues = 'NONE' } = options;
485
+ const dynamoDBDocumentClient = client ?? getDynamoDBDocumentClient();
486
+ const putCommandInput = {
487
+ TableName: tableName,
488
+ Item: item,
489
+ ReturnValues: returnValues,
490
+ };
491
+ // Add condition to prevent overwriting existing items if requested
492
+ if (preventOverwrite) {
493
+ const keyNames = Object.keys(key);
494
+ if (keyNames.length === 0) {
495
+ throw new Error('Key object must contain at least one attribute');
496
+ }
497
+ // Build condition expression checking that ALL key attributes don't exist
498
+ const keyConditions = keyNames.map((k) => `attribute_not_exists(${k})`);
499
+ putCommandInput.ConditionExpression = keyConditions.join(' AND ');
500
+ }
501
+ const result = await dynamoDBDocumentClient.send(new PutCommand(putCommandInput));
502
+ // Return the old item if ALL_OLD was requested, otherwise return the item that was put
503
+ if (returnValues === 'ALL_OLD') {
504
+ return result.Attributes;
505
+ }
506
+ return item;
507
+ }
508
+ /**
509
+ * Executes a DynamoDB delete operation to remove an item from the table.
510
+ *
511
+ * @param tableName - The name of the DynamoDB table
512
+ * @param key - The primary key of the item to delete (e.g., `{ Pk: 'User#123', Sk: 'Profile' }`)
513
+ * @param options - Configuration options
514
+ * @param options.client - Custom DynamoDB Document Client instance (defaults to singleton client)
515
+ *
516
+ * @example
517
+ * ```typescript
518
+ * await executeDelete('MyTable', { Pk: 'User#123', Sk: 'Profile' });
519
+ * ```
520
+ */
521
+ export async function executeDelete(tableName, key, options = {}) {
522
+ const dynamoDBDocumentClient = options.client ?? getDynamoDBDocumentClient();
523
+ await dynamoDBDocumentClient.send(new DeleteCommand({
524
+ TableName: tableName,
525
+ Key: key,
526
+ }));
527
+ }
528
+ /**
529
+ * Executes a DynamoDB get operation to retrieve an item from the table.
530
+ *
531
+ * @template T - The type of the returned item
532
+ * @param tableName - The name of the DynamoDB table
533
+ * @param key - The primary key of the item to retrieve (e.g., `{ Pk: 'User#123', Sk: 'Profile' }`)
534
+ * @param options - Configuration options
535
+ * @param options.client - Custom DynamoDB Document Client instance (defaults to singleton client)
536
+ * @returns The item if found, or null if not found
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * const user = await executeGet<User>('MyTable', { Pk: 'User#123', Sk: 'Profile' });
541
+ * ```
542
+ */
543
+ export async function executeGet(tableName, key, options = {}) {
544
+ const dynamoDBDocumentClient = options.client ?? getDynamoDBDocumentClient();
545
+ const result = await dynamoDBDocumentClient.send(new GetCommand({
546
+ TableName: tableName,
547
+ Key: key,
548
+ }));
549
+ const item = result.Item;
550
+ if (options.prefix) {
551
+ return item?.[options.prefix] ?? null;
552
+ }
553
+ if (options.prefix === null) {
554
+ return item ?? null;
555
+ }
556
+ return item?.Detail ?? null;
557
+ }
558
+ /**
559
+ * Executes a DynamoDB query on a secondary index and returns the first matching item.
560
+ *
561
+ * @template T - The type of the returned item
562
+ * @param tableName - The name of the DynamoDB table
563
+ * @param indexName - The name of the secondary index to query
564
+ * @param key - The key attributes to query (e.g., `{ Gs1Pk: 'User#123' }` or `{ Gs1Pk: 'User#123', Gs1Sk: 'Profile' }`)
565
+ * @param options - Configuration options
566
+ * @param options.client - Custom DynamoDB Document Client instance (defaults to singleton client)
567
+ * @returns The first matching item if found, or null if not found
568
+ *
569
+ * @example
570
+ * ```typescript
571
+ * // Query with just partition key
572
+ * const user = await executeGetFromIndex<User>('MyTable', 'Gs1', { Gs1Pk: 'User#123' });
573
+ *
574
+ * // Query with partition and sort key
575
+ * const user = await executeGetFromIndex<User>('MyTable', 'Gs1', { Gs1Pk: 'User#123', Gs1Sk: 'Profile' });
576
+ * ```
577
+ */
578
+ export async function executeGetFromIndex(tableName, indexName, key, options = {}) {
579
+ const dynamoDBDocumentClient = options.client ?? getDynamoDBDocumentClient();
580
+ // Build KeyConditionExpression and ExpressionAttributeValues from key object
581
+ const keyConditions = [];
582
+ const expressionAttributeValues = {};
583
+ for (const [keyName, value] of Object.entries(key)) {
584
+ keyConditions.push(`${keyName} = :${keyName}`);
585
+ expressionAttributeValues[`:${keyName}`] = value;
586
+ }
587
+ const result = await dynamoDBDocumentClient.send(new QueryCommand({
588
+ TableName: tableName,
589
+ IndexName: indexName,
590
+ KeyConditionExpression: keyConditions.join(' AND '),
591
+ ExpressionAttributeValues: expressionAttributeValues,
592
+ Limit: 1,
593
+ }));
594
+ const item = result.Items?.[0];
595
+ if (options.prefix) {
596
+ return item?.[options.prefix] ?? null;
597
+ }
598
+ if (options.prefix === null) {
599
+ return item ?? null;
600
+ }
601
+ return item?.Detail ?? null;
602
+ }
603
+ //# sourceMappingURL=dynamodb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../src/dynamodb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,aAAa,EAGb,sBAAsB,EACtB,YAAY,EAGZ,WAAW,EAGX,UAAU,EAGV,UAAU,EAGV,aAAa,GAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,aAAa,EAGb,UAAU,EAGV,YAAY,EAGZ,WAAW,EAGX,UAAU,EAGV,aAA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C;KACT,CAAC,CACH,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAQ,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAO,IAAI,IAAI,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC5B,OAAQ,IAAU,IAAI,IAAI,CAAC;IAC7B,CAAC;IACD,OAAQ,IAAI,EAAE,MAAY,IAAI,IAAI,CAAC;AACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=empty.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.test.d.ts","sourceRoot":"","sources":["../src/empty.test.ts"],"names":[],"mappings":""}
@@ -2,4 +2,4 @@ import { test, expect } from 'vitest';
2
2
  test('Empty test @unit', () => {
3
3
  expect(true).toBe(true);
4
4
  });
5
- //# sourceMappingURL=empty.test.mjs.map
5
+ //# sourceMappingURL=empty.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.test.js","sourceRoot":"","sources":["../src/empty.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,QAAQ,CAAC;AAEpC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC5B,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -11,4 +11,4 @@ export interface EventBridgeEvent {
11
11
  detail: unknown;
12
12
  }
13
13
  export declare function sendEvents(eventBusName: string, events: EventBridgeEvent[], region?: string): Promise<PutEventsCommandOutput>;
14
- //# sourceMappingURL=event-bridge.d.mts.map
14
+ //# sourceMappingURL=event-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bridge.d.ts","sourceRoot":"","sources":["../src/event-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,OAAO,EAAC,gBAAgB,EAAE,qBAAqB,EAAE,sBAAsB,EAAC,CAAC;AAIzE,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIvE;AAED,wBAAsB,SAAS,CAC7B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,MAAM,mCAchB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,UAAU,CAC9B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,gBAAgB,EAAE,EAC1B,MAAM,CAAC,EAAE,MAAM,mCAYhB"}
@@ -36,4 +36,4 @@ export async function sendEvents(eventBusName, events, region) {
36
36
  });
37
37
  return await client.send(command);
38
38
  }
39
- //# sourceMappingURL=event-bridge.mjs.map
39
+ //# sourceMappingURL=event-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bridge.js","sourceRoot":"","sources":["../src/event-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,OAAO,EAAC,gBAAgB,EAAgD,CAAC;AAEzE,IAAI,iBAAiB,GAAkC,SAAS,CAAC;AAEjE,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAClD,IAAI,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAChD,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;IACpD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,YAAoB,EACpB,MAAc,EACd,UAAkB,EAClB,MAAe,EACf,MAAe;IAEf,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC;QACnC,OAAO,EAAE;YACP;gBACE,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,UAAU;gBACtB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;gBAC9B,YAAY,EAAE,YAAY;aAC3B;SACF;KACF,CAAC,CAAC;IACH,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAQD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,YAAoB,EACpB,MAA0B,EAC1B,MAAe;IAEf,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC;QACnC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;YACpC,YAAY,EAAE,YAAY;SAC3B,CAAC,CAAC;KACJ,CAAC,CAAC;IACH,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
@@ -46,4 +46,4 @@ export declare function autocompleteAddress(address: string, biasPosition?: [num
46
46
  * @param client - The client to use for the request. One will be created if not provided.
47
47
  */
48
48
  export declare function suggestLocation(address: string, biasPosition?: [number, number], client?: GeoPlacesClient): Promise<SuggestCommandOutput>;
49
- //# sourceMappingURL=geo-places.d.mts.map
49
+ //# sourceMappingURL=geo-places.d.ts.map