@cumulus/aws-client 20.3.0 → 21.0.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/README.md +20 -7
- package/S3.d.ts +18 -5
- package/S3.js +16 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -299,7 +299,7 @@ Invoke a Lambda function
|
|
|
299
299
|
* [~deleteS3Object(bucket, key)](#module_S3..deleteS3Object) ⇒ <code>Promise</code>
|
|
300
300
|
* [~headObject(Bucket, Key, retryOptions)](#module_S3..headObject) ⇒
|
|
301
301
|
* [~s3ObjectExists(params)](#module_S3..s3ObjectExists) ⇒ <code>Promise.<boolean></code>
|
|
302
|
-
* [~waitForObjectToExist()](#module_S3..waitForObjectToExist)
|
|
302
|
+
* [~waitForObjectToExist(params)](#module_S3..waitForObjectToExist) ⇒
|
|
303
303
|
* [~s3PutObject(params)](#module_S3..s3PutObject)
|
|
304
304
|
* [~putFile()](#module_S3..putFile)
|
|
305
305
|
* [~s3CopyObject()](#module_S3..s3CopyObject)
|
|
@@ -479,15 +479,28 @@ Test if an object exists in S3
|
|
|
479
479
|
|
|
480
480
|
<a name="module_S3..waitForObjectToExist"></a>
|
|
481
481
|
|
|
482
|
-
### S3~waitForObjectToExist()
|
|
483
|
-
|
|
482
|
+
### S3~waitForObjectToExist(params) ⇒
|
|
483
|
+
Asynchronously waits for an S3 object to exist at a specified location.
|
|
484
|
+
|
|
485
|
+
This function uses `p-wait-for` to repeatedly check for the object's existence
|
|
486
|
+
until it's found or a timeout is reached. It provides configurable `interval`
|
|
487
|
+
between checks and a total `timeout` duration.
|
|
484
488
|
|
|
485
489
|
**Kind**: inner method of [<code>S3</code>](#module_S3)
|
|
490
|
+
**Returns**: A Promise that resolves when the S3 object is found.
|
|
491
|
+
**Throws**:
|
|
486
492
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
493
|
+
- <code>TimeoutError</code> If the object does not exist within the specified `timeout` period.
|
|
494
|
+
- <code>Error</code> If an unexpected error occurs during the S3 existence check.
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
| Param | Description |
|
|
498
|
+
| --- | --- |
|
|
499
|
+
| params | The parameters for waiting for the object. |
|
|
500
|
+
| params.bucket | The name of the S3 bucket where the object is expected. |
|
|
501
|
+
| params.key | The key (path) of the S3 object within the bucket. |
|
|
502
|
+
| params.interval | The time in milliseconds to wait between checks. Defaults to 1000ms (1 second). |
|
|
503
|
+
| params.timeout | The maximum time in milliseconds to wait before giving up and throwing a `TimeoutError`. Defaults to 30000ms (30 seconds). |
|
|
491
504
|
|
|
492
505
|
<a name="module_S3..s3PutObject"></a>
|
|
493
506
|
|
package/S3.d.ts
CHANGED
|
@@ -78,15 +78,28 @@ export declare const s3ObjectExists: (params: {
|
|
|
78
78
|
Key: string;
|
|
79
79
|
}) => Promise<boolean>;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
81
|
+
* Asynchronously waits for an S3 object to exist at a specified location.
|
|
82
|
+
*
|
|
83
|
+
* This function uses `p-wait-for` to repeatedly check for the object's existence
|
|
84
|
+
* until it's found or a timeout is reached. It provides configurable `interval`
|
|
85
|
+
* between checks and a total `timeout` duration.
|
|
86
|
+
*
|
|
87
|
+
* @param params - The parameters for waiting for the object.
|
|
88
|
+
* @param params.bucket - The name of the S3 bucket where the object is expected.
|
|
89
|
+
* @param params.key - The key (path) of the S3 object within the bucket.
|
|
90
|
+
* @param params.interval - The time in milliseconds to wait between checks.
|
|
91
|
+
* Defaults to 1000ms (1 second).
|
|
92
|
+
* @param params.timeout - The maximum time in milliseconds to wait before
|
|
93
|
+
* giving up and throwing a `TimeoutError`. Defaults to 30000ms (30 seconds).
|
|
94
|
+
* @returns A Promise that resolves when the S3 object is found.
|
|
95
|
+
* @throws {TimeoutError} If the object does not exist within the specified `timeout` period.
|
|
96
|
+
* @throws {Error} If an unexpected error occurs during the S3 existence check.
|
|
84
97
|
*/
|
|
85
98
|
export declare const waitForObjectToExist: (params: {
|
|
86
99
|
bucket: string;
|
|
87
100
|
key: string;
|
|
88
|
-
interval
|
|
89
|
-
timeout
|
|
101
|
+
interval?: number;
|
|
102
|
+
timeout?: number;
|
|
90
103
|
}) => Promise<void>;
|
|
91
104
|
/**
|
|
92
105
|
* Put an object on S3
|
package/S3.js
CHANGED
|
@@ -174,9 +174,22 @@ const s3ObjectExists = (params) => (0, exports.headObject)(params.Bucket, params
|
|
|
174
174
|
});
|
|
175
175
|
exports.s3ObjectExists = s3ObjectExists;
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
177
|
+
* Asynchronously waits for an S3 object to exist at a specified location.
|
|
178
|
+
*
|
|
179
|
+
* This function uses `p-wait-for` to repeatedly check for the object's existence
|
|
180
|
+
* until it's found or a timeout is reached. It provides configurable `interval`
|
|
181
|
+
* between checks and a total `timeout` duration.
|
|
182
|
+
*
|
|
183
|
+
* @param params - The parameters for waiting for the object.
|
|
184
|
+
* @param params.bucket - The name of the S3 bucket where the object is expected.
|
|
185
|
+
* @param params.key - The key (path) of the S3 object within the bucket.
|
|
186
|
+
* @param params.interval - The time in milliseconds to wait between checks.
|
|
187
|
+
* Defaults to 1000ms (1 second).
|
|
188
|
+
* @param params.timeout - The maximum time in milliseconds to wait before
|
|
189
|
+
* giving up and throwing a `TimeoutError`. Defaults to 30000ms (30 seconds).
|
|
190
|
+
* @returns A Promise that resolves when the S3 object is found.
|
|
191
|
+
* @throws {TimeoutError} If the object does not exist within the specified `timeout` period.
|
|
192
|
+
* @throws {Error} If an unexpected error occurs during the S3 existence check.
|
|
180
193
|
*/
|
|
181
194
|
const waitForObjectToExist = async (params) => {
|
|
182
195
|
const { bucket, key, interval = 1000, timeout = 30 * 1000, } = params;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/aws-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"description": "Utilities for working with AWS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"@aws-sdk/s3-request-presigner": "^3.621.0",
|
|
70
70
|
"@aws-sdk/signature-v4-crt": "^3.621.0",
|
|
71
71
|
"@aws-sdk/types": "^3.609.0",
|
|
72
|
-
"@cumulus/checksum": "
|
|
73
|
-
"@cumulus/errors": "
|
|
74
|
-
"@cumulus/logger": "
|
|
75
|
-
"@cumulus/types": "
|
|
72
|
+
"@cumulus/checksum": "21.0.0",
|
|
73
|
+
"@cumulus/errors": "21.0.0",
|
|
74
|
+
"@cumulus/logger": "21.0.0",
|
|
75
|
+
"@cumulus/types": "21.0.0",
|
|
76
76
|
"lodash": "~4.17.21",
|
|
77
77
|
"mem": "^8.0.2",
|
|
78
78
|
"p-map": "^1.2.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"uuid": "^8.2.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@cumulus/test-data": "
|
|
86
|
+
"@cumulus/test-data": "21.0.0",
|
|
87
87
|
"@types/uuid": "^8.0.0"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "19bb3477969662a9e0b300f10f6df23b6c0654db"
|
|
90
90
|
}
|