fable 3.0.60 → 3.0.62
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 +9 -7
- package/dist/fable.compatible.min.js +1 -1
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +10 -8
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-RestClient.js +1 -1
- package/source/services/Fable-Service-Utility.js +19 -10
- package/test/Utility_tests.js +4 -2
package/dist/fable.compatible.js
CHANGED
|
@@ -2880,7 +2880,7 @@ if(_this29.TraceLog){var tmpChunkTime=_this29.fable.log.getTimeStamp();_this29.f
|
|
|
2880
2880
|
{
|
|
2881
2881
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
2882
2882
|
}
|
|
2883
|
-
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this30.TraceLog){var tmpConnectTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this30.TraceLog){var tmpChunkTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this30.TraceLog){var tmpCompletionTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));return fCallback(pError,pResponse,JSON.parse(tmpJSONData));}
|
|
2883
|
+
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this30.TraceLog){var tmpConnectTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this30.TraceLog){var tmpChunkTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this30.TraceLog){var tmpCompletionTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}},{key:"getJSON",value:function getJSON(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}},{key:"putJSON",value:function putJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PUT JSON Error Invalid options object"));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}},{key:"postJSON",value:function postJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("POST JSON Error Invalid options object"));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}},{key:"patchJSON",value:function patchJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PATCH JSON Error Invalid options object"));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}},{key:"headJSON",value:function headJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("HEAD JSON Error Invalid options object"));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}},{key:"delJSON",value:function delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}},{key:"getRawText",value:function getRawText(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}]);return FableServiceRestClient;}(libFableServiceBase);module.exports=FableServiceRestClient;},{"../Fable-ServiceManager.js":92,"cookie":24,"simple-get":65}],107:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase8){_inherits(FableServiceTemplate,_libFableServiceBase8);var _super18=_createSuper(FableServiceTemplate);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2884
2884
|
// string-based template with code snippets into simple executable pieces,
|
|
2885
2885
|
// with the added twist of returning a precompiled function ready to go.
|
|
2886
2886
|
//
|
|
@@ -2913,7 +2913,9 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
2913
2913
|
function FableServiceUtility(pFable,pOptions,pServiceHash){var _this33;_classCallCheck2(this,FableServiceUtility);_this33=_super19.call(this,pFable,pOptions,pServiceHash);_this33.templates={};// These two functions are used extensively throughout
|
|
2914
2914
|
_this33.waterfall=libAsyncWaterfall;_this33.eachLimit=libAsyncEachLimit;return _this33;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
2915
2915
|
// Now that es6 gives us this, use the native thingy.
|
|
2916
|
-
|
|
2916
|
+
// Nevermind, the native thing is not stable enough across environments
|
|
2917
|
+
// Basic shallow copy
|
|
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];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
|
|
2917
2919
|
// string-based template with code snippets into simple executable pieces,
|
|
2918
2920
|
// with the added twist of returning a precompiled function ready to go.
|
|
2919
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
|
|
@@ -2935,17 +2937,17 @@ var tmpChunkSize=typeof pChunkSize=='number'?pChunkSize:0;var tmpChunkCache=type
|
|
|
2935
2937
|
// with ultra limited JS capabilities where those don't work.
|
|
2936
2938
|
},{key:"isoStringToDate",value:function isoStringToDate(pISOString){// Split the string into an array based on the digit groups.
|
|
2937
2939
|
var tmpDateParts=pISOString.split(/\D+/);// Set up a date object with the current time.
|
|
2938
|
-
var tmpReturnDate=new Date();//
|
|
2940
|
+
var tmpReturnDate=new Date();// Track the number of hours we need to adjust the date by based on the timezone.
|
|
2941
|
+
var tmpTimeZoneOffsetInHours=0;// Track the number of minutes we need to adjust the date by based on the timezone.
|
|
2942
|
+
var tmpTimeZoneOffsetInMinutes=0;// Manually parse the parts of the string and set each part for the
|
|
2939
2943
|
// date. Note: Using the UTC versions of these functions is necessary
|
|
2940
2944
|
// because we're manually adjusting for time zones stored in the
|
|
2941
2945
|
// string.
|
|
2942
2946
|
tmpReturnDate.setUTCFullYear(parseInt(tmpDateParts[0]));// The month numbers are one "off" from what normal humans would expect
|
|
2943
2947
|
// because January == 0.
|
|
2944
2948
|
tmpReturnDate.setUTCMonth(parseInt(tmpDateParts[1]-1));tmpReturnDate.setUTCDate(parseInt(tmpDateParts[2]));// Set the time parts of the date object.
|
|
2945
|
-
tmpReturnDate.setUTCHours(parseInt(tmpDateParts[3]));tmpReturnDate.setUTCMinutes(parseInt(tmpDateParts[4]));tmpReturnDate.setUTCSeconds(parseInt(tmpDateParts[5]));tmpReturnDate.setUTCMilliseconds(parseInt(tmpDateParts[6]));//
|
|
2946
|
-
|
|
2947
|
-
if(tmpDateParts[7]||tmpDateParts[8]){// Track the number of minutes we need to adjust the date by based on the timezone.
|
|
2948
|
-
var tmpTimeZoneOffsetInMinutes=0;// If there's a value for the minutes offset.
|
|
2949
|
+
tmpReturnDate.setUTCHours(parseInt(tmpDateParts[3]));tmpReturnDate.setUTCMinutes(parseInt(tmpDateParts[4]));tmpReturnDate.setUTCSeconds(parseInt(tmpDateParts[5]));tmpReturnDate.setUTCMilliseconds(parseInt(tmpDateParts[6]));// If there's a value for either the hours or minutes offset.
|
|
2950
|
+
if(tmpDateParts[7]||tmpDateParts[8]){// If there's a value for the minutes offset.
|
|
2949
2951
|
if(tmpDateParts[8]){// Convert the minutes value into an hours value.
|
|
2950
2952
|
tmpTimeZoneOffsetInMinutes=parseInt(tmpDateParts[8])/60;}// Add the hours and minutes values to get the total offset in hours.
|
|
2951
2953
|
tmpTimeZoneOffsetInHours=parseInt(tmpDateParts[7])+tmpTimeZoneOffsetInMinutes;// If the sign for the timezone is a plus to indicate the timezone is ahead of UTC time.
|