hotstaq 0.5.3
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/.dockerignore +123 -0
- package/.eslintignore +17 -0
- package/.eslintrc.js +11 -0
- package/.vscode/launch.json +201 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +88 -0
- package/CONTRIBUTING.md +157 -0
- package/LICENSE +21 -0
- package/README.md +128 -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 +137 -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 +242 -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 +88 -0
- package/build/src/HotCreator.d.ts.map +1 -0
- package/build/src/HotCreator.js +445 -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/HotGenerator.d.ts +80 -0
- package/build/src/HotGenerator.d.ts.map +1 -0
- package/build/src/HotGenerator.js +342 -0
- package/build/src/HotGenerator.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 +47 -0
- package/build/src/HotIO.d.ts.map +1 -0
- package/build/src/HotIO.js +232 -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 +603 -0
- package/build/src/HotStaq.d.ts.map +1 -0
- package/build/src/HotStaq.js +1260 -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 +86 -0
- package/build/src/HotTestSeleniumDriver.d.ts.map +1 -0
- package/build/src/HotTestSeleniumDriver.js +400 -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 +622 -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 copy.d.ts +2 -0
- package/build/src/api copy.d.ts.map +1 -0
- package/build/src/api copy.js +153 -0
- package/build/src/api copy.js.map +1 -0
- package/build/src/api-web.d.ts +2 -0
- package/build/src/api-web.d.ts.map +1 -0
- package/build/src/api-web.js +45 -0
- package/build/src/api-web.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 +1040 -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 +119 -0
- package/build-web/HotStaqTests_HelloWorldAPI.js +133 -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 +130 -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 +1155 -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 +542 -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 +182 -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 +386 -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 +470 -0
- package/src/HotDB.ts +79 -0
- package/src/HotDBConnectionInterface.ts +40 -0
- package/src/HotFile.ts +617 -0
- package/src/HotGenerator.ts +446 -0
- package/src/HotHTTPServer.ts +954 -0
- package/src/HotIO.ts +160 -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 +1881 -0
- package/src/HotTestDriver.ts +171 -0
- package/src/HotTestElement.ts +97 -0
- package/src/HotTestMap.ts +130 -0
- package/src/HotTestSeleniumDriver.ts +381 -0
- package/src/HotTester.ts +696 -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-web.ts +48 -0
- package/src/api.ts +103 -0
- package/src/cli.ts +1225 -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/temp/HotStaqWeb.ts +59 -0
- package/tsconfig-generator.json +17 -0
- package/tsconfig-web.json +74 -0
- package/tsconfig.json +73 -0
- package/webpack.config.generator.js +41 -0
- package/webpack.config.js +53 -0
- package/webpack.config.tests.js +56 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';var HotStaqWeb=function(A){function t(k){if(y[k])return y[k].exports;var p=y[k]={i:k,l:!1,exports:{}};return A[k].call(p.exports,p,p.exports,t),p.l=!0,p.exports}var y={};return t.m=A,t.c=y,t.d=function(k,p,r){t.o(k,p)||Object.defineProperty(k,p,{enumerable:!0,get:r})},t.r=function(k){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(k,Symbol.toStringTag,{value:"Module"});Object.defineProperty(k,"__esModule",{value:!0})},t.t=function(k,p){if((1&p&&(k=t(k)),8&p)||4&
|
|
2
|
+
p&&"object"==typeof k&&k&&k.__esModule)return k;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:k}),2&p&&"string"!=typeof k)for(var d in k)t.d(r,d,function(g){return k[g]}.bind(null,d));return r},t.n=function(k){var p=k&&k.__esModule?function(){return k.default}:function(){return k};return t.d(p,"a",p),p},t.o=function(k,p){return Object.prototype.hasOwnProperty.call(k,p)},t.p="",t(t.s=16)}([function(A,t,y){(function(k){var p=this&&this.__createBinding||(Object.create?
|
|
3
|
+
function(b,u,z,B){void 0===B&&(B=z);Object.defineProperty(b,B,{enumerable:!0,get:function(){return u[z]}})}:function(b,u,z,B){void 0===B&&(B=z);b[B]=u[z]}),r=this&&this.__setModuleDefault||(Object.create?function(b,u){Object.defineProperty(b,"default",{enumerable:!0,value:u})}:function(b,u){b.default=u}),d=this&&this.__importStar||function(b){if(b&&b.__esModule)return b;var u={};if(null!=b)for(var z in b)"default"!==z&&Object.prototype.hasOwnProperty.call(b,z)&&p(u,b,z);return r(u,b),u},g=this&&this.__awaiter||
|
|
4
|
+
function(b,u,z,B){return new (z||(z=Promise))(function(J,h){function w(G){try{L(B.next(G))}catch(C){h(C)}}function D(G){try{L(B.throw(G))}catch(C){h(C)}}function L(G){var C;G.done?J(G.value):(C=G.value,C instanceof z?C:new z(function(E){E(C)})).then(w,D)}L((B=B.apply(b,u||[])).next())})},l=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(t,"__esModule",{value:!0});t.HotStaq=void 0;const a=d(y(4)),f=d(y(4)),c=l(y(2)),e=l(y(17)),n=y(10),q=y(5),m=y(11),
|
|
5
|
+
v=y(1),x=y(12),F=y(13),H=y(15);var K=null,M=null,P=null;class I{constructor(b={}){this.api=b.api||null;this.testerAPI=b.testerAPI||null;this.mode=b.mode||v.DeveloperMode.Production;this.pages=b.pages||{};this.components=b.components||{};this.files=b.files||{};this.hotSite=b.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\t<script type = "text/javascript">\n\t\twindow.HotStaq = HotStaqWeb.HotStaq;\n\t\twindow.HotClient = HotStaqWeb.HotClient;\n\t\twindow.HotAPI = HotStaqWeb.HotAPI;\n\t\twindow.Hot = HotStaqWeb.Hot;\n\t\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\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 m.HotLog(m.HotLogLevel.None);this.publicSecrets={};this.testers={}}static parseBoolean(b){if("true"===(b=b.toLowerCase()))return!0;if("false"===b)return!1;if("yes"===b)return!0;if("no"===b)return!1;if("yep"===b)return!0;if("nah"===b)return!1;try{if(0!=parseInt(b))return!0}catch(u){}return!1}static getParam(b,u,z=!0,B=!0){u=u[b];if(null==u&&!0===z&&!0===B)throw Error(`Missing required parameter ${b}.`);if("string"==typeof u&&!0===z&&""===u&&!0===B)throw Error(`Missing required parameter ${b}.`);
|
|
8
|
+
return u}static getParamDefault(b,u,z){b=u[b];return null==b||"string"==typeof b&&""===b?z:b}static wait(b){return g(this,void 0,void 0,function*(){return yield new Promise((u,z)=>{setTimeout(()=>{u()},b)})})}addPage(b){this.pages[b.name]=b}getPage(b){return this.pages[b]}addFile(b){let u=b.name;""===u&&(u=b.localFile);""===u&&(u=b.url);this.files[u]=b}getFile(b){if(null==this.files[b])throw Error("Unable to find file "+b);return this.files[b]}addComponent(b){this.components[b.name]=b;this.registerComponent(b)}registerComponent(b){customElements.define(b.tag,
|
|
9
|
+
class extends HTMLElement{constructor(){super();(()=>{g(this,void 0,void 0,function*(){this.onclick=b.click.bind(b);for(var u in b.events){var z=b.events[u];this.addEventListener(z.type,z.func,z.options)}if(b.htmlElement=yield b.onCreated(this),null!=b.handleAttributes)yield b.handleAttributes(this.attributes);else for(u=0;u<this.attributes.length;u++){var B=this.attributes[u];z=B.name.toLowerCase();B=B.value;"id"===z&&(b.name=B);"name"===z&&(b.name=B);"value"===z&&(b.value=B)}u=yield b.output();
|
|
10
|
+
u=(new DOMParser).parseFromString(u,"text/html");z=this.attachShadow({mode:"open"});for(B=0;B<u.body.children.length;B++)z.appendChild(u.body.children[B])})})()}},b.elementOptions)}getComponent(b){return this.components[b]}static addHtml(b,u){let z=null;if(z="string"==typeof b?document.querySelector(b):b,null==z)throw Error(`Unable to find parent ${b}!`);b=null;if("string"==typeof u){u=(new DOMParser).parseFromString(u,"text/html");b=[];for(let B=0;B<u.body.children.length;B++)b.push(z.appendChild(u.body.children[B]));
|
|
11
|
+
return b}return b=z.appendChild(u),b}static checkHotSiteName(b,u=!1){let z=(0,e.default)(b);if(null!=z.errors&&0<z.errors.length&&!0===u)throw Error(`HotSite ${b} has an invalid name! The name cannot be empty and must have a valid NPM module name.`);return!0}static replaceKey(b,u,z){return b.replace(new RegExp(`\\$\\{${u}\\}`,"g"),z)}static getValueFromHotSiteObj(b,u){let z=null;if(null!=b){for(let B=0;B<u.length;B++){let J=u[B];if(null==b[J]){b=null;break}b=b[J]}null!=b&&(z=b)}return z}loadHotSite(b){return g(this,
|
|
12
|
+
void 0,void 0,function*(){var u="";!0===I.isWeb?(this.logger.info("Retrieving HotSite "+b),u=yield(0,c.default)(b),this.logger.info("Retrieved site "+b),u=u.text()):(b=f.normalize(b),this.logger.info("Retrieving HotSite "+b),u=yield new Promise((C,E)=>{a.readFile(b,(N,O)=>{if(null!=N)throw N;N=O.toString();this.logger.info("Retrieved site "+b);C(N)})}));this.hotSite=JSON.parse(u);I.checkHotSiteName(this.hotSite.name,!0);this.hotSite.hotsitePath=b;u=this.hotSite.routes;let z="http://127.0.0.1:8182",
|
|
13
|
+
B=null,J=null;if(!1===I.isWeb&&this.mode===v.DeveloperMode.Development&&null!=this.hotSite.testing){var h=C=>{let E=!0;null!=C.createNewTester&&(E=C.createNewTester);let N="Tester";null!=C.tester&&(N=C.tester);null!=C.testerName&&(N=C.testerName);!0===E?(K=y(!function(){var O=Error("Cannot find module './HotTesterMocha'");throw O.code="MODULE_NOT_FOUND",O;}()).HotTesterMocha,M=y(!function(){var O=Error("Cannot find module './HotTesterMochaSelenium'");throw O.code="MODULE_NOT_FOUND",O;}()).HotTesterMochaSelenium,
|
|
14
|
+
P=y(!function(){var O=Error("Cannot find module './HotTestSeleniumDriver'");throw O.code="MODULE_NOT_FOUND",O;}()).HotTestSeleniumDriver,""===C.testerAPIUrl&&(z=C.testerAPIUrl),"HotTestSeleniumDriver"===C.driver&&(J=new P),"HotTesterMocha"===C.tester&&(B=new K(this,N,z,J)),"HotTesterMochaSelenium"===C.tester&&(B=new M(this,N,z))):B=this.testers[N]};null!=this.hotSite.testing.web&&h(this.hotSite.testing.web);null!=this.hotSite.testing.api&&h(this.hotSite.testing.api)}if(null!=u)for(var w in u){h=u[w];
|
|
15
|
+
var D=new q.HotFile(h);D=new n.HotPage({processor:this,name:h.name||"",route:w,files:[D]});if(null!=B&&this.mode===v.DeveloperMode.Development){let C=h.name,E=null;if(null!=h.map){if("string"==typeof h.map){if(null==B.testMaps[h.map])throw Error(`Test map ${h.map} does not exist!`);B.testMaps[C]=B.testMaps[h.map]}else{E=new H.HotTestMap;let N=null;if(h.map instanceof Array){N=[];for(let O=0;O<h.map.length;O++)N.push(new H.HotTestDestination(h.map[O]))}else{N={};for(var L in h.map)N[L]=new H.HotTestDestination(h.map[L])}E.destinations=
|
|
16
|
+
N}B.testMaps[C]=E}null!=h.destinationOrder&&(B.testMaps[C].destinationOrder=h.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(h=0;h<w.map.length;h++)u.destinations.push(new H.HotTestDestination(w.map[h]));if(null==B)throw Error("A tester was not created first! You must specify one in the CLI or in HotSite.json.");B.testMaps[L]=
|
|
17
|
+
u}if(!0===I.isWeb)for(let C in this.hotSite.components)G=yield(0,c.default)(this.hotSite.components[C].url),G=eval(G),this.addComponent(G);null==this.hotSite.routes&&(this.hotSite.routes={});yield this.loadHotFiles(this.hotSite.files);null!=B&&this.addTester(B)})}loadHotFiles(b,u=!1){return g(this,void 0,void 0,function*(){for(let z in b){let B=b[z],J;J=(I.isWeb,new q.HotFile({name:z}));null!=B.url&&(J.url=B.url);!1===I.isWeb&&null!=B.localFile&&(J.localFile=B.localFile);let h=!0;null!=B.content&&
|
|
18
|
+
(J.content=B.content,h=!1);!0===u&&(h=!0);!0===h&&(yield J.load());this.addFile(J)}})}generateContent(b,u="",z="./",B="./js/HotStaq.js",J=!0,h=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 C=!0;if(null==G.jsapi&&(C=!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&&(C=!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&&(C=!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===C){w+=`\t<script type = "text/javascript" src = "${G.jsapi}"><\/script>\n`;C='""';null!=this.api&&(C=`"${this.api.baseUrl}"`);var E=this.apiContent;E=E.replace(/%api_name%/g,
|
|
20
|
+
G.apiName);E=E.replace(/%api_exported_name%/g,G.libraryName);E=E.replace(/%base_url%/g,C);D+=E}}}if(null!=this.hotSite.apis&&(C=this.hotSite.routes[b],null!=C&&null!=C.api)){G=this.hotSite.apis[C.api];if(null==G)throw Error("Unable to find API "+C.api);E=!0;if(null==G.jsapi&&(E=!1,this.logger.warning(`API with name ${C.api} doesn't have a jsapi set. Will not send js content to client.`)),null==G.libraryName&&(E=!1,this.logger.warning(`API with name ${C.api} doesn't have a libraryName set. Will not send js content to client.`)),
|
|
21
|
+
null==G.apiName&&(E=!1,this.logger.warning(`API with name ${C.api} doesn't have a apiName set. Will not send js content to client.`)),!0===E)w+=`\t<script type = "text/javascript" src = "${G.jsapi}"><\/script>\n`,C='""',null!=this.api&&(C=`"${this.api.baseUrl}"`),E=this.apiContent,E=E.replace(/%api_name%/g,G.apiName),E=E.replace(/%api_exported_name%/g,G.libraryName),E=E.replace(/%base_url%/g,C),D+=E}if(null!=this.hotSite.server&&null!=this.hotSite.server.jsSrcPath&&(B=this.hotSite.server.jsSrcPath),
|
|
22
|
+
null!=this.hotSite.publicSecrets)for(var N in this.hotSite.publicSecrets){G=this.hotSite.publicSecrets[N];C=void 0;if("string"==typeof G)C=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!");E=this.api.connection;null!=G.passSecretFromAPI&&(C=JSON.stringify(E.secrets[N]))}null!=G.env&&(C=JSON.stringify(k.env[G.env]))}L+=`processor.publicSecrets["${N}"] = ${C};\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!=h&&(O=O.replace(/%args%/g,JSON.stringify(h)));V=b;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[b])&&(V=this.hotSite.routes[b].name);return O.replace(/%hotstaq_js_src%/g,B).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,z).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(b,u="./js/HotStaq.js"){for(let z in this.pages){let B=this.pages[z];const J=this.generateContent(B.route,B.name,B.files[0].url,u);b.get(B.route,(h,w)=>{w.send(J)})}}addTester(b){this.testers[b.name]=
|
|
27
|
+
b}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(b){let u="";if(null!=this.hotSite&&null!=this.hotSite.routes)for(let z in this.hotSite.routes)if(this.hotSite.routes[z].name===b){u=z;break}return u}getRouteFromName(b){let u=null;b=this.getRouteKeyFromName(b);return""!==b&&(u=this.hotSite.routes[b]),
|
|
29
|
+
u}executeTests(b,u){return g(this,void 0,void 0,function*(){let z=this.testers[b];if(null==z)throw Error(`Unable to execute tests. Tester ${b} does not exist!`);return z.execute(u)})}executeAllWebTests(b){return g(this,void 0,void 0,function*(){let u=this.getWebTestingMaps();if(null==this.testers[b])throw Error(`Unable to execute tests. Tester ${b} does not exist!`);for(let z=0;z<u.length;z++)yield this.executeTests(b,u[z])})}executeAllAPITests(b){return g(this,void 0,void 0,function*(){let u=this.getAPITestingMaps();
|
|
30
|
+
if(null==this.testers[b])throw Error(`Unable to execute tests. Tester ${b} does not exist!`);for(let z=0;z<u.length;z++)yield this.executeTests(b,u[z])})}process(b,u=null){return g(this,void 0,void 0,function*(){return yield this.getPage(b).process(u)})}static processLocalFile(b,u=b,z=null){return g(this,void 0,void 0,function*(){let B=new I;var J=new q.HotFile({localFile:b});yield J.load();J=new n.HotPage({processor:B,name:u,files:[J]});return B.addPage(J),yield B.process(u,z)})}static processUrl(b){return g(this,
|
|
31
|
+
void 0,void 0,function*(){var u=new q.HotFile({url:b.url});yield u.load();u=new n.HotPage({processor:b.processor,name:b.name,files:[u],testerName:b.testerName,testerMap:b.testerMap});return b.processor.addPage(u),yield b.processor.process(b.name,b.args)})}static processContent(b,u,z,B=null){return g(this,void 0,void 0,function*(){var J=new q.HotFile({content:u});yield J.load();J=new n.HotPage({processor:b,name:z,files:[J]});return b.addPage(J),yield b.process(z,B)})}static onReady(b){"complete"===
|
|
32
|
+
document.readyState||"interactive"===document.readyState?b():window.addEventListener("load",b)}static useOutput(b){document.open();document.write(b);document.close()}static waitForTesters(){return g(this,void 0,void 0,function*(){for(;!1===I.isReadyForTesting;)yield I.wait(10);null!=I.onReadyForTesting&&(yield I.onReadyForTesting())})}static displayUrl(b,u=null,z=null,B=null){return g(this,void 0,void 0,function*(){return new Promise((J,h)=>{I.onReady(()=>g(this,void 0,void 0,function*(){var w={url:""};
|
|
33
|
+
if(w.name=null==u?"string"==typeof b?b:b.name:u,""===w.name&&(w.name="string"==typeof b?b:b.name),"string"==typeof b?w.url=b:(w.url=b.url,null==z&&null!=b.processor&&(z=b.processor),null==B&&null!=b.args&&(B=b.args),null!=b.testerMap&&(w.testerMap=b.testerMap),null!=b.testerName&&(w.testerName=b.testerName),null!=b.testerAPIBaseUrl&&(w.testerAPIBaseUrl=b.testerAPIBaseUrl)),null==z&&(z=new I),z.mode===v.DeveloperMode.Development&&null==z.testerAPI){null==w.testerAPIBaseUrl&&(w.testerAPIBaseUrl="");
|
|
34
|
+
""===w.testerAPIBaseUrl&&(w.testerAPIBaseUrl="http://127.0.0.1:8182");var D=new x.HotClient(z);D=new F.HotTesterAPI(w.testerAPIBaseUrl,D);D.connection.api=D;z.testerAPI=D}w.processor=z;w.args=B;w=yield I.processUrl(w);z.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(z)}))})})}static displayContent(b,u,z=null){return g(this,void 0,void 0,function*(){return new Promise((B,J)=>{I.onReady(()=>g(this,void 0,void 0,function*(){null==z&&(z=new I);let h=yield I.processContent(z,b,u);I.useOutput(h);B(z)}))})})}}t.HotStaq=I;I.isWeb=!1;I.isReadyForTesting=!1;I.onReadyForTesting=null}).call(this,y(9))},function(A,t,y){var k=this&&this.__awaiter||function(f,c,e,n){return new (e||(e=Promise))(function(q,m){function v(H){try{F(n.next(H))}catch(K){m(K)}}function x(H){try{F(n.throw(H))}catch(K){m(K)}}
|
|
36
|
+
function F(H){var K;H.done?q(H.value):(K=H.value,K instanceof e?K:new e(function(M){M(K)})).then(v,x)}F((n=n.apply(f,c||[])).next())})},p=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(t,"__esModule",{value:!0});t.Hot=t.DeveloperMode=void 0;const r=y(5),d=y(0);A=y(6);const g=p(y(19)),l=p(y(2));!function(f){f[f.Production=0]="Production";f[f.Development=1]="Development"}(y=t.DeveloperMode||(t.DeveloperMode={}));class a{static include(f,c=null){return k(this,
|
|
37
|
+
void 0,void 0,function*(){if(!0===d.HotStaq.isWeb&&"string"==typeof f){const e=f.toLowerCase();-1<e.indexOf(".hott")&&0>e.indexOf("nahfam")&&(f+="?hpserve=nahfam")}a.echo(yield a.getFile(f,c))})}static runFile(f,c=null){return k(this,void 0,void 0,function*(){var e=a.CurrentPage.processor.getFile(f);e.page=this.CurrentPage;e=yield e.process(c);a.echo(e)})}static getFile(f,c=null){return k(this,void 0,void 0,function*(){let e=null;return"string"==typeof f?(e=new r.HotFile,!0===d.HotStaq.isWeb?e.url=
|
|
38
|
+
f:e.localFile=f):e=f,yield e.load(),e.page=this.CurrentPage,yield e.process(c)})}static apiCall(f,c=null,e="POST"){return k(this,void 0,void 0,function*(){let n=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&&(n=yield a.CurrentPage.processor.api.makeCall(f,c,e)),n})}static jsonRequest(f,
|
|
39
|
+
c=null,e="POST"){return k(this,void 0,void 0,function*(){try{let n=yield(0,l.default)(f,{method:e,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)});if(!1===n.ok)throw Error(`${n.status}: ${n.statusText}`);return yield n.json()}catch(n){return JSON.stringify({error:`${n.message} - Could not fetch ${f}`})}})}static httpRequest(f,c){return k(this,void 0,void 0,function*(){return yield(0,l.default)(f,c)})}static echo(f){a.Output+=f}static displayCSS(){for(let f=
|
|
40
|
+
0;f<a.CSS.length;f++){let c=a.cssStr;c=c.replace(/%CSS_FILE%/g,a.CSS[f]);a.echo(c)}}static displayJSFiles(){for(let f=0;f<a.JSFiles.length;f++){let c=a.jsFileStr;c=c.replace(/%JS_FILE%/g,a.JSFiles[f]);a.echo(c)}}static displayJSScripts(){for(let f=0;f<a.JSScripts.length;f++){let c=a.jsScriptsStr;c=c.replace(/%JS_CODE%/g,a.JSScripts[f]);a.echo(c)}}}t.Hot=a;a.CurrentPage=null;a.Arguments=null;a.DeveloperMode=y;a.HotTestElement=A.HotTestElement;a.Mode=y.Production;a.API=null;a.TesterAPI=null;a.Output=
|
|
41
|
+
"";a.Data={};a.Cookies=g.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(A,t){var y="undefined"!=typeof self?self:this,k=function(){function p(){this.fetch=!1;this.DOMException=y.DOMException}return p.prototype=y,new p}();!function(p){!function(r){function d(h){if("string"!=
|
|
42
|
+
typeof h&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function g(h){return"string"!=typeof h&&(h=String(h)),h}function l(h){var w={next:function(){var D=h.shift();return{done:void 0===D,value:D}}};return K&&(w[Symbol.iterator]=function(){return w}),w}function a(h){this.map={};h instanceof a?h.forEach(function(w,D){this.append(D,w)},this):Array.isArray(h)?h.forEach(function(w){this.append(w[0],w[1])},this):h&&
|
|
43
|
+
Object.getOwnPropertyNames(h).forEach(function(w){this.append(w,h[w])},this)}function f(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function c(h){return new Promise(function(w,D){h.onload=function(){w(h.result)};h.onerror=function(){D(h.error)}})}function e(h){var w=new FileReader,D=c(w);return w.readAsArrayBuffer(h),D}function n(h){if(h.slice)return h.slice(0);var w=new Uint8Array(h.byteLength);return w.set(new Uint8Array(h)),w.buffer}function q(){return this.bodyUsed=
|
|
44
|
+
!1,this._initBody=function(h){var w;(this._bodyInit=h)?"string"==typeof h?this._bodyText=h:P&&Blob.prototype.isPrototypeOf(h)?this._bodyBlob=h:I&&FormData.prototype.isPrototypeOf(h)?this._bodyFormData=h:H&&URLSearchParams.prototype.isPrototypeOf(h)?this._bodyText=h.toString():b&&P&&(w=h)&&DataView.prototype.isPrototypeOf(w)?(this._bodyArrayBuffer=n(h.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):b&&(ArrayBuffer.prototype.isPrototypeOf(h)||z(h))?this._bodyArrayBuffer=n(h):this._bodyText=
|
|
45
|
+
h=Object.prototype.toString.call(h):this._bodyText="";this.headers.get("content-type")||("string"==typeof h?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(h)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},P&&(this.blob=function(){var h=f(this);if(h)return h;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(e)}),this.text=function(){var h,w,D,L=f(this);if(L)return L;if(this._bodyBlob)return h=this._bodyBlob,w=new FileReader,D=c(w),w.readAsText(h),D;if(this._bodyArrayBuffer){h=Promise;w=h.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(h,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 m(h,w){var D,L,G=(w=w||{}).body;if(h instanceof m){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url;this.credentials=h.credentials;w.headers||(this.headers=new a(h.headers));
|
|
48
|
+
this.method=h.method;this.mode=h.mode;this.signal=h.signal;G||null==h._bodyInit||(G=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);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<B.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(h){var w=new FormData;return h.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(h,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(h)}function F(h,
|
|
50
|
+
w){return new Promise(function(D,L){function G(){E.abort()}var C=new m(h,w);if(C.signal&&C.signal.aborted)return L(new r.DOMException("Aborted","AbortError"));var E=new XMLHttpRequest;E.onload=function(){var N,O,T={status:E.status,statusText:E.statusText,headers:(N=E.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 E?E.responseURL:T.headers.get("X-Request-URL");
|
|
51
|
+
D(new x("response"in E?E.response:E.responseText,T))};E.onerror=function(){L(new TypeError("Network request failed"))};E.ontimeout=function(){L(new TypeError("Network request failed"))};E.onabort=function(){L(new r.DOMException("Aborted","AbortError"))};E.open(C.method,C.url,!0);"include"===C.credentials?E.withCredentials=!0:"omit"===C.credentials&&(E.withCredentials=!1);"responseType"in E&&P&&(E.responseType="blob");C.headers.forEach(function(N,O){E.setRequestHeader(O,N)});C.signal&&(C.signal.addEventListener("abort",
|
|
52
|
+
G),E.onreadystatechange=function(){4===E.readyState&&C.signal.removeEventListener("abort",G)});E.send(void 0===C._bodyInit?null:C._bodyInit)})}var H="URLSearchParams"in p,K="Symbol"in p&&"iterator"in Symbol,M;if(M="FileReader"in p&&"Blob"in p)try{M=(new Blob,!0)}catch(h){M=!1}var P=M,I="FormData"in p,b="ArrayBuffer"in p;if(b)var u="[object Int8Array];[object Uint8Array];[object Uint8ClampedArray];[object Int16Array];[object Uint16Array];[object Int32Array];[object Uint32Array];[object Float32Array];[object Float64Array]".split(";"),
|
|
53
|
+
z=ArrayBuffer.isView||function(h){return h&&-1<u.indexOf(Object.prototype.toString.call(h))};a.prototype.append=function(h,w){h=d(h);w=g(w);var D=this.map[h];this.map[h]=D?D+", "+w:w};a.prototype.delete=function(h){delete this.map[d(h)]};a.prototype.get=function(h){return h=d(h),this.has(h)?this.map[h]:null};a.prototype.has=function(h){return this.map.hasOwnProperty(d(h))};a.prototype.set=function(h,w){this.map[d(h)]=g(w)};a.prototype.forEach=function(h,w){for(var D in this.map)this.map.hasOwnProperty(D)&&
|
|
54
|
+
h.call(w,this.map[D],D,this)};a.prototype.keys=function(){var h=[];return this.forEach(function(w,D){h.push(D)}),l(h)};a.prototype.values=function(){var h=[];return this.forEach(function(w){h.push(w)}),l(h)};a.prototype.entries=function(){var h=[];return this.forEach(function(w,D){h.push([D,w])}),l(h)};K&&(a.prototype[Symbol.iterator]=a.prototype.entries);var B="DELETE GET HEAD OPTIONS POST PUT".split(" ");m.prototype.clone=function(){return new m(this,{body:this._bodyInit})};q.call(m.prototype);
|
|
55
|
+
q.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 h=new x(null,{status:0,statusText:""});return h.type="error",h};var J=[301,302,303,307,308];x.redirect=function(h,w){if(-1===J.indexOf(w))throw new RangeError("Invalid status code");return new x(null,{status:w,headers:{location:h}})};r.DOMException=p.DOMException;try{new r.DOMException}catch(h){r.DOMException=
|
|
56
|
+
function(w,D){this.message=w;this.name=D;this.stack=Error(w).stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}F.polyfill=!0;p.fetch||(p.fetch=F,p.Headers=a,p.Request=m,p.Response=x);r.Headers=a;r.Request=m;r.Response=x;r.fetch=F;Object.defineProperty(r,"__esModule",{value:!0})}({})}(k);k.fetch.ponyfill=!0;delete k.fetch.polyfill;(t=k.fetch).default=k.fetch;t.fetch=k.fetch;t.Headers=k.Headers;t.Request=k.Request;t.Response=k.Response;
|
|
57
|
+
A.exports=t},function(A,t,y){var k=this&&this.__awaiter||function(d,g,l,a){return new (l||(l=Promise))(function(f,c){function e(m){try{q(a.next(m))}catch(v){c(v)}}function n(m){try{q(a.throw(m))}catch(v){c(v)}}function q(m){var v;m.done?f(m.value):(v=m.value,v instanceof l?v:new l(function(x){x(v)})).then(e,n)}q((a=a.apply(d,g||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});t.HotServer=t.HotServerType=void 0;const p=y(0);var r;!function(d){d[d.HTTP=0]="HTTP";d[d.WebSockets=1]="WebSockets"}(r=
|
|
58
|
+
t.HotServerType||(t.HotServerType={}));t.HotServer=class{constructor(d){d instanceof p.HotStaq?(this.processor=d,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=r.HTTP,this.logger=d.logger,this.secrets={}):(this.processor=d.processor,this.serverType=d.serverType||"Server",this.api=d.api||null,this.listenAddress=d.listenAddress||"0.0.0.0",this.ports=d.ports||{http:80,https:443},
|
|
59
|
+
this.ssl=d.ssl||{cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=null==d.redirectHTTPtoHTTPS||d.redirectHTTPtoHTTPS,this.type=d.type||r.HTTP,this.logger=d.logger,this.secrets=d.secrets||{})}setAPI(d){return k(this,void 0,void 0,function*(){this.api=this.processor.api=d})}}},function(A,t){},function(A,t,y){var k=this&&this.__createBinding||(Object.create?function(c,e,n,q){void 0===q&&(q=n);Object.defineProperty(c,q,{enumerable:!0,get:function(){return e[n]}})}:function(c,e,n,q){void 0===q&&(q=n);c[q]=
|
|
60
|
+
e[n]}),p=this&&this.__setModuleDefault||(Object.create?function(c,e){Object.defineProperty(c,"default",{enumerable:!0,value:e})}:function(c,e){c.default=e});A=this&&this.__importStar||function(c){if(c&&c.__esModule)return c;var e={};if(null!=c)for(var n in c)"default"!==n&&Object.prototype.hasOwnProperty.call(c,n)&&k(e,c,n);return p(e,c),e};var r=this&&this.__awaiter||function(c,e,n,q){return new (n||(n=Promise))(function(m,v){function x(K){try{H(q.next(K))}catch(M){v(M)}}function F(K){try{H(q.throw(K))}catch(M){v(M)}}
|
|
61
|
+
function H(K){var M;K.done?m(K.value):(M=K.value,M instanceof n?M:new n(function(P){P(M)})).then(x,F)}H((q=q.apply(c,e||[])).next())})},d=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(t,"__esModule",{value:!0});t.HotFile=void 0;const g=A(y(4)),l=d(y(2)),a=y(1);class f{constructor(c={}){this.page=c.page||null;this.name=c.name||"";this.url=c.url||"";this.localFile=c.localFile||"";this.content=c.content||"";this.throwAllErrors=c.throwAllErrors||!1}setContent(c){this.content=
|
|
62
|
+
c}getContent(){return this.content}static httpGet(c){return r(this,void 0,void 0,function*(){try{let e=yield(0,l.default)(c);if(!1===e.ok)throw Error(`${e.status}: ${e.statusText}`);return yield e.text()}catch(e){return JSON.stringify({error:`${e.message} - Could not fetch ${c}`})}})}loadUrl(){return r(this,void 0,void 0,function*(){return this.content=yield f.httpGet(this.url),this.content})}loadLocalFile(){return r(this,void 0,void 0,function*(){return new Promise((c,e)=>{g.readFile(this.localFile,
|
|
63
|
+
(n,q)=>{if(null!=n)throw n;this.content=q.toString();c(this.content)})})})}load(){return r(this,void 0,void 0,function*(){let c="";return""!==this.url&&(c=yield this.loadUrl()),""!==this.localFile&&(c=yield this.loadLocalFile()),c})}static processContent(c,e,n,q,m=2,v=2){let x=e.exec(c),F=0,H="";for(;null!=x;){let K=e.lastIndex+v,M=c.substr(F,x.index-m-F);F=K;H+=q(M);H+=n(x[0]);x=e.exec(c)}return H+=q(c.substr(F)),H}static processNestedContent(c,e,n,q,m,v,x=2,F=1){let H=c.indexOf(e),K=0;var M=c.indexOf(q,
|
|
64
|
+
H);let P="";for(;-1<H;){var I=c.indexOf(n,H);let b=0;if(""!==q){let u=c.lastIndexOf(q,I-F);for(;-1<u&&u!==M;)u=c.lastIndexOf(q,u-F),b++}if(0<b){for(I=M=c.indexOf(n,I+F);-1<M&&0<b&&!(0>I)&&!(c.lastIndexOf(e,I-F)>M);)M=I,I=c.indexOf(n,M+F),b--;I=M}P+=v(c.substr(K,H-K));P+=m(c.substr(H+x,I-(H+x)));H=c.indexOf(e,I+F);M=c.indexOf(q,H);K=I+F}return P+=v(c.substr(K)),P}process(c=null){return r(this,void 0,void 0,function*(){var e="";e=this.content;a.Hot.Mode=this.page.processor.mode;a.Hot.Arguments=c;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();e=f.processContent(e,RegExp("(?=\\<\\*)([\\s\\S]*?)(?=\\*\\>)","g"),m=>""+m.substr(2),m=>{if(""===m)return"";m=f.processNestedContent(m,"!{","}","{",x=>`*&&%*%@#@!${x}*&!#%@!@*!`,x=>x);m=f.processNestedContent(m,"STR{","}","{",x=>`*&&%*%@#@!echoOutput (JSON.stringify(${x}), ${this.throwAllErrors});*&!#%@!@*!`,x=>x,4,1);m=f.processNestedContent(m,"${","}","{",x=>{let F=
|
|
66
|
+
`*&&%*%@#@!try { Hot.echo (${x}); }catch (ex){Hot.echo ("");}*&!#%@!@*!`;return!0===this.throwAllErrors&&(F=`*&&%*%@#@!Hot.echo (${x});*&!#%@!@*!`),F},x=>x);let v="";a.Hot.Mode===a.DeveloperMode.Production&&(v=f.processNestedContent(m,"?(",")","(",x=>"",x=>x));a.Hot.Mode===a.DeveloperMode.Development&&(v=f.processNestedContent(m,"?(",")","(",x=>{let F="";try{JSON.parse(x),F=JSON.stringify(x)}catch(H){F=""+x}return`*&&%*%@#@!{\nconst testElm = createTestElement (${F});\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));m=f.processNestedContent(v,"*&&%*%@#@!","*&!#%@!@*!","*&&%*%@#@!",x=>x,x=>`echoOutput (${JSON.stringify(x)}, ${this.throwAllErrors});\n`,10,10);return m=m.replace(/\*&&%\*%@#@!/g,""),m=m.replace(/\*&!#%@!@\*!/g,""),m},0);let n=null;try{let m="\n\t\t\tvar Hot = arguments[0];\n\t\t\tvar PassedHotFile = arguments[1];\n\n\t\t\t";if("string"==typeof c)throw Error("The passing arguments cannot be a string!");for(let v in c){let x="";x=`var ${v} = ${JSON.stringify(c[v])};\n`;m+=x}var q=this.name;
|
|
68
|
+
""===q&&(q=this.localFile);""===q&&(q=this.url);m+='\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
|
+
m+=e;m+="\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}));";n=yield(new Function(m)).apply(this,[a.Hot,this])}catch(m){throw SyntaxError,m;}a.Hot.Data=n.hot.Data;q=n.output;return a.Hot.Output="",q})}}t.HotFile=f},function(A,t,y){Object.defineProperty(t,"__esModule",{value:!0});t.HotTestElement=t.HotTestElementOptions=void 0;t.HotTestElementOptions=
|
|
70
|
+
class{constructor(k={}){this.mustBeVisible=k.mustBeVisible||!0;this.ignoreMissingElementError=k.ignoreMissingElementError||!1}};t.HotTestElement=class{constructor(k,p="",r=null){"string"==typeof k?(this.name=k,this.func=p,this.value=r):(this.name=k.name,this.func=k.func||p,this.value=k.value||r)}}},function(A,t,y){Object.defineProperty(t,"__esModule",{value:!0});t.HotRoute=void 0;const k=y(8);class p{constructor(r,d,g=[]){this.onAuthorizeUser=this.onPostRegister=this.onRegister=this.onPreRegister=
|
|
71
|
+
null;this.connection=r;this.logger=null;null!=this.connection&&null!=this.connection.processor&&(this.logger=this.connection.processor.logger);this.route=d;this.version="v1";this.prefix="";this.authCredentials=null;this.methods=g;this.errors={not_authorized:p.createError("Not authorized.")}}static createError(r){return{error:r}}addMethod(r,d=null,g=k.HTTPMethod.POST,l=null){"string"==typeof r&&(r=new k.HotRouteMethod(this,r,d,g,null,null,null,l));this.methods.push(r)}getMethod(r){let d=null;for(let g=
|
|
72
|
+
0;g<this.methods.length;g++){let l=this.methods[g];if(l.name===r){d=l;break}}return d}}t.HotRoute=p},function(A,t,y){Object.defineProperty(t,"__esModule",{value:!0});t.HotRouteMethod=t.HTTPMethod=void 0;const k=y(1),p=y(3);var r;!function(d){d.GET="get";d.POST="post"}(r=t.HTTPMethod||(t.HTTPMethod={}));t.HotRouteMethod=class{constructor(d,g,l=null,a=r.POST,f=null,c=null,e=null,n=null){if(this.parentRoute=d,this.name=g,this.type=a,this.isRegistered=!1,this.executeSetup=!1,this.authCredentials=e,this.onServerAuthorize=
|
|
73
|
+
f,this.onRegister=c,this.testCases={},this.parentRoute.connection.processor.mode===k.DeveloperMode.Development&&null!=n)for(d=0;d<n.length;d++)g=n[d],"string"==typeof g?(this.addTestCase(g,n[d+1]),d++):this.addTestCase(g);this.parentRoute.connection instanceof p.HotServer&&(this.onServerExecute=l)}addTestCase(d,g=null){if("string"==typeof d)return void(this.testCases[d]={name:d,func:g});if("function"==typeof d)return g=Object.keys(this.testCases).length,g=`${this.parentRoute.route}/${this.name} test case ${g}`,
|
|
74
|
+
void(this.testCases[g]={name:g,func:d});this.testCases[d.name]=d}}},function(A,t){function y(){throw Error("setTimeout has not been defined");}function k(){throw Error("clearTimeout has not been defined");}function p(m){if(a===setTimeout)return setTimeout(m,0);if((a===y||!a)&&setTimeout)return a=setTimeout,setTimeout(m,0);try{return a(m,0)}catch(v){try{return a.call(null,m,0)}catch(x){return a.call(this,m,0)}}}function r(){n&&c&&(n=!1,c.length?e=c.concat(e):q=-1,e.length&&d())}function d(){if(!n){var m=
|
|
75
|
+
p(r);n=!0;for(var v=e.length;v;){c=e;for(e=[];++q<v;)c&&c[q].run();q=-1;v=e.length}c=null;n=!1;(function(x){if(f===clearTimeout)return clearTimeout(x);if((f===k||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(x);try{f(x)}catch(F){try{return f.call(null,x)}catch(H){return f.call(this,x)}}})(m)}}function g(m,v){this.fun=m;this.array=v}function l(){}A=A.exports={};try{var a="function"==typeof setTimeout?setTimeout:y}catch(m){a=y}try{var f="function"==typeof clearTimeout?clearTimeout:k}catch(m){f=
|
|
76
|
+
k}!0;var c,e=[],n=!1,q=-1;A.nextTick=function(m){var v=Array(arguments.length-1);if(1<arguments.length)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];e.push(new g(m,v));1!==e.length||n||p(d)};g.prototype.run=function(){this.fun.apply(null,this.array)};A.title="browser";A.browser=!0;A.env={};A.argv=[];A.version="";A.versions={};A.on=l;A.addListener=l;A.once=l;A.off=l;A.removeListener=l;A.removeAllListeners=l;A.emit=l;A.prependListener=l;A.prependOnceListener=l;A.listeners=function(m){return[]};
|
|
77
|
+
A.binding=function(m){throw Error("process.binding is not supported");};A.cwd=function(){return"/"};A.chdir=function(m){throw Error("process.chdir is not supported");};A.umask=function(){return 0}},function(A,t,y){var k=this&&this.__awaiter||function(d,g,l,a){return new (l||(l=Promise))(function(f,c){function e(m){try{q(a.next(m))}catch(v){c(v)}}function n(m){try{q(a.throw(m))}catch(v){c(v)}}function q(m){var v;m.done?f(m.value):(v=m.value,v instanceof l?v:new l(function(x){x(v)})).then(e,n)}q((a=
|
|
78
|
+
a.apply(d,g||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});t.HotPage=void 0;const p=y(1),r=y(0);t.HotPage=class{constructor(d){d instanceof r.HotStaq?(this.processor=d,this.name="",this.testerName="",this.testerMap="",this.route="",this.files=[],this.testElements={},this.testPaths={}):(this.processor=d.processor,this.name=d.name||"",this.testerName=d.testerName||"",this.testerMap=d.testerMap||"",this.route=d.route||"",this.files=d.files||[],this.testElements=d.testElements||{},
|
|
79
|
+
this.testPaths=d.testPaths||{})}addFile(d){return k(this,void 0,void 0,function*(){d.page=this;this.files.push(d)})}getAPI(){return this.processor.api}getTesterAPI(){return this.processor.testerAPI}load(d){return k(this,void 0,void 0,function*(){for(let g=0;g<this.files.length;g++)yield this.files[g].load()})}process(d=null){return k(this,void 0,void 0,function*(){let g="";for(let l=0;l<this.files.length;l++){let a=this.files[l];p.Hot.Output="";a.page=this;g+=yield a.process(d)}return g})}addTestElement(d){if(null!=
|
|
80
|
+
this.testElements[d.name])throw Error(`Test element ${d.name} already exists!`);this.testElements[d.name]=d}getTestElement(d){if(null==this.testElements[d])throw Error(`Test element ${d} doest not exist!`);return this.testElements[d]}createTestPath(d,g){if(null!=this.testPaths[d])throw Error(`Test path ${d} already exists!`);this.testPaths[d]=g}}},function(A,t,y){var k;Object.defineProperty(t,"__esModule",{value:!0});t.HotLog=t.HotLogLevel=void 0;(function(p){p[p.Info=0]="Info";p[p.Warning=1]="Warning";
|
|
81
|
+
p[p.Error=2]="Error";p[p.Verbose=3]="Verbose";p[p.All=4]="All";p[p.None=5]="None"})(k=t.HotLogLevel||(t.HotLogLevel={}));t.HotLog=class{constructor(p=k.All){this.logLevel=p}log(p,r){this.logLevel===k.Verbose&&(p===k.Error&&this.error(r),p===k.Warning&&this.warning(r),p!==k.Info&&p!==k.Verbose||this.info(r));this.logLevel===k.All&&(p===k.Error&&this.error(r),p===k.Warning&&this.warning(r),p===k.Info&&this.info(r));this.logLevel===k.Error&&p===k.Error&&this.error(r);this.logLevel===k.Warning&&p===k.Warning&&
|
|
82
|
+
this.warning(r);this.logLevel===k.Info&&p===k.Info&&this.info(r)}verbose(p){this.logLevel===k.Verbose&&console.info(p)}info(p){this.logLevel!==k.All&&this.logLevel!==k.Verbose&&this.logLevel!==k.Info||console.info(p)}warning(p){this.logLevel!==k.All&&this.logLevel!==k.Verbose&&this.logLevel!==k.Warning||console.warn(p)}error(p){if(this.logLevel===k.All||this.logLevel===k.Verbose||this.logLevel===k.Error){let r="";"string"==typeof p?r=p:(null!=p.message&&(r=p.message),null!=p.stack&&(r=p.stack));console.error(r)}}}},
|
|
83
|
+
function(A,t,y){Object.defineProperty(t,"__esModule",{value:!0});t.HotClient=void 0;const k=y(3);t.HotClient=class{constructor(p){this.processor=p;this.testerAPI=this.api=null;this.type=k.HotServerType.HTTP;this.logger=p.logger}}},function(A,t,y){var k=this&&this.__awaiter||function(g,l,a,f){return new (a||(a=Promise))(function(c,e){function n(v){try{m(f.next(v))}catch(x){e(x)}}function q(v){try{m(f.throw(v))}catch(x){e(x)}}function m(v){var x;v.done?c(v.value):(x=v.value,x instanceof a?x:new a(function(F){F(x)})).then(n,
|
|
84
|
+
q)}m((f=f.apply(g,l||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});t.HotTesterAPI=void 0;const p=y(14),r=y(7);class d extends p.HotAPI{constructor(g,l=null,a=null){super(g,l,a);this.executeEventsUsing=p.EventExecutionType.HotAPI;g=new r.HotRoute(l,"tester");g.addMethod("pageLoaded",this.pageLoaded);g.addMethod("executeTests",this.executeTests);this.addRoute(g)}pageLoaded(g,l,a,f,c){return k(this,void 0,void 0,function*(){let e={testerName:f.testerName,testerMap:f.testerMap,pageName:f.pageName,
|
|
85
|
+
testElements:f.testElements,testPathsStrs:f.testPaths};for(var n in e){var q=!1;if(null==e[n]&&(q=!0),""!=e.testerName&&""!==e.testerMap&&""!==e.testElements&&""!==e.testPathsStrs||(q=!0),!0===q)throw Error(`TesterAPI: Object ${n} was not passed.`);}e.testElements=JSON.parse(e.testElements);e.testPathsStrs=JSON.parse(e.testPathsStrs);n={};for(var m in e.testPathsStrs)q=eval(e.testPathsStrs[m]),n[m]=q;m=this.connection.processor.testers[e.testerName];if(null==m)throw Error(`TesterAPI: Tester ${e.testerMap} does not exist!`);
|
|
86
|
+
q=m.testMaps[e.testerMap];if(null==q)throw Error(`TesterAPI: Tester map ${e.testerMap} does not exist!`);return q.pages[e.pageName]={testElements:{},testPaths:{}},q.pages[e.pageName].testElements=e.testElements,q.pages[e.pageName].testPaths=n,m.finishedLoading=!0,null!=m.onFinishedLoading&&(yield m.onFinishedLoading()),!0})}executeTests(g,l,a,f,c){return k(this,void 0,void 0,function*(){let e=f.testerName,n=f.testerMap;if(null==e||null==n)throw Error("TesterAPI: Not all required json objects were passed.");
|
|
87
|
+
if(""===e||""===n)throw Error("TesterAPI: Not all required json objects were passed.");let q=this.connection;return null!=q.executeTests&&(yield q.executeTests(e,n)),!0})}}t.HotTesterAPI=d},function(A,t,y){var k=this&&this.__awaiter||function(a,f,c,e){return new (c||(c=Promise))(function(n,q){function m(F){try{x(e.next(F))}catch(H){q(H)}}function v(F){try{x(e.throw(F))}catch(H){q(H)}}function x(F){var H;F.done?n(F.value):(H=F.value,H instanceof c?H:new c(function(K){K(H)})).then(m,v)}x((e=e.apply(a,
|
|
88
|
+
f||[])).next())})};A=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(t,"__esModule",{value:!0});t.HotAPI=t.EventExecutionType=void 0;const p=A(y(2)),r=y(3),d=y(7),g=y(8);var l;!function(a){a[a.HotRoute=0]="HotRoute";a[a.HotMethod=1]="HotMethod";a[a.HotAPI=2]="HotAPI"}(l=t.EventExecutionType||(t.EventExecutionType={}));t.HotAPI=class{constructor(a,f=null,c=null){this.connection=f;this.baseUrl=a;this.createFunctions=!0;this.executeEventsUsing=l.HotRoute;
|
|
89
|
+
this.db=c;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,c=null){let e="";if(a instanceof d.HotRoute?(e=a.route,this.routes[a.route]=a):(e=a,null==this.routes[e]&&(this.routes[e]=new d.HotRoute(this.connection,e)),f instanceof g.HotRouteMethod?this.routes[e].addMethod(f):this.routes[e].addMethod(new g.HotRouteMethod(this.routes[e],f,c))),this.routes[e].connection=this.connection,!0===this.createFunctions){a=
|
|
91
|
+
this[e];null==a&&(a={});for(f=0;f<this.routes[e].methods.length;f++){let n=this.routes[e],q=this.routes[e].methods[f];a[q.name]=m=>{let v=q.type,x="";""!==n.version&&(x+="/"+n.version);""!==n.route&&(x+="/"+n.route);""!==q.name&&(x+="/"+q.name);let F=null;if(null!=this.authCredentials&&(F=this.authCredentials),null!=q.authCredentials?F=q.authCredentials:null!=q.parentRoute.authCredentials&&(F=q.parentRoute.authCredentials),null==F&&"undefined"!=typeof Hot&&null!=Hot&&null!=Hot.API&&null!=Hot.API[n.route]&&
|
|
92
|
+
null!=Hot.API[n.route].authCredentials&&(F=Hot.API[n.route].authCredentials),null!=F)for(let H in F){let K=F[H];null==m[H]&&(m[H]=K)}return this.makeCall.apply(this,[x,m,v])}}this[e]=a}}registerRoute(a){return k(this,void 0,void 0,function*(){this.connection instanceof r.HotServer&&(yield this.connection.registerRoute(a))})}registerRoutes(){return k(this,void 0,void 0,function*(){for(let a in this.routes)yield this.registerRoute(this.routes[a])})}makeCall(a,f,c="POST"){return k(this,void 0,void 0,
|
|
93
|
+
function*(){let e=this.baseUrl;"/"===e[e.length-1]&&(e=e.substr(0,e.length-1));"/"!==a[0]&&(e+="/");e+=a;let n={method:c=c.toUpperCase(),headers:{Accept:"application/json","Content-Type":"application/json"}};"GET"!==c&&"HEAD"!==c&&(n.body=JSON.stringify(f));let q=null;try{q=yield(0,p.default)(e,n)}catch(m){throw m;}return yield q.json()})}}},function(A,t,y){Object.defineProperty(t,"__esModule",{value:!0});t.HotTestMap=t.HotTestDestination=void 0;class k{constructor(p="",r=!0){"string"==typeof p?(this.destination=
|
|
94
|
+
p,this.autoStart=r):p instanceof k?(this.destination=p.destination,this.autoStart=p.autoStart):(this.destination=p.path,this.autoStart=p.autoStart)}}t.HotTestDestination=k;t.HotTestMap=class{constructor(p=[],r={},d=[]){if(p instanceof Array){this.destinations=[];for(var g=0;g<p.length;g++)this.destinations.push(new k(p[g]))}else for(g in this.destinations={},p)this.destinations[g]=new k(p[g]);this.destinationOrder=d;this.pages=r}}},function(A,t,y){Object.defineProperty(t,"__esModule",{value:!0});
|
|
95
|
+
t=y(0);const k=y(1),p=y(20),r=y(5),d=y(11),g=y(10),l=y(14),a=y(7),f=y(8),c=y(3),e=y(12),n=y(21),q=y(6),m=y(22),v=y(13);y=y(15);t.HotStaq.isWeb=!0;A.exports.HotStaq=t.HotStaq;A.exports.Hot=k.Hot;A.exports.DeveloperMode=k.DeveloperMode;A.exports.HotComponent=p.HotComponent;A.exports.HotAPI=l.HotAPI;A.exports.EventExecutionType=l.EventExecutionType;A.exports.HotFile=r.HotFile;A.exports.HotLog=d.HotLog;A.exports.HotLogLevel=d.HotLogLevel;A.exports.HotPage=g.HotPage;A.exports.HotRoute=a.HotRoute;A.exports.HotRouteMethod=
|
|
96
|
+
f.HotRouteMethod;A.exports.HTTPMethod=f.HTTPMethod;A.exports.HotServer=c.HotServer;A.exports.HotClient=e.HotClient;A.exports.HotTester=m.HotTester;A.exports.HotTesterAPI=v.HotTesterAPI;A.exports.HotTestMap=y.HotTestMap;A.exports.HotTestDestination=y.HotTestDestination;A.exports.HotTestElement=q.HotTestElement;A.exports.HotTestElementOptions=q.HotTestElementOptions;A.exports.HotTestDriver=n.HotTestDriver},function(A,t,y){var k=RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),p=y(18),r=["node_modules","favicon.ico"];
|
|
97
|
+
(A.exports=function(g){var l=[],a=[];if(null===g)return a.push("name cannot be null"),d(l,a);if(void 0===g)return a.push("name cannot be undefined"),d(l,a);if("string"!=typeof g)return a.push("name must be a string"),d(l,a);if(g.length||a.push("name length must be greater than zero"),g.match(/^\./)&&a.push("name cannot start with a period"),g.match(/^_/)&&a.push("name cannot start with an underscore"),g.trim()!==g&&a.push("name cannot contain leading or trailing spaces"),r.forEach(function(e){g.toLowerCase()===
|
|
98
|
+
e&&a.push(e+" is a blacklisted name")}),p.forEach(function(e){g.toLowerCase()===e&&l.push(e+" is a core module name")}),214<g.length&&l.push("name can no longer contain more than 214 characters"),g.toLowerCase()!==g&&l.push("name can no longer contain capital letters"),/[~'!()*]/.test(g.split("/").slice(-1)[0])&&l.push('name can no longer contain special characters ("~\'!()*")'),encodeURIComponent(g)!==g){var f=g.match(k);if(f){var c=f[1];f=f[2];if(encodeURIComponent(c)===c&&encodeURIComponent(f)===
|
|
99
|
+
f)return d(l,a)}a.push("name can only contain URL-friendly characters")}return d(l,a)}).scopedPackagePattern=k;var d=function(g,l){g={validForNewPackages:0===l.length&&0===g.length,validForOldPackages:0===l.length,warnings:g,errors:l};return g.warnings.length||delete g.warnings,g.errors.length||delete g.errors,g}},function(A){A.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"]')},
|
|
100
|
+
function(A,t,y){A.exports=function(){function k(p){for(var r=1;r<arguments.length;r++){var d=arguments[r],g;for(g in d)p[g]=d[g]}return p}return function g(r,d){function l(a,f,c){if("undefined"!=typeof document){"number"==typeof(c=k({},d,c)).expires&&(c.expires=new Date(Date.now()+864E5*c.expires));c.expires&&(c.expires=c.expires.toUTCString());a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var e="",n;for(n in c)c[n]&&(e+="; "+n,!0!==c[n]&&(e+="="+
|
|
101
|
+
c[n].split(";")[0]));return document.cookie=a+"="+r.write(f,a)+e}}return Object.create({set:l,get:function(a){if("undefined"!=typeof document&&(!arguments.length||a)){for(var f=document.cookie?document.cookie.split("; "):[],c={},e=0;e<f.length;e++){var n=f[e].split("="),q=n.slice(1).join("=");try{var m=decodeURIComponent(n[0]);if(c[m]=r.read(q,m),a===m)break}catch(v){}}return a?c[a]:c}},remove:function(a,f){l(a,"",k({},f,{expires:-1}))},withAttributes:function(a){return g(this.converter,k({},this.attributes,
|
|
102
|
+
a))},withConverter:function(a){return g(k({},this.converter,a),this.attributes)}},{attributes:{value:Object.freeze(d)},converter:{value:Object.freeze(r)}})}({read:function(r){return'"'===r[0]&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}()},function(A,t,y){var k=this&&this.__awaiter||function(r,d,g,l){return new (g||(g=Promise))(function(a,f){function c(q){try{n(l.next(q))}catch(m){f(m)}}
|
|
103
|
+
function e(q){try{n(l.throw(q))}catch(m){f(m)}}function n(q){var m;q.done?a(q.value):(m=q.value,m instanceof g?m:new g(function(v){v(m)})).then(c,e)}n((l=l.apply(r,d||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});t.HotComponent=void 0;const p=y(0);t.HotComponent=class{constructor(r,d=null){r instanceof p.HotStaq?(this.processor=r,this.htmlElement=null,this.name="",this.tag="",this.api=null,this.elementOptions=void 0,this.type="",this.value=null,this.events={}):(this.processor=r.processor,
|
|
104
|
+
this.htmlElement=r.htmlElement||null,this.name=r.name||"",this.tag=r.tag||this.name,this.api=r.api||null,this.elementOptions=r.elementOptions||void 0,this.type=r.type||"",this.value=r.value||null,this.events={});null!=d&&(this.api=d)}onCreated(r){return k(this,void 0,void 0,function*(){return r})}}},function(A,t,y){(function(k){var p=this&&this.__awaiter||function(d,g,l,a){return new (l||(l=Promise))(function(f,c){function e(m){try{q(a.next(m))}catch(v){c(v)}}function n(m){try{q(a.throw(m))}catch(v){c(v)}}
|
|
105
|
+
function q(m){var v;m.done?f(m.value):(v=m.value,v instanceof l?v:new l(function(x){x(v)})).then(e,n)}q((a=a.apply(d,g||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});t.HotTestDriver=void 0;const r=y(6);t.HotTestDriver=class{constructor(d=null){this.page=d}parseTestObject(d){let g=d.indexOf("*");var l="";-1<g&&(d=d.replace(/\*/,""),l="*");l=`[data-test-object-name${l}='${d}']`;return g=d.indexOf(">"),-1<g&&(l=d.replace(/>/,"")),l}wait(d){return p(this,void 0,void 0,function*(){return yield new Promise((g,
|
|
106
|
+
l)=>{setTimeout(()=>{g()},d)})})}print(d){return p(this,void 0,void 0,function*(){k.stdout.write(d)})}println(d){return p(this,void 0,void 0,function*(){yield this.print(d+"\n")})}assert(d,g=""){return p(this,void 0,void 0,function*(){if(!d)throw Error(g);})}run(d){return p(this,void 0,void 0,function*(){let g=[];for(let l=0;l<d.length;l++){let a=d[l],f=null,c="",e="";if("string"==typeof a){if(f=this.page.testElements[a],null==f)throw Error("HotTestDriver: Unable to find test element "+a);c=f.func;
|
|
107
|
+
e=f.value}if(a instanceof Array){let n=a[0];f=this.page.testElements[n];null==f?(f=new r.HotTestElement(n),c=a[1],e=a[2]):(c=f.func,e=f.value,1<a.length&&(c=a[1]),2<a.length&&(e=a[2]))}f.func=c;f.value=e;g.push(yield this.runCommand(f))}return g})}}}).call(this,y(9))},function(A,t,y){var k=this&&this.__awaiter||function(d,g,l,a){return new (l||(l=Promise))(function(f,c){function e(m){try{q(a.next(m))}catch(v){c(v)}}function n(m){try{q(a.throw(m))}catch(v){c(v)}}function q(m){var v;m.done?f(m.value):
|
|
108
|
+
(v=m.value,v instanceof l?v:new l(function(x){x(v)})).then(e,n)}q((a=a.apply(d,g||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});t.HotTester=void 0;const p=y(0);class r{constructor(d,g,l,a,f={}){this.processor=d;this.name=g;this.baseUrl=l;this.testMaps=f;this.driver=a;this.hasBeenDestroyed=this.hasBeenSetup=this.finishedLoading=!1}waitForData(){return k(this,void 0,void 0,function*(){for(;!1===this.finishedLoading;)yield p.HotStaq.wait(10)})}getTestPage(d){return this.testMaps[d.mapName].pages[d.page]}getTestPath(d,
|
|
109
|
+
g){return this.testMaps[d.mapName].pages[d.page].testPaths[g]}static interpretDestination(d,g){d={mapName:d,page:"",api:"",paths:[]};g=g.destination.split(/\->/g);var l=g[0];let a=(f,c)=>{let e=f.indexOf(c),n="";return-1<e&&(n=f.substr(e+c.length),n=n.trim()),n};d.page=a(l,"page:");d.api=a(l,"api:");for(l=1;l<g.length;l++){let f=g[l],c={cmd:"",dest:"",path:""};f=f.trim();c.dest=a(f,"dest:");c.cmd=a(f,"cmd:");c.path=a(f,"path:");""==c.dest&&""==c.cmd&&""==c.path&&(c.path=f);d.paths.push(c)}return d}executeTestAPIPath(d,
|
|
110
|
+
g,l,a=!1,f=!1){return k(this,void 0,void 0,function*(){var c=!0;!1===a&&null!=this.onTestAPIPathStart&&(c=yield this.onTestAPIPathStart(d,g,l,f));let e=null;if(!0===c){c=g.testCases[l];if(null==c)throw Error(`HotTester: Test case object ${l} does not exist!`);e=yield c.func(this.driver)}return!1===a&&null!=this.onTestAPIPathEnd&&(yield this.onTestAPIPathEnd(d,g,l,e,f)),e})}executeTestAPIPaths(d){return k(this,void 0,void 0,function*(){let g=[];if(null==this.testMaps[d.mapName])throw Error(`HotTester: Map ${d.mapName} does not exist!`);
|
|
111
|
+
if(null==this.processor.api)throw Error("HotTester: Associated processor does not have an API!");let l=this.processor.api.routes[d.api];if(null==l)throw Error(`HotTester: API does not have route ${d.api}!`);for(let f=0;f<d.paths.length;f+=2){var a=l.getMethod(d.paths[f].path);a=yield this.executeTestAPIPath(d,a,d.paths[f+1].path);g.push(a)}return g})}executeTestPagePath(d,g,l=!1,a=!1){return k(this,void 0,void 0,function*(){let f=!0;var c=this.testMaps[d.mapName];if(null==c)throw Error(`HotTester: Map ${d.mapName} does not exist!`);
|
|
112
|
+
var e=c.pages[d.page];if(null==e)throw Error(`HotTester: Page ${d.page} does not exist!`);this.driver.page=e;c=g.path;let n=e.testPaths[c];!1===l&&null!=this.onTestPagePathStart&&(f=yield this.onTestPagePathStart(d,e,g,a));e=null;if(!0===f){if(null==n)throw Error(`HotTester: Test path ${c} does not have a function!`);e=yield n(this.driver)}return!1===l&&null!=this.onTestPagePathEnd&&(yield this.onTestPagePathEnd(d,n,e,a)),e})}executeCommand(d,g,l,a){return k(this,void 0,void 0,function*(){let f=(q,
|
|
113
|
+
m,v)=>{q=!1;l.cmd===m&&(q=!0);v=l.cmd.indexOf("(");-1<v&&l.cmd.substr(0,v)===m&&(q=!0);return q},c=q=>{let m=[];var v=q.match(/(?=\()(.*?)(?=\))/g);null!=v&&(v=v[0],v=v.substr(2,v.length),m.push(v));if(1>m.length)throw Error(`HotTester: Command ${q} requires arguments, but none were supplied.`);return m},e=null,n=[];if(!0===f(l.cmd,"waitForTesterAPIData")&&(e=q=>k(this,void 0,void 0,function*(){this.finishedLoading=!1;yield this.waitForData()})),!0===f(l.cmd,"wait")&&(n=c(l.cmd),e=q=>k(this,void 0,
|
|
114
|
+
void 0,function*(){let m=parseInt(q[0]);yield p.HotStaq.wait(m)})),!0===f(l.cmd,"url")&&(n=c(l.cmd),e=q=>k(this,void 0,void 0,function*(){yield this.driver.navigateToUrl(q[0])})),!0===f(l.cmd,"print")&&(n=c(l.cmd),e=q=>k(this,void 0,void 0,function*(){yield this.driver.print(q[0])})),!0===f(l.cmd,"println")&&(n=c(l.cmd),e=q=>k(this,void 0,void 0,function*(){yield this.driver.println(q[0])})),!0===f(l.cmd,"waitForTestObject")&&(n=c(l.cmd),e=q=>k(this,void 0,void 0,function*(){let m=JSON.parse(q[0]);
|
|
115
|
+
yield this.driver.waitForTestElement(m)})),null==e)throw Error(`HotTester: Command ${l.cmd} does not exist!`);yield this.onCommand(d,g,l,a,n,e)})}executeTestPagePaths(d,g=!1){return k(this,void 0,void 0,function*(){let l=[],a=this.testMaps[d.mapName];if(null==a)throw Error(`HotTester: Map ${d.mapName} does not exist!`);for(let c=0;c<d.paths.length;c++){let e=d.paths[c];var f=null;let n=a.pages[d.page];if(null==n)throw Error(`HotTester: Page ${d.page} does not exist!`);if(""!==e.dest){if(a.destinations instanceof
|
|
116
|
+
Array)throw Error(`HotTester: When using type 'dest' in a destination string, all destinations in map ${d.mapName} must be named.`);f=r.interpretDestination(d.mapName,a.destinations[e.dest]);f=yield this.executeTestPagePaths(f)}""!==e.cmd&&(yield this.executeCommand(d,n,e,e.cmd));""!==e.path&&(f=yield this.executeTestPagePath(d,e,!1,g));l.push(f)}return l})}execute(d){return k(this,void 0,void 0,function*(){let g=this.testMaps[d];if(null==g)throw Error(`HotTester: Map ${d} does not exist!`);var l=
|
|
117
|
+
this.processor.getRouteKeyFromName(d);let a="";""!==l&&(a=`${this.baseUrl}${l}`);l=(q,m="")=>k(this,void 0,void 0,function*(){if(!1!==q.autoStart){var v=r.interpretDestination(d,q),x=!1,F=!0;""!==v.page&&(x=!0);null!=this.setup&&!1===this.hasBeenSetup&&(yield this.setup(x,a,m),this.hasBeenSetup=!0,this.hasBeenDestroyed=!1);null!=this.onTestStart&&(F=yield this.onTestStart(v,a,m));!0===F&&(""!==v.page&&(yield this.executeTestPagePaths(v)),""!==v.api&&(yield this.executeTestAPIPaths(v)));null!=this.onTestEnd&&
|
|
118
|
+
(yield this.onTestEnd(v));null!=this.destroy&&!1===this.hasBeenDestroyed&&(yield this.destroy(),this.hasBeenDestroyed=!0,this.hasBeenSetup=!1)}});if(g.destinations instanceof Array)for(var f=0;f<g.destinations.length;f++)yield l(g.destinations[f]);else if(0<g.destinationOrder.length){var c=[];for(var e=0;e<g.destinationOrder.length;e++){var n=g.destinationOrder[e];let q=g.destinations[n];if(null==q)throw Error(`HotTester: Destination ${n} does not exist!`);c.push(n);yield l(q,n)}for(f in g.destinations){e=
|
|
119
|
+
!0;for(n=0;n<c.length;n++)if(c[n]===f){e=!1;break}!0===e&&(yield l(g.destinations[f],f))}}else for(c in g.destinations)yield l(g.destinations[c],c)})}}t.HotTester=r}]);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
if (typeof (HotStaqTests) === "undefined")
|
|
2
|
+
HotStaqTests = {};
|
|
3
|
+
|
|
4
|
+
var HotAPIGlobal = HotAPI;
|
|
5
|
+
|
|
6
|
+
if (typeof (HotAPIGlobal) === "undefined")
|
|
7
|
+
HotAPIGlobal = window.HotAPI;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The hello_world API route.
|
|
11
|
+
*/
|
|
12
|
+
class hello_world extends HotAPIGlobal
|
|
13
|
+
{
|
|
14
|
+
constructor (baseUrl, connection, db)
|
|
15
|
+
{
|
|
16
|
+
if (baseUrl == null)
|
|
17
|
+
baseUrl = "http://127.0.0.1:3123";
|
|
18
|
+
|
|
19
|
+
super (baseUrl, connection, db);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The base url to make calls to.
|
|
23
|
+
*/
|
|
24
|
+
this.baseUrl = baseUrl;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The hello method.
|
|
29
|
+
*/
|
|
30
|
+
hello (jsonObj)
|
|
31
|
+
{
|
|
32
|
+
var promise = new Promise (function (resolve, reject)
|
|
33
|
+
{
|
|
34
|
+
fetch (`${this.baseUrl}/v1/hello_world/hello`, {
|
|
35
|
+
"method": "POST",
|
|
36
|
+
"headers": {
|
|
37
|
+
"Accept": "application/json",
|
|
38
|
+
"Content-Type": "application/json"
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify (jsonObj)
|
|
41
|
+
}).then (function (response)
|
|
42
|
+
{
|
|
43
|
+
var result = response.json ();
|
|
44
|
+
|
|
45
|
+
resolve (result);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return (promise);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The is_up method.
|
|
55
|
+
*/
|
|
56
|
+
is_up (jsonObj)
|
|
57
|
+
{
|
|
58
|
+
var promise = new Promise (function (resolve, reject)
|
|
59
|
+
{
|
|
60
|
+
fetch (`${this.baseUrl}/v1/hello_world/is_up`, {
|
|
61
|
+
"method": "GET",
|
|
62
|
+
"headers": {
|
|
63
|
+
"Accept": "application/json",
|
|
64
|
+
"Content-Type": "application/json"
|
|
65
|
+
},
|
|
66
|
+
body: JSON.stringify (jsonObj)
|
|
67
|
+
}).then (function (response)
|
|
68
|
+
{
|
|
69
|
+
var result = response.json ();
|
|
70
|
+
|
|
71
|
+
resolve (result);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return (promise);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The file_upload method.
|
|
81
|
+
*/
|
|
82
|
+
file_upload (jsonObj)
|
|
83
|
+
{
|
|
84
|
+
var promise = new Promise (function (resolve, reject)
|
|
85
|
+
{
|
|
86
|
+
fetch (`${this.baseUrl}/v1/hello_world/file_upload`, {
|
|
87
|
+
"method": "POST",
|
|
88
|
+
"headers": {
|
|
89
|
+
"Accept": "application/json",
|
|
90
|
+
"Content-Type": "application/json"
|
|
91
|
+
},
|
|
92
|
+
body: JSON.stringify (jsonObj)
|
|
93
|
+
}).then (function (response)
|
|
94
|
+
{
|
|
95
|
+
var result = response.json ();
|
|
96
|
+
|
|
97
|
+
resolve (result);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return (promise);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The test_response method.
|
|
107
|
+
*/
|
|
108
|
+
test_response (jsonObj)
|
|
109
|
+
{
|
|
110
|
+
var promise = new Promise (function (resolve, reject)
|
|
111
|
+
{
|
|
112
|
+
fetch (`${this.baseUrl}/v1/hello_world/test_response`, {
|
|
113
|
+
"method": "POST",
|
|
114
|
+
"headers": {
|
|
115
|
+
"Accept": "application/json",
|
|
116
|
+
"Content-Type": "application/json"
|
|
117
|
+
},
|
|
118
|
+
body: JSON.stringify (jsonObj)
|
|
119
|
+
}).then (function (response)
|
|
120
|
+
{
|
|
121
|
+
var result = response.json ();
|
|
122
|
+
|
|
123
|
+
resolve (result);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return (promise);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
HotStaqTests.HelloWorldAPI = hello_world;
|
|
@@ -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
|
+
}
|