fable 3.0.78 → 3.0.80
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 +96 -85
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +19 -8
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +2 -2
- package/source/services/Fable-Service-DataFormat.js +18 -0
- package/source/services/Fable-Service-Operation.js +194 -0
- package/test/DataFormat-StringDateFormatting_tests.js +28 -0
package/dist/fable.js
CHANGED
|
@@ -615,8 +615,8 @@ if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});
|
|
|
615
615
|
*
|
|
616
616
|
*
|
|
617
617
|
* @author Steven Velozo <steven@velozo.com>
|
|
618
|
-
*/class BaseLogger{constructor(pLogStreamSettings,
|
|
619
|
-
this._Settings=typeof pLogStreamSettings=='object'?pLogStreamSettings:{};// The base logger does nothing but associate a UUID with itself
|
|
618
|
+
*/const libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;class BaseLogger extends libFableServiceProviderBase{constructor(pLogStreamSettings,pLogStreamHash){super(pLogStreamSettings,pLogStreamHash);// This should not possibly be able to be instantiated without a settings object
|
|
619
|
+
this._Settings=typeof pLogStreamSettings=='object'?pLogStreamSettings:{};this.serviceType='Logging-Provider';// The base logger does nothing but associate a UUID with itself
|
|
620
620
|
// We added this as the mechanism for tracking loggers to allow multiple simultaneous streams
|
|
621
621
|
// to the same provider.
|
|
622
622
|
this.loggerUUID=this.generateInsecureUUID();// Eventually we can use this array to ompute which levels the provider allows.
|
|
@@ -626,7 +626,7 @@ generateInsecureUUID(){let tmpDate=new Date().getTime();let tmpUUID='LOGSTREAM-x
|
|
|
626
626
|
// ..but good enough for unique log stream identifiers
|
|
627
627
|
let tmpRandomData=(tmpDate+Math.random()*16)%16|0;tmpDate=Math.floor(tmpDate/16);return(pCharacter=='x'?tmpRandomData:tmpRandomData&0x3|0x8).toString(16);});return tmpUUID;}initialize(){// No operation.
|
|
628
628
|
}trace(pLogText,pLogObject){this.write("trace",pLogText,pLogObject);}debug(pLogText,pLogObject){this.write("debug",pLogText,pLogObject);}info(pLogText,pLogObject){this.write("info",pLogText,pLogObject);}warn(pLogText,pLogObject){this.write("warn",pLogText,pLogObject);}error(pLogText,pLogObject){this.write("error",pLogText,pLogObject);}fatal(pLogText,pLogObject){this.write("fatal",pLogText,pLogObject);}write(pLogLevel,pLogText,pLogObject){// The base logger does nothing.
|
|
629
|
-
return true;}}module.exports=BaseLogger;},{}],30:[function(require,module,exports){/**
|
|
629
|
+
return true;}}module.exports=BaseLogger;},{"fable-serviceproviderbase":36}],30:[function(require,module,exports){/**
|
|
630
630
|
* Default Logger Provider Function
|
|
631
631
|
*
|
|
632
632
|
*
|
|
@@ -658,8 +658,7 @@ switch(pLevel){case'trace':this.logStreamsTrace.push(pLogger);case'debug':this.l
|
|
|
658
658
|
for(let i=0;i<this._StreamDefinitions.length;i++){let tmpStreamDefinition=Object.assign({loggertype:'default',streamtype:'console',level:'info'},this._StreamDefinitions[i]);if(!this._Providers.hasOwnProperty(tmpStreamDefinition.loggertype)){console.log("Error initializing log stream: bad loggertype in stream definition ".concat(JSON.stringify(tmpStreamDefinition)));}else{this.addLogger(new this._Providers[tmpStreamDefinition.loggertype](tmpStreamDefinition,this),tmpStreamDefinition.level);}}// Now initialize each one.
|
|
659
659
|
for(let i=0;i<this.logStreams.length;i++){this.logStreams[i].initialize();}}logTime(pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time';let tmpTime=new Date();this.info("".concat(tmpMessage," ").concat(tmpTime," (epoch ").concat(+tmpTime,")"),pDatum);}// Get a timestamp
|
|
660
660
|
getTimeStamp(){return+new Date();}getTimeDelta(pTimeStamp){let tmpEndTime=+new Date();return tmpEndTime-pTimeStamp;}// Log the delta between a timestamp, and now with a message
|
|
661
|
-
logTimeDelta(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpDatum=typeof pDatum==='object'?pDatum:{};let tmpEndTime=+new Date();this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms)"),pDatum);}logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpEndTime=+new Date();let tmpMs=parseInt(pTimeDelta%1000);let tmpSeconds=parseInt(pTimeDelta/1000%60);let tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);let tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms) or (").concat(tmpHours,":").concat(tmpMinutes,":").concat(tmpSeconds,".").concat(tmpMs,")"),pDatum);}logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}
|
|
662
|
-
function autoConstruct(pSettings){return new FableLog(pSettings);}module.exports=FableLog;module.exports.new=autoConstruct;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"./Fable-Log-BaseLogger.js":29,"./Fable-Log-DefaultProviders-Node.js":30,"./Fable-Log-DefaultStreams.json":31,"./Fable-Log-Logger-Console.js":32,"./Fable-Log-Logger-SimpleFlatFile.js":33,"fable-serviceproviderbase":36}],35:[function(require,module,exports){/**
|
|
661
|
+
logTimeDelta(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpDatum=typeof pDatum==='object'?pDatum:{};let tmpEndTime=+new Date();this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms)"),pDatum);}logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpEndTime=+new Date();let tmpMs=parseInt(pTimeDelta%1000);let tmpSeconds=parseInt(pTimeDelta/1000%60);let tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);let tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms) or (").concat(tmpHours,":").concat(tmpMinutes,":").concat(tmpSeconds,".").concat(tmpMs,")"),pDatum);}logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}module.exports=FableLog;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderFlatfile=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"./Fable-Log-BaseLogger.js":29,"./Fable-Log-DefaultProviders-Node.js":30,"./Fable-Log-DefaultStreams.json":31,"./Fable-Log-Logger-Console.js":32,"./Fable-Log-Logger-SimpleFlatFile.js":33,"fable-serviceproviderbase":36}],35:[function(require,module,exports){/**
|
|
663
662
|
* Fable Core Pre-initialization Service Base
|
|
664
663
|
*
|
|
665
664
|
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
|
|
@@ -3035,7 +3034,7 @@ return'';}else{let tmpPadLength=pTargetLength-pString.length;if(tmpPadLength>tmp
|
|
|
3035
3034
|
* @param {number} pTimeEnd
|
|
3036
3035
|
* @returns {string} - HH:MM:SS.mmm
|
|
3037
3036
|
*/formatTimeDelta(pTimeStart,pTimeEnd){if(typeof pTimeStart!='number'||typeof pTimeEnd!='number'){return'';}return this.formatTimeSpan(pTimeEnd-pTimeStart);}// THE FOLLOWING TERRIBLE FUNCTIONS ARE FOR QT / WKHTMLTOPDF when luxon and moment don't work so well
|
|
3038
|
-
getMonthFromDate(pJavascriptDate){var tmpMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];return tmpMonths[pJavascriptDate.getMonth()];}getMonthAbbreviatedFromDate(pJavascriptDate){var tmpMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return tmpMonths[pJavascriptDate.getMonth()];}formatSortableStringFromDate(pDate){return pDate.getFullYear()+this.stringPadStart(pDate.getMonth(),2,'0')+this.stringPadStart(pDate.getDate(),2,'0');}/*************************************************************************
|
|
3037
|
+
getMonthFromDate(pJavascriptDate){var tmpMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];return tmpMonths[pJavascriptDate.getMonth()];}getMonthAbbreviatedFromDate(pJavascriptDate){var tmpMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return tmpMonths[pJavascriptDate.getMonth()];}formatMonthDayYearFromDate(pJavascriptDate,pStrict){let tmpStrict=typeof pStrict!=='undefined'?pStrict:false;let tmpMonth=pJavascriptDate.getMonth()+1;let tmpDay=pJavascriptDate.getDate();let tmpYear=pJavascriptDate.getFullYear();if(tmpStrict){tmpMonth=this.stringPadStart(tmpMonth,2,'0');tmpDay=this.stringPadStart(tmpDay,2,'0');tmpYear=this.stringPadStart(tmpYear,4,'0');}return"".concat(tmpMonth,"/").concat(tmpDay,"/").concat(tmpYear);}formatSortableStringFromDate(pDate){return pDate.getFullYear()+this.stringPadStart(pDate.getMonth(),2,'0')+this.stringPadStart(pDate.getDate(),2,'0');}/*************************************************************************
|
|
3039
3038
|
* String Tokenization Functions
|
|
3040
3039
|
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ /**
|
|
3041
3040
|
* Return the string before the matched substring.
|
|
@@ -3237,8 +3236,20 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
3237
3236
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
3238
3237
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
3239
3238
|
* @return {bool} True if adding the pattern was successful
|
|
3240
|
-
*/addPatternAsync(pPatternStart,pPatternEnd,fParser){let tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}module.exports=WordTree;},{}],120:[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":[]};},{}],121:[function(require,module,exports){const libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;const _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));class FableOperation extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash)
|
|
3241
|
-
this.
|
|
3239
|
+
*/addPatternAsync(pPatternStart,pPatternEnd,fParser){let tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}module.exports=WordTree;},{}],120:[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":[]};},{}],121:[function(require,module,exports){const libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;const _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));class FableOperation extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);// Timestamps will just be the long ints
|
|
3240
|
+
this.timeStamps={};// ProgressTrackers have an object format of: {Hash:'SomeHash',EndTime:UINT,CurrentTime:UINT,TotalCount:INT,CurrentCount:INT}
|
|
3241
|
+
this.progressTrackers={};this.serviceType='PhasedOperation';this.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
3242
|
+
this.state.Metadata.Hash=this.Hash;this.state.Metadata.UUID=this.UUID;this.name=typeof this.options.Name=='string'?this.options.Name:"Unnamed Operation ".concat(this.state.Metadata.UUID);this.log=this;}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));}}writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(typeof pLogObject=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}/************************************************************************
|
|
3243
|
+
* BEGINNING OF --> Telemetry Helpers
|
|
3244
|
+
*/createTimeStamp(pTimeStampHash){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';this.timeStamps[tmpTimeStampHash]=+new Date();return this.timeStamps[tmpTimeStampHash];}getTimeDelta(pTimeStampHash){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';if(this.timeStamps.hasOwnProperty(tmpTimeStampHash)){let tmpEndTime=+new Date();return tmpEndTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}logTimeDelta(pTimeStampHash,pMessage){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';let tmpMessage=typeof pMessage!=='undefined'?pMessage:"Elapsed for ".concat(tmpTimeStampHash,": ");let tmpOperationTime=this.getTimeDelta(pTimeStampHash);this.info(tmpMessage+' ('+tmpOperationTime+'ms)');return tmpOperationTime;}createProgressTracker(pTotalOperations,pProgressTrackerHash){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'DefaultProgressTracker';let tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;let tmpProgressTracker={Hash:tmpProgressTrackerHash,StartTime:this.createTimeStamp(tmpProgressTrackerHash),EndTime:0,CurrentTime:0,PercentComplete:-1,AverageOperationTime:-1,EstimatedCompletionTime:-1,TotalCount:tmpTotalOperations,CurrentCount:-1};this.progressTrackers[tmpProgressTrackerHash]=tmpProgressTracker;return tmpProgressTracker;}solveProgressTrackerStatus(pProgressTrackerHash){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'DefaultProgressTracker';if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.createProgressTracker(100,tmpProgressTrackerHash);}let tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];tmpProgressTracker.CurrentTime=this.getTimeDelta(tmpProgressTracker.Hash);if(tmpProgressTracker.CurrentCount>0&&tmpProgressTracker.TotalCount>0){tmpProgressTracker.PercentComplete=tmpProgressTracker.CurrentCount/tmpProgressTracker.TotalCount*100.0;}if(tmpProgressTracker.CurrentCount>0&&tmpProgressTracker.CurrentTime>0){tmpProgressTracker.AverageOperationTime=tmpProgressTracker.CurrentTime/tmpProgressTracker.CurrentCount;}if(tmpProgressTracker.CurrentCount<tmpProgressTracker.TotalCount&&tmpProgressTracker.AverageOperationTime>0){tmpProgressTracker.EstimatedCompletionTime=(tmpProgressTracker.TotalCount-tmpProgressTracker.CurrentCount)*tmpProgressTracker.AverageOperationTime;}}updateProgressTrackerStatus(pProgressTrackerHash,pCurrentOperations){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'DefaultProgressTracker';let tmpCurrentOperations=parseInt(pCurrentOperations);if(isNaN(tmpCurrentOperations)){return false;}if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.createProgressTracker(100,tmpProgressTrackerHash);}this.progressTrackers[tmpProgressTrackerHash].CurrentCount=tmpCurrentOperations;this.progressTrackers[tmpProgressTrackerHash].CurrentTime=this.getTimeDelta(tmpProgressTrackerHash);this.solveProgressTrackerStatus(tmpProgressTrackerHash);return this.progressTrackers[tmpProgressTrackerHash];}incrementProgressTrackerStatus(pProgressTrackerHash,pIncrementSize){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'DefaultProgressTracker';let tmpIncrementSize=parseInt(pIncrementSize);if(isNaN(tmpIncrementSize)){return false;}if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.createProgressTracker(100,tmpProgressTrackerHash);}this.progressTrackers[tmpProgressTrackerHash].CurrentCount=this.progressTrackers[tmpProgressTrackerHash].CurrentCount+tmpIncrementSize;this.progressTrackers[tmpProgressTrackerHash].CurrentTime=this.getTimeDelta(tmpProgressTrackerHash);this.solveProgressTrackerStatus(tmpProgressTrackerHash);return this.progressTrackers[tmpProgressTrackerHash];}setProgressTrackerEndTime(pProgressTrackerHash,pCurrentOperations){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'DefaultProgressTracker';let tmpCurrentOperations=parseInt(pCurrentOperations);if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){return false;}if(!isNaN(tmpCurrentOperations)){this.updateProgressTrackerStatus(tmpProgressTrackerHash,tmpCurrentOperations);}this.progressTrackers[tmpProgressTrackerHash].EndTime=this.getTimeDelta(tmpProgressTrackerHash);this.solveProgressTrackerStatus(tmpProgressTrackerHash);return this.progressTrackers[tmpProgressTrackerHash];}printProgressTrackerStatus(pProgressTrackerHash){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'DefaultProgressTracker';if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.info(">> Progress Tracker ".concat(tmpProgressTrackerHash," does not exist! No stats to display."));}else{const tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];if(tmpProgressTracker.CurrentCount<1){this.info(">> Progress Tracker ".concat(tmpProgressTracker.Hash," has no completed operations. ").concat(tmpProgressTracker.CurrentTime,"ms have elapsed since it was started."));}else if(tmpProgressTracker.EndTime<1){this.info(">> Progress Tracker ".concat(tmpProgressTracker.Hash," is ").concat(tmpProgressTracker.PercentComplete.toFixed(3),"% completed - ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations over ").concat(tmpProgressTracker.CurrentTime,"ms (median ").concat(tmpProgressTracker.AverageOperationTime.toFixed(3)," per). Estimated completion in ").concat(tmpProgressTracker.EstimatedCompletionTime.toFixed(0),"ms or ").concat((tmpProgressTracker.EstimatedCompletionTime/1000/60).toFixed(2),"minutes"));}else{this.info(">> Progress Tracker ".concat(tmpProgressTracker.Hash," is done and completed ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations in ").concat(tmpProgressTracker.EndTime,"ms."));}}}// logMemoryResourcesUsed()
|
|
3245
|
+
// {
|
|
3246
|
+
//
|
|
3247
|
+
// const tmpResourcesUsed = process.memoryUsage().heapUsed / 1024 / 1024;
|
|
3248
|
+
// this.info(`Memory usage at ${Math.round(tmpResourcesUsed * 100) / 100} MB`);
|
|
3249
|
+
// }
|
|
3250
|
+
/*
|
|
3251
|
+
* END OF --> Logging and Telemetry Helpers
|
|
3252
|
+
************************************************************************/}module.exports=FableOperation;},{"../Fable-ServiceManager.js":108,"./Fable-Service-Operation-DefaultSettings.js":120}],122:[function(require,module,exports){(function(Buffer){(function(){const libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;const libSimpleGet=require('simple-get');const libCookie=require('cookie');class FableServiceRestClient extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.TraceLog=false;if(this.options.TraceLog||this.fable.TraceLog){this.TraceLog=true;}this.dataFormat=this.fable.services.DataFormat;this.serviceType='RestClient';this.cookie=false;// This is a function that can be overridden, to allow the management
|
|
3242
3253
|
// of the request options before they are passed to the request library.
|
|
3243
3254
|
this.prepareRequestOptions=pOptions=>{return pOptions;};}get simpleGet(){return libSimpleGet;}prepareCookies(pRequestOptions){if(this.cookie){let tmpCookieObject=this.cookie;if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}let tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
|
|
3244
3255
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}preRequest(pOptions){// Validate the options object
|