fable 3.0.89 → 3.0.91

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.js CHANGED
@@ -2832,7 +2832,9 @@ this.UUID=new libFableUUID(this.SettingsManager.settings);// Instantiate the log
2832
2832
  this.Logging=new libFableLog(this.SettingsManager.settings);this.Logging.initialize();// Initialization Phase 1.5: Instantiate the service manager
2833
2833
  // This is the start actual bootstrapping point for fable.
2834
2834
  // For consistency fable is treated as a service.
2835
- this.ServiceManager=this;this.connectFable(this);// --> Bootstrapping of fable into the Service Manager is complete
2835
+ this.ServiceManager=this;// TODO: Remove this when Orator and meadow-endpoints are shifted to this new pattern
2836
+ this.serviceManager=this;// END TODO
2837
+ this.connectFable(this);// --> Bootstrapping of fable into the Service Manager is complete
2836
2838
  // Initialization Phase 2: Map in the default services.
2837
2839
  // They will then be available in the Default service provider set as well.
2838
2840
  this.connectPreinitServiceProviderInstance(this.UUID);this.connectPreinitServiceProviderInstance(this.Logging);this.connectPreinitServiceProviderInstance(this.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
@@ -3261,15 +3263,9 @@ tmpAnticipate.wait(pError=>{this.state.Status.TimeEnd=+new Date();return fExecut
3261
3263
  object prototype, or set of functions here. Discuss with colleagues!
3262
3264
  */addStep(pGUIDStep,fStepFunction,pStepName,pStepDescription,pStepMetadata){let tmpStep={};tmpStep.GUIDStep=typeof pGUIDStep!=='undefined'?pGUIDStep:"STEP-".concat(this.state.Steps.length,"-").concat(this.fable.DataGeneration.randomNumericString());tmpStep.Name=typeof pStepName!=='undefined'?pStepName:"Step [".concat(tmpStep.GUIDStep,"]");tmpStep.Description=typeof pStepDescription!=='undefined'?pStepDescription:"Step execution of ".concat(tmpStep.Name,".");// TODO: Right now this allows an Array... do we want to block that?
3263
3265
  tmpStep.Metadata=typeof pStepMetadata==='object'?pStepMetadata:{};tmpStep.TimeStart=false;tmpStep.TimeEnd=false;// There is an array of steps, in the Operation State itself ... push a step there
3264
- this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep];this.stepFunctions[tmpStep.GUIDStep]=fStepFunction;this.state.Status.StepCount++;return tmpStep;}getStep(pGUIDStep){if(this.stepMap.hasOwnProperty(pGUIDStep)){return this.stepMap[pGUIDStep];}return false;}startStep(pGUIDStep){let tmpStep=this.getStep(pGUIDStep);if(tmpStep===false){return false;}tmpStep.TimeStart=+new Date();return tmpStep;}stopStep(pGUIDStep){let tmpStep=this.getStep(pGUIDStep);if(tmpStep===false){return false;}tmpStep.TimeEnd=+new Date();return tmpStep;}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);}/************************************************************************
3266
+ this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep];this.stepFunctions[tmpStep.GUIDStep]=fStepFunction;this.state.Status.StepCount++;return tmpStep;}getStep(pGUIDStep){if(this.stepMap.hasOwnProperty(pGUIDStep)){return this.stepMap[pGUIDStep];}return false;}startStep(pGUIDStep){let tmpStep=this.getStep(pGUIDStep);if(tmpStep===false){return false;}tmpStep.TimeStart=+new Date();return tmpStep;}stopStep(pGUIDStep){let tmpStep=this.getStep(pGUIDStep);if(tmpStep===false){return false;}tmpStep.TimeEnd=+new Date();return tmpStep;}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);}/************************************************************************
3265
3267
  * BEGINNING OF --> Telemetry Helpers
3266
- */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()
3267
- // {
3268
- //
3269
- // const tmpResourcesUsed = process.memoryUsage().heapUsed / 1024 / 1024;
3270
- // this.info(`Memory usage at ${Math.round(tmpResourcesUsed * 100) / 100} MB`);
3271
- // }
3272
- /*
3268
+ */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."));}}}/*
3273
3269
  * END OF --> Logging and Telemetry Helpers
3274
3270
  ************************************************************************/}module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":127,"fable-serviceproviderbase":43}],129:[function(require,module,exports){(function(Buffer){(function(){const libFableServiceBase=require('fable-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
3275
3271
  // of the request options before they are passed to the request library.