@cumulus/aws-client 14.1.0 → 15.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/DynamoDbSearchQueue.js +4 -4
- package/S3.d.ts +1 -1
- package/S3.js +5 -8
- package/SQS.js +2 -3
- package/package.json +6 -6
package/DynamoDbSearchQueue.js
CHANGED
|
@@ -89,11 +89,11 @@ class DynamoDbSearchQueue {
|
|
|
89
89
|
else if (this.searchType === 'query') {
|
|
90
90
|
response = await this.dynamodbDocClient.query(this.params); // eslint-disable-line no-await-in-loop, max-len
|
|
91
91
|
}
|
|
92
|
-
if (response
|
|
92
|
+
if (response?.LastEvaluatedKey)
|
|
93
93
|
this.params.ExclusiveStartKey = response.LastEvaluatedKey;
|
|
94
|
-
} while ((
|
|
95
|
-
this.items = (
|
|
96
|
-
if (!
|
|
94
|
+
} while ((response?.Items || []).length === 0 && response?.LastEvaluatedKey);
|
|
95
|
+
this.items = (response?.Items || []);
|
|
96
|
+
if (!response?.LastEvaluatedKey)
|
|
97
97
|
this.items.push(null);
|
|
98
98
|
}
|
|
99
99
|
}
|
package/S3.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export declare const promiseS3Upload: (params: Omit<UploadOptions, 'client'>) =>
|
|
|
135
135
|
* @param {Object} uploadParams
|
|
136
136
|
* @returns {Promise}
|
|
137
137
|
*/
|
|
138
|
-
export declare const streamS3Upload: (uploadStream: Readable, uploadParams: UploadOptions) => Promise<import("@aws-sdk/client-s3").
|
|
138
|
+
export declare const streamS3Upload: (uploadStream: Readable, uploadParams: UploadOptions) => Promise<import("@aws-sdk/client-s3").AbortMultipartUploadCommandOutput | import("@aws-sdk/client-s3").CompleteMultipartUploadCommandOutput>;
|
|
139
139
|
/**
|
|
140
140
|
* Get a readable stream for an S3 object
|
|
141
141
|
*
|
package/S3.js
CHANGED
|
@@ -115,7 +115,7 @@ exports.buildS3Uri = buildS3Uri;
|
|
|
115
115
|
* @param {Array<Object>} tagset - S3 TagSet array
|
|
116
116
|
* @returns {string} tags query string
|
|
117
117
|
*/
|
|
118
|
-
const s3TagSetToQueryString = (tagset) => tagset
|
|
118
|
+
const s3TagSetToQueryString = (tagset) => tagset?.map(({ Key, Value }) => `${Key}=${Value}`).join('&');
|
|
119
119
|
exports.s3TagSetToQueryString = s3TagSetToQueryString;
|
|
120
120
|
/**
|
|
121
121
|
* Delete an object from S3
|
|
@@ -354,9 +354,8 @@ exports.getObjectSize = getObjectSize;
|
|
|
354
354
|
const s3GetObjectTagging = (bucket, key) => (0, services_1.s3)().getObjectTagging({ Bucket: bucket, Key: key });
|
|
355
355
|
exports.s3GetObjectTagging = s3GetObjectTagging;
|
|
356
356
|
const getObjectTags = async (bucket, key) => {
|
|
357
|
-
var _a;
|
|
358
357
|
const taggingResponse = await (0, exports.s3GetObjectTagging)(bucket, key);
|
|
359
|
-
return
|
|
358
|
+
return taggingResponse?.TagSet?.reduce((accumulator, { Key, Value }) => {
|
|
360
359
|
if (Key && Value) {
|
|
361
360
|
return { ...accumulator, [Key]: Value };
|
|
362
361
|
}
|
|
@@ -651,10 +650,9 @@ exports.listS3Objects = listS3Objects;
|
|
|
651
650
|
* @static
|
|
652
651
|
*/
|
|
653
652
|
const listS3ObjectsV2 = async (params) => {
|
|
654
|
-
var _a, _b;
|
|
655
653
|
// Fetch the first list of objects from S3
|
|
656
654
|
let listObjectsResponse = await (0, services_1.s3)().listObjectsV2(params);
|
|
657
|
-
let discoveredObjects =
|
|
655
|
+
let discoveredObjects = listObjectsResponse.Contents ?? [];
|
|
658
656
|
// Keep listing more objects from S3 until we have all of them
|
|
659
657
|
while (listObjectsResponse.IsTruncated) {
|
|
660
658
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -664,7 +662,7 @@ const listS3ObjectsV2 = async (params) => {
|
|
|
664
662
|
...params,
|
|
665
663
|
ContinuationToken: listObjectsResponse.NextContinuationToken,
|
|
666
664
|
}));
|
|
667
|
-
discoveredObjects = discoveredObjects.concat(
|
|
665
|
+
discoveredObjects = discoveredObjects.concat(listObjectsResponse.Contents ?? []);
|
|
668
666
|
}
|
|
669
667
|
return discoveredObjects;
|
|
670
668
|
};
|
|
@@ -804,9 +802,8 @@ const uploadPartCopy = async (params) => {
|
|
|
804
802
|
* note: this method may error if used with zero byte files. see CUMULUS-2557 and https://github.com/nasa/cumulus/pull/2117.
|
|
805
803
|
*/
|
|
806
804
|
const multipartCopyObject = async (params) => {
|
|
807
|
-
var _a;
|
|
808
805
|
const { sourceBucket, sourceKey, destinationBucket, destinationKey, ACL, copyTags = false, chunkSize, } = params;
|
|
809
|
-
const sourceObject =
|
|
806
|
+
const sourceObject = params.sourceObject ?? await (0, exports.headObject)(sourceBucket, sourceKey);
|
|
810
807
|
// Create a multi-part upload (copy) and get its UploadId
|
|
811
808
|
const uploadId = await createMultipartUpload({
|
|
812
809
|
sourceBucket,
|
package/SQS.js
CHANGED
|
@@ -144,7 +144,6 @@ exports.sendSQSMessage = (0, utils_1.improveStackTrace)((queueUrl, message, logO
|
|
|
144
144
|
* @returns {Promise<Array>} an array of messages
|
|
145
145
|
*/
|
|
146
146
|
const receiveSQSMessages = async (queueUrl, options) => {
|
|
147
|
-
var _a;
|
|
148
147
|
const params = {
|
|
149
148
|
QueueUrl: queueUrl,
|
|
150
149
|
AttributeNames: ['All'],
|
|
@@ -155,10 +154,10 @@ const receiveSQSMessages = async (queueUrl, options) => {
|
|
|
155
154
|
};
|
|
156
155
|
const messages = await (0, services_1.sqs)().receiveMessage(params)
|
|
157
156
|
.on('error', (error) => log.error(error)).promise();
|
|
158
|
-
return (
|
|
157
|
+
return (messages.Messages ?? []);
|
|
159
158
|
};
|
|
160
159
|
exports.receiveSQSMessages = receiveSQSMessages;
|
|
161
|
-
const parseSQSMessageBody = (message) =>
|
|
160
|
+
const parseSQSMessageBody = (message) => JSON.parse((0, get_1.default)(message, 'Body', (0, get_1.default)(message, 'body')) ?? '{}');
|
|
162
161
|
exports.parseSQSMessageBody = parseSQSMessageBody;
|
|
163
162
|
/**
|
|
164
163
|
* Delete a given SQS message from a given queue.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/aws-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.1",
|
|
4
4
|
"description": "Utilities for working with AWS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"NASA"
|
|
9
9
|
],
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
11
|
+
"node": ">=16.19.0"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"*.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@aws-sdk/s3-request-presigner": "^3.58.0",
|
|
53
53
|
"@aws-sdk/signature-v4-crt": "^3.58.0",
|
|
54
54
|
"@aws-sdk/types": "^3.58.0",
|
|
55
|
-
"@cumulus/checksum": "
|
|
56
|
-
"@cumulus/errors": "
|
|
57
|
-
"@cumulus/logger": "
|
|
55
|
+
"@cumulus/checksum": "15.0.1",
|
|
56
|
+
"@cumulus/errors": "15.0.1",
|
|
57
|
+
"@cumulus/logger": "15.0.1",
|
|
58
58
|
"aws-sdk": "^2.585.0",
|
|
59
59
|
"jsonpath-plus": "^1.1.0",
|
|
60
60
|
"lodash": "~4.17.21",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/uuid": "^8.0.0"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "fb7304717073c7be4dd8f40342e038bcab6f751c"
|
|
73
73
|
}
|