@cumulus/aws-client 10.1.2 → 11.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/DynamoDb.d.ts CHANGED
@@ -2,31 +2,34 @@
2
2
  * @module DynamoDb
3
3
  */
4
4
  import pRetry from 'p-retry';
5
- import { DocumentClient } from 'aws-sdk/lib/dynamodb/document_client';
5
+ import { CreateTableInput, DeleteTableInput, ScanInput } from '@aws-sdk/client-dynamodb';
6
+ import { DynamoDBDocument, GetCommandInput, ScanCommandInput, ScanCommandOutput } from '@aws-sdk/lib-dynamodb';
6
7
  /**
7
8
  * Call DynamoDb client get
8
9
  *
9
- * See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#get-property)
10
+ * See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)
10
11
  * for descriptions of `params` and the return data.
11
12
  *
12
13
  * @param {Object} params
13
14
  * @param {string} params.tableName - Table name to read
14
- * @param {AWS.DynamoDB.DocumentClient.Key} params.item - Key identifying object to get
15
- * @param {AWS.DynamoDB.DocumentClient} params.client - Instance of a DynamoDb DocumentClient
15
+ * @param {GetCommandInput.Key} params.item - Key identifying object to get
16
+ * @param {DynamoDBDocument} params.client - Instance of a DynamoDb DocumentClient
16
17
  * @param {Object} params.getParams - Additional parameters for DocumentClient.get()
17
18
  * @returns {Promise<Object>}
18
19
  * @throws {RecordDoesNotExist} if a record cannot be found
19
20
  */
20
21
  export declare const get: (params: {
21
22
  tableName: string;
22
- item: AWS.DynamoDB.DocumentClient.Key;
23
- client: AWS.DynamoDB.DocumentClient;
24
- getParams?: object | undefined;
25
- }) => Promise<DocumentClient.AttributeMap>;
23
+ item: GetCommandInput['Key'];
24
+ client: DynamoDBDocument;
25
+ getParams?: object;
26
+ }) => Promise<{
27
+ [key: string]: any;
28
+ }>;
26
29
  /**
27
30
  * Call DynamoDb client scan
28
31
  *
29
- * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#scan-property)
32
+ * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)
30
33
  * for descriptions of `params` and the return data.
31
34
  *
32
35
  * @param {Object} params
@@ -34,59 +37,59 @@ export declare const get: (params: {
34
37
  */
35
38
  export declare const scan: (params: {
36
39
  tableName: string;
37
- client: AWS.DynamoDB.DocumentClient;
40
+ client: DynamoDBDocument;
38
41
  query?: {
39
42
  filter?: string | undefined;
40
- names?: DocumentClient.ExpressionAttributeNameMap | undefined;
41
- values?: DocumentClient.ExpressionAttributeValueMap | undefined;
43
+ names?: ScanInput['ExpressionAttributeNames'];
44
+ values?: ScanCommandInput['ExpressionAttributeValues'];
42
45
  } | undefined;
43
46
  fields?: string | undefined;
44
47
  limit?: number | undefined;
45
48
  select: string;
46
- startKey?: DocumentClient.Key | undefined;
47
- }) => Promise<import("aws-sdk/lib/request").PromiseResult<DocumentClient.ScanOutput, import("aws-sdk").AWSError>>;
49
+ startKey?: ScanInput['ExclusiveStartKey'];
50
+ }) => Promise<ScanCommandOutput>;
48
51
  /**
49
52
  * Do a parallel scan of DynamoDB table using a document client.
50
53
  *
51
54
  * See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan.
52
- * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#scan-property).
55
+ * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html).
53
56
  *
54
57
  * @param {Object} params
55
58
  * @param {number} params.totalSegments
56
59
  * Total number of segments to divide table into for parallel scanning
57
- * @param {DocumentClient.ScanInput} params.scanParams
60
+ * @param {ScanInput} params.scanParams
58
61
  * Params for the DynamoDB client scan operation
59
62
  * See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
60
63
  * @param {function} params.processItemsFunc - Function used to process returned items by scan
61
- * @param {DocumentClient} [params.dynamoDbClient] - Instance of Dynamo DB document client
64
+ * @param {DynamoDBDocument} [params.dynamoDbClient] - Instance of Dynamo DB document client
62
65
  * @param {pRetry.Options} [params.retryOptions] - Retry options for scan operations
63
66
  * @returns {Promise}
64
67
  */
65
68
  export declare const parallelScan: (params: {
66
69
  totalSegments: number;
67
- scanParams: DocumentClient.ScanInput;
68
- processItemsFunc: (items: DocumentClient.ItemList) => Promise<void>;
69
- dynamoDbClient?: DocumentClient | undefined;
70
+ scanParams: ScanCommandInput;
71
+ processItemsFunc: (items: ScanCommandOutput['Items']) => Promise<void>;
72
+ dynamoDbClient: DynamoDBDocument;
70
73
  retryOptions?: pRetry.Options | undefined;
71
74
  }) => Promise<void[]>;
72
75
  /**
73
76
  * Create a DynamoDB table and then wait for the table to exist
74
77
  *
75
78
  * @param {Object} params - the same params that you would pass to AWS.createTable
76
- * See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property
79
+ * See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#createtable
77
80
  * @returns {Promise<Object>} the output of the createTable call
78
81
  *
79
82
  * @static
80
83
  */
81
- export declare function createAndWaitForDynamoDbTable(params: AWS.DynamoDB.CreateTableInput): Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/dynamodb").CreateTableOutput, import("aws-sdk").AWSError>>;
84
+ export declare function createAndWaitForDynamoDbTable(params: CreateTableInput): Promise<import("@aws-sdk/client-dynamodb").CreateTableCommandOutput>;
82
85
  /**
83
86
  * Delete a DynamoDB table and then wait for the table to not exist
84
87
  *
85
88
  * @param {Object} params - the same params that you would pass to AWS.deleteTable
86
- * See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#deleteTable-property
89
+ * See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#deletetable
87
90
  * @returns {Promise}
88
91
  *
89
92
  * @static
90
93
  */
91
- export declare function deleteAndWaitForDynamoDbTableNotExists(params: AWS.DynamoDB.DeleteTableInput): Promise<import("aws-sdk/lib/request").PromiseResult<import("aws-sdk/clients/dynamodb").DescribeTableOutput, import("aws-sdk").AWSError>>;
94
+ export declare function deleteAndWaitForDynamoDbTableNotExists(params: DeleteTableInput): Promise<void>;
92
95
  //# sourceMappingURL=DynamoDb.d.ts.map
package/DynamoDb.js CHANGED
@@ -10,38 +10,40 @@ exports.deleteAndWaitForDynamoDbTableNotExists = exports.createAndWaitForDynamoD
10
10
  const p_map_1 = __importDefault(require("p-map"));
11
11
  const p_retry_1 = __importDefault(require("p-retry"));
12
12
  const range_1 = __importDefault(require("lodash/range"));
13
+ const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
13
14
  const errors_1 = require("@cumulus/errors");
14
15
  const services_1 = require("./services");
15
16
  const utils_1 = require("./utils");
16
17
  /**
17
18
  * Call DynamoDb client get
18
19
  *
19
- * See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#get-property)
20
+ * See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)
20
21
  * for descriptions of `params` and the return data.
21
22
  *
22
23
  * @param {Object} params
23
24
  * @param {string} params.tableName - Table name to read
24
- * @param {AWS.DynamoDB.DocumentClient.Key} params.item - Key identifying object to get
25
- * @param {AWS.DynamoDB.DocumentClient} params.client - Instance of a DynamoDb DocumentClient
25
+ * @param {GetCommandInput.Key} params.item - Key identifying object to get
26
+ * @param {DynamoDBDocument} params.client - Instance of a DynamoDb DocumentClient
26
27
  * @param {Object} params.getParams - Additional parameters for DocumentClient.get()
27
28
  * @returns {Promise<Object>}
28
29
  * @throws {RecordDoesNotExist} if a record cannot be found
29
30
  */
30
- exports.get = (0, utils_1.improveStackTrace)(async (params) => {
31
+ const get = async (params) => {
31
32
  const { client, getParams = {}, item, tableName, } = params;
32
33
  const getResponse = await client.get({
33
34
  ...getParams,
34
35
  TableName: tableName,
35
36
  Key: item,
36
- }).promise();
37
+ });
37
38
  if (getResponse.Item)
38
39
  return getResponse.Item;
39
40
  throw new errors_1.RecordDoesNotExist(`No record found for ${JSON.stringify(item)} in ${tableName}`);
40
- });
41
+ };
42
+ exports.get = get;
41
43
  /**
42
44
  * Call DynamoDb client scan
43
45
  *
44
- * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#scan-property)
46
+ * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)
45
47
  * for descriptions of `params` and the return data.
46
48
  *
47
49
  * @param {Object} params
@@ -73,7 +75,7 @@ exports.scan = (0, utils_1.improveStackTrace)(async (params) => {
73
75
  if (startKey) {
74
76
  scanParams.ExclusiveStartKey = startKey;
75
77
  }
76
- const response = await client.scan(scanParams).promise();
78
+ const response = await client.scan(scanParams);
77
79
  // recursively go through all the records
78
80
  if (response.LastEvaluatedKey) {
79
81
  const more = await (0, exports.scan)({
@@ -98,21 +100,21 @@ exports.scan = (0, utils_1.improveStackTrace)(async (params) => {
98
100
  * Do a parallel scan of DynamoDB table using a document client.
99
101
  *
100
102
  * See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan.
101
- * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#scan-property).
103
+ * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html).
102
104
  *
103
105
  * @param {Object} params
104
106
  * @param {number} params.totalSegments
105
107
  * Total number of segments to divide table into for parallel scanning
106
- * @param {DocumentClient.ScanInput} params.scanParams
108
+ * @param {ScanInput} params.scanParams
107
109
  * Params for the DynamoDB client scan operation
108
110
  * See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
109
111
  * @param {function} params.processItemsFunc - Function used to process returned items by scan
110
- * @param {DocumentClient} [params.dynamoDbClient] - Instance of Dynamo DB document client
112
+ * @param {DynamoDBDocument} [params.dynamoDbClient] - Instance of Dynamo DB document client
111
113
  * @param {pRetry.Options} [params.retryOptions] - Retry options for scan operations
112
114
  * @returns {Promise}
113
115
  */
114
116
  const parallelScan = async (params) => {
115
- const { totalSegments, scanParams, processItemsFunc, dynamoDbClient = (0, services_1.dynamodbDocClient)(), retryOptions, } = params;
117
+ const { totalSegments, scanParams, processItemsFunc, dynamoDbClient, retryOptions, } = params;
116
118
  return await (0, p_map_1.default)((0, range_1.default)(totalSegments), async (_, segmentIndex) => {
117
119
  let exclusiveStartKey;
118
120
  const segmentScanParams = {
@@ -122,7 +124,7 @@ const parallelScan = async (params) => {
122
124
  };
123
125
  /* eslint-disable no-await-in-loop */
124
126
  do {
125
- const { Items = [], LastEvaluatedKey, } = await (0, p_retry_1.default)(() => dynamoDbClient.scan(segmentScanParams).promise(), retryOptions);
127
+ const { Items = [], LastEvaluatedKey, } = await (0, p_retry_1.default)(() => dynamoDbClient.scan(segmentScanParams), retryOptions);
126
128
  exclusiveStartKey = LastEvaluatedKey;
127
129
  segmentScanParams.ExclusiveStartKey = exclusiveStartKey;
128
130
  await processItemsFunc(Items);
@@ -138,14 +140,19 @@ exports.parallelScan = parallelScan;
138
140
  * Create a DynamoDB table and then wait for the table to exist
139
141
  *
140
142
  * @param {Object} params - the same params that you would pass to AWS.createTable
141
- * See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property
143
+ * See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#createtable
142
144
  * @returns {Promise<Object>} the output of the createTable call
143
145
  *
144
146
  * @static
145
147
  */
146
148
  async function createAndWaitForDynamoDbTable(params) {
147
- const createTableResult = await (0, services_1.dynamodb)().createTable(params).promise();
148
- await (0, services_1.dynamodb)().waitFor('tableExists', { TableName: params.TableName }).promise();
149
+ const dynamoDbClient = (0, services_1.dynamodb)();
150
+ const createTableResult = await dynamoDbClient.createTable(params);
151
+ await (0, client_dynamodb_1.waitUntilTableExists)({
152
+ client: dynamoDbClient,
153
+ minDelay: 1,
154
+ maxWaitTime: 3,
155
+ }, { TableName: params.TableName });
149
156
  return createTableResult;
150
157
  }
151
158
  exports.createAndWaitForDynamoDbTable = createAndWaitForDynamoDbTable;
@@ -153,14 +160,19 @@ exports.createAndWaitForDynamoDbTable = createAndWaitForDynamoDbTable;
153
160
  * Delete a DynamoDB table and then wait for the table to not exist
154
161
  *
155
162
  * @param {Object} params - the same params that you would pass to AWS.deleteTable
156
- * See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#deleteTable-property
163
+ * See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#deletetable
157
164
  * @returns {Promise}
158
165
  *
159
166
  * @static
160
167
  */
161
168
  async function deleteAndWaitForDynamoDbTableNotExists(params) {
162
- await (0, services_1.dynamodb)().deleteTable(params).promise();
163
- return (0, services_1.dynamodb)().waitFor('tableNotExists', { TableName: params.TableName }).promise();
169
+ const dynamoDbClient = (0, services_1.dynamodb)();
170
+ await dynamoDbClient.deleteTable(params);
171
+ await (0, client_dynamodb_1.waitUntilTableNotExists)({
172
+ client: dynamoDbClient,
173
+ minDelay: 1,
174
+ maxWaitTime: 3,
175
+ }, { TableName: params.TableName });
164
176
  }
165
177
  exports.deleteAndWaitForDynamoDbTableNotExists = deleteAndWaitForDynamoDbTableNotExists;
166
178
  //# sourceMappingURL=DynamoDb.js.map
@@ -83,12 +83,17 @@ class DynamoDbSearchQueue {
83
83
  async fetchItems() {
84
84
  let response;
85
85
  do {
86
- response = await this.dynamodbDocClient[this.searchType](this.params).promise(); // eslint-disable-line no-await-in-loop, max-len
87
- if (response.LastEvaluatedKey)
86
+ if (this.searchType === 'scan') {
87
+ response = await this.dynamodbDocClient.scan(this.params); // eslint-disable-line no-await-in-loop, max-len
88
+ }
89
+ else if (this.searchType === 'query') {
90
+ response = await this.dynamodbDocClient.query(this.params); // eslint-disable-line no-await-in-loop, max-len
91
+ }
92
+ if (response === null || response === void 0 ? void 0 : response.LastEvaluatedKey)
88
93
  this.params.ExclusiveStartKey = response.LastEvaluatedKey;
89
- } while ((response.Items || []).length === 0 && response.LastEvaluatedKey);
90
- this.items = (response.Items || []);
91
- if (!response.LastEvaluatedKey)
94
+ } while (((response === null || response === void 0 ? void 0 : response.Items) || []).length === 0 && (response === null || response === void 0 ? void 0 : response.LastEvaluatedKey));
95
+ this.items = ((response === null || response === void 0 ? void 0 : response.Items) || []);
96
+ if (!(response === null || response === void 0 ? void 0 : response.LastEvaluatedKey))
92
97
  this.items.push(null);
93
98
  }
94
99
  }
package/README.md CHANGED
@@ -143,41 +143,19 @@ Create a CloudWatch Events rule
143
143
 
144
144
  * [DynamoDb](#module_DynamoDb)
145
145
  * _static_
146
- * [.get](#module_DynamoDb.get) ⇒ <code>Promise.&lt;Object&gt;</code>
147
146
  * [.scan](#module_DynamoDb.scan) ⇒ <code>Promise.&lt;Object&gt;</code>
148
147
  * [.createAndWaitForDynamoDbTable(params)](#module_DynamoDb.createAndWaitForDynamoDbTable) ⇒ <code>Promise.&lt;Object&gt;</code>
149
148
  * [.deleteAndWaitForDynamoDbTableNotExists(params)](#module_DynamoDb.deleteAndWaitForDynamoDbTableNotExists) ⇒ <code>Promise</code>
150
149
  * _inner_
150
+ * [~get(params)](#module_DynamoDb..get) ⇒ <code>Promise.&lt;Object&gt;</code>
151
151
  * [~parallelScan(params)](#module_DynamoDb..parallelScan) ⇒ <code>Promise</code>
152
152
 
153
- <a name="module_DynamoDb.get"></a>
154
-
155
- ### DynamoDb.get ⇒ <code>Promise.&lt;Object&gt;</code>
156
- Call DynamoDb client get
157
-
158
- See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#get-property)
159
- for descriptions of `params` and the return data.
160
-
161
- **Kind**: static property of [<code>DynamoDb</code>](#module_DynamoDb)
162
- **Throws**:
163
-
164
- - <code>RecordDoesNotExist</code> if a record cannot be found
165
-
166
-
167
- | Param | Type | Description |
168
- | --- | --- | --- |
169
- | params | <code>Object</code> | |
170
- | params.tableName | <code>string</code> | Table name to read |
171
- | params.item | <code>AWS.DynamoDB.DocumentClient.Key</code> | Key identifying object to get |
172
- | params.client | <code>AWS.DynamoDB.DocumentClient</code> | Instance of a DynamoDb DocumentClient |
173
- | params.getParams | <code>Object</code> | Additional parameters for DocumentClient.get() |
174
-
175
153
  <a name="module_DynamoDb.scan"></a>
176
154
 
177
155
  ### DynamoDb.scan ⇒ <code>Promise.&lt;Object&gt;</code>
178
156
  Call DynamoDb client scan
179
157
 
180
- See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#scan-property)
158
+ See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)
181
159
  for descriptions of `params` and the return data.
182
160
 
183
161
  **Kind**: static property of [<code>DynamoDb</code>](#module_DynamoDb)
@@ -196,7 +174,7 @@ Create a DynamoDB table and then wait for the table to exist
196
174
 
197
175
  | Param | Type | Description |
198
176
  | --- | --- | --- |
199
- | params | <code>Object</code> | the same params that you would pass to AWS.createTable See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property |
177
+ | params | <code>Object</code> | the same params that you would pass to AWS.createTable See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#createtable |
200
178
 
201
179
  <a name="module_DynamoDb.deleteAndWaitForDynamoDbTableNotExists"></a>
202
180
 
@@ -207,7 +185,29 @@ Delete a DynamoDB table and then wait for the table to not exist
207
185
 
208
186
  | Param | Type | Description |
209
187
  | --- | --- | --- |
210
- | params | <code>Object</code> | the same params that you would pass to AWS.deleteTable See https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#deleteTable-property |
188
+ | params | <code>Object</code> | the same params that you would pass to AWS.deleteTable See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#deletetable |
189
+
190
+ <a name="module_DynamoDb..get"></a>
191
+
192
+ ### DynamoDb~get(params) ⇒ <code>Promise.&lt;Object&gt;</code>
193
+ Call DynamoDb client get
194
+
195
+ See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)
196
+ for descriptions of `params` and the return data.
197
+
198
+ **Kind**: inner method of [<code>DynamoDb</code>](#module_DynamoDb)
199
+ **Throws**:
200
+
201
+ - <code>RecordDoesNotExist</code> if a record cannot be found
202
+
203
+
204
+ | Param | Type | Description |
205
+ | --- | --- | --- |
206
+ | params | <code>Object</code> | |
207
+ | params.tableName | <code>string</code> | Table name to read |
208
+ | params.item | <code>GetCommandInput.Key</code> | Key identifying object to get |
209
+ | params.client | <code>DynamoDBDocument</code> | Instance of a DynamoDb DocumentClient |
210
+ | params.getParams | <code>Object</code> | Additional parameters for DocumentClient.get() |
211
211
 
212
212
  <a name="module_DynamoDb..parallelScan"></a>
213
213
 
@@ -215,7 +215,7 @@ Delete a DynamoDB table and then wait for the table to not exist
215
215
  Do a parallel scan of DynamoDB table using a document client.
216
216
 
217
217
  See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan.
218
- See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#scan-property).
218
+ See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html).
219
219
 
220
220
  **Kind**: inner method of [<code>DynamoDb</code>](#module_DynamoDb)
221
221
 
@@ -223,9 +223,9 @@ See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/
223
223
  | --- | --- | --- |
224
224
  | params | <code>Object</code> | |
225
225
  | params.totalSegments | <code>number</code> | Total number of segments to divide table into for parallel scanning |
226
- | params.scanParams | <code>DocumentClient.ScanInput</code> | Params for the DynamoDB client scan operation See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html |
226
+ | params.scanParams | <code>ScanInput</code> | Params for the DynamoDB client scan operation See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html |
227
227
  | params.processItemsFunc | <code>function</code> | Function used to process returned items by scan |
228
- | [params.dynamoDbClient] | <code>DocumentClient</code> | Instance of Dynamo DB document client |
228
+ | [params.dynamoDbClient] | <code>DynamoDBDocument</code> | Instance of Dynamo DB document client |
229
229
  | [params.retryOptions] | <code>pRetry.Options</code> | Retry options for scan operations |
230
230
 
231
231
  <a name="module_KMS"></a>
package/SNS.js CHANGED
@@ -31,7 +31,7 @@ const publishSnsMessage = async (snsTopicArn, message, retryOptions = {}) => awa
31
31
  }).promise();
32
32
  }, {
33
33
  maxTimeout: 5000,
34
- onFailedAttempt: (err) => log.debug(`publishSnsMessage('${snsTopicArn}', '${message}') failed with ${err.retriesLeft} retries left: ${err.message}`),
34
+ onFailedAttempt: (err) => log.debug(`publishSnsMessage('${snsTopicArn}', '${JSON.stringify(message)}') failed with ${err.retriesLeft} retries left: ${JSON.stringify(err)}`),
35
35
  ...retryOptions,
36
36
  });
37
37
  exports.publishSnsMessage = publishSnsMessage;
package/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import AWS from 'aws-sdk';
1
+ import { AWSClientTypes } from './types';
2
2
  /**
3
3
  * Return a function which, when called, will return an AWS service object
4
4
  *
@@ -14,6 +14,6 @@ import AWS from 'aws-sdk';
14
14
  *
15
15
  * @private
16
16
  */
17
- declare const awsClient: <T extends AWS.Service | AWS.DynamoDB.DocumentClient>(Service: new (params: object) => T, version?: string | undefined, serviceOptions?: object | undefined) => (options?: object | undefined) => T;
17
+ declare const awsClient: <T extends AWSClientTypes>(Service: new (params: object) => T, version?: string | undefined, serviceOptions?: object | undefined) => (params?: object | undefined) => T;
18
18
  export = awsClient;
19
19
  //# sourceMappingURL=client.d.ts.map
package/client.js CHANGED
@@ -3,21 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  const aws_sdk_1 = __importDefault(require("aws-sdk"));
6
+ const mem_1 = __importDefault(require("mem"));
6
7
  const test_utils_1 = require("./test-utils");
8
+ const utils_1 = require("./utils");
7
9
  const noop = () => { }; // eslint-disable-line lodash/prefer-noop
8
10
  const getRegion = () => process.env.AWS_DEFAULT_REGION || process.env.AWS_REGION || 'us-east-1';
9
11
  // Workaround upload hangs. See: https://github.com/andrewrk/node-s3-client/issues/74
10
12
  // @ts-ignore - AWS.util is not part of the public API and may break
11
13
  aws_sdk_1.default.util.update(aws_sdk_1.default.S3.prototype, { addExpect100Continue: noop });
12
14
  aws_sdk_1.default.config.setPromisesDependency(Promise);
13
- const memoize = (fn) => {
14
- let memo;
15
- return (options) => {
16
- if (!memo)
17
- memo = fn(options);
18
- return memo;
19
- };
15
+ const buildServiceClient = (Service, options) => {
16
+ if ((0, test_utils_1.inTestMode)()) {
17
+ return new Service((0, test_utils_1.getLocalstackAwsClientOptions)(Service, options));
18
+ }
19
+ return new Service(options);
20
20
  };
21
+ const getMemoizedClient = (0, mem_1.default)(buildServiceClient, {
22
+ cacheKey: (arguments_) => `${(0, utils_1.getServiceIdentifer)(arguments_[0])}${JSON.stringify(arguments_[1])}`,
23
+ });
24
+ const getServiceClient = (Service, options = {}) => (overrides) => getMemoizedClient(Service, Object.assign(options, overrides));
21
25
  /**
22
26
  * Return a function which, when called, will return an AWS service object
23
27
  *
@@ -44,11 +48,10 @@ const awsClient = (Service, version, serviceOptions) => {
44
48
  // @ts-ignore - serviceIdentifier is not part of the public API and may break at any time
45
49
  if (aws_sdk_1.default.DynamoDB.DocumentClient.serviceIdentifier === undefined) {
46
50
  // @ts-ignore - serviceIdentifier is not part of the public API and may break at any time
47
- aws_sdk_1.default.DynamoDB.DocumentClient.serviceIdentifier = 'dynamodb';
51
+ aws_sdk_1.default.DynamoDB.DocumentClient.serviceIdentifier = 'dynamodbclient';
48
52
  }
49
- return memoize((o) => (0, test_utils_1.testAwsClient)(Service, Object.assign(options, o)));
50
53
  }
51
- return memoize((o) => new Service(Object.assign(options, o)));
54
+ return getServiceClient(Service, options);
52
55
  };
53
56
  module.exports = awsClient;
54
57
  //# sourceMappingURL=client.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/aws-client",
3
- "version": "10.1.2",
3
+ "version": "11.1.0",
4
4
  "description": "Utilities for working with AWS",
5
5
  "keywords": [
6
6
  "GIBS",
@@ -43,17 +43,22 @@
43
43
  "author": "Cumulus Authors",
44
44
  "license": "Apache-2.0",
45
45
  "dependencies": {
46
- "@cumulus/checksum": "10.1.2",
47
- "@cumulus/errors": "10.1.2",
48
- "@cumulus/logger": "10.1.2",
49
- "aws-sdk": "^2.814.0",
46
+ "@aws-sdk/client-dynamodb": "^3.53.0",
47
+ "@aws-sdk/client-dynamodb-streams": "^3.53.0",
48
+ "@aws-sdk/lib-dynamodb": "^3.53.0",
49
+ "@aws-sdk/types": "^3.53.0",
50
+ "@cumulus/checksum": "11.1.0",
51
+ "@cumulus/errors": "11.1.0",
52
+ "@cumulus/logger": "11.1.0",
53
+ "aws-sdk": "^2.585.0",
50
54
  "jsonpath-plus": "^1.1.0",
51
55
  "lodash": "~4.17.21",
56
+ "mem": "^8.0.2",
52
57
  "p-map": "^1.2.0",
53
58
  "p-retry": "^4.2.0",
54
59
  "p-timeout": "^4.1.0",
55
60
  "p-wait-for": "^3.2.0",
56
61
  "pump": "^3.0.0"
57
62
  },
58
- "gitHead": "3b59753fa85064549b70ad8ed4a4ee213c5af313"
63
+ "gitHead": "a846e319e143684ebc408e35f8b51cc1a7195391"
59
64
  }
package/services.d.ts CHANGED
@@ -1,23 +1,26 @@
1
+ import { DynamoDB } from '@aws-sdk/client-dynamodb';
2
+ import { DynamoDBStreamsClient } from '@aws-sdk/client-dynamodb-streams';
3
+ import { DynamoDBDocument, TranslateConfig } from '@aws-sdk/lib-dynamodb';
1
4
  import * as AWS from 'aws-sdk';
2
- export declare const apigateway: (options?: object | undefined) => AWS.APIGateway;
3
- export declare const ecs: (options?: object | undefined) => AWS.ECS;
4
- export declare const ec2: (options?: object | undefined) => AWS.EC2;
5
- export declare const s3: (options?: object | undefined) => AWS.S3;
6
- export declare const kinesis: (options?: object | undefined) => AWS.Kinesis;
7
- export declare const lambda: (options?: object | undefined) => AWS.Lambda;
8
- export declare const sqs: (options?: object | undefined) => AWS.SQS;
9
- export declare const cloudwatchevents: (options?: object | undefined) => AWS.CloudWatchEvents;
10
- export declare const cloudwatchlogs: (options?: object | undefined) => AWS.CloudWatchLogs;
11
- export declare const cloudwatch: (options?: object | undefined) => AWS.CloudWatch;
12
- export declare const dynamodb: (options?: object | undefined) => AWS.DynamoDB;
13
- export declare const dynamodbstreams: (options?: object | undefined) => AWS.DynamoDBStreams;
14
- export declare const dynamodbDocClient: (options?: object | undefined) => AWS.DynamoDB.DocumentClient;
15
- export declare const sfn: (options?: object | undefined) => AWS.StepFunctions;
16
- export declare const cf: (options?: object | undefined) => AWS.CloudFormation;
17
- export declare const sns: (options?: object | undefined) => AWS.SNS;
18
- export declare const secretsManager: (options?: object | undefined) => AWS.SecretsManager;
19
- export declare const systemsManager: (options?: object | undefined) => AWS.SSM;
20
- export declare const kms: (options?: object | undefined) => AWS.KMS;
21
- export declare const es: (options?: object | undefined) => AWS.ES;
22
- export declare const sts: (options?: object | undefined) => AWS.STS;
5
+ export declare const apigateway: (params?: object | undefined) => AWS.APIGateway;
6
+ export declare const ecs: (params?: object | undefined) => AWS.ECS;
7
+ export declare const ec2: (params?: object | undefined) => AWS.EC2;
8
+ export declare const s3: (params?: object | undefined) => AWS.S3;
9
+ export declare const kinesis: (params?: object | undefined) => AWS.Kinesis;
10
+ export declare const lambda: (params?: object | undefined) => AWS.Lambda;
11
+ export declare const sqs: (params?: object | undefined) => AWS.SQS;
12
+ export declare const cloudwatchevents: (params?: object | undefined) => AWS.CloudWatchEvents;
13
+ export declare const cloudwatchlogs: (params?: object | undefined) => AWS.CloudWatchLogs;
14
+ export declare const cloudwatch: (params?: object | undefined) => AWS.CloudWatch;
15
+ export declare const dynamodb: (params?: object | undefined) => DynamoDB;
16
+ export declare const dynamodbstreams: (params?: object | undefined) => DynamoDBStreamsClient;
17
+ export declare const dynamodbDocClient: (docClientOptions?: TranslateConfig | undefined, dynamoOptions?: object | undefined) => DynamoDBDocument;
18
+ export declare const sfn: (params?: object | undefined) => AWS.StepFunctions;
19
+ export declare const cf: (params?: object | undefined) => AWS.CloudFormation;
20
+ export declare const sns: (params?: object | undefined) => AWS.SNS;
21
+ export declare const secretsManager: (params?: object | undefined) => AWS.SecretsManager;
22
+ export declare const systemsManager: (params?: object | undefined) => AWS.SSM;
23
+ export declare const kms: (params?: object | undefined) => AWS.KMS;
24
+ export declare const es: (params?: object | undefined) => AWS.ES;
25
+ export declare const sts: (params?: object | undefined) => AWS.STS;
23
26
  //# sourceMappingURL=services.d.ts.map
package/services.js CHANGED
@@ -22,29 +22,36 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.sts = exports.es = exports.kms = exports.systemsManager = exports.secretsManager = exports.sns = exports.cf = exports.sfn = exports.dynamodbDocClient = exports.dynamodbstreams = exports.dynamodb = exports.cloudwatch = exports.cloudwatchlogs = exports.cloudwatchevents = exports.sqs = exports.lambda = exports.kinesis = exports.s3 = exports.ec2 = exports.ecs = exports.apigateway = void 0;
30
+ const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
31
+ const client_dynamodb_streams_1 = require("@aws-sdk/client-dynamodb-streams");
32
+ const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
27
33
  const AWS = __importStar(require("aws-sdk"));
28
- const awsClient = require("./client");
29
- exports.apigateway = awsClient(AWS.APIGateway, '2015-07-09');
30
- exports.ecs = awsClient(AWS.ECS, '2014-11-13');
31
- exports.ec2 = awsClient(AWS.EC2, '2016-11-15');
32
- exports.s3 = awsClient(AWS.S3, '2006-03-01');
33
- exports.kinesis = awsClient(AWS.Kinesis, '2013-12-02');
34
- exports.lambda = awsClient(AWS.Lambda, '2015-03-31');
35
- exports.sqs = awsClient(AWS.SQS, '2012-11-05');
36
- exports.cloudwatchevents = awsClient(AWS.CloudWatchEvents, '2014-02-03');
37
- exports.cloudwatchlogs = awsClient(AWS.CloudWatchLogs, '2014-03-28');
38
- exports.cloudwatch = awsClient(AWS.CloudWatch, '2010-08-01');
39
- exports.dynamodb = awsClient(AWS.DynamoDB, '2012-08-10');
40
- exports.dynamodbstreams = awsClient(AWS.DynamoDBStreams, '2012-08-10');
41
- exports.dynamodbDocClient = awsClient(AWS.DynamoDB.DocumentClient, '2012-08-10');
42
- exports.sfn = awsClient(AWS.StepFunctions, '2016-11-23');
43
- exports.cf = awsClient(AWS.CloudFormation, '2010-05-15');
44
- exports.sns = awsClient(AWS.SNS, '2010-03-31');
45
- exports.secretsManager = awsClient(AWS.SecretsManager, '2017-10-17');
46
- exports.systemsManager = awsClient(AWS.SSM, '2017-10-17');
47
- exports.kms = awsClient(AWS.KMS, '2014-11-01');
48
- exports.es = awsClient(AWS.ES, '2015-01-01');
49
- exports.sts = awsClient(AWS.STS, '2011-06-15');
34
+ const client_1 = __importDefault(require("./client"));
35
+ exports.apigateway = (0, client_1.default)(AWS.APIGateway, '2015-07-09');
36
+ exports.ecs = (0, client_1.default)(AWS.ECS, '2014-11-13');
37
+ exports.ec2 = (0, client_1.default)(AWS.EC2, '2016-11-15');
38
+ exports.s3 = (0, client_1.default)(AWS.S3, '2006-03-01');
39
+ exports.kinesis = (0, client_1.default)(AWS.Kinesis, '2013-12-02');
40
+ exports.lambda = (0, client_1.default)(AWS.Lambda, '2015-03-31');
41
+ exports.sqs = (0, client_1.default)(AWS.SQS, '2012-11-05');
42
+ exports.cloudwatchevents = (0, client_1.default)(AWS.CloudWatchEvents, '2014-02-03');
43
+ exports.cloudwatchlogs = (0, client_1.default)(AWS.CloudWatchLogs, '2014-03-28');
44
+ exports.cloudwatch = (0, client_1.default)(AWS.CloudWatch, '2010-08-01');
45
+ exports.dynamodb = (0, client_1.default)(client_dynamodb_1.DynamoDB, '2012-08-10');
46
+ exports.dynamodbstreams = (0, client_1.default)(client_dynamodb_streams_1.DynamoDBStreamsClient, '2012-08-10');
47
+ const dynamodbDocClient = (docClientOptions, dynamoOptions) => lib_dynamodb_1.DynamoDBDocument.from((0, client_1.default)(client_dynamodb_1.DynamoDB, '2012-08-10')(dynamoOptions), docClientOptions);
48
+ exports.dynamodbDocClient = dynamodbDocClient;
49
+ exports.sfn = (0, client_1.default)(AWS.StepFunctions, '2016-11-23');
50
+ exports.cf = (0, client_1.default)(AWS.CloudFormation, '2010-05-15');
51
+ exports.sns = (0, client_1.default)(AWS.SNS, '2010-03-31');
52
+ exports.secretsManager = (0, client_1.default)(AWS.SecretsManager, '2017-10-17');
53
+ exports.systemsManager = (0, client_1.default)(AWS.SSM, '2017-10-17');
54
+ exports.kms = (0, client_1.default)(AWS.KMS, '2014-11-01');
55
+ exports.es = (0, client_1.default)(AWS.ES, '2015-01-01');
56
+ exports.sts = (0, client_1.default)(AWS.STS, '2011-06-15');
50
57
  //# sourceMappingURL=services.js.map
package/test-utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as AWS from 'aws-sdk';
1
+ import { AWSClientTypes } from './types';
2
2
  export declare const inTestMode: () => boolean;
3
3
  declare const localStackPorts: {
4
4
  stepfunctions: number;
@@ -7,7 +7,11 @@ declare const localStackPorts: {
7
7
  cloudwatch: number;
8
8
  cloudwatchevents: number;
9
9
  cloudwatchlogs: number;
10
- dynamodb: number;
10
+ DynamoDB: number;
11
+ DynamoDBClient: number;
12
+ DynamoDBStreamsClient: number;
13
+ ec2: number;
14
+ ecs: number;
11
15
  es: number;
12
16
  firehose: number;
13
17
  iam: number;
@@ -33,6 +37,20 @@ declare const localStackPorts: {
33
37
  * @private
34
38
  */
35
39
  export declare function getLocalstackEndpoint(identifier: keyof typeof localStackPorts): string;
40
+ /**
41
+ * Create an AWS service object that talks to LocalStack.
42
+ *
43
+ * This function expects that the LOCALSTACK_HOST environment variable will be set.
44
+ *
45
+ * @param {Function} Service - an AWS service object constructor function
46
+ * @param {Object} options - options to pass to the service object constructor function
47
+ * @returns {Object} an AWS service object
48
+ *
49
+ * @private
50
+ */
51
+ export declare function localStackAwsClientOptions<T>(Service: new (params: object) => T, options?: object): {
52
+ [key: string]: unknown;
53
+ };
36
54
  /**
37
55
  * Create an AWS service object that does not actually talk to AWS.
38
56
  *
@@ -42,7 +60,7 @@ export declare function getLocalstackEndpoint(identifier: keyof typeof localStac
42
60
  *
43
61
  * @private
44
62
  */
45
- export declare function testAwsClient<T extends AWS.Service | AWS.DynamoDB.DocumentClient>(Service: new (params: object) => T, options: object): T;
63
+ export declare function getLocalstackAwsClientOptions<T extends AWSClientTypes>(Service: new (params: object) => T, options?: object): object;
46
64
  /**
47
65
  * Return a function that throws a ThrottlingException the first time it is called, then returns as
48
66
  * normal any other times.
package/test-utils.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throttleOnce = exports.testAwsClient = exports.getLocalstackEndpoint = exports.inTestMode = void 0;
3
+ exports.throttleOnce = exports.getLocalstackAwsClientOptions = exports.localStackAwsClientOptions = exports.getLocalstackEndpoint = exports.inTestMode = void 0;
4
4
  const errors_1 = require("@cumulus/errors");
5
+ const utils_1 = require("./utils");
5
6
  const inTestMode = () => process.env.NODE_ENV === 'test';
6
7
  exports.inTestMode = inTestMode;
7
8
  // From https://github.com/localstack/localstack/blob/master/README.md
@@ -12,7 +13,11 @@ const localStackPorts = {
12
13
  cloudwatch: 4566,
13
14
  cloudwatchevents: 4566,
14
15
  cloudwatchlogs: 4566,
15
- dynamodb: 4566,
16
+ DynamoDB: 4566,
17
+ DynamoDBClient: 4566,
18
+ DynamoDBStreamsClient: 4566,
19
+ ec2: 4566,
20
+ ecs: 4566,
16
21
  es: 4566,
17
22
  firehose: 4566,
18
23
  iam: 4566,
@@ -68,23 +73,25 @@ exports.getLocalstackEndpoint = getLocalstackEndpoint;
68
73
  *
69
74
  * @private
70
75
  */
71
- function localStackAwsClient(Service, options) {
76
+ function localStackAwsClientOptions(Service, options = {}) {
72
77
  if (!process.env.LOCALSTACK_HOST) {
73
78
  throw new Error('The LOCALSTACK_HOST environment variable is not set.');
74
79
  }
75
- // @ts-ignore
76
- const serviceIdentifier = Service.serviceIdentifier;
80
+ const serviceIdentifier = (0, utils_1.getServiceIdentifer)(Service);
77
81
  const localStackOptions = {
78
82
  ...options,
79
- accessKeyId: 'my-access-key-id',
80
- secretAccessKey: 'my-secret-access-key',
83
+ credentials: {
84
+ accessKeyId: 'my-access-key-id',
85
+ secretAccessKey: 'my-secret-access-key',
86
+ },
81
87
  region: 'us-east-1',
82
88
  endpoint: getLocalstackEndpoint(serviceIdentifier),
83
89
  };
84
- if (serviceIdentifier === 's3')
90
+ if (serviceIdentifier.toLowerCase() === 's3')
85
91
  localStackOptions.s3ForcePathStyle = true;
86
- return new Service(localStackOptions);
92
+ return localStackOptions;
87
93
  }
94
+ exports.localStackAwsClientOptions = localStackAwsClientOptions;
88
95
  /**
89
96
  * Create an AWS service object that does not actually talk to AWS.
90
97
  *
@@ -94,15 +101,14 @@ function localStackAwsClient(Service, options) {
94
101
  *
95
102
  * @private
96
103
  */
97
- function testAwsClient(Service, options) {
98
- // @ts-ignore
99
- const serviceIdentifier = Service.serviceIdentifier;
104
+ function getLocalstackAwsClientOptions(Service, options) {
105
+ const serviceIdentifier = (0, utils_1.getServiceIdentifer)(Service);
100
106
  if (localstackSupportedService(serviceIdentifier)) {
101
- return localStackAwsClient(Service, options);
107
+ return localStackAwsClientOptions(Service, options);
102
108
  }
103
109
  return {};
104
110
  }
105
- exports.testAwsClient = testAwsClient;
111
+ exports.getLocalstackAwsClientOptions = getLocalstackAwsClientOptions;
106
112
  /**
107
113
  * Return a function that throws a ThrottlingException the first time it is called, then returns as
108
114
  * normal any other times.
package/types.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import * as AWS from 'aws-sdk';
2
+ import { DynamoDBStreamsClient } from '@aws-sdk/client-dynamodb-streams';
3
+ import { DynamoDB, DynamoDBClient } from '@aws-sdk/client-dynamodb';
4
+ export declare type AWSClientTypes = DynamoDB | DynamoDBClient | DynamoDBStreamsClient | AWS.Service | AWS.DynamoDB.DocumentClient;
5
+ //# sourceMappingURL=types.d.ts.map
package/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
package/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import pRetry from 'p-retry';
2
+ export declare const getServiceIdentifer: (service: any) => any;
2
3
  export declare const setErrorStack: (error: Error, newStack: string) => void;
3
4
  /**
4
5
  * Wrap a function and provide a better stack trace
package/utils.js CHANGED
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.retryOnThrottlingException = exports.improveStackTrace = exports.setErrorStack = void 0;
6
+ exports.retryOnThrottlingException = exports.improveStackTrace = exports.setErrorStack = exports.getServiceIdentifer = void 0;
7
7
  const p_retry_1 = __importDefault(require("p-retry"));
8
8
  const errors_1 = require("@cumulus/errors");
9
+ const getServiceIdentifer = (service) => service.serviceIdentifier || service.name;
10
+ exports.getServiceIdentifer = getServiceIdentifer;
9
11
  // Replace the stack of an error
10
12
  // Note: This mutates the error that was passed in.
11
13
  const setErrorStack = (error, newStack) => {