@adobe/helix-admin-support 3.0.1 → 3.0.3
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/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/BatchedQueueClient.d.ts +2 -2
- package/src/BatchedQueueClient.js +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.0.3](https://github.com/adobe/helix-admin-support/compare/v3.0.2...v3.0.3) (2024-11-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* return message IDs from send ([#332](https://github.com/adobe/helix-admin-support/issues/332)) ([4fc95ea](https://github.com/adobe/helix-admin-support/commit/4fc95ea727925f553182ac65de9ca1a24460f2fa))
|
|
7
|
+
|
|
8
|
+
## [3.0.2](https://github.com/adobe/helix-admin-support/compare/v3.0.1...v3.0.2) (2024-11-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-shared-config to v11.0.9 ([#331](https://github.com/adobe/helix-admin-support/issues/331)) ([ecb317e](https://github.com/adobe/helix-admin-support/commit/ecb317eabb1532a872994fcc1428fb4ca84b50d9))
|
|
14
|
+
|
|
1
15
|
## [3.0.1](https://github.com/adobe/helix-admin-support/compare/v3.0.0...v3.0.1) (2024-11-09)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-admin-support",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Helix Admin Support Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/fetch": "4.1.9",
|
|
40
|
-
"@adobe/helix-shared-config": "11.0.
|
|
40
|
+
"@adobe/helix-shared-config": "11.0.9",
|
|
41
41
|
"@adobe/helix-shared-utils": "3.0.2",
|
|
42
42
|
"@aws-sdk/client-s3": "3.688.0",
|
|
43
43
|
"@aws-sdk/client-sqs": "3.687.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"mocha": "10.8.2",
|
|
60
60
|
"mocha-multi-reporters": "1.5.1",
|
|
61
61
|
"mocha-suppress-logs": "0.5.1",
|
|
62
|
-
"nock": "13.5.
|
|
62
|
+
"nock": "13.5.6",
|
|
63
63
|
"semantic-release": "24.2.0",
|
|
64
64
|
"xml2js": "0.6.2",
|
|
65
65
|
"yaml": "2.6.0"
|
|
@@ -73,9 +73,9 @@ export declare class BatchedQueueClient {
|
|
|
73
73
|
/**
|
|
74
74
|
* Sends a batch of messages to the `outQueue`.
|
|
75
75
|
* @param {Message[]} messages
|
|
76
|
-
* @returns {Promise<
|
|
76
|
+
* @returns {Promise<String[]>} Message IDs of messages sent successfully
|
|
77
77
|
*/
|
|
78
|
-
send(messages:Message[]): Promise<
|
|
78
|
+
send(messages:Message[]): Promise<String[]>;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Closes this client and destroys the underlying datastructures
|
|
@@ -204,15 +204,17 @@ export class BatchedQueueClient {
|
|
|
204
204
|
/**
|
|
205
205
|
* Sends a batch of messages to the `outQueue`.
|
|
206
206
|
* @param {Message[]} messages
|
|
207
|
-
* @returns {Promise<
|
|
207
|
+
* @returns {Promise<String[]>} Message IDs of messages sent successfully
|
|
208
208
|
*/
|
|
209
209
|
async send(messages) {
|
|
210
210
|
const { log, sqs } = this;
|
|
211
211
|
const total = messages.length;
|
|
212
|
+
const messageIds = [];
|
|
212
213
|
let sent = 0;
|
|
213
214
|
let batchSize = 0;
|
|
214
215
|
let batch = [];
|
|
215
216
|
let send = false;
|
|
217
|
+
|
|
216
218
|
while (messages.length) {
|
|
217
219
|
let msg = messages.shift();
|
|
218
220
|
let size = JSON.stringify(msg).length;
|
|
@@ -221,7 +223,7 @@ export class BatchedQueueClient {
|
|
|
221
223
|
batchSize += size;
|
|
222
224
|
} else if (batch.length === 0) {
|
|
223
225
|
// message doesn't fit in any batch - serializing to s3
|
|
224
|
-
log.info(`[${msg.MessageGroupId}] message
|
|
226
|
+
log.info(`[${msg.MessageGroupId}] message too big: ${hsize(size)}. serializing to s3...`);
|
|
225
227
|
// eslint-disable-next-line no-await-in-loop
|
|
226
228
|
msg = await this.serialize(msg);
|
|
227
229
|
size = JSON.stringify(msg).length;
|
|
@@ -229,7 +231,7 @@ export class BatchedQueueClient {
|
|
|
229
231
|
batchSize += size;
|
|
230
232
|
} else {
|
|
231
233
|
// put message back
|
|
232
|
-
log.info(`[${msg.MessageGroupId}] message
|
|
234
|
+
log.info(`[${msg.MessageGroupId}] message too big: ${hsize(size)}. sending current batch...`);
|
|
233
235
|
messages.unshift(msg);
|
|
234
236
|
send = true;
|
|
235
237
|
}
|
|
@@ -250,12 +252,14 @@ export class BatchedQueueClient {
|
|
|
250
252
|
log.warn(`failed to send ${Failed.length} to queue.`);
|
|
251
253
|
}
|
|
252
254
|
sent += Successful.length;
|
|
255
|
+
messageIds.push(...Successful.map(({ MessageId }) => MessageId));
|
|
253
256
|
log.info(`sent. ${sent}/${total} (${hsize(batchSize)} to ${this.outQueue} done.`);
|
|
254
257
|
batch = [];
|
|
255
258
|
batchSize = 0;
|
|
256
259
|
send = false;
|
|
257
260
|
}
|
|
258
261
|
}
|
|
262
|
+
return messageIds;
|
|
259
263
|
}
|
|
260
264
|
|
|
261
265
|
/**
|