import type { Action } from '../store/state/state-manager';
/**
* Provides the basic APIs to sequence different type of actions in the Constellation infrastructure.
*
* Actions are classified into 2 types blocking actions and deferred actions.
*
* For example: In an assignment, File Attachment is blocking action while finishAssignment is deferred action.
* By using these apis, it is ensured that a deferred action is always fired when all blocking actions are completed.
*
*/
declare class ActionsSequencer {
MISSING_CONTEXT_PARAM: string;
INVALID_CONTEXT_DETAILS: string;
INVALID_CONTEXT_OPERATION: string;
/**
* Dispatches queued actions on completion of currently running action.Called from deRegisterBlockingAction,handleDeferredActionCompletion
* @param context
* For example: "app/modal_1"
* @param contextDataObject data object for respective context fetched from redux
*
* @function
* @private
*/
schedulePendingActionOnCompletion(context: string, contextDataObject: {
context_data: {
blocking_action_counter: number;
deferred_action_queue: Action[];
is_deferred_action_in_progress: boolean;
};
}): void;
/**
* executes or queues deferred actions in the context of a container
* @example
In this example, the API tries to execute or queue the specified deferred action in the context of the 'app/primary_1' container and returns a promise containing the status of the deferred action
* PCore.getActionsSequencer().executeOrQueueDeferredAction({
* type: theType
* payload: {
* context: app/primary_1,
* //include other payload properties
* }
* }).then(successCallback).catch(failureCallback);
* @param actionPayload The deferred action that must be executed or queued
* @returns A promise associated with the action
*
* - The promise resolves successfully when the deferred action has been either executed or queued.
*
- The promise rejects with an error message when the deferred action has been neither executed nor queued.
*
*
* @function
*/
executeOrQueueDeferredAction(actionPayload: Action): Promise;
/**
* signals the completion of execution of the ongoing deferred action and schedules the next deferred action in queue for execution
* @example In this example, the API tries to signal the completion of execution of the ongoing deferred action and returns a promise associated with the action.
* PCore.getActionsSequencer().handleDeferredActionCompletion("app/primary_1").then(successCallback).catch(failureCallback);
* @param context The name of the context where the API is being called
* @returns A promise associated with the action
* Note:
*
* - The promise resolves successfully when the execution of the deferred action has been completed.
*
- The promise rejects with an error message when the execution of the deferred action has not been completed.
*
*
* @function
*/
handleDeferredActionCompletion(context: string): Promise;
/**
* Registers an ongoing blocking action in the context of a container
* @example In this example, the API tries to register the ongoing blocking action in the context of the app/primary_1 container and returns a promise containing the registration status
* PCore.getActionsSequencer().registerBlockingAction("app/primary_1").then(successCallback).catch(failureCallback);
* @param context The name of the context where the APi si being called.
* @returns A promise containing the registration status of the ongoing blocking action
* @function
* @public
*/
registerBlockingAction(context: string): Promise;
/**
* De-registers an ongoing blocking action in the context of a container when the blocking action is completed
* @example In this example , the API tries to de-register the ongoing blocking action in the context of the app/primary_1 container and returns a promise containing the de-registration status
* PCore.getActionsSequencer().deRegisterBlockingAction("app/primary_1").then(successCallback).catch(failureCallback);
* @param context The name of the context where the API is being called.
* @returns A promise containing the de-registration status of the ongoing blocking action
* @function
* @public
*/
deRegisterBlockingAction(context: string): Promise;
/**
* cancels queued deferred actions when an error occurs
* @example In this example, the API cancels queued deferred actions when an error occurs.
* PCore.getActionsSequencer().cancelDeferredActionsOnError("app/primary_1");
* @param context The name of the context where the API is being called.
* @function
* @public
*/
cancelDeferredActionsOnError(context: string): void;
/**
* checks if and deferred action is currently in progress
* @param context
* For example: "app/modal_1"
* @param contextDataObject data object for respective context fetched from redux
*
* @function
* @private
*/
isDeferredActionInProgress(context: string): boolean | Promise;
}
declare const _default: ActionsSequencer;
export default _default;