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,125 @@
|
|
|
1
|
+
'use strict';!function(C,g){"object"==typeof exports&&"object"==typeof module?module.exports=g():"function"==typeof define&&define.amd?define([],g):"object"==typeof exports?exports.HotStaqWeb=g():C.HotStaqWeb=g()}(window,function(){return function(C){function g(l){if(z[l])return z[l].exports;var q=z[l]={i:l,l:!1,exports:{}};return C[l].call(q.exports,q,q.exports,g),q.l=!0,q.exports}var z={};return g.m=C,g.c=z,g.d=function(l,q,t){g.o(l,q)||Object.defineProperty(l,q,{enumerable:!0,get:t})},g.r=function(l){"undefined"!=
|
|
2
|
+
typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"});Object.defineProperty(l,"__esModule",{value:!0})},g.t=function(l,q){if((1&q&&(l=g(l)),8&q)||4&q&&"object"==typeof l&&l&&l.__esModule)return l;var t=Object.create(null);if(g.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:l}),2&q&&"string"!=typeof l)for(var e in l)g.d(t,e,function(h){return l[h]}.bind(null,e));return t},g.n=function(l){var q=l&&l.__esModule?function(){return l.default}:function(){return l};
|
|
3
|
+
return g.d(q,"a",q),q},g.o=function(l,q){return Object.prototype.hasOwnProperty.call(l,q)},g.p="",g(g.s=16)}([function(C,g,z){(function(l){var q=this&&this.__createBinding||(Object.create?function(c,u,y,A){void 0===A&&(A=y);Object.defineProperty(c,A,{enumerable:!0,get:function(){return u[y]}})}:function(c,u,y,A){void 0===A&&(A=y);c[A]=u[y]}),t=this&&this.__setModuleDefault||(Object.create?function(c,u){Object.defineProperty(c,"default",{enumerable:!0,value:u})}:function(c,u){c.default=u}),e=this&&
|
|
4
|
+
this.__importStar||function(c){if(c&&c.__esModule)return c;var u={};if(null!=c)for(var y in c)"default"!==y&&Object.prototype.hasOwnProperty.call(c,y)&&q(u,c,y);return t(u,c),u},h=this&&this.__awaiter||function(c,u,y,A){return new (y||(y=Promise))(function(J,k){function w(G){try{L(A.next(G))}catch(B){k(B)}}function D(G){try{L(A.throw(G))}catch(B){k(B)}}function L(G){var B;G.done?J(G.value):(B=G.value,B instanceof y?B:new y(function(F){F(B)})).then(w,D)}L((A=A.apply(c,u||[])).next())})},m=this&&this.__importDefault||
|
|
5
|
+
function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(g,"__esModule",{value:!0});g.HotStaq=void 0;const a=e(z(4)),f=e(z(4)),b=m(z(2)),d=m(z(17)),p=z(10),r=z(5),n=z(11),v=z(1),x=z(12),E=z(13),H=z(15);var K=null,M=null,P=null;class I{constructor(c={}){this.api=c.api||null;this.testerAPI=c.testerAPI||null;this.mode=c.mode||v.DeveloperMode.Production;this.pages=c.pages||{};this.components=c.components||{};this.files=c.files||{};this.hotSite=c.hotSite||null;this.apiContent="\n\t\t\tvar %api_name% = %api_exported_name%.%api_name%;\n\t\t\tvar newHotClient = new HotClient (processor);\n\t\t\tvar newapi = new %api_name% (%base_url%, newHotClient);\n\t\t\tnewHotClient.api = newapi;\n\t\t\tprocessor.api = newapi;";
|
|
6
|
+
this.testerApiContent="\n\t\t\tvar HotTesterAPI = HotStaqWeb.HotTesterAPI;\n\t\t\tvar newHotTesterClient = new HotClient (processor);\n\t\t\tvar newtesterapi = new HotTesterAPI (%base_tester_url%, newHotTesterClient);\n\t\t\tnewHotTesterClient.testerAPI = newtesterapi;\n\t\t\tprocessor.testerAPI = newtesterapi;";this.pageContent='<!DOCTYPE html>\n<html>\n\n<head>\n\t<title>%title%</title>\n\n\t<script type = "text/javascript" src = "%hotstaq_js_src%">\x3c/script>\n\n%apis_to_load%\n\n\t<script type = "text/javascript">\n\t\tfunction hotstaq_startApp ()\n\t\t{\n\t\t\tlet tempMode = 0;\n\n\t\t\tif (window["Hot"] != null)\n\t\t\t\ttempMode = Hot.Mode;\n\n\t\t\twindow.HotStaq = HotStaqWeb.HotStaq;\n\t\t\twindow.HotClient = HotStaqWeb.HotClient;\n\t\t\twindow.Hot = HotStaqWeb.Hot;\n\n\t\t\t%load_hot_site%\n\n\t\t\tvar processor = new HotStaq ();\n\t\t\tvar promises = [];\n\t\t\t%developer_mode%\n\n\t\t\t%api_code%\n\n\t\t\t%public_secrets%\n\t\t\t%tester_api%\n\t\t\t%load_files%\n\n\t\t\tprocessor.mode = tempMode;\n\n\t\t\tPromise.all (promises).then (function ()\n\t\t\t\t{\n\t\t\t\t\tHotStaq.displayUrl ({\n\t\t\t\t\t\t\turl: "%url%",\n\t\t\t\t\t\t\tname: "%title%",\n\t\t\t\t\t\t\tprocessor: processor,\n\t\t\t\t\t\t\targs: %args%,\n\t\t\t\t\t\t\ttesterName: %tester_name%,\n\t\t\t\t\t\t\ttesterMap: %tester_map%,\n\t\t\t\t\t\t\ttesterAPIBaseUrl: %tester_api_base_url%,\n\t\t\t\t\t\t\ttesterLaunchpadUrl: %tester_launchpad_url%\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\n\t\thotstaq_startApp ();\n\t\x3c/script>\n</head>\n\n<body>\n</body>\n\n</html>';
|
|
7
|
+
this.logger=new n.HotLog(n.HotLogLevel.None);this.publicSecrets={};this.testers={}}static parseBoolean(c){if("true"===(c=c.toLowerCase()))return!0;if("false"===c)return!1;if("yes"===c)return!0;if("no"===c)return!1;if("yep"===c)return!0;if("nah"===c)return!1;try{if(0!=parseInt(c))return!0}catch(u){}return!1}static getParam(c,u,y=!0,A=!0){u=u[c];if(null==u&&!0===y&&!0===A)throw Error(`Missing required parameter ${c}.`);if("string"==typeof u&&!0===y&&""===u&&!0===A)throw Error(`Missing required parameter ${c}.`);
|
|
8
|
+
return u}static getParamDefault(c,u,y){c=u[c];return null==c||"string"==typeof c&&""===c?y:c}static wait(c){return h(this,void 0,void 0,function*(){return yield new Promise((u,y)=>{setTimeout(()=>{u()},c)})})}addPage(c){this.pages[c.name]=c}getPage(c){return this.pages[c]}addFile(c){let u=c.name;""===u&&(u=c.localFile);""===u&&(u=c.url);this.files[u]=c}getFile(c){if(null==this.files[c])throw Error("Unable to find file "+c);return this.files[c]}addComponent(c){this.components[c.name]=c;this.registerComponent(c)}registerComponent(c){customElements.define(c.tag,
|
|
9
|
+
class extends HTMLElement{constructor(){super();(()=>{h(this,void 0,void 0,function*(){this.onclick=c.click.bind(c);for(var u in c.events){var y=c.events[u];this.addEventListener(y.type,y.func,y.options)}if(c.htmlElement=yield c.onCreated(this),null!=c.handleAttributes)yield c.handleAttributes(this.attributes);else for(u=0;u<this.attributes.length;u++){var A=this.attributes[u];y=A.name.toLowerCase();A=A.value;"id"===y&&(c.name=A);"name"===y&&(c.name=A);"value"===y&&(c.value=A)}u=yield c.output();
|
|
10
|
+
u=(new DOMParser).parseFromString(u,"text/html");y=this.attachShadow({mode:"open"});for(A=0;A<u.body.children.length;A++)y.appendChild(u.body.children[A])})})()}},c.elementOptions)}getComponent(c){return this.components[c]}static addHtml(c,u){let y=null;if(y="string"==typeof c?document.querySelector(c):c,null==y)throw Error(`Unable to find parent ${c}!`);c=null;if("string"==typeof u){u=(new DOMParser).parseFromString(u,"text/html");c=[];for(let A=0;A<u.body.children.length;A++)c.push(y.appendChild(u.body.children[A]));
|
|
11
|
+
return c}return c=y.appendChild(u),c}static checkHotSiteName(c,u=!1){let y=(0,d.default)(c);if(null!=y.errors&&0<y.errors.length&&!0===u)throw Error(`HotSite ${c} has an invalid name! The name cannot be empty and must have a valid NPM module name.`);return!0}static replaceKey(c,u,y){return c.replace(new RegExp(`\\$\\{${u}\\}`,"g"),y)}static getValueFromHotSiteObj(c,u){let y=null;if(null!=c){for(let A=0;A<u.length;A++){let J=u[A];if(null==c[J]){c=null;break}c=c[J]}null!=c&&(y=c)}return y}loadHotSite(c){return h(this,
|
|
12
|
+
void 0,void 0,function*(){var u="";!0===I.isWeb?(this.logger.info("Retrieving HotSite "+c),u=yield(0,b.default)(c),this.logger.info("Retrieved site "+c),u=u.text()):(c=f.normalize(c),this.logger.info("Retrieving HotSite "+c),u=yield new Promise((B,F)=>{a.readFile(c,(N,O)=>{if(null!=N)throw N;N=O.toString();this.logger.info("Retrieved site "+c);B(N)})}));this.hotSite=JSON.parse(u);I.checkHotSiteName(this.hotSite.name,!0);this.hotSite.hotsitePath=c;u=this.hotSite.routes;let y="http://127.0.0.1:8182",
|
|
13
|
+
A=null,J=null;if(!1===I.isWeb&&this.mode===v.DeveloperMode.Development&&null!=this.hotSite.testing){var k=B=>{let F=!0;null!=B.createNewTester&&(F=B.createNewTester);let N="Tester";null!=B.tester&&(N=B.tester);null!=B.testerName&&(N=B.testerName);!0===F?(K=z(!function(){var O=Error("Cannot find module './HotTesterMocha'");throw O.code="MODULE_NOT_FOUND",O;}()).HotTesterMocha,M=z(!function(){var O=Error("Cannot find module './HotTesterMochaSelenium'");throw O.code="MODULE_NOT_FOUND",O;}()).HotTesterMochaSelenium,
|
|
14
|
+
P=z(!function(){var O=Error("Cannot find module './HotTestSeleniumDriver'");throw O.code="MODULE_NOT_FOUND",O;}()).HotTestSeleniumDriver,""===B.testerAPIUrl&&(y=B.testerAPIUrl),"HotTestSeleniumDriver"===B.driver&&(J=new P),"HotTesterMocha"===B.tester&&(A=new K(this,N,y,J)),"HotTesterMochaSelenium"===B.tester&&(A=new M(this,N,y))):A=this.testers[N]};null!=this.hotSite.testing.web&&k(this.hotSite.testing.web);null!=this.hotSite.testing.api&&k(this.hotSite.testing.api)}if(null!=u)for(var w in u){k=u[w];
|
|
15
|
+
var D=new r.HotFile(k);D=new p.HotPage({processor:this,name:k.name||"",route:w,files:[D]});if(null!=A&&this.mode===v.DeveloperMode.Development){let B=k.name,F=null;if(null!=k.map){if("string"==typeof k.map){if(null==A.testMaps[k.map])throw Error(`Test map ${k.map} does not exist!`);A.testMaps[B]=A.testMaps[k.map]}else{F=new H.HotTestMap;let N=null;if(k.map instanceof Array){N=[];for(let O=0;O<k.map.length;O++)N.push(new H.HotTestDestination(k.map[O]))}else{N={};for(var L in k.map)N[L]=new H.HotTestDestination(k.map[L])}F.destinations=
|
|
16
|
+
N}A.testMaps[B]=F}null!=k.destinationOrder&&(A.testMaps[B].destinationOrder=k.destinationOrder)}this.addPage(D)}if(null!=this.hotSite.apis)for(var G in this.hotSite.apis)if(w=this.hotSite.apis[G],null!=w.map&&!1===I.isWeb&&this.mode===v.DeveloperMode.Development){L=G;u=new H.HotTestMap;u.destinations=[];for(k=0;k<w.map.length;k++)u.destinations.push(new H.HotTestDestination(w.map[k]));if(null==A)throw Error("A tester was not created first! You must specify one in the CLI or in HotSite.json.");A.testMaps[L]=
|
|
17
|
+
u}if(!0===I.isWeb)for(let B in this.hotSite.components)G=yield(0,b.default)(this.hotSite.components[B].url),G=eval(G),this.addComponent(G);null==this.hotSite.routes&&(this.hotSite.routes={});yield this.loadHotFiles(this.hotSite.files);null!=A&&this.addTester(A)})}loadHotFiles(c,u=!1){return h(this,void 0,void 0,function*(){for(let y in c){let A=c[y],J;J=(I.isWeb,new r.HotFile({name:y}));null!=A.url&&(J.url=A.url);!1===I.isWeb&&null!=A.localFile&&(J.localFile=A.localFile);let k=!0;null!=A.content&&
|
|
18
|
+
(J.content=A.content,k=!1);!0===u&&(k=!0);!0===k&&(yield J.load());this.addFile(J)}})}generateContent(c,u="",y="./",A="./js/HotStaq.js",J=!0,k=null){let w="",D="",L="";if(null!=this.hotSite){if(null!=this.hotSite.server.globalApi&&""!==this.hotSite.server.globalApi){var G=this.hotSite.apis[this.hotSite.server.globalApi];if(null==G)this.logger.warning(`API with name ${this.hotSite.server.globalApi} doesn't exist!`);else{var B=!0;if(null==G.jsapi&&(B=!1,this.logger.warning(`API with name ${this.hotSite.server.globalApi} doesn't have a jsapi set. Will not send js content to client.`)),
|
|
19
|
+
null==G.libraryName&&(B=!1,this.logger.warning(`API with name ${this.hotSite.server.globalApi} doesn't have a libraryName set. Will not send js content to client.`)),null==G.apiName&&(B=!1,this.logger.warning(`API with name ${this.hotSite.server.globalApi} doesn't have a apiName set. Will not send js content to client.`)),!0===B){w+=`\t<script type = "text/javascript" src = "${G.jsapi}"><\/script>\n`;B='""';null!=this.api&&(B=`"${this.api.baseUrl}"`);var F=this.apiContent;F=F.replace(/%api_name%/g,
|
|
20
|
+
G.apiName);F=F.replace(/%api_exported_name%/g,G.libraryName);F=F.replace(/%base_url%/g,B);D+=F}}}if(null!=this.hotSite.apis&&(B=this.hotSite.routes[c],null!=B&&null!=B.api)){G=this.hotSite.apis[B.api];if(null==G)throw Error("Unable to find API "+B.api);F=!0;if(null==G.jsapi&&(F=!1,this.logger.warning(`API with name ${B.api} doesn't have a jsapi set. Will not send js content to client.`)),null==G.libraryName&&(F=!1,this.logger.warning(`API with name ${B.api} doesn't have a libraryName set. Will not send js content to client.`)),
|
|
21
|
+
null==G.apiName&&(F=!1,this.logger.warning(`API with name ${B.api} doesn't have a apiName set. Will not send js content to client.`)),!0===F)w+=`\t<script type = "text/javascript" src = "${G.jsapi}"><\/script>\n`,B='""',null!=this.api&&(B=`"${this.api.baseUrl}"`),F=this.apiContent,F=F.replace(/%api_name%/g,G.apiName),F=F.replace(/%api_exported_name%/g,G.libraryName),F=F.replace(/%base_url%/g,B),D+=F}if(null!=this.hotSite.server&&null!=this.hotSite.server.jsSrcPath&&(A=this.hotSite.server.jsSrcPath),
|
|
22
|
+
null!=this.hotSite.publicSecrets)for(var N in this.hotSite.publicSecrets){G=this.hotSite.publicSecrets[N];B=void 0;if("string"==typeof G)B=JSON.stringify(G);else if(!1===I.isWeb){if(null!=this.api){if(null==this.api.connection)throw Error("Cannot pass secrets from the API if there's no connection!");F=this.api.connection;null!=G.passSecretFromAPI&&(B=JSON.stringify(F.secrets[N]))}null!=G.env&&(B=JSON.stringify(l.env[G.env]))}L+=`processor.publicSecrets["${N}"] = ${B};\n`}}N=this.pageContent;return N=
|
|
23
|
+
(O=>{let T="",S="";this.mode===v.DeveloperMode.Development&&(T="tempMode = HotStaqWeb.DeveloperMode.Development;",S=this.testerApiContent,null!=this.hotSite&&null!=this.hotSite.testing&&(null==this.hotSite.testing.web.testerAPIUrl&&(this.hotSite.testing.web.testerAPIUrl="http://127.0.0.1:8182"),S=S.replace(/%base_tester_url%/g,`"${this.hotSite.testing.web.testerAPIUrl}"`)));let R="";if(0<Object.keys(this.files).length){R+="var files = {};\n\n";for(var V in this.files){var Q=this.files[V],W=`"${Q.url}"`,
|
|
24
|
+
U="";""!==Q.content&&(Q=JSON.stringify(Q.content),Q=Q.replace(RegExp("\\<script","gmi"),'<scr" + "ipt'),Q=Q.replace(RegExp("\\<\\/script","gmi"),'</scr" + "ipt'),U=', "content": '+Q);R+=`\t\t\tfiles["${V}"] = { "url": ${W}${U} };\n`}R+="\t\t\tpromises.push (processor.loadHotFiles (files));\n"}O=O.replace(/%title%/g,u);!0===J&&(O=O.replace(/%args%/g,"Hot.Arguments"));null!=k&&(O=O.replace(/%args%/g,JSON.stringify(k)));V=c;Q=W="";U="Tester";null!=this.hotSite&&(null!=this.hotSite.testing&&(null!=this.hotSite.testing.web.tester&&
|
|
25
|
+
(U=this.hotSite.testing.web.tester),null!=this.hotSite.testing.web.testerName&&(U=this.hotSite.testing.web.testerName),null!=this.hotSite.testing.web.testerAPIUrl&&(W=this.hotSite.testing.web.testerAPIUrl),null!=this.hotSite.testing.web.launchpadUrl&&(Q=this.hotSite.testing.web.launchpadUrl)),null!=this.hotSite.routes&&null!=this.hotSite.routes[c])&&(V=this.hotSite.routes[c].name);return O.replace(/%hotstaq_js_src%/g,A).replace(/%developer_mode%/g,T).replace(/%tester_api%/g,S).replace(/%apis_to_load%/g,
|
|
26
|
+
w).replace(/%load_hot_site%/g,"").replace(/%load_files%/g,R).replace(/%api_code%/g,D).replace(/%public_secrets%/g,L).replace(/%url%/g,y).replace(/%tester_name%/g,`"${U}"`).replace(/%tester_map%/g,`"${V}"`).replace(/%tester_api_base_url%/g,`"${W}"`).replace(/%tester_launchpad_url%/g,`"${Q}"`)})(N),N}createExpressRoutes(c,u="./js/HotStaq.js"){for(let y in this.pages){let A=this.pages[y];const J=this.generateContent(A.route,A.name,A.files[0].url,u);c.get(A.route,(k,w)=>{w.send(J)})}}addTester(c){this.testers[c.name]=
|
|
27
|
+
c}getWebTestingMaps(){if(null==this.hotSite)throw Error("No HotSite was loaded!");if(null==this.hotSite.testing)throw Error("The HotSite does not have a testing object!");if(null==this.hotSite.testing.web)throw Error("The HotSite does not have a testing web object!");if(null==this.hotSite.testing.web.maps)throw Error("The HotSite testing object does not have any maps!");return this.hotSite.testing.web.maps}getAPITestingMaps(){if(null==this.hotSite)throw Error("No HotSite was loaded!");if(null==this.hotSite.testing)throw Error("The HotSite does not have a testing object!");
|
|
28
|
+
if(null==this.hotSite.testing.api)throw Error("The HotSite does not have a testing api object!");if(null==this.hotSite.testing.api.maps)throw Error("The HotSite testing object does not have any maps!");return this.hotSite.testing.api.maps}getRouteKeyFromName(c){let u="";if(null!=this.hotSite&&null!=this.hotSite.routes)for(let y in this.hotSite.routes)if(this.hotSite.routes[y].name===c){u=y;break}return u}getRouteFromName(c){let u=null;c=this.getRouteKeyFromName(c);return""!==c&&(u=this.hotSite.routes[c]),
|
|
29
|
+
u}executeTests(c,u){return h(this,void 0,void 0,function*(){let y=this.testers[c];if(null==y)throw Error(`Unable to execute tests. Tester ${c} does not exist!`);return y.execute(u)})}executeAllWebTests(c){return h(this,void 0,void 0,function*(){let u=this.getWebTestingMaps();if(null==this.testers[c])throw Error(`Unable to execute tests. Tester ${c} does not exist!`);for(let y=0;y<u.length;y++)yield this.executeTests(c,u[y])})}executeAllAPITests(c){return h(this,void 0,void 0,function*(){let u=this.getAPITestingMaps();
|
|
30
|
+
if(null==this.testers[c])throw Error(`Unable to execute tests. Tester ${c} does not exist!`);for(let y=0;y<u.length;y++)yield this.executeTests(c,u[y])})}process(c,u=null){return h(this,void 0,void 0,function*(){return yield this.getPage(c).process(u)})}static processLocalFile(c,u=c,y=null){return h(this,void 0,void 0,function*(){let A=new I;var J=new r.HotFile({localFile:c});yield J.load();J=new p.HotPage({processor:A,name:u,files:[J]});return A.addPage(J),yield A.process(u,y)})}static processUrl(c){return h(this,
|
|
31
|
+
void 0,void 0,function*(){var u=new r.HotFile({url:c.url});yield u.load();u=new p.HotPage({processor:c.processor,name:c.name,files:[u],testerName:c.testerName,testerMap:c.testerMap});return c.processor.addPage(u),yield c.processor.process(c.name,c.args)})}static processContent(c,u,y,A=null){return h(this,void 0,void 0,function*(){var J=new r.HotFile({content:u});yield J.load();J=new p.HotPage({processor:c,name:y,files:[J]});return c.addPage(J),yield c.process(y,A)})}static onReady(c){"complete"===
|
|
32
|
+
document.readyState||"interactive"===document.readyState?c():window.addEventListener("load",c)}static useOutput(c){document.open();document.write(c);document.close()}static waitForTesters(){return h(this,void 0,void 0,function*(){for(;!1===I.isReadyForTesting;)yield I.wait(10);null!=I.onReadyForTesting&&(yield I.onReadyForTesting())})}static displayUrl(c,u=null,y=null,A=null){return h(this,void 0,void 0,function*(){return new Promise((J,k)=>{I.onReady(()=>h(this,void 0,void 0,function*(){var w={url:""};
|
|
33
|
+
if(w.name=null==u?"string"==typeof c?c:c.name:u,""===w.name&&(w.name="string"==typeof c?c:c.name),"string"==typeof c?w.url=c:(w.url=c.url,null==y&&null!=c.processor&&(y=c.processor),null==A&&null!=c.args&&(A=c.args),null!=c.testerMap&&(w.testerMap=c.testerMap),null!=c.testerName&&(w.testerName=c.testerName),null!=c.testerAPIBaseUrl&&(w.testerAPIBaseUrl=c.testerAPIBaseUrl)),null==y&&(y=new I),y.mode===v.DeveloperMode.Development&&null==y.testerAPI){null==w.testerAPIBaseUrl&&(w.testerAPIBaseUrl="");
|
|
34
|
+
""===w.testerAPIBaseUrl&&(w.testerAPIBaseUrl="http://127.0.0.1:8182");var D=new x.HotClient(y);D=new E.HotTesterAPI(w.testerAPIBaseUrl,D);D.connection.api=D;y.testerAPI=D}w.processor=y;w.args=A;w=yield I.processUrl(w);y.mode===v.DeveloperMode.Development&&(w+='<script type = "text/javascript">\n\tfunction hotstaq_isDocumentReady ()\n\t{\n\t\tif (window["Hot"] != null)\n\t\t{\n\t\t\tif (Hot.Mode === HotStaqWeb.DeveloperMode.Development)\n\t\t\t{\n\t\t\t\tlet func = function ()\n\t\t\t\t\t{\n\t\t\t\t\t\tif (Hot.TesterAPI != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlet testPaths = {};\n\t\t\t\t\t\t\tlet testElements = JSON.stringify (Hot.CurrentPage.testElements);\n\t\t\t\t\t\t\tlet testMaps = JSON.stringify (Hot.CurrentPage.testMaps);\n\n\t\t\t\t\t\t\tfor (let key in Hot.CurrentPage.testPaths)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlet testPath = Hot.CurrentPage.testPaths[key];\n\n\t\t\t\t\t\t\t\ttestPaths[key] = testPath.toString ();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet testPathsStr = JSON.stringify (testPaths);\n\n\t\t\t\t\t\t\tHot.TesterAPI.tester.pageLoaded ({\n\t\t\t\t\t\t\t\t\ttesterName: Hot.CurrentPage.testerName,\n\t\t\t\t\t\t\t\t\ttesterMap: Hot.CurrentPage.testerMap,\n\t\t\t\t\t\t\t\t\tpageName: Hot.CurrentPage.name,\n\t\t\t\t\t\t\t\t\ttestElements: testElements,\n\t\t\t\t\t\t\t\t\ttestPaths: testPathsStr\n\t\t\t\t\t\t\t\t}).then (function (resp)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif (resp.error != null)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tif (resp.error !== "")\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error (resp.error);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tHotStaqWeb.HotStaq.isReadyForTesting = true;\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\tif ((document.readyState === "complete") || (document.readyState === "interactive"))\n\t\t\t\t\tfunc ();\n\t\t\t\telse\n\t\t\t\t\tdocument.addEventListener ("DOMContentLoaded", func);\n\t\t\t}\n\t\t}\n\t}\n\n\thotstaq_isDocumentReady ();\n\x3c/script>');
|
|
35
|
+
I.useOutput(w);J(y)}))})})}static displayContent(c,u,y=null){return h(this,void 0,void 0,function*(){return new Promise((A,J)=>{I.onReady(()=>h(this,void 0,void 0,function*(){null==y&&(y=new I);let k=yield I.processContent(y,c,u);I.useOutput(k);A(y)}))})})}}g.HotStaq=I;I.isWeb=!1;I.isReadyForTesting=!1;I.onReadyForTesting=null}).call(this,z(9))},function(C,g,z){var l=this&&this.__awaiter||function(f,b,d,p){return new (d||(d=Promise))(function(r,n){function v(H){try{E(p.next(H))}catch(K){n(K)}}function x(H){try{E(p.throw(H))}catch(K){n(K)}}
|
|
36
|
+
function E(H){var K;H.done?r(H.value):(K=H.value,K instanceof d?K:new d(function(M){M(K)})).then(v,x)}E((p=p.apply(f,b||[])).next())})},q=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(g,"__esModule",{value:!0});g.Hot=g.DeveloperMode=void 0;const t=z(5),e=z(0);C=z(6);const h=q(z(19)),m=q(z(2));!function(f){f[f.Production=0]="Production";f[f.Development=1]="Development"}(z=g.DeveloperMode||(g.DeveloperMode={}));class a{static include(f,b=null){return l(this,
|
|
37
|
+
void 0,void 0,function*(){if(!0===e.HotStaq.isWeb&&"string"==typeof f){const d=f.toLowerCase();-1<d.indexOf(".hott")&&0>d.indexOf("nahfam")&&(f+="?hpserve=nahfam")}a.echo(yield a.getFile(f,b))})}static runFile(f,b=null){return l(this,void 0,void 0,function*(){var d=a.CurrentPage.processor.getFile(f);d.page=this.CurrentPage;d=yield d.process(b);a.echo(d)})}static getFile(f,b=null){return l(this,void 0,void 0,function*(){let d=null;return"string"==typeof f?(d=new t.HotFile,!0===e.HotStaq.isWeb?d.url=
|
|
38
|
+
f:d.localFile=f):d=f,yield d.load(),d.page=this.CurrentPage,yield d.process(b)})}static apiCall(f,b=null,d="POST"){return l(this,void 0,void 0,function*(){let p=null;if(null==a.CurrentPage)throw Error("Current page is null!");if(null==a.CurrentPage.processor)throw Error("Current page's processor is null!");if(null==a.CurrentPage.processor.api)throw Error("Current page's processor api is null!");return null!=a.CurrentPage.processor.api&&(p=yield a.CurrentPage.processor.api.call(f,b,d)),p})}static jsonRequest(f,
|
|
39
|
+
b=null,d="POST"){return l(this,void 0,void 0,function*(){try{let p=yield(0,m.default)(f,{method:d,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(b)});if(!1===p.ok)throw Error(`${p.status}: ${p.statusText}`);return yield p.json()}catch(p){return JSON.stringify({error:`${p.message} - Could not fetch ${f}`})}})}static httpRequest(f,b){return l(this,void 0,void 0,function*(){return yield(0,m.default)(f,b)})}static echo(f){a.Output+=f}static displayCSS(){for(let f=
|
|
40
|
+
0;f<a.CSS.length;f++){let b=a.cssStr;b=b.replace(/%CSS_FILE%/g,a.CSS[f]);a.echo(b)}}static displayJSFiles(){for(let f=0;f<a.JSFiles.length;f++){let b=a.jsFileStr;b=b.replace(/%JS_FILE%/g,a.JSFiles[f]);a.echo(b)}}static displayJSScripts(){for(let f=0;f<a.JSScripts.length;f++){let b=a.jsScriptsStr;b=b.replace(/%JS_CODE%/g,a.JSScripts[f]);a.echo(b)}}}g.Hot=a;a.CurrentPage=null;a.Arguments=null;a.DeveloperMode=z;a.HotTestElement=C.HotTestElement;a.Mode=z.Production;a.API=null;a.TesterAPI=null;a.Output=
|
|
41
|
+
"";a.Data={};a.Cookies=h.default;a.PublicSecrets={};a.cssStr='<link rel = "stylesheet" href = "%CSS_FILE%" />';a.CSS=[];a.JSFiles=[];a.JSScripts=[];a.jsFileStr='<script type = "text/javascript" src = "%JS_FILE%">\x3c/script>';a.jsScriptsStr='<script type = "text/javascript">%JS_CODE%\x3c/script>'},function(C,g){var z="undefined"!=typeof self?self:this,l=function(){function q(){this.fetch=!1;this.DOMException=z.DOMException}return q.prototype=z,new q}();!function(q){!function(t){function e(k){if("string"!=
|
|
42
|
+
typeof k&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(k))throw new TypeError("Invalid character in header field name");return k.toLowerCase()}function h(k){return"string"!=typeof k&&(k=String(k)),k}function m(k){var w={next:function(){var D=k.shift();return{done:void 0===D,value:D}}};return K&&(w[Symbol.iterator]=function(){return w}),w}function a(k){this.map={};k instanceof a?k.forEach(function(w,D){this.append(D,w)},this):Array.isArray(k)?k.forEach(function(w){this.append(w[0],w[1])},this):k&&
|
|
43
|
+
Object.getOwnPropertyNames(k).forEach(function(w){this.append(w,k[w])},this)}function f(k){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}function b(k){return new Promise(function(w,D){k.onload=function(){w(k.result)};k.onerror=function(){D(k.error)}})}function d(k){var w=new FileReader,D=b(w);return w.readAsArrayBuffer(k),D}function p(k){if(k.slice)return k.slice(0);var w=new Uint8Array(k.byteLength);return w.set(new Uint8Array(k)),w.buffer}function r(){return this.bodyUsed=
|
|
44
|
+
!1,this._initBody=function(k){var w;(this._bodyInit=k)?"string"==typeof k?this._bodyText=k:P&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:I&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:H&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c&&P&&(w=k)&&DataView.prototype.isPrototypeOf(w)?(this._bodyArrayBuffer=p(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(k)||y(k))?this._bodyArrayBuffer=p(k):this._bodyText=
|
|
45
|
+
k=Object.prototype.toString.call(k):this._bodyText="";this.headers.get("content-type")||("string"==typeof k?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):H&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},P&&(this.blob=function(){var k=f(this);if(k)return k;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
|
46
|
+
if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var k,w,D,L=f(this);if(L)return L;if(this._bodyBlob)return k=this._bodyBlob,w=new FileReader,D=b(w),w.readAsText(k),D;if(this._bodyArrayBuffer){k=Promise;w=k.resolve;D=new Uint8Array(this._bodyArrayBuffer);L=Array(D.length);for(var G=
|
|
47
|
+
0;G<D.length;G++)L[G]=String.fromCharCode(D[G]);D=L.join("");return w.call(k,D)}if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},I&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}function n(k,w){var D,L,G=(w=w||{}).body;if(k instanceof n){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url;this.credentials=k.credentials;w.headers||(this.headers=new a(k.headers));
|
|
48
|
+
this.method=k.method;this.mode=k.mode;this.signal=k.signal;G||null==k._bodyInit||(G=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=w.credentials||this.credentials||"same-origin",!w.headers&&this.headers||(this.headers=new a(w.headers)),this.method=(D=w.method||this.method||"GET",L=D.toUpperCase(),-1<A.indexOf(L)?L:D),this.mode=w.mode||this.mode||null,this.signal=w.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&G)throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
49
|
+
this._initBody(G)}function v(k){var w=new FormData;return k.trim().split("&").forEach(function(D){if(D){var L=D.split("=");D=L.shift().replace(/\+/g," ");L=L.join("=").replace(/\+/g," ");w.append(decodeURIComponent(D),decodeURIComponent(L))}}),w}function x(k,w){w||(w={});this.type="default";this.status=void 0===w.status?200:w.status;this.ok=200<=this.status&&300>this.status;this.statusText="statusText"in w?w.statusText:"OK";this.headers=new a(w.headers);this.url=w.url||"";this._initBody(k)}function E(k,
|
|
50
|
+
w){return new Promise(function(D,L){function G(){F.abort()}var B=new n(k,w);if(B.signal&&B.signal.aborted)return L(new t.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;F.onload=function(){var N,O,T={status:F.status,statusText:F.statusText,headers:(N=F.getAllResponseHeaders()||"",O=new a,N.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(S){var R=S.split(":");if(S=R.shift().trim())R=R.join(":").trim(),O.append(S,R)}),O)};T.url="responseURL"in F?F.responseURL:T.headers.get("X-Request-URL");
|
|
51
|
+
D(new x("response"in F?F.response:F.responseText,T))};F.onerror=function(){L(new TypeError("Network request failed"))};F.ontimeout=function(){L(new TypeError("Network request failed"))};F.onabort=function(){L(new t.DOMException("Aborted","AbortError"))};F.open(B.method,B.url,!0);"include"===B.credentials?F.withCredentials=!0:"omit"===B.credentials&&(F.withCredentials=!1);"responseType"in F&&P&&(F.responseType="blob");B.headers.forEach(function(N,O){F.setRequestHeader(O,N)});B.signal&&(B.signal.addEventListener("abort",
|
|
52
|
+
G),F.onreadystatechange=function(){4===F.readyState&&B.signal.removeEventListener("abort",G)});F.send(void 0===B._bodyInit?null:B._bodyInit)})}var H="URLSearchParams"in q,K="Symbol"in q&&"iterator"in Symbol,M;if(M="FileReader"in q&&"Blob"in q)try{M=(new Blob,!0)}catch(k){M=!1}var P=M,I="FormData"in q,c="ArrayBuffer"in q;if(c)var u="[object Int8Array];[object Uint8Array];[object Uint8ClampedArray];[object Int16Array];[object Uint16Array];[object Int32Array];[object Uint32Array];[object Float32Array];[object Float64Array]".split(";"),
|
|
53
|
+
y=ArrayBuffer.isView||function(k){return k&&-1<u.indexOf(Object.prototype.toString.call(k))};a.prototype.append=function(k,w){k=e(k);w=h(w);var D=this.map[k];this.map[k]=D?D+", "+w:w};a.prototype.delete=function(k){delete this.map[e(k)]};a.prototype.get=function(k){return k=e(k),this.has(k)?this.map[k]:null};a.prototype.has=function(k){return this.map.hasOwnProperty(e(k))};a.prototype.set=function(k,w){this.map[e(k)]=h(w)};a.prototype.forEach=function(k,w){for(var D in this.map)this.map.hasOwnProperty(D)&&
|
|
54
|
+
k.call(w,this.map[D],D,this)};a.prototype.keys=function(){var k=[];return this.forEach(function(w,D){k.push(D)}),m(k)};a.prototype.values=function(){var k=[];return this.forEach(function(w){k.push(w)}),m(k)};a.prototype.entries=function(){var k=[];return this.forEach(function(w,D){k.push([D,w])}),m(k)};K&&(a.prototype[Symbol.iterator]=a.prototype.entries);var A="DELETE GET HEAD OPTIONS POST PUT".split(" ");n.prototype.clone=function(){return new n(this,{body:this._bodyInit})};r.call(n.prototype);
|
|
55
|
+
r.call(x.prototype);x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})};x.error=function(){var k=new x(null,{status:0,statusText:""});return k.type="error",k};var J=[301,302,303,307,308];x.redirect=function(k,w){if(-1===J.indexOf(w))throw new RangeError("Invalid status code");return new x(null,{status:w,headers:{location:k}})};t.DOMException=q.DOMException;try{new t.DOMException}catch(k){t.DOMException=
|
|
56
|
+
function(w,D){this.message=w;this.name=D;this.stack=Error(w).stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}E.polyfill=!0;q.fetch||(q.fetch=E,q.Headers=a,q.Request=n,q.Response=x);t.Headers=a;t.Request=n;t.Response=x;t.fetch=E;Object.defineProperty(t,"__esModule",{value:!0})}({})}(l);l.fetch.ponyfill=!0;delete l.fetch.polyfill;(g=l.fetch).default=l.fetch;g.fetch=l.fetch;g.Headers=l.Headers;g.Request=l.Request;g.Response=l.Response;
|
|
57
|
+
C.exports=g},function(C,g,z){var l=this&&this.__awaiter||function(e,h,m,a){return new (m||(m=Promise))(function(f,b){function d(n){try{r(a.next(n))}catch(v){b(v)}}function p(n){try{r(a.throw(n))}catch(v){b(v)}}function r(n){var v;n.done?f(n.value):(v=n.value,v instanceof m?v:new m(function(x){x(v)})).then(d,p)}r((a=a.apply(e,h||[])).next())})};Object.defineProperty(g,"__esModule",{value:!0});g.HotServer=g.HotServerType=void 0;const q=z(0);var t;!function(e){e[e.HTTP=0]="HTTP";e[e.WebSockets=1]="WebSockets"}(t=
|
|
58
|
+
g.HotServerType||(g.HotServerType={}));g.HotServer=class{constructor(e){e instanceof q.HotStaq?(this.processor=e,this.serverType="Server",this.api=null,this.listenAddress="0.0.0.0",this.ports={http:80,https:443},this.ssl={cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=!0,this.type=t.HTTP,this.logger=e.logger,this.secrets={}):(this.processor=e.processor,this.serverType=e.serverType||"Server",this.api=e.api||null,this.listenAddress=e.listenAddress||"0.0.0.0",this.ports=e.ports||{http:80,https:443},
|
|
59
|
+
this.ssl=e.ssl||{cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=null==e.redirectHTTPtoHTTPS||e.redirectHTTPtoHTTPS,this.type=e.type||t.HTTP,this.logger=e.logger,this.secrets=e.secrets||{})}setAPI(e){return l(this,void 0,void 0,function*(){this.api=this.processor.api=e})}}},function(C,g){},function(C,g,z){var l=this&&this.__createBinding||(Object.create?function(b,d,p,r){void 0===r&&(r=p);Object.defineProperty(b,r,{enumerable:!0,get:function(){return d[p]}})}:function(b,d,p,r){void 0===r&&(r=p);b[r]=
|
|
60
|
+
d[p]}),q=this&&this.__setModuleDefault||(Object.create?function(b,d){Object.defineProperty(b,"default",{enumerable:!0,value:d})}:function(b,d){b.default=d});C=this&&this.__importStar||function(b){if(b&&b.__esModule)return b;var d={};if(null!=b)for(var p in b)"default"!==p&&Object.prototype.hasOwnProperty.call(b,p)&&l(d,b,p);return q(d,b),d};var t=this&&this.__awaiter||function(b,d,p,r){return new (p||(p=Promise))(function(n,v){function x(K){try{H(r.next(K))}catch(M){v(M)}}function E(K){try{H(r.throw(K))}catch(M){v(M)}}
|
|
61
|
+
function H(K){var M;K.done?n(K.value):(M=K.value,M instanceof p?M:new p(function(P){P(M)})).then(x,E)}H((r=r.apply(b,d||[])).next())})},e=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(g,"__esModule",{value:!0});g.HotFile=void 0;const h=C(z(4)),m=e(z(2)),a=z(1);class f{constructor(b={}){this.page=b.page||null;this.name=b.name||"";this.url=b.url||"";this.localFile=b.localFile||"";this.content=b.content||"";this.throwAllErrors=b.throwAllErrors||!1}setContent(b){this.content=
|
|
62
|
+
b}getContent(){return this.content}static httpGet(b){return t(this,void 0,void 0,function*(){try{let d=yield(0,m.default)(b);if(!1===d.ok)throw Error(`${d.status}: ${d.statusText}`);return yield d.text()}catch(d){return JSON.stringify({error:`${d.message} - Could not fetch ${b}`})}})}loadUrl(){return t(this,void 0,void 0,function*(){return this.content=yield f.httpGet(this.url),this.content})}loadLocalFile(){return t(this,void 0,void 0,function*(){return new Promise((b,d)=>{h.readFile(this.localFile,
|
|
63
|
+
(p,r)=>{if(null!=p)throw p;this.content=r.toString();b(this.content)})})})}load(){return t(this,void 0,void 0,function*(){let b="";return""!==this.url&&(b=yield this.loadUrl()),""!==this.localFile&&(b=yield this.loadLocalFile()),b})}static processContent(b,d,p,r,n=2,v=2){let x=d.exec(b),E=0,H="";for(;null!=x;){let K=d.lastIndex+v,M=b.substr(E,x.index-n-E);E=K;H+=r(M);H+=p(x[0]);x=d.exec(b)}return H+=r(b.substr(E)),H}static processNestedContent(b,d,p,r,n,v,x=2,E=1){let H=b.indexOf(d),K=0;var M=b.indexOf(r,
|
|
64
|
+
H);let P="";for(;-1<H;){var I=b.indexOf(p,H);let c=0;if(""!==r){let u=b.lastIndexOf(r,I-E);for(;-1<u&&u!==M;)u=b.lastIndexOf(r,u-E),c++}if(0<c){for(I=M=b.indexOf(p,I+E);-1<M&&0<c&&!(0>I)&&!(b.lastIndexOf(d,I-E)>M);)M=I,I=b.indexOf(p,M+E),c--;I=M}P+=v(b.substr(K,H-K));P+=n(b.substr(H+x,I-(H+x)));H=b.indexOf(d,I+E);M=b.indexOf(r,H);K=I+E}return P+=v(b.substr(K)),P}process(b=null){return t(this,void 0,void 0,function*(){var d="";d=this.content;a.Hot.Mode=this.page.processor.mode;a.Hot.Arguments=b;a.Hot.CurrentPage=
|
|
65
|
+
this.page;a.Hot.PublicSecrets=this.page.processor.publicSecrets;a.Hot.API=this.page.getAPI();a.Hot.TesterAPI=this.page.getTesterAPI();d=f.processContent(d,RegExp("(?=\\<\\*)([\\s\\S]*?)(?=\\*\\>)","g"),n=>""+n.substr(2),n=>{if(""===n)return"";n=f.processNestedContent(n,"!{","}","{",x=>`*&&%*%@#@!${x}*&!#%@!@*!`,x=>x);n=f.processNestedContent(n,"STR{","}","{",x=>`*&&%*%@#@!echoOutput (JSON.stringify(${x}), ${this.throwAllErrors});*&!#%@!@*!`,x=>x,4,1);n=f.processNestedContent(n,"${","}","{",x=>{let E=
|
|
66
|
+
`*&&%*%@#@!try { Hot.echo (${x}); }catch (ex){Hot.echo ("");}*&!#%@!@*!`;return!0===this.throwAllErrors&&(E=`*&&%*%@#@!Hot.echo (${x});*&!#%@!@*!`),E},x=>x);let v="";a.Hot.Mode===a.DeveloperMode.Production&&(v=f.processNestedContent(n,"?(",")","(",x=>"",x=>x));a.Hot.Mode===a.DeveloperMode.Development&&(v=f.processNestedContent(n,"?(",")","(",x=>{let E="";try{JSON.parse(x),E=JSON.stringify(x)}catch(H){E=""+x}return`*&&%*%@#@!{\nconst testElm = createTestElement (${E});\nHot.echo (\`data-test-object-name = "\${testElm.name}" data-test-object-func = "\${testElm.func}" data-test-object-value = "\${testElm.value}"\`);\n}*&!#%@!@*!\n`},
|
|
67
|
+
x=>x));n=f.processNestedContent(v,"*&&%*%@#@!","*&!#%@!@*!","*&&%*%@#@!",x=>x,x=>`echoOutput (${JSON.stringify(x)}, ${this.throwAllErrors});\n`,10,10);return n=n.replace(/\*&&%\*%@#@!/g,""),n=n.replace(/\*&!#%@!@\*!/g,""),n},0);let p=null;try{let n="\n\t\t\tvar Hot = arguments[0];\n\t\t\tvar PassedHotFile = arguments[1];\n\n\t\t\t";if("string"==typeof b)throw Error("The passing arguments cannot be a string!");for(let v in b){let x="";x=`var ${v} = ${JSON.stringify(b[v])};\n`;n+=x}var r=this.name;
|
|
68
|
+
""===r&&(r=this.localFile);""===r&&(r=this.url);n+='\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';
|
|
69
|
+
n+=d;n+="\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}));";p=yield(new Function(n)).apply(this,[a.Hot,this])}catch(n){throw SyntaxError,n;}a.Hot.Data=p.hot.Data;r=p.output;return a.Hot.Output="",r})}}g.HotFile=f},function(C,g,z){Object.defineProperty(g,"__esModule",{value:!0});g.HotTestElement=g.HotTestElementOptions=void 0;g.HotTestElementOptions=
|
|
70
|
+
class{constructor(l={}){this.mustBeVisible=l.mustBeVisible||!0;this.ignoreMissingElementError=l.ignoreMissingElementError||!1}};g.HotTestElement=class{constructor(l,q="",t=null){"string"==typeof l?(this.name=l,this.func=q,this.value=t):(this.name=l.name,this.func=l.func||q,this.value=l.value||t)}}},function(C,g,z){Object.defineProperty(g,"__esModule",{value:!0});g.HotRoute=void 0;const l=z(8);class q{constructor(t,e,h=[]){this.onAuthorizeUser=this.onPostRegister=this.onRegister=this.onPreRegister=
|
|
71
|
+
null;this.connection=t;this.logger=null;null!=this.connection&&null!=this.connection.processor&&(this.logger=this.connection.processor.logger);this.route=e;this.version="v1";this.prefix="";this.authCredentials=null;this.methods=h;this.errors={not_authorized:q.createError("Not authorized.")}}static createError(t){return{error:t}}addMethod(t,e=null,h=l.HTTPMethod.POST,m=null){"string"==typeof t&&(t=new l.HotRouteMethod(this,t,e,h,null,null,null,m));this.methods.push(t)}getMethod(t){let e=null;for(let h=
|
|
72
|
+
0;h<this.methods.length;h++){let m=this.methods[h];if(m.name===t){e=m;break}}return e}}g.HotRoute=q},function(C,g,z){Object.defineProperty(g,"__esModule",{value:!0});g.HotRouteMethod=g.HTTPMethod=void 0;const l=z(1),q=z(3);var t;!function(e){e.GET="get";e.POST="post"}(t=g.HTTPMethod||(g.HTTPMethod={}));g.HotRouteMethod=class{constructor(e,h,m=null,a=t.POST,f=null,b=null,d=null,p=null){if(this.parentRoute=e,this.name=h,this.type=a,this.isRegistered=!1,this.executeSetup=!1,this.authCredentials=d,this.onServerAuthorize=
|
|
73
|
+
f,this.onRegister=b,this.testCases={},this.parentRoute.connection.processor.mode===l.DeveloperMode.Development&&null!=p)for(e=0;e<p.length;e++)h=p[e],"string"==typeof h?(this.addTestCase(h,p[e+1]),e++):this.addTestCase(h);this.parentRoute.connection instanceof q.HotServer&&(this.onServerExecute=m)}addTestCase(e,h=null){if("string"==typeof e)return void(this.testCases[e]={name:e,func:h});if("function"==typeof e)return h=Object.keys(this.testCases).length,h=`${this.parentRoute.route}/${this.name} test case ${h}`,
|
|
74
|
+
void(this.testCases[h]={name:h,func:e});this.testCases[e.name]=e}}},function(C,g){function z(){throw Error("setTimeout has not been defined");}function l(){throw Error("clearTimeout has not been defined");}function q(n){if(a===setTimeout)return setTimeout(n,0);if((a===z||!a)&&setTimeout)return a=setTimeout,setTimeout(n,0);try{return a(n,0)}catch(v){try{return a.call(null,n,0)}catch(x){return a.call(this,n,0)}}}function t(){p&&b&&(p=!1,b.length?d=b.concat(d):r=-1,d.length&&e())}function e(){if(!p){var n=
|
|
75
|
+
q(t);p=!0;for(var v=d.length;v;){b=d;for(d=[];++r<v;)b&&b[r].run();r=-1;v=d.length}b=null;p=!1;(function(x){if(f===clearTimeout)return clearTimeout(x);if((f===l||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(x);try{f(x)}catch(E){try{return f.call(null,x)}catch(H){return f.call(this,x)}}})(n)}}function h(n,v){this.fun=n;this.array=v}function m(){}C=C.exports={};try{var a="function"==typeof setTimeout?setTimeout:z}catch(n){a=z}try{var f="function"==typeof clearTimeout?clearTimeout:l}catch(n){f=
|
|
76
|
+
l}!0;var b,d=[],p=!1,r=-1;C.nextTick=function(n){var v=Array(arguments.length-1);if(1<arguments.length)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];d.push(new h(n,v));1!==d.length||p||q(e)};h.prototype.run=function(){this.fun.apply(null,this.array)};C.title="browser";C.browser=!0;C.env={};C.argv=[];C.version="";C.versions={};C.on=m;C.addListener=m;C.once=m;C.off=m;C.removeListener=m;C.removeAllListeners=m;C.emit=m;C.prependListener=m;C.prependOnceListener=m;C.listeners=function(n){return[]};
|
|
77
|
+
C.binding=function(n){throw Error("process.binding is not supported");};C.cwd=function(){return"/"};C.chdir=function(n){throw Error("process.chdir is not supported");};C.umask=function(){return 0}},function(C,g,z){var l=this&&this.__awaiter||function(e,h,m,a){return new (m||(m=Promise))(function(f,b){function d(n){try{r(a.next(n))}catch(v){b(v)}}function p(n){try{r(a.throw(n))}catch(v){b(v)}}function r(n){var v;n.done?f(n.value):(v=n.value,v instanceof m?v:new m(function(x){x(v)})).then(d,p)}r((a=
|
|
78
|
+
a.apply(e,h||[])).next())})};Object.defineProperty(g,"__esModule",{value:!0});g.HotPage=void 0;const q=z(1),t=z(0);g.HotPage=class{constructor(e){e instanceof t.HotStaq?(this.processor=e,this.name="",this.testerName="",this.testerMap="",this.route="",this.files=[],this.testElements={},this.testPaths={}):(this.processor=e.processor,this.name=e.name||"",this.testerName=e.testerName||"",this.testerMap=e.testerMap||"",this.route=e.route||"",this.files=e.files||[],this.testElements=e.testElements||{},
|
|
79
|
+
this.testPaths=e.testPaths||{})}addFile(e){return l(this,void 0,void 0,function*(){e.page=this;this.files.push(e)})}getAPI(){return this.processor.api}getTesterAPI(){return this.processor.testerAPI}load(e){return l(this,void 0,void 0,function*(){for(let h=0;h<this.files.length;h++)yield this.files[h].load()})}process(e=null){return l(this,void 0,void 0,function*(){let h="";for(let m=0;m<this.files.length;m++){let a=this.files[m];q.Hot.Output="";a.page=this;h+=yield a.process(e)}return h})}addTestElement(e){if(null!=
|
|
80
|
+
this.testElements[e.name])throw Error(`Test element ${e.name} already exists!`);this.testElements[e.name]=e}getTestElement(e){if(null==this.testElements[e])throw Error(`Test element ${e} doest not exist!`);return this.testElements[e]}createTestPath(e,h){if(null!=this.testPaths[e])throw Error(`Test path ${e} already exists!`);this.testPaths[e]=h}}},function(C,g,z){var l;Object.defineProperty(g,"__esModule",{value:!0});g.HotLog=g.HotLogLevel=void 0;(function(q){q[q.Info=0]="Info";q[q.Warning=1]="Warning";
|
|
81
|
+
q[q.Error=2]="Error";q[q.Verbose=3]="Verbose";q[q.All=4]="All";q[q.None=5]="None"})(l=g.HotLogLevel||(g.HotLogLevel={}));g.HotLog=class{constructor(q=l.All){this.logLevel=q}log(q,t){this.logLevel===l.Verbose&&(q===l.Error&&this.error(t),q===l.Warning&&this.warning(t),q!==l.Info&&q!==l.Verbose||this.info(t));this.logLevel===l.All&&(q===l.Error&&this.error(t),q===l.Warning&&this.warning(t),q===l.Info&&this.info(t));this.logLevel===l.Error&&q===l.Error&&this.error(t);this.logLevel===l.Warning&&q===l.Warning&&
|
|
82
|
+
this.warning(t);this.logLevel===l.Info&&q===l.Info&&this.info(t)}verbose(q){this.logLevel===l.Verbose&&console.info(q)}info(q){this.logLevel!==l.All&&this.logLevel!==l.Verbose&&this.logLevel!==l.Info||console.info(q)}warning(q){this.logLevel!==l.All&&this.logLevel!==l.Verbose&&this.logLevel!==l.Warning||console.warn(q)}error(q){if(this.logLevel===l.All||this.logLevel===l.Verbose||this.logLevel===l.Error){let t="";"string"==typeof q?t=q:(null!=q.message&&(t=q.message),null!=q.stack&&(t=q.stack));console.error(t)}}}},
|
|
83
|
+
function(C,g,z){Object.defineProperty(g,"__esModule",{value:!0});g.HotClient=void 0;const l=z(3);g.HotClient=class{constructor(q){this.processor=q;this.testerAPI=this.api=null;this.type=l.HotServerType.HTTP;this.logger=q.logger}}},function(C,g,z){var l=this&&this.__awaiter||function(h,m,a,f){return new (a||(a=Promise))(function(b,d){function p(v){try{n(f.next(v))}catch(x){d(x)}}function r(v){try{n(f.throw(v))}catch(x){d(x)}}function n(v){var x;v.done?b(v.value):(x=v.value,x instanceof a?x:new a(function(E){E(x)})).then(p,
|
|
84
|
+
r)}n((f=f.apply(h,m||[])).next())})};Object.defineProperty(g,"__esModule",{value:!0});g.HotTesterAPI=void 0;const q=z(14),t=z(7);class e extends q.HotAPI{constructor(h,m=null,a=null){super(h,m,a);this.executeEventsUsing=q.EventExecutionType.HotAPI;h=new t.HotRoute(m,"tester");h.addMethod("pageLoaded",this.pageLoaded);h.addMethod("executeTests",this.executeTests);this.addRoute(h)}pageLoaded(h,m,a,f,b){return l(this,void 0,void 0,function*(){let d={testerName:f.testerName,testerMap:f.testerMap,pageName:f.pageName,
|
|
85
|
+
testElements:f.testElements,testPathsStrs:f.testPaths};for(var p in d){var r=!1;if(null==d[p]&&(r=!0),""!=d.testerName&&""!==d.testerMap&&""!==d.testElements&&""!==d.testPathsStrs||(r=!0),!0===r)throw Error(`TesterAPI: Object ${p} was not passed.`);}d.testElements=JSON.parse(d.testElements);d.testPathsStrs=JSON.parse(d.testPathsStrs);p={};for(var n in d.testPathsStrs)r=eval(d.testPathsStrs[n]),p[n]=r;n=this.connection.processor.testers[d.testerName];if(null==n)throw Error(`TesterAPI: Tester ${d.testerMap} does not exist!`);
|
|
86
|
+
r=n.testMaps[d.testerMap];if(null==r)throw Error(`TesterAPI: Tester map ${d.testerMap} does not exist!`);return r.pages[d.pageName]={testElements:{},testPaths:{}},r.pages[d.pageName].testElements=d.testElements,r.pages[d.pageName].testPaths=p,n.finishedLoading=!0,null!=n.onFinishedLoading&&(yield n.onFinishedLoading()),!0})}executeTests(h,m,a,f,b){return l(this,void 0,void 0,function*(){let d=f.testerName,p=f.testerMap;if(null==d||null==p)throw Error("TesterAPI: Not all required json objects were passed.");
|
|
87
|
+
if(""===d||""===p)throw Error("TesterAPI: Not all required json objects were passed.");let r=this.connection;return null!=r.executeTests&&(yield r.executeTests(d,p)),!0})}}g.HotTesterAPI=e},function(C,g,z){var l=this&&this.__awaiter||function(a,f,b,d){return new (b||(b=Promise))(function(p,r){function n(E){try{x(d.next(E))}catch(H){r(H)}}function v(E){try{x(d.throw(E))}catch(H){r(H)}}function x(E){var H;E.done?p(E.value):(H=E.value,H instanceof b?H:new b(function(K){K(H)})).then(n,v)}x((d=d.apply(a,
|
|
88
|
+
f||[])).next())})};C=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(g,"__esModule",{value:!0});g.HotAPI=g.EventExecutionType=void 0;const q=C(z(2)),t=z(3),e=z(7),h=z(8);var m;!function(a){a[a.HotRoute=0]="HotRoute";a[a.HotMethod=1]="HotMethod";a[a.HotAPI=2]="HotAPI"}(m=g.EventExecutionType||(g.EventExecutionType={}));g.HotAPI=class{constructor(a,f=null,b=null){this.connection=f;this.baseUrl=a;this.createFunctions=!0;this.executeEventsUsing=m.HotRoute;
|
|
89
|
+
this.db=b;this.userAuth=this.authCredentials=null;this.routes={};this.onPostRegister=this.onPreRegister=null}setDBSchema(a){if(null==this.connection.api)throw Error("No API has been set!");if(null==this.connection.api.db)throw Error("No database has been set for API base url "+this.connection.api.baseUrl);this.connection.api.db.schema=a}getDB(){if(null==this.connection.api.db)throw Error("No database has been set for API base url "+this.connection.api.baseUrl);return this.connection.api.db}getDBSchema(){if(null==
|
|
90
|
+
this.connection.api.db)throw Error("No database has been set for API base url "+this.connection.api.baseUrl);return this.connection.api.db.schema}addRoute(a,f=null,b=null){let d="";if(a instanceof e.HotRoute?(d=a.route,this.routes[a.route]=a):(d=a,null==this.routes[d]&&(this.routes[d]=new e.HotRoute(this.connection,d)),f instanceof h.HotRouteMethod?this.routes[d].addMethod(f):this.routes[d].addMethod(new h.HotRouteMethod(this.routes[d],f,b))),this.routes[d].connection=this.connection,!0===this.createFunctions){a=
|
|
91
|
+
this[d];null==a&&(a={});for(f=0;f<this.routes[d].methods.length;f++){let p=this.routes[d],r=this.routes[d].methods[f];a[r.name]=n=>{let v=r.type,x="";""!==p.version&&(x+="/"+p.version);""!==p.route&&(x+="/"+p.route);""!==r.name&&(x+="/"+r.name);let E=null;if(null!=this.authCredentials&&(E=this.authCredentials),null!=r.authCredentials?E=r.authCredentials:null!=r.parentRoute.authCredentials&&(E=r.parentRoute.authCredentials),null==E&&"undefined"!=typeof Hot&&null!=Hot&&null!=Hot.API&&null!=Hot.API[p.route]&&
|
|
92
|
+
null!=Hot.API[p.route].authCredentials&&(E=Hot.API[p.route].authCredentials),null!=E)for(let H in E){let K=E[H];null==n[H]&&(n[H]=K)}return this.call.apply(this,[x,n,v])}}this[d]=a}}registerRoute(a){return l(this,void 0,void 0,function*(){this.connection instanceof t.HotServer&&(yield this.connection.registerRoute(a))})}registerRoutes(){return l(this,void 0,void 0,function*(){for(let a in this.routes)yield this.registerRoute(this.routes[a])})}call(a,f,b="POST"){return l(this,void 0,void 0,function*(){let d=
|
|
93
|
+
this.baseUrl;"/"===d[d.length-1]&&(d=d.substr(0,d.length-1));"/"!==a[0]&&(d+="/");d+=a;let p={method:b=b.toUpperCase(),headers:{Accept:"application/json","Content-Type":"application/json"}};"GET"!==b&&"HEAD"!==b&&(p.body=JSON.stringify(f));let r=null;try{r=yield(0,q.default)(d,p)}catch(n){throw n;}return yield r.json()})}}},function(C,g,z){Object.defineProperty(g,"__esModule",{value:!0});g.HotTestMap=g.HotTestDestination=void 0;class l{constructor(q="",t=!0){"string"==typeof q?(this.destination=q,
|
|
94
|
+
this.autoStart=t):q instanceof l?(this.destination=q.destination,this.autoStart=q.autoStart):(this.destination=q.path,this.autoStart=q.autoStart)}}g.HotTestDestination=l;g.HotTestMap=class{constructor(q=[],t={},e=[]){if(q instanceof Array){this.destinations=[];for(var h=0;h<q.length;h++)this.destinations.push(new l(q[h]))}else for(h in this.destinations={},q)this.destinations[h]=new l(q[h]);this.destinationOrder=e;this.pages=t}}},function(C,g,z){Object.defineProperty(g,"__esModule",{value:!0});g.HotTestDriver=
|
|
95
|
+
g.IHotTestElementOptions=g.HotTestElementOptions=g.IHotTestElement=g.HotTestElement=g.HotTestPage=g.HotTestPath=g.HotTestDestination=g.HotTestMap=g.HotTesterAPI=g.HotTester=g.HotClient=g.HotServer=g.ServerExecutionFunction=g.ServerAuthorizationFunction=g.HTTPMethod=g.HotRouteMethod=g.HotRoute=g.HotPage=g.HotLog=g.HotFile=g.EventExecutionType=g.HotAPI=g.IHotComponent=g.HotComponent=g.DeveloperMode=g.Hot=g.HotSiteMapPath=g.HotSiteRoute=g.HotSite=g.IHotStaq=g.HotStartOptions=g.HotStaq=void 0;const l=
|
|
96
|
+
z(0);Object.defineProperty(g,"HotStaq",{enumerable:!0,get:function(){return l.HotStaq}});Object.defineProperty(g,"IHotStaq",{enumerable:!0,get:function(){return l.IHotStaq}});Object.defineProperty(g,"HotStartOptions",{enumerable:!0,get:function(){return l.HotStartOptions}});Object.defineProperty(g,"HotSite",{enumerable:!0,get:function(){return l.HotSite}});Object.defineProperty(g,"HotSiteRoute",{enumerable:!0,get:function(){return l.HotSiteRoute}});Object.defineProperty(g,"HotSiteMapPath",{enumerable:!0,
|
|
97
|
+
get:function(){return l.HotSiteMapPath}});const q=z(1);Object.defineProperty(g,"Hot",{enumerable:!0,get:function(){return q.Hot}});Object.defineProperty(g,"DeveloperMode",{enumerable:!0,get:function(){return q.DeveloperMode}});const t=z(20);Object.defineProperty(g,"HotComponent",{enumerable:!0,get:function(){return t.HotComponent}});Object.defineProperty(g,"IHotComponent",{enumerable:!0,get:function(){return t.IHotComponent}});const e=z(5);Object.defineProperty(g,"HotFile",{enumerable:!0,get:function(){return e.HotFile}});
|
|
98
|
+
const h=z(11);Object.defineProperty(g,"HotLog",{enumerable:!0,get:function(){return h.HotLog}});const m=z(10);Object.defineProperty(g,"HotPage",{enumerable:!0,get:function(){return m.HotPage}});const a=z(7);Object.defineProperty(g,"HotRoute",{enumerable:!0,get:function(){return a.HotRoute}});const f=z(14);Object.defineProperty(g,"HotAPI",{enumerable:!0,get:function(){return f.HotAPI}});Object.defineProperty(g,"EventExecutionType",{enumerable:!0,get:function(){return f.EventExecutionType}});const b=
|
|
99
|
+
z(8);Object.defineProperty(g,"HotRouteMethod",{enumerable:!0,get:function(){return b.HotRouteMethod}});Object.defineProperty(g,"HTTPMethod",{enumerable:!0,get:function(){return b.HTTPMethod}});Object.defineProperty(g,"ServerAuthorizationFunction",{enumerable:!0,get:function(){return b.ServerAuthorizationFunction}});Object.defineProperty(g,"ServerExecutionFunction",{enumerable:!0,get:function(){return b.ServerExecutionFunction}});const d=z(3);Object.defineProperty(g,"HotServer",{enumerable:!0,get:function(){return d.HotServer}});
|
|
100
|
+
const p=z(12);Object.defineProperty(g,"HotClient",{enumerable:!0,get:function(){return p.HotClient}});const r=z(21);Object.defineProperty(g,"HotTester",{enumerable:!0,get:function(){return r.HotTester}});const n=z(13);Object.defineProperty(g,"HotTesterAPI",{enumerable:!0,get:function(){return n.HotTesterAPI}});const v=z(15);Object.defineProperty(g,"HotTestMap",{enumerable:!0,get:function(){return v.HotTestMap}});Object.defineProperty(g,"HotTestDestination",{enumerable:!0,get:function(){return v.HotTestDestination}});
|
|
101
|
+
Object.defineProperty(g,"HotTestPath",{enumerable:!0,get:function(){return v.HotTestPath}});Object.defineProperty(g,"HotTestPage",{enumerable:!0,get:function(){return v.HotTestPage}});const x=z(6);Object.defineProperty(g,"IHotTestElement",{enumerable:!0,get:function(){return x.IHotTestElement}});Object.defineProperty(g,"HotTestElement",{enumerable:!0,get:function(){return x.HotTestElement}});Object.defineProperty(g,"HotTestElementOptions",{enumerable:!0,get:function(){return x.HotTestElementOptions}});
|
|
102
|
+
Object.defineProperty(g,"IHotTestElementOptions",{enumerable:!0,get:function(){return x.IHotTestElementOptions}});const E=z(22);Object.defineProperty(g,"HotTestDriver",{enumerable:!0,get:function(){return E.HotTestDriver}});l.HotStaq.isWeb=!0},function(C,g,z){var l=RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),q=z(18),t=["node_modules","favicon.ico"];(C.exports=function(h){var m=[],a=[];if(null===h)return a.push("name cannot be null"),e(m,a);if(void 0===h)return a.push("name cannot be undefined"),e(m,a);
|
|
103
|
+
if("string"!=typeof h)return a.push("name must be a string"),e(m,a);if(h.length||a.push("name length must be greater than zero"),h.match(/^\./)&&a.push("name cannot start with a period"),h.match(/^_/)&&a.push("name cannot start with an underscore"),h.trim()!==h&&a.push("name cannot contain leading or trailing spaces"),t.forEach(function(d){h.toLowerCase()===d&&a.push(d+" is a blacklisted name")}),q.forEach(function(d){h.toLowerCase()===d&&m.push(d+" is a core module name")}),214<h.length&&m.push("name can no longer contain more than 214 characters"),
|
|
104
|
+
h.toLowerCase()!==h&&m.push("name can no longer contain capital letters"),/[~'!()*]/.test(h.split("/").slice(-1)[0])&&m.push('name can no longer contain special characters ("~\'!()*")'),encodeURIComponent(h)!==h){var f=h.match(l);if(f){var b=f[1];f=f[2];if(encodeURIComponent(b)===b&&encodeURIComponent(f)===f)return e(m,a)}a.push("name can only contain URL-friendly characters")}return e(m,a)}).scopedPackagePattern=l;var e=function(h,m){h={validForNewPackages:0===m.length&&0===h.length,validForOldPackages:0===
|
|
105
|
+
m.length,warnings:h,errors:m};return h.warnings.length||delete h.warnings,h.errors.length||delete h.errors,h}},function(C){C.exports=JSON.parse('["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"]')},function(C,g,z){C.exports=function(){function l(q){for(var t=1;t<arguments.length;t++){var e=
|
|
106
|
+
arguments[t],h;for(h in e)q[h]=e[h]}return q}return function h(t,e){function m(a,f,b){if("undefined"!=typeof document){"number"==typeof(b=l({},e,b)).expires&&(b.expires=new Date(Date.now()+864E5*b.expires));b.expires&&(b.expires=b.expires.toUTCString());a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="",p;for(p in b)b[p]&&(d+="; "+p,!0!==b[p]&&(d+="="+b[p].split(";")[0]));return document.cookie=a+"="+t.write(f,a)+d}}return Object.create({set:m,
|
|
107
|
+
get:function(a){if("undefined"!=typeof document&&(!arguments.length||a)){for(var f=document.cookie?document.cookie.split("; "):[],b={},d=0;d<f.length;d++){var p=f[d].split("="),r=p.slice(1).join("=");try{var n=decodeURIComponent(p[0]);if(b[n]=t.read(r,n),a===n)break}catch(v){}}return a?b[a]:b}},remove:function(a,f){m(a,"",l({},f,{expires:-1}))},withAttributes:function(a){return h(this.converter,l({},this.attributes,a))},withConverter:function(a){return h(l({},this.converter,a),this.attributes)}},
|
|
108
|
+
{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}({read:function(t){return'"'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}()},function(C,g,z){var l=this&&this.__awaiter||function(t,e,h,m){return new (h||(h=Promise))(function(a,f){function b(r){try{p(m.next(r))}catch(n){f(n)}}function d(r){try{p(m.throw(r))}catch(n){f(n)}}
|
|
109
|
+
function p(r){var n;r.done?a(r.value):(n=r.value,n instanceof h?n:new h(function(v){v(n)})).then(b,d)}p((m=m.apply(t,e||[])).next())})};Object.defineProperty(g,"__esModule",{value:!0});g.HotComponent=void 0;const q=z(0);g.HotComponent=class{constructor(t,e=null){t instanceof q.HotStaq?(this.processor=t,this.htmlElement=null,this.name="",this.tag="",this.api=null,this.elementOptions=void 0,this.type="",this.value=null,this.events={}):(this.processor=t.processor,this.htmlElement=t.htmlElement||null,
|
|
110
|
+
this.name=t.name||"",this.tag=t.tag||this.name,this.api=t.api||null,this.elementOptions=t.elementOptions||void 0,this.type=t.type||"",this.value=t.value||null,this.events={});null!=e&&(this.api=e)}onCreated(t){return l(this,void 0,void 0,function*(){return t})}}},function(C,g,z){var l=this&&this.__awaiter||function(e,h,m,a){return new (m||(m=Promise))(function(f,b){function d(n){try{r(a.next(n))}catch(v){b(v)}}function p(n){try{r(a.throw(n))}catch(v){b(v)}}function r(n){var v;n.done?f(n.value):(v=
|
|
111
|
+
n.value,v instanceof m?v:new m(function(x){x(v)})).then(d,p)}r((a=a.apply(e,h||[])).next())})};Object.defineProperty(g,"__esModule",{value:!0});g.HotTester=void 0;const q=z(0);class t{constructor(e,h,m,a,f={}){this.processor=e;this.name=h;this.baseUrl=m;this.testMaps=f;this.driver=a;this.hasBeenDestroyed=this.hasBeenSetup=this.finishedLoading=!1}waitForData(){return l(this,void 0,void 0,function*(){for(;!1===this.finishedLoading;)yield q.HotStaq.wait(10)})}getTestPage(e){return this.testMaps[e.mapName].pages[e.page]}getTestPath(e,
|
|
112
|
+
h){return this.testMaps[e.mapName].pages[e.page].testPaths[h]}static interpretDestination(e,h){e={mapName:e,page:"",api:"",paths:[]};h=h.destination.split(/\->/g);var m=h[0];let a=(f,b)=>{let d=f.indexOf(b),p="";return-1<d&&(p=f.substr(d+b.length),p=p.trim()),p};e.page=a(m,"page:");e.api=a(m,"api:");for(m=1;m<h.length;m++){let f=h[m],b={cmd:"",dest:"",path:""};f=f.trim();b.dest=a(f,"dest:");b.cmd=a(f,"cmd:");b.path=a(f,"path:");""==b.dest&&""==b.cmd&&""==b.path&&(b.path=f);e.paths.push(b)}return e}executeTestAPIPath(e,
|
|
113
|
+
h,m,a=!1,f=!1){return l(this,void 0,void 0,function*(){var b=!0;!1===a&&null!=this.onTestAPIPathStart&&(b=yield this.onTestAPIPathStart(e,h,m,f));let d=null;if(!0===b){b=h.testCases[m];if(null==b)throw Error(`HotTester: Test case object ${m} does not exist!`);d=yield b.func(this.driver)}return!1===a&&null!=this.onTestAPIPathEnd&&(yield this.onTestAPIPathEnd(e,h,m,d,f)),d})}executeTestAPIPaths(e){return l(this,void 0,void 0,function*(){let h=[];if(null==this.testMaps[e.mapName])throw Error(`HotTester: Map ${e.mapName} does not exist!`);
|
|
114
|
+
if(null==this.processor.api)throw Error("HotTester: Associated processor does not have an API!");let m=this.processor.api.routes[e.api];if(null==m)throw Error(`HotTester: API does not have route ${e.api}!`);for(let f=0;f<e.paths.length;f+=2){var a=m.getMethod(e.paths[f].path);a=yield this.executeTestAPIPath(e,a,e.paths[f+1].path);h.push(a)}return h})}executeTestPagePath(e,h,m=!1,a=!1){return l(this,void 0,void 0,function*(){let f=!0;var b=this.testMaps[e.mapName];if(null==b)throw Error(`HotTester: Map ${e.mapName} does not exist!`);
|
|
115
|
+
var d=b.pages[e.page];if(null==d)throw Error(`HotTester: Page ${e.page} does not exist!`);this.driver.page=d;b=h.path;let p=d.testPaths[b];!1===m&&null!=this.onTestPagePathStart&&(f=yield this.onTestPagePathStart(e,d,h,a));d=null;if(!0===f){if(null==p)throw Error(`HotTester: Test path ${b} does not have a function!`);d=yield p(this.driver)}return!1===m&&null!=this.onTestPagePathEnd&&(yield this.onTestPagePathEnd(e,p,d,a)),d})}executeCommand(e,h,m,a){return l(this,void 0,void 0,function*(){let f=(r,
|
|
116
|
+
n,v)=>{r=!1;m.cmd===n&&(r=!0);v=m.cmd.indexOf("(");-1<v&&m.cmd.substr(0,v)===n&&(r=!0);return r},b=r=>{let n=[];var v=r.match(/(?=\()(.*?)(?=\))/g);null!=v&&(v=v[0],v=v.substr(2,v.length),n.push(v));if(1>n.length)throw Error(`HotTester: Command ${r} requires arguments, but none were supplied.`);return n},d=null,p=[];if(!0===f(m.cmd,"waitForTesterAPIData")&&(d=r=>l(this,void 0,void 0,function*(){this.finishedLoading=!1;yield this.waitForData()})),!0===f(m.cmd,"wait")&&(p=b(m.cmd),d=r=>l(this,void 0,
|
|
117
|
+
void 0,function*(){let n=parseInt(r[0]);yield q.HotStaq.wait(n)})),!0===f(m.cmd,"url")&&(p=b(m.cmd),d=r=>l(this,void 0,void 0,function*(){yield this.driver.navigateToUrl(r[0])})),!0===f(m.cmd,"print")&&(p=b(m.cmd),d=r=>l(this,void 0,void 0,function*(){yield this.driver.print(r[0])})),!0===f(m.cmd,"println")&&(p=b(m.cmd),d=r=>l(this,void 0,void 0,function*(){yield this.driver.println(r[0])})),!0===f(m.cmd,"waitForTestObject")&&(p=b(m.cmd),d=r=>l(this,void 0,void 0,function*(){let n=JSON.parse(r[0]);
|
|
118
|
+
yield this.driver.waitForTestElement(n)})),null==d)throw Error(`HotTester: Command ${m.cmd} does not exist!`);yield this.onCommand(e,h,m,a,p,d)})}executeTestPagePaths(e,h=!1){return l(this,void 0,void 0,function*(){let m=[],a=this.testMaps[e.mapName];if(null==a)throw Error(`HotTester: Map ${e.mapName} does not exist!`);for(let b=0;b<e.paths.length;b++){let d=e.paths[b];var f=null;let p=a.pages[e.page];if(null==p)throw Error(`HotTester: Page ${e.page} does not exist!`);if(""!==d.dest){if(a.destinations instanceof
|
|
119
|
+
Array)throw Error(`HotTester: When using type 'dest' in a destination string, all destinations in map ${e.mapName} must be named.`);f=t.interpretDestination(e.mapName,a.destinations[d.dest]);f=yield this.executeTestPagePaths(f)}""!==d.cmd&&(yield this.executeCommand(e,p,d,d.cmd));""!==d.path&&(f=yield this.executeTestPagePath(e,d,!1,h));m.push(f)}return m})}execute(e){return l(this,void 0,void 0,function*(){let h=this.testMaps[e];if(null==h)throw Error(`HotTester: Map ${e} does not exist!`);var m=
|
|
120
|
+
this.processor.getRouteKeyFromName(e);let a="";""!==m&&(a=`${this.baseUrl}${m}`);m=(r,n="")=>l(this,void 0,void 0,function*(){if(!1!==r.autoStart){var v=t.interpretDestination(e,r),x=!1,E=!0;""!==v.page&&(x=!0);null!=this.setup&&!1===this.hasBeenSetup&&(yield this.setup(x,a,n),this.hasBeenSetup=!0,this.hasBeenDestroyed=!1);null!=this.onTestStart&&(E=yield this.onTestStart(v,a,n));!0===E&&(""!==v.page&&(yield this.executeTestPagePaths(v)),""!==v.api&&(yield this.executeTestAPIPaths(v)));null!=this.onTestEnd&&
|
|
121
|
+
(yield this.onTestEnd(v));null!=this.destroy&&!1===this.hasBeenDestroyed&&(yield this.destroy(),this.hasBeenDestroyed=!0,this.hasBeenSetup=!1)}});if(h.destinations instanceof Array)for(var f=0;f<h.destinations.length;f++)yield m(h.destinations[f]);else if(0<h.destinationOrder.length){var b=[];for(var d=0;d<h.destinationOrder.length;d++){var p=h.destinationOrder[d];let r=h.destinations[p];if(null==r)throw Error(`HotTester: Destination ${p} does not exist!`);b.push(p);yield m(r,p)}for(f in h.destinations){d=
|
|
122
|
+
!0;for(p=0;p<b.length;p++)if(b[p]===f){d=!1;break}!0===d&&(yield m(h.destinations[f],f))}}else for(b in h.destinations)yield m(h.destinations[b],b)})}}g.HotTester=t},function(C,g,z){(function(l){var q=this&&this.__awaiter||function(e,h,m,a){return new (m||(m=Promise))(function(f,b){function d(n){try{r(a.next(n))}catch(v){b(v)}}function p(n){try{r(a.throw(n))}catch(v){b(v)}}function r(n){var v;n.done?f(n.value):(v=n.value,v instanceof m?v:new m(function(x){x(v)})).then(d,p)}r((a=a.apply(e,h||[])).next())})};
|
|
123
|
+
Object.defineProperty(g,"__esModule",{value:!0});g.HotTestDriver=void 0;const t=z(6);g.HotTestDriver=class{constructor(e=null){this.page=e}parseTestObject(e){let h=e.indexOf("*");var m="";-1<h&&(e=e.replace(/\*/,""),m="*");m=`[data-test-object-name${m}='${e}']`;return h=e.indexOf(">"),-1<h&&(m=e.replace(/>/,"")),m}wait(e){return q(this,void 0,void 0,function*(){return yield new Promise((h,m)=>{setTimeout(()=>{h()},e)})})}print(e){return q(this,void 0,void 0,function*(){l.stdout.write(e)})}println(e){return q(this,
|
|
124
|
+
void 0,void 0,function*(){yield this.print(e+"\n")})}assert(e,h=""){return q(this,void 0,void 0,function*(){if(!e)throw Error(h);})}run(e){return q(this,void 0,void 0,function*(){let h=[];for(let m=0;m<e.length;m++){let a=e[m],f=null,b="",d="";if("string"==typeof a){if(f=this.page.testElements[a],null==f)throw Error("HotTestDriver: Unable to find test element "+a);b=f.func;d=f.value}if(a instanceof Array){let p=a[0];f=this.page.testElements[p];null==f?(f=new t.HotTestElement(p),b=a[1],d=a[2]):(b=
|
|
125
|
+
f.func,d=f.value,1<a.length&&(b=a[1]),2<a.length&&(d=a[2]))}f.func=b;f.value=d;h.push(yield this.runCommand(f))}return h})}}}).call(this,z(9))}])});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
FROM node:lts-alpine3.14 AS builder
|
|
2
|
+
|
|
3
|
+
# Install build dependencies
|
|
4
|
+
RUN apk update && \
|
|
5
|
+
apk add git && \
|
|
6
|
+
npm install -g typescript hotstaq && \
|
|
7
|
+
mkdir -p /tmp/app/${HOTSITE_NAME} && \
|
|
8
|
+
mkdir -p /app/${HOTSITE_NAME}
|
|
9
|
+
|
|
10
|
+
COPY ./ /tmp/app/${HOTSITE_NAME}
|
|
11
|
+
|
|
12
|
+
RUN cd /tmp/app/${HOTSITE_NAME} && \
|
|
13
|
+
npm install && \
|
|
14
|
+
npm run build && \
|
|
15
|
+
npm run build-web
|
|
16
|
+
|
|
17
|
+
FROM node:lts-alpine3.14
|
|
18
|
+
|
|
19
|
+
COPY --from=builder /tmp/app/${HOTSITE_NAME} /app/${HOTSITE_NAME}
|
|
20
|
+
COPY ./docker/${HOTSITE_NAME}/app/start.sh /app/start.sh
|
|
21
|
+
|
|
22
|
+
RUN chmod 500 /app/start.sh
|
|
23
|
+
|
|
24
|
+
RUN npm install -g hotstaq
|
|
25
|
+
|
|
26
|
+
${DOCKERFILE_PORTS}
|
|
27
|
+
${HARDEN_SECURITY}
|
|
28
|
+
|
|
29
|
+
ARG NODEJS_START_ARGS=""
|
|
30
|
+
ENV NODEJS_START_ARGS=${NODEJS_START_ARGS}
|
|
31
|
+
|
|
32
|
+
ARG HOT_RUN_ARGS=""
|
|
33
|
+
ENV HOT_RUN_ARGS=${HOT_RUN_ARGS}
|
|
34
|
+
|
|
35
|
+
ARG SERVER_TYPE="web-api"
|
|
36
|
+
ENV SERVER_TYPE=${SERVER_TYPE}
|
|
37
|
+
|
|
38
|
+
ENV HOTSITE_PATH=${HOTSITE_PATH}
|
|
39
|
+
|
|
40
|
+
WORKDIR /app/${HOTSITE_NAME}
|
|
41
|
+
ENTRYPOINT [ "/app/start.sh" ]
|
|
42
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Docker Getting Started
|
|
2
|
+
To execute the container run:
|
|
3
|
+
```console
|
|
4
|
+
./start.sh
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
To stop it enter:
|
|
8
|
+
```console
|
|
9
|
+
./stop.sh
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Docker Environment Variables
|
|
13
|
+
* NODEJS_START_ARGS
|
|
14
|
+
* Description: The start arguments to pass to NodeJS when starting the app.
|
|
15
|
+
* Type: string
|
|
16
|
+
* Default:
|
|
17
|
+
* HOT_RUN_ARGS
|
|
18
|
+
* Description: The start arguments to pass to HotStaq when starting the app.
|
|
19
|
+
* Type: string
|
|
20
|
+
* Default:
|
|
21
|
+
* SERVER_TYPE
|
|
22
|
+
* Description: The type of server to start.
|
|
23
|
+
* Type: string
|
|
24
|
+
* Default: web-api
|
|
25
|
+
* BASE_URL
|
|
26
|
+
* Description: The base url to use for the web server.
|
|
27
|
+
* Type: string
|
|
28
|
+
* Default:
|
|
29
|
+
* HTTP_PORT
|
|
30
|
+
* Description: The http port to listen on.
|
|
31
|
+
* Type: number
|
|
32
|
+
* Default: 80
|
|
33
|
+
* HTTPS_PORT
|
|
34
|
+
* Description: The https port to listen on.
|
|
35
|
+
* Type: number
|
|
36
|
+
* Default: 443
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Start the application
|
|
4
|
+
node ${NODEJS_START_ARGS} $(pwd)/node_modules/hotpreprocessor/bin/hotpreprocessor run ${HOT_RUN_ARGS}\
|
|
5
|
+
--hotsite $(pwd)/HotSite.json --server-type ${SERVER_TYPE} \
|
|
6
|
+
--web-base-url ${BASE_URL} \
|
|
7
|
+
--web-http-port ${HTTP_PORT} --web-https-port ${HTTPS_PORT} \
|
|
8
|
+
--web-route "/=$(pwd)/public"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
|
+
set NAMESPACE="${NAMESPACE}"
|
|
4
|
+
set HOTSITE_NAME="${HOTSITE_NAME}"
|
|
5
|
+
set VERSION="1.0.0"
|
|
6
|
+
|
|
7
|
+
docker build -t %NAMESPACE%/%HOTSITE_NAME%:%VERSION% -f ./docker/%HOTSITE_NAME%/Dockerfile .
|
|
8
|
+
docker tag %HOTSITE_NAME%:%VERSION% %HOTSITE_NAME%:latest
|
|
9
|
+
|
|
10
|
+
docker tag %HOTSITE_NAME%:%VERSION% %HOTSITE_NAME%-api:%VERSION%
|
|
11
|
+
docker tag %HOTSITE_NAME%-api:%VERSION% %HOTSITE_NAME%-api:latest
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
NAMESPACE="${NAMESPACE}"
|
|
4
|
+
HOTSITE_NAME="${HOTSITE_NAME}"
|
|
5
|
+
VERSION="$(cat ./package.json | jq -r .version)"
|
|
6
|
+
|
|
7
|
+
docker build -t $NAMESPACE/$HOTSITE_NAME:$VERSION -f ./docker/$HOTSITE_NAME/Dockerfile .
|
|
8
|
+
docker tag $HOTSITE_NAME:$VERSION $HOTSITE_NAME:latest
|
|
9
|
+
|
|
10
|
+
docker tag $HOTSITE_NAME:$VERSION $HOTSITE_NAME-api:$VERSION
|
|
11
|
+
docker tag $HOTSITE_NAME-api:$VERSION $HOTSITE_NAME-api:latest
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
version: "3.8"
|
|
2
|
+
services:
|
|
3
|
+
${HOTSITE_NAME}:
|
|
4
|
+
image: ${NAMESPACE}/${HOTSITE_NAME}:latest
|
|
5
|
+
networks:
|
|
6
|
+
- ${HOTSITE_NAME}-network
|
|
7
|
+
${DOCKER_COMPOSE_APP_PORTS}
|
|
8
|
+
deploy:
|
|
9
|
+
replicas: 1
|
|
10
|
+
${HOTSITE_NAME}-api:
|
|
11
|
+
image: ${NAMESPACE}/${HOTSITE_NAME}-api:latest
|
|
12
|
+
networks:
|
|
13
|
+
- ${HOTSITE_NAME}-network
|
|
14
|
+
${DOCKER_COMPOSE_APP_API_PORTS}
|
|
15
|
+
environment:
|
|
16
|
+
DATABASE_SERVER: " ${HOTSITE_NAME}-database"
|
|
17
|
+
DATABASE_PORT: "3306"
|
|
18
|
+
DATABASE_USERNAME: "${DATABASE_USERNAME}"
|
|
19
|
+
DATABASE_PASSWORD: "${DATABASE_PASSWORD}"
|
|
20
|
+
DATABASE_SCHEMA: "${DATABASE_SCHEMA}"
|
|
21
|
+
deploy:
|
|
22
|
+
replicas: 1
|
|
23
|
+
${HOTSITE_NAME}-database:
|
|
24
|
+
image: mariadb:10.6
|
|
25
|
+
networks:
|
|
26
|
+
- ${HOTSITE_NAME}-network
|
|
27
|
+
volumes:
|
|
28
|
+
- "${HOTSITE_NAME}-database-volume:/var/lib/mysql"
|
|
29
|
+
environment:
|
|
30
|
+
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
|
|
31
|
+
MYSQL_DATABASE: "${DATABASE_USERNAME}"
|
|
32
|
+
MYSQL_USER: "${DATABASE_PASSWORD}"
|
|
33
|
+
MYSQL_PASSWORD: "${DATABASE_SCHEMA}"
|
|
34
|
+
deploy:
|
|
35
|
+
replicas: 1
|
|
36
|
+
|
|
37
|
+
volumes:
|
|
38
|
+
${HOTSITE_NAME}-database-volume:
|
|
39
|
+
|
|
40
|
+
network:
|
|
41
|
+
${HOTSITE_NAME}-network:
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"type": "node",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"name": "Debug Web Server",
|
|
11
|
+
"program": "${workspaceFolder}/node_modules/hotstaq/build/src/cli.js",
|
|
12
|
+
"skipFiles": [
|
|
13
|
+
"<node_internals>/**"
|
|
14
|
+
],
|
|
15
|
+
"outputCapture": "std",
|
|
16
|
+
"args": [
|
|
17
|
+
"--development-mode",
|
|
18
|
+
"--hot-site",
|
|
19
|
+
"./HotSite.json",
|
|
20
|
+
"run",
|
|
21
|
+
"--web-http-port",
|
|
22
|
+
"8080"
|
|
23
|
+
],
|
|
24
|
+
"env": {
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "node",
|
|
29
|
+
"request": "launch",
|
|
30
|
+
"name": "Run Web Tests",
|
|
31
|
+
"skipFiles": [
|
|
32
|
+
"<node_internals>/**"
|
|
33
|
+
],
|
|
34
|
+
"program": "${workspaceFolder}/node_modules/hotstaq/build/src/cli.js",
|
|
35
|
+
"args": [
|
|
36
|
+
"--development-mode",
|
|
37
|
+
"--hot-site",
|
|
38
|
+
"./HotSite.json",
|
|
39
|
+
"test",
|
|
40
|
+
"--web-http-port",
|
|
41
|
+
"8080"
|
|
42
|
+
],
|
|
43
|
+
"env": {
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"localRoot": "${workspaceFolder}",
|
|
48
|
+
"name": "Remote Debugger",
|
|
49
|
+
"address": "127.0.0.1",
|
|
50
|
+
"port": 9229,
|
|
51
|
+
"remoteRoot": "/app/${HOTSITE_NAME}",
|
|
52
|
+
"request": "attach",
|
|
53
|
+
"skipFiles": [
|
|
54
|
+
"<node_internals>/**"
|
|
55
|
+
],
|
|
56
|
+
"type": "pwa-node"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# ${APPNAME}
|
|
2
|
+
This application was bootstrapped with [HotStaq](https://www.github.com/HigherEdgeSoftware/HotStaq)
|
|
3
|
+
|
|
4
|
+
## Getting Started
|
|
5
|
+
Navigate to the project's directory then enter:
|
|
6
|
+
${BUILDSTEPS}
|
|
7
|
+
npm run dev
|
|
8
|
+
|
|
9
|
+
This will launch the web server in development mode. Open a web browser and navigate to https://127.0.0.1:8080 to see the example page!
|
|
10
|
+
|
|
11
|
+
## Docker
|
|
12
|
+
To build the docker images navigate to the project's directory and enter:
|
|
13
|
+
```console
|
|
14
|
+
hotstaq build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This will build the Dockerfile. After which you can navigate into your output directory and enter:
|
|
18
|
+
```console
|
|
19
|
+
./build.sh
|
|
20
|
+
```
|