@aligent/aws-wrappers 0.0.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.
- package/CLAUDE.md +172 -0
- package/README.md +286 -0
- package/docs/classes/DynamoDBService.md +353 -0
- package/docs/classes/S3Service.md +389 -0
- package/docs/classes/SNSService.md +95 -0
- package/docs/classes/SQSService.md +162 -0
- package/docs/classes/SSMService.md +157 -0
- package/docs/classes/SecretsManagerService.md +114 -0
- package/docs/classes/StepFunctionsService.md +134 -0
- package/docs/modules.md +15 -0
- package/package.json +32 -0
- package/src/dynamodb/dynamodb.d.ts +127 -0
- package/src/dynamodb/dynamodb.js +308 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +17 -0
- package/src/s3/s3.d.ts +131 -0
- package/src/s3/s3.js +244 -0
- package/src/secrets-manager/secrets-manager.d.ts +78 -0
- package/src/secrets-manager/secrets-manager.js +152 -0
- package/src/sfn/sfn.d.ts +38 -0
- package/src/sfn/sfn.js +74 -0
- package/src/sns/sns.d.ts +48 -0
- package/src/sns/sns.js +110 -0
- package/src/sqs/sqs.d.ts +60 -0
- package/src/sqs/sqs.js +134 -0
- package/src/ssm/ssm.d.ts +84 -0
- package/src/ssm/ssm.js +144 -0
- package/src/util/redact.d.ts +18 -0
- package/src/util/redact.js +29 -0
- package/src/util/truncate.d.ts +15 -0
- package/src/util/truncate.js +36 -0
- package/tsconfig.lib.tsbuildinfo +1 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
[**@aligent/aws-wrappers**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/aws-wrappers](../modules.md) / S3Service
|
|
6
|
+
|
|
7
|
+
# Class: S3Service
|
|
8
|
+
|
|
9
|
+
Defined in: [s3/s3.ts:35](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L35)
|
|
10
|
+
|
|
11
|
+
Wrapper around the AWS S3 client providing structured Powertools logging
|
|
12
|
+
and X-Ray tracing by default.
|
|
13
|
+
|
|
14
|
+
Input shapes are intentionally tight (Bucket/Key/Body only). Callers
|
|
15
|
+
needing SDK-level options not exposed here (server-side encryption,
|
|
16
|
+
tagging, version IDs) should use `S3Client` directly.
|
|
17
|
+
|
|
18
|
+
## Constructors
|
|
19
|
+
|
|
20
|
+
<a id="constructor"></a>
|
|
21
|
+
|
|
22
|
+
### Constructor
|
|
23
|
+
|
|
24
|
+
> **new S3Service**(`opts?`): `S3Service`
|
|
25
|
+
|
|
26
|
+
Defined in: [s3/s3.ts:45](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L45)
|
|
27
|
+
|
|
28
|
+
#### Parameters
|
|
29
|
+
|
|
30
|
+
##### opts?
|
|
31
|
+
|
|
32
|
+
###### client?
|
|
33
|
+
|
|
34
|
+
`S3Client`
|
|
35
|
+
|
|
36
|
+
Optional pre-configured `S3Client`. When supplied,
|
|
37
|
+
the wrapper does not apply X-Ray instrumentation.
|
|
38
|
+
|
|
39
|
+
###### logger?
|
|
40
|
+
|
|
41
|
+
`Logger`
|
|
42
|
+
|
|
43
|
+
Optional Powertools logger. Defaults to a logger with
|
|
44
|
+
`serviceName: 'S3Service'`.
|
|
45
|
+
|
|
46
|
+
#### Returns
|
|
47
|
+
|
|
48
|
+
`S3Service`
|
|
49
|
+
|
|
50
|
+
## Methods
|
|
51
|
+
|
|
52
|
+
<a id="copyobject"></a>
|
|
53
|
+
|
|
54
|
+
### copyObject()
|
|
55
|
+
|
|
56
|
+
> **copyObject**(`input`): `Promise`\<`CopyObjectCommandOutput`\>
|
|
57
|
+
|
|
58
|
+
Defined in: [s3/s3.ts:145](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L145)
|
|
59
|
+
|
|
60
|
+
Copy an object within S3.
|
|
61
|
+
|
|
62
|
+
#### Parameters
|
|
63
|
+
|
|
64
|
+
##### input
|
|
65
|
+
|
|
66
|
+
`Required`\<`Pick`\<`CopyObjectCommandInput`, `"Bucket"` \| `"Key"` \| `"CopySource"`\>\>
|
|
67
|
+
|
|
68
|
+
#### Returns
|
|
69
|
+
|
|
70
|
+
`Promise`\<`CopyObjectCommandOutput`\>
|
|
71
|
+
|
|
72
|
+
***
|
|
73
|
+
|
|
74
|
+
<a id="deleteobject"></a>
|
|
75
|
+
|
|
76
|
+
### deleteObject()
|
|
77
|
+
|
|
78
|
+
> **deleteObject**(`input`): `Promise`\<`DeleteObjectCommandOutput`\>
|
|
79
|
+
|
|
80
|
+
Defined in: [s3/s3.ts:199](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L199)
|
|
81
|
+
|
|
82
|
+
Delete a single object from S3.
|
|
83
|
+
|
|
84
|
+
#### Parameters
|
|
85
|
+
|
|
86
|
+
##### input
|
|
87
|
+
|
|
88
|
+
`Required`\<`Pick`\<`DeleteObjectCommandInput`, `"Bucket"` \| `"Key"`\>\>
|
|
89
|
+
|
|
90
|
+
#### Returns
|
|
91
|
+
|
|
92
|
+
`Promise`\<`DeleteObjectCommandOutput`\>
|
|
93
|
+
|
|
94
|
+
***
|
|
95
|
+
|
|
96
|
+
<a id="deleteobjects"></a>
|
|
97
|
+
|
|
98
|
+
### deleteObjects()
|
|
99
|
+
|
|
100
|
+
> **deleteObjects**(`bucket`, `keys`): `Promise`\<`DeleteObjectsCommandOutput`[]\>
|
|
101
|
+
|
|
102
|
+
Defined in: [s3/s3.ts:211](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L211)
|
|
103
|
+
|
|
104
|
+
Delete multiple objects from S3, auto-chunking the request into batches
|
|
105
|
+
of 1000 keys (the S3-enforced DeleteObjects limit). Returns one output
|
|
106
|
+
per chunk.
|
|
107
|
+
|
|
108
|
+
#### Parameters
|
|
109
|
+
|
|
110
|
+
##### bucket
|
|
111
|
+
|
|
112
|
+
`string`
|
|
113
|
+
|
|
114
|
+
##### keys
|
|
115
|
+
|
|
116
|
+
`string`[]
|
|
117
|
+
|
|
118
|
+
#### Returns
|
|
119
|
+
|
|
120
|
+
`Promise`\<`DeleteObjectsCommandOutput`[]\>
|
|
121
|
+
|
|
122
|
+
***
|
|
123
|
+
|
|
124
|
+
<a id="emptybucket"></a>
|
|
125
|
+
|
|
126
|
+
### emptyBucket()
|
|
127
|
+
|
|
128
|
+
> **emptyBucket**(`bucket`): `Promise`\<`string`[]\>
|
|
129
|
+
|
|
130
|
+
Defined in: [s3/s3.ts:234](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L234)
|
|
131
|
+
|
|
132
|
+
Delete every object in a bucket. Streams the listing page-by-page and
|
|
133
|
+
delegates each page's deletion to `deleteObjects`, so peak memory stays
|
|
134
|
+
bounded by one page (~1000 keys) regardless of bucket size.
|
|
135
|
+
|
|
136
|
+
#### Parameters
|
|
137
|
+
|
|
138
|
+
##### bucket
|
|
139
|
+
|
|
140
|
+
`string`
|
|
141
|
+
|
|
142
|
+
#### Returns
|
|
143
|
+
|
|
144
|
+
`Promise`\<`string`[]\>
|
|
145
|
+
|
|
146
|
+
The keys of every deleted object.
|
|
147
|
+
|
|
148
|
+
***
|
|
149
|
+
|
|
150
|
+
<a id="getallobjects"></a>
|
|
151
|
+
|
|
152
|
+
### getAllObjects()
|
|
153
|
+
|
|
154
|
+
> **getAllObjects**\<`T`\>(`bucket`, `prefix?`): `Promise`\<`T`[]\>
|
|
155
|
+
|
|
156
|
+
Defined in: [s3/s3.ts:176](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L176)
|
|
157
|
+
|
|
158
|
+
List and JSON-parse every object under a bucket and optional prefix.
|
|
159
|
+
Auto-paginated. Objects without a body are skipped.
|
|
160
|
+
|
|
161
|
+
#### Type Parameters
|
|
162
|
+
|
|
163
|
+
##### T
|
|
164
|
+
|
|
165
|
+
`T`
|
|
166
|
+
|
|
167
|
+
Expected type of each parsed object.
|
|
168
|
+
|
|
169
|
+
#### Parameters
|
|
170
|
+
|
|
171
|
+
##### bucket
|
|
172
|
+
|
|
173
|
+
`string`
|
|
174
|
+
|
|
175
|
+
##### prefix?
|
|
176
|
+
|
|
177
|
+
`string`
|
|
178
|
+
|
|
179
|
+
#### Returns
|
|
180
|
+
|
|
181
|
+
`Promise`\<`T`[]\>
|
|
182
|
+
|
|
183
|
+
***
|
|
184
|
+
|
|
185
|
+
<a id="getjsonobject"></a>
|
|
186
|
+
|
|
187
|
+
### getJsonObject()
|
|
188
|
+
|
|
189
|
+
> **getJsonObject**\<`T`\>(`input`): `Promise`\<`T` \| `undefined`\>
|
|
190
|
+
|
|
191
|
+
Defined in: [s3/s3.ts:123](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L123)
|
|
192
|
+
|
|
193
|
+
Get an object from S3 and parse it as JSON.
|
|
194
|
+
|
|
195
|
+
#### Type Parameters
|
|
196
|
+
|
|
197
|
+
##### T
|
|
198
|
+
|
|
199
|
+
`T`
|
|
200
|
+
|
|
201
|
+
Expected type of the parsed value.
|
|
202
|
+
|
|
203
|
+
#### Parameters
|
|
204
|
+
|
|
205
|
+
##### input
|
|
206
|
+
|
|
207
|
+
`Required`\<`Pick`\<`GetObjectCommandInput`, `"Bucket"` \| `"Key"`\>\>
|
|
208
|
+
|
|
209
|
+
#### Returns
|
|
210
|
+
|
|
211
|
+
`Promise`\<`T` \| `undefined`\>
|
|
212
|
+
|
|
213
|
+
The parsed value, or `undefined` if the response has no body.
|
|
214
|
+
|
|
215
|
+
#### Throws
|
|
216
|
+
|
|
217
|
+
If the body is non-empty and not valid JSON.
|
|
218
|
+
|
|
219
|
+
***
|
|
220
|
+
|
|
221
|
+
<a id="getobject"></a>
|
|
222
|
+
|
|
223
|
+
### getObject()
|
|
224
|
+
|
|
225
|
+
> **getObject**(`input`): `Promise`\<`GetObjectCommandOutput`\>
|
|
226
|
+
|
|
227
|
+
Defined in: [s3/s3.ts:97](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L97)
|
|
228
|
+
|
|
229
|
+
Get an object from S3.
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
##### input
|
|
234
|
+
|
|
235
|
+
`Required`\<`Pick`\<`GetObjectCommandInput`, `"Bucket"` \| `"Key"`\>\>
|
|
236
|
+
|
|
237
|
+
#### Returns
|
|
238
|
+
|
|
239
|
+
`Promise`\<`GetObjectCommandOutput`\>
|
|
240
|
+
|
|
241
|
+
***
|
|
242
|
+
|
|
243
|
+
<a id="getobjectbody"></a>
|
|
244
|
+
|
|
245
|
+
### getObjectBody()
|
|
246
|
+
|
|
247
|
+
> **getObjectBody**(`input`): `Promise`\<`string` \| `undefined`\>
|
|
248
|
+
|
|
249
|
+
Defined in: [s3/s3.ts:109](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L109)
|
|
250
|
+
|
|
251
|
+
Get an object from S3 and return its body as a string.
|
|
252
|
+
|
|
253
|
+
#### Parameters
|
|
254
|
+
|
|
255
|
+
##### input
|
|
256
|
+
|
|
257
|
+
`Required`\<`Pick`\<`GetObjectCommandInput`, `"Bucket"` \| `"Key"`\>\>
|
|
258
|
+
|
|
259
|
+
#### Returns
|
|
260
|
+
|
|
261
|
+
`Promise`\<`string` \| `undefined`\>
|
|
262
|
+
|
|
263
|
+
The object body as a string, or `undefined` if the response
|
|
264
|
+
has no body.
|
|
265
|
+
|
|
266
|
+
***
|
|
267
|
+
|
|
268
|
+
<a id="headobject"></a>
|
|
269
|
+
|
|
270
|
+
### headObject()
|
|
271
|
+
|
|
272
|
+
> **headObject**(`input`): `Promise`\<`HeadObjectCommandOutput`\>
|
|
273
|
+
|
|
274
|
+
Defined in: [s3/s3.ts:135](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L135)
|
|
275
|
+
|
|
276
|
+
Fetch the metadata for an S3 object without downloading its body.
|
|
277
|
+
|
|
278
|
+
#### Parameters
|
|
279
|
+
|
|
280
|
+
##### input
|
|
281
|
+
|
|
282
|
+
`Required`\<`Pick`\<`HeadObjectCommandInput`, `"Bucket"` \| `"Key"`\>\>
|
|
283
|
+
|
|
284
|
+
#### Returns
|
|
285
|
+
|
|
286
|
+
`Promise`\<`HeadObjectCommandOutput`\>
|
|
287
|
+
|
|
288
|
+
***
|
|
289
|
+
|
|
290
|
+
<a id="listobjects"></a>
|
|
291
|
+
|
|
292
|
+
### listObjects()
|
|
293
|
+
|
|
294
|
+
> **listObjects**(`bucket`, `prefix?`): `Promise`\<`string`[]\>
|
|
295
|
+
|
|
296
|
+
Defined in: [s3/s3.ts:156](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L156)
|
|
297
|
+
|
|
298
|
+
List object keys under a bucket and optional prefix, auto-paginating
|
|
299
|
+
across all pages.
|
|
300
|
+
|
|
301
|
+
#### Parameters
|
|
302
|
+
|
|
303
|
+
##### bucket
|
|
304
|
+
|
|
305
|
+
`string`
|
|
306
|
+
|
|
307
|
+
##### prefix?
|
|
308
|
+
|
|
309
|
+
`string`
|
|
310
|
+
|
|
311
|
+
#### Returns
|
|
312
|
+
|
|
313
|
+
`Promise`\<`string`[]\>
|
|
314
|
+
|
|
315
|
+
***
|
|
316
|
+
|
|
317
|
+
<a id="putjsonobject"></a>
|
|
318
|
+
|
|
319
|
+
### putJsonObject()
|
|
320
|
+
|
|
321
|
+
> **putJsonObject**\<`T`\>(`input`): `Promise`\<`PutObjectCommandOutput`\>
|
|
322
|
+
|
|
323
|
+
Defined in: [s3/s3.ts:75](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L75)
|
|
324
|
+
|
|
325
|
+
Serialise a value to JSON and store it as an S3 object.
|
|
326
|
+
|
|
327
|
+
Note: the structured log line only includes `Bucket` and `Key` —
|
|
328
|
+
the JSON-encoded body is omitted to avoid spilling potentially
|
|
329
|
+
large or sensitive content into CloudWatch.
|
|
330
|
+
|
|
331
|
+
#### Type Parameters
|
|
332
|
+
|
|
333
|
+
##### T
|
|
334
|
+
|
|
335
|
+
`T`
|
|
336
|
+
|
|
337
|
+
Type of the value being stored.
|
|
338
|
+
|
|
339
|
+
#### Parameters
|
|
340
|
+
|
|
341
|
+
##### input
|
|
342
|
+
|
|
343
|
+
###### Body
|
|
344
|
+
|
|
345
|
+
`T`
|
|
346
|
+
|
|
347
|
+
###### Bucket
|
|
348
|
+
|
|
349
|
+
`string`
|
|
350
|
+
|
|
351
|
+
###### Key
|
|
352
|
+
|
|
353
|
+
`string`
|
|
354
|
+
|
|
355
|
+
###### Metadata?
|
|
356
|
+
|
|
357
|
+
`Record`\<`string`, `string`\>
|
|
358
|
+
|
|
359
|
+
#### Returns
|
|
360
|
+
|
|
361
|
+
`Promise`\<`PutObjectCommandOutput`\>
|
|
362
|
+
|
|
363
|
+
***
|
|
364
|
+
|
|
365
|
+
<a id="putobject"></a>
|
|
366
|
+
|
|
367
|
+
### putObject()
|
|
368
|
+
|
|
369
|
+
> **putObject**(`input`): `Promise`\<`PutObjectCommandOutput`\>
|
|
370
|
+
|
|
371
|
+
Defined in: [s3/s3.ts:59](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/s3/s3.ts#L59)
|
|
372
|
+
|
|
373
|
+
Put an object into S3.
|
|
374
|
+
|
|
375
|
+
Note: the structured log line only includes `Bucket` and `Key` —
|
|
376
|
+
`Body` is omitted to avoid spilling large payloads or sensitive
|
|
377
|
+
content into CloudWatch.
|
|
378
|
+
|
|
379
|
+
#### Parameters
|
|
380
|
+
|
|
381
|
+
##### input
|
|
382
|
+
|
|
383
|
+
`Required`\<`Pick`\<`PutObjectCommandInput`, `"Bucket"` \| `"Key"` \| `"Body"`\>\>
|
|
384
|
+
|
|
385
|
+
Bucket, Key, and Body of the object to store.
|
|
386
|
+
|
|
387
|
+
#### Returns
|
|
388
|
+
|
|
389
|
+
`Promise`\<`PutObjectCommandOutput`\>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
[**@aligent/aws-wrappers**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/aws-wrappers](../modules.md) / SNSService
|
|
6
|
+
|
|
7
|
+
# Class: SNSService
|
|
8
|
+
|
|
9
|
+
Defined in: [sns/sns.ts:20](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sns/sns.ts#L20)
|
|
10
|
+
|
|
11
|
+
Wrapper around the AWS SNS client providing structured Powertools logging
|
|
12
|
+
and X-Ray tracing by default.
|
|
13
|
+
|
|
14
|
+
## Constructors
|
|
15
|
+
|
|
16
|
+
<a id="constructor"></a>
|
|
17
|
+
|
|
18
|
+
### Constructor
|
|
19
|
+
|
|
20
|
+
> **new SNSService**(`opts?`): `SNSService`
|
|
21
|
+
|
|
22
|
+
Defined in: [sns/sns.ts:30](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sns/sns.ts#L30)
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
##### opts?
|
|
27
|
+
|
|
28
|
+
###### client?
|
|
29
|
+
|
|
30
|
+
`SNSClient`
|
|
31
|
+
|
|
32
|
+
Optional pre-configured `SNSClient`. When supplied,
|
|
33
|
+
the wrapper does not apply X-Ray instrumentation.
|
|
34
|
+
|
|
35
|
+
###### logger?
|
|
36
|
+
|
|
37
|
+
`Logger`
|
|
38
|
+
|
|
39
|
+
Optional Powertools logger. Defaults to a logger with
|
|
40
|
+
`serviceName: 'SNSService'`.
|
|
41
|
+
|
|
42
|
+
#### Returns
|
|
43
|
+
|
|
44
|
+
`SNSService`
|
|
45
|
+
|
|
46
|
+
## Methods
|
|
47
|
+
|
|
48
|
+
<a id="publish"></a>
|
|
49
|
+
|
|
50
|
+
### publish()
|
|
51
|
+
|
|
52
|
+
> **publish**(`input`): `Promise`\<`PublishCommandOutput`\>
|
|
53
|
+
|
|
54
|
+
Defined in: [sns/sns.ts:39](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sns/sns.ts#L39)
|
|
55
|
+
|
|
56
|
+
Publish a single message to an SNS topic.
|
|
57
|
+
|
|
58
|
+
#### Parameters
|
|
59
|
+
|
|
60
|
+
##### input
|
|
61
|
+
|
|
62
|
+
`PublishCommandInput`
|
|
63
|
+
|
|
64
|
+
PublishCommandInput including TopicArn and Message.
|
|
65
|
+
|
|
66
|
+
#### Returns
|
|
67
|
+
|
|
68
|
+
`Promise`\<`PublishCommandOutput`\>
|
|
69
|
+
|
|
70
|
+
***
|
|
71
|
+
|
|
72
|
+
<a id="publishbatch"></a>
|
|
73
|
+
|
|
74
|
+
### publishBatch()
|
|
75
|
+
|
|
76
|
+
> **publishBatch**(`input`): `Promise`\<`PublishBatchCommandOutput`[]\>
|
|
77
|
+
|
|
78
|
+
Defined in: [sns/sns.ts:51](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sns/sns.ts#L51)
|
|
79
|
+
|
|
80
|
+
Publish a batch of messages to an SNS topic. The SNS API caps
|
|
81
|
+
PublishBatch at 10 entries per request, so this method auto-chunks
|
|
82
|
+
the caller's `PublishBatchRequestEntries` and sends one request per
|
|
83
|
+
chunk, returning the array of outputs.
|
|
84
|
+
|
|
85
|
+
#### Parameters
|
|
86
|
+
|
|
87
|
+
##### input
|
|
88
|
+
|
|
89
|
+
`PublishBatchCommandInput`
|
|
90
|
+
|
|
91
|
+
PublishBatchCommandInput including TopicArn and entries.
|
|
92
|
+
|
|
93
|
+
#### Returns
|
|
94
|
+
|
|
95
|
+
`Promise`\<`PublishBatchCommandOutput`[]\>
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
[**@aligent/aws-wrappers**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/aws-wrappers](../modules.md) / SQSService
|
|
6
|
+
|
|
7
|
+
# Class: SQSService
|
|
8
|
+
|
|
9
|
+
Defined in: [sqs/sqs.ts:30](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L30)
|
|
10
|
+
|
|
11
|
+
Wrapper around the AWS SQS client providing structured Powertools logging
|
|
12
|
+
and X-Ray tracing by default.
|
|
13
|
+
|
|
14
|
+
## Constructors
|
|
15
|
+
|
|
16
|
+
<a id="constructor"></a>
|
|
17
|
+
|
|
18
|
+
### Constructor
|
|
19
|
+
|
|
20
|
+
> **new SQSService**(`opts?`): `SQSService`
|
|
21
|
+
|
|
22
|
+
Defined in: [sqs/sqs.ts:40](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L40)
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
##### opts?
|
|
27
|
+
|
|
28
|
+
###### client?
|
|
29
|
+
|
|
30
|
+
`SQSClient`
|
|
31
|
+
|
|
32
|
+
Optional pre-configured `SQSClient`. When supplied,
|
|
33
|
+
the wrapper does not apply X-Ray instrumentation.
|
|
34
|
+
|
|
35
|
+
###### logger?
|
|
36
|
+
|
|
37
|
+
`Logger`
|
|
38
|
+
|
|
39
|
+
Optional Powertools logger. Defaults to a logger with
|
|
40
|
+
`serviceName: 'SQSService'`.
|
|
41
|
+
|
|
42
|
+
#### Returns
|
|
43
|
+
|
|
44
|
+
`SQSService`
|
|
45
|
+
|
|
46
|
+
## Methods
|
|
47
|
+
|
|
48
|
+
<a id="deletemessage"></a>
|
|
49
|
+
|
|
50
|
+
### deleteMessage()
|
|
51
|
+
|
|
52
|
+
> **deleteMessage**(`input`): `Promise`\<`DeleteMessageCommandOutput`\>
|
|
53
|
+
|
|
54
|
+
Defined in: [sqs/sqs.ts:68](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L68)
|
|
55
|
+
|
|
56
|
+
Delete a single message from an SQS queue.
|
|
57
|
+
|
|
58
|
+
#### Parameters
|
|
59
|
+
|
|
60
|
+
##### input
|
|
61
|
+
|
|
62
|
+
`DeleteMessageCommandInput`
|
|
63
|
+
|
|
64
|
+
#### Returns
|
|
65
|
+
|
|
66
|
+
`Promise`\<`DeleteMessageCommandOutput`\>
|
|
67
|
+
|
|
68
|
+
***
|
|
69
|
+
|
|
70
|
+
<a id="deletemessagebatch"></a>
|
|
71
|
+
|
|
72
|
+
### deleteMessageBatch()
|
|
73
|
+
|
|
74
|
+
> **deleteMessageBatch**(`input`): `Promise`\<`DeleteMessageBatchCommandOutput`[]\>
|
|
75
|
+
|
|
76
|
+
Defined in: [sqs/sqs.ts:100](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L100)
|
|
77
|
+
|
|
78
|
+
Delete a batch of messages from an SQS queue. The SQS API caps
|
|
79
|
+
DeleteMessageBatch at 10 entries per request, so this method auto-chunks
|
|
80
|
+
the caller's entries and sends one request per chunk.
|
|
81
|
+
|
|
82
|
+
#### Parameters
|
|
83
|
+
|
|
84
|
+
##### input
|
|
85
|
+
|
|
86
|
+
`DeleteMessageBatchCommandInput`
|
|
87
|
+
|
|
88
|
+
#### Returns
|
|
89
|
+
|
|
90
|
+
`Promise`\<`DeleteMessageBatchCommandOutput`[]\>
|
|
91
|
+
|
|
92
|
+
***
|
|
93
|
+
|
|
94
|
+
<a id="receivemessages"></a>
|
|
95
|
+
|
|
96
|
+
### receiveMessages()
|
|
97
|
+
|
|
98
|
+
> **receiveMessages**(`input`): `Promise`\<`Message`[]\>
|
|
99
|
+
|
|
100
|
+
Defined in: [sqs/sqs.ts:59](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L59)
|
|
101
|
+
|
|
102
|
+
Receive messages from an SQS queue. Returns an empty array when no
|
|
103
|
+
messages are available. No automatic deletion is performed — visibility
|
|
104
|
+
timeout semantics are the caller's responsibility.
|
|
105
|
+
|
|
106
|
+
#### Parameters
|
|
107
|
+
|
|
108
|
+
##### input
|
|
109
|
+
|
|
110
|
+
`ReceiveMessageCommandInput`
|
|
111
|
+
|
|
112
|
+
#### Returns
|
|
113
|
+
|
|
114
|
+
`Promise`\<`Message`[]\>
|
|
115
|
+
|
|
116
|
+
The `Messages` array from the response, or `[]` if absent.
|
|
117
|
+
|
|
118
|
+
***
|
|
119
|
+
|
|
120
|
+
<a id="sendmessage"></a>
|
|
121
|
+
|
|
122
|
+
### sendMessage()
|
|
123
|
+
|
|
124
|
+
> **sendMessage**(`input`): `Promise`\<`SendMessageCommandOutput`\>
|
|
125
|
+
|
|
126
|
+
Defined in: [sqs/sqs.ts:48](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L48)
|
|
127
|
+
|
|
128
|
+
Send a single message to an SQS queue.
|
|
129
|
+
|
|
130
|
+
#### Parameters
|
|
131
|
+
|
|
132
|
+
##### input
|
|
133
|
+
|
|
134
|
+
`SendMessageCommandInput`
|
|
135
|
+
|
|
136
|
+
#### Returns
|
|
137
|
+
|
|
138
|
+
`Promise`\<`SendMessageCommandOutput`\>
|
|
139
|
+
|
|
140
|
+
***
|
|
141
|
+
|
|
142
|
+
<a id="sendmessagebatch"></a>
|
|
143
|
+
|
|
144
|
+
### sendMessageBatch()
|
|
145
|
+
|
|
146
|
+
> **sendMessageBatch**(`input`): `Promise`\<`SendMessageBatchCommandOutput`[]\>
|
|
147
|
+
|
|
148
|
+
Defined in: [sqs/sqs.ts:78](https://github.com/aligent/microservice-development-utilities/blob/30b581ee09ba114f98caadf97f423e40b9b4f410/packages/aws-wrappers/src/sqs/sqs.ts#L78)
|
|
149
|
+
|
|
150
|
+
Send a batch of messages to an SQS queue. The SQS API caps
|
|
151
|
+
SendMessageBatch at 10 entries per request, so this method auto-chunks
|
|
152
|
+
the caller's entries and sends one request per chunk.
|
|
153
|
+
|
|
154
|
+
#### Parameters
|
|
155
|
+
|
|
156
|
+
##### input
|
|
157
|
+
|
|
158
|
+
`SendMessageBatchCommandInput`
|
|
159
|
+
|
|
160
|
+
#### Returns
|
|
161
|
+
|
|
162
|
+
`Promise`\<`SendMessageBatchCommandOutput`[]\>
|