fable 3.0.68 → 3.0.70
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/fable.compatible.js +3 -2
- package/dist/fable.compatible.min.js +1 -1
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +3 -2
- package/dist/fable.min.js +1 -1
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-RestClient.js +5 -1
- package/source/services/Fable-Service-Utility.js +6 -3
- package/test/Utility_tests.js +14 -0
package/dist/fable.compatible.js
CHANGED
|
@@ -2872,7 +2872,8 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
2872
2872
|
*/},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParser){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}]);return WordTree;}();module.exports=WordTree;},{}],104:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Title":"","Summary":"","Version":0},"Status":{"Completed":false,"CompletionProgress":0,"CompletionTimeElapsed":0,"Steps":1,"StepsCompleted":0,"StartTime":0,"EndTime":0},"Errors":[],"Log":[]};},{}],105:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase6){_inherits(FableOperation,_libFableServiceBase6);var _super16=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this27;_classCallCheck2(this,FableOperation);_this27=_super16.call(this,pFable,pOptions,pServiceHash);_this27.serviceType='PhasedOperation';_this27.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
2873
2873
|
_this27.state.Metadata.Hash=_this27.Hash;_this27.state.Metadata.UUID=_this27.UUID;_this27.name=typeof _this27.options.Name=='string'?_this27.options.Name:"Unnamed Operation ".concat(_this27.state.Metadata.UUID);_this27.log=_assertThisInitialized(_this27);return _this27;}_createClass2(FableOperation,[{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":92,"./Fable-Service-Operation-DefaultSettings.js":104}],106:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceRestClient,_libFableServiceBase7);var _super17=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,FableServiceRestClient);_this28=_super17.call(this,pFable,pOptions,pServiceHash);_this28.TraceLog=false;if(_this28.options.TraceLog||_this28.fable.TraceLog){_this28.TraceLog=true;}_this28.dataFormat=_this28.fable.services.DataFormat;_this28.serviceType='RestClient';_this28.cookie=false;// This is a function that can be overridden, to allow the management
|
|
2874
2874
|
// of the request options before they are passed to the request library.
|
|
2875
|
-
_this28.prepareRequestOptions=function(pOptions){return pOptions;};return _this28;}_createClass2(FableServiceRestClient,[{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKey=Object.keys(this.cookie);
|
|
2875
|
+
_this28.prepareRequestOptions=function(pOptions){return pOptions;};return _this28;}_createClass2(FableServiceRestClient,[{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKey=Object.keys(this.cookie);if(tmpCookieKey.length>0){// Only grab the first for now.
|
|
2876
|
+
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKey[0],this.cookie[tmpCookieKey[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
2876
2877
|
var tmpOptions=this.prepareCookies(pOptions);return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this29=this;var tmpOptions=this.preRequest(pOptions);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this29.TraceLog){var tmpConnectTime=_this29.fable.log.getTimeStamp();_this29.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this29.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpData='';pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
|
|
2877
2878
|
if(_this29.TraceLog){var tmpChunkTime=_this29.fable.log.getTimeStamp();_this29.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this29.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this29.TraceLog){var tmpCompletionTime=_this29.fable.log.getTimeStamp();_this29.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this29.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this30=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!tmpOptions.hasOwnProperty('headers')){tmpOptions.headers={};}/* Automated headers break some APIs
|
|
2878
2879
|
if (!tmpOptions.headers.hasOwnProperty('Content-Type'))
|
|
@@ -2914,7 +2915,7 @@ _this33.waterfall=libAsyncWaterfall;_this33.eachLimit=libAsyncEachLimit;return _
|
|
|
2914
2915
|
// Now that es6 gives us this, use the native thingy.
|
|
2915
2916
|
// Nevermind, the native thing is not stable enough across environments
|
|
2916
2917
|
// Basic shallow copy
|
|
2917
|
-
_createClass2(FableServiceUtility,[{key:"extend",value:function extend(pDestinationObject){for(var i=0;i<(arguments.length<=1?0:arguments.length-1);i++){var tmpSourceObject=i+1<1||arguments.length<=i+1?undefined:arguments[i+1];var tmpObjectProperties=Object.keys(tmpSourceObject);for(var k=0;k<tmpObjectProperties.length;k++){pDestinationObject[tmpObjectProperties[k]]=tmpSourceObject[tmpObjectProperties[k]];}}return pDestinationObject;}// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2918
|
+
_createClass2(FableServiceUtility,[{key:"extend",value:function extend(pDestinationObject){for(var i=0;i<(arguments.length<=1?0:arguments.length-1);i++){var tmpSourceObject=i+1<1||arguments.length<=i+1?undefined:arguments[i+1];if(_typeof(tmpSourceObject)==='object'){var tmpObjectProperties=Object.keys(tmpSourceObject);for(var k=0;k<tmpObjectProperties.length;k++){pDestinationObject[tmpObjectProperties[k]]=tmpSourceObject[tmpObjectProperties[k]];}}}return pDestinationObject;}// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2918
2919
|
// string-based template with code snippets into simple executable pieces,
|
|
2919
2920
|
// with the added twist of returning a precompiled function ready to go.
|
|
2920
2921
|
},{key:"template",value:function template(pTemplateText,pData){var tmpTemplate=this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Template');return tmpTemplate.buildTemplateFunction(pTemplateText,pData);}// Build a template function from a template hash, and, register it with the service provider
|