hotstaq 0.9.38 → 0.9.39
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/HotRouteMethod.d.ts +8 -0
- package/build/src/HotRouteMethod.d.ts.map +1 -1
- package/build/src/HotRouteMethod.js +3 -0
- package/build/src/HotRouteMethod.js.map +1 -1
- package/build/src/HotStaq.js +1 -1
- package/build-web/HotStaq.js +2 -2
- package/build-web/HotStaq.min.js +14 -14
- package/package.json +1 -1
- package/src/HotRouteMethod.ts +18 -5
- package/src/HotStaq.ts +1 -1
package/build-web/HotStaq.min.js
CHANGED
|
@@ -161,19 +161,19 @@ function A(F){var I;F.done?m(F.value):(I=F.value,I instanceof p?I:new p(function
|
|
|
161
161
|
"post_and_websocket_client_pub_event"}(e||(k.HotEventMethod=e={}));(function(a){a[a.ReturnToClient=0]="ReturnToClient";a[a.Update=1]="Update";a[a.Ignore=2]="Ignore"})(c||(k.PassType=c={}));k.ServerRequest=(()=>class{constructor(a=null){null==a&&(a={});this.req=a.req||null;this.res=a.res||null;this.bearerToken=a.bearerToken||"";this.wsSocket=a.wsSocket||null;this.authorizedValue=a.authorizedValue||null;this.jsonObj=a.jsonObj||null;this.queryObj=a.queryObj||null;this.files=a.files||null;this.onClose=
|
|
162
162
|
a.onClose||null}httpWrite(a,b){return q(this,void 0,void 0,function*(){if(null==this.res)throw Error("Cannot close HTTP response because it is null!");return new Promise((p,g)=>{!0===this.res.writable?(g=b,"string"!=typeof b&&(g=JSON.stringify(b)),this.res.write(`event: ${a}\ndata: ${g}\n\n`,m=>{if(null!=m)throw m;p()})):p()})})}httpWriteRaw(a){return q(this,void 0,void 0,function*(){if(null==this.res)throw Error("Cannot close HTTP response because it is null!");return new Promise((b,p)=>{!0===this.res.writable?
|
|
163
163
|
this.res.write(a,g=>{if(null!=g)throw g;b()}):b()})})}httpClose(){if(null==this.res)throw Error("Cannot close HTTP response because it is null!");this.res.end()}})();(function(a){a.UUID="UUID";a.Boolean="boolean";a.Number="number";a.Integer="Integer";a.Float="Float";a.Text="Text";a.Email="Email";a.Phone="Phone";a.URL="URL";a.IPv4="IPv4";a.IP="IP";a.IPv6="IPv6";a.Date="Date";a.Object="Object";a.Array="Array";a.Map="Map";a.Enum="Enum";a.JSON="JSON";a.JS="JS";a.Undefined="undefined";a.Null="null"})(d||
|
|
164
|
-
(k.HotValidationType=d={}));class f{constructor(){this.route=null;this.description=this.name="";this.openAPI=null;this.tags=[];this.returns=null;this.validateQueryInput=new l.ValidationOptions;this.validateJSONInput=new l.ValidationOptions;this.parametersRefName="";this.parameters={};this.queryParameters={};this.type=e.POST;this.isRegistered=!1;this.executeSetup=!0;this.testCases={};this.onValidateJSONInput=this.onValidateQueryInput=this.onClientExecute=this.onServerExecute=this.
|
|
165
|
-
this.onPostRegister=this.onRegister=this.onPreRegister=null}static create(a,b="",p=null,g=e.POST,m=null,t=null,B=null){var C=new f;if(a instanceof x.HotRoute)var A=a;else{if(A=a.route,null!=a.type&&(g=a.type),null!=a.name&&(b=a.name),null!=a.name&&(C.tags=a.tags),null!=a.description&&(C.description=a.description),null!=a.openAPI&&(C.openAPI=a.openAPI),null!=a.validateQueryInput&&(C.validateQueryInput=a.validateQueryInput),null!=a.validateJSONInput&&(C.validateJSONInput=a.validateJSONInput),
|
|
166
|
-
a.parametersRefName&&(C.parametersRefName=a.parametersRefName),null!=a.queryParameters&&(C.queryParameters=a.queryParameters),null!=a.returns&&("string"==typeof a.returns?C.returns={type:"string",required:!0,description:a.returns}:(a.returns,C.returns=a.returns)),null!=a.parameters)if(a.parameters instanceof Function)C.parameters=a.parameters;else for(let F in a.parameters){let I=a.parameters[F];"string"==typeof I?C.parameters[F]={type:"string",required:!1,description:I}:("function"==typeof I||
|
|
167
|
-
I.type&&(I.type="string"),C.parameters[F]=I)}null!=a.onServerExecute&&(p=a.onServerExecute);null!=a.onServerAuthorize&&(m=a.onServerAuthorize);null!=a.onRegister&&(t=a.onRegister);null!=a.onPostRegister&&(C.onPostRegister=a.onPostRegister);null!=a.
|
|
168
|
-
null!=a.testCases&&(B=a.testCases)}if(""===b)throw Error("All route methods must have a name!");if(C.route=A,C.name=b,C.type=g,C.isRegistered=!1,C.executeSetup=!1,C.onServerAuthorize=m,C.onRegister=t,C.testCases={},C.route.connection.processor.mode===n.DeveloperMode.Development&&null!=B)if(B instanceof Array)for(a=0;a<B.length;a++)b=B[a],"string"==typeof b?(C.addTestCase(b,B[a+1]),a++):C.addTestCase(b);else for(let F in B)C.addTestCase(B[F]);
|
|
169
|
-
p),C}addTestCase(a,b=null){if("string"==typeof a)return void(this.testCases[a]={name:a,func:b});if("function"==typeof a)return b=Object.keys(this.testCases).length,b=`${this.route.route}/${this.name} test case ${b}`,void(this.testCases[b]={name:b,func:a});this.testCases[a.name]=a}getRouteUrl(){if(null==this.route)throw Error(`Route method ${this.name} does not have a parent route!`);var a="/";return""!==this.route.version&&(a+=`${this.route.version}/`),
|
|
170
|
-
""!==this.route.route&&(a+=`${this.route.route}/`),a+=this.name,a}}k.HotRouteMethod=f},[3205](E,k,r){var q=this&&this.__awaiter||function(h,l,e,c){return new (e||(e=Promise))(function(d,f){function a(g){try{p(c.next(g))}catch(m){f(m)}}function b(g){try{p(c.throw(g))}catch(m){f(m)}}function p(g){var m;g.done?d(g.value):(m=g.value,m instanceof e?m:new e(function(t){t(m)})).then(a,b)}p((c=c.apply(h,l||[])).next())})};Object.defineProperty(k,"__esModule",
|
|
171
|
-
var n=r(9343),x;!function(h){h[h.HTTP=0]="HTTP";h[h.WebSockets=1]="WebSockets";h[h.Generate=2]="Generate";h[h.WebTesting=3]="WebTesting";h[h.APITesting=4]="APITesting"}(x||(k.HotServerType=x={}));k.HotServer=(()=>class{constructor(h){h instanceof n.HotStaq?(this.processor=h,this.serverType="Server",this.api=null,this.listenAddress="0.0.0.0",this.ports={http:5E3,https:443},this.ssl={cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=!0,this.type=x.HTTP,this.logger=
|
|
172
|
-
h.processor,this.serverType=h.serverType||"Server",this.api=h.api||null,this.listenAddress=h.listenAddress||"0.0.0.0",this.ports=h.ports||{http:5E3,https:443},this.ssl=h.ssl||{cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=null==h.redirectHTTPtoHTTPS||h.redirectHTTPtoHTTPS,this.type=h.type||x.HTTP,this.logger=h.logger,this.secrets=h.secrets||{})}setAPI(h){return q(this,void 0,void 0,function*(){this.api=this.processor.api=h})}})()},[5269](E,k){Object.defineProperty(k,
|
|
173
|
-
k,r){var q=this&&this.__createBinding||(Object.create?function(u,v,y,w){void 0===w&&(w=y);var G=Object.getOwnPropertyDescriptor(v,y);G&&("get"in G?v.__esModule:!G.writable&&!G.configurable)||(G={enumerable:!0,get:function(){return v[y]}});Object.defineProperty(u,w,G)}:function(u,v,y,w){void 0===w&&(w=y);u[w]=v[y]}),n=this&&this.__setModuleDefault||(Object.create?function(u,v){Object.defineProperty(u,"default",{enumerable:!0,value:v})}:function(u,v){u.default=v});
|
|
174
|
-
Object.getOwnPropertyNames||function(v){var y=[],w;for(w in v)Object.prototype.hasOwnProperty.call(v,w)&&(y[y.length]=w);return y},x(u)},function(u){if(u&&u.__esModule)return u;var v={};if(null!=u)for(var y=x(u),w=0;w<y.length;w++)"default"!==y[w]&&q(v,u,y[w]);return n(v,u),v});var x,h=this&&this.__awaiter||function(u,v,y,w){return new (y||(y=Promise))(function(G,L){function Q(S){try{Z(w.next(S))}catch(V){L(V)}}function K(S){try{Z(w.throw(S))}catch(V){L(V)}}
|
|
175
|
-
S.value,V instanceof y?V:new y(function(da){da(V)})).then(Q,K)}Z((w=w.apply(u,v||[])).next())})},l=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(k,"__esModule",{value:!0});k.HotStaq=k.HotValidReturnType=void 0;var e=E(r(9247)),c=l(r(2365)),d=l(r(7963)),f=l(r(5454)),a=r(5989),b=r(8296),p=r(3622);E=r(6044);var g=r(1814),m=r(5472),t=r(3025),B=r(6681),C=r(6434),A=r(4744),F=r(6019);l=r(6061);var I=r(9844),R=
|
|
176
|
-
0]="Delete";u[u.Return=1]="Return";u[u.Ignore=2]="Ignore"}(ba||(k.HotValidReturnType=ba={}));class D{constructor(u={}){this.logger=new p.HotLog(p.HotLogLevel.All);this.startDelay=0;this.api=u.api||null;this.testerAPI=u.testerAPI||null;this.mode=u.mode||g.DeveloperMode.Production;this.pages=u.pages||{};this.modules=u.modules||{};this.components=u.components||{};this.files=u.files||{};this.hotSite=u.hotSite||null;this.apiContent="\n\t\t\t{\n\t\t\t\tvar %api_name% = %api_exported_name%.%api_name%;\n\t\t\t\tvar newHotClient = new HotClient (processor);\n\t\t\t\tvar newapi = new %api_name% (%base_url%, newHotClient);\n\t\t\t\tnewHotClient.api = newapi;\n\t\t\t\tprocessor.api = newapi;\n\t\t\t}";
|
|
164
|
+
(k.HotValidationType=d={}));class f{constructor(){this.route=null;this.description=this.name="";this.openAPI=null;this.tags=[];this.returns=null;this.validateQueryInput=new l.ValidationOptions;this.validateJSONInput=new l.ValidationOptions;this.parametersRefName="";this.parameters={};this.queryParameters={};this.type=e.POST;this.isRegistered=!1;this.executeSetup=!0;this.testCases={};this.onValidateJSONInput=this.onValidateQueryInput=this.onClientExecute=this.onServerExecute=this.onServerPreExecute=
|
|
165
|
+
this.onServerAuthorize=this.onPostRegister=this.onRegister=this.onPreRegister=null}static create(a,b="",p=null,g=e.POST,m=null,t=null,B=null){var C=new f;if(a instanceof x.HotRoute)var A=a;else{if(A=a.route,null!=a.type&&(g=a.type),null!=a.name&&(b=a.name),null!=a.name&&(C.tags=a.tags),null!=a.description&&(C.description=a.description),null!=a.openAPI&&(C.openAPI=a.openAPI),null!=a.validateQueryInput&&(C.validateQueryInput=a.validateQueryInput),null!=a.validateJSONInput&&(C.validateJSONInput=a.validateJSONInput),
|
|
166
|
+
null!=a.parametersRefName&&(C.parametersRefName=a.parametersRefName),null!=a.queryParameters&&(C.queryParameters=a.queryParameters),null!=a.returns&&("string"==typeof a.returns?C.returns={type:"string",required:!0,description:a.returns}:(a.returns,C.returns=a.returns)),null!=a.parameters)if(a.parameters instanceof Function)C.parameters=a.parameters;else for(let F in a.parameters){let I=a.parameters[F];"string"==typeof I?C.parameters[F]={type:"string",required:!1,description:I}:("function"==typeof I||
|
|
167
|
+
null==I.type&&(I.type="string"),C.parameters[F]=I)}null!=a.onServerExecute&&(p=a.onServerExecute);null!=a.onServerAuthorize&&(m=a.onServerAuthorize);null!=a.onRegister&&(t=a.onRegister);null!=a.onPostRegister&&(C.onPostRegister=a.onPostRegister);null!=a.onServerPreExecute&&(C.onServerPreExecute=a.onServerPreExecute);null!=a.onServerExecute&&(C.onServerExecute=a.onServerExecute);null!=a.onClientExecute&&(C.onClientExecute=a.onClientExecute);null!=a.onValidateQueryInput&&(C.onValidateQueryInput=a.onValidateQueryInput);
|
|
168
|
+
null!=a.onValidateJSONInput&&(C.onValidateJSONInput=a.onValidateJSONInput);null!=a.testCases&&(B=a.testCases)}if(""===b)throw Error("All route methods must have a name!");if(C.route=A,C.name=b,C.type=g,C.isRegistered=!1,C.executeSetup=!1,C.onServerAuthorize=m,C.onRegister=t,C.testCases={},C.route.connection.processor.mode===n.DeveloperMode.Development&&null!=B)if(B instanceof Array)for(a=0;a<B.length;a++)b=B[a],"string"==typeof b?(C.addTestCase(b,B[a+1]),a++):C.addTestCase(b);else for(let F in B)C.addTestCase(B[F]);
|
|
169
|
+
return C.route.connection instanceof h.HotServer&&(C.onServerExecute=p),C}addTestCase(a,b=null){if("string"==typeof a)return void(this.testCases[a]={name:a,func:b});if("function"==typeof a)return b=Object.keys(this.testCases).length,b=`${this.route.route}/${this.name} test case ${b}`,void(this.testCases[b]={name:b,func:a});this.testCases[a.name]=a}getRouteUrl(){if(null==this.route)throw Error(`Route method ${this.name} does not have a parent route!`);var a="/";return""!==this.route.version&&(a+=`${this.route.version}/`),
|
|
170
|
+
""!==this.route.prefix&&(a+=`${this.route.prefix}/`),""!==this.route.route&&(a+=`${this.route.route}/`),a+=this.name,a}}k.HotRouteMethod=f},[3205](E,k,r){var q=this&&this.__awaiter||function(h,l,e,c){return new (e||(e=Promise))(function(d,f){function a(g){try{p(c.next(g))}catch(m){f(m)}}function b(g){try{p(c.throw(g))}catch(m){f(m)}}function p(g){var m;g.done?d(g.value):(m=g.value,m instanceof e?m:new e(function(t){t(m)})).then(a,b)}p((c=c.apply(h,l||[])).next())})};Object.defineProperty(k,"__esModule",
|
|
171
|
+
{value:!0});k.HotServer=k.HotServerType=void 0;var n=r(9343),x;!function(h){h[h.HTTP=0]="HTTP";h[h.WebSockets=1]="WebSockets";h[h.Generate=2]="Generate";h[h.WebTesting=3]="WebTesting";h[h.APITesting=4]="APITesting"}(x||(k.HotServerType=x={}));k.HotServer=(()=>class{constructor(h){h instanceof n.HotStaq?(this.processor=h,this.serverType="Server",this.api=null,this.listenAddress="0.0.0.0",this.ports={http:5E3,https:443},this.ssl={cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=!0,this.type=x.HTTP,this.logger=
|
|
172
|
+
h.logger,this.secrets={}):(this.processor=h.processor,this.serverType=h.serverType||"Server",this.api=h.api||null,this.listenAddress=h.listenAddress||"0.0.0.0",this.ports=h.ports||{http:5E3,https:443},this.ssl=h.ssl||{cert:"",key:"",ca:""},this.redirectHTTPtoHTTPS=null==h.redirectHTTPtoHTTPS||h.redirectHTTPtoHTTPS,this.type=h.type||x.HTTP,this.logger=h.logger,this.secrets=h.secrets||{})}setAPI(h){return q(this,void 0,void 0,function*(){this.api=this.processor.api=h})}})()},[5269](E,k){Object.defineProperty(k,
|
|
173
|
+
"__esModule",{value:!0})},[9343](E,k,r){var q=this&&this.__createBinding||(Object.create?function(u,v,y,w){void 0===w&&(w=y);var G=Object.getOwnPropertyDescriptor(v,y);G&&("get"in G?v.__esModule:!G.writable&&!G.configurable)||(G={enumerable:!0,get:function(){return v[y]}});Object.defineProperty(u,w,G)}:function(u,v,y,w){void 0===w&&(w=y);u[w]=v[y]}),n=this&&this.__setModuleDefault||(Object.create?function(u,v){Object.defineProperty(u,"default",{enumerable:!0,value:v})}:function(u,v){u.default=v});
|
|
174
|
+
E=this&&this.__importStar||(x=function(u){return x=Object.getOwnPropertyNames||function(v){var y=[],w;for(w in v)Object.prototype.hasOwnProperty.call(v,w)&&(y[y.length]=w);return y},x(u)},function(u){if(u&&u.__esModule)return u;var v={};if(null!=u)for(var y=x(u),w=0;w<y.length;w++)"default"!==y[w]&&q(v,u,y[w]);return n(v,u),v});var x,h=this&&this.__awaiter||function(u,v,y,w){return new (y||(y=Promise))(function(G,L){function Q(S){try{Z(w.next(S))}catch(V){L(V)}}function K(S){try{Z(w.throw(S))}catch(V){L(V)}}
|
|
175
|
+
function Z(S){var V;S.done?G(S.value):(V=S.value,V instanceof y?V:new y(function(da){da(V)})).then(Q,K)}Z((w=w.apply(u,v||[])).next())})},l=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(k,"__esModule",{value:!0});k.HotStaq=k.HotValidReturnType=void 0;var e=E(r(9247)),c=l(r(2365)),d=l(r(7963)),f=l(r(5454)),a=r(5989),b=r(8296),p=r(3622);E=r(6044);var g=r(1814),m=r(5472),t=r(3025),B=r(6681),C=r(6434),A=r(4744),F=r(6019);l=r(6061);var I=r(9844),R=
|
|
176
|
+
r(6801),O=r(8374),ba;!function(u){u[u.Delete=0]="Delete";u[u.Return=1]="Return";u[u.Ignore=2]="Ignore"}(ba||(k.HotValidReturnType=ba={}));class D{constructor(u={}){this.logger=new p.HotLog(p.HotLogLevel.All);this.startDelay=0;this.api=u.api||null;this.testerAPI=u.testerAPI||null;this.mode=u.mode||g.DeveloperMode.Production;this.pages=u.pages||{};this.modules=u.modules||{};this.components=u.components||{};this.files=u.files||{};this.hotSite=u.hotSite||null;this.apiContent="\n\t\t\t{\n\t\t\t\tvar %api_name% = %api_exported_name%.%api_name%;\n\t\t\t\tvar newHotClient = new HotClient (processor);\n\t\t\t\tvar newapi = new %api_name% (%base_url%, newHotClient);\n\t\t\t\tnewHotClient.api = newapi;\n\t\t\t\tprocessor.api = newapi;\n\t\t\t}";
|
|
177
177
|
this.testerApiContent="\n\t\t\tvar HotTesterAPI = HotStaqWeb.HotTesterAPI;\n\t\t\tvar newHotTesterClient = new HotClient (processor);\n\t\t\tvar newtesterapi = new HotTesterAPI (%base_tester_url%, newHotTesterClient);\n\t\t\tnewHotTesterClient.testerAPI = newtesterapi;\n\t\t\tprocessor.testerAPI = newtesterapi;";this.pageContent='<!DOCTYPE html>\n<html>\n\n<head>\n\t<title>%title%</title>\n\n\t<script type = "text/javascript" src = "%hotstaq_js_src%">\x3c/script>\n\t<script type = "text/javascript">\n\t\twindow.hotstaqStartingApp = true;\n\n\t\tfor (let key in HotStaqWeb)\n\t\t\twindow[key] = HotStaqWeb[key];\n\t\x3c/script>\n\n%apis_to_load%\n\n\t<script type = "text/javascript">\n\t\tasync function hotstaq_startApp ()\n\t\t{\n\t\t\tlet tempMode = 0;\n\n\t\t\tif (window["Hot"] != null)\n\t\t\t\ttempMode = Hot.Mode;\n\n\t\t\t%start_delay%\n\n\t\t\tvar processor = new HotStaq ();\n\t\t\tprocessor.logger.logLevel = %logging_level%;\n\n\t\t\tvar promises = [];\n\t\t\t%developer_mode%\n\n\t\t\t%api_code%\n\n\t\t\t%public_secrets%\n\t\t\t%tester_api%\n\t\t\t%load_files%\n\n\t\t\tprocessor.mode = tempMode;\n\n\t\t\tPromise.all (promises).then (function ()\n\t\t\t\t{\n\t\t\t\t\tHotStaq.displayUrl ({\n\t\t\t\t\t\t\turl: "%url%",\n\t\t\t\t\t\t\tname: "%title%",\n\t\t\t\t\t\t\tprocessor: processor,\n\t\t\t\t\t\t\targs: %args%,\n\t\t\t\t\t\t\ttesterName: %tester_name%,\n\t\t\t\t\t\t\ttesterMap: %tester_map%,\n\t\t\t\t\t\t\ttesterAPIBaseUrl: %tester_api_base_url%,\n\t\t\t\t\t\t\ttesterLaunchpadUrl: %tester_launchpad_url%\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\n\t\thotstaq_startApp ();\n\t\x3c/script>\n</head>\n\n<body>\n</body>\n\n</html>';
|
|
178
178
|
this.publicKeys={};this.testers={}}static baseValidator(u,v,y,w,G=4096){if(null==y.max&&"string"==typeof w&&w.length>G)throw new O.HttpError(`Parameter '${v}' is longer than ${G} characters.`,400);if(y.notEmptyOrNull){if(null==w)throw Error(`Parameter '${v}' must not be empty or null.`);if("string"==typeof w&&""===w)throw Error(`Parameter '${v}' must not be empty or null.`);}if(y.comparison){u=y.comparison;if(void 0!==u.greaterThan&&!(w>u.greaterThan))throw Error(`Parameter '${v}' must be greater than ${u.greaterThan}.`);
|
|
179
179
|
if(void 0!==u.lessThan&&!(w<u.lessThan))throw Error(`Parameter '${v}' must be less than ${u.lessThan}.`);if(void 0!==u.eq&&w!==u.eq)throw Error(`Parameter '${v}' must equal ${u.eq}.`);if(void 0!==u.not&&w===u.not)throw Error(`Parameter '${v}' must not equal ${u.not}.`);}if(y.values&&y.values.length>0&&!y.values.includes(w))throw Error(`Parameter '${v}' must be one of the allowed values.`);return!0}static setupValidators(){D.valids[void 0]=function(u,v,y,w,G){if(void 0!==w&&!0===u.strictInput)throw new O.HttpError(`Parameter '${v}' must be undefined.`,
|
|
@@ -249,7 +249,7 @@ v}static reportTestPaths(u){return h(this,void 0,void 0,function*(){if(null!=u&&
|
|
|
249
249
|
testElements:y,testPaths:v});if(null!=y.error&&""!==y.error)throw Error(y.error);D.isReadyForTesting=!0}})}static onInitalLoad(u){"complete"===document.readyState||"interactive"===document.readyState?u():window.addEventListener("load",u,{once:!0})}static displayUrl(u){return h(this,arguments,void 0,function*(v,y=null,w=null,G=null){return new Promise((L,Q)=>{D.onInitalLoad(()=>h(this,void 0,void 0,function*(){var K={url:""};K.name=null==y?"string"==typeof v?v:v.name:y;""===K.name&&(K.name="string"==
|
|
250
250
|
typeof v?v:v.name);"string"==typeof v?K.url=v:(K.url=v.url,null==w&&null!=v.processor&&(w=v.processor),null==G&&null!=v.args&&(G=v.args),null!=v.testerMap&&(K.testerMap=v.testerMap),null!=v.testerName&&(K.testerName=v.testerName),null!=v.testerAPIBaseUrl&&(K.testerAPIBaseUrl=v.testerAPIBaseUrl));null==w&&(w=new D);w.mode===g.DeveloperMode.Development&&(g.Hot.Debugger.benchmark=!0);D.setupTesters(w,K);K.processor=w;K.args=G;K.url.indexOf("hstqserve")<0&&(K.url+="?hstqserve=nahfam");K=yield D.processUrl(K);
|
|
251
251
|
K+=D.setupClientTesters(w);yield D.useOutput(K);L(w)}))})})}static displayContent(u){return h(this,arguments,void 0,function*(v,y=null,w=null,G=null){return new Promise((L,Q)=>{D.onInitalLoad(()=>h(this,void 0,void 0,function*(){var K={content:""};K.name=null==y?"string"==typeof v?"":v.name:y;""===K.name&&(K.name="string"==typeof v?"":v.name);"string"==typeof v?K.content=v:(K.content=v.content,null==w&&null!=v.processor&&(w=v.processor),null==G&&null!=v.args&&(G=v.args),null!=v.testerMap&&(K.testerMap=
|
|
252
|
-
v.testerMap),null!=v.testerName&&(K.testerName=v.testerName),null!=v.testerAPIBaseUrl&&(K.testerAPIBaseUrl=v.testerAPIBaseUrl));null==w&&(w=new D);D.setupTesters(w,K);K.processor=w;K.args=G;K=yield D.processContent(K);yield D.useOutput(K);L(w)}))})})}}k.HotStaq=D;D.version="0.9.
|
|
252
|
+
v.testerMap),null!=v.testerName&&(K.testerName=v.testerName),null!=v.testerAPIBaseUrl&&(K.testerAPIBaseUrl=v.testerAPIBaseUrl));null==w&&(w=new D);D.setupTesters(w,K);K.processor=w;K.args=G;K=yield D.processContent(K);yield D.useOutput(K);L(w)}))})})}}k.HotStaq=D;D.version="0.9.39";D.isWeb=!1;D.isReadyForTesting=!1;D.onReadyForTesting=null;D.onOutputReceived=null;D.onReadyEvent=null;D.dispatchReadyEvents=!0;D.spaTarget=null;D.routerManager={};D.routerWildcards=[];D.spaProcessor=null;D.spaEnabled=
|
|
253
253
|
!1;D.spaOutlet=null;D.layoutEnabled=!1;D.onBeforeNavigate=null;D.onAfterNavigate=null;D.onAfterUseOutput=null;D.onRouteNotFound=null;D.autoInstallFetchInterceptors=!0;D.navAbort=null;D.fetchInterceptorsInstalled=!1;D.fetchInterceptorOptions={};D.errors={};D.preValidate=null;D.valids={};D.postValidate=null;D.uuidRegex=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;D.setupValidators();"undefined"!=typeof document&&(window.HotAPI=E.HotAPI,window.addEventListener("load",
|
|
254
254
|
l.hotStaqWebStart,{once:!0}))},[6019](E,k,r){Object.defineProperty(k,"__esModule",{value:!0});k.registerComponent=function(l,e){if(null==l||""===l)throw Error("All components must have a tag!");if(void 0===customElements.get(l)){var c=this.components;customElements.define(l,class extends HTMLElement{constructor(){super();var d=c[l];if(this.component=new d.componentType(d.processor,d.api),this.hotComponent=this.component,this.component.htmlElements=[this],this.component.inner=this.innerHTML,null!=
|
|
255
255
|
this.component.handleAttributes)this.component.handleAttributes(this.attributes);else for(d=0;d<this.attributes.length;d++){var f=this.attributes[d],a=f.name.toLowerCase();f=f.value;if("id"===a&&(this.component.name=f),"name"===a&&(this.component.name=f),"value"===a&&(this.component.value=f),a.indexOf("hot-")>-1)a=a.substring(4),this.component[a]=f}if(null==this.component.onPreOutput||!1!==this.component.onPreOutput())for(a=this.component.output(),null!=this.component.onPostOutput&&(a=this.component.onPostOutput(a)),
|
package/package.json
CHANGED
package/src/HotRouteMethod.ts
CHANGED
|
@@ -589,12 +589,21 @@ export interface IHotRouteMethod
|
|
|
589
589
|
onServerAuthorize?: ServerAuthorizationFunction;
|
|
590
590
|
|
|
591
591
|
/**
|
|
592
|
-
* Executes
|
|
593
|
-
*
|
|
594
|
-
*
|
|
592
|
+
* Executes before executing onServerExecute. Anything that returns
|
|
593
|
+
* from this will be passed onto onServerExecute via request.previousJsonObj.
|
|
594
|
+
* Commonly used for authorization guards, so it MUST be carried through
|
|
595
|
+
* HotRouteMethod.create() alongside onServerExecute — omitting it here
|
|
596
|
+
* silently drops any guard supplied via addMethod({ ... }).
|
|
597
|
+
*/
|
|
598
|
+
onServerPreExecute?: ServerExecutionFunction;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Executes when executing a called method from the server side.
|
|
602
|
+
* This will stringify any JSON object and send it as a JSON response.
|
|
603
|
+
* If undefined is returned no response will be sent to the server.
|
|
595
604
|
* So the developer would have to send a response using "res".
|
|
596
|
-
* If any exceptions are thrown from this function, they will be sent
|
|
597
|
-
* to the server as an { error: string; } object with the exception
|
|
605
|
+
* If any exceptions are thrown from this function, they will be sent
|
|
606
|
+
* to the server as an { error: string; } object with the exception
|
|
598
607
|
* message as the error.
|
|
599
608
|
*/
|
|
600
609
|
onServerExecute?: ServerExecutionFunction;
|
|
@@ -766,6 +775,7 @@ export class HotRouteMethod implements IHotRouteMethod
|
|
|
766
775
|
this.onPostRegister = null;
|
|
767
776
|
|
|
768
777
|
this.onServerAuthorize = null;
|
|
778
|
+
this.onServerPreExecute = null;
|
|
769
779
|
this.onServerExecute = null;
|
|
770
780
|
this.onClientExecute = null;
|
|
771
781
|
this.onValidateQueryInput = null;
|
|
@@ -889,6 +899,9 @@ export class HotRouteMethod implements IHotRouteMethod
|
|
|
889
899
|
if (route.onPostRegister != null)
|
|
890
900
|
newMethod.onPostRegister = route.onPostRegister;
|
|
891
901
|
|
|
902
|
+
if (route.onServerPreExecute != null)
|
|
903
|
+
newMethod.onServerPreExecute = route.onServerPreExecute;
|
|
904
|
+
|
|
892
905
|
if (route.onServerExecute != null)
|
|
893
906
|
newMethod.onServerExecute = route.onServerExecute;
|
|
894
907
|
|
package/src/HotStaq.ts
CHANGED