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
|
@@ -0,0 +1,454 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.HotFile = void 0;
|
|
62
|
+
var fs = __importStar(require("fs"));
|
|
63
|
+
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
64
|
+
var Hot_1 = require("./Hot");
|
|
65
|
+
/**
|
|
66
|
+
* A file to process.
|
|
67
|
+
*/
|
|
68
|
+
var HotFile = /** @class */ (function () {
|
|
69
|
+
function HotFile(copy) {
|
|
70
|
+
if (copy === void 0) { copy = {}; }
|
|
71
|
+
this.page = copy.page || null;
|
|
72
|
+
this.name = copy.name || "";
|
|
73
|
+
this.url = copy.url || "";
|
|
74
|
+
this.localFile = copy.localFile || "";
|
|
75
|
+
this.content = copy.content || "";
|
|
76
|
+
this.throwAllErrors = copy.throwAllErrors || false;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Set the content of this file.
|
|
80
|
+
*/
|
|
81
|
+
HotFile.prototype.setContent = function (content) {
|
|
82
|
+
this.content = content;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Get the content of this file.
|
|
86
|
+
*/
|
|
87
|
+
HotFile.prototype.getContent = function () {
|
|
88
|
+
return (this.content);
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Make a HTTP get request.
|
|
92
|
+
*/
|
|
93
|
+
HotFile.httpGet = function (url) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
var res, content, ex_1;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
_a.trys.push([0, 3, , 4]);
|
|
100
|
+
return [4 /*yield*/, (0, cross_fetch_1.default)(url)];
|
|
101
|
+
case 1:
|
|
102
|
+
res = _a.sent();
|
|
103
|
+
if (res.ok === false)
|
|
104
|
+
throw new Error("".concat(res.status, ": ").concat(res.statusText));
|
|
105
|
+
return [4 /*yield*/, res.text()];
|
|
106
|
+
case 2:
|
|
107
|
+
content = _a.sent();
|
|
108
|
+
return [2 /*return*/, (content)];
|
|
109
|
+
case 3:
|
|
110
|
+
ex_1 = _a.sent();
|
|
111
|
+
return [2 /*return*/, (JSON.stringify({ "error": "".concat(ex_1.message, " - Could not fetch ").concat(url) }))];
|
|
112
|
+
case 4: return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Load content from a url.
|
|
119
|
+
*/
|
|
120
|
+
HotFile.prototype.loadUrl = function () {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
var _a;
|
|
123
|
+
return __generator(this, function (_b) {
|
|
124
|
+
switch (_b.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
_a = this;
|
|
127
|
+
return [4 /*yield*/, HotFile.httpGet(this.url)];
|
|
128
|
+
case 1:
|
|
129
|
+
_a.content = _b.sent();
|
|
130
|
+
return [2 /*return*/, (this.content)];
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Load content from a local file.
|
|
137
|
+
*/
|
|
138
|
+
HotFile.prototype.loadLocalFile = function () {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var promise;
|
|
141
|
+
var _this = this;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
promise = new Promise(function (resolve, reject) {
|
|
144
|
+
fs.readFile(_this.localFile, function (err, data) {
|
|
145
|
+
if (err != null)
|
|
146
|
+
throw err;
|
|
147
|
+
var content = data.toString();
|
|
148
|
+
_this.content = content;
|
|
149
|
+
resolve(_this.content);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
return [2 /*return*/, (promise)];
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Load the contents of the file.
|
|
158
|
+
*/
|
|
159
|
+
HotFile.prototype.load = function () {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
+
var content;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0:
|
|
165
|
+
content = "";
|
|
166
|
+
if (!(this.url !== "")) return [3 /*break*/, 2];
|
|
167
|
+
return [4 /*yield*/, this.loadUrl()];
|
|
168
|
+
case 1:
|
|
169
|
+
content = _a.sent();
|
|
170
|
+
_a.label = 2;
|
|
171
|
+
case 2:
|
|
172
|
+
if (!(this.localFile !== "")) return [3 /*break*/, 4];
|
|
173
|
+
return [4 /*yield*/, this.loadLocalFile()];
|
|
174
|
+
case 3:
|
|
175
|
+
content = _a.sent();
|
|
176
|
+
_a.label = 4;
|
|
177
|
+
case 4: return [2 /*return*/, (content)];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Process string content. This will take in a regular expression and
|
|
184
|
+
* parse the content based on the regex. When the regex content is found
|
|
185
|
+
* contentProcessor will be executed with the regex content found. When
|
|
186
|
+
* the regex content is not found, offContentProcessor will be called with
|
|
187
|
+
* the content outside of the regex.
|
|
188
|
+
*
|
|
189
|
+
* @param content The content to parse.
|
|
190
|
+
* @param contentRegex The regex to use to parse the content.
|
|
191
|
+
* @param contentProcessor The content found inside the regex.
|
|
192
|
+
* @param offContentProcessor The content found outside of the regex.
|
|
193
|
+
* @param numRemoveFromBeginning The number of characters to remove from the
|
|
194
|
+
* beginning of the found content.
|
|
195
|
+
* @param numRemoveFromEnd The number of characters to remove from the end of
|
|
196
|
+
* the found content.
|
|
197
|
+
*/
|
|
198
|
+
HotFile.processContent = function (content, contentRegex, contentProcessor, offContentProcessor, numRemoveFromBeginning, numRemoveFromEnd) {
|
|
199
|
+
if (numRemoveFromBeginning === void 0) { numRemoveFromBeginning = 2; }
|
|
200
|
+
if (numRemoveFromEnd === void 0) { numRemoveFromEnd = 2; }
|
|
201
|
+
var result = contentRegex.exec(content);
|
|
202
|
+
var previousIndex = 0;
|
|
203
|
+
var output = "";
|
|
204
|
+
while (result != null) {
|
|
205
|
+
var start = result.index - numRemoveFromBeginning;
|
|
206
|
+
var end = contentRegex.lastIndex + numRemoveFromEnd;
|
|
207
|
+
// Get the previous section.
|
|
208
|
+
var prevContent = content.substr(previousIndex, (start - previousIndex));
|
|
209
|
+
previousIndex = end;
|
|
210
|
+
output += offContentProcessor(prevContent);
|
|
211
|
+
// Process the content found from the regex
|
|
212
|
+
var contentFound = result[0];
|
|
213
|
+
output += contentProcessor(contentFound);
|
|
214
|
+
// Move on to the next section to parse.
|
|
215
|
+
result = contentRegex.exec(content);
|
|
216
|
+
}
|
|
217
|
+
// Append whatever else is after the last parsed section.
|
|
218
|
+
var lastContent = content.substr(previousIndex);
|
|
219
|
+
output += offContentProcessor(lastContent);
|
|
220
|
+
return (output);
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Process any content that could have nested values. This will
|
|
224
|
+
* take in a regular expression and
|
|
225
|
+
* parse the content based on the regex. When the regex content is found
|
|
226
|
+
* contentProcessor will be executed with the regex content found. When
|
|
227
|
+
* the regex content is not found, offContentProcessor will be called with
|
|
228
|
+
* the content outside of the regex.
|
|
229
|
+
*
|
|
230
|
+
* @fixme Needs to be able to ignore any characters found inside comments
|
|
231
|
+
* or a string. For example, if the following is used ```${"Test }"}``` It
|
|
232
|
+
* will error out.
|
|
233
|
+
*
|
|
234
|
+
* @param content The content to parse.
|
|
235
|
+
* @param contentRegex The regex to use to parse the content.
|
|
236
|
+
* @param contentProcessor The content found inside the regex.
|
|
237
|
+
* @param offContentProcessor The content found outside of the regex.
|
|
238
|
+
* @param numRemoveFromBeginning The number of characters to remove from the
|
|
239
|
+
* beginning of the found content.
|
|
240
|
+
* @param numRemoveFromEnd The number of characters to remove from the end of
|
|
241
|
+
* the found content.
|
|
242
|
+
*/
|
|
243
|
+
HotFile.processNestedContent = function (content, startChars, endChars, triggerChar, contentProcessor, offContentProcessor, numRemoveFromBeginning, numRemoveFromEnd) {
|
|
244
|
+
if (numRemoveFromBeginning === void 0) { numRemoveFromBeginning = 2; }
|
|
245
|
+
if (numRemoveFromEnd === void 0) { numRemoveFromEnd = 1; }
|
|
246
|
+
var pos = content.indexOf(startChars);
|
|
247
|
+
var previousIndex = 0;
|
|
248
|
+
var startTriggerPos = content.indexOf(triggerChar, pos);
|
|
249
|
+
var output = "";
|
|
250
|
+
while (pos > -1) {
|
|
251
|
+
var end = content.indexOf(endChars, pos);
|
|
252
|
+
var nestedCounter = 0;
|
|
253
|
+
if (triggerChar !== "") {
|
|
254
|
+
// Reverse search the trigger characters and count the number of
|
|
255
|
+
// occurrences.
|
|
256
|
+
var rpos = content.lastIndexOf(triggerChar, end - numRemoveFromEnd);
|
|
257
|
+
while (rpos > -1) {
|
|
258
|
+
if (rpos === startTriggerPos)
|
|
259
|
+
break;
|
|
260
|
+
rpos = content.lastIndexOf(triggerChar, rpos - numRemoveFromEnd);
|
|
261
|
+
nestedCounter++;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// If there's nested trigger characters, get the last occurrence of
|
|
265
|
+
// the end character.
|
|
266
|
+
if (nestedCounter > 0) {
|
|
267
|
+
var epos = content.indexOf(endChars, end + numRemoveFromEnd);
|
|
268
|
+
var tempepos = epos;
|
|
269
|
+
while ((epos > -1) && (nestedCounter > 0)) {
|
|
270
|
+
if (tempepos < 0)
|
|
271
|
+
break;
|
|
272
|
+
// Make sure we aren't discovering endChars that we shouldn't be.
|
|
273
|
+
var posOutsideOfContent = content.lastIndexOf(startChars, tempepos - numRemoveFromEnd);
|
|
274
|
+
if (posOutsideOfContent > epos)
|
|
275
|
+
break;
|
|
276
|
+
epos = tempepos;
|
|
277
|
+
tempepos = content.indexOf(endChars, epos + numRemoveFromEnd);
|
|
278
|
+
nestedCounter--;
|
|
279
|
+
}
|
|
280
|
+
end = epos;
|
|
281
|
+
}
|
|
282
|
+
var offContentStr = content.substr(previousIndex, (pos - previousIndex));
|
|
283
|
+
output += offContentProcessor(offContentStr);
|
|
284
|
+
var foundContent = content.substr(pos + numRemoveFromBeginning, (end - (pos + numRemoveFromBeginning)));
|
|
285
|
+
output += contentProcessor(foundContent);
|
|
286
|
+
// Get the next content
|
|
287
|
+
pos = content.indexOf(startChars, end + numRemoveFromEnd);
|
|
288
|
+
startTriggerPos = content.indexOf(triggerChar, pos);
|
|
289
|
+
previousIndex = end + numRemoveFromEnd;
|
|
290
|
+
}
|
|
291
|
+
// Append whatever else is after the last parsed section.
|
|
292
|
+
var lastContent = content.substr(previousIndex);
|
|
293
|
+
output += offContentProcessor(lastContent);
|
|
294
|
+
return (output);
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Process the content in this file. This treats each file as one large JavaScript
|
|
298
|
+
* file. Any text outside of the <* *> areas will be treated as:
|
|
299
|
+
*
|
|
300
|
+
* Hot.echo ("text");
|
|
301
|
+
*
|
|
302
|
+
* @fixme The regex's in the offContent functions need to be fixed. There's several
|
|
303
|
+
* test cases where they will fail.
|
|
304
|
+
*/
|
|
305
|
+
HotFile.prototype.process = function (args) {
|
|
306
|
+
if (args === void 0) { args = null; }
|
|
307
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
308
|
+
var output, thisContent, returnedOutput, executionContent, key, newVar, newVarValue, newVarValueStr, contentName, func, ex_2, finalOutput;
|
|
309
|
+
var _this = this;
|
|
310
|
+
return __generator(this, function (_a) {
|
|
311
|
+
switch (_a.label) {
|
|
312
|
+
case 0:
|
|
313
|
+
output = "";
|
|
314
|
+
thisContent = this.content;
|
|
315
|
+
Hot_1.Hot.Mode = this.page.processor.mode;
|
|
316
|
+
Hot_1.Hot.Arguments = args;
|
|
317
|
+
Hot_1.Hot.CurrentPage = this.page;
|
|
318
|
+
Hot_1.Hot.PublicSecrets = this.page.processor.publicSecrets;
|
|
319
|
+
Hot_1.Hot.API = this.page.getAPI();
|
|
320
|
+
Hot_1.Hot.TesterAPI = this.page.getTesterAPI();
|
|
321
|
+
// Assemble the JS to evaluate. This will take all content outside of
|
|
322
|
+
// <* and *> and wrap a Hot.echo around it. Any JS found inside of the
|
|
323
|
+
// <* and *> will be executed as is.
|
|
324
|
+
output = HotFile.processContent(thisContent, new RegExp("(?=\\<\\*)([\\s\\S]*?)(?=\\*\\>)", "g"), function (regexFound) {
|
|
325
|
+
// A little hack, since I suck at Regex :(
|
|
326
|
+
regexFound = regexFound.substr(2);
|
|
327
|
+
return ("".concat(regexFound));
|
|
328
|
+
}, function (offContent) {
|
|
329
|
+
if (offContent === "")
|
|
330
|
+
return ("");
|
|
331
|
+
var tempOutput = HotFile.processNestedContent(offContent, "!{", "}", "{", function (regexFound2) {
|
|
332
|
+
var out = "*&&%*%@#@!".concat(regexFound2, "*&!#%@!@*!");
|
|
333
|
+
return (out);
|
|
334
|
+
}, function (offContent3) {
|
|
335
|
+
return (offContent3);
|
|
336
|
+
});
|
|
337
|
+
var tempOutput2 = HotFile.processNestedContent(tempOutput, "STR{", "}", "{", function (regexFound2) {
|
|
338
|
+
var out = "*&&%*%@#@!echoOutput (JSON.stringify(".concat(regexFound2, "), ").concat(_this.throwAllErrors, ");*&!#%@!@*!");
|
|
339
|
+
return (out);
|
|
340
|
+
}, function (offContent3) {
|
|
341
|
+
return (offContent3);
|
|
342
|
+
}, 4, 1);
|
|
343
|
+
var tempOutput3 = HotFile.processNestedContent(tempOutput2, "${", "}", "{", function (regexFound2) {
|
|
344
|
+
var out = "*&&%*%@#@!try { Hot.echo (".concat(regexFound2, "); }catch (ex){Hot.echo (\"\");}*&!#%@!@*!");
|
|
345
|
+
if (_this.throwAllErrors === true)
|
|
346
|
+
out = "*&&%*%@#@!Hot.echo (".concat(regexFound2, ");*&!#%@!@*!");
|
|
347
|
+
return (out);
|
|
348
|
+
}, function (offContent3) {
|
|
349
|
+
return (offContent3);
|
|
350
|
+
/*let escapedContent: string = JSON.stringify (offContent3);
|
|
351
|
+
let out: string = `echoOutput (${escapedContent}, ${this.throwAllErrors});\n`;
|
|
352
|
+
|
|
353
|
+
return (out);*/
|
|
354
|
+
});
|
|
355
|
+
var tempOutput4 = "";
|
|
356
|
+
if (Hot_1.Hot.Mode === Hot_1.DeveloperMode.Production) {
|
|
357
|
+
tempOutput4 = HotFile.processNestedContent(tempOutput3, "?(", ")", "(", function (regexFound2) {
|
|
358
|
+
return ("");
|
|
359
|
+
}, function (offContent3) {
|
|
360
|
+
return (offContent3);
|
|
361
|
+
/*let out: string = `echoOutput (${offContent3}, ${this.throwAllErrors});\n`;
|
|
362
|
+
|
|
363
|
+
return (out);*/
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
if (Hot_1.Hot.Mode === Hot_1.DeveloperMode.Development) {
|
|
367
|
+
tempOutput4 = HotFile.processNestedContent(tempOutput3, "?(", ")", "(", function (regexFound2) {
|
|
368
|
+
var foundStr = "";
|
|
369
|
+
try {
|
|
370
|
+
// Check to see if it be parsed. If so, stringify it.
|
|
371
|
+
JSON.parse(regexFound2);
|
|
372
|
+
foundStr = JSON.stringify(regexFound2);
|
|
373
|
+
}
|
|
374
|
+
catch (ex) {
|
|
375
|
+
// If valid JSON is not received, don't worry about it, pass it
|
|
376
|
+
// along to the function below for it to be parsed in the page.
|
|
377
|
+
// The exception should be thrown there instead.
|
|
378
|
+
foundStr = "".concat(regexFound2);
|
|
379
|
+
}
|
|
380
|
+
/// @fixme Make this a callable function and pass foundStr, etc.
|
|
381
|
+
var out = "*&&%*%@#@!{\nconst testElm = createTestElement (".concat(foundStr, ");\nHot.echo (`data-test-object-name = \"${testElm.name}\" data-test-object-func = \"${testElm.func}\" data-test-object-value = \"${testElm.value}\"`);\n}*&!#%@!@*!\n");
|
|
382
|
+
return (out);
|
|
383
|
+
}, function (offContent3) {
|
|
384
|
+
return (offContent3);
|
|
385
|
+
/*let out: string = `echoOutput (${offContent3}, ${this.throwAllErrors});\n`;
|
|
386
|
+
|
|
387
|
+
return (out);*/
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
var tempOutput5 = HotFile.processNestedContent(tempOutput4, "*&&%*%@#@!", "*&!#%@!@*!", "*&&%*%@#@!", function (regexFound) {
|
|
391
|
+
return (regexFound);
|
|
392
|
+
}, function (offContent) {
|
|
393
|
+
var escapedContent = JSON.stringify(offContent);
|
|
394
|
+
var out = "echoOutput (".concat(escapedContent, ", ").concat(_this.throwAllErrors, ");\n");
|
|
395
|
+
return (out);
|
|
396
|
+
}, "*&&%*%@#@!".length, "*&!#%@!@*!".length);
|
|
397
|
+
/// @fixme Temporary hack. These delimiters should be removed from tempOutput when
|
|
398
|
+
/// executing processNestedContent.
|
|
399
|
+
tempOutput5 = tempOutput5.replace(/\*\&\&\%\*\%\@\#\@\!/g, "");
|
|
400
|
+
tempOutput5 = tempOutput5.replace(/\*\&\!\#\%\@\!\@\*\!/g, "");
|
|
401
|
+
return (tempOutput5);
|
|
402
|
+
}, 0);
|
|
403
|
+
returnedOutput = null;
|
|
404
|
+
_a.label = 1;
|
|
405
|
+
case 1:
|
|
406
|
+
_a.trys.push([1, 3, , 4]);
|
|
407
|
+
executionContent = "\n\t\t\tvar Hot = arguments[0];\n\t\t\tvar PassedHotFile = arguments[1];\n\n\t\t\t";
|
|
408
|
+
if (typeof (args) === "string")
|
|
409
|
+
throw new Error("The passing arguments cannot be a string!");
|
|
410
|
+
for (key in args) {
|
|
411
|
+
newVar = "";
|
|
412
|
+
newVarValue = args[key];
|
|
413
|
+
newVarValueStr = JSON.stringify(newVarValue);
|
|
414
|
+
newVar = "var ".concat(key, " = ").concat(newVarValueStr, ";\n");
|
|
415
|
+
executionContent += newVar;
|
|
416
|
+
}
|
|
417
|
+
contentName = this.name;
|
|
418
|
+
if (contentName === "")
|
|
419
|
+
contentName = this.localFile;
|
|
420
|
+
if (contentName === "")
|
|
421
|
+
contentName = this.url;
|
|
422
|
+
executionContent += "\n\n\t\t\tfunction echoOutput (content, throwErrors)\n\t\t\t{\n\t\t\t\tif (throwErrors == null)\n\t\t\t\t\tthrowErrors = true;\n\n\t\t\t\tif (throwErrors === true)\n\t\t\t\t{\n\t\t\t\t\tHot.echo (content);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tHot.echo (content);\n\t\t\t\t}\n\t\t\t\tcatch (ex)\n\t\t\t\t{\n\t\t\t\t\tHot.echo (\"\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction createTestElement (foundStr)\n\t\t\t{\n\t\t\t\tlet testElm = null;\n\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tlet obj = foundStr;\n\n\t\t\t\t\tif (typeof (foundStr) === \"string\")\n\t\t\t\t\t\tobj = JSON.parse (foundStr);\n\n\t\t\t\t\tif (typeof (obj) === \"string\")\n\t\t\t\t\t\ttestElm = new Hot.HotTestElement (obj);\n\n\t\t\t\t\tif (obj instanceof Array)\n\t\t\t\t\t\ttestElm = new Hot.HotTestElement (obj[0], obj[1], obj[2]);\n\n\t\t\t\t\tif (obj[\"name\"] != null)\n\t\t\t\t\t\ttestElm = new Hot.HotTestElement (obj);\n\n\t\t\t\t\tif (Hot.CurrentPage.testElements[testElm.name] != null)\n\t\t\t\t\t\tthrow new Error (`Test element ${testElm.name} already exists!`);\n\n\t\t\t\t\tHot.CurrentPage.addTestElement (testElm);\n\t\t\t\t}\n\t\t\t\tcatch (ex)\n\t\t\t\t{\n\t\t\t\t\tthrow new Error (\n\t\t\t`Error processing test element ${foundStr} in ${Hot.CurrentPage.name}. Error: ${ex.message}`\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (testElm);\n\t\t\t}\n\n\t\t\tasync function runContent (CurrentHotFile)\n\t\t\t{\n";
|
|
423
|
+
executionContent += output;
|
|
424
|
+
executionContent += "\n\t\t\t}\n\n\t\t\treturn (runContent (PassedHotFile).then (() =>\n\t\t\t{\n\t\t\t\treturn ({\n\t\t\t\t\t\thot: Hot,\n\t\t\t\t\t\toutput: Hot.Output,\n\t\t\t\t\t\tdata: JSON.stringify (Hot.Data)\n\t\t\t\t\t});\n\t\t\t}));";
|
|
425
|
+
func = new Function(executionContent);
|
|
426
|
+
return [4 /*yield*/, func.apply(this, [Hot_1.Hot, this])];
|
|
427
|
+
case 2:
|
|
428
|
+
returnedOutput = _a.sent();
|
|
429
|
+
return [3 /*break*/, 4];
|
|
430
|
+
case 3:
|
|
431
|
+
ex_2 = _a.sent();
|
|
432
|
+
if (ex_2 instanceof SyntaxError) {
|
|
433
|
+
/// @fixme Put what's in the content variable into a prev content variable?
|
|
434
|
+
/// Then once there's no longer any syntax errors being thrown, execute the
|
|
435
|
+
/// code? This would also require saving any HTML outside of the *> and <*
|
|
436
|
+
/// then echoing it out. The throw below would have to be removed as well.
|
|
437
|
+
throw ex_2;
|
|
438
|
+
}
|
|
439
|
+
else
|
|
440
|
+
throw ex_2;
|
|
441
|
+
return [3 /*break*/, 4];
|
|
442
|
+
case 4:
|
|
443
|
+
Hot_1.Hot.Data = returnedOutput.hot.Data;
|
|
444
|
+
finalOutput = returnedOutput.output;
|
|
445
|
+
Hot_1.Hot.Output = "";
|
|
446
|
+
return [2 /*return*/, (finalOutput)];
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
return HotFile;
|
|
452
|
+
}());
|
|
453
|
+
exports.HotFile = HotFile;
|
|
454
|
+
//# sourceMappingURL=HotFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotFile.js","sourceRoot":"","sources":["../../src/HotFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AAEzB,4DAAgC;AAEhC,6BAA2C;AAmC3C;;GAEG;AACH;IA2BC,iBAAa,IAAmB;QAAnB,qBAAA,EAAA,SAAmB;QAE/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC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,QAAK,CAAC;4BAE7C,gBAAgB,IAAI,MAAM,CAAC;yBAC3B;wBAEG,WAAW,GAAW,IAAI,CAAC,IAAI,CAAC;wBAEpC,IAAI,WAAW,KAAK,EAAE;4BACrB,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC;wBAE9B,IAAI,WAAW,KAAK,EAAE;4BACrB,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC;wBAExB,gBAAgB,IAAI,k5CA4DhB,CAAC;wBACL,gBAAgB,IAAI,MAAM,CAAC;wBAC3B,gBAAgB,IAAI,+NAUf,CAAC;wBAGF,IAAI,GAAa,IAAI,QAAQ,CAAE,gBAAgB,CAAC,CAAC;wBACpC,qBAAM,IAAI,CAAC,KAAK,CAAE,IAAI,EAAE,CAAC,SAAG,EAAE,IAAI,CAAC,CAAC,EAAA;;wBAArD,cAAc,GAAG,SAAoC,CAAC;;;;wBAItD,IAAI,IAAE,YAAY,WAAW,EAC7B;4BACC,2EAA2E;4BAC3E,4EAA4E;4BAC5E,2EAA2E;4BAC3E,0EAA0E;4BAC1E,MAAM,IAAE,CAAC;yBACT;;4BAEA,MAAM,IAAE,CAAC;;;wBAGX,SAAG,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;wBAC/B,WAAW,GAAW,cAAc,CAAC,MAAM,CAAC;wBAChD,SAAG,CAAC,MAAM,GAAG,EAAE,CAAC;wBAEhB,sBAAO,CAAC,WAAW,CAAC,EAAC;;;;KACrB;IACF,cAAC;AAAD,CAAC,AA9jBD,IA8jBC;AA9jBY,0BAAO"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as http from "http";
|
|
3
|
+
import * as https from "https";
|
|
4
|
+
import express from "express";
|
|
5
|
+
import { Files } from "formidable";
|
|
6
|
+
import { HotServer } from "./HotServer";
|
|
7
|
+
import { HotStaq } from "./HotStaq";
|
|
8
|
+
import { HotRoute } from "./HotRoute";
|
|
9
|
+
import { HTTPMethod } from "./HotRouteMethod";
|
|
10
|
+
/**
|
|
11
|
+
* A static route.
|
|
12
|
+
*/
|
|
13
|
+
export interface StaticRoute {
|
|
14
|
+
/**
|
|
15
|
+
* The route to the files.
|
|
16
|
+
*/
|
|
17
|
+
route?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The absolute path to the location of the files to
|
|
20
|
+
* serve on this machine.
|
|
21
|
+
*/
|
|
22
|
+
localPath?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A HTTP server.
|
|
26
|
+
*/
|
|
27
|
+
export declare class HotHTTPServer extends HotServer {
|
|
28
|
+
/**
|
|
29
|
+
* The express app to use.
|
|
30
|
+
*/
|
|
31
|
+
expressApp: express.Express;
|
|
32
|
+
/**
|
|
33
|
+
* The HTTP listener to use.
|
|
34
|
+
*/
|
|
35
|
+
httpListener: http.Server;
|
|
36
|
+
/**
|
|
37
|
+
* The HTTPS listener to use.
|
|
38
|
+
*/
|
|
39
|
+
httpsListener: https.Server;
|
|
40
|
+
/**
|
|
41
|
+
* The static files and folders to serve.
|
|
42
|
+
*/
|
|
43
|
+
staticRoutes: StaticRoute[];
|
|
44
|
+
/**
|
|
45
|
+
* Any non-static routes that need to be added. These
|
|
46
|
+
* will be added during the preregistration phase, before
|
|
47
|
+
* all API routes are added.
|
|
48
|
+
*/
|
|
49
|
+
routes: {
|
|
50
|
+
/**
|
|
51
|
+
* The type of route.
|
|
52
|
+
*/
|
|
53
|
+
type: HTTPMethod;
|
|
54
|
+
/**
|
|
55
|
+
* The type of route.
|
|
56
|
+
*/
|
|
57
|
+
route: string;
|
|
58
|
+
/**
|
|
59
|
+
* The method to execute when this route is hit.
|
|
60
|
+
*/
|
|
61
|
+
method: (req: express.Request, res: express.Response) => Promise<void>;
|
|
62
|
+
}[];
|
|
63
|
+
/**
|
|
64
|
+
* Serve hott files when requested. This value will be overwritten by whatever
|
|
65
|
+
* value is set to server.serveHottFiles in HotSite.json.
|
|
66
|
+
*/
|
|
67
|
+
serveHottFiles: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Do not serve these hott files.
|
|
70
|
+
*/
|
|
71
|
+
ignoreHottFiles: {
|
|
72
|
+
[name: string]: boolean;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* The associated info with any hott files served. All values here will be
|
|
76
|
+
* overwritten by whatever values are set in the server object in HotSite.json.
|
|
77
|
+
*/
|
|
78
|
+
hottFilesAssociatedInfo: {
|
|
79
|
+
/**
|
|
80
|
+
* The default name for a served Hott file.
|
|
81
|
+
*/
|
|
82
|
+
name: string;
|
|
83
|
+
/**
|
|
84
|
+
* The base url for a hott file.
|
|
85
|
+
*/
|
|
86
|
+
url: string;
|
|
87
|
+
/**
|
|
88
|
+
* The JavaScript source path.
|
|
89
|
+
*/
|
|
90
|
+
jsSrcPath: string;
|
|
91
|
+
};
|
|
92
|
+
constructor(processor: HotStaq | HotServer, httpPort?: number, httpsPort?: number);
|
|
93
|
+
/**
|
|
94
|
+
* Add a static route.
|
|
95
|
+
*/
|
|
96
|
+
addStaticRoute(route: string | StaticRoute, localPath?: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* Add a route. This will be registered before any APIs are registered.
|
|
99
|
+
*/
|
|
100
|
+
addRoute(route: string, method: (req: express.Request, res: express.Response) => Promise<void>, type?: HTTPMethod): void;
|
|
101
|
+
/**
|
|
102
|
+
* Serve a directory. This is an alias for addStaticRoute.
|
|
103
|
+
*/
|
|
104
|
+
serveDirectory(route: string | StaticRoute, localPath?: string): void;
|
|
105
|
+
/**
|
|
106
|
+
* Register a static route with Express.
|
|
107
|
+
*/
|
|
108
|
+
registerStaticRoute(route: StaticRoute): void;
|
|
109
|
+
/**
|
|
110
|
+
* Get a static route.
|
|
111
|
+
*/
|
|
112
|
+
getStaticRoute(route: string): StaticRoute;
|
|
113
|
+
/**
|
|
114
|
+
* Register a route.
|
|
115
|
+
*/
|
|
116
|
+
registerRoute(route: HotRoute): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Check if a file exists.
|
|
119
|
+
*/
|
|
120
|
+
static checkIfFileExists(filepath: string): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* The routes to add before registering a route.
|
|
123
|
+
*/
|
|
124
|
+
preregisterRoute(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Get all files uploaded.
|
|
127
|
+
*/
|
|
128
|
+
static getFileUploads(req: express.Request, options?: any): Promise<Files>;
|
|
129
|
+
/**
|
|
130
|
+
* Set the error handlers. This will create two express routes at the bottom of the
|
|
131
|
+
* route stack. The first will be to capture any 404 errors, the second would be to
|
|
132
|
+
* catch any remaining errors.
|
|
133
|
+
*/
|
|
134
|
+
setErrorHandlingRoutes(handle404?: (req: express.Request, res: express.Response, next: any) => void, handleOther?: (err: any, req: express.Request, res: express.Response, next: any) => void): void;
|
|
135
|
+
/**
|
|
136
|
+
* Clear the last two express routes, which are reserved for the
|
|
137
|
+
* error handlers.
|
|
138
|
+
*/
|
|
139
|
+
clearErrorHandlingRoutes(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Start listening for requests.
|
|
142
|
+
*/
|
|
143
|
+
listen(): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Start the server.
|
|
146
|
+
*
|
|
147
|
+
* @param localStaticPath The public path that contains the HTML, Hott files, images, and
|
|
148
|
+
* all public content. This can also be an array of StaticRoutes.
|
|
149
|
+
* @param httpPort The HTTP port to listen on .
|
|
150
|
+
* @param httpsPort The HTTPS port to listen on.
|
|
151
|
+
* @param processor The HotStaq or parent server being used for communication.
|
|
152
|
+
*/
|
|
153
|
+
static startServer(localStaticPath?: string | StaticRoute[], httpPort?: number, httpsPort?: number, processor?: HotServer | HotStaq): Promise<{
|
|
154
|
+
processor: HotServer | HotStaq;
|
|
155
|
+
server: HotHTTPServer;
|
|
156
|
+
}>;
|
|
157
|
+
/**
|
|
158
|
+
* Shutdown the server.
|
|
159
|
+
*/
|
|
160
|
+
shutdown(): Promise<void>;
|
|
161
|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