hotstaq 0.6.21 → 0.6.23

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.
@@ -58,15 +58,15 @@ for(let F of Array.from(w.querySelectorAll("area,base,br,col,command,embed,hr,im
58
58
  else for(var w=0;w<this.attributes.length;w++){var v=this.attributes[w],F=v.name.toLowerCase();v=v.value;if("id"===F&&(this.component.name=v),"name"===F&&(this.component.name=v),"value"===F&&(this.component.value=v),-1<F.indexOf("hot-"))F=F.substring(4),this.component[F]=v}if(null==this.component.onPreOutput||!1!==(yield this.component.onPreOutput()))for(F=yield this.component.output(),null!=this.component.onPostOutput&&(F=yield this.component.onPostOutput(F)),w=[],"string"==typeof F?w.push({html:F}):
59
59
  w=F instanceof Array?F:[F],F=0;F<w.length;F++){v=w[F];var A=v.html,J="";null!=v.addFunctionsTo&&(J=v.addFunctionsTo);A=l.HotFile.parseContent(A,!0,{outputCommands:!1});null!=this.component.onParsed&&(A=yield this.component.onParsed(A));A=null!=this.component.onFixHTML?yield this.component.onFixHTML(A):H.fixHTML(A);var K=null;if(K=null!=this.component.onParseDOM?yield this.component.onParseDOM(A.fixedStr):(new DOMParser).parseFromString(A.fixedStr,"text/html"),1>K.body.children.length)throw Error(`No component output from ${this.component.name}`);
60
60
  if(1<K.body.children.length){var G=!0;for(var B=0;B<K.body.children.length;B++){var L=K.body.children[B];if(L instanceof HTMLElement&&"parsererror"===L.tagName.toLowerCase()){G=!1;break}}if(!0===G)throw Error(`Only a single html element can come from component ${this.component.name}, multiple elements were detected.`);}K=""===A.querySelector?K.body.children[0]:K.querySelector(A.querySelector);A=[];for(G=this.children.length-1;-1<G;G--)A.push(this.removeChild(this.children[G]));this.replaceWith(K);
61
- null!=this.component.click&&(K.onclick=this.component.click.bind(this.component));for(let O in this.component.events)G=this.component.events[O],K.addEventListener(G.type,G.func,G.options);G=Object.getOwnPropertyNames(this.component.constructor.prototype);for(B=0;B<G.length;B++)if(L=G[B],"constructor"!==L&&"function"==typeof this.component[L]){let O=!0;for(let N in k.HotComponent.prototype)if(L===N){O=!1;break}!0===O&&(K[L]=H.keepContext(this.component[L],this.component),""!==J)&&(document.querySelector(J)[L]=
61
+ null!=this.component.click&&(K.onclick=this.component.click.bind(this.component));for(let P in this.component.events)G=this.component.events[P],K.addEventListener(G.type,G.func,G.options);G=Object.getOwnPropertyNames(this.component.constructor.prototype);for(B=0;B<G.length;B++)if(L=G[B],"constructor"!==L&&"function"==typeof this.component[L]){let P=!0;for(let N in k.HotComponent.prototype)if(L===N){P=!1;break}!0===P&&(K[L]=H.keepContext(this.component[L],this.component),""!==J)&&(document.querySelector(J)[L]=
62
62
  H.keepContext(this.component[L],this.component))}null!=this.component.onPrePlace&&(K=yield this.component.onPrePlace(K));J=yield this.component.onCreated(K);if(null!=this.component.onParentPlace&&(J.onParentPlace=this.component.onParentPlace),J.hotComponent=this.component,this.component.htmlElements.push(J),null!=v.parentSelector)K=document.querySelector(v.parentSelector),J.parentElement.removeChild(J),K.appendChild(J),null!=J.onParentPlace&&(yield J.hotComponent.onParentPlace(K,J));if(null!=v.placeHereParent)for(K=
63
63
  J.parentNode,G=0;10>G&&null!=K&&!(K instanceof HTMLHtmlElement);){B=K.querySelectorAll(`hot-place-here[name="${v.placeHereParent}"]`);if(0<B.length){v=B[0];J.parentNode.removeChild(J);v.appendChild(J);null!=J.onParentPlace&&(yield J.hotComponent.onParentPlace(v,J));break}if(1>B.length&&(B=K.querySelectorAll(`[hot-place-here="${v.placeHereParent}"]`),0<B.length)){v=B[0];J.parentNode.removeChild(J);v.appendChild(J);null!=J.onParentPlace&&(yield J.hotComponent.onParentPlace(v,J));break}K=K.parentNode;
64
64
  G++}for(v=0;v<A.length;v++)K=A[v],J.appendChild(K),null!=K.onParentPlace&&(yield K.hotComponent.onParentPlace(J,K));null!=this.component.onPostPlace&&(yield this.component.onPostPlace(J.parentNode,J))}})}},f)}}static addHtml(a,f){let e=null;if(e="string"==typeof a?document.querySelector(a):a,null==e)throw Error(`Unable to find parent ${a}!`);a=null;if("string"==typeof f){f=H.fixHTML(f);a=(new DOMParser).parseFromString(f.fixedStr,"text/html");f=""===f.querySelector?a.body.children:a.querySelector(f.querySelector).children;
65
65
  a=[];for(let w=0;w<f.length;w++)a.push(e.appendChild(f[w]));return a}return a=e.appendChild(f),a}static checkHotSiteName(a,f=!1){let e=(0,c.default)(a);if(null!=e.errors&&0<e.errors.length&&!0===f)throw Error(`HotSite ${a} has an invalid name! The name cannot be empty and must have a valid NPM module name.`);return!0}static replaceKey(a,f,e){return a.replace(new RegExp(`\\$\\{${f}\\}`,"g"),e)}static getValueFromHotSiteObj(a,f){let e=null;if(null!=a){for(let w=0;w<f.length;w++){let v=f[w];if(null==
66
- a[v]){a=null;break}a=a[v]}null!=a&&(e=a)}return e}processHotSite(){return x(this,void 0,void 0,function*(){H.checkHotSiteName(this.hotSite.name,!0);var a=this.hotSite.routes;let f="http://127.0.0.1:8182",e=null,w=null;if(!1===H.isWeb&&this.mode===r.DeveloperMode.Development&&null!=this.hotSite.testing){var v=B=>{let L=!0;null!=B.createNewTester&&(L=B.createNewTester);let O="Tester";if(null!=B.tester&&(O=B.tester),null!=B.testerName&&(O=B.testerName),!0===L?(z=Object(function(){var N=Error("Cannot find module './HotTesterMocha'");
67
- throw N.code="MODULE_NOT_FOUND",N;}()),E=Object(function(){var N=Error("Cannot find module './HotTesterMochaSelenium'");throw N.code="MODULE_NOT_FOUND",N;}()),M=Object(function(){var N=Error("Cannot find module './HotTestSeleniumDriver'");throw N.code="MODULE_NOT_FOUND",N;}()),""===B.testerAPIUrl&&(f=B.testerAPIUrl),"HotTestSeleniumDriver"===B.driver&&(w=new M),"HotTesterMocha"===B.tester&&(e=new z(this,O,f,w)),"HotTesterMochaSelenium"===B.tester&&(e=new E(this,O,f))):e=this.testers[O],null==e.driver)throw Error(`Tester ${O} does not have a driver set!`);
66
+ a[v]){a=null;break}a=a[v]}null!=a&&(e=a)}return e}processHotSite(){return x(this,void 0,void 0,function*(){H.checkHotSiteName(this.hotSite.name,!0);var a=this.hotSite.routes;let f="http://127.0.0.1:8182",e=null,w=null;if(!1===H.isWeb&&this.mode===r.DeveloperMode.Development&&null!=this.hotSite.testing){var v=B=>{let L=!0;null!=B.createNewTester&&(L=B.createNewTester);let P="Tester";if(null!=B.tester&&(P=B.tester),null!=B.testerName&&(P=B.testerName),!0===L?(z=Object(function(){var N=Error("Cannot find module './HotTesterMocha'");
67
+ throw N.code="MODULE_NOT_FOUND",N;}()),E=Object(function(){var N=Error("Cannot find module './HotTesterMochaSelenium'");throw N.code="MODULE_NOT_FOUND",N;}()),M=Object(function(){var N=Error("Cannot find module './HotTestSeleniumDriver'");throw N.code="MODULE_NOT_FOUND",N;}()),""===B.testerAPIUrl&&(f=B.testerAPIUrl),"HotTestSeleniumDriver"===B.driver&&(w=new M),"HotTesterMocha"===B.tester&&(e=new z(this,P,f,w)),"HotTesterMochaSelenium"===B.tester&&(e=new E(this,P,f))):e=this.testers[P],null==e.driver)throw Error(`Tester ${P} does not have a driver set!`);
68
68
  null!=B.commandDelay&&(e.driver.commandDelay=B.commandDelay)};null!=this.hotSite.testing.web&&v(this.hotSite.testing.web);null!=this.hotSite.testing.api&&v(this.hotSite.testing.api)}if(null!=a)for(var F in a){v=a[F];var A=new l.HotFile(v);A=new b.HotPage({processor:this,name:v.name||"",route:F,files:[A]});if(null!=e&&this.mode===r.DeveloperMode.Development){let B=v.name,L=null;if(null!=v.map){if("string"==typeof v.map){if(null==e.testMaps[v.map])throw Error(`Test map ${v.map} does not exist!`);e.testMaps[B]=
69
- e.testMaps[v.map]}else{L=new y.HotTestMap;let O=null;if(v.map instanceof Array){O=[];for(let N=0;N<v.map.length;N++)O.push(new y.HotTestDestination(v.map[N]))}else{O={};for(var J in v.map)O[J]=new y.HotTestDestination(v.map[J])}L.destinations=O}e.testMaps[B]=L}null!=v.destinationOrder&&(e.testMaps[B].destinationOrder=v.destinationOrder)}this.addPage(A)}if(null!=this.hotSite.apis)for(var K in this.hotSite.apis)if(a=this.hotSite.apis[K],null!=a.map&&!1===H.isWeb&&this.mode===r.DeveloperMode.Development){F=
69
+ e.testMaps[v.map]}else{L=new y.HotTestMap;let P=null;if(v.map instanceof Array){P=[];for(let N=0;N<v.map.length;N++)P.push(new y.HotTestDestination(v.map[N]))}else{P={};for(var J in v.map)P[J]=new y.HotTestDestination(v.map[J])}L.destinations=P}e.testMaps[B]=L}null!=v.destinationOrder&&(e.testMaps[B].destinationOrder=v.destinationOrder)}this.addPage(A)}if(null!=this.hotSite.apis)for(var K in this.hotSite.apis)if(a=this.hotSite.apis[K],null!=a.map&&!1===H.isWeb&&this.mode===r.DeveloperMode.Development){F=
70
70
  K;J=new y.HotTestMap;J.destinations=[];for(v=0;v<a.map.length;v++)J.destinations.push(new y.HotTestDestination(a.map[v]));if(null==e)throw Error("A tester was not created first! You must specify one in the CLI or in HotSite.json.");e.testMaps[F]=J}if(!0===H.isWeb)for(var G in this.hotSite.components)K=yield(0,h.default)(this.hotSite.components[G].url),K=eval(K),this.addComponent(K);null==this.hotSite.routes&&(this.hotSite.routes={});G=!1;null!=this.hotSite.disableFileLoading&&(G=this.hotSite.disableFileLoading);
71
71
  !1===G?yield this.loadHotFiles(this.hotSite.files):this.logger.verbose("Hotsite has file loading disabled...");null!=e&&this.addTester(e)})}loadHotSite(a){return x(this,void 0,void 0,function*(){var f="";!0===H.isWeb?(this.logger.info(`Downloading HotSite ${a}`),f=yield(0,h.default)(a),this.logger.info(`Downloaded site ${a}`),f=f.text()):(a=m.normalize(a),this.logger.info(`Accessing HotSite ${a}`),f=yield new Promise((e,w)=>{g.readFile(a,(v,F)=>{if(null!=v)throw v;v=F.toString();this.logger.info(`Accessed site ${a}`);
72
72
  e(v)})}));this.hotSite=JSON.parse(f);this.hotSite.hotsitePath=a})}loadHotFiles(a,f=!1){return x(this,void 0,void 0,function*(){this.logger.verbose("Loading Hott files...");for(let w in a){var e=a[w];let v;H.isWeb;v=new l.HotFile({name:w});null!=e.url&&(v.url=e.url);!1===H.isWeb&&null!=e.localFile&&(v.localFile=e.localFile);let F=!0;if(null!=e.content&&(v.content=e.content,F=!1),!0===f&&(F=!0),!0===F)e="",""!==v.url&&(e=v.url),""!==v.localFile&&(e=v.localFile),this.logger.verbose(`Loading Hott file: ${e}`),
@@ -74,11 +74,11 @@ yield v.load(),this.logger.verbose(`Finished loading Hott file: ${e}`);this.addF
74
74
  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.`)),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){A+=`\t<script type = "text/javascript" src = "${G.jsapi}"><\/script>\n`;
75
75
  B='""';null!=G.url&&(B=`"${G.url}"`);null!=this.api&&(B=`"${this.api.baseUrl}"`);var L=this.apiContent;L=L.replace(/%api_name%/g,G.apiName);L=L.replace(/%api_exported_name%/g,G.libraryName);L=L.replace(/%base_url%/g,B);J+=L}}}if(null!=this.hotSite.apis&&(B=this.hotSite.routes[a],null!=B&&null!=B.api)){G=this.hotSite.apis[B.api];if(null==G)throw Error(`Unable to find API ${B.api}`);L=!0;if(null==G.jsapi&&(L=!1,this.logger.warning(`API with name ${B.api} doesn't have a jsapi set. Will not send js content to client.`)),
76
76
  null==G.libraryName&&(L=!1,this.logger.warning(`API with name ${B.api} doesn't have a libraryName set. Will not send js content to client.`)),null==G.apiName&&(L=!1,this.logger.warning(`API with name ${B.api} doesn't have a apiName set. Will not send js content to client.`)),!0===L)A+=`\t<script type = "text/javascript" src = "${G.jsapi}"><\/script>\n`,B='""',null!=G.url&&(B=`"${G.url}"`),null!=this.api&&(B=`"${this.api.baseUrl}"`),L=this.apiContent,L=L.replace(/%api_name%/g,G.apiName),L=L.replace(/%api_exported_name%/g,
77
- G.libraryName),L=L.replace(/%base_url%/g,B),J+=L}if(null!=this.hotSite.server&&null!=this.hotSite.server.jsSrcPath&&(w=this.hotSite.server.jsSrcPath),null!=this.hotSite.publicKeys)for(var O in this.hotSite.publicKeys){let N;G=this.hotSite.publicKeys[O];if("string"==typeof G)N=JSON.stringify(G);else if(!1===H.isWeb){if(null!=this.api){if(null==this.api.connection)throw Error("Cannot pass secrets from the API if there's no connection!");B=this.api.connection;null!=G.passSecretFromAPI&&(N=JSON.stringify(B.secrets[O]))}null!=
78
- G.env&&(N=JSON.stringify(process.env[G.env]))}K+=`processor.publicKeys["${O}"] = ${N};\n`}}O=this.pageContent;return O=(N=>{let Y="",X="";this.mode===r.DeveloperMode.Development&&(Y="tempMode = HotStaqWeb.DeveloperMode.Development;",null!=this.hotSite&&null!=this.hotSite.testing&&null!=this.hotSite.testing.web&&(X=this.testerApiContent,null==this.hotSite.testing.web.testerAPIUrl&&(this.hotSite.testing.web.testerAPIUrl="http://127.0.0.1:8182"),X=X.replace(/%base_tester_url%/g,`"${this.hotSite.testing.web.testerAPIUrl}"`)));
79
- let S="";if(0<Object.keys(this.files).length){S+="var files = {};\n\n";for(var T in this.files){var Q=this.files[T],P=`"${Q.url}"`,R="";""!==Q.content&&(Q=JSON.stringify(Q.content),Q=Q.replace(RegExp("\\<script","gmi"),'<scr" + "ipt'),Q=Q.replace(RegExp("\\<\\/script","gmi"),'</scr" + "ipt'),R=`, "content": ${Q}`);S+=`\t\t\tfiles["${T}"] = { "url": ${P}${R} };\n`}S+="\t\t\tpromises.push (processor.loadHotFiles (files));\n"}N=N.replace(/%title%/g,f);!0===v&&(N=N.replace(/%args%/g,"Hot.Arguments"));
80
- null!=F&&(N=N.replace(/%args%/g,JSON.stringify(F)));T=a;Q=P="";R="Tester";return null!=this.hotSite&&(null!=this.hotSite.testing&&null!=this.hotSite.testing.web&&(null!=this.hotSite.testing.web.tester&&(R=this.hotSite.testing.web.tester),null!=this.hotSite.testing.web.testerName&&(R=this.hotSite.testing.web.testerName),null!=this.hotSite.testing.web.testerAPIUrl&&(P=this.hotSite.testing.web.testerAPIUrl),null!=this.hotSite.testing.web.launchpadUrl&&(Q=this.hotSite.testing.web.launchpadUrl)),null!=
81
- this.hotSite.routes&&null!=this.hotSite.routes[a])&&(T=this.hotSite.routes[a].name),N.replace(/%hotstaq_js_src%/g,w).replace(/%developer_mode%/g,Y).replace(/%tester_api%/g,X).replace(/%apis_to_load%/g,A).replace(/%load_hot_site%/g,"").replace(/%load_files%/g,S).replace(/%api_code%/g,J).replace(/%public_secrets%/g,K).replace(/%url%/g,e).replace(/%tester_name%/g,`"${R}"`).replace(/%tester_map%/g,`"${T}"`).replace(/%tester_api_base_url%/g,`"${P}"`).replace(/%tester_launchpad_url%/g,`"${Q}"`)})(O),O}createExpressRoutes(a,
77
+ G.libraryName),L=L.replace(/%base_url%/g,B),J+=L}if(null!=this.hotSite.server&&null!=this.hotSite.server.jsSrcPath&&(w=this.hotSite.server.jsSrcPath),null!=this.hotSite.publicKeys)for(var P in this.hotSite.publicKeys){let N;G=this.hotSite.publicKeys[P];if("string"==typeof G)N=JSON.stringify(G);else if(!1===H.isWeb){if(null!=this.api){if(null==this.api.connection)throw Error("Cannot pass secrets from the API if there's no connection!");B=this.api.connection;null!=G.passSecretFromAPI&&(N=JSON.stringify(B.secrets[P]))}null!=
78
+ G.env&&(N=JSON.stringify(process.env[G.env]))}K+=`processor.publicKeys["${P}"] = ${N};\n`}}P=this.pageContent;return P=(N=>{let Z="",X="";this.mode===r.DeveloperMode.Development&&(Z="tempMode = HotStaqWeb.DeveloperMode.Development;",null!=this.hotSite&&null!=this.hotSite.testing&&null!=this.hotSite.testing.web&&(X=this.testerApiContent,null==this.hotSite.testing.web.testerAPIUrl&&(this.hotSite.testing.web.testerAPIUrl="http://127.0.0.1:8182"),X=X.replace(/%base_tester_url%/g,`"${this.hotSite.testing.web.testerAPIUrl}"`)));
79
+ let T="";if(0<Object.keys(this.files).length){T+="var files = {};\n\n";for(var S in this.files){var Q=this.files[S],O=`"${Q.url}"`,R="";""!==Q.content&&(Q=JSON.stringify(Q.content),Q=Q.replace(RegExp("\\<script","gmi"),'<scr" + "ipt'),Q=Q.replace(RegExp("\\<\\/script","gmi"),'</scr" + "ipt'),R=`, "content": ${Q}`);T+=`\t\t\tfiles["${S}"] = { "url": ${O}${R} };\n`}T+="\t\t\tpromises.push (processor.loadHotFiles (files));\n"}N=N.replace(/%title%/g,f);!0===v&&(N=N.replace(/%args%/g,"Hot.Arguments"));
80
+ null!=F&&(N=N.replace(/%args%/g,JSON.stringify(F)));S=a;Q=O="";R="Tester";return null!=this.hotSite&&(null!=this.hotSite.testing&&null!=this.hotSite.testing.web&&(null!=this.hotSite.testing.web.tester&&(R=this.hotSite.testing.web.tester),null!=this.hotSite.testing.web.testerName&&(R=this.hotSite.testing.web.testerName),null!=this.hotSite.testing.web.testerAPIUrl&&(O=this.hotSite.testing.web.testerAPIUrl),null!=this.hotSite.testing.web.launchpadUrl&&(Q=this.hotSite.testing.web.launchpadUrl)),null!=
81
+ this.hotSite.routes&&null!=this.hotSite.routes[a])&&(S=this.hotSite.routes[a].name),N.replace(/%hotstaq_js_src%/g,w).replace(/%developer_mode%/g,Z).replace(/%tester_api%/g,X).replace(/%apis_to_load%/g,A).replace(/%load_hot_site%/g,"").replace(/%load_files%/g,T).replace(/%api_code%/g,J).replace(/%public_secrets%/g,K).replace(/%url%/g,e).replace(/%tester_name%/g,`"${R}"`).replace(/%tester_map%/g,`"${S}"`).replace(/%tester_api_base_url%/g,`"${O}"`).replace(/%tester_launchpad_url%/g,`"${Q}"`)})(P),P}createExpressRoutes(a,
82
82
  f="./js/HotStaq.min.js"){for(let e in this.pages){let w=this.pages[e];const v=this.generateContent(w.route,w.name,w.files[0].url,f);a.get(w.route,(F,A)=>{A.send(v)})}}addTester(a){this.testers[a.name]=a}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!");
83
83
  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!");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(a){let f="";if(null!=this.hotSite&&null!=
84
84
  this.hotSite.routes)for(let e in this.hotSite.routes)if(this.hotSite.routes[e].name===a){f=e;break}return f}getRouteFromName(a){let f=null;a=this.getRouteKeyFromName(a);return""!==a&&(f=this.hotSite.routes[a]),f}executeTests(a,f){return x(this,void 0,void 0,function*(){let e=this.testers[a];if(null==e)throw Error(`Unable to execute tests. Tester ${a} does not exist!`);return e.execute(f)})}executeAllWebTests(a){return x(this,void 0,void 0,function*(){let f=this.getWebTestingMaps();if(null==this.testers[a])throw Error(`Unable to execute tests. Tester ${a} does not exist!`);
@@ -90,24 +90,25 @@ if(0<f.length){let e=[];for(let w=0;w<f.length;w++)e.push(f[w]);for(let w=0;w<e.
90
90
  "";return a.mode===r.DeveloperMode.Development&&(f+='<script type = "text/javascript">\nfunction hotstaq_isDocumentReady ()\n{\nif (window["Hot"] != null)\n{\nif (Hot.Mode === HotStaqWeb.DeveloperMode.Development)\n{\nlet func = function ()\n\t{\n\t\tif (Hot.TesterAPI != null)\n\t\t{\n\t\t\tlet testPaths = {};\n\t\t\tlet testElements = JSON.stringify (Hot.CurrentPage.testElements);\n\t\t\tlet testMaps = JSON.stringify (Hot.CurrentPage.testMaps);\n\n\t\t\tfor (let key in Hot.CurrentPage.testPaths)\n\t\t\t{\n\t\t\t\tlet testPath = Hot.CurrentPage.testPaths[key];\n\n\t\t\t\ttestPaths[key] = testPath.toString ();\n\t\t\t}\n\n\t\t\tlet testPathsStr = JSON.stringify (testPaths);\n\n\t\t\tHot.TesterAPI.tester.pageLoaded ({\n\t\t\t\t\ttesterName: Hot.CurrentPage.testerName,\n\t\t\t\t\ttesterMap: Hot.CurrentPage.testerMap,\n\t\t\t\t\tpageName: Hot.CurrentPage.name,\n\t\t\t\t\ttestElements: testElements,\n\t\t\t\t\ttestPaths: testPathsStr\n\t\t\t\t}).then (function (resp)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (resp.error != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (resp.error !== "")\n\t\t\t\t\t\t\t\tthrow new Error (resp.error);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tHotStaqWeb.HotStaq.isReadyForTesting = true;\n\t\t\t\t\t});\n\t\t}\n\t};\n\nif ((document.readyState === "complete") || (document.readyState === "interactive"))\n\tfunc ();\nelse\n\tdocument.addEventListener ("DOMContentLoaded", func);\n}\n}\n}\n\nhotstaq_isDocumentReady ();\n\x3c/script>'),
91
91
  f}static displayUrl(a,f=null,e=null,w=null){return x(this,void 0,void 0,function*(){return new Promise((v,F)=>{H.onReady(()=>x(this,void 0,void 0,function*(){var A={url:""};A.name=null==f?"string"==typeof a?a:a.name:f;""===A.name&&(A.name="string"==typeof a?a:a.name);"string"==typeof a?A.url=a:(A.url=a.url,null==e&&null!=a.processor&&(e=a.processor),null==w&&null!=a.args&&(w=a.args),null!=a.testerMap&&(A.testerMap=a.testerMap),null!=a.testerName&&(A.testerName=a.testerName),null!=a.testerAPIBaseUrl&&
92
92
  (A.testerAPIBaseUrl=a.testerAPIBaseUrl));null==e&&(e=new H);H.setupTesters(e,A);A.processor=e;A.args=w;0>A.url.indexOf("hstqserve")&&(A.url+="?hstqserve=nahfam");A=yield H.processUrl(A);A+=H.setupClientTesters(e);yield H.useOutput(A);v(e)}))})})}static displayContent(a,f=null,e=null,w=null){return x(this,void 0,void 0,function*(){return new Promise((v,F)=>{H.onReady(()=>x(this,void 0,void 0,function*(){var A={content:""};A.name=null==f?"string"==typeof a?"":a.name:f;""===A.name&&(A.name="string"==
93
- typeof a?"":a.name);"string"==typeof a?A.content=a:(A.content=a.content,null==e&&null!=a.processor&&(e=a.processor),null==w&&null!=a.args&&(w=a.args),null!=a.testerMap&&(A.testerMap=a.testerMap),null!=a.testerName&&(A.testerName=a.testerName),null!=a.testerAPIBaseUrl&&(A.testerAPIBaseUrl=a.testerAPIBaseUrl));null==e&&(e=new H);H.setupTesters(e,A);A.processor=e;A.args=w;A=yield H.processContent(A);yield H.useOutput(A);v(e)}))})})}}if(u.HotStaq=H,H.version="0.6.21",H.isWeb=!1,H.isReadyForTesting=!1,
94
- H.onReadyForTesting=null,H.errors={},"undefined"!=typeof document)window.ethereum22=window.ethereum,window.addEventListener("load",function(){let a=document.getElementsByTagName("hotstaq");if(H.isWeb=!0,void 0!==HotStaqWeb&&(window.HotStaq=HotStaqWeb.HotStaq,window.HotClient=HotStaqWeb.HotClient,window.HotAPI=HotStaqWeb.HotAPI,window.Hot=HotStaqWeb.Hot,window.HotComponent=HotStaqWeb.HotComponent),0<a.length){let f=a[0];setTimeout(function(){return x(this,void 0,void 0,function*(){var e=(Z,fa)=>{for(let ba=
95
- 0;ba<fa.length;ba++){let aa=fa[ba];if(null!=Z.getAttribute(aa))return Z.getAttribute(aa);if(null!=Z.getAttribute(`data-${aa}`))return Z.getAttribute(`data-${aa}`)}};let w=e(f,["load-page","loadPage","src"])||"";var v=e(f,["router"])||"",F=e(f,["name"])||"default";let A=e(f,["args"])||null;var J=e(f,["api-library","apiLibrary"])||null;let K=e(f,["api-name","apiName"])||null,G=e(f,["api-url","apiUrl"])||null;var B=e(f,["tester-name","testerName"])||"HotTesterMochaSelenium",L=e(f,["tester-map","testerMap"])||
96
- null;let O=e(f,["tester-api-base-url","testerApiBaseUrl"])||null,N=e(f,["tester-launchpad-url","testerLaunchpadUrl"])||null,Y=!1,X=!1;var S=f.innerHTML||"",T={},Q=[];null!=e(f,["src"])&&(w=e(f,["src"]));null!=e(f,["passRawUrl"])&&(X=!0);null!=e(f,["dont-reuse-processor","dontReuseProcessor"])&&(Y=!0);var P=document.getElementsByTagName("hotstaq-error");for(var R=0;R<P.length;R++){var U=P[R],V=e(U,["status"]);U=e(U,["unsupported-browser-redirect"]);null!=U?H.errors.unsupportedBrowser={redirectToUrl:U}:
97
- H.errors[`${V}`]={redirectToUrl:U}}try{eval("async () => {}")}catch(Z){H.executeError("unsupportedBrowser")}if(""!==v)for(V=document.getElementsByTagName("hotstaq-router"),U=0;U<V.length;U++){R=V[U];var ca=e(R,["name"]);P=e(R,["serve-local","serveLocally"]);if(ca===v){for(v=0;v<R.childNodes.length;v++){var W=R.childNodes[v];W instanceof HTMLElement&&"ROUTE"===W.tagName.toUpperCase()&&(V=e(W,["path"]),U=e(W,["redirect"]),ca=e(W,["base"]),W=e(W,["src"]),-1<V.indexOf("*")&&Q.push(V),T[V]={redirect:U||
98
- void 0,base:ca||void 0,src:W||void 0})}e=window.location.pathname;null!=P&&(P=P.toLowerCase(),"true"===P||"yes"===P||"1"===P)&&(P=e.lastIndexOf("/"),-1<P&&(e=e.substring(P)));if(0<Q.length)for(P=0;P<Q.length;P++)if(R=Q[P],v=R.replace("*",""),-1<e.indexOf(v)){e=R;break}if(null!=T[e]){if(null!=T[e].redirect)return void(window.location.href=T[e].redirect);null!=T[e].src&&(w=T[e].src)}break}}A=null!=A?JSON.parse(A):r.Hot.Arguments;T=!1;""!==S&&""!==S.replace(/\s/g,"")&&(T=!0);Q=0;null!=window.Hot&&(Q=
99
- r.Hot.Mode);S=null;!1===Y&&void 0!==r.Hot&&null!=r.Hot.CurrentPage&&null!=r.Hot.CurrentPage.processor&&(S=r.Hot.CurrentPage.processor);null==S&&(S=new H);S.mode=Q;F={name:F,processor:S,args:A};if(""!==w&&(!1===X&&0>w.indexOf("hstqserve")&&(w+="?hstqserve=nahfam"),F.url=w),null!=L&&(F.testerMap=L,F.testerName=B),null!=B&&(F.testerName=B),null!=O&&(F.testerAPIBaseUrl=O),null!=N&&(F.testerLaunchpadUrl=N),null!=K){B=new t.HotClient(S);if(""===G)throw Error("api-url was not set!");L=window;null!=J&&(L=
100
- window[J]);J=new L[K](G,B);J.connection.api=J;S.api=J}if(!1===T){if(""===w)throw Error("The hotstaq tag must have a src, HTML contents inside it, or a router set.");H.displayUrl(F)}else H.displayContent(F)})},50)}})},628:function(D,u,q){var p=this&&this.__awaiter||function(d,g,m,h){return new (m||(m=Promise))(function(c,b){function l(r){try{n(h.next(r))}catch(t){b(t)}}function k(r){try{n(h.throw(r))}catch(t){b(t)}}function n(r){var t;r.done?c(r.value):(t=r.value,t instanceof m?t:new m(function(I){I(t)})).then(l,
101
- k)}n((h=h.apply(d,g||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0});u.HotTestDriver=void 0;const C=q(243),x=q(967);u.HotTestDriver=class{constructor(d,g=null){this.processor=d;this.page=g;this.commandDelay=20;this.persistentData={}}parseTestObject(d){let g=d.indexOf("*");var m="";-1<g&&(d=d.replace(/\*/,""),m="*");m=`[data-test-object-name${m}='${d}']`;return g=d.indexOf(">"),-1<g&&(m=d.replace(/>/,"")),m}wait(d){return p(this,void 0,void 0,function*(){return yield new Promise((g,
102
- m)=>{setTimeout(()=>{g()},d)})})}print(d){return p(this,void 0,void 0,function*(){process.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 h=0;h<d.length;h++){var m=d[h];let c=null,b="",l="";if("string"==typeof m){if(c=this.page.testElements[m],null==c)throw Error(`HotTestDriver: Unable to find test element ${m}`);
103
- b=c.func;l=c.value}if(m instanceof Array){let k=m[0];c=this.page.testElements[k];null==c?(c=new x.HotTestElement(k),b=m[1],l=m[2]):(b=c.func,l=c.value,1<m.length&&(b=m[1]),2<m.length&&(l=m[2]))}c.func=b;c.value=l;m=yield this.runCommand(c);yield C.HotStaq.wait(this.commandDelay);g.push(m)}return g})}}},967:(D,u)=>{Object.defineProperty(u,"__esModule",{value:!0});u.HotTestElement=u.HotTestElementOptions=void 0;u.HotTestElementOptions=class{constructor(q={}){this.mustBeVisible=q.mustBeVisible||!0;this.ignoreMissingElementError=
104
- q.ignoreMissingElementError||!1}};u.HotTestElement=class{constructor(q,p="",C=null){"string"==typeof q?(this.name=q,this.func=p,this.value=C):(this.name=q.name,this.func=q.func||p,this.value=q.value||C)}}},985:(D,u)=>{Object.defineProperty(u,"__esModule",{value:!0});u.HotTestMap=u.HotTestDestination=void 0;class q{constructor(p="",C=!0){"string"==typeof p?(this.destination=p,this.autoStart=C):p instanceof q?(this.destination=p.destination,this.autoStart=p.autoStart):(this.destination=p.path,this.autoStart=
105
- p.autoStart)}}u.HotTestDestination=q;u.HotTestMap=class{constructor(p=[],C={},x=[]){if(p instanceof Array){this.destinations=[];for(var d=0;d<p.length;d++)this.destinations.push(new q(p[d]))}else for(d in this.destinations={},p)this.destinations[d]=new q(p[d]);this.destinationOrder=x;this.pages=C}}},677:function(D,u,q){var p=this&&this.__awaiter||function(d,g,m,h){return new (m||(m=Promise))(function(c,b){function l(r){try{n(h.next(r))}catch(t){b(t)}}function k(r){try{n(h.throw(r))}catch(t){b(t)}}
106
- function n(r){var t;r.done?c(r.value):(t=r.value,t instanceof m?t:new m(function(I){I(t)})).then(l,k)}n((h=h.apply(d,g||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0});u.HotTester=void 0;const C=q(243);class x{constructor(d,g,m,h,c={}){this.processor=d;this.name=g;this.baseUrl=m;this.testMaps=c;this.driver=h;this.hasBeenDestroyed=this.hasBeenSetup=this.finishedLoading=!1}waitForData(){return p(this,void 0,void 0,function*(){for(;!1===this.finishedLoading;)yield C.HotStaq.wait(10)})}getTestPage(d){return this.testMaps[d.mapName].pages[d.page]}getTestPath(d,
107
- 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 m=g[0];if(2>m.length||"/"===m[0]&&"/"===m[1])return null;let h=(c,b)=>{let l=c.indexOf(b),k="";return-1<l&&(k=c.substr(l+b.length),k=k.trim()),k};d.page=h(m,"page:");d.api=h(m,"api:");for(m=1;m<g.length;m++){let c=g[m],b={cmd:"",dest:"",path:""};c=c.trim();b.dest=h(c,"dest:");b.cmd=h(c,"cmd:");b.path=h(c,"path:");""==b.dest&&""==b.cmd&&
108
- ""==b.path&&(b.path=c);d.paths.push(b)}return d}executeTestAPIPath(d,g,m,h=!1,c=!1){return p(this,void 0,void 0,function*(){var b=!0;if(null==g)throw Error(`Trying to access null method on destination map ${d.mapName}.`);!1===h&&null!=this.onTestAPIPathStart&&(b=yield this.onTestAPIPathStart(d,g,m,c));let l=null;if(!0===b){b=g.testCases[m];if(null==b)throw Error(`HotTester: Test case object ${m} does not exist!`);l=yield b.func(this.driver)}return!1===h&&null!=this.onTestAPIPathEnd&&(yield this.onTestAPIPathEnd(d,
109
- g,m,l,c)),l})}executeTestAPIPaths(d){return p(this,void 0,void 0,function*(){let g=[];if(null==this.testMaps[d.mapName])throw Error(`HotTester: Map ${d.mapName} does not exist!`);if(null==this.processor.api)throw Error("HotTester: Associated processor does not have an API!");let m=this.processor.api.routes[d.api];if(null==m)throw Error(`HotTester: API does not have route ${d.api}!`);for(let c=0;c<d.paths.length;c+=2){var h=d.paths[c].path;let b=m.getMethod(h),l=d.paths[c+1].path;if(null==b)throw Error(`Unable to find method related to path ${h} in map ${d.mapName}`);
110
- h=yield this.executeTestAPIPath(d,b,l);g.push(h)}return g})}executeTestPagePath(d,g,m=!1,h=!1){return p(this,void 0,void 0,function*(){let c=!0;var b=this.testMaps[d.mapName];if(null==b)throw Error(`HotTester: Map ${d.mapName} does not exist!`);var l=b.pages[d.page];if(null==l)throw Error(`HotTester: Page ${d.page} does not exist!`);this.driver.page=l;b=g.path;let k=l.testPaths[b];!1===m&&null!=this.onTestPagePathStart&&(c=yield this.onTestPagePathStart(d,l,g,h));l=null;if(!0===c){if(null==k)throw Error(`HotTester: Test path ${b} does not have a function!`);
93
+ typeof a?"":a.name);"string"==typeof a?A.content=a:(A.content=a.content,null==e&&null!=a.processor&&(e=a.processor),null==w&&null!=a.args&&(w=a.args),null!=a.testerMap&&(A.testerMap=a.testerMap),null!=a.testerName&&(A.testerName=a.testerName),null!=a.testerAPIBaseUrl&&(A.testerAPIBaseUrl=a.testerAPIBaseUrl));null==e&&(e=new H);H.setupTesters(e,A);A.processor=e;A.args=w;A=yield H.processContent(A);yield H.useOutput(A);v(e)}))})})}}if(u.HotStaq=H,H.version="0.6.23",H.isWeb=!1,H.isReadyForTesting=!1,
94
+ H.onReadyForTesting=null,H.errors={},"undefined"!=typeof document)window.ethereum22=window.ethereum,window.addEventListener("load",function(){let a=document.getElementsByTagName("hotstaq");if(H.isWeb=!0,void 0!==HotStaqWeb&&(window.HotStaq=HotStaqWeb.HotStaq,window.HotClient=HotStaqWeb.HotClient,window.HotAPI=HotStaqWeb.HotAPI,window.Hot=HotStaqWeb.Hot,window.HotComponent=HotStaqWeb.HotComponent),0<a.length){let f=a[0];setTimeout(function(){return x(this,void 0,void 0,function*(){var e=(Y,fa)=>{for(let ba=
95
+ 0;ba<fa.length;ba++){let aa=fa[ba];if(null!=Y.getAttribute(aa))return Y.getAttribute(aa);if(null!=Y.getAttribute(`data-${aa}`))return Y.getAttribute(`data-${aa}`)}};let w=e(f,["load-page","loadPage","src"])||"";var v=e(f,["router"])||"",F=e(f,["name"])||"default";let A=e(f,["args"])||null;var J=e(f,["api-library","apiLibrary"])||null;let K=e(f,["api-name","apiName"])||null,G=e(f,["api-url","apiUrl"])||null;var B=e(f,["tester-name","testerName"])||"HotTesterMochaSelenium",L=e(f,["tester-map","testerMap"])||
96
+ null;let P=e(f,["tester-api-base-url","testerApiBaseUrl"])||null,N=e(f,["tester-launchpad-url","testerLaunchpadUrl"])||null,Z=!1,X=!1;var T=f.innerHTML||"",S={},Q=[],O=new URLSearchParams(window.location.search);null!=e(f,["src"])&&(w=e(f,["src"]));null!=e(f,["passRawUrl"])&&(X=!0);null!=e(f,["dont-reuse-processor","dontReuseProcessor"])&&(Z=!0);O=O.get("hstqbaseredirect");null!=O&&(O=decodeURI(O),window.history.replaceState("","",O),w=O);O=document.getElementsByTagName("hotstaq-error");for(var R=
97
+ 0;R<O.length;R++){var U=O[R],V=e(U,["status"]);U=e(U,["unsupported-browser-redirect"]);null!=U?H.errors.unsupportedBrowser={redirectToUrl:U}:H.errors[`${V}`]={redirectToUrl:U}}try{eval("async () => {}")}catch(Y){H.executeError("unsupportedBrowser")}if(""!==v)for(V=document.getElementsByTagName("hotstaq-router"),U=0;U<V.length;U++){R=V[U];var ca=e(R,["name"]);O=e(R,["serve-local","serveLocally"]);if(ca===v){for(v=0;v<R.childNodes.length;v++){var W=R.childNodes[v];if(W instanceof HTMLElement&&"ROUTE"===
98
+ W.tagName.toUpperCase()){V=e(W,["path"]);U=e(W,["redirect"]);ca=e(W,["base-redirect","baseRedirect"]);let Y=e(W,["base"]);W=e(W,["src"]);-1<V.indexOf("*")&&Q.push(V);S[V]={redirect:U||void 0,baseRedirect:ca||void 0,base:Y||void 0,src:W||void 0}}}v=e=window.location.pathname;null!=O&&(O=O.toLowerCase(),"true"===O||"yes"===O||"1"===O)&&(O=e.lastIndexOf("/"),-1<O&&(e=e.substring(O),v=v.substring(O)));if(0<Q.length)for(O=0;O<Q.length;O++)if(R=Q[O],V=R.replace("*",""),-1<e.indexOf(V)){e=R;break}if(null!=
99
+ S[e]){if(null!=S[e].redirect)return void(window.location.href=S[e].redirect);if(null!=S[e].baseRedirect)return void(window.location.href=`${S[e].baseRedirect}?hstqbaseredirect=${encodeURI(v)}`);null!=S[e].src&&(w=S[e].src)}break}}A=null!=A?JSON.parse(A):r.Hot.Arguments;S=!1;""!==T&&""!==T.replace(/\s/g,"")&&(S=!0);Q=0;null!=window.Hot&&(Q=r.Hot.Mode);T=null;!1===Z&&void 0!==r.Hot&&null!=r.Hot.CurrentPage&&null!=r.Hot.CurrentPage.processor&&(T=r.Hot.CurrentPage.processor);null==T&&(T=new H);T.mode=
100
+ Q;F={name:F,processor:T,args:A};if(""!==w&&(!1===X&&0>w.indexOf("hstqserve")&&(w+="?hstqserve=nahfam"),F.url=w),null!=L&&(F.testerMap=L,F.testerName=B),null!=B&&(F.testerName=B),null!=P&&(F.testerAPIBaseUrl=P),null!=N&&(F.testerLaunchpadUrl=N),null!=K){B=new t.HotClient(T);if(""===G)throw Error("api-url was not set!");L=window;null!=J&&(L=window[J]);J=new L[K](G,B);J.connection.api=J;T.api=J}if(!1===S){if(""===w)throw Error("The hotstaq tag must have a src, HTML contents inside it, or a router set.");
101
+ H.displayUrl(F)}else H.displayContent(F)})},50)}})},628:function(D,u,q){var p=this&&this.__awaiter||function(d,g,m,h){return new (m||(m=Promise))(function(c,b){function l(r){try{n(h.next(r))}catch(t){b(t)}}function k(r){try{n(h.throw(r))}catch(t){b(t)}}function n(r){var t;r.done?c(r.value):(t=r.value,t instanceof m?t:new m(function(I){I(t)})).then(l,k)}n((h=h.apply(d,g||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0});u.HotTestDriver=void 0;const C=q(243),x=q(967);u.HotTestDriver=
102
+ class{constructor(d,g=null){this.processor=d;this.page=g;this.commandDelay=20;this.persistentData={}}parseTestObject(d){let g=d.indexOf("*");var m="";-1<g&&(d=d.replace(/\*/,""),m="*");m=`[data-test-object-name${m}='${d}']`;return g=d.indexOf(">"),-1<g&&(m=d.replace(/>/,"")),m}wait(d){return p(this,void 0,void 0,function*(){return yield new Promise((g,m)=>{setTimeout(()=>{g()},d)})})}print(d){return p(this,void 0,void 0,function*(){process.stdout.write(d)})}println(d){return p(this,void 0,void 0,
103
+ 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 h=0;h<d.length;h++){var m=d[h];let c=null,b="",l="";if("string"==typeof m){if(c=this.page.testElements[m],null==c)throw Error(`HotTestDriver: Unable to find test element ${m}`);b=c.func;l=c.value}if(m instanceof Array){let k=m[0];c=this.page.testElements[k];null==c?(c=new x.HotTestElement(k),b=m[1],l=m[2]):(b=c.func,
104
+ l=c.value,1<m.length&&(b=m[1]),2<m.length&&(l=m[2]))}c.func=b;c.value=l;m=yield this.runCommand(c);yield C.HotStaq.wait(this.commandDelay);g.push(m)}return g})}}},967:(D,u)=>{Object.defineProperty(u,"__esModule",{value:!0});u.HotTestElement=u.HotTestElementOptions=void 0;u.HotTestElementOptions=class{constructor(q={}){this.mustBeVisible=q.mustBeVisible||!0;this.ignoreMissingElementError=q.ignoreMissingElementError||!1}};u.HotTestElement=class{constructor(q,p="",C=null){"string"==typeof q?(this.name=
105
+ q,this.func=p,this.value=C):(this.name=q.name,this.func=q.func||p,this.value=q.value||C)}}},985:(D,u)=>{Object.defineProperty(u,"__esModule",{value:!0});u.HotTestMap=u.HotTestDestination=void 0;class q{constructor(p="",C=!0){"string"==typeof p?(this.destination=p,this.autoStart=C):p instanceof q?(this.destination=p.destination,this.autoStart=p.autoStart):(this.destination=p.path,this.autoStart=p.autoStart)}}u.HotTestDestination=q;u.HotTestMap=class{constructor(p=[],C={},x=[]){if(p instanceof Array){this.destinations=
106
+ [];for(var d=0;d<p.length;d++)this.destinations.push(new q(p[d]))}else for(d in this.destinations={},p)this.destinations[d]=new q(p[d]);this.destinationOrder=x;this.pages=C}}},677:function(D,u,q){var p=this&&this.__awaiter||function(d,g,m,h){return new (m||(m=Promise))(function(c,b){function l(r){try{n(h.next(r))}catch(t){b(t)}}function k(r){try{n(h.throw(r))}catch(t){b(t)}}function n(r){var t;r.done?c(r.value):(t=r.value,t instanceof m?t:new m(function(I){I(t)})).then(l,k)}n((h=h.apply(d,g||[])).next())})};
107
+ Object.defineProperty(u,"__esModule",{value:!0});u.HotTester=void 0;const C=q(243);class x{constructor(d,g,m,h,c={}){this.processor=d;this.name=g;this.baseUrl=m;this.testMaps=c;this.driver=h;this.hasBeenDestroyed=this.hasBeenSetup=this.finishedLoading=!1}waitForData(){return p(this,void 0,void 0,function*(){for(;!1===this.finishedLoading;)yield C.HotStaq.wait(10)})}getTestPage(d){return this.testMaps[d.mapName].pages[d.page]}getTestPath(d,g){return this.testMaps[d.mapName].pages[d.page].testPaths[g]}static interpretDestination(d,
108
+ g){d={mapName:d,page:"",api:"",paths:[]};g=g.destination.split(/\->/g);var m=g[0];if(2>m.length||"/"===m[0]&&"/"===m[1])return null;let h=(c,b)=>{let l=c.indexOf(b),k="";return-1<l&&(k=c.substr(l+b.length),k=k.trim()),k};d.page=h(m,"page:");d.api=h(m,"api:");for(m=1;m<g.length;m++){let c=g[m],b={cmd:"",dest:"",path:""};c=c.trim();b.dest=h(c,"dest:");b.cmd=h(c,"cmd:");b.path=h(c,"path:");""==b.dest&&""==b.cmd&&""==b.path&&(b.path=c);d.paths.push(b)}return d}executeTestAPIPath(d,g,m,h=!1,c=!1){return p(this,
109
+ void 0,void 0,function*(){var b=!0;if(null==g)throw Error(`Trying to access null method on destination map ${d.mapName}.`);!1===h&&null!=this.onTestAPIPathStart&&(b=yield this.onTestAPIPathStart(d,g,m,c));let l=null;if(!0===b){b=g.testCases[m];if(null==b)throw Error(`HotTester: Test case object ${m} does not exist!`);l=yield b.func(this.driver)}return!1===h&&null!=this.onTestAPIPathEnd&&(yield this.onTestAPIPathEnd(d,g,m,l,c)),l})}executeTestAPIPaths(d){return p(this,void 0,void 0,function*(){let g=
110
+ [];if(null==this.testMaps[d.mapName])throw Error(`HotTester: Map ${d.mapName} does not exist!`);if(null==this.processor.api)throw Error("HotTester: Associated processor does not have an API!");let m=this.processor.api.routes[d.api];if(null==m)throw Error(`HotTester: API does not have route ${d.api}!`);for(let c=0;c<d.paths.length;c+=2){var h=d.paths[c].path;let b=m.getMethod(h),l=d.paths[c+1].path;if(null==b)throw Error(`Unable to find method related to path ${h} in map ${d.mapName}`);h=yield this.executeTestAPIPath(d,
111
+ b,l);g.push(h)}return g})}executeTestPagePath(d,g,m=!1,h=!1){return p(this,void 0,void 0,function*(){let c=!0;var b=this.testMaps[d.mapName];if(null==b)throw Error(`HotTester: Map ${d.mapName} does not exist!`);var l=b.pages[d.page];if(null==l)throw Error(`HotTester: Page ${d.page} does not exist!`);this.driver.page=l;b=g.path;let k=l.testPaths[b];!1===m&&null!=this.onTestPagePathStart&&(c=yield this.onTestPagePathStart(d,l,g,h));l=null;if(!0===c){if(null==k)throw Error(`HotTester: Test path ${b} does not have a function!`);
111
112
  l=yield k(this.driver)}return!1===m&&null!=this.onTestPagePathEnd&&(yield this.onTestPagePathEnd(d,k,l,h)),l})}executeCommand(d,g,m,h){return p(this,void 0,void 0,function*(){let c=(n,r,t)=>{n=!1;m.cmd===r&&(n=!0);t=m.cmd.indexOf("(");return-1<t&&m.cmd.substr(0,t)===r&&(n=!0),n},b=n=>{let r=[];var t=n.match(/(?=\()(.*?)(?=\))/g);null!=t&&(t=t[0],t=t.substr(2,t.length),r.push(t));if(1>r.length)throw Error(`HotTester: Command ${n} requires arguments, but none were supplied.`);return r},l=null,k=[];
112
113
  if(!0===c(m.cmd,"waitForTesterAPIData")&&(l=n=>p(this,void 0,void 0,function*(){this.finishedLoading=!1;yield this.waitForData()})),!0===c(m.cmd,"wait")&&(k=b(m.cmd),l=n=>p(this,void 0,void 0,function*(){let r=parseInt(n[0]);yield C.HotStaq.wait(r)})),!0===c(m.cmd,"url")&&(k=b(m.cmd),l=n=>p(this,void 0,void 0,function*(){yield this.driver.navigateToUrl(n[0])})),!0===c(m.cmd,"print")&&(k=b(m.cmd),l=n=>p(this,void 0,void 0,function*(){yield this.driver.print(n[0])})),!0===c(m.cmd,"println")&&(k=b(m.cmd),
113
114
  l=n=>p(this,void 0,void 0,function*(){yield this.driver.println(n[0])})),!0===c(m.cmd,"waitForTestObject")&&(k=b(m.cmd),l=n=>p(this,void 0,void 0,function*(){let r=JSON.parse(n[0]);yield this.driver.waitForTestElement(r)})),null==l)throw Error(`HotTester: Command ${m.cmd} does not exist!`);yield this.onCommand(d,g,m,h,k,l)})}executeTestPagePaths(d,g=!1){return p(this,void 0,void 0,function*(){let m=[],h=this.testMaps[d.mapName];if(null==h)throw Error(`HotTester: Map ${d.mapName} does not exist!`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hotstaq",
3
- "version": "0.6.21",
3
+ "version": "0.6.23",
4
4
  "description": "A friendly web framework that fits nicely into devops and CI/CD pipelines.",
5
5
  "bin": {
6
6
  "hotstaq": "./bin/hotstaq"
package/src/HotStaq.ts CHANGED
@@ -432,7 +432,7 @@ export class HotStaq implements IHotStaq
432
432
  /**
433
433
  * The current version of HotStaq.
434
434
  */
435
- static version: string = "0.6.21";
435
+ static version: string = "0.6.23";
436
436
  /**
437
437
  * Indicates if this is a web build.
438
438
  */
@@ -2601,8 +2601,9 @@ if (typeof (document) !== "undefined")
2601
2601
  let dontReuseProcessor: boolean = false;
2602
2602
  let passRawUrl: boolean = false;
2603
2603
  let htmlSource: string = hotstaqElm.innerHTML || "";
2604
- let routerManager: { [path: string]: { redirect: string; base: string; src: string; } } = {};
2604
+ let routerManager: { [path: string]: { redirect: string; baseRedirect: string; base: string; src: string; } } = {};
2605
2605
  let routerWildcards: string[] = [];
2606
+ let search: URLSearchParams = new URLSearchParams (window.location.search);
2606
2607
 
2607
2608
  if (getAttr (hotstaqElm, ["src"]) != null)
2608
2609
  loadPage = getAttr (hotstaqElm, ["src"]);
@@ -2613,6 +2614,15 @@ if (typeof (document) !== "undefined")
2613
2614
  if (getAttr (hotstaqElm, ["dont-reuse-processor", "dontReuseProcessor"]) != null)
2614
2615
  dontReuseProcessor = true;
2615
2616
 
2617
+ let hstqbaseredirect: string = search.get ("hstqbaseredirect");
2618
+
2619
+ if (hstqbaseredirect != null)
2620
+ {
2621
+ hstqbaseredirect = decodeURI (hstqbaseredirect);
2622
+ window.history.replaceState ("", "", hstqbaseredirect);
2623
+ loadPage = hstqbaseredirect;
2624
+ }
2625
+
2616
2626
  let hotstaqErrors = document.getElementsByTagName ("hotstaq-error");
2617
2627
 
2618
2628
  for (let iIdx = 0; iIdx < hotstaqErrors.length; iIdx++)
@@ -2664,6 +2674,7 @@ if (typeof (document) !== "undefined")
2664
2674
  {
2665
2675
  let routerPath: string = getAttr (routerElm, ["path"]);
2666
2676
  let redirect: string = getAttr (routerElm, ["redirect"]);
2677
+ let baseRedirect: string = getAttr (routerElm, ["base-redirect", "baseRedirect"]);
2667
2678
  let base: string = getAttr (routerElm, ["base"]);
2668
2679
  let routerSrc: string = getAttr (routerElm, ["src"]);
2669
2680
 
@@ -2672,6 +2683,7 @@ if (typeof (document) !== "undefined")
2672
2683
 
2673
2684
  routerManager[routerPath] = {
2674
2685
  redirect: redirect || undefined,
2686
+ baseRedirect: baseRedirect || undefined,
2675
2687
  base: base || undefined,
2676
2688
  src: routerSrc || undefined
2677
2689
  };
@@ -2679,7 +2691,8 @@ if (typeof (document) !== "undefined")
2679
2691
  }
2680
2692
  }
2681
2693
 
2682
- let tempPathname: string = window.location.pathname;
2694
+ let checkPath: string = window.location.pathname;
2695
+ let gotoPath: string = window.location.pathname;
2683
2696
 
2684
2697
  if (serveLocally != null)
2685
2698
  {
@@ -2689,10 +2702,13 @@ if (typeof (document) !== "undefined")
2689
2702
  (lowerServeLocally === "yes") ||
2690
2703
  (lowerServeLocally === "1"))
2691
2704
  {
2692
- const lastSlashPos: number = tempPathname.lastIndexOf ("/");
2705
+ const lastSlashPos: number = checkPath.lastIndexOf ("/");
2693
2706
 
2694
2707
  if (lastSlashPos > -1)
2695
- tempPathname = tempPathname.substring (lastSlashPos);
2708
+ {
2709
+ checkPath = checkPath.substring (lastSlashPos);
2710
+ gotoPath = gotoPath.substring (lastSlashPos);
2711
+ }
2696
2712
  }
2697
2713
  }
2698
2714
 
@@ -2705,9 +2721,10 @@ if (typeof (document) !== "undefined")
2705
2721
  let routeWildcard: string = routerWildcards[iJdx];
2706
2722
  let tempRouteWildcard: string = routeWildcard.replace ("*", "");
2707
2723
 
2708
- if (tempPathname.indexOf (tempRouteWildcard) > -1)
2724
+ if (checkPath.indexOf (tempRouteWildcard) > -1)
2709
2725
  {
2710
- tempPathname = routeWildcard;
2726
+ // This simply returns the key in the routerManager to access.
2727
+ checkPath = routeWildcard;
2711
2728
 
2712
2729
  break;
2713
2730
  }
@@ -2715,17 +2732,24 @@ if (typeof (document) !== "undefined")
2715
2732
  }
2716
2733
 
2717
2734
  // Find the correct route and load it.
2718
- if (routerManager[tempPathname] != null)
2735
+ if (routerManager[checkPath] != null)
2719
2736
  {
2720
- if (routerManager[tempPathname].redirect != null)
2737
+ if (routerManager[checkPath].redirect != null)
2738
+ {
2739
+ window.location.href = routerManager[checkPath].redirect;
2740
+
2741
+ return;
2742
+ }
2743
+
2744
+ if (routerManager[checkPath].baseRedirect != null)
2721
2745
  {
2722
- window.location.href = routerManager[tempPathname].redirect;
2746
+ window.location.href = `${routerManager[checkPath].baseRedirect}?hstqbaseredirect=${encodeURI (gotoPath)}`;
2723
2747
 
2724
2748
  return;
2725
2749
  }
2726
2750
 
2727
- if (routerManager[tempPathname].src != null)
2728
- loadPage = routerManager[tempPathname].src;
2751
+ if (routerManager[checkPath].src != null)
2752
+ loadPage = routerManager[checkPath].src;
2729
2753
  }
2730
2754
 
2731
2755
  break;