Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
else res.end();
});
return app;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Startup Environment
////////////////////////////////////////////////////////////////////////////////////////////////
const createContext = require("./runtime"),
wellKnownSymbols = require("./lib/symbol").wellKnownSymbols,
repl = require("repl"),
{ observe, computed, dispose } = require("hyperactiv"),
{ Observable, Computable } = require("hyperactiv/mixins"),
ObservableObject = Computable(Observable(Object)),
wss = require('hyperactiv/websocket/server').server;
async function environment(config) {
config.hooks = config.hooks || { };
if (config.hooks.init) await config.hooks.init(config);
if (config.symbols) {
Object.assign(wellKnownSymbols, config.symbols)
}
if (config.cache) {
require("./lib/model/contract").cache = require('memoize-fs')({ cachePath: config.cache });
}
const { Observable, Computable } = require("hyperactiv/mixins");
class Subscription extends Computable(Observable(Object)) {
constructor(base, data) {
super({ });
if (base) {
if (base.service) {
Object.defineProperty(this, "contract", { value: base, enumerable: false });
Object.defineProperty(this, "service", { value: base.service, enumerable: false });
}
else if (base.socket) {
Object.defineProperty(this, "service", { value: base, enumerable: false });
}
}
Object.defineProperty(this, "subscriptions", { value: [ ], enumerable: false });
}
require("sugar").extend()
const { observe, computed, dispose } = require("hyperactiv"),
{ Observable, Computable } = require("hyperactiv/mixins"),
ObservableObject = Computable(Observable(Object));
const utility = {
at: require('node-schedule').scheduleJob,
get time() { return Date.create() },
require,
process,
observe,
computed,
dispose,
Observable,
Computable,
ObservableObject
}
let math = require("simple-statistics")
Object.assign(math, require("numeric"))
const { session, constants } = require("../index"),
{ processCommandLineArgs, preprocess } = require("./program"),
{ observe, computed, dispose } = require("hyperactiv"),
{ Observable, Computable } = require("hyperactiv/mixins"),
wss = require('hyperactiv/websocket/server').server,
ObservableObject = Computable(Observable(Object)),
Context = require("./context"),
http = require('http'),
WebSocket = require('ws'),
express = require('express'),
bodyParser = require('body-parser'),
util = require('util'),
repl = require("repl");
function createApp(context, app) {
app = app || express();
app.use("/hyperactiv", express.static("node_modules/hyperactiv"));
app.use(express.static(__dirname + '/html'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());