@cumulus/message 10.0.1 → 10.0.2
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/Build.d.ts.map +1 -1
- package/Build.js.map +1 -1
- package/DeadLetterMessage.d.ts +16 -0
- package/DeadLetterMessage.d.ts.map +1 -0
- package/DeadLetterMessage.js +42 -0
- package/DeadLetterMessage.js.map +1 -0
- package/README.md +0 -427
- package/StepFunctions.d.ts +56 -0
- package/StepFunctions.d.ts.map +1 -1
- package/StepFunctions.js +132 -9
- package/StepFunctions.js.map +1 -1
- package/package.json +7 -7
- package/src/Build.ts +1 -1
- package/src/DeadLetterMessage.ts +54 -0
- package/src/StepFunctions.ts +158 -1
- package/tsconfig.tsbuildinfo +1 -1
package/Build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Build.d.ts","sourceRoot":"","sources":["src/Build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Build.d.ts","sourceRoot":"","sources":["src/Build.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EACL,uBAAuB,EACvB,kCAAkC,EAClC,QAAQ,EACT,MAAM,SAAS,CAAC;AAYjB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;kBAOb,MAAM;;;yBAGC,kCAAkC;;MAErD,QAAQ,WASX,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B;wBAUpB,MAAM;qBACT,uBAAuB;aAC/B,MAAM;cACL,QAAQ;;;;;MAKhB,QAAQ,cAmBX,CAAC"}
|
package/Build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Build.js","sourceRoot":"","sources":["src/Build.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAEb;;;;;;;GAOG;AAEH,yDAAiC;
|
|
1
|
+
{"version":3,"file":"Build.js","sourceRoot":"","sources":["src/Build.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAEb;;;;;;;GAOG;AAEH,yDAAiC;AAGjC,+BAAoC;AAOpC;;;;;;GAMG;AACH,MAAM,mBAAmB,GAAG,CAAC,MAAe,EAAU,EAAE,CACtD,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAA,SAAM,GAAE,EAAE,CAAC,CAAC,CAAC,IAAA,SAAM,GAAE,CAAC,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAC/B,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GAOpB,EAAuB,EAAE;IACxB,MAAM,WAAW,GAAwB;QACvC,GAAG,mBAAmB;QACtB,cAAc,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;QACxD,aAAa,EAAE,YAAY;KAC5B,CAAC;IACF,IAAI,kBAAkB;QAAE,WAAW,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC5E,IAAI,gBAAgB;QAAE,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IACtE,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AArBW,QAAA,gBAAgB,oBAqB3B;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,6BAA6B,GAAG,CAAC,EAC5C,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,iBAAiB,GAAG,EAAE,EACtB,UAAU,GAAG,EAAE,EACf,mBAAmB,GAUpB,EAA0B,EAAE;IAC3B,MAAM,WAAW,GAAG,IAAA,wBAAgB,EAAC;QACnC,gBAAgB;QAChB,kBAAkB;QAClB,YAAY,EAAE,QAAQ,CAAC,GAAG;QAC1B,mBAAmB,EAAE,eAAe,CAAC,YAAY;QACjD,mBAAmB;KACpB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG;QACd,GAAG,eAAe;QAClB,IAAI,EAAE,IAAA,eAAK,EAAC,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE;YAC5C,aAAa,EAAE,QAAQ,CAAC,IAAI;SAC7B,CAAC;QACF,YAAY,EAAE,IAAA,eAAK,EAAC,iBAAiB,EAAE,WAAW,CAAC;QACnD,OAAO;KACR,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AArCW,QAAA,6BAA6B,iCAqCxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SQSRecord, EventBridgeEvent } from 'aws-lambda';
|
|
2
|
+
import { CumulusMessage } from '@cumulus/types/message';
|
|
3
|
+
declare type StepFunctionEventBridgeEvent = EventBridgeEvent<'Step Functions Execution Status Change', {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
}>;
|
|
6
|
+
declare type UnwrapDeadLetterCumulusMessageReturnType = (StepFunctionEventBridgeEvent | AWS.SQS.Message | SQSRecord | CumulusMessage);
|
|
7
|
+
/**
|
|
8
|
+
* Unwrap dead letter Cumulus message, which may be wrapped in a
|
|
9
|
+
* States cloudwatch event, which is wrapped in an SQS message.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} messageBody - received SQS message
|
|
12
|
+
* @returns {Object} the cumulus message or nearest available object
|
|
13
|
+
*/
|
|
14
|
+
export declare const unwrapDeadLetterCumulusMessage: (messageBody: UnwrapDeadLetterCumulusMessageReturnType) => Promise<UnwrapDeadLetterCumulusMessageReturnType>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=DeadLetterMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeadLetterMessage.d.ts","sourceRoot":"","sources":["src/DeadLetterMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,aAAK,4BAA4B,GAAG,gBAAgB,CAAC,wCAAwC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC;AAC1H,aAAK,wCAAwC,GAAG,CAC9C,4BAA4B,GAC1B,GAAG,CAAC,GAAG,CAAC,OAAO,GACf,SAAS,GACT,cAAc,CACjB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,gBAC5B,wCAAwC,KACpD,QAAQ,wCAAwC,CA0BlD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.unwrapDeadLetterCumulusMessage = void 0;
|
|
7
|
+
const SQS_1 = require("@cumulus/aws-client/SQS");
|
|
8
|
+
const logger_1 = __importDefault(require("@cumulus/logger"));
|
|
9
|
+
const StepFunctions_1 = require("./StepFunctions");
|
|
10
|
+
const log = new logger_1.default({ sender: '@cumulus/DeadLetterMessage' });
|
|
11
|
+
/**
|
|
12
|
+
* Unwrap dead letter Cumulus message, which may be wrapped in a
|
|
13
|
+
* States cloudwatch event, which is wrapped in an SQS message.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} messageBody - received SQS message
|
|
16
|
+
* @returns {Object} the cumulus message or nearest available object
|
|
17
|
+
*/
|
|
18
|
+
const unwrapDeadLetterCumulusMessage = async (messageBody) => {
|
|
19
|
+
try {
|
|
20
|
+
if ('cumulus_meta' in messageBody) {
|
|
21
|
+
return messageBody;
|
|
22
|
+
}
|
|
23
|
+
if ('Body' in messageBody || 'body' in messageBody) {
|
|
24
|
+
// AWS.SQS.Message/SQS.Record case
|
|
25
|
+
const unwrappedMessageBody = (0, SQS_1.parseSQSMessageBody)(messageBody);
|
|
26
|
+
return await (0, exports.unwrapDeadLetterCumulusMessage)(unwrappedMessageBody);
|
|
27
|
+
}
|
|
28
|
+
if (!('detail' in messageBody)) {
|
|
29
|
+
// Non-typed catchall
|
|
30
|
+
return messageBody;
|
|
31
|
+
}
|
|
32
|
+
// StepFunctionEventBridgeEvent case
|
|
33
|
+
const unwrappedMessageBody = await (0, StepFunctions_1.getCumulusMessageFromExecutionEvent)(messageBody);
|
|
34
|
+
return await (0, exports.unwrapDeadLetterCumulusMessage)(unwrappedMessageBody);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
log.error('Falling back to storing wrapped message after encountering unwrap error', error);
|
|
38
|
+
return messageBody;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.unwrapDeadLetterCumulusMessage = unwrapDeadLetterCumulusMessage;
|
|
42
|
+
//# sourceMappingURL=DeadLetterMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeadLetterMessage.js","sourceRoot":"","sources":["src/DeadLetterMessage.ts"],"names":[],"mappings":";;;;;;AAEA,iDAA8D;AAE9D,6DAAqC;AAErC,mDAAsE;AAEtE,MAAM,GAAG,GAAG,IAAI,gBAAM,CAAC,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC,CAAC;AAUjE;;;;;;GAMG;AACI,MAAM,8BAA8B,GAAG,KAAK,EACjD,WAAqD,EACF,EAAE;IACrD,IAAI;QACF,IAAI,cAAc,IAAI,WAAW,EAAE;YACjC,OAAO,WAAW,CAAC;SACpB;QACD,IAAI,MAAM,IAAI,WAAW,IAAI,MAAM,IAAI,WAAW,EAAE;YAClD,kCAAkC;YAClC,MAAM,oBAAoB,GAAG,IAAA,yBAAmB,EAC9C,WAAW,CACM,CAAC;YACpB,OAAO,MAAM,IAAA,sCAA8B,EAAC,oBAAoB,CAAC,CAAC;SACnE;QACD,IAAI,CAAC,CAAC,QAAQ,IAAI,WAAW,CAAC,EAAE;YAC9B,qBAAqB;YACrB,OAAO,WAAW,CAAC;SACpB;QACD,oCAAoC;QACpC,MAAM,oBAAoB,GAAG,MAAM,IAAA,mDAAmC,EAAC,WAAW,CAAC,CAAC;QACpF,OAAO,MAAM,IAAA,sCAA8B,EAAC,oBAAoB,CAAC,CAAC;KACnE;IAAC,OAAO,KAAK,EAAE;QACd,GAAG,CAAC,KAAK,CACP,yEAAyE,EACzE,KAAK,CACN,CAAC;QACF,OAAO,WAAW,CAAC;KACpB;AACH,CAAC,CAAC;AA5BW,QAAA,8BAA8B,kCA4BzC"}
|
package/README.md
CHANGED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
# @cumulus/message
|
|
2
|
-
|
|
3
|
-
Utilities for building and parsing Cumulus workflow messages.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @cumulus/message
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## API
|
|
12
|
-
|
|
13
|
-
### Modules
|
|
14
|
-
|
|
15
|
-
<dl>
|
|
16
|
-
<dt><a href="#module_Build">Build</a></dt>
|
|
17
|
-
<dd><p>Utility functions for building Cumulus messages</p>
|
|
18
|
-
</dd>
|
|
19
|
-
<dt><a href="#module_Executions">Executions</a></dt>
|
|
20
|
-
<dd><p>Utility functions for generating execution information or parsing execution information
|
|
21
|
-
from a Cumulus message</p>
|
|
22
|
-
</dd>
|
|
23
|
-
<dt><a href="#module_Queue">Queue</a></dt>
|
|
24
|
-
<dd><p>Utility functions for parsing queue information from a Cumulus message</p>
|
|
25
|
-
</dd>
|
|
26
|
-
<dt><a href="#module_StepFunctions">StepFunctions</a></dt>
|
|
27
|
-
<dd><p>Utility functions for working with AWS Step Function events/messages</p>
|
|
28
|
-
</dd>
|
|
29
|
-
</dl>
|
|
30
|
-
|
|
31
|
-
### Functions
|
|
32
|
-
|
|
33
|
-
<dl>
|
|
34
|
-
<dt><a href="#exp_module_AsyncOperations--getMessageAsyncOperationId">getMessageAsyncOperationId(message)</a> ⇒ <code>undefined</code> | <code>string</code> ⏏</dt>
|
|
35
|
-
<dd><p>Get the async operation ID from a workflow message, if any.</p>
|
|
36
|
-
</dd>
|
|
37
|
-
<dt><a href="#exp_module_Collections--constructCollectionId">constructCollectionId(name, version)</a> ⇒ <code>string</code> ⏏</dt>
|
|
38
|
-
<dd><p>Returns the collection ID.</p>
|
|
39
|
-
</dd>
|
|
40
|
-
<dt><a href="#deconstructCollectionId">deconstructCollectionId(collectionId)</a> ⇒ <code>Object</code></dt>
|
|
41
|
-
<dd><p>Returns the name and version of a collection based on
|
|
42
|
-
the collectionId used in elasticsearch indexing</p>
|
|
43
|
-
</dd>
|
|
44
|
-
<dt><a href="#exp_module_Collections--getCollectionNameAndVersionFromMessage">getCollectionNameAndVersionFromMessage(message)</a> ⇒ <code>CollectionInfo</code> | <code>undefined</code> ⏏</dt>
|
|
45
|
-
<dd><p>Get collection name and version from execution message.</p>
|
|
46
|
-
</dd>
|
|
47
|
-
<dt><a href="#exp_module_Collections--getCollectionIdFromMessage">getCollectionIdFromMessage(message)</a> ⇒ <code>string</code> | <code>undefined</code> ⏏</dt>
|
|
48
|
-
<dd><p>Get collection ID from execution message.</p>
|
|
49
|
-
</dd>
|
|
50
|
-
<dt><a href="#exp_module_Granules--getMessageGranules">getMessageGranules(message)</a> ⇒ <code>Array.<Object></code> | <code>undefined</code> ⏏</dt>
|
|
51
|
-
<dd><p>Get granules from payload?.granules of a workflow message.</p>
|
|
52
|
-
</dd>
|
|
53
|
-
<dt><a href="#exp_module_Granules--messageHasGranules">messageHasGranules(message)</a> ⇒ <code>boolean</code> ⏏</dt>
|
|
54
|
-
<dd><p>Determine if message has a granules object.</p>
|
|
55
|
-
</dd>
|
|
56
|
-
<dt><a href="#exp_module_Granules--getGranuleStatus">getGranuleStatus(workflowStatus, granule)</a> ⇒ <code>string</code> ⏏</dt>
|
|
57
|
-
<dd><p>Determine the status of a granule.</p>
|
|
58
|
-
</dd>
|
|
59
|
-
<dt><a href="#exp_module_Granules--getGranuleQueryFields">getGranuleQueryFields(message)</a> ⇒ <code>unknown</code> | <code>undefined</code> ⏏</dt>
|
|
60
|
-
<dd><p>Get the query fields of a granule, if any</p>
|
|
61
|
-
</dd>
|
|
62
|
-
<dt><a href="#exp_module_PDRs--getMessagePdr">getMessagePdr(message)</a> ⇒ <code>undefined</code> | <code>Object</code> ⏏</dt>
|
|
63
|
-
<dd><p>Get the PDR object from a workflow message, if any.</p>
|
|
64
|
-
</dd>
|
|
65
|
-
<dt><a href="#exp_module_PDRs--messageHasPdr">messageHasPdr(message)</a> ⇒ <code>boolean</code> ⏏</dt>
|
|
66
|
-
<dd><p>Determine if message has a PDR.</p>
|
|
67
|
-
</dd>
|
|
68
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrPANSent">getMessagePdrPANSent(message)</a> ⇒ <code>boolean</code> ⏏</dt>
|
|
69
|
-
<dd><p>Get the PAN sent status from a workflow message, if any.</p>
|
|
70
|
-
</dd>
|
|
71
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrPANMessage">getMessagePdrPANMessage(message)</a> ⇒ <code>string</code> ⏏</dt>
|
|
72
|
-
<dd><p>Get the PAN message status from a workflow message, if any.</p>
|
|
73
|
-
</dd>
|
|
74
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrName">getMessagePdrName(message)</a> ⇒ <code>string</code> ⏏</dt>
|
|
75
|
-
<dd><p>Get the PDR name from a workflow message, if any.</p>
|
|
76
|
-
</dd>
|
|
77
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrRunningExecutions">getMessagePdrRunningExecutions(message)</a> ⇒ <code>number</code> ⏏</dt>
|
|
78
|
-
<dd><p>Get the number of running executions for a PDR, if any.</p>
|
|
79
|
-
</dd>
|
|
80
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrCompletedExecutions">getMessagePdrCompletedExecutions(message)</a> ⇒ <code>number</code> ⏏</dt>
|
|
81
|
-
<dd><p>Get the number of completed executions for a PDR, if any.</p>
|
|
82
|
-
</dd>
|
|
83
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrFailedExecutions">getMessagePdrFailedExecutions(message)</a> ⇒ <code>number</code> ⏏</dt>
|
|
84
|
-
<dd><p>Get the number of failed executions for a PDR, if any.</p>
|
|
85
|
-
</dd>
|
|
86
|
-
<dt><a href="#exp_module_PDRs--getMessagePdrStats">getMessagePdrStats(message)</a> ⇒ <code>PdrStats</code> ⏏</dt>
|
|
87
|
-
<dd><p>Get the PDR stats from a workflow message, if any.</p>
|
|
88
|
-
</dd>
|
|
89
|
-
<dt><a href="#exp_module_PDRs--getPdrPercentCompletion">getPdrPercentCompletion(stats)</a> ⇒ <code>number</code> ⏏</dt>
|
|
90
|
-
<dd><p>Get the percent completion of PDR executions</p>
|
|
91
|
-
</dd>
|
|
92
|
-
<dt><a href="#exp_module_Providers--getMessageProvider">getMessageProvider(message)</a> ⇒ <code>MessageProvider</code> | <code>string</code> ⏏</dt>
|
|
93
|
-
<dd><p>Get the provider from a workflow message, if any.</p>
|
|
94
|
-
</dd>
|
|
95
|
-
<dt><a href="#exp_module_Providers--getMessageProviderId">getMessageProviderId(message)</a> ⇒ <code>undefined</code> | <code>string</code> ⏏</dt>
|
|
96
|
-
<dd><p>Get the provider ID from a workflow message, if any.</p>
|
|
97
|
-
</dd>
|
|
98
|
-
<dt><a href="#exp_module_workflows--getMetaStatus">getMetaStatus(message)</a> ⇒ <code>Message.WorkflowStatus</code> | <code>undefined</code> ⏏</dt>
|
|
99
|
-
<dd><p>Get the status of a workflow message, if any.</p>
|
|
100
|
-
</dd>
|
|
101
|
-
<dt><a href="#exp_module_workflows--getMessageWorkflowTasks">getMessageWorkflowTasks(message)</a> ⇒ <code>Object</code> | <code>undefined</code> ⏏</dt>
|
|
102
|
-
<dd><p>Get the workflow tasks in a workflow message, if any.</p>
|
|
103
|
-
</dd>
|
|
104
|
-
<dt><a href="#exp_module_workflows--getMessageWorkflowStartTime">getMessageWorkflowStartTime(message)</a> ⇒ <code>number</code> | <code>undefined</code> ⏏</dt>
|
|
105
|
-
<dd><p>Get the workflow start time, if any.</p>
|
|
106
|
-
</dd>
|
|
107
|
-
<dt><a href="#exp_module_workflows--getMessageWorkflowStopTime">getMessageWorkflowStopTime(message)</a> ⇒ <code>number</code> | <code>undefined</code> ⏏</dt>
|
|
108
|
-
<dd><p>Get the workflow stop time, if any.</p>
|
|
109
|
-
</dd>
|
|
110
|
-
<dt><a href="#exp_module_workflows--getMessageWorkflowName">getMessageWorkflowName(message)</a> ⇒ <code>string</code> | <code>undefined</code> ⏏</dt>
|
|
111
|
-
<dd><p>Get the workflow name, if any.</p>
|
|
112
|
-
</dd>
|
|
113
|
-
<dt><a href="#exp_module_workflows--getWorkflowDuration">getWorkflowDuration(startTime, [stopTime])</a> ⇒ <code>number</code> ⏏</dt>
|
|
114
|
-
<dd><p>Get the workflow duration.</p>
|
|
115
|
-
</dd>
|
|
116
|
-
</dl>
|
|
117
|
-
|
|
118
|
-
<a name="module_Build"></a>
|
|
119
|
-
|
|
120
|
-
### Build
|
|
121
|
-
Utility functions for building Cumulus messages
|
|
122
|
-
|
|
123
|
-
**Example**
|
|
124
|
-
```js
|
|
125
|
-
const Build = require('@cumulus/message/Build');
|
|
126
|
-
```
|
|
127
|
-
<a name="exp_module_Build--buildQueueMessageFromTemplate"></a>
|
|
128
|
-
|
|
129
|
-
#### buildQueueMessageFromTemplate(params) ⇒ <code>Message.CumulusMessage</code> ⏏
|
|
130
|
-
Build an SQS message from a workflow template for queueing executions.
|
|
131
|
-
|
|
132
|
-
**Kind**: Exported function
|
|
133
|
-
**Returns**: <code>Message.CumulusMessage</code> - A Cumulus message object
|
|
134
|
-
|
|
135
|
-
| Param | Type | Description |
|
|
136
|
-
| --- | --- | --- |
|
|
137
|
-
| params | <code>Object</code> | |
|
|
138
|
-
| params.provider | <code>Object</code> | A provider object |
|
|
139
|
-
| params.collection | <code>Object</code> | A collection object |
|
|
140
|
-
| params.parentExecutionArn | <code>string</code> | ARN for parent execution |
|
|
141
|
-
| params.messageTemplate | <code>Object</code> | Message template for the workflow |
|
|
142
|
-
| params.payload | <code>Object</code> | Payload for the workflow |
|
|
143
|
-
| params.workflow | <code>Object</code> | workflow name & arn object |
|
|
144
|
-
| [params.asyncOperationId] | <code>string</code> | Async operation ID |
|
|
145
|
-
| [params.customCumulusMeta] | <code>Object</code> | Custom data for message.cumulus_meta |
|
|
146
|
-
| [params.customMeta] | <code>Object</code> | Custom data for message.meta |
|
|
147
|
-
| [params.executionNamePrefix] | <code>string</code> | Prefix to apply to the name of the enqueued execution |
|
|
148
|
-
|
|
149
|
-
<a name="module_Executions"></a>
|
|
150
|
-
|
|
151
|
-
### Executions
|
|
152
|
-
Utility functions for generating execution information or parsing execution information
|
|
153
|
-
from a Cumulus message
|
|
154
|
-
|
|
155
|
-
**Example**
|
|
156
|
-
```js
|
|
157
|
-
const Executions = require('@cumulus/message/Executions');
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
* [Executions](#module_Executions)
|
|
161
|
-
* [buildExecutionArn(stateMachineArn, executionName)](#exp_module_Executions--buildExecutionArn) ⇒ <code>string</code> ⏏
|
|
162
|
-
* [getExecutionUrlFromArn(executionArn)](#exp_module_Executions--getExecutionUrlFromArn) ⇒ <code>string</code> ⏏
|
|
163
|
-
* [getStateMachineArnFromExecutionArn(executionArn)](#exp_module_Executions--getStateMachineArnFromExecutionArn) ⇒ <code>string</code> ⏏
|
|
164
|
-
* [getMessageExecutionName(message)](#exp_module_Executions--getMessageExecutionName) ⇒ <code>string</code> ⏏
|
|
165
|
-
* [getMessageStateMachineArn(message)](#exp_module_Executions--getMessageStateMachineArn) ⇒ <code>string</code> ⏏
|
|
166
|
-
* [getMessageExecutionArn(message)](#exp_module_Executions--getMessageExecutionArn) ⇒ <code>null</code> \| <code>string</code> ⏏
|
|
167
|
-
* [getMessageExecutionParentArn(message)](#exp_module_Executions--getMessageExecutionParentArn) ⇒ <code>undefined</code> \| <code>string</code> ⏏
|
|
168
|
-
* [getMessageCumulusVersion(message)](#exp_module_Executions--getMessageCumulusVersion) ⇒ <code>undefined</code> \| <code>string</code> ⏏
|
|
169
|
-
* [getMessageExecutionOriginalPayload(message)](#exp_module_Executions--getMessageExecutionOriginalPayload) ⇒ <code>unknown</code> \| <code>undefined</code> ⏏
|
|
170
|
-
* [getMessageExecutionFinalPayload(message)](#exp_module_Executions--getMessageExecutionFinalPayload) ⇒ <code>unknown</code> \| <code>undefined</code> ⏏
|
|
171
|
-
|
|
172
|
-
<a name="exp_module_Executions--buildExecutionArn"></a>
|
|
173
|
-
|
|
174
|
-
#### buildExecutionArn(stateMachineArn, executionName) ⇒ <code>string</code> ⏏
|
|
175
|
-
Build execution ARN from a state machine ARN and execution name
|
|
176
|
-
|
|
177
|
-
**Kind**: Exported function
|
|
178
|
-
**Returns**: <code>string</code> - an execution ARN
|
|
179
|
-
|
|
180
|
-
| Param | Type | Description |
|
|
181
|
-
| --- | --- | --- |
|
|
182
|
-
| stateMachineArn | <code>string</code> | state machine ARN |
|
|
183
|
-
| executionName | <code>string</code> | state machine's execution name |
|
|
184
|
-
|
|
185
|
-
<a name="exp_module_Executions--getExecutionUrlFromArn"></a>
|
|
186
|
-
|
|
187
|
-
#### getExecutionUrlFromArn(executionArn) ⇒ <code>string</code> ⏏
|
|
188
|
-
Returns execution URL from an execution ARN.
|
|
189
|
-
|
|
190
|
-
**Kind**: Exported function
|
|
191
|
-
**Returns**: <code>string</code> - returns AWS console URL for the execution
|
|
192
|
-
|
|
193
|
-
| Param | Type | Description |
|
|
194
|
-
| --- | --- | --- |
|
|
195
|
-
| executionArn | <code>string</code> | an execution ARN |
|
|
196
|
-
|
|
197
|
-
<a name="exp_module_Executions--getStateMachineArnFromExecutionArn"></a>
|
|
198
|
-
|
|
199
|
-
#### getStateMachineArnFromExecutionArn(executionArn) ⇒ <code>string</code> ⏏
|
|
200
|
-
Get state machine ARN from an execution ARN
|
|
201
|
-
|
|
202
|
-
**Kind**: Exported function
|
|
203
|
-
**Returns**: <code>string</code> - a state machine ARN
|
|
204
|
-
|
|
205
|
-
| Param | Type | Description |
|
|
206
|
-
| --- | --- | --- |
|
|
207
|
-
| executionArn | <code>string</code> | an execution ARN |
|
|
208
|
-
|
|
209
|
-
<a name="exp_module_Executions--getMessageExecutionName"></a>
|
|
210
|
-
|
|
211
|
-
#### getMessageExecutionName(message) ⇒ <code>string</code> ⏏
|
|
212
|
-
Get the execution name from a workflow message.
|
|
213
|
-
|
|
214
|
-
**Kind**: Exported function
|
|
215
|
-
**Returns**: <code>string</code> - An execution name
|
|
216
|
-
**Throws**:
|
|
217
|
-
|
|
218
|
-
- <code>Error</code> if there is no execution name
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
| Param | Type | Description |
|
|
222
|
-
| --- | --- | --- |
|
|
223
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
224
|
-
|
|
225
|
-
<a name="exp_module_Executions--getMessageStateMachineArn"></a>
|
|
226
|
-
|
|
227
|
-
#### getMessageStateMachineArn(message) ⇒ <code>string</code> ⏏
|
|
228
|
-
Get the state machine ARN from a workflow message.
|
|
229
|
-
|
|
230
|
-
**Kind**: Exported function
|
|
231
|
-
**Returns**: <code>string</code> - A state machine ARN
|
|
232
|
-
**Throws**:
|
|
233
|
-
|
|
234
|
-
- <code>Error</code> if there is not state machine ARN
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
| Param | Type | Description |
|
|
238
|
-
| --- | --- | --- |
|
|
239
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
240
|
-
|
|
241
|
-
<a name="exp_module_Executions--getMessageExecutionArn"></a>
|
|
242
|
-
|
|
243
|
-
#### getMessageExecutionArn(message) ⇒ <code>null</code> \| <code>string</code> ⏏
|
|
244
|
-
Get the execution ARN from a workflow message.
|
|
245
|
-
|
|
246
|
-
**Kind**: Exported function
|
|
247
|
-
**Returns**: <code>null</code> \| <code>string</code> - A state machine execution ARN
|
|
248
|
-
|
|
249
|
-
| Param | Type | Description |
|
|
250
|
-
| --- | --- | --- |
|
|
251
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
252
|
-
|
|
253
|
-
<a name="exp_module_Executions--getMessageExecutionParentArn"></a>
|
|
254
|
-
|
|
255
|
-
#### getMessageExecutionParentArn(message) ⇒ <code>undefined</code> \| <code>string</code> ⏏
|
|
256
|
-
Get the parent execution ARN from a workflow message, if any.
|
|
257
|
-
|
|
258
|
-
**Kind**: Exported function
|
|
259
|
-
**Returns**: <code>undefined</code> \| <code>string</code> - A state machine execution ARN
|
|
260
|
-
|
|
261
|
-
| Param | Type | Description |
|
|
262
|
-
| --- | --- | --- |
|
|
263
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
264
|
-
|
|
265
|
-
<a name="exp_module_Executions--getMessageCumulusVersion"></a>
|
|
266
|
-
|
|
267
|
-
#### getMessageCumulusVersion(message) ⇒ <code>undefined</code> \| <code>string</code> ⏏
|
|
268
|
-
Get the Cumulus version from a workflow message, if any.
|
|
269
|
-
|
|
270
|
-
**Kind**: Exported function
|
|
271
|
-
**Returns**: <code>undefined</code> \| <code>string</code> - The cumulus version
|
|
272
|
-
|
|
273
|
-
| Param | Type | Description |
|
|
274
|
-
| --- | --- | --- |
|
|
275
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
276
|
-
|
|
277
|
-
<a name="exp_module_Executions--getMessageExecutionOriginalPayload"></a>
|
|
278
|
-
|
|
279
|
-
#### getMessageExecutionOriginalPayload(message) ⇒ <code>unknown</code> \| <code>undefined</code> ⏏
|
|
280
|
-
Get the workflow original payload, if any.
|
|
281
|
-
|
|
282
|
-
**Kind**: Exported function
|
|
283
|
-
**Returns**: <code>unknown</code> \| <code>undefined</code> - The workflow original payload
|
|
284
|
-
|
|
285
|
-
| Param | Type | Description |
|
|
286
|
-
| --- | --- | --- |
|
|
287
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
288
|
-
|
|
289
|
-
<a name="exp_module_Executions--getMessageExecutionFinalPayload"></a>
|
|
290
|
-
|
|
291
|
-
#### getMessageExecutionFinalPayload(message) ⇒ <code>unknown</code> \| <code>undefined</code> ⏏
|
|
292
|
-
Get the workflow final payload, if any.
|
|
293
|
-
|
|
294
|
-
**Kind**: Exported function
|
|
295
|
-
**Returns**: <code>unknown</code> \| <code>undefined</code> - The workflow final payload
|
|
296
|
-
|
|
297
|
-
| Param | Type | Description |
|
|
298
|
-
| --- | --- | --- |
|
|
299
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
300
|
-
|
|
301
|
-
<a name="module_Queue"></a>
|
|
302
|
-
|
|
303
|
-
### Queue
|
|
304
|
-
Utility functions for parsing queue information from a Cumulus message
|
|
305
|
-
|
|
306
|
-
**Example**
|
|
307
|
-
```js
|
|
308
|
-
const Queue = require('@cumulus/message/Queue');
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
* [Queue](#module_Queue)
|
|
312
|
-
* [getQueueUrl(message)](#exp_module_Queue--getQueueUrl) ⇒ <code>string</code> ⏏
|
|
313
|
-
* [getMaximumExecutions(message, queueUrl)](#exp_module_Queue--getMaximumExecutions) ⇒ <code>number</code> ⏏
|
|
314
|
-
* [hasQueueAndExecutionLimit(message)](#exp_module_Queue--hasQueueAndExecutionLimit) ⇒ <code>boolean</code> ⏏
|
|
315
|
-
|
|
316
|
-
<a name="exp_module_Queue--getQueueUrl"></a>
|
|
317
|
-
|
|
318
|
-
#### getQueueUrl(message) ⇒ <code>string</code> ⏏
|
|
319
|
-
Get the queue URL from a workflow message.
|
|
320
|
-
|
|
321
|
-
**Kind**: Exported function
|
|
322
|
-
**Returns**: <code>string</code> - A queue URL
|
|
323
|
-
|
|
324
|
-
| Param | Type | Description |
|
|
325
|
-
| --- | --- | --- |
|
|
326
|
-
| message | <code>MessageWithQueueInfo</code> | A workflow message object |
|
|
327
|
-
|
|
328
|
-
<a name="exp_module_Queue--getMaximumExecutions"></a>
|
|
329
|
-
|
|
330
|
-
#### getMaximumExecutions(message, queueUrl) ⇒ <code>number</code> ⏏
|
|
331
|
-
Get the maximum executions for a queue.
|
|
332
|
-
|
|
333
|
-
**Kind**: Exported function
|
|
334
|
-
**Returns**: <code>number</code> - Count of the maximum executions for the queue
|
|
335
|
-
**Throws**:
|
|
336
|
-
|
|
337
|
-
- <code>Error</code> if no maximum executions can be found
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
| Param | Type | Description |
|
|
341
|
-
| --- | --- | --- |
|
|
342
|
-
| message | <code>Message.CumulusMessage</code> | A workflow message object |
|
|
343
|
-
| queueUrl | <code>string</code> | A queue URL |
|
|
344
|
-
|
|
345
|
-
<a name="exp_module_Queue--hasQueueAndExecutionLimit"></a>
|
|
346
|
-
|
|
347
|
-
#### hasQueueAndExecutionLimit(message) ⇒ <code>boolean</code> ⏏
|
|
348
|
-
Determine if there is a queue and queue execution limit in the message.
|
|
349
|
-
|
|
350
|
-
**Kind**: Exported function
|
|
351
|
-
**Returns**: <code>boolean</code> - True if there is a queue and execution limit.
|
|
352
|
-
|
|
353
|
-
| Param | Type | Description |
|
|
354
|
-
| --- | --- | --- |
|
|
355
|
-
| message | <code>MessageWithQueueInfo</code> | A workflow message object |
|
|
356
|
-
|
|
357
|
-
<a name="module_StepFunctions"></a>
|
|
358
|
-
|
|
359
|
-
### StepFunctions
|
|
360
|
-
Utility functions for working with AWS Step Function events/messages
|
|
361
|
-
|
|
362
|
-
**Example**
|
|
363
|
-
```js
|
|
364
|
-
const StepFunctions = require('@cumulus/message/StepFunctions');
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
* [StepFunctions](#module_StepFunctions)
|
|
368
|
-
* [pullStepFunctionEvent(event)](#exp_module_StepFunctions--pullStepFunctionEvent) ⇒ <code>Promise.<Object></code> ⏏
|
|
369
|
-
* [parseStepMessage(stepMessage, stepName)](#exp_module_StepFunctions--parseStepMessage) ⇒ <code>Promise.<Object></code> ⏏
|
|
370
|
-
|
|
371
|
-
<a name="exp_module_StepFunctions--pullStepFunctionEvent"></a>
|
|
372
|
-
|
|
373
|
-
#### pullStepFunctionEvent(event) ⇒ <code>Promise.<Object></code> ⏏
|
|
374
|
-
Given a Step Function event, replace specified key in event with contents
|
|
375
|
-
of S3 remote message
|
|
376
|
-
|
|
377
|
-
**Kind**: Exported function
|
|
378
|
-
**Returns**: <code>Promise.<Object></code> - Updated event with target path replaced by remote message
|
|
379
|
-
**Throws**:
|
|
380
|
-
|
|
381
|
-
- <code>Error</code> if target path cannot be found on source event
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
| Param | Type | Description |
|
|
385
|
-
| --- | --- | --- |
|
|
386
|
-
| event | <code>Message.CumulusRemoteMessage</code> | Source event |
|
|
387
|
-
|
|
388
|
-
<a name="exp_module_StepFunctions--parseStepMessage"></a>
|
|
389
|
-
|
|
390
|
-
#### parseStepMessage(stepMessage, stepName) ⇒ <code>Promise.<Object></code> ⏏
|
|
391
|
-
Parse step message with CMA keys and replace specified key in event with contents
|
|
392
|
-
of S3 remote message
|
|
393
|
-
|
|
394
|
-
**Kind**: Exported function
|
|
395
|
-
**Returns**: <code>Promise.<Object></code> - Parsed and updated event with target path replaced by remote message
|
|
396
|
-
|
|
397
|
-
| Param | Type | Description |
|
|
398
|
-
| --- | --- | --- |
|
|
399
|
-
| stepMessage | <code>CMAMessage</code> | Message for the step |
|
|
400
|
-
| stepName | <code>string</code> | Name of the step |
|
|
401
|
-
|
|
402
|
-
<a name="deconstructCollectionId"></a>
|
|
403
|
-
|
|
404
|
-
### deconstructCollectionId(collectionId) ⇒ <code>Object</code>
|
|
405
|
-
Returns the name and version of a collection based on
|
|
406
|
-
the collectionId used in elasticsearch indexing
|
|
407
|
-
|
|
408
|
-
**Kind**: global function
|
|
409
|
-
**Returns**: <code>Object</code> - name and version as object
|
|
410
|
-
|
|
411
|
-
| Param | Type | Description |
|
|
412
|
-
| --- | --- | --- |
|
|
413
|
-
| collectionId | <code>string</code> | collectionId used in elasticsearch index |
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
## About Cumulus
|
|
417
|
-
|
|
418
|
-
Cumulus is a cloud-based data ingest, archive, distribution and management prototype for NASA's future Earth science data streams.
|
|
419
|
-
|
|
420
|
-
[Cumulus Documentation](https://nasa.github.io/cumulus)
|
|
421
|
-
|
|
422
|
-
## Contributing
|
|
423
|
-
|
|
424
|
-
To make a contribution, please [see our contributing guidelines](https://github.com/nasa/cumulus/blob/master/CONTRIBUTING.md).
|
|
425
|
-
|
|
426
|
-
---
|
|
427
|
-
Generated automatically using `npm run build-docs`
|
package/StepFunctions.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with AWS Step Function events/messages
|
|
3
|
+
* @module StepFunctions
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const StepFunctions = require('@cumulus/message/StepFunctions');
|
|
7
|
+
*/
|
|
8
|
+
import { EventBridgeEvent } from 'aws-lambda';
|
|
9
|
+
import { getExecutionHistory } from '@cumulus/aws-client/StepFunctions';
|
|
1
10
|
import { Message } from '@cumulus/types';
|
|
2
11
|
/**
|
|
3
12
|
* Given a Step Function event, replace specified key in event with contents
|
|
@@ -25,4 +34,51 @@ export declare const pullStepFunctionEvent: (event: {
|
|
|
25
34
|
* @alias module:StepFunctions
|
|
26
35
|
*/
|
|
27
36
|
export declare const parseStepMessage: (stepMessage: Message.CMAMessage, stepName: string) => Promise<Message.CumulusMessage>;
|
|
37
|
+
/**
|
|
38
|
+
* Searches the Execution step History for the TaskStateEntered pertaining to
|
|
39
|
+
* the failed task Id. HistoryEvent ids are numbered sequentially, starting at
|
|
40
|
+
* one.
|
|
41
|
+
*
|
|
42
|
+
* @param {HistoryEvent[]} events - Step Function events array
|
|
43
|
+
* @param {HistoryEvent} failedStepEvent - Step Function's failed event.
|
|
44
|
+
* @returns {string} name of the current stepfunction task or 'UnknownFailedStepName'.
|
|
45
|
+
*/
|
|
46
|
+
export declare const getFailedStepName: (events: AWS.StepFunctions.HistoryEvent[], failedStepEvent: {
|
|
47
|
+
id: number;
|
|
48
|
+
}) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Finds all failed execution events and returns the last one in the list.
|
|
51
|
+
*
|
|
52
|
+
* @param {Array<HistoryEventList>} events - array of AWS Stepfunction execution HistoryEvents
|
|
53
|
+
* @returns {HistoryEvent|[]} - the last lambda or activity that failed in the
|
|
54
|
+
* event array, or an empty array.
|
|
55
|
+
*/
|
|
56
|
+
export declare const lastFailedEventStep: (events: AWS.StepFunctions.HistoryEvent[]) => AWS.StepFunctions.HistoryEvent | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Get message to use for publishing failed execution notifications.
|
|
59
|
+
*
|
|
60
|
+
* Try to get the input to the last failed step in the execution so we can
|
|
61
|
+
* update the status of any granules/PDRs that don't exist in the initial execution
|
|
62
|
+
* input.
|
|
63
|
+
*
|
|
64
|
+
* Falls back to overall execution input.
|
|
65
|
+
*
|
|
66
|
+
* @param {Object} inputCumulusMessage - Workflow execution input message
|
|
67
|
+
* @param {Function} getExecutionHistoryFunction - Testing override for mock/etc of
|
|
68
|
+
* StepFunctions.getExecutionHistory
|
|
69
|
+
* @returns {Object} - CumulusMessage Execution step message or execution input message
|
|
70
|
+
*/
|
|
71
|
+
export declare const getFailedExecutionMessage: (inputCumulusMessage: Message.CumulusMessage, getExecutionHistoryFunction?: typeof getExecutionHistory) => Promise<Message.CumulusMessage | {
|
|
72
|
+
exception: {
|
|
73
|
+
failedExecutionStepName: string;
|
|
74
|
+
error?: string | undefined;
|
|
75
|
+
cause?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
cumulus_meta: Message.CumulusMeta;
|
|
78
|
+
meta: Message.Meta;
|
|
79
|
+
payload: unknown;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const getCumulusMessageFromExecutionEvent: (executionEvent: EventBridgeEvent<"Step Functions Execution Status Change", {
|
|
82
|
+
[key: string]: string;
|
|
83
|
+
}>) => Promise<Message.CumulusMessage>;
|
|
28
84
|
//# sourceMappingURL=StepFunctions.d.ts.map
|
package/StepFunctions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepFunctions.d.ts","sourceRoot":"","sources":["src/StepFunctions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StepFunctions.d.ts","sourceRoot":"","sources":["src/StepFunctions.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA6BzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,UACzB;IACL,OAAO,CAAC,EAAE,QAAQ,aAAa,CAAA;CAChC,KACA,QAAQ,OAAO,CAyBjB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,gBACd,QAAQ,UAAU,YACrB,MAAM,oCAkBjB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,WACpB,IAAI,aAAa,CAAC,YAAY,EAAE,mBACvB;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,WAehC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,WACtB,IAAI,aAAa,CAAC,YAAY,EAAE,KACvC,IAAI,aAAa,CAAC,YAAY,GAAG,SAInC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,wBACf,QAAQ,cAAc,gCACd,0BAA0B;;;;;;;;;EAwCxD,CAAC;AAEF,eAAO,MAAM,mCAAmC;;sCA2B/C,CAAC"}
|