UNPKG

@cumulus/message

Version:

Utilities for building and parsing Cumulus messages

110 lines 3.94 kB
import { Message } from '@cumulus/types'; import { ApiExecution } from '@cumulus/types/api/executions'; interface MessageWithPayload extends Message.CumulusMessage { payload: object; } /** * Build execution ARN from a state machine ARN and execution name * * @param {string} stateMachineArn - state machine ARN * @param {string} executionName - state machine's execution name * @returns {string} an execution ARN * * @alias module:Executions */ export declare const buildExecutionArn: (stateMachineArn: string, executionName: string) => string | null; /** * Returns execution URL from an execution ARN. * * @param {string} executionArn - an execution ARN * @returns {string} returns AWS console URL for the execution * * @alias module:Executions */ export declare const getExecutionUrlFromArn: (executionArn: string) => string; /** * Get state machine ARN from an execution ARN * * @param {string} executionArn - an execution ARN * @returns {string} a state machine ARN * * @alias module:Executions */ export declare const getStateMachineArnFromExecutionArn: (executionArn: string) => string | null; /** * Get the execution name from a workflow message. * * @param {Message.CumulusMessage} message - A workflow message object * @returns {string} An execution name * @throws {Error} if there is no execution name * * @alias module:Executions */ export declare const getMessageExecutionName: (message: Message.CumulusMessage) => string; /** * Get the state machine ARN from a workflow message. * * @param {Message.CumulusMessage} message - A workflow message object * @returns {string} A state machine ARN * @throws {Error} if there is not state machine ARN * * @alias module:Executions */ export declare const getMessageStateMachineArn: (message: Message.CumulusMessage) => string; /** * Get the execution ARN from a workflow message. * * @param {Message.CumulusMessage} message - A workflow message object * @returns {null|string} A state machine execution ARN * * @alias module:Executions */ export declare const getMessageExecutionArn: (message: Message.CumulusMessage) => string | null; /** * Get the parent execution ARN from a workflow message, if any. * * @param {Message.CumulusMessage} message - A workflow message object * @returns {undefined|string} A state machine execution ARN * * @alias module:Executions */ export declare const getMessageExecutionParentArn: (message: Message.CumulusMessage) => string | undefined; /** * Get the Cumulus version from a workflow message, if any. * * @param {Message.CumulusMessage} message - A workflow message object * @returns {undefined|string} The cumulus version * * @alias module:Executions */ export declare const getMessageCumulusVersion: (message: Message.CumulusMessage) => string | undefined; /** * Get the workflow original payload, if any. * * @param {MessageWithPayload} message - A workflow message object * @returns {unknown|undefined} The workflow original payload * * @alias module:Executions */ export declare const getMessageExecutionOriginalPayload: (message: MessageWithPayload) => object | undefined; /** * Get the workflow final payload, if any. * * @param {MessageWithPayload} message - A workflow message object * @returns {unknown|undefined} The workflow final payload * * @alias module:Executions */ export declare const getMessageExecutionFinalPayload: (message: MessageWithPayload) => object | undefined; /** * Generate an execution record for the API from the message. * * @param {MessageWithPayload} message - A workflow message object * @param {string} [updatedAt] - Optional updated timestamp to apply to record * @returns {ApiExecution} An execution API record * * @alias module:Executions */ export declare const generateExecutionApiRecordFromMessage: (message: MessageWithPayload, updatedAt?: number) => ApiExecution; export {}; //# sourceMappingURL=Executions.d.ts.map