hotstaq 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +17 -0
- package/.eslintrc.js +11 -0
- package/.vscode/launch.json +199 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +78 -0
- package/CONTRIBUTING.md +157 -0
- package/README.md +126 -0
- package/bin/hotstaq +3 -0
- package/bin/hotstaq.cmd +1 -0
- package/build/src/Hot.d.ts +167 -0
- package/build/src/Hot.d.ts.map +1 -0
- package/build/src/Hot.js +365 -0
- package/build/src/Hot.js.map +1 -0
- package/build/src/HotAPI.d.ts +130 -0
- package/build/src/HotAPI.d.ts.map +1 -0
- package/build/src/HotAPI.js +353 -0
- package/build/src/HotAPI.js.map +1 -0
- package/build/src/HotAgentAPI.d.ts +22 -0
- package/build/src/HotAgentAPI.d.ts.map +1 -0
- package/build/src/HotAgentAPI.js +85 -0
- package/build/src/HotAgentAPI.js.map +1 -0
- package/build/src/HotAgentRoute.d.ts +17 -0
- package/build/src/HotAgentRoute.d.ts.map +1 -0
- package/build/src/HotAgentRoute.js +109 -0
- package/build/src/HotAgentRoute.js.map +1 -0
- package/build/src/HotBuilder.d.ts +52 -0
- package/build/src/HotBuilder.d.ts.map +1 -0
- package/build/src/HotBuilder.js +239 -0
- package/build/src/HotBuilder.js.map +1 -0
- package/build/src/HotClient.d.ts +31 -0
- package/build/src/HotClient.d.ts.map +1 -0
- package/build/src/HotClient.js +19 -0
- package/build/src/HotClient.js.map +1 -0
- package/build/src/HotComponent.d.ts +118 -0
- package/build/src/HotComponent.d.ts.map +1 -0
- package/build/src/HotComponent.js +89 -0
- package/build/src/HotComponent.js.map +1 -0
- package/build/src/HotCreator.d.ts +92 -0
- package/build/src/HotCreator.d.ts.map +1 -0
- package/build/src/HotCreator.js +465 -0
- package/build/src/HotCreator.js.map +1 -0
- package/build/src/HotDB.d.ts +69 -0
- package/build/src/HotDB.d.ts.map +1 -0
- package/build/src/HotDB.js +29 -0
- package/build/src/HotDB.js.map +1 -0
- package/build/src/HotDBConnectionInterface.d.ts +40 -0
- package/build/src/HotDBConnectionInterface.d.ts.map +1 -0
- package/build/src/HotDBConnectionInterface.js +3 -0
- package/build/src/HotDBConnectionInterface.js.map +1 -0
- package/build/src/HotFile.d.ts +134 -0
- package/build/src/HotFile.d.ts.map +1 -0
- package/build/src/HotFile.js +454 -0
- package/build/src/HotFile.js.map +1 -0
- package/build/src/HotHTTPServer.d.ts +162 -0
- package/build/src/HotHTTPServer.d.ts.map +1 -0
- package/build/src/HotHTTPServer.js +863 -0
- package/build/src/HotHTTPServer.js.map +1 -0
- package/build/src/HotIO.d.ts +39 -0
- package/build/src/HotIO.d.ts.map +1 -0
- package/build/src/HotIO.js +195 -0
- package/build/src/HotIO.js.map +1 -0
- package/build/src/HotLog.d.ts +60 -0
- package/build/src/HotLog.d.ts.map +1 -0
- package/build/src/HotLog.js +126 -0
- package/build/src/HotLog.js.map +1 -0
- package/build/src/HotPage.d.ts +125 -0
- package/build/src/HotPage.d.ts.map +1 -0
- package/build/src/HotPage.js +178 -0
- package/build/src/HotPage.js.map +1 -0
- package/build/src/HotRoute.d.ts +82 -0
- package/build/src/HotRoute.d.ts.map +1 -0
- package/build/src/HotRoute.js +83 -0
- package/build/src/HotRoute.js.map +1 -0
- package/build/src/HotRouteMethod.d.ts +129 -0
- package/build/src/HotRouteMethod.d.ts.map +1 -0
- package/build/src/HotRouteMethod.js +84 -0
- package/build/src/HotRouteMethod.js.map +1 -0
- package/build/src/HotServer.d.ts +152 -0
- package/build/src/HotServer.d.ts.map +1 -0
- package/build/src/HotServer.js +109 -0
- package/build/src/HotServer.js.map +1 -0
- package/build/src/HotSetAsWeb.d.ts +2 -0
- package/build/src/HotSetAsWeb.d.ts.map +1 -0
- package/build/src/HotSetAsWeb.js +5 -0
- package/build/src/HotSetAsWeb.js.map +1 -0
- package/build/src/HotStaq.d.ts +601 -0
- package/build/src/HotStaq.d.ts.map +1 -0
- package/build/src/HotStaq.js +1258 -0
- package/build/src/HotStaq.js.map +1 -0
- package/build/src/HotStaqWeb.d.ts +18 -0
- package/build/src/HotStaqWeb.d.ts.map +1 -0
- package/build/src/HotStaqWeb.js +44 -0
- package/build/src/HotStaqWeb.js.map +1 -0
- package/build/src/HotTestDriver.d.ts +63 -0
- package/build/src/HotTestDriver.d.ts.map +1 -0
- package/build/src/HotTestDriver.js +187 -0
- package/build/src/HotTestDriver.js.map +1 -0
- package/build/src/HotTestElement.d.ts +71 -0
- package/build/src/HotTestElement.d.ts.map +1 -0
- package/build/src/HotTestElement.js +37 -0
- package/build/src/HotTestElement.js.map +1 -0
- package/build/src/HotTestMap.d.ts +83 -0
- package/build/src/HotTestMap.d.ts.map +1 -0
- package/build/src/HotTestMap.js +58 -0
- package/build/src/HotTestMap.js.map +1 -0
- package/build/src/HotTestSeleniumDriver.d.ts +82 -0
- package/build/src/HotTestSeleniumDriver.d.ts.map +1 -0
- package/build/src/HotTestSeleniumDriver.js +398 -0
- package/build/src/HotTestSeleniumDriver.js.map +1 -0
- package/build/src/HotTester.d.ts +188 -0
- package/build/src/HotTester.d.ts.map +1 -0
- package/build/src/HotTester.js +623 -0
- package/build/src/HotTester.js.map +1 -0
- package/build/src/HotTesterAPI.d.ts +15 -0
- package/build/src/HotTesterAPI.d.ts.map +1 -0
- package/build/src/HotTesterAPI.js +161 -0
- package/build/src/HotTesterAPI.js.map +1 -0
- package/build/src/HotTesterMocha.d.ts +50 -0
- package/build/src/HotTesterMocha.d.ts.map +1 -0
- package/build/src/HotTesterMocha.js +205 -0
- package/build/src/HotTesterMocha.js.map +1 -0
- package/build/src/HotTesterMochaSelenium.d.ts +70 -0
- package/build/src/HotTesterMochaSelenium.d.ts.map +1 -0
- package/build/src/HotTesterMochaSelenium.js +257 -0
- package/build/src/HotTesterMochaSelenium.js.map +1 -0
- package/build/src/HotTesterServer.d.ts +114 -0
- package/build/src/HotTesterServer.d.ts.map +1 -0
- package/build/src/HotTesterServer.js +575 -0
- package/build/src/HotTesterServer.js.map +1 -0
- package/build/src/api.d.ts +33 -0
- package/build/src/api.d.ts.map +1 -0
- package/build/src/api.js +78 -0
- package/build/src/api.js.map +1 -0
- package/build/src/cli.d.ts +2 -0
- package/build/src/cli.d.ts.map +1 -0
- package/build/src/cli.js +935 -0
- package/build/src/cli.js.map +1 -0
- package/build/src/schemas/HotDBInflux.d.ts +63 -0
- package/build/src/schemas/HotDBInflux.d.ts.map +1 -0
- package/build/src/schemas/HotDBInflux.js +239 -0
- package/build/src/schemas/HotDBInflux.js.map +1 -0
- package/build/src/schemas/HotDBMigration.d.ts +19 -0
- package/build/src/schemas/HotDBMigration.d.ts.map +1 -0
- package/build/src/schemas/HotDBMigration.js +15 -0
- package/build/src/schemas/HotDBMigration.js.map +1 -0
- package/build/src/schemas/HotDBMySQL.d.ts +65 -0
- package/build/src/schemas/HotDBMySQL.d.ts.map +1 -0
- package/build/src/schemas/HotDBMySQL.js +387 -0
- package/build/src/schemas/HotDBMySQL.js.map +1 -0
- package/build/src/schemas/HotDBSchema.d.ts +15 -0
- package/build/src/schemas/HotDBSchema.d.ts.map +1 -0
- package/build/src/schemas/HotDBSchema.js +19 -0
- package/build/src/schemas/HotDBSchema.js.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts +14 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.js +33 -0
- package/build/src/schemas/influx/InfluxSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts +39 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.js +151 -0
- package/build/src/schemas/mysql/MySQLSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts +168 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js +260 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts +49 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js +310 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js.map +1 -0
- package/build-web/HotStaq.js +2 -0
- package/build-web/HotStaq.min.js +125 -0
- package/builder/docker/Dockerfile.linux.gen +42 -0
- package/builder/docker/README.md +36 -0
- package/builder/docker/app/start.sh +8 -0
- package/builder/docker/dockerignore +3 -0
- package/builder/docker/scripts/build.bat +11 -0
- package/builder/docker/scripts/build.sh +11 -0
- package/builder/docker/scripts/start-app.bat +7 -0
- package/builder/docker/scripts/start-app.sh +7 -0
- package/builder/docker/scripts/stop-app.bat +5 -0
- package/builder/docker/scripts/stop-app.sh +5 -0
- package/builder/docker-compose/docker-compose.gen.yaml +41 -0
- package/builder/docker-compose/env-skeleton +4 -0
- package/creator/project/.vscode/launch.json +59 -0
- package/creator/project/README.md +20 -0
- package/creator/project/gitignore +118 -0
- package/creator/project/npmignore +118 -0
- package/creator/public/api-test.hott +28 -0
- package/creator/public/index.hott +12 -0
- package/creator/ts/src/AppAPI.ts +30 -0
- package/creator/ts/src/HelloWorld.ts +39 -0
- package/creator/ts/src/WebExport.ts +7 -0
- package/creator/ts/tsconfig-web.json +73 -0
- package/creator/ts/tsconfig.json +73 -0
- package/creator/ts/webpack-api.config.js +57 -0
- package/dbstart.sh +19 -0
- package/dbstop.sh +4 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +128 -0
- package/docs/classes/Hot.md +477 -0
- package/docs/classes/HotAPI.md +369 -0
- package/docs/classes/HotClient.md +95 -0
- package/docs/classes/HotComponent.md +279 -0
- package/docs/classes/HotDB.md +247 -0
- package/docs/classes/HotDBInflux.md +404 -0
- package/docs/classes/HotDBMigration.md +80 -0
- package/docs/classes/HotDBMySQL.md +310 -0
- package/docs/classes/HotDBSchema.md +51 -0
- package/docs/classes/HotFile.md +353 -0
- package/docs/classes/HotHTTPServer.md +700 -0
- package/docs/classes/HotLog.md +162 -0
- package/docs/classes/HotPage.md +357 -0
- package/docs/classes/HotRoute.md +312 -0
- package/docs/classes/HotRouteMethod.md +271 -0
- package/docs/classes/HotServer.md +311 -0
- package/docs/classes/HotStaq.md +1153 -0
- package/docs/classes/HotTestDestination.md +58 -0
- package/docs/classes/HotTestDriver.md +332 -0
- package/docs/classes/HotTestElement.md +88 -0
- package/docs/classes/HotTestElementOptions.md +71 -0
- package/docs/classes/HotTestMap.md +92 -0
- package/docs/classes/HotTestSeleniumDriver.md +529 -0
- package/docs/classes/HotTester.md +653 -0
- package/docs/classes/HotTesterAPI.md +493 -0
- package/docs/classes/HotTesterMocha.md +843 -0
- package/docs/classes/HotTesterMochaSelenium.md +896 -0
- package/docs/classes/HotTesterServer.md +633 -0
- package/docs/classes/InfluxSchema.md +74 -0
- package/docs/classes/MySQLSchema.md +199 -0
- package/docs/classes/MySQLSchemaField.md +330 -0
- package/docs/classes/MySQLSchemaTable.md +176 -0
- package/docs/enums/ConnectionStatus.md +43 -0
- package/docs/enums/DeveloperMode.md +38 -0
- package/docs/enums/EventExecutionType.md +43 -0
- package/docs/enums/HTTPMethod.md +32 -0
- package/docs/enums/HotDBGenerationType.md +30 -0
- package/docs/enums/HotLogLevel.md +88 -0
- package/docs/interfaces/HotDBConnectionInterface.md +116 -0
- package/docs/interfaces/HotDestination.md +62 -0
- package/docs/interfaces/HotSite.md +187 -0
- package/docs/interfaces/HotSiteMapPath.md +37 -0
- package/docs/interfaces/HotSiteRoute.md +79 -0
- package/docs/interfaces/HotStartOptions.md +115 -0
- package/docs/interfaces/HotTestPage.md +44 -0
- package/docs/interfaces/HotTestStop.md +62 -0
- package/docs/interfaces/IHotComponent.md +135 -0
- package/docs/interfaces/IHotStaq.md +118 -0
- package/docs/interfaces/IHotTestElement.md +54 -0
- package/docs/interfaces/IHotTestElementOptions.md +43 -0
- package/docs/interfaces/MySQLResults.md +43 -0
- package/docs/interfaces/MySQLSchemaFieldResult.md +75 -0
- package/docs/modules.md +162 -0
- package/package.json +65 -0
- package/selenium-start.sh +7 -0
- package/selenium-stop.sh +3 -0
- package/src/Hot.ts +319 -0
- package/src/HotAPI.ts +378 -0
- package/src/HotAgentAPI.ts +43 -0
- package/src/HotAgentRoute.ts +44 -0
- package/src/HotBuilder.ts +221 -0
- package/src/HotClient.ts +40 -0
- package/src/HotComponent.ts +158 -0
- package/src/HotCreator.ts +482 -0
- package/src/HotDB.ts +79 -0
- package/src/HotDBConnectionInterface.ts +40 -0
- package/src/HotFile.ts +617 -0
- package/src/HotHTTPServer.ts +954 -0
- package/src/HotIO.ts +128 -0
- package/src/HotLog.ts +158 -0
- package/src/HotPage.ts +206 -0
- package/src/HotRoute.ts +137 -0
- package/src/HotRouteMethod.ts +216 -0
- package/src/HotServer.ts +211 -0
- package/src/HotSetAsWeb.ts +3 -0
- package/src/HotStaq.ts +1877 -0
- package/src/HotStaqWeb.ts +59 -0
- package/src/HotTestDriver.ts +172 -0
- package/src/HotTestElement.ts +97 -0
- package/src/HotTestMap.ts +130 -0
- package/src/HotTestSeleniumDriver.ts +374 -0
- package/src/HotTester.ts +697 -0
- package/src/HotTesterAPI.ts +126 -0
- package/src/HotTesterMocha.ts +133 -0
- package/src/HotTesterMochaSelenium.ts +189 -0
- package/src/HotTesterServer.ts +551 -0
- package/src/api.ts +102 -0
- package/src/cli.ts +1147 -0
- package/src/schemas/HotDBInflux.ts +211 -0
- package/src/schemas/HotDBMigration.ts +24 -0
- package/src/schemas/HotDBMySQL.ts +312 -0
- package/src/schemas/HotDBSchema.ts +21 -0
- package/src/schemas/influx/InfluxSchema.ts +19 -0
- package/src/schemas/mysql/MySQLSchema.ts +90 -0
- package/src/schemas/mysql/MySQLSchemaField.ts +408 -0
- package/src/schemas/mysql/MySQLSchemaTable.ts +353 -0
- package/tsconfig-web.json +74 -0
- package/tsconfig.json +73 -0
- package/webpack.config.js +51 -0
- package/webpack.config.tests.js +56 -0
package/build/src/cli.js
ADDED
|
@@ -0,0 +1,935 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
+
function step(op) {
|
|
35
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
+
while (_) try {
|
|
37
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
+
switch (op[0]) {
|
|
40
|
+
case 0: case 1: t = op; break;
|
|
41
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
+
default:
|
|
45
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
+
if (t[2]) _.ops.pop();
|
|
50
|
+
_.trys.pop(); continue;
|
|
51
|
+
}
|
|
52
|
+
op = body.call(thisArg, _);
|
|
53
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
var ppath = __importStar(require("path"));
|
|
59
|
+
var fs = __importStar(require("fs"));
|
|
60
|
+
var commander = __importStar(require("commander"));
|
|
61
|
+
var HotStaq_1 = require("./HotStaq");
|
|
62
|
+
var HotHTTPServer_1 = require("./HotHTTPServer");
|
|
63
|
+
var HotLog_1 = require("./HotLog");
|
|
64
|
+
var Hot_1 = require("./Hot");
|
|
65
|
+
var HotTesterServer_1 = require("./HotTesterServer");
|
|
66
|
+
var HotBuilder_1 = require("./HotBuilder");
|
|
67
|
+
var HotCreator_1 = require("./HotCreator");
|
|
68
|
+
var HotTesterMochaSelenium_1 = require("./HotTesterMochaSelenium");
|
|
69
|
+
var HotDBMySQL_1 = require("./schemas/HotDBMySQL");
|
|
70
|
+
var HotIO_1 = require("./HotIO");
|
|
71
|
+
var HotAgentAPI_1 = require("./HotAgentAPI");
|
|
72
|
+
var HotTesterMocha_1 = require("./HotTesterMocha");
|
|
73
|
+
HotStaq_1.HotStaq.isWeb = false;
|
|
74
|
+
var VERSION = "";
|
|
75
|
+
var processor = new HotStaq_1.HotStaq();
|
|
76
|
+
processor.logger.logLevel = HotLog_1.HotLogLevel.All;
|
|
77
|
+
var hotsitePath = "";
|
|
78
|
+
var globalLogLevel = null;
|
|
79
|
+
/**
|
|
80
|
+
* Start the API server.
|
|
81
|
+
*/
|
|
82
|
+
function startAPIServer(server, loadedAPI, baseAPIUrl, dbinfo, isAPIOnly) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
var foundModulePath, apiJS, apiClass, api, dbClass;
|
|
85
|
+
var _this = this;
|
|
86
|
+
return __generator(this, function (_a) {
|
|
87
|
+
switch (_a.label) {
|
|
88
|
+
case 0:
|
|
89
|
+
process.chdir(process.cwd());
|
|
90
|
+
foundModulePath = require.resolve(loadedAPI.path, { paths: [process.cwd()] });
|
|
91
|
+
apiJS = require(foundModulePath);
|
|
92
|
+
apiClass = apiJS[loadedAPI.exportedClassName];
|
|
93
|
+
api = new apiClass(baseAPIUrl, server);
|
|
94
|
+
server.logger.info("Loaded API class: ".concat(loadedAPI.exportedClassName));
|
|
95
|
+
server.processor.api = api;
|
|
96
|
+
server.api = api;
|
|
97
|
+
if (isAPIOnly === true) {
|
|
98
|
+
server.addRoute("/", function (req, res) { return __awaiter(_this, void 0, void 0, function () {
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
res.json({ "status": "ok" });
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
});
|
|
103
|
+
}); });
|
|
104
|
+
}
|
|
105
|
+
if (!(dbinfo != null)) return [3 /*break*/, 3];
|
|
106
|
+
dbClass = null;
|
|
107
|
+
if (dbinfo.type === "mysql")
|
|
108
|
+
dbClass = HotDBMySQL_1.HotDBMySQL;
|
|
109
|
+
api.db = new dbClass();
|
|
110
|
+
return [4 /*yield*/, server.setAPI(api)];
|
|
111
|
+
case 1:
|
|
112
|
+
_a.sent();
|
|
113
|
+
if (dbinfo.username === "")
|
|
114
|
+
throw new Error("No database username provided!");
|
|
115
|
+
if (dbinfo.password === "")
|
|
116
|
+
throw new Error("No database password provided!");
|
|
117
|
+
return [4 /*yield*/, api.db.connect(dbinfo)];
|
|
118
|
+
case 2:
|
|
119
|
+
_a.sent();
|
|
120
|
+
_a.label = 3;
|
|
121
|
+
case 3: return [2 /*return*/, (api)];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get a key/value pair from a string.
|
|
128
|
+
*/
|
|
129
|
+
function getKeyValuePair(str) {
|
|
130
|
+
var pos = str.indexOf("=");
|
|
131
|
+
var key = "";
|
|
132
|
+
var value = "";
|
|
133
|
+
if (pos > -1) {
|
|
134
|
+
key = str.substr(0, pos);
|
|
135
|
+
value = str.substr(pos + 1);
|
|
136
|
+
}
|
|
137
|
+
return ({ key: key, value: value });
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Handle any build commands.
|
|
141
|
+
*/
|
|
142
|
+
function handleBuildCommands() {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var builder, createHotBuilder, buildCmd;
|
|
145
|
+
var _this = this;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
builder = null;
|
|
148
|
+
createHotBuilder = function () {
|
|
149
|
+
if (builder == null)
|
|
150
|
+
builder = new HotBuilder_1.HotBuilder();
|
|
151
|
+
};
|
|
152
|
+
buildCmd = new commander.Command("build");
|
|
153
|
+
buildCmd.description("Build commands.");
|
|
154
|
+
buildCmd.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
155
|
+
var tempHotsitePath;
|
|
156
|
+
return __generator(this, function (_a) {
|
|
157
|
+
switch (_a.label) {
|
|
158
|
+
case 0:
|
|
159
|
+
createHotBuilder();
|
|
160
|
+
if (!(hotsitePath === "")) return [3 /*break*/, 2];
|
|
161
|
+
tempHotsitePath = ppath.normalize("".concat(process.cwd(), "/HotSite.json"));
|
|
162
|
+
return [4 /*yield*/, HotIO_1.HotIO.exists(tempHotsitePath)];
|
|
163
|
+
case 1:
|
|
164
|
+
/// @fixme Do this check without caps sensitivity.
|
|
165
|
+
if ((_a.sent()) === true)
|
|
166
|
+
hotsitePath = tempHotsitePath;
|
|
167
|
+
_a.label = 2;
|
|
168
|
+
case 2:
|
|
169
|
+
if (hotsitePath === "")
|
|
170
|
+
throw new Error("When building, you must specify a HotSite.json!");
|
|
171
|
+
if (!(hotsitePath !== "")) return [3 /*break*/, 4];
|
|
172
|
+
return [4 /*yield*/, processor.loadHotSite(hotsitePath)];
|
|
173
|
+
case 3:
|
|
174
|
+
_a.sent();
|
|
175
|
+
_a.label = 4;
|
|
176
|
+
case 4: return [4 /*yield*/, builder.build([processor.hotSite])];
|
|
177
|
+
case 5:
|
|
178
|
+
_a.sent();
|
|
179
|
+
return [2 /*return*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}); });
|
|
183
|
+
/*buildCmd.option ("--watch, -w", "Watch the associated files and rebuild when changes are detected.",
|
|
184
|
+
(arg: string, previous: any) =>
|
|
185
|
+
{
|
|
186
|
+
createHotBuilder ();
|
|
187
|
+
builder.api = true;
|
|
188
|
+
});*/
|
|
189
|
+
/*buildCmd.option ("--api", "Build the web client to be used in a web browser.",
|
|
190
|
+
(arg: string, previous: any) =>
|
|
191
|
+
{
|
|
192
|
+
createHotBuilder ();
|
|
193
|
+
builder.api = true;
|
|
194
|
+
});*/
|
|
195
|
+
buildCmd.option("--docker", "Build Dockerfiles from the given HotSite.json. This will be the default option.", function (arg, previous) {
|
|
196
|
+
createHotBuilder();
|
|
197
|
+
builder.dockerFiles = true;
|
|
198
|
+
});
|
|
199
|
+
buildCmd.option("--dont-get-hard", "Do not use the default security hardening when generating the docker image.", function (arg, previous) {
|
|
200
|
+
createHotBuilder();
|
|
201
|
+
builder.dockerHardenSecurity = true;
|
|
202
|
+
});
|
|
203
|
+
buildCmd.option("--dont-append-readme", "Do not add the additional docker documentation to the existing README.md.", function (arg, previous) {
|
|
204
|
+
createHotBuilder();
|
|
205
|
+
builder.appendReadMe = true;
|
|
206
|
+
});
|
|
207
|
+
/*buildCmd.option ("--docker-compose", "Build the docker compose file from the given HotSite.json.",
|
|
208
|
+
(arg: string, previous: any) =>
|
|
209
|
+
{
|
|
210
|
+
createHotBuilder ();
|
|
211
|
+
builder.dockerCompose = true;
|
|
212
|
+
});
|
|
213
|
+
buildCmd.option ("--kubernetes", "Build a Kubernetes cluster from the given HotSite.json.",
|
|
214
|
+
(arg: string, previous: any) =>
|
|
215
|
+
{
|
|
216
|
+
createHotBuilder ();
|
|
217
|
+
builder.kubernetes = true;
|
|
218
|
+
});*/
|
|
219
|
+
buildCmd.option("--output", "The directory path to place all files.", function (arg, previous) {
|
|
220
|
+
createHotBuilder();
|
|
221
|
+
builder.outputDir = arg;
|
|
222
|
+
});
|
|
223
|
+
return [2 /*return*/, (buildCmd)];
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Handle create commands.
|
|
229
|
+
*/
|
|
230
|
+
function handleCreateCommands() {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
232
|
+
var creator, createHotCreator, copyLibrariesPath, createCmd;
|
|
233
|
+
var _this = this;
|
|
234
|
+
return __generator(this, function (_a) {
|
|
235
|
+
creator = null;
|
|
236
|
+
createHotCreator = function () {
|
|
237
|
+
if (creator == null)
|
|
238
|
+
creator = new HotCreator_1.HotCreator();
|
|
239
|
+
};
|
|
240
|
+
copyLibrariesPath = "";
|
|
241
|
+
createCmd = new commander.Command("create");
|
|
242
|
+
createCmd.description("Create a new project.");
|
|
243
|
+
createCmd.action(function (cmdr, args) { return __awaiter(_this, void 0, void 0, function () {
|
|
244
|
+
var name;
|
|
245
|
+
return __generator(this, function (_a) {
|
|
246
|
+
switch (_a.label) {
|
|
247
|
+
case 0:
|
|
248
|
+
createHotCreator();
|
|
249
|
+
if (!(copyLibrariesPath !== "")) return [3 /*break*/, 2];
|
|
250
|
+
return [4 /*yield*/, creator.copyLibraries(copyLibrariesPath)];
|
|
251
|
+
case 1:
|
|
252
|
+
_a.sent();
|
|
253
|
+
return [2 /*return*/];
|
|
254
|
+
case 2:
|
|
255
|
+
if (args == null)
|
|
256
|
+
throw new Error("You must supply an npm compatible project name!");
|
|
257
|
+
if (args.length < 1)
|
|
258
|
+
throw new Error("You must supply an npm compatible project name!");
|
|
259
|
+
name = args[0];
|
|
260
|
+
creator.name = name;
|
|
261
|
+
creator.outputDir = ppath.normalize("".concat(process.cwd(), "/").concat(name, "/"));
|
|
262
|
+
return [4 /*yield*/, creator.create()];
|
|
263
|
+
case 3:
|
|
264
|
+
_a.sent();
|
|
265
|
+
return [2 /*return*/];
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}); });
|
|
269
|
+
createCmd.option("--copy-libraries-to-location <path>", "Copy the latest HotStaq libraries to a specified location. This will not generate any projects.", function (path, previous) {
|
|
270
|
+
createHotCreator();
|
|
271
|
+
copyLibrariesPath = path;
|
|
272
|
+
}, "");
|
|
273
|
+
createCmd.option("--type <type>", "The type of app to create. Can be (web, web-api, api)", function (type, previous) {
|
|
274
|
+
createHotCreator();
|
|
275
|
+
creator.type = type;
|
|
276
|
+
}, "web-api");
|
|
277
|
+
createCmd.option("--code <language>", "Set the type of code output. Can be (ts, js) Default: ts", function (language, previous) {
|
|
278
|
+
createHotCreator();
|
|
279
|
+
creator.language = language;
|
|
280
|
+
}, "ts");
|
|
281
|
+
createCmd.option("--output <path>", "The directory path to place all the files.", function (path, previous) {
|
|
282
|
+
createHotCreator();
|
|
283
|
+
creator.outputDir = path;
|
|
284
|
+
}, "");
|
|
285
|
+
createCmd.option("--overwrite-cmd-create-init <value>", "Overwrite the create command for initalizing an app.", function (value, previous) {
|
|
286
|
+
createHotCreator();
|
|
287
|
+
creator.createCommands.init = value;
|
|
288
|
+
}, "");
|
|
289
|
+
createCmd.option("--overwrite-cmd-create-transpile <value>", "Overwrite the create command for transpiling.", function (value, previous) {
|
|
290
|
+
createHotCreator();
|
|
291
|
+
creator.createCommands.transpileTS = value;
|
|
292
|
+
}, "");
|
|
293
|
+
createCmd.option("--overwrite-cmd-npm-build-web-api <value>", "Overwrite the npm command for building the web api.", function (value, previous) {
|
|
294
|
+
createHotCreator();
|
|
295
|
+
creator.npmCommands.buildWebAPI = value;
|
|
296
|
+
}, "");
|
|
297
|
+
createCmd.option("--overwrite-cmd-npm-build-web-api-debug <value>", "Overwrite the npm command for building the debug script for web api.", function (value, previous) {
|
|
298
|
+
createHotCreator();
|
|
299
|
+
creator.npmCommands.buildWebAPIDebug = value;
|
|
300
|
+
}, "");
|
|
301
|
+
createCmd.option("--overwrite-cmd-npm-dev <value>", "Overwrite the npm command for building the development script.", function (value, previous) {
|
|
302
|
+
createHotCreator();
|
|
303
|
+
creator.npmCommands.dev = value;
|
|
304
|
+
}, "");
|
|
305
|
+
createCmd.option("--overwrite-cmd-npm-start <value>", "Overwrite the npm command for the start script.", function (value, previous) {
|
|
306
|
+
createHotCreator();
|
|
307
|
+
creator.npmCommands.start = value;
|
|
308
|
+
}, "");
|
|
309
|
+
createCmd.option("--overwrite-cmd-npm-test <value>", "Overwrite the npm command for the test script.", function (value, previous) {
|
|
310
|
+
createHotCreator();
|
|
311
|
+
creator.npmCommands.test = value;
|
|
312
|
+
}, "");
|
|
313
|
+
return [2 /*return*/, (createCmd)];
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Handle run commands.
|
|
319
|
+
*/
|
|
320
|
+
function handleRunCommands() {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
322
|
+
var webServer, apiServer, testerSettings, apis, dbinfo, setupDB, serverType, baseWebUrl, baseAPIUrl, runWebTestMap, runAPITestMap, runCmd, serverTypes, _loop_1, iIdx;
|
|
323
|
+
var _this = this;
|
|
324
|
+
return __generator(this, function (_a) {
|
|
325
|
+
webServer = new HotHTTPServer_1.HotHTTPServer(processor);
|
|
326
|
+
apiServer = new HotHTTPServer_1.HotHTTPServer(processor);
|
|
327
|
+
testerSettings = {
|
|
328
|
+
tester: "HotTesterMochaSelenium",
|
|
329
|
+
address: "127.0.0.1",
|
|
330
|
+
browser: "chrome",
|
|
331
|
+
openDevTools: false,
|
|
332
|
+
headless: false,
|
|
333
|
+
remoteServer: "",
|
|
334
|
+
http: 8183,
|
|
335
|
+
https: 4143
|
|
336
|
+
};
|
|
337
|
+
apis = [];
|
|
338
|
+
dbinfo = null;
|
|
339
|
+
setupDB = function () {
|
|
340
|
+
if (dbinfo != null)
|
|
341
|
+
return;
|
|
342
|
+
dbinfo = {
|
|
343
|
+
"type": process.env["DATABASE_TYPE"] || "mysql",
|
|
344
|
+
"server": process.env["DATABASE_SERVER"] || "127.0.0.1",
|
|
345
|
+
"username": process.env["DATABASE_USERNAME"] || "",
|
|
346
|
+
"password": process.env["DATABASE_PASSWORD"] || "",
|
|
347
|
+
"org": process.env["DATABASE_ORG"] || "",
|
|
348
|
+
"token": process.env["DATABASE_TOKEN"] || "",
|
|
349
|
+
"port": 3306,
|
|
350
|
+
"database": process.env["DATABASE_SCHEMA"] || ""
|
|
351
|
+
};
|
|
352
|
+
if (process.env["DATABASE_PORT"] != null) {
|
|
353
|
+
try {
|
|
354
|
+
dbinfo.port = parseInt(process.env["DATABASE_PORT"]);
|
|
355
|
+
}
|
|
356
|
+
catch (ex) {
|
|
357
|
+
throw new Error("Unable to parse db port ".concat(process.env["DATABASE_PORT"]));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
serverType = "web";
|
|
362
|
+
baseWebUrl = "";
|
|
363
|
+
baseAPIUrl = "";
|
|
364
|
+
runWebTestMap = false;
|
|
365
|
+
runAPITestMap = false;
|
|
366
|
+
runCmd = new commander.Command("run");
|
|
367
|
+
runCmd.description("Run commands.");
|
|
368
|
+
runCmd.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
369
|
+
var runWebServer, runAPIServer, testerServer, serverStarter, tester, mochaTester, mochaSeleniumTester, key, tempapi, path, apiToLoad, foundBaseUrl, loadAPI, getBaseUrlFromHotSite;
|
|
370
|
+
return __generator(this, function (_a) {
|
|
371
|
+
switch (_a.label) {
|
|
372
|
+
case 0:
|
|
373
|
+
runWebServer = false;
|
|
374
|
+
runAPIServer = false;
|
|
375
|
+
testerServer = null;
|
|
376
|
+
if (!(processor.mode === Hot_1.DeveloperMode.Development)) return [3 /*break*/, 2];
|
|
377
|
+
return [4 /*yield*/, HotTesterServer_1.HotTesterServer.startServer("http://".concat(testerSettings.address, ":").concat(testerSettings.http), testerSettings.http, testerSettings.https, processor)];
|
|
378
|
+
case 1:
|
|
379
|
+
serverStarter = _a.sent();
|
|
380
|
+
testerServer = serverStarter.server;
|
|
381
|
+
tester = null;
|
|
382
|
+
if (testerSettings.tester === "HotTesterMocha") {
|
|
383
|
+
mochaTester = new HotTesterMocha_1.HotTesterMocha(processor, "HotTesterMocha", baseWebUrl, null);
|
|
384
|
+
tester = mochaTester;
|
|
385
|
+
}
|
|
386
|
+
if (testerSettings.tester === "HotTesterMochaSelenium") {
|
|
387
|
+
mochaSeleniumTester = new HotTesterMochaSelenium_1.HotTesterMochaSelenium(processor, "HotTesterMochaSelenium", baseWebUrl);
|
|
388
|
+
mochaSeleniumTester.driver.browser = testerSettings.browser;
|
|
389
|
+
mochaSeleniumTester.driver.openDevTools = testerSettings.openDevTools;
|
|
390
|
+
mochaSeleniumTester.driver.headless = testerSettings.headless;
|
|
391
|
+
mochaSeleniumTester.driver.remoteServer = testerSettings.remoteServer;
|
|
392
|
+
tester = mochaSeleniumTester;
|
|
393
|
+
}
|
|
394
|
+
testerServer.addTester(tester);
|
|
395
|
+
_a.label = 2;
|
|
396
|
+
case 2:
|
|
397
|
+
if (!(hotsitePath !== "")) return [3 /*break*/, 4];
|
|
398
|
+
return [4 /*yield*/, processor.loadHotSite(hotsitePath)];
|
|
399
|
+
case 3:
|
|
400
|
+
_a.sent();
|
|
401
|
+
if (processor.hotSite != null) {
|
|
402
|
+
if (processor.hotSite.apis != null) {
|
|
403
|
+
for (key in processor.hotSite.apis) {
|
|
404
|
+
tempapi = processor.hotSite.apis[key];
|
|
405
|
+
if (tempapi.libraryName != null) {
|
|
406
|
+
path = tempapi.filepath;
|
|
407
|
+
apiToLoad = {
|
|
408
|
+
exportedClassName: tempapi.apiName,
|
|
409
|
+
path: path
|
|
410
|
+
};
|
|
411
|
+
apis.push(apiToLoad);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
_a.label = 4;
|
|
417
|
+
case 4:
|
|
418
|
+
// Setup the DB if it hasn't already been setup.
|
|
419
|
+
if (process.env["DATABASE_TYPE"] != null) {
|
|
420
|
+
setupDB();
|
|
421
|
+
dbinfo.type = process.env["DATABASE_TYPE"];
|
|
422
|
+
}
|
|
423
|
+
if (process.env["DATABASE_SERVER"] != null) {
|
|
424
|
+
setupDB();
|
|
425
|
+
dbinfo.server = process.env["DATABASE_SERVER"];
|
|
426
|
+
}
|
|
427
|
+
if (process.env["DATABASE_USERNAME"] != null) {
|
|
428
|
+
setupDB();
|
|
429
|
+
dbinfo.username = process.env["DATABASE_USERNAME"];
|
|
430
|
+
}
|
|
431
|
+
if (process.env["DATABASE_PASSWORD"] != null) {
|
|
432
|
+
setupDB();
|
|
433
|
+
dbinfo.password = process.env["DATABASE_PASSWORD"];
|
|
434
|
+
}
|
|
435
|
+
if (process.env["DATABASE_ORG"] != null) {
|
|
436
|
+
setupDB();
|
|
437
|
+
dbinfo.org = process.env["DATABASE_ORG"];
|
|
438
|
+
}
|
|
439
|
+
if (process.env["DATABASE_TOKEN"] != null) {
|
|
440
|
+
setupDB();
|
|
441
|
+
dbinfo.token = process.env["DATABASE_TOKEN"];
|
|
442
|
+
}
|
|
443
|
+
if (process.env["DATABASE_PORT"] != null) {
|
|
444
|
+
setupDB();
|
|
445
|
+
try {
|
|
446
|
+
dbinfo.port = parseInt(process.env["DATABASE_PORT"]);
|
|
447
|
+
}
|
|
448
|
+
catch (ex) {
|
|
449
|
+
throw new Error("Unable to parse db port ".concat(process.env["DATABASE_PORT"]));
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (process.env["DATABASE_SCHEMA"] != null) {
|
|
453
|
+
setupDB();
|
|
454
|
+
dbinfo.database = process.env["DATABASE_SCHEMA"];
|
|
455
|
+
}
|
|
456
|
+
if (baseWebUrl === "") {
|
|
457
|
+
foundBaseUrl = HotStaq_1.HotStaq.getValueFromHotSiteObj(processor.hotSite, ["server", "url"]);
|
|
458
|
+
if (foundBaseUrl != null)
|
|
459
|
+
baseWebUrl = foundBaseUrl;
|
|
460
|
+
}
|
|
461
|
+
if (baseWebUrl === "")
|
|
462
|
+
baseWebUrl = "http://127.0.0.1:".concat(webServer.ports.http);
|
|
463
|
+
if ((serverType === "web") || (serverType === "web-api")) {
|
|
464
|
+
if (processor.hotSite != null) {
|
|
465
|
+
if (processor.hotSite.server != null)
|
|
466
|
+
processor.hotSite.server.url = baseWebUrl;
|
|
467
|
+
}
|
|
468
|
+
runWebServer = true;
|
|
469
|
+
}
|
|
470
|
+
if ((serverType === "api") || (serverType === "web-api"))
|
|
471
|
+
runAPIServer = true;
|
|
472
|
+
loadAPI = apis[0];
|
|
473
|
+
getBaseUrlFromHotSite = function () {
|
|
474
|
+
var foundAPIUrl = null;
|
|
475
|
+
// Attempt to find the base url from the HotSite's API.
|
|
476
|
+
if (processor.hotSite != null) {
|
|
477
|
+
if (processor.hotSite.apis != null) {
|
|
478
|
+
for (var key in processor.hotSite.apis) {
|
|
479
|
+
var tempAPI = processor.hotSite.apis[key];
|
|
480
|
+
if (tempAPI.apiName != null) {
|
|
481
|
+
if (tempAPI.apiName === loadAPI.exportedClassName) {
|
|
482
|
+
if (tempAPI.url != null)
|
|
483
|
+
foundAPIUrl = tempAPI.url;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (foundAPIUrl != null)
|
|
491
|
+
baseAPIUrl = foundAPIUrl;
|
|
492
|
+
};
|
|
493
|
+
if (!(serverType === "api")) return [3 /*break*/, 7];
|
|
494
|
+
if (apis.length < 1)
|
|
495
|
+
throw new Error("No APIs are loaded! Try using --api-load");
|
|
496
|
+
if (baseAPIUrl === "")
|
|
497
|
+
getBaseUrlFromHotSite();
|
|
498
|
+
if (baseAPIUrl === "")
|
|
499
|
+
baseAPIUrl = "http://127.0.0.1:".concat(apiServer.ports.http);
|
|
500
|
+
// Only run the api server.
|
|
501
|
+
return [4 /*yield*/, startAPIServer(apiServer, loadAPI, baseAPIUrl, dbinfo, true)];
|
|
502
|
+
case 5:
|
|
503
|
+
// Only run the api server.
|
|
504
|
+
_a.sent();
|
|
505
|
+
if (globalLogLevel != null)
|
|
506
|
+
apiServer.logger.logLevel = globalLogLevel;
|
|
507
|
+
apiServer.serverType = "API Server";
|
|
508
|
+
return [4 /*yield*/, apiServer.listen()];
|
|
509
|
+
case 6:
|
|
510
|
+
_a.sent();
|
|
511
|
+
_a.label = 7;
|
|
512
|
+
case 7:
|
|
513
|
+
if (!(runWebServer === true)) return [3 /*break*/, 12];
|
|
514
|
+
if (!(runAPIServer === true)) return [3 /*break*/, 9];
|
|
515
|
+
if (apis.length < 1)
|
|
516
|
+
throw new Error("No APIs are loaded! Try using --api-load");
|
|
517
|
+
if (baseAPIUrl === "")
|
|
518
|
+
getBaseUrlFromHotSite();
|
|
519
|
+
if (baseAPIUrl === "")
|
|
520
|
+
baseAPIUrl = "http://127.0.0.1:".concat(webServer.ports.http);
|
|
521
|
+
return [4 /*yield*/, startAPIServer(webServer, loadAPI, baseAPIUrl, dbinfo, false)];
|
|
522
|
+
case 8:
|
|
523
|
+
_a.sent();
|
|
524
|
+
webServer.serverType = "Web-API Server";
|
|
525
|
+
return [3 /*break*/, 10];
|
|
526
|
+
case 9:
|
|
527
|
+
webServer.serverType = "Web Server";
|
|
528
|
+
_a.label = 10;
|
|
529
|
+
case 10:
|
|
530
|
+
if (globalLogLevel != null)
|
|
531
|
+
webServer.logger.logLevel = globalLogLevel;
|
|
532
|
+
return [4 /*yield*/, webServer.listen()];
|
|
533
|
+
case 11:
|
|
534
|
+
_a.sent();
|
|
535
|
+
_a.label = 12;
|
|
536
|
+
case 12:
|
|
537
|
+
if (!(runWebTestMap === true)) return [3 /*break*/, 14];
|
|
538
|
+
if (testerServer == null)
|
|
539
|
+
throw new Error("Unable to execute tests! Is --development-mode missing?");
|
|
540
|
+
return [4 /*yield*/, testerServer.executeAllWebTests(testerSettings.tester)];
|
|
541
|
+
case 13:
|
|
542
|
+
_a.sent();
|
|
543
|
+
_a.label = 14;
|
|
544
|
+
case 14:
|
|
545
|
+
if (!(runAPITestMap === true)) return [3 /*break*/, 16];
|
|
546
|
+
if (testerServer == null)
|
|
547
|
+
throw new Error("Unable to execute tests! Is --development-mode missing?");
|
|
548
|
+
return [4 /*yield*/, testerServer.executeAllAPITests(testerSettings.tester)];
|
|
549
|
+
case 15:
|
|
550
|
+
_a.sent();
|
|
551
|
+
_a.label = 16;
|
|
552
|
+
case 16: return [2 /*return*/];
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
}); });
|
|
556
|
+
runCmd.option("--tester-http-port <port>", "Set the tester HTTP port", function (port, previous) {
|
|
557
|
+
try {
|
|
558
|
+
var tempPort = parseInt(port);
|
|
559
|
+
testerSettings.http = tempPort;
|
|
560
|
+
}
|
|
561
|
+
catch (ex) {
|
|
562
|
+
processor.logger.error("Unable to parse tester http port ".concat(port));
|
|
563
|
+
}
|
|
564
|
+
}, testerSettings.http);
|
|
565
|
+
runCmd.option("--tester-https-port <port>", "Set the tester HTTPS port", function (port, previous) {
|
|
566
|
+
if (port == null)
|
|
567
|
+
return;
|
|
568
|
+
if (port === "")
|
|
569
|
+
return;
|
|
570
|
+
try {
|
|
571
|
+
var tempPort = parseInt(port);
|
|
572
|
+
testerSettings.https = tempPort;
|
|
573
|
+
}
|
|
574
|
+
catch (ex) {
|
|
575
|
+
processor.logger.error("Unable to parse tester https port ".concat(port));
|
|
576
|
+
}
|
|
577
|
+
}, testerSettings.https);
|
|
578
|
+
runCmd.option("--tester-type <tester>", "Set the tester to use. Can be: HotTesterMocha,HotTesterMochaSelenium", function (tester, previous) {
|
|
579
|
+
testerSettings.tester = tester;
|
|
580
|
+
}, "HotTesterMochaSelenium");
|
|
581
|
+
runCmd.option("--tester-address <address>", "Set the tester address to listen on.", function (address, previous) {
|
|
582
|
+
testerSettings.address = address;
|
|
583
|
+
}, "127.0.0.1");
|
|
584
|
+
runCmd.option("--tester-browser <browser>", "Set the tester browser to use. Can only be used with tester type: HotTesterMochaSelenium", function (browser, previous) {
|
|
585
|
+
testerSettings.browser = browser;
|
|
586
|
+
}, "chrome");
|
|
587
|
+
runCmd.option("--tester-open-dev-tools", "Open the browsers dev tools on start. Can only be used with tester type: HotTesterMochaSelenium", function (value, previous) {
|
|
588
|
+
testerSettings.openDevTools = true;
|
|
589
|
+
}, "false");
|
|
590
|
+
runCmd.option("--tester-headless", "Make the browser headless. Can only be used with tester type: HotTesterMochaSelenium", function (value, previous) {
|
|
591
|
+
testerSettings.headless = true;
|
|
592
|
+
}, "false");
|
|
593
|
+
runCmd.option("--tester-remote-server <remote_server>", "Set the remote Selenium server to use for testing. Can only be used with tester type: HotTesterMochaSelenium", function (remoteServer, previous) {
|
|
594
|
+
testerSettings.remoteServer = remoteServer;
|
|
595
|
+
}, "");
|
|
596
|
+
serverTypes = ["web", "api"];
|
|
597
|
+
_loop_1 = function (iIdx) {
|
|
598
|
+
var currentServerType = serverTypes[iIdx];
|
|
599
|
+
var httpPort = 80;
|
|
600
|
+
var httpsPort = 443;
|
|
601
|
+
if (currentServerType === "api") {
|
|
602
|
+
httpPort = 81;
|
|
603
|
+
httpsPort = 444;
|
|
604
|
+
}
|
|
605
|
+
runCmd.option("--".concat(currentServerType, "-base-url <url>"), "Set the base ".concat(currentServerType, " server url."), function (url, previous) {
|
|
606
|
+
if (currentServerType === "web")
|
|
607
|
+
baseWebUrl = url;
|
|
608
|
+
else
|
|
609
|
+
baseAPIUrl = url;
|
|
610
|
+
}, "");
|
|
611
|
+
runCmd.option("--".concat(currentServerType, "-http-port <port>"), "Set the ".concat(currentServerType, " HTTP port"), function (port, previous) {
|
|
612
|
+
try {
|
|
613
|
+
var tempPort = parseInt(port);
|
|
614
|
+
if (currentServerType === "web")
|
|
615
|
+
webServer.ports.http = tempPort;
|
|
616
|
+
else
|
|
617
|
+
apiServer.ports.http = tempPort;
|
|
618
|
+
}
|
|
619
|
+
catch (ex) {
|
|
620
|
+
processor.logger.error("Unable to parse ".concat(currentServerType, " http port ").concat(port));
|
|
621
|
+
}
|
|
622
|
+
}, httpPort);
|
|
623
|
+
runCmd.option("--".concat(currentServerType, "-https-port [port]"), "Set the ".concat(currentServerType, " HTTPS port"), function (port, previous) {
|
|
624
|
+
if (port == null)
|
|
625
|
+
return;
|
|
626
|
+
if (port === "")
|
|
627
|
+
return;
|
|
628
|
+
try {
|
|
629
|
+
var tempPort = parseInt(port);
|
|
630
|
+
if (currentServerType === "web")
|
|
631
|
+
webServer.ports.https = tempPort;
|
|
632
|
+
else
|
|
633
|
+
apiServer.ports.https = tempPort;
|
|
634
|
+
}
|
|
635
|
+
catch (ex) {
|
|
636
|
+
processor.logger.error("Unable to parse ".concat(currentServerType, " https port ").concat(port));
|
|
637
|
+
}
|
|
638
|
+
}, httpsPort);
|
|
639
|
+
runCmd.option("--".concat(currentServerType, "-dont-redirect-http-to-https"), "Do not redirect ".concat(currentServerType, " HTTP traffic to HTTPS"), function (port, previous) {
|
|
640
|
+
if (currentServerType === "web")
|
|
641
|
+
webServer.redirectHTTPtoHTTPS = false;
|
|
642
|
+
else
|
|
643
|
+
apiServer.redirectHTTPtoHTTPS = false;
|
|
644
|
+
});
|
|
645
|
+
runCmd.option("--".concat(currentServerType, "-listen-address <address>"), "Set the ".concat(currentServerType, " listen address"), function (address, previous) {
|
|
646
|
+
if (currentServerType === "web")
|
|
647
|
+
webServer.listenAddress = address;
|
|
648
|
+
else
|
|
649
|
+
apiServer.listenAddress = address;
|
|
650
|
+
}, "0.0.0.0");
|
|
651
|
+
runCmd.option("--".concat(currentServerType, "-ssl-cert <path>"), "Set the path to the SSL cert for the ".concat(currentServerType, " server"), function (cert, previous) {
|
|
652
|
+
if (currentServerType === "web")
|
|
653
|
+
webServer.ssl.cert = cert;
|
|
654
|
+
else
|
|
655
|
+
apiServer.ssl.cert = cert;
|
|
656
|
+
}, "");
|
|
657
|
+
runCmd.option("--".concat(currentServerType, "-ssl-key <path>"), "Set the path to the SSL key for the ".concat(currentServerType, " server"), function (key, previous) {
|
|
658
|
+
if (currentServerType === "web")
|
|
659
|
+
webServer.ssl.key = key;
|
|
660
|
+
else
|
|
661
|
+
apiServer.ssl.key = key;
|
|
662
|
+
}, "");
|
|
663
|
+
runCmd.option("--".concat(currentServerType, "-ssl-ca <path>"), "Set the path to the SSL CA for the ".concat(currentServerType, " server"), function (ca, previous) {
|
|
664
|
+
if (currentServerType === "web")
|
|
665
|
+
webServer.ssl.ca = ca;
|
|
666
|
+
else
|
|
667
|
+
apiServer.ssl.ca = ca;
|
|
668
|
+
}, "");
|
|
669
|
+
runCmd.option("--".concat(currentServerType, "-log-level <level>"), "Set the logging level for the ".concat(currentServerType, " server. Can be (info,warning,error,all,none)"), function (logLevel, previous) {
|
|
670
|
+
var tempServer = null;
|
|
671
|
+
if (logLevel === "")
|
|
672
|
+
return;
|
|
673
|
+
if (currentServerType === "web")
|
|
674
|
+
tempServer = webServer;
|
|
675
|
+
else
|
|
676
|
+
tempServer = apiServer;
|
|
677
|
+
if (logLevel === "info")
|
|
678
|
+
tempServer.logger.logLevel = HotLog_1.HotLogLevel.Info;
|
|
679
|
+
if (logLevel === "warning")
|
|
680
|
+
tempServer.logger.logLevel = HotLog_1.HotLogLevel.Warning;
|
|
681
|
+
if (logLevel === "error")
|
|
682
|
+
tempServer.logger.logLevel = HotLog_1.HotLogLevel.Error;
|
|
683
|
+
if (logLevel === "verbose")
|
|
684
|
+
tempServer.logger.logLevel = HotLog_1.HotLogLevel.Verbose;
|
|
685
|
+
if (logLevel === "all")
|
|
686
|
+
tempServer.logger.logLevel = HotLog_1.HotLogLevel.All;
|
|
687
|
+
if (logLevel === "none")
|
|
688
|
+
tempServer.logger.logLevel = HotLog_1.HotLogLevel.None;
|
|
689
|
+
}, "");
|
|
690
|
+
runCmd.option("--".concat(currentServerType, "-test"), "Execute all tests specified in HotSite.json. Must be used with --development-mode.", function (map, previous) {
|
|
691
|
+
if (currentServerType === "web")
|
|
692
|
+
runWebTestMap = true;
|
|
693
|
+
else
|
|
694
|
+
runAPITestMap = true;
|
|
695
|
+
});
|
|
696
|
+
if (currentServerType === "web") {
|
|
697
|
+
runCmd.option("--".concat(currentServerType, "-route <route_and_path>"), "Add a static route in \"key=path\" format. Example: --".concat(currentServerType, "-route \"/=/var/www\""), function (routeAndPath, previous) {
|
|
698
|
+
var keyValuePair = getKeyValuePair(routeAndPath);
|
|
699
|
+
var route = keyValuePair.key;
|
|
700
|
+
var path = keyValuePair.value;
|
|
701
|
+
webServer.addStaticRoute(route, path);
|
|
702
|
+
});
|
|
703
|
+
runCmd.option("--".concat(currentServerType, "-serve-hott-files"), "Serve Hott files", function (port, previous) {
|
|
704
|
+
webServer.serveHottFiles = true;
|
|
705
|
+
});
|
|
706
|
+
runCmd.option("--".concat(currentServerType, "-js-url <url>"), "The url to the HotStaq JS", function (url, previous) {
|
|
707
|
+
webServer.hottFilesAssociatedInfo.jsSrcPath = url;
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
if (currentServerType === "api") {
|
|
711
|
+
runCmd.option("--".concat(currentServerType, "-load <exported_name_and_path>"), "Load an API for use in \"exported_name=path_to_js_file\" format. Example: --".concat(currentServerType, "-load \"FreeLightAPI=/app/FreeLight/build/src/FreeLightAPI.js\""), function (exported_name_and_path, previous) {
|
|
712
|
+
var keyValuePair = getKeyValuePair(exported_name_and_path);
|
|
713
|
+
var exportedClassName = keyValuePair.key;
|
|
714
|
+
var path = keyValuePair.value;
|
|
715
|
+
apis.push({ exportedClassName: exportedClassName, path: path });
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
for (iIdx = 0; iIdx < serverTypes.length; iIdx++) {
|
|
720
|
+
_loop_1(iIdx);
|
|
721
|
+
}
|
|
722
|
+
runCmd.option("--server-type <type>", "Set the type of server. Can be (web, api, web-api)", function (type, previous) {
|
|
723
|
+
serverType = type;
|
|
724
|
+
}, "web");
|
|
725
|
+
runCmd.option("--db-type <type>", "The type of database to use. Can be (mysql, influx)", function (type, previous) {
|
|
726
|
+
setupDB();
|
|
727
|
+
dbinfo.type = type;
|
|
728
|
+
}, "mysql");
|
|
729
|
+
runCmd.option("--db-server <address>", "The address to the database", function (address, previous) {
|
|
730
|
+
setupDB();
|
|
731
|
+
dbinfo.server = address;
|
|
732
|
+
}, "127.0.0.1");
|
|
733
|
+
runCmd.option("--db-username <username>", "The database's username", function (username, previous) {
|
|
734
|
+
setupDB();
|
|
735
|
+
dbinfo.username = username;
|
|
736
|
+
});
|
|
737
|
+
runCmd.option("--db-password <password>", "The database's password. This is insecure to use on the command line!", function (password, previous) {
|
|
738
|
+
setupDB();
|
|
739
|
+
dbinfo.password = password;
|
|
740
|
+
});
|
|
741
|
+
runCmd.option("--db-port <port>", "The database's port", function (port, previous) {
|
|
742
|
+
setupDB();
|
|
743
|
+
try {
|
|
744
|
+
dbinfo.port = parseInt(port);
|
|
745
|
+
}
|
|
746
|
+
catch (ex) {
|
|
747
|
+
processor.logger.error("Unable to parse db port ".concat(port));
|
|
748
|
+
}
|
|
749
|
+
}, "3306");
|
|
750
|
+
runCmd.option("--db-database <schema>", "The database's schema to select", function (schema, previous) {
|
|
751
|
+
setupDB();
|
|
752
|
+
dbinfo.database = schema;
|
|
753
|
+
});
|
|
754
|
+
return [2 /*return*/, (runCmd)];
|
|
755
|
+
});
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Handle any agent commands.
|
|
760
|
+
*/
|
|
761
|
+
function handleAgentCommands() {
|
|
762
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
763
|
+
var baseAPIUrl, agentKey, agentSecret, commands, listenAddr, port, agentCmd;
|
|
764
|
+
var _this = this;
|
|
765
|
+
return __generator(this, function (_a) {
|
|
766
|
+
baseAPIUrl = "";
|
|
767
|
+
agentKey = "";
|
|
768
|
+
agentSecret = "";
|
|
769
|
+
commands = {};
|
|
770
|
+
listenAddr = "0.0.0.0";
|
|
771
|
+
port = 5468;
|
|
772
|
+
agentCmd = new commander.Command("agent");
|
|
773
|
+
agentCmd.description("Listen for commands on a port.");
|
|
774
|
+
agentCmd.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
775
|
+
var processor, apiServer, api;
|
|
776
|
+
return __generator(this, function (_a) {
|
|
777
|
+
switch (_a.label) {
|
|
778
|
+
case 0:
|
|
779
|
+
processor = new HotStaq_1.HotStaq();
|
|
780
|
+
processor.logger.logLevel = HotLog_1.HotLogLevel.Verbose;
|
|
781
|
+
apiServer = new HotHTTPServer_1.HotHTTPServer(processor);
|
|
782
|
+
api = new HotAgentAPI_1.HotAgentAPI(baseAPIUrl, apiServer);
|
|
783
|
+
api.key = agentKey;
|
|
784
|
+
api.secret = agentSecret;
|
|
785
|
+
apiServer.listenAddress = listenAddr;
|
|
786
|
+
apiServer.ports.http = port;
|
|
787
|
+
apiServer.processor.api = api;
|
|
788
|
+
apiServer.api = api;
|
|
789
|
+
return [4 /*yield*/, apiServer.setAPI(api)];
|
|
790
|
+
case 1:
|
|
791
|
+
_a.sent();
|
|
792
|
+
return [4 /*yield*/, apiServer.listen()];
|
|
793
|
+
case 2:
|
|
794
|
+
_a.sent();
|
|
795
|
+
return [2 /*return*/];
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}); });
|
|
799
|
+
agentCmd.option("--base_api_url <value>", "The key that must be given in order to execute the commands.", function (value, previous) {
|
|
800
|
+
baseAPIUrl = value;
|
|
801
|
+
});
|
|
802
|
+
agentCmd.option("--key <key>", "The key that must be given in order to execute the commands.", function (value, previous) {
|
|
803
|
+
agentKey = value;
|
|
804
|
+
});
|
|
805
|
+
agentCmd.option("--secret <secret>", "The secret key that must be given in order to execute the commands.", function (value, previous) {
|
|
806
|
+
agentSecret = value;
|
|
807
|
+
});
|
|
808
|
+
agentCmd.option("--file <key_filepath>", "The key and the associated NodeJS file to execute (key=path).", function (value, previous) {
|
|
809
|
+
var key = "";
|
|
810
|
+
var filepath = "";
|
|
811
|
+
var pos = key.indexOf("=");
|
|
812
|
+
if (pos < 0)
|
|
813
|
+
throw new Error("key_filepath must be in the format (key=path)");
|
|
814
|
+
key = value.substr(0, pos);
|
|
815
|
+
filepath = value.substr(pos + 1);
|
|
816
|
+
commands[key] = filepath;
|
|
817
|
+
});
|
|
818
|
+
agentCmd.option("--listen-addr <addr>", "The address to listen on.", function (value, previous) {
|
|
819
|
+
listenAddr = value;
|
|
820
|
+
});
|
|
821
|
+
agentCmd.option("--listen-port <port>", "The port to listen on.", function (value, previous) {
|
|
822
|
+
try {
|
|
823
|
+
port = parseInt(value);
|
|
824
|
+
}
|
|
825
|
+
catch (ex) {
|
|
826
|
+
throw new Error("Unable to parse port ".concat(value));
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
return [2 /*return*/, (agentCmd)];
|
|
830
|
+
});
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Check if the path exists.
|
|
835
|
+
*/
|
|
836
|
+
function checkIfPathExists(path) {
|
|
837
|
+
if (fs.existsSync(path) === true)
|
|
838
|
+
return (true);
|
|
839
|
+
return (false);
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Start the CLI app.
|
|
843
|
+
*/
|
|
844
|
+
function start() {
|
|
845
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
846
|
+
var packagePath, packageJSON, program, command, hotsiteExists, foundHotsitePath, createCmd, runCmd, buildCmd, agentCmd, ex_1;
|
|
847
|
+
return __generator(this, function (_a) {
|
|
848
|
+
switch (_a.label) {
|
|
849
|
+
case 0:
|
|
850
|
+
_a.trys.push([0, 5, , 6]);
|
|
851
|
+
packagePath = ppath.normalize("".concat(__dirname, "/../../package.json"));
|
|
852
|
+
if (checkIfPathExists(packagePath) === false) {
|
|
853
|
+
packagePath = ppath.normalize("".concat(process.cwd(), "/package.json"));
|
|
854
|
+
if (checkIfPathExists(packagePath) === false) {
|
|
855
|
+
console.error("Unable to find path to HotStaq!");
|
|
856
|
+
return [2 /*return*/];
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
packageJSON = JSON.parse(fs.readFileSync(packagePath).toString());
|
|
860
|
+
VERSION = packageJSON.version;
|
|
861
|
+
program = new commander.Command("hotstaq");
|
|
862
|
+
program.description("Copyright(c) 2021, FreeLight, Inc. Under the MIT License.");
|
|
863
|
+
command = program.version(VERSION);
|
|
864
|
+
hotsiteExists = false;
|
|
865
|
+
foundHotsitePath = "";
|
|
866
|
+
if (checkIfPathExists("./HotSite.json") === true) {
|
|
867
|
+
hotsiteExists = true;
|
|
868
|
+
foundHotsitePath = ppath.normalize("./HotSite.json");
|
|
869
|
+
}
|
|
870
|
+
if (checkIfPathExists("./hotsite.json") === true) {
|
|
871
|
+
hotsiteExists = true;
|
|
872
|
+
foundHotsitePath = ppath.normalize("./HotSite.json");
|
|
873
|
+
}
|
|
874
|
+
if (hotsiteExists === true)
|
|
875
|
+
hotsitePath = foundHotsitePath;
|
|
876
|
+
command.option("--cwd <path>", "Set the current working directory to use.", function (path, previous) {
|
|
877
|
+
process.chdir(path);
|
|
878
|
+
});
|
|
879
|
+
command.option("-o, --hotsite <path>", "Specify the HotSite.json to use. This will look in the current directory to find one first.", function (path, previous) {
|
|
880
|
+
hotsitePath = path;
|
|
881
|
+
}, foundHotsitePath);
|
|
882
|
+
command.option("--not-hot", "Do not use a HotSite.json.", function (path, previous) {
|
|
883
|
+
hotsitePath = "";
|
|
884
|
+
});
|
|
885
|
+
command.option("--verbose", "Set the logging level to verbose.", function (logLevel, previous) {
|
|
886
|
+
if (logLevel === "verbose")
|
|
887
|
+
globalLogLevel = HotLog_1.HotLogLevel.Verbose;
|
|
888
|
+
});
|
|
889
|
+
command.option("-l, --log-level <level>", "Set the logging level. Can be (info,warning,error,all,none)", function (logLevel, previous) {
|
|
890
|
+
if (logLevel === "info")
|
|
891
|
+
globalLogLevel = HotLog_1.HotLogLevel.Info;
|
|
892
|
+
if (logLevel === "warning")
|
|
893
|
+
globalLogLevel = HotLog_1.HotLogLevel.Warning;
|
|
894
|
+
if (logLevel === "error")
|
|
895
|
+
globalLogLevel = HotLog_1.HotLogLevel.Error;
|
|
896
|
+
if (logLevel === "verbose")
|
|
897
|
+
globalLogLevel = HotLog_1.HotLogLevel.Verbose;
|
|
898
|
+
if (logLevel === "all")
|
|
899
|
+
globalLogLevel = HotLog_1.HotLogLevel.All;
|
|
900
|
+
if (logLevel === "none")
|
|
901
|
+
globalLogLevel = HotLog_1.HotLogLevel.None;
|
|
902
|
+
}, "");
|
|
903
|
+
command.option("--dev, --development-mode", "Set to execute in development mode. This will allow for testing data to be collected and executed", function (value, previous) {
|
|
904
|
+
processor.mode = Hot_1.DeveloperMode.Development;
|
|
905
|
+
});
|
|
906
|
+
return [4 /*yield*/, handleCreateCommands()];
|
|
907
|
+
case 1:
|
|
908
|
+
createCmd = _a.sent();
|
|
909
|
+
command.addCommand(createCmd);
|
|
910
|
+
return [4 /*yield*/, handleRunCommands()];
|
|
911
|
+
case 2:
|
|
912
|
+
runCmd = _a.sent();
|
|
913
|
+
command.addCommand(runCmd);
|
|
914
|
+
return [4 /*yield*/, handleBuildCommands()];
|
|
915
|
+
case 3:
|
|
916
|
+
buildCmd = _a.sent();
|
|
917
|
+
command.addCommand(buildCmd);
|
|
918
|
+
return [4 /*yield*/, handleAgentCommands()];
|
|
919
|
+
case 4:
|
|
920
|
+
agentCmd = _a.sent();
|
|
921
|
+
command.addCommand(agentCmd);
|
|
922
|
+
if (process.argv.length > 2)
|
|
923
|
+
program.parse(process.argv);
|
|
924
|
+
return [3 /*break*/, 6];
|
|
925
|
+
case 5:
|
|
926
|
+
ex_1 = _a.sent();
|
|
927
|
+
processor.logger.error(ex_1.stack);
|
|
928
|
+
return [3 /*break*/, 6];
|
|
929
|
+
case 6: return [2 /*return*/];
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
start();
|
|
935
|
+
//# sourceMappingURL=cli.js.map
|