@cumulus/common 9.6.0 → 10.0.0-beta.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/BucketsConfig.d.ts +3 -3
- package/BucketsConfig.js +1 -1
- package/FileUtils.js +5 -3
- package/URLUtils.js +6 -5
- package/cli-utils.js +1 -1
- package/cloudwatch-event.js +12 -8
- package/env.js +2 -1
- package/execution-history.js +4 -2
- package/index.js +2 -2
- package/key-pair-provider.js +4 -4
- package/kms.js +3 -3
- package/log.js +2 -2
- package/package.json +4 -4
- package/sns-event.js +8 -5
- package/stack.js +2 -1
- package/test-utils.js +13 -7
- package/types.d.ts +1 -2
- package/util.js +4 -3
- package/workflows.js +8 -4
package/BucketsConfig.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BucketsConfigObject
|
|
1
|
+
import { BucketsConfigObject } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Class representing cumulus bucket configuration.
|
|
4
4
|
*/
|
|
@@ -16,7 +16,7 @@ declare class BucketsConfig {
|
|
|
16
16
|
* @param {string} bucketName
|
|
17
17
|
* @returns {string} matching bucket's type
|
|
18
18
|
*/
|
|
19
|
-
type(bucketName: string):
|
|
19
|
+
type(bucketName: string): string;
|
|
20
20
|
/**
|
|
21
21
|
* returns bucket object who's name field matches bucketName
|
|
22
22
|
* @param {string} bucketName
|
|
@@ -47,7 +47,7 @@ declare class BucketsConfig {
|
|
|
47
47
|
* @param {string/Array} types - types of buckets to return
|
|
48
48
|
* @returns {Array<Object>} - array of buckets that are of desired types
|
|
49
49
|
*/
|
|
50
|
-
bucketsOfType(types:
|
|
50
|
+
bucketsOfType(types: string | string[]): import("./types").BucketConfig[];
|
|
51
51
|
/** @returns {Array} list of private buckets */
|
|
52
52
|
privateBuckets(): import("./types").BucketConfig[];
|
|
53
53
|
/** @returns {Array} list of protected buckets */
|
package/BucketsConfig.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const errors_1 = require("@cumulus/errors");
|
|
3
|
-
const BucketsConfigError = errors_1.createErrorType('BucketsConfigError');
|
|
3
|
+
const BucketsConfigError = (0, errors_1.createErrorType)('BucketsConfigError');
|
|
4
4
|
/**
|
|
5
5
|
* Class representing cumulus bucket configuration.
|
|
6
6
|
*/
|
package/FileUtils.js
CHANGED
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.readJsonFile = exports.readTextFile = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const util_1 = require("util");
|
|
9
|
-
const readFile = util_1.promisify(fs_1.default.readFile);
|
|
10
|
-
|
|
11
|
-
exports.
|
|
9
|
+
const readFile = (0, util_1.promisify)(fs_1.default.readFile);
|
|
10
|
+
const readTextFile = (filename) => readFile(filename, 'utf8');
|
|
11
|
+
exports.readTextFile = readTextFile;
|
|
12
|
+
const readJsonFile = (filename) => (0, exports.readTextFile)(filename).then(JSON.parse);
|
|
13
|
+
exports.readJsonFile = readJsonFile;
|
|
12
14
|
//# sourceMappingURL=FileUtils.js.map
|
package/URLUtils.js
CHANGED
|
@@ -40,19 +40,20 @@ const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
|
40
40
|
* path: ['path', 'to', 'file.txt']
|
|
41
41
|
* }); // => 'http://example.com:8080/path/to/file.txt'
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
const buildURL = (params) => {
|
|
44
44
|
const { protocol, host, port, path = [], } = params;
|
|
45
|
-
if (isNil_1.default(protocol))
|
|
45
|
+
if ((0, isNil_1.default)(protocol))
|
|
46
46
|
throw new TypeError('protocol is required');
|
|
47
|
-
if (isNil_1.default(host))
|
|
47
|
+
if ((0, isNil_1.default)(host))
|
|
48
48
|
throw new TypeError('host is required');
|
|
49
49
|
const url = new url_1.URL(`${protocol}://${host}`);
|
|
50
50
|
if (port && protocol !== 's3')
|
|
51
51
|
url.port = port;
|
|
52
|
-
if (isString_1.default(path))
|
|
52
|
+
if ((0, isString_1.default)(path))
|
|
53
53
|
url.pathname = path;
|
|
54
54
|
else if (path.length > 0)
|
|
55
|
-
url.pathname = url_join_1.default(...path);
|
|
55
|
+
url.pathname = (0, url_join_1.default)(...path);
|
|
56
56
|
return url.toString().replace(/\/$/, '');
|
|
57
57
|
};
|
|
58
|
+
exports.buildURL = buildURL;
|
|
58
59
|
//# sourceMappingURL=URLUtils.js.map
|
package/cli-utils.js
CHANGED
|
@@ -24,7 +24,7 @@ exports.findMissingOptions = findMissingOptions;
|
|
|
24
24
|
* @returns {string} - display name
|
|
25
25
|
*/
|
|
26
26
|
function convertCamelOptionToLongOption(optionName) {
|
|
27
|
-
return `--${kebabCase_1.default(optionName)}`;
|
|
27
|
+
return `--${(0, kebabCase_1.default)(optionName)}`;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Convert missing required fields for display and display on console
|
package/cloudwatch-event.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -28,14 +28,15 @@ const util_1 = require("./util");
|
|
|
28
28
|
* @param {AwsCloudWatchEvent} event - A Cloudwatch event
|
|
29
29
|
* @returns {boolean} True if event is a Step Function event
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
const isSfExecutionEvent = (event) => event.source === 'aws.states';
|
|
32
|
+
exports.isSfExecutionEvent = isSfExecutionEvent;
|
|
32
33
|
/**
|
|
33
34
|
* Determine if Step Function is in a terminal state.
|
|
34
35
|
*
|
|
35
36
|
* @param {string} status - A Step Function execution status from a Cloudwatch event
|
|
36
37
|
* @returns {boolean} True if Step Function is in terminal state.
|
|
37
38
|
*/
|
|
38
|
-
exports.isTerminalSfStatus = util_1.isOneOf([
|
|
39
|
+
exports.isTerminalSfStatus = (0, util_1.isOneOf)([
|
|
39
40
|
'ABORTED',
|
|
40
41
|
'SUCCEEDED',
|
|
41
42
|
'FAILED',
|
|
@@ -47,7 +48,7 @@ exports.isTerminalSfStatus = util_1.isOneOf([
|
|
|
47
48
|
* @param {Object} status - A Step Function execution status from a Cloudwatch event
|
|
48
49
|
* @returns {boolean} True if Step Function is in failed state.
|
|
49
50
|
*/
|
|
50
|
-
exports.isFailedSfStatus = util_1.isOneOf([
|
|
51
|
+
exports.isFailedSfStatus = (0, util_1.isOneOf)([
|
|
51
52
|
'ABORTED',
|
|
52
53
|
'FAILED',
|
|
53
54
|
'TIMED_OUT',
|
|
@@ -58,7 +59,8 @@ exports.isFailedSfStatus = util_1.isOneOf([
|
|
|
58
59
|
* @param {AwsCloudWatchEvent} event - A Cloudwatch event
|
|
59
60
|
* @returns {string|undefined} Step Function execution status
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
+
const getSfEventStatus = (event) => { var _a; return (_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.status; };
|
|
63
|
+
exports.getSfEventStatus = getSfEventStatus;
|
|
62
64
|
/**
|
|
63
65
|
* Get the Step Function output message from a Cloudwatch Event
|
|
64
66
|
*
|
|
@@ -67,7 +69,8 @@ exports.getSfEventStatus = (event) => { var _a; return (_a = event === null || e
|
|
|
67
69
|
* @param {string} [defaultValue] - A default value for the message, if none exists
|
|
68
70
|
* @returns {string|undefined} Output message from Step Function
|
|
69
71
|
*/
|
|
70
|
-
|
|
72
|
+
const getSfEventDetailValue = (event, field, defaultValue) => { var _a, _b; return (_b = (_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a[field]) !== null && _b !== void 0 ? _b : defaultValue; };
|
|
73
|
+
exports.getSfEventDetailValue = getSfEventDetailValue;
|
|
71
74
|
/**
|
|
72
75
|
* Get the Step Function output message from a Cloudwatch Event
|
|
73
76
|
*
|
|
@@ -76,8 +79,8 @@ exports.getSfEventDetailValue = (event, field, defaultValue) => { var _a, _b; re
|
|
|
76
79
|
* @param {string} defaultValue - defaultValue to fetch if no event message object is found
|
|
77
80
|
* @returns {unknown} Message object from Step Function
|
|
78
81
|
*/
|
|
79
|
-
|
|
80
|
-
const message = exports.getSfEventDetailValue(event, messageSource, defaultValue);
|
|
82
|
+
const getSfEventMessageObject = (event, messageSource, defaultValue) => {
|
|
83
|
+
const message = (0, exports.getSfEventDetailValue)(event, messageSource, defaultValue);
|
|
81
84
|
if (message === undefined) {
|
|
82
85
|
log.error('Unable to find message');
|
|
83
86
|
return undefined;
|
|
@@ -90,4 +93,5 @@ exports.getSfEventMessageObject = (event, messageSource, defaultValue) => {
|
|
|
90
93
|
return undefined;
|
|
91
94
|
}
|
|
92
95
|
};
|
|
96
|
+
exports.getSfEventMessageObject = getSfEventMessageObject;
|
|
93
97
|
//# sourceMappingURL=cloudwatch-event.js.map
|
package/env.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRequiredEnvVar = void 0;
|
|
4
4
|
const errors_1 = require("@cumulus/errors");
|
|
5
|
-
|
|
5
|
+
const getRequiredEnvVar = (name, env = process.env) => {
|
|
6
6
|
const value = env[name];
|
|
7
7
|
if (typeof value === 'string')
|
|
8
8
|
return value;
|
|
9
9
|
throw new errors_1.MissingRequiredEnvVarError(`The ${name} environment variable must be set`);
|
|
10
10
|
};
|
|
11
|
+
exports.getRequiredEnvVar = getRequiredEnvVar;
|
|
11
12
|
//# sourceMappingURL=env.js.map
|
package/execution-history.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTaskExitedEventOutput = exports.getStepExitedEvent = void 0;
|
|
4
|
-
|
|
5
|
-
exports.
|
|
4
|
+
const getStepExitedEvent = (events, lastStepEvent) => events.find(({ type, previousEventId }) => type === 'TaskStateExited' && previousEventId === lastStepEvent.id);
|
|
5
|
+
exports.getStepExitedEvent = getStepExitedEvent;
|
|
6
|
+
const getTaskExitedEventOutput = (event) => { var _a; return (_a = event === null || event === void 0 ? void 0 : event.stateExitedEventDetails) === null || _a === void 0 ? void 0 : _a.output; };
|
|
7
|
+
exports.getTaskExitedEventOutput = getTaskExitedEventOutput;
|
|
6
8
|
//# sourceMappingURL=execution-history.js.map
|
package/index.js
CHANGED
|
@@ -14,12 +14,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.BucketsConfig = void 0;
|
|
22
|
+
exports.workflows = exports.util = exports.testUtils = exports.log = exports.keyPairProvider = exports.envUtils = exports.cliUtils = exports.BucketsConfig = void 0;
|
|
23
23
|
const BucketsConfig = require("./BucketsConfig");
|
|
24
24
|
exports.BucketsConfig = BucketsConfig;
|
|
25
25
|
exports.cliUtils = __importStar(require("./cli-utils"));
|
package/key-pair-provider.js
CHANGED
|
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.DefaultProvider = exports.S3KeyPairProvider = void 0;
|
|
10
|
+
exports.DefaultProvider = exports.S3KeyPairProvider = exports.KMS = void 0;
|
|
11
11
|
const noop_1 = __importDefault(require("lodash/noop"));
|
|
12
12
|
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
|
13
13
|
const node_forge_1 = __importDefault(require("node-forge"));
|
|
@@ -35,7 +35,7 @@ const buildS3Client = () => {
|
|
|
35
35
|
const options = {
|
|
36
36
|
apiVersion: '2006-03-01',
|
|
37
37
|
};
|
|
38
|
-
if (test_utils_1.inTestMode()) {
|
|
38
|
+
if ((0, test_utils_1.inTestMode)()) {
|
|
39
39
|
options.accessKeyId = 'my-access-key-id';
|
|
40
40
|
options.endpoint = `http://${getLocalStackHost()}:4572`;
|
|
41
41
|
options.region = 'us-east-1';
|
|
@@ -83,7 +83,7 @@ class S3KeyPairProvider {
|
|
|
83
83
|
* @returns {Promise.<string>} the encrypted string
|
|
84
84
|
*/
|
|
85
85
|
static async encrypt(str, keyId = 'public.pub', bucket, stack) {
|
|
86
|
-
util_1.deprecate('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.encrypt');
|
|
86
|
+
(0, util_1.deprecate)('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.encrypt');
|
|
87
87
|
// Download the publickey
|
|
88
88
|
const pki = node_forge_1.default.pki;
|
|
89
89
|
const pub = await retrieveKey(keyId, bucket, stack);
|
|
@@ -105,7 +105,7 @@ class S3KeyPairProvider {
|
|
|
105
105
|
* @returns {Promise.<string>} the decrypted string
|
|
106
106
|
*/
|
|
107
107
|
static async decrypt(str, keyId = 'private.pem', bucket, stack) {
|
|
108
|
-
util_1.deprecate('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.decryptBase64String');
|
|
108
|
+
(0, util_1.deprecate)('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.decryptBase64String');
|
|
109
109
|
const pki = node_forge_1.default.pki;
|
|
110
110
|
const priv = await retrieveKey(keyId, bucket, stack);
|
|
111
111
|
if (!priv) {
|
package/kms.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.KMS = void 0;
|
|
|
7
7
|
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
|
8
8
|
const errors_1 = require("@cumulus/errors");
|
|
9
9
|
const util_1 = require("./util");
|
|
10
|
-
const KMSDecryptionFailed = errors_1.createErrorType('KMSDecryptionFailed');
|
|
10
|
+
const KMSDecryptionFailed = (0, errors_1.createErrorType)('KMSDecryptionFailed');
|
|
11
11
|
class KMS {
|
|
12
12
|
static async encrypt(text, kmsId) {
|
|
13
|
-
util_1.deprecate('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.encrypt');
|
|
13
|
+
(0, util_1.deprecate)('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.encrypt');
|
|
14
14
|
const params = {
|
|
15
15
|
KeyId: kmsId,
|
|
16
16
|
Plaintext: text,
|
|
@@ -23,7 +23,7 @@ class KMS {
|
|
|
23
23
|
return CiphertextBlob.toString('base64');
|
|
24
24
|
}
|
|
25
25
|
static async decrypt(text) {
|
|
26
|
-
util_1.deprecate('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.decryptBase64String');
|
|
26
|
+
(0, util_1.deprecate)('@cumulus/common/key-pair-provider', '1.17.0', '@cumulus/aws-client/KMS.decryptBase64String');
|
|
27
27
|
const params = {
|
|
28
28
|
CiphertextBlob: Buffer.from(text, 'base64'),
|
|
29
29
|
};
|
package/log.js
CHANGED
|
@@ -101,10 +101,10 @@ function convertLogLevel(level) {
|
|
|
101
101
|
trace: 10,
|
|
102
102
|
};
|
|
103
103
|
// @ts-ignore
|
|
104
|
-
if (isString_1.default(level))
|
|
104
|
+
if ((0, isString_1.default)(level))
|
|
105
105
|
return mapping[level];
|
|
106
106
|
// @ts-ignore
|
|
107
|
-
if (isNumber_1.default(level))
|
|
107
|
+
if ((0, isNumber_1.default)(level))
|
|
108
108
|
return Object.keys(mapping).find((key) => mapping[key] === level);
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-beta.0",
|
|
4
4
|
"description": "Common utilities used across tasks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"author": "Cumulus Authors",
|
|
42
42
|
"license": "Apache-2.0",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@cumulus/errors": "
|
|
45
|
-
"@cumulus/logger": "
|
|
44
|
+
"@cumulus/errors": "10.0.0-beta.0",
|
|
45
|
+
"@cumulus/logger": "10.0.0-beta.0",
|
|
46
46
|
"ajv": "^6.12.3",
|
|
47
47
|
"aws-sdk": "^2.585.0",
|
|
48
48
|
"follow-redirects": "^1.2.4",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"@types/node-forge": "^0.9.5",
|
|
64
64
|
"@types/url-join": "^4.0.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "bc283986be627ba06a4084cabd4e01d1540d14c7"
|
|
67
67
|
}
|
package/sns-event.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -27,7 +27,8 @@ const log = __importStar(require("./log"));
|
|
|
27
27
|
* @param {Object} event - A Cloudwatch event object
|
|
28
28
|
* @returns {boolean} - True if event is an SNS event
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
const isSnsEvent = (event) => event.EventSource === 'aws:sns';
|
|
31
|
+
exports.isSnsEvent = isSnsEvent;
|
|
31
32
|
/**
|
|
32
33
|
* Get message from SNS event.
|
|
33
34
|
*
|
|
@@ -35,15 +36,16 @@ exports.isSnsEvent = (event) => event.EventSource === 'aws:sns';
|
|
|
35
36
|
* @param {any} [defaultValue] - Default value to use for message, if none exists.
|
|
36
37
|
* @returns {any} - Message from SNS event
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
|
+
const getSnsEventMessage = (event, defaultValue) => { var _a, _b; return (_b = (_a = event === null || event === void 0 ? void 0 : event.Sns) === null || _a === void 0 ? void 0 : _a.Message) !== null && _b !== void 0 ? _b : defaultValue; };
|
|
40
|
+
exports.getSnsEventMessage = getSnsEventMessage;
|
|
39
41
|
/**
|
|
40
42
|
* Get message object from SNS event.
|
|
41
43
|
*
|
|
42
44
|
* @param {Object} event - SNS event
|
|
43
45
|
* @returns {Object} - Message object from SNS event
|
|
44
46
|
*/
|
|
45
|
-
|
|
46
|
-
const message = exports.getSnsEventMessage(event, '{}');
|
|
47
|
+
const getSnsEventMessageObject = (event) => {
|
|
48
|
+
const message = (0, exports.getSnsEventMessage)(event, '{}');
|
|
47
49
|
try {
|
|
48
50
|
return JSON.parse(message);
|
|
49
51
|
}
|
|
@@ -52,4 +54,5 @@ exports.getSnsEventMessageObject = (event) => {
|
|
|
52
54
|
return undefined;
|
|
53
55
|
}
|
|
54
56
|
};
|
|
57
|
+
exports.getSnsEventMessageObject = getSnsEventMessageObject;
|
|
55
58
|
//# sourceMappingURL=sns-event.js.map
|
package/stack.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBucketsConfigKey = void 0;
|
|
4
|
-
|
|
4
|
+
const getBucketsConfigKey = (stackName) => `${stackName}/buckets/buckets.json`;
|
|
5
|
+
exports.getBucketsConfigKey = getBucketsConfigKey;
|
|
5
6
|
//# sourceMappingURL=stack.js.map
|
package/test-utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.jlog = exports.findTestDataDirectory = exports.findGitRepoRootDirectory = exports.validateOutput = exports.validateConfig = exports.validateInput = exports.randomStringFromRegex = exports.randomNumber = exports.randomId = exports.randomString = exports.throwTestError = exports.inTestMode = void 0;
|
|
7
|
+
exports.jlog = exports.findTestDataDirectory = exports.findGitRepoRootDirectory = exports.validateOutput = exports.validateConfig = exports.validateInput = exports.randomStringFromRegex = exports.randomNumber = exports.randomId = exports.randomString = exports.throwTestError = exports.inTestMode = exports.readJsonFixture = void 0;
|
|
8
8
|
const ajv_1 = __importDefault(require("ajv"));
|
|
9
9
|
const crypto_1 = __importDefault(require("crypto"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
@@ -12,14 +12,16 @@ const randexp_1 = __importDefault(require("randexp"));
|
|
|
12
12
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
13
13
|
var FileUtils_1 = require("./FileUtils");
|
|
14
14
|
Object.defineProperty(exports, "readJsonFixture", { enumerable: true, get: function () { return FileUtils_1.readJsonFile; } });
|
|
15
|
-
|
|
15
|
+
const inTestMode = (env = process.env) => env.NODE_ENV === 'test';
|
|
16
|
+
exports.inTestMode = inTestMode;
|
|
16
17
|
/**
|
|
17
18
|
* Helper function to throw error for unit test exports
|
|
18
19
|
* @throws {Error}
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
const throwTestError = () => {
|
|
21
22
|
throw new Error('This function is only exportable when NODE_ENV === test for unit test purposes');
|
|
22
23
|
};
|
|
24
|
+
exports.throwTestError = throwTestError;
|
|
23
25
|
/**
|
|
24
26
|
* Generate a [40 character] random string
|
|
25
27
|
*
|
|
@@ -27,7 +29,8 @@ exports.throwTestError = () => {
|
|
|
27
29
|
* defaults to 20 to produce a 40 character string
|
|
28
30
|
* @returns {string} - a random string
|
|
29
31
|
*/
|
|
30
|
-
|
|
32
|
+
const randomString = (numBytes = 20) => crypto_1.default.randomBytes(numBytes).toString('hex');
|
|
33
|
+
exports.randomString = randomString;
|
|
31
34
|
/**
|
|
32
35
|
* Postpend a [10-character] random string to input identifier.
|
|
33
36
|
*
|
|
@@ -36,7 +39,8 @@ exports.randomString = (numBytes = 20) => crypto_1.default.randomBytes(numBytes)
|
|
|
36
39
|
* extension. Default 5 to produce 10 characters..
|
|
37
40
|
* @returns {string} - a random string
|
|
38
41
|
*/
|
|
39
|
-
|
|
42
|
+
const randomId = (id, numBytes = 5) => `${id}${exports.randomString(numBytes)}`;
|
|
43
|
+
exports.randomId = randomId;
|
|
40
44
|
/**
|
|
41
45
|
* Generate a random for the given scale.
|
|
42
46
|
*
|
|
@@ -45,14 +49,16 @@ exports.randomId = (id, numBytes = 5) => `${id}${exports.randomString(numBytes)}
|
|
|
45
49
|
* @param {number} scale - scale for the random number. Defaults to 10.
|
|
46
50
|
* @returns {number} - a random number
|
|
47
51
|
*/
|
|
48
|
-
|
|
52
|
+
const randomNumber = (scale = 10) => Math.ceil(Math.random() * scale);
|
|
53
|
+
exports.randomNumber = randomNumber;
|
|
49
54
|
/**
|
|
50
55
|
* Create a random granule id from the regular expression
|
|
51
56
|
*
|
|
52
57
|
* @param {string} regex - regular expression string
|
|
53
58
|
* @returns {string} - random granule id
|
|
54
59
|
*/
|
|
55
|
-
|
|
60
|
+
const randomStringFromRegex = (regex) => new randexp_1.default(regex).gen();
|
|
61
|
+
exports.randomStringFromRegex = randomStringFromRegex;
|
|
56
62
|
/**
|
|
57
63
|
* Validate an object using json-schema
|
|
58
64
|
*
|
package/types.d.ts
CHANGED
|
@@ -12,10 +12,9 @@ export declare type AwsCloudWatchEvent = {
|
|
|
12
12
|
output?: string;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export declare type BucketType = 'internal' | 'private' | 'protected' | 'public' | 'shared';
|
|
16
15
|
export declare type BucketConfig = {
|
|
17
16
|
name: string;
|
|
18
|
-
type:
|
|
17
|
+
type: string;
|
|
19
18
|
};
|
|
20
19
|
export declare type BucketsConfigObject = {
|
|
21
20
|
[key: string]: BucketConfig;
|
package/util.js
CHANGED
|
@@ -18,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
19
|
if (mod && mod.__esModule) return mod;
|
|
20
20
|
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
@@ -67,7 +67,8 @@ exports.deprecate = (() => {
|
|
|
67
67
|
*
|
|
68
68
|
* @alias module:util
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
const removeNilProperties = (obj) => (0, omitBy_1.default)(obj, isNil_1.default);
|
|
71
|
+
exports.removeNilProperties = removeNilProperties;
|
|
71
72
|
/**
|
|
72
73
|
* Test if a value is included in a list of items
|
|
73
74
|
*
|
|
@@ -80,5 +81,5 @@ exports.removeNilProperties = (obj) => omitBy_1.default(obj, isNil_1.default);
|
|
|
80
81
|
* @alias module:util
|
|
81
82
|
* @kind function
|
|
82
83
|
*/
|
|
83
|
-
exports.isOneOf = curry_1.default((collection, val) => collection.includes(val), 2);
|
|
84
|
+
exports.isOneOf = (0, curry_1.default)((collection, val) => collection.includes(val), 2);
|
|
84
85
|
//# sourceMappingURL=util.js.map
|
package/workflows.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWorkflowsListKeyPrefix = exports.getWorkflowFileKey = exports.workflowTemplateUri = exports.templateKey = void 0;
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
|
|
7
|
-
exports.
|
|
4
|
+
const templateKey = (stack) => `${stack}/workflow_template.json`;
|
|
5
|
+
exports.templateKey = templateKey;
|
|
6
|
+
const workflowTemplateUri = (bucket, stack) => `s3://${bucket}/${(0, exports.templateKey)(stack)}`;
|
|
7
|
+
exports.workflowTemplateUri = workflowTemplateUri;
|
|
8
|
+
const getWorkflowFileKey = (stackName, workflowName) => `${stackName}/workflows/${workflowName}.json`;
|
|
9
|
+
exports.getWorkflowFileKey = getWorkflowFileKey;
|
|
10
|
+
const getWorkflowsListKeyPrefix = (stackName) => `${stackName}/workflows/`;
|
|
11
|
+
exports.getWorkflowsListKeyPrefix = getWorkflowsListKeyPrefix;
|
|
8
12
|
//# sourceMappingURL=workflows.js.map
|