models/actions/Action.js

export default class Action {
    /**
     * Creates a new Action instance from the provider parameters.
     *
     * @constructor Action
     * @param {Object} actionMap - Action parameters
     * @param {string} type - Type
     * @param {Object<string, string>} [data={}] - Data
     */
    constructor(actionMap) {
        this.type = actionMap.type;
        this.data = actionMap.data || {};
    }

    /**
     * Create an action instance
     *
     * @memberof Action
     * @param {string} type - Type of action.
     * @param {Object<string, string>} data - Custom data.
     * @return {Action} Action instance.
     */
    static create(type, data) {
        return new Action({ type, data});
    }
}