@aligent/aws-wrappers 0.3.0 → 0.4.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.
package/esm/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
+ "engines": {
6
+ "node": ">=18"
7
+ },
5
8
  "main": "./cjs/index.cjs",
6
9
  "module": "./index.esm.js",
7
10
  "types": "./cjs/src/index.d.ts",
@@ -119,11 +119,38 @@ export declare class DynamoDBService {
119
119
  batchWrite(input: BatchWriteCommandInput): Promise<BatchWriteCommandOutput>;
120
120
  /**
121
121
  * Paginate over Query results, yielding one unmarshalled item at a time.
122
+ *
123
+ * **`Limit` is a page size, not a total cap.** DynamoDB applies it per
124
+ * request, and this method walks every page until `LastEvaluatedKey` is
125
+ * exhausted — so `paginateItems({ Limit: 10 })` yields *every* matching
126
+ * item, in pages of 10, not the first 10 items.
127
+ *
128
+ * To bound the number of items, `break` out of the loop. This is an
129
+ * `AsyncGenerator`, so `break` calls its `return()`, which unwinds the
130
+ * pagination and issues no further requests:
131
+ *
132
+ * ```ts
133
+ * const firstTen: Item[] = [];
134
+ * for await (const item of ddb.paginateItems<Item>(input)) {
135
+ * firstTen.push(item);
136
+ * if (firstTen.length === 10) break;
137
+ * }
138
+ * ```
139
+ *
140
+ * `Limit` remains the right knob for tuning per-request consumed capacity
141
+ * and page memory — set it deliberately, just don't expect it to stop the
142
+ * walk.
143
+ *
122
144
  * @template T - Expected shape of each yielded item.
123
145
  */
124
146
  paginateItems<T extends Record<string, unknown> = Record<string, unknown>>(input: QueryCommandInput): AsyncGenerator<T>;
125
147
  /**
126
148
  * Paginate over Scan results, yielding one unmarshalled item at a time.
149
+ *
150
+ * **`Limit` is a page size, not a total cap** — see `paginateItems` for the
151
+ * detail. `break` out of the loop to bound the number of items; `Limit`
152
+ * stays the right knob for per-request consumed capacity and page memory.
153
+ *
127
154
  * @template T - Expected shape of each yielded item.
128
155
  */
129
156
  paginateScan<T extends Record<string, unknown> = Record<string, unknown>>(input: ScanCommandInput): AsyncGenerator<T>;
@@ -125,10 +125,21 @@ export declare class S3Service {
125
125
  */
126
126
  deleteObjects(bucket: string, keys: string[]): Promise<DeleteObjectsCommandOutput[]>;
127
127
  /**
128
- * Delete every object in a bucket. Streams the listing page-by-page and
129
- * delegates each page's deletion to `deleteObjects`, so peak memory stays
130
- * bounded by one page (~1000 keys) regardless of bucket size.
131
- * @returns The keys of every deleted object.
128
+ * Delete every object in an **unversioned** bucket. Streams the listing
129
+ * page-by-page and delegates each page's deletion to `deleteObjects`, so
130
+ * peak memory stays bounded by one page (~1000 keys) regardless of bucket
131
+ * size.
132
+ *
133
+ * **Versioned buckets are out of scope.** This paginates `ListObjectsV2`,
134
+ * which reports only current object versions — never noncurrent versions or
135
+ * delete markers. Against a versioned bucket the call therefore succeeds and
136
+ * the bucket then *looks* empty to `ListObjectsV2`, but the deletes only
137
+ * added delete markers: every object version is still stored, still billed,
138
+ * and `DeleteBucket` will still fail with `BucketNotEmpty`. Emptying a
139
+ * versioned bucket requires `ListObjectVersions` and per-version deletes;
140
+ * use `S3Client` directly for that.
141
+ *
142
+ * @returns The keys this call issued deletes for.
132
143
  */
133
144
  emptyBucket(bucket: string): Promise<string[]>;
134
145
  }
@@ -39,6 +39,13 @@ export declare class SNSService {
39
39
  publish(input: PublishCommandInput, opts?: {
40
40
  truncate?: boolean;
41
41
  }): Promise<PublishCommandOutput>;
42
+ /**
43
+ * The truncation helpers return the input unchanged when it already fits, so
44
+ * a `!==` comparison against their result is what decides whether a field
45
+ * was modified. Don't reintroduce a size guard here: that would state each
46
+ * limit twice, encode the string to a `Buffer` twice, and let the two
47
+ * expressions drift into warning without truncating (or the reverse).
48
+ */
42
49
  private applyTruncation;
43
50
  /**
44
51
  * Publish a batch of messages to an SNS topic. The SNS API caps
@@ -36,6 +36,13 @@ export declare class SQSService {
36
36
  sendMessage(input: SendMessageCommandInput, opts?: {
37
37
  truncate?: boolean;
38
38
  }): Promise<SendMessageCommandOutput>;
39
+ /**
40
+ * `truncateUtf8` returns the input unchanged when it already fits, so a
41
+ * `!==` comparison against its result is what decides whether the body was
42
+ * modified. Don't reintroduce a size guard here: that would state the limit
43
+ * twice, encode the string to a `Buffer` twice, and let the two expressions
44
+ * drift into warning without truncating (or the reverse).
45
+ */
39
46
  private applyTruncation;
40
47
  /**
41
48
  * Receive messages from an SQS queue. Returns an empty array when no
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
+ "engines": {
6
+ "node": ">=18"
7
+ },
5
8
  "main": "./cjs/index.cjs",
6
9
  "module": "./esm/index.mjs",
7
10
  "types": "./cjs/src/index.d.ts",