hotstaq 0.6.21 → 0.6.22
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/build/src/HotStaq.js +15 -2
- package/build/src/HotStaq.js.map +1 -1
- package/build-web/HotStaq.js +2 -2
- package/build-web/HotStaq.min.js +43 -42
- package/package.json +1 -1
- package/src/HotStaq.ts +21 -2
package/build-web/HotStaq.min.js
CHANGED
|
@@ -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
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
78
|
-
G.env&&(N=JSON.stringify(process.env[G.env]))}K+=`processor.publicKeys["${
|
|
79
|
-
let
|
|
80
|
-
null!=F&&(N=N.replace(/%args%/g,JSON.stringify(F)));
|
|
81
|
-
this.hotSite.routes&&null!=this.hotSite.routes[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 R in this.files){var Q=this.files[R],O=`"${Q.url}"`,S="";""!==Q.content&&(Q=JSON.stringify(Q.content),Q=Q.replace(RegExp("\\<script","gmi"),'<scr" + "ipt'),Q=Q.replace(RegExp("\\<\\/script","gmi"),'</scr" + "ipt'),S=`, "content": ${Q}`);T+=`\t\t\tfiles["${R}"] = { "url": ${O}${S} };\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)));R=a;Q=O="";S="Tester";return null!=this.hotSite&&(null!=this.hotSite.testing&&null!=this.hotSite.testing.web&&(null!=this.hotSite.testing.web.tester&&(S=this.hotSite.testing.web.tester),null!=this.hotSite.testing.web.testerName&&(S=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])&&(R=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,`"${S}"`).replace(/%tester_map%/g,`"${R}"`).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,36 +90,37 @@ 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.
|
|
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=(
|
|
95
|
-
0;ba<fa.length;ba++){let aa=fa[ba];if(null!=
|
|
96
|
-
null;let
|
|
97
|
-
H.errors[`${
|
|
98
|
-
void 0,
|
|
99
|
-
r.Hot.Mode);
|
|
100
|
-
window[J]);J=new L[K](G,B);J.connection.api=J;
|
|
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;
|
|
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,
|
|
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);
|
|
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,
|
|
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=
|
|
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,
|
|
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);
|
|
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}.`)
|
|
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!");
|
|
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!`);
|
|
111
|
-
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,
|
|
112
|
-
|
|
113
|
-
l=n=>p(this,void 0,void 0,function*(){yield this.driver.
|
|
114
|
-
for(let c=0;c<d.paths.length;c++){let b=d.paths[c],l=null,k=h.pages[d.page];if(null==k)throw Error(`HotTester: Page ${d.page} does not exist!`);if(""!==b.dest){if(h.destinations instanceof
|
|
115
|
-
yield this.executeTestPagePath(d,b,!1,g));m.push(l)}return m})}execute(d){return p(this,void 0,void 0,function*(){let g=this.testMaps[d];if(null==g)throw Error(`HotTester: Map ${d} does not exist!`);
|
|
116
|
-
!0,this.hasBeenDestroyed=!1);null!=this.onTestStart&&(y=yield this.onTestStart(t,h,r));!0===y&&(""!==t.page&&(yield this.executeTestPagePaths(t)),""!==t.api&&(yield this.executeTestAPIPaths(t)));null!=
|
|
117
|
-
[];for(var l=0;l<g.destinationOrder.length;l++){var k=g.destinationOrder[l];let n=g.destinations[k];if(null==n)throw Error(`HotTester: Destination ${k} does not exist!`);b.push(k);yield m(n,k)}for(c in g.destinations){l
|
|
118
|
-
function r(I){try{t(b.throw(I))}catch(y){k(y)}}function t(I){var y;I.done?l(I.value):(y=I.value,y instanceof c?y:new c(function(z){z(y)})).then(n,r)}t((b=b.apply(m,h||[])).next())})};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
pageName:b.pageName,testElements:b.testElements,testPathsStrs:b.testPaths};for(var n in k){var r=!1;if(null==k[n]&&(r=!0),""!=k.testerName&&
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
D.exports.
|
|
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.22",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||"",R={},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 S=
|
|
97
|
+
0;S<O.length;S++){var U=O[S],W=e(U,["status"]);U=e(U,["unsupported-browser-redirect"]);null!=U?H.errors.unsupportedBrowser={redirectToUrl:U}:H.errors[`${W}`]={redirectToUrl:U}}try{eval("async () => {}")}catch(Y){H.executeError("unsupportedBrowser")}if(""!==v)for(W=document.getElementsByTagName("hotstaq-router"),U=0;U<W.length;U++){S=W[U];var ca=e(S,["name"]);O=e(S,["serve-local","serveLocally"]);if(ca===v){for(v=0;v<S.childNodes.length;v++){var V=S.childNodes[v];if(V instanceof HTMLElement&&"ROUTE"===
|
|
98
|
+
V.tagName.toUpperCase()){W=e(V,["path"]);U=e(V,["redirect"]);ca=e(V,["base-redirect","baseRedirect"]);let Y=e(V,["base"]);V=e(V,["src"]);-1<W.indexOf("*")&&Q.push(W);R[W]={redirect:U||void 0,baseRedirect:ca||void 0,base:Y||void 0,src:V||void 0}}}e=window.location.pathname;null!=O&&(O=O.toLowerCase(),"true"===O||"yes"===O||"1"===O)&&(O=e.lastIndexOf("/"),-1<O&&(e=e.substring(O)));if(0<Q.length)for(O=0;O<Q.length;O++)if(v=Q[O],S=v.replace("*",""),-1<e.indexOf(S)){e=v;break}if(null!=R[e]){if(null!=R[e].redirect)return void(window.location.href=
|
|
99
|
+
R[e].redirect);if(null!=R[e].baseRedirect)return void(window.location.href=`${R[e].baseRedirect}?hstqbaseredirect=${encodeURI(e)}`);null!=R[e].src&&(w=R[e].src)}break}}A=null!=A?JSON.parse(A):r.Hot.Arguments;R=!1;""!==T&&""!==T.replace(/\s/g,"")&&(R=!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=Q;F={name:F,processor:T,args:A};if(""!==w&&(!1===X&&0>w.indexOf("hstqserve")&&
|
|
100
|
+
(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===R){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=
|
|
101
|
+
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=class{constructor(d,g=null){this.processor=d;this.page=g;this.commandDelay=20;
|
|
102
|
+
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,function*(){yield this.print(`${d}\n`)})}assert(d,g=""){return p(this,void 0,void 0,
|
|
103
|
+
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,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);
|
|
104
|
+
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=q,this.func=p,this.value=C):(this.name=q.name,this.func=q.func||p,this.value=q.value||C)}}},985:(D,
|
|
105
|
+
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=[];for(var d=0;d<p.length;d++)this.destinations.push(new q(p[d]))}else for(d in this.destinations=
|
|
106
|
+
{},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())})};Object.defineProperty(u,"__esModule",{value:!0});u.HotTester=void 0;const C=q(243);class x{constructor(d,
|
|
107
|
+
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,g){d={mapName:d,page:"",api:"",paths:[]};g=g.destination.split(/\->/g);
|
|
108
|
+
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,void 0,void 0,function*(){var b=!0;if(null==g)throw Error(`Trying to access null method on destination map ${d.mapName}.`);
|
|
109
|
+
!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=[];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!");
|
|
110
|
+
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,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!`);
|
|
111
|
+
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!`);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,
|
|
112
|
+
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=[];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,
|
|
113
|
+
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),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]);
|
|
114
|
+
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!`);for(let c=0;c<d.paths.length;c++){let b=d.paths[c],l=null,k=h.pages[d.page];if(null==k)throw Error(`HotTester: Page ${d.page} does not exist!`);if(""!==b.dest){if(h.destinations instanceof
|
|
115
|
+
Array)throw Error(`HotTester: When using type 'dest' in a destination string, all destinations in map ${d.mapName} must be named.`);let n=x.interpretDestination(d.mapName,h.destinations[b.dest]);null!=n&&(l=yield this.executeTestPagePaths(n))}""!==b.cmd&&(yield this.executeCommand(d,k,b,b.cmd));""!==b.path&&(l=yield this.executeTestPagePath(d,b,!1,g));m.push(l)}return m})}execute(d){return p(this,void 0,void 0,function*(){let g=this.testMaps[d];if(null==g)throw Error(`HotTester: Map ${d} does not exist!`);
|
|
116
|
+
var m=this.processor.getRouteKeyFromName(d);let h="";""!==m&&(h=`${this.baseUrl}${m}`);m=(n,r="")=>p(this,void 0,void 0,function*(){if(!1!==n.autoStart){var t=x.interpretDestination(d,n),I=!1,y=!0;""!==t.page&&(I=!0);null!=this.setup&&!1===this.hasBeenSetup&&(yield this.setup(I,h,r),this.hasBeenSetup=!0,this.hasBeenDestroyed=!1);null!=this.onTestStart&&(y=yield this.onTestStart(t,h,r));!0===y&&(""!==t.page&&(yield this.executeTestPagePaths(t)),""!==t.api&&(yield this.executeTestAPIPaths(t)));null!=
|
|
117
|
+
this.onTestEnd&&(yield this.onTestEnd(t));null!=this.destroy&&!1===this.hasBeenDestroyed&&(yield this.destroy(),this.hasBeenDestroyed=!0,this.hasBeenSetup=!1)}});if(g.destinations instanceof Array)for(var c=0;c<g.destinations.length;c++)yield m(g.destinations[c]);else if(0<g.destinationOrder.length){var b=[];for(var l=0;l<g.destinationOrder.length;l++){var k=g.destinationOrder[l];let n=g.destinations[k];if(null==n)throw Error(`HotTester: Destination ${k} does not exist!`);b.push(k);yield m(n,k)}for(c in g.destinations){l=
|
|
118
|
+
!0;for(k=0;k<b.length;k++)if(b[k]===c){l=!1;break}!0===l&&(yield m(g.destinations[c],c))}}else for(b in g.destinations)yield m(g.destinations[b],b)})}}u.HotTester=x},414:function(D,u,q){var p=this&&this.__awaiter||function(m,h,c,b){return new (c||(c=Promise))(function(l,k){function n(I){try{t(b.next(I))}catch(y){k(y)}}function r(I){try{t(b.throw(I))}catch(y){k(y)}}function t(I){var y;I.done?l(I.value):(y=I.value,y instanceof c?y:new c(function(z){z(y)})).then(n,r)}t((b=b.apply(m,h||[])).next())})};
|
|
119
|
+
Object.defineProperty(u,"__esModule",{value:!0});u.HotTesterAPI=void 0;const C=q(233),x=q(761),d=q(70);class g extends C.HotAPI{constructor(m,h=null,c=null){super(m,h,c);this.executeEventsUsing=C.EventExecutionType.HotAPI;m=new x.HotRoute(h,"tester");m.addMethod({name:"pageLoaded",onServerExecute:this.pageLoaded,parameters:{testerName:{required:!0,type:"string",description:"The name of the tester executing the test."},testerMap:{required:!0,type:"string",description:"The tester map executing the test."},
|
|
120
|
+
pageName:{required:!0,type:"string",description:"The name of the page executing the test."},testElements:{required:!0,type:"array",description:"The test elements on the page."},testPaths:{required:!0,type:"array",description:"The test paths on the page."}},returns:"Returns true as an acknowledgement."});m.addMethod({name:"executeTests",onServerExecute:this.executeTests,parameters:{testerName:{required:!0,type:"string",description:"The name of the tester executing the test."},testerMap:{required:!0,
|
|
121
|
+
type:"object",description:"The tester map to execute."}},returns:"Returns true when tests are complete."});m.addMethod({name:"heartbeat",type:d.HTTPMethod.GET,onServerExecute:this.heartbeat,returns:"Returns true as an acknowledgement."});this.addRoute(m)}pageLoaded(m,h,c,b,l){return p(this,void 0,void 0,function*(){let k={testerName:b.testerName,testerMap:b.testerMap,pageName:b.pageName,testElements:b.testElements,testPathsStrs:b.testPaths};for(var n in k){var r=!1;if(null==k[n]&&(r=!0),""!=k.testerName&&
|
|
122
|
+
""!==k.testerMap&&""!==k.testElements&&""!==k.testPathsStrs||(r=!0),!0===r)throw Error(`TesterAPI: Object ${n} was not passed.`);}k.testElements=JSON.parse(k.testElements);k.testPathsStrs=JSON.parse(k.testPathsStrs);n={};for(var t in k.testPathsStrs)r=eval(k.testPathsStrs[t]),n[t]=r;t=this.connection.processor.testers[k.testerName];if(null==t)throw Error(`TesterAPI: Tester ${k.testerMap} does not exist!`);r=t.testMaps[k.testerMap];if(null==r)throw Error(`TesterAPI: Tester map ${k.testerMap} does not exist!`);
|
|
123
|
+
return r.pages[k.pageName]={testElements:{},testPaths:{}},r.pages[k.pageName].testElements=k.testElements,r.pages[k.pageName].testPaths=n,t.finishedLoading=!0,null!=t.onFinishedLoading&&(yield t.onFinishedLoading()),!0})}executeTests(m,h,c,b,l){return p(this,void 0,void 0,function*(){let k=b.testerName,n=b.testerMap;if(null==k||null==n)throw Error("TesterAPI: Not all required json objects were passed.");if(""===k||""===n)throw Error("TesterAPI: Not all required json objects were passed.");let r=this.connection;
|
|
124
|
+
return null!=r.executeTests&&(yield r.executeTests(k,n)),!0})}heartbeat(m,h,c,b,l){return p(this,void 0,void 0,function*(){return!0})}}u.HotTesterAPI=g},859:(D,u,q)=>{Object.defineProperty(u,"__esModule",{value:!0});u=q(243);const p=q(507),C=q(260),x=q(732),d=q(802),g=q(136),m=q(233),h=q(761),c=q(70),b=q(810),l=q(957),k=q(628),n=q(967),r=q(677),t=q(414);q=q(985);u.HotStaq.isWeb=!0;D.exports.HotStaq=u.HotStaq;D.exports.Hot=p.Hot;D.exports.DeveloperMode=p.DeveloperMode;D.exports.HotComponent=C.HotComponent;
|
|
125
|
+
D.exports.HotAPI=m.HotAPI;D.exports.EventExecutionType=m.EventExecutionType;D.exports.HotFile=x.HotFile;D.exports.HotLog=d.HotLog;D.exports.HotLogLevel=d.HotLogLevel;D.exports.HotPage=g.HotPage;D.exports.HotRoute=h.HotRoute;D.exports.HotRouteMethod=c.HotRouteMethod;D.exports.HTTPMethod=c.HTTPMethod;D.exports.HotServer=b.HotServer;D.exports.HotServerType=b.HotServerType;D.exports.HotClient=l.HotClient;D.exports.HotTester=r.HotTester;D.exports.HotTesterAPI=t.HotTesterAPI;D.exports.HotTestMap=q.HotTestMap;
|
|
126
|
+
D.exports.HotTestDestination=q.HotTestDestination;D.exports.HotTestElement=n.HotTestElement;D.exports.HotTestElementOptions=n.HotTestElementOptions;D.exports.HotTestDriver=k.HotTestDriver},651:D=>{D.exports={}},351:()=>{},606:()=>{}},ea={};HotStaqWeb=da(859)})();
|
package/package.json
CHANGED
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.
|
|
435
|
+
static version: string = "0.6.22";
|
|
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
|
};
|
|
@@ -2724,6 +2736,13 @@ if (typeof (document) !== "undefined")
|
|
|
2724
2736
|
return;
|
|
2725
2737
|
}
|
|
2726
2738
|
|
|
2739
|
+
if (routerManager[tempPathname].baseRedirect != null)
|
|
2740
|
+
{
|
|
2741
|
+
window.location.href = `${routerManager[tempPathname].baseRedirect}?hstqbaseredirect=${encodeURI (tempPathname)}`;
|
|
2742
|
+
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2727
2746
|
if (routerManager[tempPathname].src != null)
|
|
2728
2747
|
loadPage = routerManager[tempPathname].src;
|
|
2729
2748
|
}
|