fable 3.0.105 → 3.0.107

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
@@ -2847,7 +2847,7 @@ this.connectFable(this);// --> Bootstrapping of fable into the Service Manager i
2847
2847
  // They will then be available in the Default service provider set as well.
2848
2848
  this.connectPreinitServiceProviderInstance(this.UUID);this.connectPreinitServiceProviderInstance(this.Logging);this.connectPreinitServiceProviderInstance(this.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
2849
2849
  this.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));this.addServiceType('Template',require('./services/Fable-Service-Template.js'));this.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));this.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));this.addAndInstantiateServiceType('Dates',require('./services/Fable-Service-DateManipulation.js'));this.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));this.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));this.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));this.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));this.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));this.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));this.addServiceType('Manifest',require('manyfest'));this.addServiceType('ObjectCache',require('cachetrax'));this.addServiceType('FilePersistence',require('./services/Fable-Service-FilePersistence.js'));}/* State Accessors */get isFable(){return true;}get settings(){return this.SettingsManager.settings;}get settingsManager(){return this.SettingsManager;}// For backwards compatibility
2850
- getUUID(){return this.UUID.getUUID();}/* Service Manager Methods */addServiceType(pServiceType,pServiceClass){if(this.servicesMap.hasOwnProperty(pServiceType)){// TODO: Check if any services are running?
2850
+ getUUID(){return this.UUID.getUUID();}newAnticipate(){return this.instantiateServiceProviderWithoutRegistration('Anticipate');}/* Service Manager Methods */addServiceType(pServiceType,pServiceClass){if(this.servicesMap.hasOwnProperty(pServiceType)){// TODO: Check if any services are running?
2851
2851
  this.log.warn("Adding a service type [".concat(pServiceType,"] that already exists."));}else{// Add the container for instantiated services to go in
2852
2852
  this.servicesMap[pServiceType]={};// Add the type to the list of types
2853
2853
  this.serviceTypes.push(pServiceType);}// Using the static member of the class is a much more reliable way to check if it is a service class than instanceof
@@ -2874,15 +2874,16 @@ if(!this.services.hasOwnProperty(tmpServiceType)){this.setDefaultServiceInstanti
2874
2874
  let tmpOverwriteService=typeof pOverwriteService==='undefined'?true:pOverwriteService;// Make sure the service exists
2875
2875
  if(this.servicesMap[pServiceType].hasOwnProperty(pServiceHash)){if(!this.hasOwnProperty(pServiceType)||tmpOverwriteService){this[pServiceType]=this.servicesMap[pServiceType][pServiceHash];}if(!this.services.hasOwnProperty(pServiceType)||tmpOverwriteService){this.services[pServiceType]=this.servicesMap[pServiceType][pServiceHash];}return true;}return false;}}// This is for backwards compatibility
2876
2876
  function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports.new=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./services/Fable-Service-Anticipate.js":120,"./services/Fable-Service-CSVParser.js":121,"./services/Fable-Service-DataFormat.js":122,"./services/Fable-Service-DataGeneration.js":124,"./services/Fable-Service-DateManipulation.js":125,"./services/Fable-Service-EnvironmentData.js":126,"./services/Fable-Service-FilePersistence.js":127,"./services/Fable-Service-MetaTemplate.js":128,"./services/Fable-Service-Operation.js":132,"./services/Fable-Service-RestClient.js":133,"./services/Fable-Service-Template.js":134,"./services/Fable-Service-Utility.js":135,"cachetrax":22,"fable-log":43,"fable-serviceproviderbase":44,"fable-settings":47,"fable-uuid":49,"manyfest":72}],120:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceAnticipate extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
2877
- this.operationQueue=[];this.erroredOperations=[];this.executingOperationCount=0;this.completedOperationCount=0;this.maxOperations=1;this.lastError=undefined;this.waitingFunctions=[];}checkQueue(){// This checks to see if we need to start any operations.
2877
+ this.operationQueue=[];this.erroredOperations=[];this.executingOperationCount=0;this.completedOperationCount=0;this.callDepth=0;this.maxOperations=1;this.lastError=undefined;this.waitingFunctions=[];}checkQueue(){// This checks to see if we need to start any operations.
2878
2878
  if(this.operationQueue.length>0&&this.executingOperationCount<this.maxOperations){let tmpOperation=this.operationQueue.shift();this.executingOperationCount+=1;tmpOperation(this.buildAnticipatorCallback());}else if(this.waitingFunctions.length>0&&this.executingOperationCount<1){// If there are no operations left, and we have waiting functions, call them.
2879
2879
  for(let i=0;i<this.waitingFunctions.length;i++){//this.log.trace('Calling waiting function.')
2880
2880
  this.waitingFunctions[i](this.lastError);}// Reset our state
2881
2881
  this.lastError=undefined;this.waitingFunctions=[];}}// Expects a function fAsynchronousFunction(fCallback)
2882
2882
  anticipate(fAsynchronousFunction){//this.log.trace('Adding a function...')
2883
2883
  this.operationQueue.push(fAsynchronousFunction);this.checkQueue();}buildAnticipatorCallback(){// This uses closure-scoped state to track the callback state
2884
- let tmpCallbackState={Called:false,Error:undefined,OperationSet:this};return hoistedCallback;function hoistedCallback(pError){if(tmpCallbackState.Called){// If they call the callback twice, throw an error
2885
- throw new Error("Anticipation async callback called twice...");}tmpCallbackState.Called=true;tmpCallbackState.error=pError;tmpCallbackState.OperationSet.executingOperationCount-=1;tmpCallbackState.OperationSet.completedOperationCount+=1;tmpCallbackState.OperationSet.checkQueue();}}wait(fCallback){this.waitingFunctions.push(fCallback);this.checkQueue();}}module.exports=FableServiceAnticipate;},{"fable-serviceproviderbase":44}],121:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/**
2884
+ let tmpCallbackState={Called:false,Error:undefined,OperationSet:this};return hoistedCallback.bind(this);function hoistedCallback(pError){if(tmpCallbackState.Called){// If they call the callback twice, throw an error
2885
+ throw new Error("Anticipation async callback called twice...");}tmpCallbackState.Called=true;tmpCallbackState.error=pError;tmpCallbackState.OperationSet.executingOperationCount-=1;tmpCallbackState.OperationSet.completedOperationCount+=1;tmpCallbackState.OperationSet.callDepth++;// TODO: Figure out a better pattern for chaining templates so the call stack doesn't get abused.
2886
+ if(tmpCallbackState.OperationSet.callDepth>400){tmpCallbackState.OperationSet.callDepth=0;setTimeout(tmpCallbackState.OperationSet.checkQueue.bind(this),0);}else{tmpCallbackState.OperationSet.checkQueue();}}}wait(fCallback){this.waitingFunctions.push(fCallback);this.checkQueue();}}module.exports=FableServiceAnticipate;},{"fable-serviceproviderbase":44}],121:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/**
2886
2887
  * Parsing CSVs. Why? Because it's a thing that needs to be done.
2887
2888
  *
2888
2889
  * 1. And the other node CSV parsers had issues with the really messy files we had.