@cumulus/aws-client 10.0.1 → 10.1.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/S3.js +13 -1
- package/SQS.d.ts +4 -1
- package/package.json +7 -6
package/S3.js
CHANGED
|
@@ -32,6 +32,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
32
32
|
const p_map_1 = __importDefault(require("p-map"));
|
|
33
33
|
const p_retry_1 = __importDefault(require("p-retry"));
|
|
34
34
|
const p_wait_for_1 = __importDefault(require("p-wait-for"));
|
|
35
|
+
const p_timeout_1 = __importDefault(require("p-timeout"));
|
|
35
36
|
const pump_1 = __importDefault(require("pump"));
|
|
36
37
|
const querystring_1 = __importDefault(require("querystring"));
|
|
37
38
|
const stream_1 = require("stream");
|
|
@@ -166,7 +167,18 @@ exports.s3ObjectExists = s3ObjectExists;
|
|
|
166
167
|
*/
|
|
167
168
|
const waitForObjectToExist = async (params) => {
|
|
168
169
|
const { bucket, key, interval = 1000, timeout = 30 * 1000, } = params;
|
|
169
|
-
|
|
170
|
+
try {
|
|
171
|
+
await (0, p_wait_for_1.default)(() => (0, exports.s3ObjectExists)({ Bucket: bucket, Key: key }), { interval, timeout });
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
if (error instanceof p_timeout_1.default) {
|
|
175
|
+
log.error(`Timed out after ${timeout}ms waiting for existence of s3://${bucket}/${key}`);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
log.error(`Unexpected error while waiting for existence of s3://${bucket}/${key}: ${error}`);
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
170
182
|
};
|
|
171
183
|
exports.waitForObjectToExist = waitForObjectToExist;
|
|
172
184
|
/**
|
package/SQS.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module SQS
|
|
3
3
|
*/
|
|
4
4
|
import Logger from '@cumulus/logger';
|
|
5
|
+
import { SQSRecord } from 'aws-lambda';
|
|
5
6
|
export interface SQSMessage extends AWS.SQS.Message {
|
|
6
7
|
ReceiptHandle: string;
|
|
7
8
|
}
|
|
@@ -52,7 +53,9 @@ declare type ReceiveSQSMessagesOptions = {
|
|
|
52
53
|
* @returns {Promise<Array>} an array of messages
|
|
53
54
|
*/
|
|
54
55
|
export declare const receiveSQSMessages: (queueUrl: string, options: ReceiveSQSMessagesOptions) => Promise<SQSMessage[]>;
|
|
55
|
-
export declare const parseSQSMessageBody: (message:
|
|
56
|
+
export declare const parseSQSMessageBody: (message: SQSRecord | AWS.SQS.Message) => {
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
56
59
|
/**
|
|
57
60
|
* Delete a given SQS message from a given queue.
|
|
58
61
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/aws-client",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Utilities for working with AWS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -43,16 +43,17 @@
|
|
|
43
43
|
"author": "Cumulus Authors",
|
|
44
44
|
"license": "Apache-2.0",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@cumulus/checksum": "10.0
|
|
47
|
-
"@cumulus/errors": "10.0
|
|
48
|
-
"@cumulus/logger": "10.0
|
|
46
|
+
"@cumulus/checksum": "10.1.0",
|
|
47
|
+
"@cumulus/errors": "10.1.0",
|
|
48
|
+
"@cumulus/logger": "10.1.0",
|
|
49
49
|
"aws-sdk": "^2.814.0",
|
|
50
50
|
"jsonpath-plus": "^1.1.0",
|
|
51
51
|
"lodash": "~4.17.20",
|
|
52
52
|
"p-map": "^1.2.0",
|
|
53
53
|
"p-retry": "^4.2.0",
|
|
54
|
-
"p-
|
|
54
|
+
"p-timeout": "^4.1.0",
|
|
55
|
+
"p-wait-for": "^3.2.0",
|
|
55
56
|
"pump": "^3.0.0"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "765ba4733ec97540e28cd64dac702eea3b96c654"
|
|
58
59
|
}
|