@cumulus/aws-client 11.0.0 → 11.1.0-alpha1
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 +27 -24
- package/DynamoDb.js +31 -19
- package/DynamoDbSearchQueue.js +10 -5
- package/S3.js +1 -5
- package/S3ObjectStore.js +1 -5
- package/SQS.js +1 -5
- package/client.d.ts +2 -2
- package/client.js +13 -10
- package/index.js +1 -5
- package/package.json +8 -4
- package/services.d.ts +24 -21
- package/services.js +30 -27
- package/test-utils.d.ts +21 -3
- package/test-utils.js +20 -14
- package/types.d.ts +5 -0
- package/types.js +3 -0
- package/utils.d.ts +1 -0
- package/utils.js +3 -1
- package/LICENSE +0 -60
package/DynamoDb.d.ts
CHANGED
|
@@ -2,31 +2,34 @@
|
|
|
2
2
|
* @module DynamoDb
|
|
3
3
|
*/
|
|
4
4
|
import pRetry from 'p-retry';
|
|
5
|
-
import {
|
|
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/
|
|
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 {
|
|
15
|
-
* @param {
|
|
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:
|
|
23
|
-
client:
|
|
24
|
-
getParams?: object
|
|
25
|
-
}) => Promise<
|
|
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/
|
|
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:
|
|
40
|
+
client: DynamoDBDocument;
|
|
38
41
|
query?: {
|
|
39
42
|
filter?: string | undefined;
|
|
40
|
-
names?:
|
|
41
|
-
values?:
|
|
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?:
|
|
47
|
-
}) => Promise<
|
|
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/
|
|
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 {
|
|
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 {
|
|
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:
|
|
68
|
-
processItemsFunc: (items:
|
|
69
|
-
dynamoDbClient
|
|
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/
|
|
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:
|
|
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/
|
|
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:
|
|
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/
|
|
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 {
|
|
25
|
-
* @param {
|
|
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
|
-
|
|
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
|
-
})
|
|
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/
|
|
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)
|
|
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/
|
|
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 {
|
|
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 {
|
|
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
|
|
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)
|
|
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/
|
|
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
|
|
148
|
-
|
|
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/
|
|
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
|
-
|
|
163
|
-
|
|
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
|
package/DynamoDbSearchQueue.js
CHANGED
|
@@ -83,12 +83,17 @@ class DynamoDbSearchQueue {
|
|
|
83
83
|
async fetchItems() {
|
|
84
84
|
let response;
|
|
85
85
|
do {
|
|
86
|
-
|
|
87
|
-
|
|
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/S3.js
CHANGED
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
|
-
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
7
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
8
|
}) : (function(o, m, k, k2) {
|
|
13
9
|
if (k2 === undefined) k2 = k;
|
|
14
10
|
o[k2] = m[k];
|
package/S3ObjectStore.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
package/SQS.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
package/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 = '
|
|
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
|
|
54
|
+
return getServiceClient(Service, options);
|
|
52
55
|
};
|
|
53
56
|
module.exports = awsClient;
|
|
54
57
|
//# sourceMappingURL=client.js.map
|
package/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/aws-client",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0-alpha1",
|
|
4
4
|
"description": "Utilities for working with AWS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -43,17 +43,21 @@
|
|
|
43
43
|
"author": "Cumulus Authors",
|
|
44
44
|
"license": "Apache-2.0",
|
|
45
45
|
"dependencies": {
|
|
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
|
+
"aws-sdk": "^2.585.0",
|
|
46
51
|
"@cumulus/checksum": "11.0.0",
|
|
47
52
|
"@cumulus/errors": "11.0.0",
|
|
48
53
|
"@cumulus/logger": "11.0.0",
|
|
49
|
-
"aws-sdk": "^2.814.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
|
-
}
|
|
58
|
-
"gitHead": "e922ad12fd94affa6cd60a97a184a465a756c50b"
|
|
62
|
+
}
|
|
59
63
|
}
|
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: (
|
|
3
|
-
export declare const ecs: (
|
|
4
|
-
export declare const ec2: (
|
|
5
|
-
export declare const s3: (
|
|
6
|
-
export declare const kinesis: (
|
|
7
|
-
export declare const lambda: (
|
|
8
|
-
export declare const sqs: (
|
|
9
|
-
export declare const cloudwatchevents: (
|
|
10
|
-
export declare const cloudwatchlogs: (
|
|
11
|
-
export declare const cloudwatch: (
|
|
12
|
-
export declare const dynamodb: (
|
|
13
|
-
export declare const dynamodbstreams: (
|
|
14
|
-
export declare const dynamodbDocClient: (
|
|
15
|
-
export declare const sfn: (
|
|
16
|
-
export declare const cf: (
|
|
17
|
-
export declare const sns: (
|
|
18
|
-
export declare const secretsManager: (
|
|
19
|
-
export declare const systemsManager: (
|
|
20
|
-
export declare const kms: (
|
|
21
|
-
export declare const es: (
|
|
22
|
-
export declare const 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
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -22,29 +18,36 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
18
|
__setModuleDefault(result, mod);
|
|
23
19
|
return result;
|
|
24
20
|
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
25
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
25
|
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;
|
|
26
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
27
|
+
const client_dynamodb_streams_1 = require("@aws-sdk/client-dynamodb-streams");
|
|
28
|
+
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
27
29
|
const AWS = __importStar(require("aws-sdk"));
|
|
28
|
-
const
|
|
29
|
-
exports.apigateway =
|
|
30
|
-
exports.ecs =
|
|
31
|
-
exports.ec2 =
|
|
32
|
-
exports.s3 =
|
|
33
|
-
exports.kinesis =
|
|
34
|
-
exports.lambda =
|
|
35
|
-
exports.sqs =
|
|
36
|
-
exports.cloudwatchevents =
|
|
37
|
-
exports.cloudwatchlogs =
|
|
38
|
-
exports.cloudwatch =
|
|
39
|
-
exports.dynamodb =
|
|
40
|
-
exports.dynamodbstreams =
|
|
41
|
-
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
30
|
+
const client_1 = __importDefault(require("./client"));
|
|
31
|
+
exports.apigateway = (0, client_1.default)(AWS.APIGateway, '2015-07-09');
|
|
32
|
+
exports.ecs = (0, client_1.default)(AWS.ECS, '2014-11-13');
|
|
33
|
+
exports.ec2 = (0, client_1.default)(AWS.EC2, '2016-11-15');
|
|
34
|
+
exports.s3 = (0, client_1.default)(AWS.S3, '2006-03-01');
|
|
35
|
+
exports.kinesis = (0, client_1.default)(AWS.Kinesis, '2013-12-02');
|
|
36
|
+
exports.lambda = (0, client_1.default)(AWS.Lambda, '2015-03-31');
|
|
37
|
+
exports.sqs = (0, client_1.default)(AWS.SQS, '2012-11-05');
|
|
38
|
+
exports.cloudwatchevents = (0, client_1.default)(AWS.CloudWatchEvents, '2014-02-03');
|
|
39
|
+
exports.cloudwatchlogs = (0, client_1.default)(AWS.CloudWatchLogs, '2014-03-28');
|
|
40
|
+
exports.cloudwatch = (0, client_1.default)(AWS.CloudWatch, '2010-08-01');
|
|
41
|
+
exports.dynamodb = (0, client_1.default)(client_dynamodb_1.DynamoDB, '2012-08-10');
|
|
42
|
+
exports.dynamodbstreams = (0, client_1.default)(client_dynamodb_streams_1.DynamoDBStreamsClient, '2012-08-10');
|
|
43
|
+
const dynamodbDocClient = (docClientOptions, dynamoOptions) => lib_dynamodb_1.DynamoDBDocument.from((0, client_1.default)(client_dynamodb_1.DynamoDB, '2012-08-10')(dynamoOptions), docClientOptions);
|
|
44
|
+
exports.dynamodbDocClient = dynamodbDocClient;
|
|
45
|
+
exports.sfn = (0, client_1.default)(AWS.StepFunctions, '2016-11-23');
|
|
46
|
+
exports.cf = (0, client_1.default)(AWS.CloudFormation, '2010-05-15');
|
|
47
|
+
exports.sns = (0, client_1.default)(AWS.SNS, '2010-03-31');
|
|
48
|
+
exports.secretsManager = (0, client_1.default)(AWS.SecretsManager, '2017-10-17');
|
|
49
|
+
exports.systemsManager = (0, client_1.default)(AWS.SSM, '2017-10-17');
|
|
50
|
+
exports.kms = (0, client_1.default)(AWS.KMS, '2014-11-01');
|
|
51
|
+
exports.es = (0, client_1.default)(AWS.ES, '2015-01-01');
|
|
52
|
+
exports.sts = (0, client_1.default)(AWS.STS, '2011-06-15');
|
|
50
53
|
//# sourceMappingURL=services.js.map
|
package/test-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
76
|
-
const serviceIdentifier = Service.serviceIdentifier;
|
|
80
|
+
const serviceIdentifier = (0, utils_1.getServiceIdentifer)(Service);
|
|
77
81
|
const localStackOptions = {
|
|
78
82
|
...options,
|
|
79
|
-
|
|
80
|
-
|
|
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
|
|
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
|
|
98
|
-
|
|
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
|
|
107
|
+
return localStackAwsClientOptions(Service, options);
|
|
102
108
|
}
|
|
103
109
|
return {};
|
|
104
110
|
}
|
|
105
|
-
exports.
|
|
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
package/utils.d.ts
CHANGED
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) => {
|
package/LICENSE
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
Copyright © 2020 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
4
|
-
You may obtain a copy of the License at
|
|
5
|
-
|
|
6
|
-
http://www.apache.org/licenses/LICE NSE-2.0
|
|
7
|
-
|
|
8
|
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
14
|
-
|
|
15
|
-
1. Definitions.
|
|
16
|
-
|
|
17
|
-
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
18
|
-
|
|
19
|
-
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
20
|
-
|
|
21
|
-
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
24
|
-
|
|
25
|
-
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
26
|
-
|
|
27
|
-
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
28
|
-
|
|
29
|
-
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
30
|
-
|
|
31
|
-
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
32
|
-
|
|
33
|
-
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
34
|
-
|
|
35
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
36
|
-
|
|
37
|
-
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
38
|
-
|
|
39
|
-
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
40
|
-
|
|
41
|
-
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
42
|
-
|
|
43
|
-
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
44
|
-
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
45
|
-
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
46
|
-
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
47
|
-
|
|
48
|
-
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
49
|
-
|
|
50
|
-
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
51
|
-
|
|
52
|
-
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
53
|
-
|
|
54
|
-
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
55
|
-
|
|
56
|
-
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
57
|
-
|
|
58
|
-
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
59
|
-
|
|
60
|
-
END OF TERMS AND CONDITIONS
|