<commit_before>import { WS_CLOSED } from "./actionTypes";
import { wsUpdateAnalysis, wsRemoveAnalysis } from "./analyses/actions";
import { wsUpdateSample, wsRemoveSample } from "./samples/actions";
import { wsUpdateFile, wsRemoveFile } from "./files/actions";
import { wsUpdateIndex } from "./indexes/actions";
import { wsUpdateJob, wsRemoveJob } from "./jobs/actions";
import { wsUpdateProcess, wsInsertProcess } from "./processes/actions";
import { wsUpdateReference } from "./references/actions";
import { wsUpdateStatus } from "./status/actions";
import { wsInsertSubtraction, wsUpdateSubtraction, wsRemoveSubtraction } from "./subtraction/actions";
import { wsInsertUser, wsUpdateUser, wsRemoveUser } from "./users/actions";

const documentInserters = {
    processes: wsInsertProcess,
    subtraction: wsInsertSubtraction,
    users: wsInsertUser
};

const documentUpdaters = {
    analyses: wsUpdateAnalysis,
    files: wsUpdateFile,
    indexes: wsUpdateIndex,
    jobs: wsUpdateJob,
    processes: wsUpdateProcess,
    references: wsUpdateReference,
    samples: wsUpdateSample,
    status: wsUpdateStatus,
    subtraction: wsUpdateSubtraction,
    users: wsUpdateUser
};

const documentRemovers = {
    analyses: wsRemoveAnalysis,
    files: wsRemoveFile,
    jobs: wsRemoveJob,
    samples: wsRemoveSample,
    subtraction: wsRemoveSubtraction,
    users: wsRemoveUser
};

export default function WSConnection (dispatch) {

    // The Redux store's dispatch method.
    this.dispatch = dispatch;

    // When a websocket message is received, this method is called with the message as the sole argument. Every message
    // has a property "operation" that tells the dispatcher what to do. Illegal operation names will throw an error.<commit_msg>Add all insert/update/remove updaters that require websocket messages<commit_after>import { WS_CLOSED } from "./actionTypes";
import { wsInsertAnalysis, wsUpdateAnalysis, wsRemoveAnalysis } from "./analyses/actions";
import { wsInsertSample, wsUpdateSample, wsRemoveSample } from "./samples/actions";
import { wsInsertFile, wsUpdateFile, wsRemoveFile } from "./files/actions";
import { wsInsertIndex, wsUpdateIndex, wsRemoveIndex } from "./indexes/actions";
import { wsInsertJob, wsUpdateJob, wsRemoveJob } from "./jobs/actions";
import { wsInsertProcess, wsUpdateProcess } from "./processes/actions";
import { wsInsertReference, wsUpdateReference, wsRemoveReference } from "./references/actions";
import { wsUpdateStatus } from "./status/actions";
import { wsInsertSubtraction, wsUpdateSubtraction, wsRemoveSubtraction } from "./subtraction/actions";
import { wsInsertUser, wsUpdateUser, wsRemoveUser } from "./users/actions";

const documentInserters = {
    analyses: wsInsertAnalysis,
    files: wsInsertFile,
    indexes: wsInsertIndex,
    jobs: wsInsertJob,
    processes: wsInsertProcess,
    references: wsInsertReference,
    samples: wsInsertSample,
    subtraction: wsInsertSubtraction,
    users: wsInsertUser
};

const documentUpdaters = {
    analyses: wsUpdateAnalysis,
    files: wsUpdateFile,
    indexes: wsUpdateIndex,
    jobs: wsUpdateJob,
    processes: wsUpdateProcess,
    references: wsUpdateReference,
    samples: wsUpdateSample,
    status: wsUpdateStatus,
    subtraction: wsUpdateSubtraction,
    users: wsUpdateUser
};

const documentRemovers = {
    analyses: wsRemoveAnalysis,
    files: wsRemoveFile,
    indexes: wsRemoveIndex,
    jobs: wsRemoveJob,
    references: wsRemoveReference,
    samples: wsRemoveSample,
    subtraction: wsRemoveSubtraction,
    users: wsRemoveUser
};

export default function WSConnection (dispatch) {

    // The Redux store's dispatch method.
    this.dispatch = dispatch;

    // When a websocket message is received, this method is called with the message as the sole argument. Every message
    // has a property "operation" that tells the dispatcher what to do. Illegal operation names will throw an error.
{'fraction_non_alphanumeric': 0.09100152516522624, 'fraction_numerical': 0.0, 'mean_word_length': 4.542253521126761, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2980900', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1064, 'n_words': 322}