orator 3.0.10 → 3.0.11

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/dist/orator.js CHANGED
@@ -5052,13 +5052,13 @@
5052
5052
  return this.addRouteProcessor('POST', pRoute, Array.from(fRouteProcessingFunctions));
5053
5053
  }
5054
5054
  doDel(pRoute, ...fRouteProcessingFunctions) {
5055
- return this.addRouteProcessor('DEL', pRoute, Array.from(fRouteProcessingFunctions));
5055
+ return this.addRouteProcessor('DELETE', pRoute, Array.from(fRouteProcessingFunctions));
5056
5056
  }
5057
5057
  doPatch(pRoute, ...fRouteProcessingFunctions) {
5058
5058
  return this.addRouteProcessor('PATCH', pRoute, Array.from(fRouteProcessingFunctions));
5059
5059
  }
5060
5060
  doOpts(pRoute, ...fRouteProcessingFunctions) {
5061
- return this.addRouteProcessor('OPTS', pRoute, Array.from(fRouteProcessingFunctions));
5061
+ return this.addRouteProcessor('OPTIONS', pRoute, Array.from(fRouteProcessingFunctions));
5062
5062
  }
5063
5063
  doHead(pRoute, ...fRouteProcessingFunctions) {
5064
5064
  return this.addRouteProcessor('HEAD', pRoute, Array.from(fRouteProcessingFunctions));
@@ -25,7 +25,7 @@ var n=t("./Orator.js");"object"!=typeof window||window.hasOwnProperty("Orator")|
25
25
  *
26
26
  * @author Steven Velozo <steven@velozo.com>
27
27
  */
28
- getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":51}],48:[function(t,e,r){e.exports=class{constructor(t){this.orator=t,this.log=t.log,this.ServiceServerType="Base",this.Name=this.orator.settings.Product,this.URL="BASE_SERVICE_SERVER",this.Port=this.orator.settings.ServicePort,this.Active=!1}listen(t,e){return this.Active=!0,e()}close(t){return this.Active=!1,t()}bodyParser(t){return(t,e,r)=>{r()}}use(t){return"function"==typeof t||(this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof t} instead of a string.`),!1)}doGet(t,...e){return!0}get(t,...e){return"string"!=typeof t?(this.log.error(`Orator GET Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doGet(t,...e)}getWithBodyParser(t,...e){return this.get(t,this.bodyParser(),...e)}doPut(t,...e){return!0}put(t,...e){return"string"!=typeof t?(this.log.error(`Orator PUT Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPut(t,...e)}putWithBodyParser(t,...e){return this.put(t,this.bodyParser(),...e)}doPost(t,...e){return!0}post(t,...e){return"string"!=typeof t?(this.log.error(`Orator POST Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPost(t,...e)}postWithBodyParser(t,...e){return this.post(t,this.bodyParser(),...e)}doDel(t,...e){return!0}del(t,...e){return"string"!=typeof t?(this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doDel(t,...e)}delWithBodyParser(t,...e){return this.del(t,this.bodyParser(),...e)}doPatch(t,...e){return!0}patch(t,...e){return"string"!=typeof t?(this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPatch(t,...e)}patchWithBodyParser(t,...e){return this.patch(t,this.bodyParser(),...e)}doOpts(t,...e){return!0}opts(t,...e){return"string"!=typeof t?(this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doOpts(t,...e)}optsWithBodyParser(t,...e){return this.opts(t,this.bodyParser(),...e)}doHead(t,...e){return!0}head(t,...e){return"string"==typeof t||(this.log.error(`Orator HEAD Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}headWithBodyParser(t,...e){return this.head(t,this.bodyParser(),...e)}invoke(t,e,r,n){return this.log.debug(`Orator invoke called for route [${e}] and landed on the base class; the service provider likely does not implement programmatic invoke capabilities.`,r),!1}}},{}],49:[function(t,e,r){"use strict";e.exports={name:"ipc",isAsync:!0,storage:()=>{let t={};return{get:e=>t[e]||null,set:(e,r)=>{t[e]=r}}},deriveConstraint:(t,e,r)=>r(null,"IPC"),mustMatchWhenDerived:!0}},{}],50:[function(t,e,r){e.exports=class{constructor(t,e){this.log=t,this.requestGUID=e,this.responseData=null,this.responseStatus=-1}send(t){return"string"==typeof t?null===this.responseData?(this.responseData=t,!0):"string"==typeof this.responseData?(this.responseData=this.responseData+t,!0):(this.log(`Request ${this.requestGUID} has tried to send() a string value after send()ing data type ${typeof this.responseData}.`,t),!1):"object"==typeof t?null===this.responseData?(this.responseData=JSON.stringify(t),!0):"string"==typeof this.responseData?(this.responseData+=this.responseData+JSON.stringify(t),!0):(this.log(`Request ${this.requestGUID} has tried to send() an object value to be auto stringified after send()ing data type ${typeof this.responseData}.`,t),!1):void 0}}},{}],51:[function(t,e,r){const n=t("./Orator-ServiceServer-Base.js"),i=t("./Orator-ServiceServer-IPC-SynthesizedResponse.js"),s=t("./Orator-ServiceServer-IPC-RouterConstrainer.js"),o=t("find-my-way"),a=t("async/waterfall"),u=t("async/eachOfSeries");e.exports=class extends n{constructor(t){super(t),this.routerOptions=this.orator.settings.hasOwnProperty("router_options")&&"object"==typeof this.orator.settings.router_options?this.orator.settings.router_options:{},this.router=o(this.routerOptions),this.router.addConstraintStrategy(s),this.ServiceServerType="IPC",this.URL="IPC",this.preBehaviorFunctions=[],this.behaviorMap={},this.postBehaviorFunctions=[]}use(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}addPostBehaviorFunction(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}executePreBehaviorFunctions(t,e,r){u(this.preBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider preBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addPostBehaviorFunction(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}executePostBehaviorFunctions(t,e,r){u(this.postBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider postBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addRouteProcessor(t,e,r){return this.router.on(t,e,{constraints:{ipc:"IPC"}},((t,e,n)=>{a([e=>(t.params=n,e()),r=>this.executePreBehaviorFunctions(t,e,r),n=>{u(r,((r,n,i)=>r(t,e,i)),(t=>{if(t)return this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${t}`,t),fNext(pError)}))},r=>this.executePostBehaviorFunctions(t,e,r)],(t=>{t&&this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${pBehaviorFunctionError}`,pBehaviorFunctionError)}))})),!0}bodyParser(){return(t,e,r)=>r()}doGet(t,...e){return this.addRouteProcessor("GET",t,Array.from(e))}doPut(t,...e){return this.addRouteProcessor("PUT",t,Array.from(e))}doPost(t,...e){return this.addRouteProcessor("POST",t,Array.from(e))}doDel(t,...e){return this.addRouteProcessor("DEL",t,Array.from(e))}doPatch(t,...e){return this.addRouteProcessor("PATCH",t,Array.from(e))}doOpts(t,...e){return this.addRouteProcessor("OPTS",t,Array.from(e))}doHead(t,...e){return this.addRouteProcessor("HEAD",t,Array.from(e))}invoke(t,e,r,n){let s="function"==typeof n?n:"function"==typeof r?r:()=>{},o={method:t,url:e,guid:this.orator.fable.getUUID()},a=new i(this.log,o.guid);return this.router.lookup(o,a,((t,n)=>(t&&this.log.error(`IPC Request Error Request GUID [${o.guid}] handling route [${e}]: ${t}`,{Error:t,Route:e,Data:r}),s(t,a.responseData,a,n))))}}},{"./Orator-ServiceServer-Base.js":48,"./Orator-ServiceServer-IPC-RouterConstrainer.js":49,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":50,"async/eachOfSeries":7,"async/waterfall":20,"find-my-way":29}],52:[function(t,e,r){
28
+ getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":51}],48:[function(t,e,r){e.exports=class{constructor(t){this.orator=t,this.log=t.log,this.ServiceServerType="Base",this.Name=this.orator.settings.Product,this.URL="BASE_SERVICE_SERVER",this.Port=this.orator.settings.ServicePort,this.Active=!1}listen(t,e){return this.Active=!0,e()}close(t){return this.Active=!1,t()}bodyParser(t){return(t,e,r)=>{r()}}use(t){return"function"==typeof t||(this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof t} instead of a string.`),!1)}doGet(t,...e){return!0}get(t,...e){return"string"!=typeof t?(this.log.error(`Orator GET Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doGet(t,...e)}getWithBodyParser(t,...e){return this.get(t,this.bodyParser(),...e)}doPut(t,...e){return!0}put(t,...e){return"string"!=typeof t?(this.log.error(`Orator PUT Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPut(t,...e)}putWithBodyParser(t,...e){return this.put(t,this.bodyParser(),...e)}doPost(t,...e){return!0}post(t,...e){return"string"!=typeof t?(this.log.error(`Orator POST Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPost(t,...e)}postWithBodyParser(t,...e){return this.post(t,this.bodyParser(),...e)}doDel(t,...e){return!0}del(t,...e){return"string"!=typeof t?(this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doDel(t,...e)}delWithBodyParser(t,...e){return this.del(t,this.bodyParser(),...e)}doPatch(t,...e){return!0}patch(t,...e){return"string"!=typeof t?(this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPatch(t,...e)}patchWithBodyParser(t,...e){return this.patch(t,this.bodyParser(),...e)}doOpts(t,...e){return!0}opts(t,...e){return"string"!=typeof t?(this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doOpts(t,...e)}optsWithBodyParser(t,...e){return this.opts(t,this.bodyParser(),...e)}doHead(t,...e){return!0}head(t,...e){return"string"==typeof t||(this.log.error(`Orator HEAD Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}headWithBodyParser(t,...e){return this.head(t,this.bodyParser(),...e)}invoke(t,e,r,n){return this.log.debug(`Orator invoke called for route [${e}] and landed on the base class; the service provider likely does not implement programmatic invoke capabilities.`,r),!1}}},{}],49:[function(t,e,r){"use strict";e.exports={name:"ipc",isAsync:!0,storage:()=>{let t={};return{get:e=>t[e]||null,set:(e,r)=>{t[e]=r}}},deriveConstraint:(t,e,r)=>r(null,"IPC"),mustMatchWhenDerived:!0}},{}],50:[function(t,e,r){e.exports=class{constructor(t,e){this.log=t,this.requestGUID=e,this.responseData=null,this.responseStatus=-1}send(t){return"string"==typeof t?null===this.responseData?(this.responseData=t,!0):"string"==typeof this.responseData?(this.responseData=this.responseData+t,!0):(this.log(`Request ${this.requestGUID} has tried to send() a string value after send()ing data type ${typeof this.responseData}.`,t),!1):"object"==typeof t?null===this.responseData?(this.responseData=JSON.stringify(t),!0):"string"==typeof this.responseData?(this.responseData+=this.responseData+JSON.stringify(t),!0):(this.log(`Request ${this.requestGUID} has tried to send() an object value to be auto stringified after send()ing data type ${typeof this.responseData}.`,t),!1):void 0}}},{}],51:[function(t,e,r){const n=t("./Orator-ServiceServer-Base.js"),i=t("./Orator-ServiceServer-IPC-SynthesizedResponse.js"),s=t("./Orator-ServiceServer-IPC-RouterConstrainer.js"),o=t("find-my-way"),a=t("async/waterfall"),u=t("async/eachOfSeries");e.exports=class extends n{constructor(t){super(t),this.routerOptions=this.orator.settings.hasOwnProperty("router_options")&&"object"==typeof this.orator.settings.router_options?this.orator.settings.router_options:{},this.router=o(this.routerOptions),this.router.addConstraintStrategy(s),this.ServiceServerType="IPC",this.URL="IPC",this.preBehaviorFunctions=[],this.behaviorMap={},this.postBehaviorFunctions=[]}use(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}addPostBehaviorFunction(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}executePreBehaviorFunctions(t,e,r){u(this.preBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider preBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addPostBehaviorFunction(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}executePostBehaviorFunctions(t,e,r){u(this.postBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider postBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addRouteProcessor(t,e,r){return this.router.on(t,e,{constraints:{ipc:"IPC"}},((t,e,n)=>{a([e=>(t.params=n,e()),r=>this.executePreBehaviorFunctions(t,e,r),n=>{u(r,((r,n,i)=>r(t,e,i)),(t=>{if(t)return this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${t}`,t),fNext(pError)}))},r=>this.executePostBehaviorFunctions(t,e,r)],(t=>{t&&this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${pBehaviorFunctionError}`,pBehaviorFunctionError)}))})),!0}bodyParser(){return(t,e,r)=>r()}doGet(t,...e){return this.addRouteProcessor("GET",t,Array.from(e))}doPut(t,...e){return this.addRouteProcessor("PUT",t,Array.from(e))}doPost(t,...e){return this.addRouteProcessor("POST",t,Array.from(e))}doDel(t,...e){return this.addRouteProcessor("DELETE",t,Array.from(e))}doPatch(t,...e){return this.addRouteProcessor("PATCH",t,Array.from(e))}doOpts(t,...e){return this.addRouteProcessor("OPTIONS",t,Array.from(e))}doHead(t,...e){return this.addRouteProcessor("HEAD",t,Array.from(e))}invoke(t,e,r,n){let s="function"==typeof n?n:"function"==typeof r?r:()=>{},o={method:t,url:e,guid:this.orator.fable.getUUID()},a=new i(this.log,o.guid);return this.router.lookup(o,a,((t,n)=>(t&&this.log.error(`IPC Request Error Request GUID [${o.guid}] handling route [${e}]: ${t}`,{Error:t,Route:e,Data:r}),s(t,a.responseData,a,n))))}}},{"./Orator-ServiceServer-Base.js":48,"./Orator-ServiceServer-IPC-RouterConstrainer.js":49,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":50,"async/eachOfSeries":7,"async/waterfall":20,"find-my-way":29}],52:[function(t,e,r){
29
29
  /**
30
30
  * Orator Service Abstraction
31
31
  *