<commit_before>/* jslint node: true, esnext: true */

"use strict";

const kronos = require('kronos-service-manager');

const koa = require('koa');
const route = require('koa-route');
const jwt = require('koa-jwt');
const websockify = require('koa-websocket');

exports.defaultKronosPort = 10000;

exports.manager = function (options) {
  return kronos.manager(options).then(function (manager) {
    const stepNames = Object.keys(manager.stepImplementations);

    const port = options.port || exports.defaultKronosPort;

    const healthMountPoint = '/health';

    manager.consul.services[kronosService.name] = kronosService;

    const app = websockify(koa());
    manager.app = app;

    const hc = require('./controllers/health').initialize(manager);
    app.use(route.get(healthMountPoint, hc.status));

    const sc = require('./controllers/state').initialize(manager);
    app.use(route.get('/state', sc.list));
    app.ws.use(route.all('/state', sc.ws));

    const fc = require('./controllers/flow').initialize(manager);
    app.use(route.get('/flows', fc.list));
    app.use(route.get('/flows/:id', fc.fetch));
    app.use(route.delete('/flows/:id', fc.delete));
    app.use(route.post('/flows', fc.insert));
    app.ws.use(route.all('/flows', fc.ws));

    manager.httpServer = app.listen(port);

    const protoShutdown = manager.shutdown;

    manager.shutdown = function () {
      return Promise.all([protoShutdown(), new Promise(function (resolve, reject) {
        manager.httpServer.close(function (error) {
          if (error) {
            reject(error);
          } else {
            delete manager.app;
            delete manager.httpServer;

            resolve(manager);
          }
        });
      })]);
    };

    return manager;
  });
};
<commit_msg>fix: test are working<commit_after>/* jslint node: true, esnext: true */

"use strict";

const kronos = require('kronos-service-manager');

const koa = require('koa');
const route = require('koa-route');
const jwt = require('koa-jwt');
const websockify = require('koa-websocket');

exports.defaultKronosPort = 10000;

exports.manager = function (options) {
  return kronos.manager(options).then(function (manager) {
    const stepNames = Object.keys(manager.stepImplementations);

    const port = options.port || exports.defaultKronosPort;

    const healthMountPoint = '/health';

    const app = websockify(koa());
    manager.app = app;

    const hc = require('./controllers/health').initialize(manager);
    app.use(route.get(healthMountPoint, hc.status));

    const sc = require('./controllers/state').initialize(manager);
    app.use(route.get('/state', sc.list));
    app.ws.use(route.all('/state', sc.ws));

    const fc = require('./controllers/flow').initialize(manager);
    app.use(route.get('/flows', fc.list));
    app.use(route.get('/flows/:id', fc.fetch));
    app.use(route.delete('/flows/:id', fc.delete));
    app.use(route.post('/flows', fc.insert));
    app.ws.use(route.all('/flows', fc.ws));

    manager.httpServer = app.listen(port);

    const protoShutdown = manager.shutdown;

    manager.shutdown = function () {
      return Promise.all([protoShutdown(), new Promise(function (resolve, reject) {
        manager.httpServer.close(function (error) {
          if (error) {
            reject(error);
          } else {
            delete manager.app;
            delete manager.httpServer;

            resolve(manager);
          }
        });
      })]);
    };

    return manager;
  });
};

{'fraction_non_alphanumeric': 0.16647662485746864, 'fraction_numerical': 0.0028506271379703536, 'mean_word_length': 3.152662721893491, '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': '3571541', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1090, 'n_words': 199}