@cumulus/aws-client 10.0.0-beta.0 → 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.
Files changed (4) hide show
  1. package/README.md +2 -0
  2. package/S3.js +14 -4
  3. package/SQS.d.ts +4 -1
  4. package/package.json +7 -6
package/README.md CHANGED
@@ -858,6 +858,7 @@ Copy an S3 object to another location in S3 using a multipart copy
858
858
  | [params.sourceObject] | <code>AWS.S3.HeadObjectOutput</code> | | Output from https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#headObject-property |
859
859
  | [params.ACL] | <code>string</code> | | an [S3 Canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) |
860
860
  | [params.copyTags] | <code>boolean</code> | <code>false</code> | |
861
+ | [params.chunkSize] | <code>number</code> | | chunk size of the S3 multipart uploads |
861
862
 
862
863
  <a name="module_S3..moveObject"></a>
863
864
 
@@ -875,6 +876,7 @@ Move an S3 object to another location in S3
875
876
  | params.destinationKey | <code>string</code> | | |
876
877
  | [params.ACL] | <code>string</code> | | an [S3 Canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) |
877
878
  | [params.copyTags] | <code>boolean</code> | <code>false</code> | |
879
+ | [params.chunkSize] | <code>number</code> | | chunk size of the S3 multipart uploads |
878
880
 
879
881
  <a name="module_SNS"></a>
880
882
 
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
- return await (0, p_wait_for_1.default)(() => (0, exports.s3ObjectExists)({ Bucket: bucket, Key: key }), { interval, timeout });
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
  /**
@@ -320,9 +332,7 @@ exports.s3PutObjectTagging = (0, utils_1.improveStackTrace)((Bucket, Key, Taggin
320
332
  * @returns {Promise<AWS.S3.GetObjectOutput>} response from `AWS.S3.getObject()`
321
333
  * as a Promise
322
334
  */
323
- const getObject = (
324
- // eslint-disable-next-line no-shadow
325
- s3Client, params) => s3Client.getObject(params).promise();
335
+ const getObject = (s3Client, params) => s3Client.getObject(params).promise();
326
336
  exports.getObject = getObject;
327
337
  /**
328
338
  * Get an object from S3, waiting for it to exist and, if specified, have the
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: any) => unknown;
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.0-beta.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.0-beta.0",
47
- "@cumulus/errors": "10.0.0-beta.0",
48
- "@cumulus/logger": "10.0.0-beta.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-wait-for": "^3.1.0",
54
+ "p-timeout": "^4.1.0",
55
+ "p-wait-for": "^3.2.0",
55
56
  "pump": "^3.0.0"
56
57
  },
57
- "gitHead": "bc283986be627ba06a4084cabd4e01d1540d14c7"
58
+ "gitHead": "765ba4733ec97540e28cd64dac702eea3b96c654"
58
59
  }