function clean(flowConfig) {
    flowConfig = flowConfig || { allNodes: {}, subflows: {} };
    const knownNodes = new Set(Object.keys(flowConfig.allNodes))

    // We need to alias all of the subflow instance contents
    for (const subflow of Object.values(flowConfig.subflows || {})) {
        subflow.instances.forEach(instance => {
            for (const nodeId of Object.keys(subflow.nodes || {})) {
                knownNodes.add(`${instance.id}-${nodeId}`)
            }
            for (const nodeId of Object.keys(subflow.configs || {})) {
                knownNodes.add(`${instance.id}-${nodeId}`)
            }
        })
    }
    var promises = [];
    for (const store of Object.values(stores)){
        promises.push(store.clean(Array.from(knownNodes)));
    }
    for (const id of Object.keys(contexts)) {
        if (id !== "global") {
            var idParts = id.split(":");
            if (!knownNodes.has(idParts[0])) {
                delete contexts[id];
            }
        }
    }
    return Promise.all(promises);
}
Delete any contexts that are no longer in use
@param flowConfig object includes allNodes as object of id->node

If flowConfig is undefined, all flow/node contexts will be removed