<commit_before>/**
 * Created by ksinger on 23.09.2015.
 *
 * Contains a list of actions to be used with the dispatcher and documentation for their expected payloads.
 */
import { tree2constants, deepFreeze, reduceAndMapTreeKeys, flattenTree } from './utils';
import './service/won';

export const actionTypes = tree2constants({

    /* actions received as responses or push notifications */
    received: {
        /* contains all user-bound data, e.g. ownedPosts,
         * drafts, messages,...
         * This action will likely be caused as a consequence of signing in.
         */
        userData : null
    },
    drafts: {
        /*
         * A new draft was created (either through the view in this client or on another browser)
         */
        new: null,
        /*
         * A draft has changed. Pass along the draftURI and the respective data.
         */
        change: {
            type: null,
            title: null,
            thumbnail: null,
        },
        delete: null,
        select: null
    },
    ownpost: {
        new: null,
    },
    moreWub: null
});

/**
 * actionCreators are functions that take the payload and output
 * an action object, thus prebinding the action-type.
 *
 * e.g.:
 *
 * ```javascript
 * function newDraft(draft) {
 *   return { type: 'draft.new', payload: draft }
 * }
 * ```
 */
export const actionCreators = flattenTree(
        reduceAndMapTreeKeys(
            (acc, k) => acc.concat(k), //construct paths, e.g. ['draft', 'new']
            (acc) => createActionCreator(won.lookup(actionTypes, acc)), //lookup constant at path
            [], actionTypes
        ),
    '__');

function createActionCreator(type) {<commit_msg>More docu.<commit_after>/**
 * Created by ksinger on 23.09.2015.
 *
 * Contains a list of actions to be used with the dispatcher and documentation for their expected payloads.
 */
import { tree2constants, deepFreeze, reduceAndMapTreeKeys, flattenTree } from './utils';
import './service/won';

export const actionTypes = tree2constants({

    /* actions received as responses or push notifications */
    received: {
        /* contains all user-bound data, e.g. ownedPosts,
         * drafts, messages,...
         * This action will likely be caused as a consequence of signing in.
         */
        userData : null
    },
    drafts: {
        /*
         * A new draft was created (either through the view in this client or on another browser)
         */
        new: null,
        /*
         * A draft has changed. Pass along the draftURI and the respective data.
         */
        change: {
            type: null,
            title: null,
            thumbnail: null,
        },
        delete: null,
        select: null
    },
    ownpost: {
        new: null,
    },
    moreWub: null
});

/**
 * actionCreators are functions that take the payload and output
 * an action object, thus prebinding the action-type.
 * This object follows the structure of the actionTypes-object,
 * but is flattened for use with ng-redux. Thus calling
 * `$ngRedux.dispatch(actionCreators.drafts__new(myDraft))` will trigger an action
 * `{type: actionTypes.drafts.new, payload: myDraft}`
 *
 * e.g.:
 *
 * ```javascript
 * function newDraft(draft) {
 *   return { type: 'draft.new', payload: draft }
 * }
 * ```
 */
export const actionCreators = flattenTree(
        reduceAndMapTreeKeys(
            (acc, k) => acc.concat(k), //construct paths, e.g. ['draft', 'new']
            (acc) => createActionCreator(won.lookup(actionTypes, acc)), //lookup constant at path
            [], actionTypes
        ),
    '__');

function createActionCreator(type) {
{'fraction_non_alphanumeric': 0.11205479452054795, 'fraction_numerical': 0.005479452054794521, 'mean_word_length': 2.2252650176678443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493971', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1016, 'n_words': 349}