orator 3.0.5 → 3.0.6
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
|
@@ -980,7 +980,7 @@ this.responseData+=this.responseData+JSON.stringify(pData);return true;}else{thi
|
|
|
980
980
|
const libOratorServiceServerIPCSynthesizedResponse=require('./Orator-ServiceServer-IPC-SynthesizedResponse.js');// A simple constrainer for the find-my-way router since we aren't using any kind of headers to pass version or host
|
|
981
981
|
const libOratorServiceServerIPCCustomConstrainer=require('./Orator-ServiceServer-IPC-RouterConstrainer.js');// This library is the default router for our services
|
|
982
982
|
const libFindMyWay=require('find-my-way');//const libAsync = require('async');
|
|
983
|
-
const libAsyncWaterfall=require("async/waterfall");const libAsyncEachOfSeries=require('async/
|
|
983
|
+
const libAsyncWaterfall=require("async/waterfall");const libAsyncEachOfSeries=require('async/eachOfSeries');class OratorServiceServerIPC extends libOratorServiceServerBase{constructor(pOrator){super(pOrator);this.routerOptions=this.orator.settings.hasOwnProperty('router_options')&&typeof this.orator.settings.router_options=='object'?this.orator.settings.router_options:{};this.router=libFindMyWay(this.routerOptions);this.router.addConstraintStrategy(libOratorServiceServerIPCCustomConstrainer);this.URL='IPC';this.preBehaviorFunctions=[];this.behaviorMap={};this.postBehaviorFunctions=[];}use(fHandlerFunction){if(!super.use(fHandlerFunction)){this.log.error(`IPC provider failed to map USE handler function!`);return false;}this.preBehaviorFunctions.push(fHandlerFunction);}addPostBehaviorFunction(fHandlerFunction){if(!super.use(fHandlerFunction)){this.log.error(`IPC provider failed to map USE handler function!`);return false;}this.preBehaviorFunctions.push(fHandlerFunction);}executePreBehaviorFunctions(pRequest,pResponse,fNext){libAsyncEachOfSeries(this.preBehaviorFunctions,(fBehaviorFunction,pFunctionIndex,fCallback)=>{return fBehaviorFunction(pRequest,pResponse,fCallback);},pError=>{if(pError){this.log.error(`IPC Provider preBehaviorFunction ${pFunctionIndex} failed with error: ${pError}`,pError);}return fNext(pError);});}addPostBehaviorFunction(fHandlerFunction){if(!super.use(fHandlerFunction)){this.log.error(`IPC provider failed to map USE handler function!`);return false;}this.preBehaviorFunctions.push(fHandlerFunction);}executePostBehaviorFunctions(pRequest,pResponse,fNext){libAsyncEachOfSeries(this.postBehaviorFunctions,(fBehaviorFunction,pFunctionIndex,fCallback)=>{return fBehaviorFunction(pRequest,pResponse,fCallback);},pError=>{if(pError){this.log.error(`IPC Provider postBehaviorFunction ${pFunctionIndex} failed with error: ${pError}`,pError);}return fNext(pError);});}/*
|
|
984
984
|
* Service Route Creation Functions
|
|
985
985
|
*
|
|
986
986
|
* These base functions provide basic validation for the routes, but don't actually
|
|
@@ -1006,7 +1006,7 @@ let tmpCallback=typeof fCallback=='function'?fCallback:typeof pData=='function'?
|
|
|
1006
1006
|
()=>{};// Create a bare minimum request object for IPC to pass to our router
|
|
1007
1007
|
let tmpRequest={method:pMethod,url:pRoute,guid:this.orator.fable.getUUID()};// Create a container for the IPC response data to be aggregated to from send() methodds
|
|
1008
1008
|
let tmpSynthesizedResponseData=new libOratorServiceServerIPCSynthesizedResponse(this.log,tmpRequest.guid);return this.router.lookup(tmpRequest,tmpSynthesizedResponseData,(pError,pResults)=>{if(pError){this.log.error(`IPC Request Error Request GUID [${tmpRequest.guid}] handling route [${pRoute}]: ${pError}`,{Error:pError,Route:pRoute,Data:pData});}// by default, send data back through
|
|
1009
|
-
return tmpCallback(pError,tmpSynthesizedResponseData.responseData,tmpSynthesizedResponseData,pResults);});}}module.exports=OratorServiceServerIPC;},{"./Orator-ServiceServer-IPC-RouterConstrainer.js":67,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":68,"async/
|
|
1009
|
+
return tmpCallback(pError,tmpSynthesizedResponseData.responseData,tmpSynthesizedResponseData,pResults);});}}module.exports=OratorServiceServerIPC;},{"./Orator-ServiceServer-IPC-RouterConstrainer.js":67,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":68,"async/eachOfSeries":8,"async/waterfall":22,"find-my-way":44,"orator-serviceserver":52}],70:[function(require,module,exports){/**
|
|
1010
1010
|
* Orator Service Abstraction
|
|
1011
1011
|
*
|
|
1012
1012
|
* @license MIT
|
package/dist/orator.min.js
CHANGED
|
@@ -123,7 +123,7 @@ var n=t("./Orator.js");"object"!=typeof window||window.hasOwnProperty("Orator")|
|
|
|
123
123
|
*
|
|
124
124
|
* @author Steven Velozo <steven@velozo.com>
|
|
125
125
|
*/
|
|
126
|
-
getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":69}],67:[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}},{}],68:[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}}},{}],69:[function(t,e,r){const n=t("orator-serviceserver"),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/
|
|
126
|
+
getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":69}],67:[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}},{}],68:[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}}},{}],69:[function(t,e,r){const n=t("orator-serviceserver"),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.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}get(t,...e){return super.get(t,...e)?this.addRouteProcessor("GET",t,Array.from(e)):(this.log.error(`IPC provider failed to map GET route [${t}]!`),!1)}put(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map PUT route [${t}]!`),!1)}post(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map POST route [${t}]!`),!1)}del(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map DEL route [${t}]!`),!1)}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-IPC-RouterConstrainer.js":67,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":68,"async/eachOfSeries":8,"async/waterfall":22,"find-my-way":44,"orator-serviceserver":52}],70:[function(t,e,r){
|
|
127
127
|
/**
|
|
128
128
|
* Orator Service Abstraction
|
|
129
129
|
*
|