@cumulus/common 14.1.0 → 15.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,7 +63,7 @@ exports.isFailedSfStatus = (0, util_1.isOneOf)([
63
63
  * @param {AwsCloudWatchEvent} event - A Cloudwatch event
64
64
  * @returns {string|undefined} Step Function execution status
65
65
  */
66
- const getSfEventStatus = (event) => { var _a; return (_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.status; };
66
+ const getSfEventStatus = (event) => event?.detail?.status;
67
67
  exports.getSfEventStatus = getSfEventStatus;
68
68
  /**
69
69
  * Get the Step Function output message from a Cloudwatch Event
@@ -73,7 +73,7 @@ exports.getSfEventStatus = getSfEventStatus;
73
73
  * @param {string} [defaultValue] - A default value for the message, if none exists
74
74
  * @returns {string|undefined} Output message from Step Function
75
75
  */
76
- 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; };
76
+ const getSfEventDetailValue = (event, field, defaultValue) => event?.detail?.[field] ?? defaultValue;
77
77
  exports.getSfEventDetailValue = getSfEventDetailValue;
78
78
  /**
79
79
  * Get the Step Function output message from a Cloudwatch Event
package/errors.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This method is for parsing a caught error which is not an HTTPerror
3
+ * in case the EDL endpoint call results in an unexpected error
4
+ *
5
+ * @param {unkown} e - the Error, if e isn't of type Error then it returns itself
6
+ * @returns {Error}
7
+ */
8
+ export declare const parseCaughtError: (e: unknown) => Error;
9
+ //# sourceMappingURL=errors.d.ts.map
package/errors.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCaughtError = void 0;
4
+ /**
5
+ * This method is for parsing a caught error which is not an HTTPerror
6
+ * in case the EDL endpoint call results in an unexpected error
7
+ *
8
+ * @param {unkown} e - the Error, if e isn't of type Error then it returns itself
9
+ * @returns {Error}
10
+ */
11
+ const parseCaughtError = (e) => (e instanceof Error ? e : new Error(`${e}`));
12
+ exports.parseCaughtError = parseCaughtError;
13
+ //# sourceMappingURL=errors.js.map
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTaskExitedEventOutput = exports.getStepExitedEvent = void 0;
4
4
  const getStepExitedEvent = (events, lastStepEvent) => events.find(({ type, previousEventId }) => type === 'TaskStateExited' && previousEventId === lastStepEvent.id);
5
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; };
6
+ const getTaskExitedEventOutput = (event) => event?.stateExitedEventDetails?.output;
7
7
  exports.getTaskExitedEventOutput = getTaskExitedEventOutput;
8
8
  //# sourceMappingURL=execution-history.js.map
@@ -25,8 +25,7 @@ const getLocalStackHost = () => {
25
25
  return process.env.LOCALSTACK_HOST;
26
26
  };
27
27
  const buildS3Client = () => {
28
- var _a;
29
- const region = (_a = process.env.AWS_DEFAULT_REGION) !== null && _a !== void 0 ? _a : 'us-east-1';
28
+ const region = process.env.AWS_DEFAULT_REGION ?? 'us-east-1';
30
29
  const options = {
31
30
  apiVersion: '2006-03-01',
32
31
  region,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/common",
3
- "version": "14.1.0",
3
+ "version": "15.0.1",
4
4
  "description": "Common utilities used across tasks",
5
5
  "keywords": [
6
6
  "GIBS",
@@ -8,7 +8,7 @@
8
8
  "NASA"
9
9
  ],
10
10
  "engines": {
11
- "node": ">=14.19.1"
11
+ "node": ">=16.19.0"
12
12
  },
13
13
  "files": [
14
14
  "*.js",
@@ -43,9 +43,9 @@
43
43
  "dependencies": {
44
44
  "@aws-sdk/client-s3": "^3.58.0",
45
45
  "@aws-sdk/signature-v4-crt": "^3.58.0",
46
- "@cumulus/aws-client": "14.1.0",
47
- "@cumulus/errors": "14.1.0",
48
- "@cumulus/logger": "14.1.0",
46
+ "@cumulus/aws-client": "15.0.1",
47
+ "@cumulus/errors": "15.0.1",
48
+ "@cumulus/logger": "15.0.1",
49
49
  "ajv": "^6.12.3",
50
50
  "aws-sdk": "^2.585.0",
51
51
  "follow-redirects": "^1.2.4",
@@ -67,5 +67,5 @@
67
67
  "@types/node-forge": "^0.9.5",
68
68
  "@types/url-join": "^4.0.0"
69
69
  },
70
- "gitHead": "d97b5b37913944c0f0ecf958f2a567ec3714816c"
70
+ "gitHead": "fb7304717073c7be4dd8f40342e038bcab6f751c"
71
71
  }
package/sns-event.js CHANGED
@@ -40,7 +40,7 @@ exports.isSnsEvent = isSnsEvent;
40
40
  * @param {any} [defaultValue] - Default value to use for message, if none exists.
41
41
  * @returns {any} - Message from SNS event
42
42
  */
43
- 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; };
43
+ const getSnsEventMessage = (event, defaultValue) => event?.Sns?.Message ?? defaultValue;
44
44
  exports.getSnsEventMessage = getSnsEventMessage;
45
45
  /**
46
46
  * Get message object from SNS event.