pict 1.0.183 → 1.0.186

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.
Files changed (52) hide show
  1. package/dist/pict.compatible.js +566 -254
  2. package/dist/pict.compatible.min.js +2 -2
  3. package/dist/pict.compatible.min.js.map +1 -1
  4. package/dist/pict.js +489 -177
  5. package/dist/pict.min.js +2 -2
  6. package/dist/pict.min.js.map +1 -1
  7. package/eslint.config.mjs +10 -0
  8. package/package.json +12 -3
  9. package/source/Pict-Browser-SafeLoad.js +13 -5
  10. package/source/Pict-Browser-SafeOnDocumentReady.js +8 -3
  11. package/source/Pict-Browser-Shim.js +3 -3
  12. package/source/Pict-CSS.js +1 -1
  13. package/source/Pict-Content-Assignment.js +115 -9
  14. package/source/Pict-DataProvider.js +8 -8
  15. package/source/Pict-Meadow-EntityProvider.js +2 -2
  16. package/source/Pict-Template-Provider.js +132 -94
  17. package/source/Pict-Template.js +80 -0
  18. package/source/Pict.js +176 -74
  19. package/source/environments/Pict-Environment-Log.js +63 -10
  20. package/source/environments/Pict-Environment-Object.js +12 -6
  21. package/source/templates/Pict-Template-Data.js +80 -0
  22. package/test/Pict_application_tests.js +1 -1
  23. package/test/Pict_contentassignment_tests.js +1 -1
  24. package/test/Pict_css_tests.js +1 -1
  25. package/test/Pict_provider_tests.js +1 -1
  26. package/test/Pict_template_complex_tests.js +1 -1
  27. package/test/Pict_template_tests.js +1 -1
  28. package/test/Pict_tests.js +15 -2
  29. package/test/Pict_view_tests.js +1 -1
  30. package/tsconfig.json +11 -0
  31. package/types/Pict-Browser-SafeLoad.d.ts +3 -0
  32. package/types/Pict-Browser-SafeLoad.d.ts.map +1 -0
  33. package/types/Pict-Browser-SafeOnDocumentReady.d.ts +3 -0
  34. package/types/Pict-Browser-SafeOnDocumentReady.d.ts.map +1 -0
  35. package/types/Pict-Browser-Shim.d.ts +3 -0
  36. package/types/Pict-Browser-Shim.d.ts.map +1 -0
  37. package/types/Pict-CSS.d.ts +10 -0
  38. package/types/Pict-CSS.d.ts.map +1 -0
  39. package/types/Pict-Content-Assignment.d.ts +139 -0
  40. package/types/Pict-Content-Assignment.d.ts.map +1 -0
  41. package/types/Pict-DataProvider.d.ts +7 -0
  42. package/types/Pict-DataProvider.d.ts.map +1 -0
  43. package/types/Pict-Meadow-EntityProvider.d.ts +14 -0
  44. package/types/Pict-Meadow-EntityProvider.d.ts.map +1 -0
  45. package/types/Pict-Template-Provider.d.ts +64 -0
  46. package/types/Pict-Template-Provider.d.ts.map +1 -0
  47. package/types/Pict.d.ts +147 -0
  48. package/types/Pict.d.ts.map +1 -0
  49. package/types/environments/Pict-Environment-Log.d.ts +98 -0
  50. package/types/environments/Pict-Environment-Log.d.ts.map +1 -0
  51. package/types/environments/Pict-Environment-Object.d.ts +58 -0
  52. package/types/environments/Pict-Environment-Object.d.ts.map +1 -0
@@ -633,8 +633,8 @@ return true;}}]);}(libFableServiceProviderBase);module.exports=BaseLogger;},{"fa
633
633
  *
634
634
  * @author Steven Velozo <steven@velozo.com>
635
635
  */ // Return the providers that are available without extensions loaded
636
- var getDefaultProviders=function getDefaultProviders(){var tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders["default"]=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":49}],48:[function(require,module,exports){module.exports=[{"loggertype":"console","streamtype":"console","level":"trace"}];},{}],49:[function(require,module,exports){var libBaseLogger=require('./Fable-Log-BaseLogger.js');var ConsoleLogger=/*#__PURE__*/function(_libBaseLogger){function ConsoleLogger(pLogStreamSettings,pFableLog){var _this7;_classCallCheck2(this,ConsoleLogger);_this7=_callSuper(this,ConsoleLogger,[pLogStreamSettings]);_this7._ShowTimeStamps=_this7._Settings.hasOwnProperty('showtimestamps')?_this7._Settings.showtimestamps==true:true;_this7._FormattedTimeStamps=_this7._Settings.hasOwnProperty('formattedtimestamps')?_this7._Settings.formattedtimestamps==true:true;_this7._ContextMessage=_this7._Settings.hasOwnProperty('Context')?"(".concat(_this7._Settings.Context,")"):pFableLog._Settings.hasOwnProperty('Product')?"(".concat(pFableLog._Settings.Product,")"):'Unnamed_Log_Context';// Allow the user to decide what gets output to the console
637
- _this7._OutputLogLinesToConsole=_this7._Settings.hasOwnProperty('outputloglinestoconsole')?_this7._Settings.outputloglinestoconsole:true;_this7._OutputObjectsToConsole=_this7._Settings.hasOwnProperty('outputobjectstoconsole')?_this7._Settings.outputobjectstoconsole:true;// Precompute the prefix for each level
636
+ var getDefaultProviders=function getDefaultProviders(){var tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders["default"]=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":49}],48:[function(require,module,exports){module.exports=[{"loggertype":"console","streamtype":"console","level":"trace"}];},{}],49:[function(require,module,exports){var libBaseLogger=require('./Fable-Log-BaseLogger.js');var ConsoleLogger=/*#__PURE__*/function(_libBaseLogger){function ConsoleLogger(pLogStreamSettings,pFableLog){var _this7;_classCallCheck2(this,ConsoleLogger);_this7=_callSuper(this,ConsoleLogger,[pLogStreamSettings]);_this7._ShowTimeStamps='showtimestamps'in _this7._Settings?_this7._Settings.showtimestamps==true:true;_this7._FormattedTimeStamps='formattedtimestamps'in _this7._Settings?_this7._Settings.formattedtimestamps==true:true;_this7._ContextMessage='Context'in _this7._Settings?"(".concat(_this7._Settings.Context,")"):'Product'in pFableLog._Settings?"(".concat(pFableLog._Settings.Product,")"):'Unnamed_Log_Context';// Allow the user to decide what gets output to the console
637
+ _this7._OutputLogLinesToConsole='outputloglinestoconsole'in _this7._Settings?_this7._Settings.outputloglinestoconsole:true;_this7._OutputObjectsToConsole='outputobjectstoconsole'in _this7._Settings?_this7._Settings.outputobjectstoconsole:true;// Precompute the prefix for each level
638
638
  _this7.prefixCache={};for(var i=0;i<=_this7.levels.length;i++){_this7.prefixCache[_this7.levels[i]]="[".concat(_this7.levels[i],"] ").concat(_this7._ContextMessage,": ");if(_this7._ShowTimeStamps){// If there is a timestamp we need a to prepend space before the prefixcache string, since the timestamp comes first
639
639
  _this7.prefixCache[_this7.levels[i]]=' '+_this7.prefixCache[_this7.levels[i]];}}return _this7;}_inherits(ConsoleLogger,_libBaseLogger);return _createClass2(ConsoleLogger,[{key:"write",value:function write(pLevel,pLogText,pObject){var tmpTimeStamp='';if(this._ShowTimeStamps&&this._FormattedTimeStamps){tmpTimeStamp=new Date().toISOString();}else if(this._ShowTimeStamps){tmpTimeStamp=+new Date();}var tmpLogLine="".concat(tmpTimeStamp).concat(this.prefixCache[pLevel]).concat(pLogText);if(this._OutputLogLinesToConsole){console.log(tmpLogLine);}// Write out the object on a separate line if it is passed in
640
640
  if(this._OutputObjectsToConsole&&typeof pObject!=='undefined'){console.log(JSON.stringify(pObject,null,2));}// Provide an easy way to be overridden and be consistent
@@ -649,14 +649,14 @@ this.fileWriter.once('drain',this.completeBufferFlushToLogFile.bind(this,tmpFlus
649
649
  this.logLineStrings.push(tmpLogLine);// Write out the object on a separate line if it is passed in
650
650
  if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}]);}(libConsoleLog);module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":49,"fs":19,"path":113}],51:[function(require,module,exports){/**
651
651
  * Fable Logging Service
652
- */var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var FableLog=/*#__PURE__*/function(_libFableServiceProvi3){function FableLog(pSettings,pServiceHash){var _this9;_classCallCheck2(this,FableLog);_this9=_callSuper(this,FableLog,[pSettings,pServiceHash]);_this9.serviceType='Logging';var tmpSettings=_typeof(pSettings)==='object'?pSettings:{};_this9._Settings=tmpSettings;_this9._Providers=require('./Fable-Log-DefaultProviders-Node.js');_this9._StreamDefinitions=tmpSettings.hasOwnProperty('LogStreams')?tmpSettings.LogStreams:require('./Fable-Log-DefaultStreams.json');_this9.logStreams=[];// This object gets decorated for one-time instantiated providers that
652
+ */var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var FableLog=/*#__PURE__*/function(_libFableServiceProvi3){function FableLog(pSettings,pServiceHash){var _this9;_classCallCheck2(this,FableLog);_this9=_callSuper(this,FableLog,[pSettings,pServiceHash]);_this9.serviceType='Logging';var tmpSettings=_typeof(pSettings)==='object'?pSettings:{};_this9._Settings=tmpSettings;_this9._Providers=require('./Fable-Log-DefaultProviders-Node.js');_this9._StreamDefinitions='LogStreams'in tmpSettings?tmpSettings.LogStreams:require('./Fable-Log-DefaultStreams.json');_this9.logStreams=[];// This object gets decorated for one-time instantiated providers that
653
653
  // have multiple outputs, such as bunyan.
654
654
  _this9.logProviders={};// A hash list of the GUIDs for each log stream, so they can't be added to the set more than one time
655
655
  _this9.activeLogStreams={};_this9.logStreamsTrace=[];_this9.logStreamsDebug=[];_this9.logStreamsInfo=[];_this9.logStreamsWarn=[];_this9.logStreamsError=[];_this9.logStreamsFatal=[];_this9.datumDecorator=function(pDatum){return pDatum;};_this9.uuid=typeof tmpSettings.Product==='string'?tmpSettings.Product:'Default';return _this9;}_inherits(FableLog,_libFableServiceProvi3);return _createClass2(FableLog,[{key:"addLogger",value:function addLogger(pLogger,pLevel){// Bail out if we've already created one.
656
- if(this.activeLogStreams.hasOwnProperty(pLogger.loggerUUID)){return false;}// Add it to the streams and to the mutex
656
+ if(pLogger.loggerUUID in this.activeLogStreams){return false;}// Add it to the streams and to the mutex
657
657
  this.logStreams.push(pLogger);this.activeLogStreams[pLogger.loggerUUID]=true;// Make sure a kosher level was passed in
658
658
  switch(pLevel){case'trace':this.logStreamsTrace.push(pLogger);case'debug':this.logStreamsDebug.push(pLogger);case'info':this.logStreamsInfo.push(pLogger);case'warn':this.logStreamsWarn.push(pLogger);case'error':this.logStreamsError.push(pLogger);case'fatal':this.logStreamsFatal.push(pLogger);break;}return true;}},{key:"setDatumDecorator",value:function setDatumDecorator(fDatumDecorator){if(typeof fDatumDecorator==='function'){this.datumDecorator=fDatumDecorator;}else{this.datumDecorator=function(pDatum){return pDatum;};}}},{key:"trace",value:function trace(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsTrace.length;i++){this.logStreamsTrace[i].trace(pMessage,tmpDecoratedDatum);}}},{key:"debug",value:function debug(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsDebug.length;i++){this.logStreamsDebug[i].debug(pMessage,tmpDecoratedDatum);}}},{key:"info",value:function info(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsInfo.length;i++){this.logStreamsInfo[i].info(pMessage,tmpDecoratedDatum);}}},{key:"warn",value:function warn(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsWarn.length;i++){this.logStreamsWarn[i].warn(pMessage,tmpDecoratedDatum);}}},{key:"error",value:function error(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsError.length;i++){this.logStreamsError[i].error(pMessage,tmpDecoratedDatum);}}},{key:"fatal",value:function fatal(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsFatal.length;i++){this.logStreamsFatal[i].fatal(pMessage,tmpDecoratedDatum);}}},{key:"initialize",value:function initialize(){// "initialize" each logger as defined in the logging parameters
659
- for(var i=0;i<this._StreamDefinitions.length;i++){var 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
+ for(var i=0;i<this._StreamDefinitions.length;i++){var tmpStreamDefinition=Object.assign({loggertype:'default',streamtype:'console',level:'info'},this._StreamDefinitions[i]);if(!(tmpStreamDefinition.loggertype in this._Providers)){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.
660
660
  for(var _i=0;_i<this.logStreams.length;_i++){this.logStreams[_i].initialize();}}},{key:"logTime",value:function logTime(pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time';var tmpTime=new Date();this.info("".concat(tmpMessage," ").concat(tmpTime," (epoch ").concat(+tmpTime,")"),pDatum);}// Get a timestamp
661
661
  },{key:"getTimeStamp",value:function getTimeStamp(){return+new Date();}},{key:"getTimeDelta",value:function getTimeDelta(pTimeStamp){var tmpEndTime=+new Date();return tmpEndTime-pTimeStamp;}// Log the delta between a timestamp, and now with a message
662
662
  },{key:"logTimeDelta",value:function logTimeDelta(pTimeDelta,pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';var tmpDatum=_typeof(pDatum)==='object'?pDatum:{};var tmpEndTime=+new Date();this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms)"),pDatum);}},{key:"logTimeDeltaHuman",value:function logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';var tmpEndTime=+new Date();var tmpMs=parseInt(pTimeDelta%1000);var tmpSeconds=parseInt(pTimeDelta/1000%60);var tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);var 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);}},{key:"logTimeDeltaRelative",value:function logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}},{key:"logTimeDeltaRelativeHuman",value:function logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}]);}(libFableServiceProviderBase);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":46,"./Fable-Log-DefaultProviders-Node.js":47,"./Fable-Log-DefaultStreams.json":48,"./Fable-Log-Logger-Console.js":49,"./Fable-Log-Logger-SimpleFlatFile.js":50,"fable-serviceproviderbase":52}],52:[function(require,module,exports){/**
@@ -682,7 +682,7 @@ module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{}],53:[functi
682
682
  * @module Fable Settings
683
683
  */var libPrecedent=require('precedent');var FableSettingsTemplateProcessor=/*#__PURE__*/function(){function FableSettingsTemplateProcessor(pDependencies){_classCallCheck2(this,FableSettingsTemplateProcessor);// Use a no-dependencies templating engine to parse out environment variables
684
684
  this.templateProcessor=new libPrecedent();// TODO: Make the environment variable wrap expression demarcation characters configurable?
685
- this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|');var tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}return _createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":120,"precedent":117}],55:[function(require,module,exports){/**
685
+ this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|');var tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(tmpEnvironmentVariableName in process.env){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}return _createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":120,"precedent":117}],55:[function(require,module,exports){/**
686
686
  * Fable Settings Add-on
687
687
  *
688
688
  *
@@ -738,10 +738,10 @@ for(var i=0,tmpValue;i<16;i++){if((i&0x03)===0){tmpValue=Math.random()*0x1000000
738
738
  * Fable UUID Generator
739
739
  */var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;0;var libRandomByteGenerator=require('./Fable-UUID-Random.js');var FableUUID=/*#__PURE__*/function(_libFableServiceProvi5){function FableUUID(pSettings,pServiceHash){var _this12;_classCallCheck2(this,FableUUID);_this12=_callSuper(this,FableUUID,[pSettings,pServiceHash]);_this12.serviceType='UUID';// Determine if the module is in "Random UUID Mode" which means just use the random character function rather than the v4 random UUID spec.
740
740
  // Note this allows UUIDs of various lengths (including very short ones) although guaranteed uniqueness goes downhill fast.
741
- _this12._UUIDModeRandom=_typeof(pSettings)==='object'&&pSettings.hasOwnProperty('UUIDModeRandom')?pSettings.UUIDModeRandom==true:false;// These two properties are only useful if we are in Random mode. Otherwise it generates a v4 spec
741
+ _this12._UUIDModeRandom=_typeof(pSettings)==='object'&&'UUIDModeRandom'in pSettings?pSettings.UUIDModeRandom==true:false;// These two properties are only useful if we are in Random mode. Otherwise it generates a v4 spec
742
742
  // Length for "Random UUID Mode" is set -- if not set it to 8
743
- _this12._UUIDLength=_typeof(pSettings)==='object'&&pSettings.hasOwnProperty('UUIDLength')?pSettings.UUIDLength+0:8;// Dictionary for "Random UUID Mode"
744
- _this12._UUIDRandomDictionary=_typeof(pSettings)==='object'&&pSettings.hasOwnProperty('UUIDDictionary')?pSettings.UUIDDictionary+0:'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';_this12.randomByteGenerator=new libRandomByteGenerator();// Lookup table for hex codes
743
+ _this12._UUIDLength=_typeof(pSettings)==='object'&&'UUIDLength'in pSettings?pSettings.UUIDLength+0:8;// Dictionary for "Random UUID Mode"
744
+ _this12._UUIDRandomDictionary=_typeof(pSettings)==='object'&&'UUIDDictionary'in pSettings?pSettings.UUIDDictionary+0:'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';_this12.randomByteGenerator=new libRandomByteGenerator();// Lookup table for hex codes
745
745
  _this12._HexLookup=[];for(var i=0;i<256;++i){_this12._HexLookup[i]=(i+0x100).toString(16).substr(1);}return _this12;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
746
746
  _inherits(FableUUID,_libFableServiceProvi5);return _createClass2(FableUUID,[{key:"bytesToUUID",value:function bytesToUUID(pBuffer){var i=0;// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
747
747
  return[this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]]].join('');}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
@@ -775,32 +775,32 @@ _this13.connectFable(_this13);// --> Bootstrapping of fable into the Service Man
775
775
  // They will then be available in the Default service provider set as well.
776
776
  _this13.connectPreinitServiceProviderInstance(_this13.UUID);_this13.connectPreinitServiceProviderInstance(_this13.Logging);_this13.connectPreinitServiceProviderInstance(_this13.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
777
777
  _this13.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));_this13.addServiceType('Template',require('./services/Fable-Service-Template.js'));_this13.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));_this13.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));_this13.addAndInstantiateServiceType('Dates',require('./services/Fable-Service-DateManipulation.js'));_this13.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));_this13.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));_this13.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));_this13.addAndInstantiateServiceType('Math',require('./services/Fable-Service-Math.js'));_this13.addServiceType('ExpressionParser',require('./services/Fable-Service-ExpressionParser.js'));_this13.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));_this13.addServiceType('Manifest',require('manyfest'));_this13.addServiceType('ObjectCache',require('cachetrax'));_this13.addAndInstantiateServiceType('ProgressTime',require('./services/Fable-Service-ProgressTime.js'));_this13.addServiceType('ProgressTrackerSet',require('./services/Fable-Service-ProgressTrackerSet.js'));_this13.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));_this13.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));_this13.addServiceType('FilePersistence',require('./services/Fable-Service-FilePersistence.js'));return _this13;}/* State Accessors */_inherits(Fable,_libFableServiceBase$);return _createClass2(Fable,[{key:"isFable",get:function get(){return true;}},{key:"settings",get:function get(){return this.SettingsManager.settings;}},{key:"settingsManager",get:function get(){return this.SettingsManager;}// For backwards compatibility
778
- },{key:"getUUID",value:function getUUID(){return this.UUID.getUUID();}},{key:"newAnticipate",value:function newAnticipate(){return this.instantiateServiceProviderWithoutRegistration('Anticipate');}},{key:"newManyfest",value:function newManyfest(pManifestDefinition){return this.instantiateServiceProviderWithoutRegistration('Manifest',pManifestDefinition);}/* Service Manager Methods */},{key:"addServiceType",value:function addServiceType(pServiceType,pServiceClass){if(this.servicesMap.hasOwnProperty(pServiceType)){// TODO: Check if any services are running?
778
+ },{key:"getUUID",value:function getUUID(){return this.UUID.getUUID();}},{key:"newAnticipate",value:function newAnticipate(){return this.instantiateServiceProviderWithoutRegistration('Anticipate');}},{key:"newManyfest",value:function newManyfest(pManifestDefinition){return this.instantiateServiceProviderWithoutRegistration('Manifest',pManifestDefinition);}/* Service Manager Methods */},{key:"addServiceType",value:function addServiceType(pServiceType,pServiceClass){if(pServiceType in this.servicesMap){// TODO: Check if any services are running?
779
779
  this.log.warn("Adding a service type [".concat(pServiceType,"] that already exists. This will change the default class prototype for this service."));}else{// Add the container for instantiated services to go in
780
780
  this.servicesMap[pServiceType]={};// Add the type to the list of types
781
781
  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
782
782
  if(typeof pServiceClass=='function'&&pServiceClass.isFableService){// Add the class to the list of classes
783
783
  this.serviceClasses[pServiceType]=pServiceClass;}else{// Add the base class to the list of classes
784
- this.log.error("Attempted to add service type [".concat(pServiceType,"] with an invalid class. Using base service class, which will not crash but won't provide meaningful services."));this.serviceClasses[pServiceType]=libFableServiceBase;}return this.serviceClasses[pServiceType];}},{key:"addServiceTypeIfNotExists",value:function addServiceTypeIfNotExists(pServiceType,pServiceClass){if(!this.servicesMap.hasOwnProperty(pServiceType)){return this.addServiceType(pServiceType,pServiceClass);}else{return this.serviceClasses[pServiceType];}}// This is for the services that are meant to run mostly single-instance so need a default at initialization
785
- },{key:"addAndInstantiateServiceType",value:function addAndInstantiateServiceType(pServiceType,pServiceClass){this.addServiceType(pServiceType,pServiceClass);return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}},{key:"addAndInstantiateServiceTypeIfNotExists",value:function addAndInstantiateServiceTypeIfNotExists(pServiceType,pServiceClass){if(!this.servicesMap.hasOwnProperty(pServiceType)){return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}else{return this.serviceClasses[pServiceType];}}// Some services expect to be overloaded / customized class.
784
+ this.log.error("Attempted to add service type [".concat(pServiceType,"] with an invalid class. Using base service class, which will not crash but won't provide meaningful services."));this.serviceClasses[pServiceType]=libFableServiceBase;}return this.serviceClasses[pServiceType];}},{key:"addServiceTypeIfNotExists",value:function addServiceTypeIfNotExists(pServiceType,pServiceClass){if(!(pServiceType in this.servicesMap)){return this.addServiceType(pServiceType,pServiceClass);}else{return this.serviceClasses[pServiceType];}}// This is for the services that are meant to run mostly single-instance so need a default at initialization
785
+ },{key:"addAndInstantiateServiceType",value:function addAndInstantiateServiceType(pServiceType,pServiceClass){this.addServiceType(pServiceType,pServiceClass);return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}},{key:"addAndInstantiateServiceTypeIfNotExists",value:function addAndInstantiateServiceTypeIfNotExists(pServiceType,pServiceClass){if(!(pServiceType in this.servicesMap)){return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}else{return this.serviceClasses[pServiceType];}}// Some services expect to be overloaded / customized class.
786
786
  },{key:"instantiateServiceProviderFromPrototype",value:function instantiateServiceProviderFromPrototype(pServiceType,pOptions,pCustomServiceHash,pServicePrototype){// Instantiate the service
787
787
  var tmpService=new pServicePrototype(this,pOptions,pCustomServiceHash);if(this.extraServiceInitialization){tmpService=this.extraServiceInitialization(tmpService);}// Add the service to the service map
788
788
  this.servicesMap[pServiceType][tmpService.Hash]=tmpService;// If this is the first service of this type, make it the default
789
- if(!this.services.hasOwnProperty(pServiceType)){this.setDefaultServiceInstantiation(pServiceType,tmpService.Hash);}return tmpService;}},{key:"instantiateServiceProvider",value:function instantiateServiceProvider(pServiceType,pOptions,pCustomServiceHash){// Instantiate the service
789
+ if(!(pServiceType in this.services)){this.setDefaultServiceInstantiation(pServiceType,tmpService.Hash);}return tmpService;}},{key:"instantiateServiceProvider",value:function instantiateServiceProvider(pServiceType,pOptions,pCustomServiceHash){// Instantiate the service
790
790
  var tmpService=this.instantiateServiceProviderWithoutRegistration(pServiceType,pOptions,pCustomServiceHash);// Add the service to the service map
791
791
  this.servicesMap[pServiceType][tmpService.Hash]=tmpService;// If this is the first service of this type, make it the default
792
- if(!this.services.hasOwnProperty(pServiceType)){this.setDefaultServiceInstantiation(pServiceType,tmpService.Hash);}return tmpService;}},{key:"instantiateServiceProviderIfNotExists",value:function instantiateServiceProviderIfNotExists(pServiceType,pOptions,pCustomServiceHash){if(this.services.hasOwnProperty(pServiceType)){return this.services[pServiceType];}else{return this.instantiateServiceProvider(pServiceType,pOptions,pCustomServiceHash);}}// Create a service provider but don't register it to live forever in fable.services
792
+ if(!(pServiceType in this.services)){this.setDefaultServiceInstantiation(pServiceType,tmpService.Hash);}return tmpService;}},{key:"instantiateServiceProviderIfNotExists",value:function instantiateServiceProviderIfNotExists(pServiceType,pOptions,pCustomServiceHash){if(pServiceType in this.services){return this.services[pServiceType];}else{return this.instantiateServiceProvider(pServiceType,pOptions,pCustomServiceHash);}}// Create a service provider but don't register it to live forever in fable.services
793
793
  },{key:"instantiateServiceProviderWithoutRegistration",value:function instantiateServiceProviderWithoutRegistration(pServiceType,pOptions,pCustomServiceHash){// Instantiate the service
794
794
  var tmpService=new this.serviceClasses[pServiceType](this,pOptions,pCustomServiceHash);if(this.extraServiceInitialization){tmpService=this.extraServiceInitialization(tmpService);}return tmpService;}// Connect an initialized service provider that came before Fable was initialized
795
795
  },{key:"connectPreinitServiceProviderInstance",value:function connectPreinitServiceProviderInstance(pServiceInstance){var tmpServiceType=pServiceInstance.serviceType;var tmpServiceHash=pServiceInstance.Hash;// The service should already be instantiated, so just connect it to fable
796
796
  pServiceInstance.connectFable(this);// Add the service type to the map if it isn't there yet
797
- if(!this.servicesMap.hasOwnProperty(tmpServiceType)){// If the core service hasn't registered itself yet, create the service container for it.
797
+ if(!(tmpServiceType in this.servicesMap)){// If the core service hasn't registered itself yet, create the service container for it.
798
798
  // This means you couldn't register another with this type unless it was later registered with a constructor class.
799
799
  this.servicesMap[tmpServiceType]={};}// Add the service to the service map
800
800
  this.servicesMap[tmpServiceType][tmpServiceHash]=pServiceInstance;// If this is the first service of this type, make it the default
801
- if(!this.services.hasOwnProperty(tmpServiceType)){this.setDefaultServiceInstantiation(tmpServiceType,tmpServiceHash,false);}return pServiceInstance;}},{key:"setDefaultServiceInstantiation",value:function setDefaultServiceInstantiation(pServiceType,pServiceHash,pOverwriteService){// Overwrite services by default, unless told not to
801
+ if(!(tmpServiceType in this.services)){this.setDefaultServiceInstantiation(tmpServiceType,tmpServiceHash,false);}return pServiceInstance;}},{key:"setDefaultServiceInstantiation",value:function setDefaultServiceInstantiation(pServiceType,pServiceHash,pOverwriteService){// Overwrite services by default, unless told not to
802
802
  var tmpOverwriteService=typeof pOverwriteService==='undefined'?true:pOverwriteService;// Make sure the service exists
803
- 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;}}]);}(libFableServiceBase.CoreServiceProviderBase);// This is for backwards compatibility
803
+ if(pServiceHash in this.servicesMap[pServiceType]){if(!(pServiceType in this)||tmpOverwriteService){this[pServiceType]=this.servicesMap[pServiceType][pServiceHash];}if(!(pServiceType in this.services)||tmpOverwriteService){this.services[pServiceType]=this.servicesMap[pServiceType][pServiceHash];}return true;}return false;}}]);}(libFableServiceBase.CoreServiceProviderBase);// This is for backwards compatibility
804
804
  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":59,"./services/Fable-Service-CSVParser.js":60,"./services/Fable-Service-DataFormat.js":61,"./services/Fable-Service-DataGeneration.js":63,"./services/Fable-Service-DateManipulation.js":64,"./services/Fable-Service-EnvironmentData.js":65,"./services/Fable-Service-ExpressionParser.js":66,"./services/Fable-Service-FilePersistence.js":74,"./services/Fable-Service-Math.js":75,"./services/Fable-Service-MetaTemplate.js":76,"./services/Fable-Service-Operation.js":80,"./services/Fable-Service-ProgressTime.js":81,"./services/Fable-Service-ProgressTrackerSet.js":83,"./services/Fable-Service-RestClient.js":84,"./services/Fable-Service-Template.js":85,"./services/Fable-Service-Utility.js":86,"cachetrax":22,"fable-log":51,"fable-serviceproviderbase":52,"fable-settings":55,"fable-uuid":57,"manyfest":110}],59:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceAnticipate=/*#__PURE__*/function(_libFableServiceBase){function FableServiceAnticipate(pFable,pOptions,pServiceHash){var _this14;_classCallCheck2(this,FableServiceAnticipate);_this14=_callSuper(this,FableServiceAnticipate,[pFable,pOptions,pServiceHash]);_this14.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
805
805
  _this14.operationQueue=[];_this14.erroredOperations=[];_this14.executingOperationCount=0;_this14.completedOperationCount=0;_this14.callDepth=0;_this14.maxOperations=1;_this14.lastError=undefined;_this14.waitingFunctions=[];return _this14;}_inherits(FableServiceAnticipate,_libFableServiceBase);return _createClass2(FableServiceAnticipate,[{key:"checkQueue",value:function checkQueue(){// This could be combined with the last else if stanza but the logic for errors and non-errors would be blended and more complex to follow so keeping it unrolled.
806
806
  if(this.lastError){// If there are no operations left, and we have waiting functions, call them.
@@ -1008,9 +1008,9 @@ return'';}else{var tmpPadLength=pTargetLength-pString.length;if(tmpPadLength>tmp
1008
1008
  if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
1009
1009
  &&tmpEnclosureStack.length==0){// Increment the segment count
1010
1010
  tmpSegmentCount++;}// IF This is the start of an enclosure
1011
- else if(tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])){// Add it to the stack!
1011
+ else if(tmpString[i]in tmpEnclosureStartSymbolMap){// Add it to the stack!
1012
1012
  tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);}// IF This is the end of an enclosure
1013
- else if(tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])// AND it matches the current nest level symbol
1013
+ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nest level symbol
1014
1014
  &&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
1015
1015
  tmpEnclosureStack.pop();}}return tmpSegmentCount;}/**
1016
1016
  * Get all segments in a string, respecting enclosures
@@ -1024,9 +1024,9 @@ tmpEnclosureStack.pop();}}return tmpSegmentCount;}/**
1024
1024
  if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
1025
1025
  &&tmpEnclosureStack.length==0){// Return the segment
1026
1026
  tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart,i));tmpCurrentSegmentStart=i+1;}// IF This is the start of an enclosure
1027
- else if(tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])){// Add it to the stack!
1027
+ else if(tmpString[i]in tmpEnclosureStartSymbolMap){// Add it to the stack!
1028
1028
  tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);}// IF This is the end of an enclosure
1029
- else if(tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])// AND it matches the current nest level symbol
1029
+ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nest level symbol
1030
1030
  &&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
1031
1031
  tmpEnclosureStack.pop();}}if(tmpCurrentSegmentStart<tmpString.length){tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart));}return tmpSegmentList;}/**
1032
1032
  * Get the first segment in a string, respecting enclosures
@@ -1040,9 +1040,9 @@ tmpEnclosureStack.pop();}}if(tmpCurrentSegmentStart<tmpString.length){tmpSegment
1040
1040
  if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
1041
1041
  &&tmpEnclosureStack.length==0){// Return the segment
1042
1042
  return tmpString.substring(0,i);}// IF This is the start of an enclosure
1043
- else if(tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])){// Add it to the stack!
1043
+ else if(tmpString[i]in tmpEnclosureStartSymbolMap){// Add it to the stack!
1044
1044
  tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);}// IF This is the end of an enclosure
1045
- else if(tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])// AND it matches the current nest level symbol
1045
+ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nest level symbol
1046
1046
  &&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
1047
1047
  tmpEnclosureStack.pop();}}return tmpString;}/**
1048
1048
  * Count the number of enclosures in a string based on the start and end characters.
@@ -1129,10 +1129,10 @@ var tmpValue=tmpManifest.getValueByHash(tmpDataSource,tmpToken.Token);// if (!tm
1129
1129
  // }
1130
1130
  if(!tmpValue){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.substituteValuesInTokenizedObjects found no value for the symbol hash or address ".concat(tmpToken.Token," at index ").concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}else{tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(tmpValue,"] for the state address ").concat(tmpToken.Token," at index ").concat(i));this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{var tmpValueParsed=new this.fable.Utility.bigNumber(tmpValue);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}if(pTokenizedObjects[i].Type==='Token.StateAddress'&&!tmpToken.Resolved){// Symbols are always hashes. This gracefully works for simple shallow objects because hashes default to the address in Manyfest.
1131
1131
  var _tmpValue=tmpManifest.getValueAtAddress(tmpDataSource,tmpToken.Token);if(!_tmpValue){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.substituteValuesInTokenizedObjects found no value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}else{tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(_tmpValue,"] for the state address ").concat(tmpToken.Token," at index ").concat(i));this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{var _tmpValueParsed=new this.fable.Utility.bigNumber(_tmpValue);tmpToken.Resolved=true;tmpToken.Value=_tmpValueParsed.toString();}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}if(pTokenizedObjects[i].Type==='Token.Constant'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(tmpToken.Token,"] for the constant ").concat(tmpToken.Token," at index ").concat(i));this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{var _tmpValueParsed2=new this.fable.Utility.bigNumber(tmpToken.Token);tmpToken.Resolved=true;tmpToken.Value=_tmpValueParsed2.toString();}catch(pError){// This constant has the right symbols but apparently isn't a parsable number.
1132
- tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}return pTokenizedObjects;}},{key:"tokenize",value:function tokenize(pExpression,pResultObject){return this.Tokenizer.tokenize(pExpression,pResultObject);}},{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){return this.Linter.lintTokenizedExpression(pTokenizedExpression,pResultObject);}},{key:"buildPostfixedSolveList",value:function buildPostfixedSolveList(pTokenizedExpression,pResultObject){return this.Postfix.buildPostfixedSolveList(pTokenizedExpression,pResultObject);}},{key:"solvePostfixedExpression",value:function solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){return this.Solver.solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest);}},{key:"solve",value:function solve(pExpression,pDataSourceObject,pResultObject,pManifest,pDataDestinationObject){var tmpResultsObject=_typeof(pResultObject)==='object'?pResultObject:{};var tmpDataSourceObject=_typeof(pDataSourceObject)==='object'?pDataSourceObject:{};var tmpDataDestinationObject=_typeof(pDataDestinationObject)==='object'?pDataDestinationObject:{};this.tokenize(pExpression,tmpResultsObject);this.lintTokenizedExpression(tmpResultsObject.RawTokens,tmpResultsObject);this.buildPostfixedSolveList(tmpResultsObject.RawTokens,tmpResultsObject);this.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects,tmpDataSourceObject,tmpResultsObject,pManifest);return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}]);}(libFableServiceBase);module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":68,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json":69,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js":70,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js":71,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js":72,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json":73,"big.js":17,"fable-serviceproviderbase":52}],67:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');var ExpressionParserOperationBase=/*#__PURE__*/function(_libFableServiceProvi9){function ExpressionParserOperationBase(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,ExpressionParserOperationBase);_this21=_callSuper(this,ExpressionParserOperationBase,[pFable,pOptions,pServiceHash]);_this21.serviceType='ExpressionParserOperationBase';_this21.numberTest=/^-{0,1}\d*\.{0,1}\d+$/;_this21.ExpressionParser=false;return _this21;}_inherits(ExpressionParserOperationBase,_libFableServiceProvi9);return _createClass2(ExpressionParserOperationBase,[{key:"connectExpressionParser",value:function connectExpressionParser(pExpressionParser){this.ExpressionParser=pExpressionParser;}},{key:"getTokenType",value:function getTokenType(pToken){if(this.ExpressionParser.tokenMap.hasOwnProperty(pToken)){return"Token.".concat(this.ExpressionParser.tokenMap[pToken].Type);}else if(pToken.length>2&&pToken[0]==='{'&&pToken[pToken.length-1]==='}'){return'Token.StateAddress';}else if(this.numberTest.test(pToken)){return'Token.Constant';}else{return'Token.Symbol';}// Just for documentation sake:
1132
+ tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}return pTokenizedObjects;}},{key:"tokenize",value:function tokenize(pExpression,pResultObject){return this.Tokenizer.tokenize(pExpression,pResultObject);}},{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){return this.Linter.lintTokenizedExpression(pTokenizedExpression,pResultObject);}},{key:"buildPostfixedSolveList",value:function buildPostfixedSolveList(pTokenizedExpression,pResultObject){return this.Postfix.buildPostfixedSolveList(pTokenizedExpression,pResultObject);}},{key:"solvePostfixedExpression",value:function solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){return this.Solver.solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest);}},{key:"solve",value:function solve(pExpression,pDataSourceObject,pResultObject,pManifest,pDataDestinationObject){var tmpResultsObject=_typeof(pResultObject)==='object'?pResultObject:{};var tmpDataSourceObject=_typeof(pDataSourceObject)==='object'?pDataSourceObject:{};var tmpDataDestinationObject=_typeof(pDataDestinationObject)==='object'?pDataDestinationObject:{};this.tokenize(pExpression,tmpResultsObject);this.lintTokenizedExpression(tmpResultsObject.RawTokens,tmpResultsObject);this.buildPostfixedSolveList(tmpResultsObject.RawTokens,tmpResultsObject);this.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects,tmpDataSourceObject,tmpResultsObject,pManifest);return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}]);}(libFableServiceBase);module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":68,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json":69,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js":70,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js":71,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js":72,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json":73,"big.js":17,"fable-serviceproviderbase":52}],67:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');var ExpressionParserOperationBase=/*#__PURE__*/function(_libFableServiceProvi9){function ExpressionParserOperationBase(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,ExpressionParserOperationBase);_this21=_callSuper(this,ExpressionParserOperationBase,[pFable,pOptions,pServiceHash]);_this21.serviceType='ExpressionParserOperationBase';_this21.numberTest=/^-{0,1}\d*\.{0,1}\d+$/;_this21.ExpressionParser=false;return _this21;}_inherits(ExpressionParserOperationBase,_libFableServiceProvi9);return _createClass2(ExpressionParserOperationBase,[{key:"connectExpressionParser",value:function connectExpressionParser(pExpressionParser){this.ExpressionParser=pExpressionParser;}},{key:"getTokenType",value:function getTokenType(pToken){if(pToken in this.ExpressionParser.tokenMap){return"Token.".concat(this.ExpressionParser.tokenMap[pToken].Type);}else if(pToken.length>2&&pToken[0]==='{'&&pToken[pToken.length-1]==='}'){return'Token.StateAddress';}else if(this.numberTest.test(pToken)){return'Token.Constant';}else{return'Token.Symbol';}// Just for documentation sake:
1133
1133
  // There is a fifth token type, VirtualSymbol
1134
1134
  // This is a value that's added during solve and looked up by address in the VirtualSymbol object.
1135
- }},{key:"getTokenContainerObject",value:function getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:this.ExpressionParser.tokenMap.hasOwnProperty(pToken)?this.ExpressionParser.tokenMap[pToken]:false};}}]);}(libFableServiceProviderBase);module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":52}],68:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionTokenizer=/*#__PURE__*/function(_libExpressionParserO){function ExpressionTokenizer(pFable,pOptions,pServiceHash){var _this22;_classCallCheck2(this,ExpressionTokenizer);_this22=_callSuper(this,ExpressionTokenizer,[pFable,pOptions,pServiceHash]);_this22.serviceType='ExpressionParser-Tokenizer';return _this22;}_inherits(ExpressionTokenizer,_libExpressionParserO);return _createClass2(ExpressionTokenizer,[{key:"tokenize",value:function tokenize(pExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.RawExpression=pExpression;tmpResults.RawTokens=[];tmpResults.ExpressionParserLog=[];if(typeof pExpression!=='string'){this.log.warn('ExpressionParser.tokenize was passed a non-string expression.');return tmpResults.RawTokens;}/* Tokenize the expression
1135
+ }},{key:"getTokenContainerObject",value:function getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:pToken in this.ExpressionParser.tokenMap?this.ExpressionParser.tokenMap[pToken]:false};}}]);}(libFableServiceProviderBase);module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":52}],68:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionTokenizer=/*#__PURE__*/function(_libExpressionParserO){function ExpressionTokenizer(pFable,pOptions,pServiceHash){var _this22;_classCallCheck2(this,ExpressionTokenizer);_this22=_callSuper(this,ExpressionTokenizer,[pFable,pOptions,pServiceHash]);_this22.serviceType='ExpressionParser-Tokenizer';return _this22;}_inherits(ExpressionTokenizer,_libExpressionParserO);return _createClass2(ExpressionTokenizer,[{key:"tokenize",value:function tokenize(pExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.RawExpression=pExpression;tmpResults.RawTokens=[];tmpResults.ExpressionParserLog=[];if(typeof pExpression!=='string'){this.log.warn('ExpressionParser.tokenize was passed a non-string expression.');return tmpResults.RawTokens;}/* Tokenize the expression
1136
1136
  *
1137
1137
  * Current token types:
1138
1138
  * - Value
@@ -1154,7 +1154,7 @@ if(tmpCurrentTokenType==='StateAddress'&&tmpCharacter==='}'){tmpCurrentToken+=tm
1154
1154
  // TODO: Should we just ignore it? We do at the moment.
1155
1155
  if(tmpCharacter=='}'){if(tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpCurrentToken='';tmpCurrentTokenType=false;tmpResults.ExpressionParserLog.push("ExpressionParser.tokenize found a closing brace without an opening brace in the expression: ".concat(pExpression," at character index ").concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}// 5. If we're not in an address and we hit an opening brace, we start an address
1156
1156
  if(tmpCharacter=='{'){if(tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpCurrentToken='';tmpCurrentTokenType='StateAddress';tmpCurrentToken=tmpCharacter;continue;}// [ TOKENS ]
1157
- if(this.ExpressionParser.tokenMap.hasOwnProperty(tmpCharacter)){if(tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpCurrentToken='';tmpCurrentTokenType=false;tmpResults.RawTokens.push(tmpCharacter);continue;}// If it's not an operator, it's a number or address.
1157
+ if(tmpCharacter in this.ExpressionParser.tokenMap){if(tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpCurrentToken='';tmpCurrentTokenType=false;tmpResults.RawTokens.push(tmpCharacter);continue;}// If it's not an operator, it's a number or address.
1158
1158
  // At the moment we aren't going to gate it on whether it's a valid address or not
1159
1159
  // Just treat anything not a known token on its own as a value identifier
1160
1160
  /* Per this stack overflow article: https://stackoverflow.com/questions/4434076/best-way-to-alphanumeric-check-in-javascript
@@ -1198,7 +1198,7 @@ this.getTokenType(pTokenizedExpression[0])==='Token.StateAddress'||this.getToken
1198
1198
  //|| (this.getTokenType(pTokenizedExpression[2]) === 'Token.StateAddress') || (this.getTokenType(pTokenizedExpression[0]) === 'Token.Symbol')
1199
1199
  ){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.lintTokenizedExpression found a single equality assignment in the tokenized expression with no assignable address on the left side of the assignment.");tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);}}}// 5. Check that there are no operators adjacent to each other
1200
1200
  // This is a simple lint check, not a full-blown syntax check
1201
- var tmpTokenPrevious=false;for(var _i6=0;_i6<pTokenizedExpression.length-1;_i6++){if(this.ExpressionParser.tokenMap.hasOwnProperty(pTokenizedExpression[_i6])&&this.ExpressionParser.tokenMap[pTokenizedExpression[_i6]].Type!='Parenthesis'&&!tmpTokenPrevious){tmpTokenPrevious=true;}else if(this.ExpressionParser.tokenMap.hasOwnProperty(pTokenizedExpression[_i6])&&this.ExpressionParser.tokenMap[pTokenizedExpression[_i6]].Type!='Parenthesis'){// If this isn't a + or - positivity/negativity multiplier, it's an error.
1201
+ var tmpTokenPrevious=false;for(var _i6=0;_i6<pTokenizedExpression.length-1;_i6++){if(pTokenizedExpression[_i6]in this.ExpressionParser.tokenMap&&this.ExpressionParser.tokenMap[pTokenizedExpression[_i6]].Type!='Parenthesis'&&!tmpTokenPrevious){tmpTokenPrevious=true;}else if(pTokenizedExpression[_i6]in this.ExpressionParser.tokenMap&&this.ExpressionParser.tokenMap[pTokenizedExpression[_i6]].Type!='Parenthesis'){// If this isn't a + or - positivity/negativity multiplier, it's an error.
1202
1202
  if(pTokenizedExpression[_i6]!=='+'&&pTokenizedExpression[_i6]!=='-'){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.lintTokenizedExpression found an ".concat(pTokenizedExpression[_i6]," operator adjacent to another operator in the tokenized expression at token index ").concat(_i6));tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);}}else{tmpTokenPrevious=false;}}return tmpResults.LinterResults;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserLinter;},{"./Fable-Service-ExpressionParser-Base.js":67}],71:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserPostfix=/*#__PURE__*/function(_libExpressionParserO3){function ExpressionParserPostfix(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,ExpressionParserPostfix);_this24=_callSuper(this,ExpressionParserPostfix,[pFable,pOptions,pServiceHash]);_this24.serviceType='ExpressionParser-Postfix';return _this24;}_inherits(ExpressionParserPostfix,_libExpressionParserO3);return _createClass2(ExpressionParserPostfix,[{key:"getPosfixSolveListOperation",value:function getPosfixSolveListOperation(pOperation,pLeftValue,pRightValue,pDepthSolveList,pDepthSolveIndex){var tmpOperation={VirtualSymbolName:pOperation.VirtualSymbolName,Operation:pOperation,LeftValue:pLeftValue,RightValue:pRightValue};var tmpDepthSolveList=Array.isArray(pDepthSolveList)?pDepthSolveList:false;// // Although we have a `Token.Type == "Parenthesis"` option to check on, keeping these explicit means the solver won't
1203
1203
  // // allow users to pass in parenthesis in the wrong order.
1204
1204
  // // The linter does blow up as does the postfix, but, just in case we'll leave these explicit.
@@ -1228,13 +1228,13 @@ if(pTokenizedExpression[_i6]!=='+'&&pTokenizedExpression[_i6]!=='-'){tmpResults.
1228
1228
  */if(!tmpOperation.LeftValue.VirtualSymbolName){tmpOperation.LeftValue.VirtualSymbolName=tmpOperation.VirtualSymbolName;}else{// We need to set the left value to a virtual symbol instead of the looked up value if it's already used in another operation
1229
1229
  tmpOperation.LeftValue=this.getTokenContainerObject(tmpOperation.LeftValue.VirtualSymbolName,'Token.VirtualSymbol');// Now walk backwards and see if we need to update a previous symbol for a previously unparsed operator
1230
1230
  if(tmpDepthSolveList){for(var i=pDepthSolveIndex-1;i>=0;i--){if(tmpDepthSolveList[i].Type==='Token.Operator'&&!tmpDepthSolveList[i].Parsed&&// When walking backward, we only want to mutate if the .
1231
- tmpDepthSolveList[i].hasOwnProperty('Descriptor')&&tmpOperation.Operation.hasOwnProperty('Descriptor')&&// Anything >3 does not have commutative properties
1231
+ 'Descriptor'in tmpDepthSolveList[i]&&'Descriptor'in tmpOperation.Operation&&// Anything >3 does not have commutative properties
1232
1232
  tmpDepthSolveList[i].Descriptor.Precedence>3){// If the symbol to its right is not the same as this operation
1233
1233
  if(tmpDepthSolveList[i+1].VirtualSymbolName!==tmpOperation.VirtualSymbolName){// This is the recursive "shunting" being simulated
1234
1234
  tmpDepthSolveList[i+1].VirtualSymbolName=tmpOperation.VirtualSymbolName;}break;}}}}if(!tmpOperation.RightValue.VirtualSymbolName){tmpOperation.RightValue.VirtualSymbolName=tmpOperation.VirtualSymbolName;}else{// We need to set the right value to a virtual symbol instead of the looked up value if it's already used in another operation
1235
1235
  tmpOperation.RightValue=this.getTokenContainerObject(tmpOperation.RightValue.VirtualSymbolName,'Token.VirtualSymbol');// Now walk forwards and see if we need to update an upcoming symbol for a previously unparsed operator
1236
1236
  if(tmpDepthSolveList){for(var _i7=pDepthSolveIndex+1;_i7<tmpDepthSolveList.length;_i7++){if(tmpDepthSolveList[_i7].Type==='Token.Operator'&&!tmpDepthSolveList[_i7].Parsed&&// When walking forward, we only want to mutate if the precedence hasn't been solved.
1237
- tmpDepthSolveList[_i7].hasOwnProperty('Descriptor')&&tmpOperation.Operation.hasOwnProperty('Descriptor')&&// Anything >3 does not have commutative properties
1237
+ 'Descriptor'in tmpDepthSolveList[_i7]&&'Descriptor'in tmpOperation.Operation&&// Anything >3 does not have commutative properties
1238
1238
  tmpDepthSolveList[_i7].Descriptor.Precedence>3){// If the symbol to its right is not the same as this operation
1239
1239
  if(tmpDepthSolveList[_i7-1].VirtualSymbolName!==tmpOperation.VirtualSymbolName){// This is the recursive "shunting" being simulated
1240
1240
  tmpDepthSolveList[_i7-1].VirtualSymbolName=tmpOperation.VirtualSymbolName;}break;}else if(tmpDepthSolveList[_i7].Type==='Token.Operator'&&!tmpDepthSolveList[_i7].Parsed){break;}}}}tmpOperation.Operation.Parsed=true;return tmpOperation;}},{key:"buildPostfixedSolveList",value:function buildPostfixedSolveList(pTokenizedExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.PostfixedAssignmentAddress='Result';tmpResults.PostfixTokenObjects=[];tmpResults.PostfixSolveList=[];if(pTokenizedExpression.length<3){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.buildPostfixedSolveList was passed a tokenized expression with less than three tokens.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return tmpResults.PostfixTokenObjects;}// 1. Figure out the Equality Assignment
@@ -1278,7 +1278,7 @@ tmpResults.PostfixTokenObjects[_i9].Depth=tmpDepth;tmpResults.PostfixTokenObject
1278
1278
  }// 4. If it's an operator or constant or comment, just set the depth
1279
1279
  else{tmpResults.PostfixTokenObjects[_i9].Depth=tmpDepth;tmpResults.PostfixTokenObjects[_i9].SolveLayerStack=tmpSolveLayerStack[tmpSolveLayerStack.length-1];}}// 4. Walk through the decorated symbols and generate the postfix solve list
1280
1280
  // We are going to start by creating a map of the solve layers:
1281
- var tmpSolveLayerMap={};var tmpSolveLayerMaxDepth=0;for(var _i10=0;_i10<tmpResults.PostfixTokenObjects.length;_i10++){if(!tmpSolveLayerMap.hasOwnProperty(tmpResults.PostfixTokenObjects[_i10].SolveLayerStack)){tmpSolveLayerMap[tmpResults.PostfixTokenObjects[_i10].SolveLayerStack]=[];}tmpSolveLayerMap[tmpResults.PostfixTokenObjects[_i10].SolveLayerStack].push(tmpResults.PostfixTokenObjects[_i10]);// See what our max depth is. This is super important to the postfix operation
1281
+ var tmpSolveLayerMap={};var tmpSolveLayerMaxDepth=0;for(var _i10=0;_i10<tmpResults.PostfixTokenObjects.length;_i10++){if(!(tmpResults.PostfixTokenObjects[_i10].SolveLayerStack in tmpSolveLayerMap)){tmpSolveLayerMap[tmpResults.PostfixTokenObjects[_i10].SolveLayerStack]=[];}tmpSolveLayerMap[tmpResults.PostfixTokenObjects[_i10].SolveLayerStack].push(tmpResults.PostfixTokenObjects[_i10]);// See what our max depth is. This is super important to the postfix operation
1282
1282
  // The programmer in me thinks it would be funny to not track this and just use the map key length as the max size, which would work (logically impossible to have a depth > key length) but it would be quite a bit more confusing to grok the algorithm.
1283
1283
  if(tmpResults.PostfixTokenObjects[_i10].Depth>tmpSolveLayerMaxDepth){tmpSolveLayerMaxDepth=tmpResults.PostfixTokenObjects[_i10].Depth;}}var tmpSolveLayerKeys=Object.keys(tmpSolveLayerMap);// Reset the virtual symbol index -- it was used above for uniquenes when creating abstract symbols for parenthesis and layer stacks.
1284
1284
  var tmpVirtualSymbolIndex=0;tmpSolveLayerKeys.sort(// Sort the solve layers by depth.
@@ -1323,7 +1323,7 @@ var tmpPeekedNextToken=tmpResults.PostfixTokenObjects[_i12+1];if(tmpPeekedNextTo
1323
1323
  // If the next token has higher precedence than what's before the open parenthesis, use it for the open as well
1324
1324
  if(tmpPeekedNextToken.Descriptor.Precedence<tmpOpenParenthesis.PreviousPrecedence){tmpOpenParenthesis.VirtualSymbolName=tmpPeekedNextToken.VirtualSymbolName;tmpPostfixTokenObject.VirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];}// Otherwise use this one -- it is the higher precedence. And update the previous parenthesis operator's virtual symbol to be the peeked token's virtual symbol.
1325
1325
  else{tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName;}}// The next token is an operator and it isn't a function
1326
- else if(tmpPeekedNextToken.Type=='Token.Operator'&&tmpOpenParenthesis.hasOwnProperty('PreviousPrecedence')){// This is the second most complex case -- the next token is an operator.
1326
+ else if(tmpPeekedNextToken.Type=='Token.Operator'&&'PreviousPrecedence'in tmpOpenParenthesis){// This is the second most complex case -- the next token is an operator.
1327
1327
  // If the operater is at the same precedence or higher than the open parenthesis previous operator, use the previous operator's identifier
1328
1328
  // NOTE: This line of code is insanely complex
1329
1329
  if(tmpPeekedNextToken.Descriptor.Precedence<=tmpOpenParenthesis.PreviousPrecedence){tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName;}// Otherwise use this one -- it is the higher precedence. And update the previous parenthesis operator's virtual symbol to be the peeked token's virtual symbol.
@@ -1348,16 +1348,16 @@ else if(_i13>0&&_tmpToken2.Token=='+'&&(_tmpSolveLayerTokens2[_i13-1].Type==='To
1348
1348
  else{tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken2,_tmpSolveLayerTokens2[_i13-1],_tmpSolveLayerTokens2[_i13+1],_tmpSolveLayerTokens2,_i13));}}else if(_tmpSolveLayerTokens2[_i13].Type==='Token.Function'&&_tmpPrecedence===0){var _tmpToken3=_tmpSolveLayerTokens2[_i13];// Not sure what to do with the other token.
1349
1349
  tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken3,_tmpSolveLayerTokens2[_i13+1],this.getTokenContainerObject('0.0')));}}}}// Now set the assignment address.
1350
1350
  var tmpAssignmentInstruction=this.getPosfixSolveListOperation(this.getTokenContainerObject('Assign','Token.SolverInstruction'),this.getTokenContainerObject('DestinationHash','Token.SolverInstruction'),this.getTokenContainerObject('Resulting','Token.SolverInstruction'));tmpAssignmentInstruction.VirtualSymbolName=tmpResults.PostfixedAssignmentAddress;tmpResults.PostfixSolveList.push(tmpAssignmentInstruction);return tmpResults.PostfixSolveList;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserPostfix;},{"./Fable-Service-ExpressionParser-Base.js":67}],72:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserSolver=/*#__PURE__*/function(_libExpressionParserO4){function ExpressionParserSolver(pFable,pOptions,pServiceHash){var _this25;_classCallCheck2(this,ExpressionParserSolver);_this25=_callSuper(this,ExpressionParserSolver,[pFable,pOptions,pServiceHash]);_this25.serviceType='ExpressionParser-Solver';return _this25;}_inherits(ExpressionParserSolver,_libExpressionParserO4);return _createClass2(ExpressionParserSolver,[{key:"solvePostfixedExpression",value:function solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};var tmpManifest=_typeof(pManifest)==='object'?pManifest:this.fable.newManyfest();var tmpDataDestinationObject=_typeof(pDataDestinationObject)==='object'?pDataDestinationObject:{};// If there was a fable passed in (e.g. the results object was a service or such), we won't decorate
1351
- var tmpPassedInFable=tmpResults.hasOwnProperty('fable');if(!tmpPassedInFable){tmpResults.fable=this.fable;}if(!Array.isArray(pPostfixedExpression)){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression was passed a non-array postfixed expression.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}if(pPostfixedExpression.length<1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression was passed an empty postfixed expression.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// This is how the user communication magic happens.
1351
+ var tmpPassedInFable=('fable'in tmpResults);if(!tmpPassedInFable){tmpResults.fable=this.fable;}if(!Array.isArray(pPostfixedExpression)){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression was passed a non-array postfixed expression.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}if(pPostfixedExpression.length<1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression was passed an empty postfixed expression.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// This is how the user communication magic happens.
1352
1352
  tmpResults.VirtualSymbols={};for(var i=0;i<pPostfixedExpression.length;i++){if(pPostfixedExpression[i].Operation.Type==='Token.SolverInstruction'){continue;}var tmpStepResultObject={ExpressionStep:pPostfixedExpression[i],ExpressionStepIndex:i,ResultsObject:tmpResults,Manifest:tmpManifest};// Resolve the virtual symbols to their actual values
1353
1353
  if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.VirtualSymbol'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.Token);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.VirtualSymbol'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.Token);}// Resolve the parenthesis to their actual values
1354
1354
  if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.VirtualSymbolName);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.VirtualSymbolName);}if(tmpStepResultObject.ExpressionStep.Operation.Type='Operator'){// TODO: This can be optimized. A lot. If necessary. Seems pretty fast honestly for even thousands of operations. Slowest part is arbitrary precision.
1355
1355
  // An operator always has a left and right value.
1356
- var tmpFunctionAddress=false;if(this.ExpressionParser.tokenMap.hasOwnProperty(tmpStepResultObject.ExpressionStep.Operation.Token)){tmpFunctionAddress="ResultsObject.".concat(tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function);}else if(this.ExpressionParser.functionMap.hasOwnProperty(tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase())){tmpFunctionAddress="ResultsObject.".concat(this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address);}try{this.log.trace("Solving Step ".concat(i," [").concat(tmpStepResultObject.ExpressionStep.VirtualSymbolName,"] --> [").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"]: ( ").concat(tmpStepResultObject.ExpressionStep.LeftValue.Value," , ").concat(tmpStepResultObject.ExpressionStep.RightValue.Value," )"));tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]=tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)"));this.log.trace(" ---> Step ".concat(i,": ").concat(tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]));}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"."));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// Equations don't always solve in virtual symbol order.
1356
+ var tmpFunctionAddress=false;if(tmpStepResultObject.ExpressionStep.Operation.Token in this.ExpressionParser.tokenMap){tmpFunctionAddress="ResultsObject.".concat(tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function);}else if(tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()in this.ExpressionParser.functionMap){tmpFunctionAddress="ResultsObject.".concat(this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address);}try{this.log.trace("Solving Step ".concat(i," [").concat(tmpStepResultObject.ExpressionStep.VirtualSymbolName,"] --> [").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"]: ( ").concat(tmpStepResultObject.ExpressionStep.LeftValue.Value," , ").concat(tmpStepResultObject.ExpressionStep.RightValue.Value," )"));tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]=tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)"));this.log.trace(" ---> Step ".concat(i,": ").concat(tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]));}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"."));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// Equations don't always solve in virtual symbol order.
1357
1357
  tmpResults.SolverFinalVirtualSymbol=tmpStepResultObject.ExpressionStep.VirtualSymbolName;}}var tmpSolverResultValue=tmpManifest.getValueAtAddress(tmpResults,"VirtualSymbols.".concat(tmpResults.SolverFinalVirtualSymbol));// Now deal with final assignment
1358
1358
  for(var _i14=0;_i14<pPostfixedExpression.length;_i14++){if(pPostfixedExpression[_i14].Operation.Type==='Token.SolverInstruction'&&pPostfixedExpression[_i14].Operation.Token=='Assign'){tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[_i14].VirtualSymbolName,tmpSolverResultValue);tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i14].VirtualSymbolName,tmpSolverResultValue);}}// Clean up the reference if we added it to the object.
1359
- if(!tmpPassedInFable){delete tmpResults.fable;}return tmpSolverResultValue.toString();}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":67}],73:[function(require,module,exports){module.exports={"=":{"Name":"Equals","Token":"=","Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":1,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],74:[function(require,module,exports){(function(process){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libFS=require('fs');var libPath=require('path');var libReadline=require('readline');var FableServiceFilePersistence=/*#__PURE__*/function(_libFableServiceBase5){function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this26;_classCallCheck2(this,FableServiceFilePersistence);_this26=_callSuper(this,FableServiceFilePersistence,[pFable,pOptions,pServiceHash]);_this26.serviceType='FilePersistence';if(!_this26.options.hasOwnProperty('Mode')){_this26.options.Mode=parseInt('0777',8)&~process.umask();}_this26.libFS=libFS;_this26.libPath=libPath;_this26.libReadline=libReadline;return _this26;}_inherits(FableServiceFilePersistence,_libFableServiceBase5);return _createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){return libPath.resolve.apply(libPath,arguments);}},{key:"existsSync",value:function existsSync(pPath){return libFS.existsSync(pPath);}},{key:"exists",value:function exists(pPath,fCallback){var tmpFileExists=this.existsSync(pPath);;return fCallback(null,tmpFileExists);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{key:"deleteFileSync",value:function deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}},{key:"deleteFolderSync",value:function deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}},{key:"readFileSync",value:function readFileSync(pFilePath,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFileSync(pFilePath,tmpOptions);}},{key:"readFile",value:function readFile(pFilePath,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFile(pFilePath,tmpOptions,fCallback);}},{key:"writeFileSync",value:function writeFileSync(pFileName,pFileContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}},{key:"writeFileSyncFromObject",value:function writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}},{key:"writeFileSyncFromArray",value:function writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error("File Persistence Service attempted to write ".concat(pFileName," from array but the expected array was not an array (it was a ").concat(_typeof(pFileArray),")."));return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(var i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,"".concat(pFileArray[i],"\n"));}}}},{key:"writeFile",value:function writeFile(pFileName,pFileContent,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFile(pFileName,pFileContent,tmpOptions,fCallback);}},{key:"lineReaderFactory",value:function lineReaderFactory(pFilePath,fOnLine,fOnComplete,fOnError){var tmpLineReader={};if(typeof pFilePath!='string'){return false;}tmpLineReader.filePath=pFilePath;tmpLineReader.fileStream=libFS.createReadStream(tmpLineReader.filePath);tmpLineReader.reader=libReadline.createInterface({input:tmpLineReader.fileStream,crlfDelay:Infinity});if(typeof fOnError==='function'){tmpLineReader.reader.on('error',fOnError);}tmpLineReader.reader.on('line',typeof fOnLine==='function'?fOnLine:function(){});if(typeof fOnComplete==='function'){tmpLineReader.reader.on('close',fOnComplete);}return tmpLineReader;}// Folder management
1360
- },{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this27=this;var tmpParameters=pParameters;if(typeof pParameters=='string'){tmpParameters={Path:pParameters};}else if(_typeof(pParameters)!=='object'){fCallback(new Error('Parameters object or string not properly passed to recursive folder create.'));return false;}if(typeof tmpParameters.Path!=='string'){fCallback(new Error('Parameters object needs a path to run the folder create operation.'));return false;}if(!tmpParameters.hasOwnProperty('Mode')){tmpParameters.Mode=this.options.Mode;}// Check if we are just starting .. if so, build the initial state for our recursive function
1359
+ if(!tmpPassedInFable){delete tmpResults.fable;}return tmpSolverResultValue.toString();}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":67}],73:[function(require,module,exports){module.exports={"=":{"Name":"Equals","Token":"=","Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":1,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],74:[function(require,module,exports){(function(process){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libFS=require('fs');var libPath=require('path');var libReadline=require('readline');var FableServiceFilePersistence=/*#__PURE__*/function(_libFableServiceBase5){function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this26;_classCallCheck2(this,FableServiceFilePersistence);_this26=_callSuper(this,FableServiceFilePersistence,[pFable,pOptions,pServiceHash]);_this26.serviceType='FilePersistence';if(!('Mode'in _this26.options)){_this26.options.Mode=parseInt('0777',8)&~process.umask();}_this26.libFS=libFS;_this26.libPath=libPath;_this26.libReadline=libReadline;return _this26;}_inherits(FableServiceFilePersistence,_libFableServiceBase5);return _createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){return libPath.resolve.apply(libPath,arguments);}},{key:"existsSync",value:function existsSync(pPath){return libFS.existsSync(pPath);}},{key:"exists",value:function exists(pPath,fCallback){var tmpFileExists=this.existsSync(pPath);;return fCallback(null,tmpFileExists);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{key:"deleteFileSync",value:function deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}},{key:"deleteFolderSync",value:function deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}},{key:"readFileSync",value:function readFileSync(pFilePath,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFileSync(pFilePath,tmpOptions);}},{key:"readFile",value:function readFile(pFilePath,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFile(pFilePath,tmpOptions,fCallback);}},{key:"writeFileSync",value:function writeFileSync(pFileName,pFileContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}},{key:"writeFileSyncFromObject",value:function writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}},{key:"writeFileSyncFromArray",value:function writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error("File Persistence Service attempted to write ".concat(pFileName," from array but the expected array was not an array (it was a ").concat(_typeof(pFileArray),")."));return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(var i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,"".concat(pFileArray[i],"\n"));}}}},{key:"writeFile",value:function writeFile(pFileName,pFileContent,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFile(pFileName,pFileContent,tmpOptions,fCallback);}},{key:"lineReaderFactory",value:function lineReaderFactory(pFilePath,fOnLine,fOnComplete,fOnError){var tmpLineReader={};if(typeof pFilePath!='string'){return false;}tmpLineReader.filePath=pFilePath;tmpLineReader.fileStream=libFS.createReadStream(tmpLineReader.filePath);tmpLineReader.reader=libReadline.createInterface({input:tmpLineReader.fileStream,crlfDelay:Infinity});if(typeof fOnError==='function'){tmpLineReader.reader.on('error',fOnError);}tmpLineReader.reader.on('line',typeof fOnLine==='function'?fOnLine:function(){});if(typeof fOnComplete==='function'){tmpLineReader.reader.on('close',fOnComplete);}return tmpLineReader;}// Folder management
1360
+ },{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this27=this;var tmpParameters=pParameters;if(typeof pParameters=='string'){tmpParameters={Path:pParameters};}else if(_typeof(pParameters)!=='object'){fCallback(new Error('Parameters object or string not properly passed to recursive folder create.'));return false;}if(typeof tmpParameters.Path!=='string'){fCallback(new Error('Parameters object needs a path to run the folder create operation.'));return false;}if(!('Mode'in tmpParameters)){tmpParameters.Mode=this.options.Mode;}// Check if we are just starting .. if so, build the initial state for our recursive function
1361
1361
  if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
1362
1362
  tmpParameters.ActualPath=libPath.normalize(tmpParameters.Path);tmpParameters.ActualPathParts=tmpParameters.ActualPath.split(libPath.sep);tmpParameters.CurrentPathIndex=0;tmpParameters.CurrentPath='';}else{// This is not our first run, so we will continue the recursion.
1363
1363
  // Build the new base path
@@ -1387,14 +1387,7 @@ var tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.
1387
1387
  * Precedent Meta-Templating
1388
1388
  * @author Steven Velozo <steven@velozo.com>
1389
1389
  * @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
1390
- */var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase7){function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this29;_classCallCheck2(this,FableServiceMetaTemplate);_this29=_callSuper(this,FableServiceMetaTemplate,[pFable,pOptions,pServiceHash]);_this29.serviceType='MetaTemplate';_this29.WordTree=new libWordTree();_this29.StringParser=new libStringParser(_this29.fable);_this29.ParseTree=_this29.WordTree.ParseTree;return _this29;}/**
1391
- * Add a Pattern to the Parse Tree
1392
- * @method addPattern
1393
- * @param {Object} pTree - A node on the parse tree to push the characters into
1394
- * @param {string} pPattern - The string to add to the tree
1395
- * @param {number} pIndex - callback function
1396
- * @return {bool} True if adding the pattern was successful
1397
- */_inherits(FableServiceMetaTemplate,_libFableServiceBase7);return _createClass2(FableServiceMetaTemplate,[{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,pParser){return this.WordTree.addPattern(pPatternStart,pPatternEnd,pParser);}},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,pParserPromise){return this.WordTree.addPatternAsync(pPatternStart,pPatternEnd,pParserPromise);}},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise){return this.WordTree.addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise);}/**
1390
+ */var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase7){function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this29;_classCallCheck2(this,FableServiceMetaTemplate);_this29=_callSuper(this,FableServiceMetaTemplate,[pFable,pOptions,pServiceHash]);_this29.serviceType='MetaTemplate';_this29.WordTree=new libWordTree();_this29.StringParser=new libStringParser(_this29.fable);_this29.ParseTree=_this29.WordTree.ParseTree;return _this29;}_inherits(FableServiceMetaTemplate,_libFableServiceBase7);return _createClass2(FableServiceMetaTemplate,[{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,pParser,pParserContext){return this.WordTree.addPattern(pPatternStart,pPatternEnd,pParser,pParserContext);}},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,pParserPromise,pParserContext){return this.WordTree.addPatternAsync(pPatternStart,pPatternEnd,pParserPromise,pParserContext);}},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise,pParserContext){return this.WordTree.addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise,pParserContext);}/**
1398
1391
  * Parse a string with the existing parse tree
1399
1392
  * @method parseString
1400
1393
  * @param {string} pString - The string to parse
@@ -1436,25 +1429,25 @@ pParserState.Pattern=false;pParserState.PatternStartNode=false;pParserState.Star
1436
1429
  * @private
1437
1430
  */},{key:"parseCharacter",value:function parseCharacter(pCharacter,pParserState,pData,pDataContext){// If we are already in a pattern match traversal
1438
1431
  if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
1439
- if(!pParserState.StartPatternMatchComplete&&pParserState.Pattern.hasOwnProperty(pCharacter)){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This leaf has a PatternEnd tree, so we will wait until that end is met.
1432
+ if(!pParserState.StartPatternMatchComplete&&pCharacter in pParserState.Pattern){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pCharacter in pParserState.Pattern.PatternEnd){// This leaf has a PatternEnd tree, so we will wait until that end is met.
1440
1433
  pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
1441
1434
  this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
1442
- if(pParserState.Pattern.hasOwnProperty('Parse')&&(!pParserState.Pattern.isAsync||pParserState.Pattern.isBoth)){// Run the function
1443
- pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);return this.resetOutputBuffer(pParserState);}else{this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));return this.resetOutputBuffer(pParserState);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
1444
- pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if(pParserState.Pattern.hasOwnProperty('PatternEnd')){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This is the first character of the end pattern.
1435
+ if('Parse'in pParserState.Pattern&&(!pParserState.Pattern.isAsync||pParserState.Pattern.isBoth)){// Run the function
1436
+ var tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(tmpFunctionContext){pParserState.OutputBuffer=pParserState.Pattern.Parse.call(tmpFunctionContext,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}else{pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}return this.resetOutputBuffer(pParserState);}else{this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));return this.resetOutputBuffer(pParserState);}}else if(pCharacter in pParserState.PatternStartNode.PatternEnd){// We broke out of the end -- see if this is a new start of the end.
1437
+ pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if('PatternEnd'in pParserState.Pattern){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pCharacter in pParserState.Pattern.PatternEnd){// This is the first character of the end pattern.
1445
1438
  pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
1446
1439
  pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
1447
- if(pParserState.Pattern.hasOwnProperty('Parse')){if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));this.resetOutputBuffer(pParserState);}else{// Run the t*mplate function
1448
- pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);return this.resetOutputBuffer(pParserState);}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
1440
+ if('Parse'in pParserState.Pattern){if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));this.resetOutputBuffer(pParserState);}else{// Run the t*mplate function
1441
+ var _tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(_tmpFunctionContext){pParserState.OutputBuffer=pParserState.Pattern.Parse.call(_tmpFunctionContext,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}else{pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}return this.resetOutputBuffer(pParserState);}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
1449
1442
  this.resetOutputBuffer(pParserState);}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
1450
1443
  if(!pParserState.PatternMatch){// This may be the start of a new pattern....
1451
- if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
1444
+ if(pCharacter in pParserState.ParseTree){// ... assign the root node as the matched node.
1452
1445
  this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}},{key:"executePatternAsync",value:function executePatternAsync(pParserState,pData,fCallback,pDataContext){var _this30=this;// ... this is the end of a pattern, cut off the end tag and parse it.
1453
1446
  // Trim the start and end tags off the output buffer now
1454
1447
  if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){// Run the function
1455
- return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this30.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this30.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else if(pParserState.Pattern.isAsync&&pParserState.Pattern.isBoth){// Run the function when both async and non async were provided with the pattern
1456
- return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this30.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this30.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else{// Run the t*mplate function
1457
- pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);this.resetOutputBuffer(pParserState);return fCallback();}}/**
1448
+ var tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(tmpFunctionContext){return pParserState.Pattern.Parse.call(tmpFunctionContext,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this30.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this30.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else{return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this30.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this30.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}}else if(pParserState.Pattern.isAsync&&pParserState.Pattern.isBoth){// Run the function when both async and non async were provided with the pattern
1449
+ var _tmpFunctionContext2='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(_tmpFunctionContext2){return pParserState.Pattern.ParseAsync.call(_tmpFunctionContext2,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this30.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this30.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else{return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this30.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this30.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}}else{// Run the t*mplate function
1450
+ var _tmpFunctionContext3='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(_tmpFunctionContext3){pParserState.OutputBuffer=pParserState.Pattern.Parse.call(_tmpFunctionContext3,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}else{pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}this.resetOutputBuffer(pParserState);return fCallback();}}/**
1458
1451
  * Parse a character in the buffer.
1459
1452
  * @method parseCharacterAsync
1460
1453
  * @param {string} pCharacter - The character to append
@@ -1465,17 +1458,17 @@ pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.s
1465
1458
  * @private
1466
1459
  */},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback,pDataContext){// If we are already in a pattern match traversal
1467
1460
  if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
1468
- if(!pParserState.StartPatternMatchComplete&&pParserState.Pattern.hasOwnProperty(pCharacter)){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This leaf has a PatternEnd tree, so we will wait until that end is met.
1461
+ if(!pParserState.StartPatternMatchComplete&&pCharacter in pParserState.Pattern){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pCharacter in pParserState.Pattern.PatternEnd){// This leaf has a PatternEnd tree, so we will wait until that end is met.
1469
1462
  pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
1470
1463
  this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
1471
- if(pParserState.Pattern.hasOwnProperty('Parse')){return this.executePatternAsync(pParserState,pData,fCallback,pDataContext);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
1472
- pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if(pParserState.Pattern.hasOwnProperty('PatternEnd')){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This is the first character of the end pattern.
1464
+ if('Parse'in pParserState.Pattern){return this.executePatternAsync(pParserState,pData,fCallback,pDataContext);}}else if(pCharacter in pParserState.PatternStartNode.PatternEnd){// We broke out of the end -- see if this is a new start of the end.
1465
+ pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if('PatternEnd'in pParserState.Pattern){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pCharacter in pParserState.Pattern.PatternEnd){// This is the first character of the end pattern.
1473
1466
  pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
1474
1467
  pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
1475
- if(pParserState.Pattern.hasOwnProperty('Parse')){return this.executePatternAsync(pParserState,pData,fCallback,pDataContext);}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
1468
+ if('Parse'in pParserState.Pattern){return this.executePatternAsync(pParserState,pData,fCallback,pDataContext);}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
1476
1469
  this.resetOutputBuffer(pParserState);}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
1477
1470
  else{// This may be the start of a new pattern....
1478
- if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
1471
+ if(pCharacter in pParserState.ParseTree){// ... assign the root node as the matched node.
1479
1472
  this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}// Without this, templates of all sizes work fine in node. They do not in the browser.
1480
1473
  // Trying this out without the timout on non asynchronous template flips.
1481
1474
  return fCallback();}/**
@@ -1503,33 +1496,34 @@ _this31.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserSta
1503
1496
  * @param {string} pPattern - The string to add to the tree
1504
1497
  * @returns {Object} The resulting leaf node that was added (or found)
1505
1498
  * @private
1506
- */return _createClass2(WordTree,[{key:"addChild",value:function addChild(pTree,pPattern){if(!pTree.hasOwnProperty(pPattern)){pTree[pPattern]={};}return pTree[pPattern];}/**
1499
+ */return _createClass2(WordTree,[{key:"addChild",value:function addChild(pTree,pPattern){if(!(pPattern in pTree)){pTree[pPattern]={};}return pTree[pPattern];}/**
1507
1500
  * Add a child character to a Parse Tree PatternEnd subtree
1508
1501
  * @method addChild
1509
1502
  * @param {Object} pTree - A parse tree to push the characters into
1510
1503
  * @param {string} pPattern - The string to add to the tree
1511
1504
  * @returns {Object} The resulting leaf node that was added (or found)
1512
1505
  * @private
1513
- */},{key:"addEndChild",value:function addEndChild(pTree,pPattern){if(!pTree.hasOwnProperty('PatternEnd')){pTree.PatternEnd={};}pTree.PatternEnd[pPattern]={};return pTree.PatternEnd[pPattern];}/** Add a Pattern to the Parse Tree
1506
+ */},{key:"addEndChild",value:function addEndChild(pTree,pPattern){if(!('PatternEnd'in pTree)){pTree.PatternEnd={};}pTree.PatternEnd[pPattern]={};return pTree.PatternEnd[pPattern];}/** Add a Pattern to the Parse Tree
1514
1507
  * @method addPattern
1515
1508
  * @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
1516
1509
  * @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
1517
1510
  * @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.
1518
1511
  * @return {bool} True if adding the pattern was successful
1519
- */},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
1520
- for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var _i16=0;_i16<tmpPatternEnd.length;_i16++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i16],_i16);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(){return fParser;}:function(pData){return pData;};return tmpLeaf;}/** Add a Pattern to the Parse Tree
1512
+ */},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
1513
+ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!('PatternEnd'in tmpLeaf)){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var _i16=0;_i16<tmpPatternEnd.length;_i16++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i16],_i16);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(){return fParser;}:function(pData){return pData;};// A "this" for every object
1514
+ if(pParserContext){tmpLeaf.ParserContext=pParserContext;}return tmpLeaf;}/** Add a Pattern to the Parse Tree
1521
1515
  * @method addPatternAsync
1522
1516
  * @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
1523
1517
  * @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
1524
1518
  * @param {function} fParserAsync - 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.
1525
1519
  * @return {bool} True if adding the pattern was successful
1526
- */},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParserAsync){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParserAsync);if(tmpLeaf){tmpLeaf.isAsync=true;}}/** Add a Pattern to the Parse Tree
1520
+ */},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParserAsync,pParserContext){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParserAsync,pParserContext);if(tmpLeaf){tmpLeaf.isAsync=true;}}/** Add a Pattern to the Parse Tree
1527
1521
  * @method addPatternBoth
1528
1522
  * @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
1529
1523
  * @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
1530
1524
  * @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.
1531
1525
  * @return {bool} True if adding the pattern was successful
1532
- */},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,fParser,fParserAsync){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;tmpLeaf.isBoth=true;// When a leaf has both async and non-async versions of the functions, we store the async in fParserAsync.
1526
+ */},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,fParser,fParserAsync,pParserContext){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser,pParserContext);if(tmpLeaf){tmpLeaf.isAsync=true;tmpLeaf.isBoth=true;// When a leaf has both async and non-async versions of the functions, we store the async in fParserAsync.
1533
1527
  tmpLeaf.ParseAsync=fParserAsync;}}}]);}();module.exports=WordTree;},{}],79:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":0},"Steps":[],"Errors":[],"Log":[]};},{}],80:[function(require,module,exports){var _require4=require('big.js'),PE=_require4.PE;var libFableServiceBase=require('fable-serviceproviderbase');var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase8){function FableOperation(pFable,pOptions,pServiceHash){var _this32;_classCallCheck2(this,FableOperation);_this32=_callSuper(this,FableOperation,[pFable,pOptions,pServiceHash]);// Timestamps will just be the long ints
1534
1528
  _this32.timeStamps={};_this32.serviceType='PhasedOperation';_this32.state=JSON.parse(_OperationStatePrototypeString);_this32.stepMap={};_this32.stepFunctions={};// Match the service instantiation to the operation.
1535
1529
  _this32.state.Metadata.Hash=_this32.Hash;_this32.state.Metadata.UUID=_this32.UUID;_this32.state.Metadata.Name=typeof _this32.options.Name=='string'?_this32.options.Name:"Unnamed Operation ".concat(_this32.state.Metadata.UUID);_this32.name=_this32.state.Metadata.Name;_this32.progressTrackerSet=_this32.fable.instantiateServiceProviderWithoutRegistration('ProgressTrackerSet');_this32.state.OverallProgressTracker=_this32.progressTrackerSet.createProgressTracker("Overall-".concat(_this32.state.Metadata.UUID));// This is here to use the pass-through logging functions in the operation itself.
@@ -1545,41 +1539,41 @@ tmpAnticipate.wait(function(pError){if(pError){_this33.fable.log.error("Operatio
1545
1539
  },{key:"addStep",value:function addStep(fStepFunction,pStepMetadata,pStepName,pStepDescription,pGUIDStep){var tmpStep={};// GUID is optional
1546
1540
  tmpStep.GUIDStep=typeof pGUIDStep!=='undefined'?pGUIDStep:"STEP-".concat(this.state.Steps.length,"-").concat(this.fable.DataGeneration.randomNumericString());// Name is optional
1547
1541
  tmpStep.Name=typeof pStepName!=='undefined'?pStepName:"Step [".concat(tmpStep.GUIDStep,"]");tmpStep.Description=typeof pStepDescription!=='undefined'?pStepDescription:"Step execution of ".concat(tmpStep.Name,".");tmpStep.ProgressTracker=this.progressTrackerSet.createProgressTracker(tmpStep.GUIDStep);tmpStep.Metadata=_typeof(pStepMetadata)==='object'?pStepMetadata:{};// There is an array of steps, in the Operation State itself ... push a step there
1548
- this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep]=tmpStep;this.stepFunctions[tmpStep.GUIDStep]=typeof fStepFunction=='function'?fStepFunction:function(fDone){return fDone();};this.state.Status.StepCount++;return tmpStep;}},{key:"setStepTotalOperations",value:function setStepTotalOperations(pGUIDStep,pTotalOperationCount){if(!this.stepMap.hasOwnProperty(pGUIDStep)){return new Error("Step [".concat(pGUIDStep,"] does not exist in operation [").concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," when attempting to set total operations to ").concat(pTotalOperationCount,"."));}this.progressTrackerSet.setProgressTrackerTotalOperations(this.stepMap[pGUIDStep].ProgressTracker.Hash,pTotalOperationCount);}},{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);}}]);}(libFableServiceBase);module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":79,"big.js":17,"fable-serviceproviderbase":52}],81:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase9){function FableServiceProgressTime(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,FableServiceProgressTime);_this34=_callSuper(this,FableServiceProgressTime,[pFable,pOptions,pServiceHash]);_this34.serviceType='ProgressTime';_this34.timeStamps={};return _this34;}_inherits(FableServiceProgressTime,_libFableServiceBase9);return _createClass2(FableServiceProgressTime,[{key:"formatTimeDuration",value:function formatTimeDuration(pTimeDurationInMilliseconds){var tmpTimeDuration=typeof pTimeDurationInMilliseconds=='number'?pTimeDurationInMilliseconds:0;if(pTimeDurationInMilliseconds<0){return'unknown';}var tmpTimeDurationString='';if(tmpTimeDuration>3600000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/3600000)+'h ';tmpTimeDuration=tmpTimeDuration%3600000;}if(tmpTimeDuration>60000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/60000)+'m ';tmpTimeDuration=tmpTimeDuration%60000;}if(tmpTimeDuration>1000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/1000)+'s ';tmpTimeDuration=tmpTimeDuration%1000;}tmpTimeDurationString+=Math.round(tmpTimeDuration)+'ms';return tmpTimeDurationString;}},{key:"createTimeStamp",value:function createTimeStamp(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';this.timeStamps[tmpTimeStampHash]=+new Date();return this.timeStamps[tmpTimeStampHash];}},{key:"getTimeStampValue",value:function getTimeStampValue(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';return this.timeStamps.hasOwnProperty(tmpTimeStampHash)?this.timeStamps[tmpTimeStampHash]:-1;}},{key:"updateTimeStampValue",value:function updateTimeStampValue(pTimeStampHash,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
1549
- if(typeof pReferenceTime=='string'){tmpReferenceTime=this.timeStamps.hasOwnProperty(tmpReference)?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(this.timeStamps.hasOwnProperty(tmpTimeStampHash)&&tmpReferenceTime){this.timeStamps[tmpTimeStampHash]=tmpReferenceTime;return this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"removeTimeStamp",value:function removeTimeStamp(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';if(this.timeStamps.hasOwnProperty(tmpTimeStampHash)){delete this.timeStamps[tmpTimeStampHash];return true;}else{return false;}}},{key:"getTimeStampDelta",value:function getTimeStampDelta(pTimeStampHash,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
1550
- if(typeof pReferenceTime=='string'){tmpReferenceTime=this.timeStamps.hasOwnProperty(tmpReference)?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(this.timeStamps.hasOwnProperty(tmpTimeStampHash)&&tmpReferenceTime){return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"getDurationBetweenTimestamps",value:function getDurationBetweenTimestamps(pTimeStampHashStart,pTimeStampHashEnd){var tmpTimeStampHashStart=typeof pTimeStampHashStart=='string'?pTimeStampHashStart:'Default';var tmpTimeStampHashEnd=typeof pTimeStampHashEnd=='string'?pTimeStampHashEnd:'Default';if(this.timeStamps.hasOwnProperty(tmpTimeStampHashStart)&&this.timeStamps.hasOwnProperty(tmpTimeStampHashEnd)){return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];}else{return-1;}}},{key:"getTimeStampDeltaMessage",value:function getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpMessage=typeof pMessage!=='undefined'?pMessage:"Elapsed for ".concat(tmpTimeStampHash,": ");var tmpOperationTime=this.getTimeStampDelta(tmpTimeStampHash,pReferenceTime);return"".concat(tmpMessage," ").concat(this.formatTimeDuration(tmpOperationTime));}},{key:"logTimeStampDelta",value:function logTimeStampDelta(pTimeStampHash,pMessage,pReferenceTime){this.fable.log.info(this.getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTime;},{"fable-serviceproviderbase":52}],82:[function(require,module,exports){var ProgressTracker=/*#__PURE__*/function(){function ProgressTracker(pProgressTrackerSet,pProgressTrackerHash){_classCallCheck2(this,ProgressTracker);this.progressTrackerSet=pProgressTrackerSet;this.progressTrackerHash=pProgressTrackerHash;this.data=this.progressTrackerSet.getProgressTrackerData(this.progressTrackerHash);}return _createClass2(ProgressTracker,[{key:"updateProgressTracker",value:function updateProgressTracker(pProgressAmount){return this.progressTrackerSet.updateProgressTracker(this.progressTrackerHash,pProgressAmount);}},{key:"incrementProgressTracker",value:function incrementProgressTracker(pProgressIncrementAmount){return this.progressTrackerSet.incrementProgressTracker(this.progressTrackerHash,pProgressIncrementAmount);}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pTotalOperationCount){return this.progressTrackerSet.setProgressTrackerTotalOperations(this.progressTrackerHash,pTotalOperationCount);}},{key:"getProgressTrackerStatusString",value:function getProgressTrackerStatusString(){return this.progressTrackerSet.getProgressTrackerStatusString(this.progressTrackerHash);}}]);}();module.exports=ProgressTracker;},{}],83:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');var FableServiceProgressTrackerSet=/*#__PURE__*/function(_libFableServiceBase10){function FableServiceProgressTrackerSet(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,FableServiceProgressTrackerSet);_this35=_callSuper(this,FableServiceProgressTrackerSet,[pFable,pOptions,pServiceHash]);_this35.serviceType='ProgressTrackerSet';_this35.progressTrackers={};// Create an internal PorgressTime service to track timestamps
1542
+ this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep]=tmpStep;this.stepFunctions[tmpStep.GUIDStep]=typeof fStepFunction=='function'?fStepFunction:function(fDone){return fDone();};this.state.Status.StepCount++;return tmpStep;}},{key:"setStepTotalOperations",value:function setStepTotalOperations(pGUIDStep,pTotalOperationCount){if(!(pGUIDStep in this.stepMap)){return new Error("Step [".concat(pGUIDStep,"] does not exist in operation [").concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," when attempting to set total operations to ").concat(pTotalOperationCount,"."));}this.progressTrackerSet.setProgressTrackerTotalOperations(this.stepMap[pGUIDStep].ProgressTracker.Hash,pTotalOperationCount);}},{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);}}]);}(libFableServiceBase);module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":79,"big.js":17,"fable-serviceproviderbase":52}],81:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase9){function FableServiceProgressTime(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,FableServiceProgressTime);_this34=_callSuper(this,FableServiceProgressTime,[pFable,pOptions,pServiceHash]);_this34.serviceType='ProgressTime';_this34.timeStamps={};return _this34;}_inherits(FableServiceProgressTime,_libFableServiceBase9);return _createClass2(FableServiceProgressTime,[{key:"formatTimeDuration",value:function formatTimeDuration(pTimeDurationInMilliseconds){var tmpTimeDuration=typeof pTimeDurationInMilliseconds=='number'?pTimeDurationInMilliseconds:0;if(pTimeDurationInMilliseconds<0){return'unknown';}var tmpTimeDurationString='';if(tmpTimeDuration>3600000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/3600000)+'h ';tmpTimeDuration=tmpTimeDuration%3600000;}if(tmpTimeDuration>60000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/60000)+'m ';tmpTimeDuration=tmpTimeDuration%60000;}if(tmpTimeDuration>1000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/1000)+'s ';tmpTimeDuration=tmpTimeDuration%1000;}tmpTimeDurationString+=Math.round(tmpTimeDuration)+'ms';return tmpTimeDurationString;}},{key:"createTimeStamp",value:function createTimeStamp(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';this.timeStamps[tmpTimeStampHash]=+new Date();return this.timeStamps[tmpTimeStampHash];}},{key:"getTimeStampValue",value:function getTimeStampValue(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';return tmpTimeStampHash in this.timeStamps?this.timeStamps[tmpTimeStampHash]:-1;}},{key:"updateTimeStampValue",value:function updateTimeStampValue(pTimeStampHash,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
1543
+ if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){this.timeStamps[tmpTimeStampHash]=tmpReferenceTime;return this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"removeTimeStamp",value:function removeTimeStamp(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';if(tmpTimeStampHash in this.timeStamps){delete this.timeStamps[tmpTimeStampHash];return true;}else{return false;}}},{key:"getTimeStampDelta",value:function getTimeStampDelta(pTimeStampHash,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
1544
+ if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"getDurationBetweenTimestamps",value:function getDurationBetweenTimestamps(pTimeStampHashStart,pTimeStampHashEnd){var tmpTimeStampHashStart=typeof pTimeStampHashStart=='string'?pTimeStampHashStart:'Default';var tmpTimeStampHashEnd=typeof pTimeStampHashEnd=='string'?pTimeStampHashEnd:'Default';if(tmpTimeStampHashStart in this.timeStamps&&tmpTimeStampHashEnd in this.timeStamps){return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];}else{return-1;}}},{key:"getTimeStampDeltaMessage",value:function getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpMessage=typeof pMessage!=='undefined'?pMessage:"Elapsed for ".concat(tmpTimeStampHash,": ");var tmpOperationTime=this.getTimeStampDelta(tmpTimeStampHash,pReferenceTime);return"".concat(tmpMessage," ").concat(this.formatTimeDuration(tmpOperationTime));}},{key:"logTimeStampDelta",value:function logTimeStampDelta(pTimeStampHash,pMessage,pReferenceTime){this.fable.log.info(this.getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTime;},{"fable-serviceproviderbase":52}],82:[function(require,module,exports){var ProgressTracker=/*#__PURE__*/function(){function ProgressTracker(pProgressTrackerSet,pProgressTrackerHash){_classCallCheck2(this,ProgressTracker);this.progressTrackerSet=pProgressTrackerSet;this.progressTrackerHash=pProgressTrackerHash;this.data=this.progressTrackerSet.getProgressTrackerData(this.progressTrackerHash);}return _createClass2(ProgressTracker,[{key:"updateProgressTracker",value:function updateProgressTracker(pProgressAmount){return this.progressTrackerSet.updateProgressTracker(this.progressTrackerHash,pProgressAmount);}},{key:"incrementProgressTracker",value:function incrementProgressTracker(pProgressIncrementAmount){return this.progressTrackerSet.incrementProgressTracker(this.progressTrackerHash,pProgressIncrementAmount);}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pTotalOperationCount){return this.progressTrackerSet.setProgressTrackerTotalOperations(this.progressTrackerHash,pTotalOperationCount);}},{key:"getProgressTrackerStatusString",value:function getProgressTrackerStatusString(){return this.progressTrackerSet.getProgressTrackerStatusString(this.progressTrackerHash);}}]);}();module.exports=ProgressTracker;},{}],83:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');var FableServiceProgressTrackerSet=/*#__PURE__*/function(_libFableServiceBase10){function FableServiceProgressTrackerSet(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,FableServiceProgressTrackerSet);_this35=_callSuper(this,FableServiceProgressTrackerSet,[pFable,pOptions,pServiceHash]);_this35.serviceType='ProgressTrackerSet';_this35.progressTrackers={};// Create an internal PorgressTime service to track timestamps
1551
1545
  _this35.progressTimes=_this35.fable.instantiateServiceProviderWithoutRegistration('ProgressTime');// This timestamp is used and updated by *all* progress trackers.
1552
- _this35.progressTimes.createTimeStamp('CurrentTime');return _this35;}_inherits(FableServiceProgressTrackerSet,_libFableServiceBase10);return _createClass2(FableServiceProgressTrackerSet,[{key:"getProgressTracker",value:function getProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,100);}return new libProgressTrackerClass(this,pProgressTrackerHash);}},{key:"getProgressTrackerData",value:function getProgressTrackerData(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,100);}return this.progressTrackers[tmpProgressTrackerHash];}},{key:"createProgressTracker",value:function createProgressTracker(pProgressTrackerHash,pTotalOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;var tmpProgressTracker={Hash:tmpProgressTrackerHash,StartTimeHash:"".concat(tmpProgressTrackerHash,"-Start"),StartTimeStamp:-1,CurrentTimeStamp:-1,EndTimeHash:"".concat(tmpProgressTrackerHash,"-End"),EndTimeStamp:-1,PercentComplete:-1,// If this is set to true, PercentComplete will be calculated as CurrentCount / TotalCount even if it goes over 100%
1553
- AllowTruePercentComplete:false,ElapsedTime:-1,AverageOperationTime:-1,EstimatedCompletionTime:-1,TotalCount:tmpTotalOperations,CurrentCount:-1};if(this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," already exists! Overwriting with a new tracker..."));this.progressTimes.removeTimeStamp(tmpProgressTracker.StartTimeHash);this.progressTimes.removeTimeStamp(tmpProgressTracker.EndTimeHash);}this.progressTrackers[tmpProgressTrackerHash]=tmpProgressTracker;return tmpProgressTracker;}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pProgressTrackerHash,pTotalOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.warn("Attempted to set the total operations of ProgressTracker ".concat(tmpProgressTrackerHash," but it does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,tmpTotalOperations);}this.progressTrackers[tmpProgressTrackerHash].TotalCount=tmpTotalOperations;return this.progressTrackers[tmpProgressTrackerHash];}},{key:"startProgressTracker",value:function startProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This is the only method to lazily create ProgressTrackers now
1554
- if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.createProgressTracker(tmpProgressTrackerHash,100);}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];this.progressTimes.createTimeStamp(this.progressTrackers[tmpProgressTrackerHash].StartTimeHash);tmpProgressTracker.StartTimeStamp=this.progressTimes.getTimeStampValue(this.progressTrackers[tmpProgressTrackerHash].StartTimeHash);if(tmpProgressTracker.CurrentCount<0){tmpProgressTracker.CurrentCount=0;}return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"endProgressTracker",value:function endProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.error("Attempted to end ProgressTracker ".concat(tmpProgressTrackerHash," that does not exist!"));return false;}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];this.progressTimes.createTimeStamp(this.progressTrackers[tmpProgressTrackerHash].EndTimeHash);tmpProgressTracker.EndTimeStamp=this.progressTimes.getTimeStampValue(this.progressTrackers[tmpProgressTrackerHash].EndTimeHash);return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"solveProgressTrackerStatus",value:function solveProgressTrackerStatus(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.error("Attempted to solve ProgressTracker ".concat(tmpProgressTrackerHash," that does not exist!"));return false;}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];if(tmpProgressTracker.TotalCount<1||isNaN(tmpProgressTracker.TotalCount)){this.fable.log.error("ProgressTracker ".concat(tmpProgressTracker.Hash," has an invalid total count of operations (").concat(tmpProgressTracker.TotalCount,"! Setting it to the default of 100..."));tmpProgressTracker.TotalCount=100;}// Compute the percentage of progress that is complete.
1546
+ _this35.progressTimes.createTimeStamp('CurrentTime');return _this35;}_inherits(FableServiceProgressTrackerSet,_libFableServiceBase10);return _createClass2(FableServiceProgressTrackerSet,[{key:"getProgressTracker",value:function getProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,100);}return new libProgressTrackerClass(this,pProgressTrackerHash);}},{key:"getProgressTrackerData",value:function getProgressTrackerData(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,100);}return this.progressTrackers[tmpProgressTrackerHash];}},{key:"createProgressTracker",value:function createProgressTracker(pProgressTrackerHash,pTotalOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;var tmpProgressTracker={Hash:tmpProgressTrackerHash,StartTimeHash:"".concat(tmpProgressTrackerHash,"-Start"),StartTimeStamp:-1,CurrentTimeStamp:-1,EndTimeHash:"".concat(tmpProgressTrackerHash,"-End"),EndTimeStamp:-1,PercentComplete:-1,// If this is set to true, PercentComplete will be calculated as CurrentCount / TotalCount even if it goes over 100%
1547
+ AllowTruePercentComplete:false,ElapsedTime:-1,AverageOperationTime:-1,EstimatedCompletionTime:-1,TotalCount:tmpTotalOperations,CurrentCount:-1};if(tmpProgressTrackerHash in this.progressTrackers){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," already exists! Overwriting with a new tracker..."));this.progressTimes.removeTimeStamp(tmpProgressTracker.StartTimeHash);this.progressTimes.removeTimeStamp(tmpProgressTracker.EndTimeHash);}this.progressTrackers[tmpProgressTrackerHash]=tmpProgressTracker;return tmpProgressTracker;}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pProgressTrackerHash,pTotalOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("Attempted to set the total operations of ProgressTracker ".concat(tmpProgressTrackerHash," but it does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,tmpTotalOperations);}this.progressTrackers[tmpProgressTrackerHash].TotalCount=tmpTotalOperations;return this.progressTrackers[tmpProgressTrackerHash];}},{key:"startProgressTracker",value:function startProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This is the only method to lazily create ProgressTrackers now
1548
+ if(!(tmpProgressTrackerHash in this.progressTrackers)){this.createProgressTracker(tmpProgressTrackerHash,100);}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];this.progressTimes.createTimeStamp(this.progressTrackers[tmpProgressTrackerHash].StartTimeHash);tmpProgressTracker.StartTimeStamp=this.progressTimes.getTimeStampValue(this.progressTrackers[tmpProgressTrackerHash].StartTimeHash);if(tmpProgressTracker.CurrentCount<0){tmpProgressTracker.CurrentCount=0;}return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"endProgressTracker",value:function endProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.error("Attempted to end ProgressTracker ".concat(tmpProgressTrackerHash," that does not exist!"));return false;}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];this.progressTimes.createTimeStamp(this.progressTrackers[tmpProgressTrackerHash].EndTimeHash);tmpProgressTracker.EndTimeStamp=this.progressTimes.getTimeStampValue(this.progressTrackers[tmpProgressTrackerHash].EndTimeHash);return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"solveProgressTrackerStatus",value:function solveProgressTrackerStatus(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.error("Attempted to solve ProgressTracker ".concat(tmpProgressTrackerHash," that does not exist!"));return false;}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];if(tmpProgressTracker.TotalCount<1||isNaN(tmpProgressTracker.TotalCount)){this.fable.log.error("ProgressTracker ".concat(tmpProgressTracker.Hash," has an invalid total count of operations (").concat(tmpProgressTracker.TotalCount,"! Setting it to the default of 100..."));tmpProgressTracker.TotalCount=100;}// Compute the percentage of progress that is complete.
1555
1549
  if(tmpProgressTracker.CurrentCount<1){tmpProgressTracker.PercentComplete=0;}else{tmpProgressTracker.PercentComplete=tmpProgressTracker.CurrentCount/tmpProgressTracker.TotalCount*100.0;}if(!tmpProgressTracker.AllowTruePercentComplete&&tmpProgressTracker.PercentComplete>100){tmpProgressTracker.PercentComplete=100;}// Compute the average time per operation
1556
1550
  this.progressTimes.updateTimeStampValue('CurrentTime');tmpProgressTracker.CurrentTimeStamp=this.progressTimes.getTimeStampValue('CurrentTime');tmpProgressTracker.ElapsedTime=tmpProgressTracker.CurrentTimeStamp-tmpProgressTracker.StartTimeStamp;if(tmpProgressTracker.EndTimeStamp>0){tmpProgressTracker.ElapsedTime=tmpProgressTracker.EndTimeStamp-tmpProgressTracker.StartTimeStamp;}if(tmpProgressTracker.CurrentCount>0){tmpProgressTracker.AverageOperationTime=(tmpProgressTracker.CurrentTimeStamp-tmpProgressTracker.StartTimeStamp)/tmpProgressTracker.CurrentCount;}else{tmpProgressTracker.AverageOperationTime=-1;}// Compute the estimated completion
1557
- if(tmpProgressTracker.AverageOperationTime>0){tmpProgressTracker.EstimatedCompletionTime=Math.max(tmpProgressTracker.TotalCount-tmpProgressTracker.CurrentCount,0)*tmpProgressTracker.AverageOperationTime;}else{tmpProgressTracker.EstimatedCompletionTime=-1;}return tmpProgressTracker;}},{key:"updateProgressTracker",value:function updateProgressTracker(pProgressTrackerHash,pCurrentOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpCurrentOperations=parseInt(pCurrentOperations);if(isNaN(tmpCurrentOperations)){this.fable.log.warn("Attempted to update ProgressTracker ".concat(tmpProgressTrackerHash," with an invalid number of operations!"));return false;}if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.createProgressTracker(100,tmpProgressTrackerHash);}this.progressTrackers[tmpProgressTrackerHash].CurrentCount=tmpCurrentOperations;return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"incrementProgressTracker",value:function incrementProgressTracker(pProgressTrackerHash,pOperationIncrementAmount){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpOperationIncrementAmount=parseInt(pOperationIncrementAmount);if(isNaN(tmpOperationIncrementAmount)){tmpOperationIncrementAmount=1;}if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){this.fable.log.warn("Attempted to increment ProgressTracker ".concat(tmpProgressTrackerHash," but it did not exist."));return false;}if(this.progressTrackers[tmpProgressTrackerHash].StartTimeStamp<1){this.fable.log.warn("Attempted to increment ProgressTracker ".concat(tmpProgressTrackerHash," but it was not started.. starting now."));this.startProgressTracker(tmpProgressTrackerHash);}this.progressTrackers[tmpProgressTrackerHash].CurrentCount=this.progressTrackers[tmpProgressTrackerHash].CurrentCount+tmpOperationIncrementAmount;return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"getProgressTrackerCompletedOperationCountString",value:function getProgressTrackerCompletedOperationCountString(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This call here can mean if we add operations and then immediately get the string, this function runs twice.
1551
+ if(tmpProgressTracker.AverageOperationTime>0){tmpProgressTracker.EstimatedCompletionTime=Math.max(tmpProgressTracker.TotalCount-tmpProgressTracker.CurrentCount,0)*tmpProgressTracker.AverageOperationTime;}else{tmpProgressTracker.EstimatedCompletionTime=-1;}return tmpProgressTracker;}},{key:"updateProgressTracker",value:function updateProgressTracker(pProgressTrackerHash,pCurrentOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpCurrentOperations=parseInt(pCurrentOperations);if(isNaN(tmpCurrentOperations)){this.fable.log.warn("Attempted to update ProgressTracker ".concat(tmpProgressTrackerHash," with an invalid number of operations!"));return false;}if(!(tmpProgressTrackerHash in this.progressTrackers)){this.createProgressTracker(100,tmpProgressTrackerHash);}this.progressTrackers[tmpProgressTrackerHash].CurrentCount=tmpCurrentOperations;return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"incrementProgressTracker",value:function incrementProgressTracker(pProgressTrackerHash,pOperationIncrementAmount){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpOperationIncrementAmount=parseInt(pOperationIncrementAmount);if(isNaN(tmpOperationIncrementAmount)){tmpOperationIncrementAmount=1;}if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("Attempted to increment ProgressTracker ".concat(tmpProgressTrackerHash," but it did not exist."));return false;}if(this.progressTrackers[tmpProgressTrackerHash].StartTimeStamp<1){this.fable.log.warn("Attempted to increment ProgressTracker ".concat(tmpProgressTrackerHash," but it was not started.. starting now."));this.startProgressTracker(tmpProgressTrackerHash);}this.progressTrackers[tmpProgressTrackerHash].CurrentCount=this.progressTrackers[tmpProgressTrackerHash].CurrentCount+tmpOperationIncrementAmount;return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"getProgressTrackerCompletedOperationCountString",value:function getProgressTrackerCompletedOperationCountString(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This call here can mean if we add operations and then immediately get the string, this function runs twice.
1558
1552
  var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];// The states of a progress tracker:
1559
1553
  if(tmpProgressTracker.CurrentCount<0){return"none";}else if(tmpProgressTracker.CurrentCount<1){return"0";}else{return"".concat(tmpProgressTracker.CurrentCount);}}},{key:"getProgressTrackerPercentCompleteString",value:function getProgressTrackerPercentCompleteString(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This call here can mean if we add operations and then immediately get the string, this function runs twice.
1560
1554
  // TODO: Is there a pattern to avoid this double call that's worth putting in?
1561
- this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){return"ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! No stats to display.");}else{var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];// The states of a progress tracker:
1555
+ this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!(tmpProgressTrackerHash in this.progressTrackers)){return"ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! No stats to display.");}else{var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];// The states of a progress tracker:
1562
1556
  // 1. Not started
1563
1557
  if(tmpProgressTracker.StartTimeStamp<1){return"0%";}// 2. Started, but no operations completed
1564
1558
  if(tmpProgressTracker.CurrentCount<1){return"0%";}// 3. Started, some operations completed
1565
1559
  else if(tmpProgressTracker.EndTimeStamp<1){return"".concat(tmpProgressTracker.PercentComplete.toFixed(3),"%");}// 4. Done
1566
1560
  else{return"".concat(tmpProgressTracker.PercentComplete.toFixed(3),"%");}}}},{key:"getProgressTrackerStatusString",value:function getProgressTrackerStatusString(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This call here can mean if we add operations and then immediately get the string, this function runs twice.
1567
1561
  // TODO: Is there a pattern to avoid this double call that's worth putting in?
1568
- this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!this.progressTrackers.hasOwnProperty(tmpProgressTrackerHash)){return"ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! No stats to display.");}else{var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];// The states of a progress tracker:
1562
+ this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!(tmpProgressTrackerHash in this.progressTrackers)){return"ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! No stats to display.");}else{var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];// The states of a progress tracker:
1569
1563
  // 1. Not started
1570
1564
  if(tmpProgressTracker.StartTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," has not been started yet.");}// 2. Started, but no operations completed
1571
1565
  if(tmpProgressTracker.CurrentCount<1&&tmpProgressTracker.EndTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," has no completed operations. ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," have elapsed since it was started.");}// 3. Started, some operations completed
1572
1566
  else if(tmpProgressTracker.EndTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," is ").concat(tmpProgressTracker.PercentComplete.toFixed(3),"% completed - ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations over ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," (median ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)," per). Estimated completion: ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.EstimatedCompletionTime));}// 4. Done
1573
1567
  else{return"ProgressTracker ".concat(tmpProgressTracker.Hash," is done. ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations were completed in ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," (median ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)," per).");}}}},{key:"logProgressTrackerStatus",value:function logProgressTrackerStatus(pProgressTrackerHash){this.fable.log.info(this.getProgressTrackerStatusString(pProgressTrackerHash));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTrackerSet;},{"./Fable-Service-ProgressTracker/ProgressTracker.js":82,"fable-serviceproviderbase":52}],84:[function(require,module,exports){(function(Buffer){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase11){function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this36;_classCallCheck2(this,FableServiceRestClient);_this36=_callSuper(this,FableServiceRestClient,[pFable,pOptions,pServiceHash]);_this36.TraceLog=false;if(_this36.options.TraceLog||_this36.fable.TraceLog){_this36.TraceLog=true;}_this36.dataFormat=_this36.fable.services.DataFormat;_this36.serviceType='RestClient';_this36.cookie=false;// This is a function that can be overridden, to allow the management
1574
1568
  // of the request options before they are passed to the request library.
1575
- _this36.prepareRequestOptions=function(pOptions){return pOptions;};return _this36;}_inherits(FableServiceRestClient,_libFableServiceBase11);return _createClass2(FableServiceRestClient,[{key:"simpleGet",get:function get(){return libSimpleGet;}},{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){var tmpCookieObject=this.cookie;if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
1569
+ _this36.prepareRequestOptions=function(pOptions){return pOptions;};return _this36;}_inherits(FableServiceRestClient,_libFableServiceBase11);return _createClass2(FableServiceRestClient,[{key:"simpleGet",get:function get(){return libSimpleGet;}},{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){var tmpCookieObject=this.cookie;if(!('headers'in pRequestOptions)){pRequestOptions.headers={};}var tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
1576
1570
  pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
1577
1571
  var tmpOptions=this.prepareCookies(pOptions);// Prepend a string to the URL if it exists in the Fable Config
1578
- if(this.fable.settings.hasOwnProperty('RestClientURLPrefix')){tmpOptions.url=this.fable.settings.RestClientURLPrefix+tmpOptions.url;}return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this37=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(_this37.TraceLog){var tmpConnectTime=_this37.fable.log.getTimeStamp();_this37.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this37.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.
1572
+ if('RestClientURLPrefix'in this.fable.settings){tmpOptions.url=this.fable.settings.RestClientURLPrefix+tmpOptions.url;}return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this37=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(_this37.TraceLog){var tmpConnectTime=_this37.fable.log.getTimeStamp();_this37.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this37.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.
1579
1573
  if(_this37.TraceLog){var tmpChunkTime=_this37.fable.log.getTimeStamp();_this37.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this37.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this37.TraceLog){var tmpCompletionTime=_this37.fable.log.getTimeStamp();_this37.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this37.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeChunkedRequestBinary",value:function executeChunkedRequestBinary(pOptions,fCallback){var _this38=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));}tmpOptions.json=false;tmpOptions.encoding=null;return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this38.TraceLog){var tmpConnectTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpDataBuffer=false;pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
1580
1574
  if(_this38.TraceLog){var tmpChunkTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}// TODO: Potentially create a third option that streams this to a file? So it doesn't have to hold it all in memory.
1581
- if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(_this38.TraceLog){var tmpCompletionTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpDataBuffer.length,"b received in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpDataBuffer);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this39=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!tmpOptions.hasOwnProperty('headers')){tmpOptions.headers={};}/* Automated headers break some APIs
1582
- if (!tmpOptions.headers.hasOwnProperty('Content-Type'))
1575
+ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(_this38.TraceLog){var tmpCompletionTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpDataBuffer.length,"b received in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpDataBuffer);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this39=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!('headers'in tmpOptions)){tmpOptions.headers={};}/* Automated headers break some APIs
1576
+ if (!('Content-Type' in tmpOptions.headers))
1583
1577
  {
1584
1578
  tmpOptions.headers['Content-Type'] = 'application/json';
1585
1579
  }
@@ -1638,7 +1632,7 @@ var tmpChunkSize=typeof pChunkSize=='number'?pChunkSize:0;var tmpChunkCache=type
1638
1632
  // This is not meant to replace the more complex libraries such as moment or luxon.
1639
1633
  // This *is* meant to be a simple, small, and fast way to convert ISO strings to dates in engines
1640
1634
  // with ultra limited JS capabilities where those don't work.
1641
- },{key:"isoStringToDate",value:function isoStringToDate(pISOString){if(!this.fable.hasOwnProperty('Dates')){this.fable.instantiateServiceProvider('Dates');}var tmpDate=false;try{tmpDate=this.fable.Dates.dayJS.utc(pISOString);}catch(pError){// TODO: Should this throw? Doubtful.
1635
+ },{key:"isoStringToDate",value:function isoStringToDate(pISOString){if(!('Dates'in this.fable)){this.fable.instantiateServiceProvider('Dates');}var tmpDate=false;try{tmpDate=this.fable.Dates.dayJS.utc(pISOString);}catch(pError){// TODO: Should this throw? Doubtful.
1642
1636
  this.fable.log.error("Could not parse date string ".concat(pISOString," with dayJS."));return false;}if(tmpDate){return tmpDate.toDate();}else{return false;}}}]);}(libFableServiceBase);module.exports=FableServiceUtility;},{"async.eachlimit":1,"async.waterfall":15,"big.js":17,"fable-serviceproviderbase":52}],87:[function(require,module,exports){'use strict';/* eslint no-invalid-this: 1 */var ERROR_MESSAGE='Function.prototype.bind called on incompatible ';var toStr=Object.prototype.toString;var max=Math.max;var funcType='[object Function]';var concatty=function concatty(a,b){var arr=[];for(var i=0;i<a.length;i+=1){arr[i]=a[i];}for(var j=0;j<b.length;j+=1){arr[j+a.length]=b[j];}return arr;};var slicy=function slicy(arrLike,offset){var arr=[];for(var i=offset||0,j=0;i<arrLike.length;i+=1,j+=1){arr[j]=arrLike[i];}return arr;};var joiny=function joiny(arr,joiner){var str='';for(var i=0;i<arr.length;i+=1){str+=arr[i];if(i+1<arr.length){str+=joiner;}}return str;};module.exports=function bind(that){var target=this;if(typeof target!=='function'||toStr.apply(target)!==funcType){throw new TypeError(ERROR_MESSAGE+target);}var args=slicy(arguments,1);var bound;var binder=function binder(){if(this instanceof bound){var result=target.apply(this,concatty(args,arguments));if(Object(result)===result){return result;}return this;}return target.apply(that,concatty(args,arguments));};var boundLength=max(0,target.length-args.length);var boundArgs=[];for(var i=0;i<boundLength;i++){boundArgs[i]='$'+i;}bound=Function('binder','return function ('+joiny(boundArgs,',')+'){ return binder.apply(this,arguments); }')(binder);if(target.prototype){var Empty=function Empty(){};Empty.prototype=target.prototype;bound.prototype=new Empty();Empty.prototype=null;}return bound;};},{}],88:[function(require,module,exports){'use strict';var implementation=require('./implementation');module.exports=Function.prototype.bind||implementation;},{"./implementation":87}],89:[function(require,module,exports){'use strict';var undefined;var $Error=require('es-errors');var $EvalError=require('es-errors/eval');var $RangeError=require('es-errors/range');var $ReferenceError=require('es-errors/ref');var $SyntaxError=require('es-errors/syntax');var $TypeError=require('es-errors/type');var $URIError=require('es-errors/uri');var $Function=Function;// eslint-disable-next-line consistent-return
1643
1637
  var getEvalledConstructor=function getEvalledConstructor(expressionSyntax){try{return $Function('"use strict"; return ('+expressionSyntax+').constructor;')();}catch(e){}};var $gOPD=Object.getOwnPropertyDescriptor;if($gOPD){try{$gOPD({},'');}catch(e){$gOPD=null;// this is IE 8, which has a broken gOPD
1644
1638
  }}var throwTypeError=function throwTypeError(){throw new $TypeError();};var ThrowTypeError=$gOPD?function(){try{// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
@@ -1702,10 +1696,10 @@ var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pStr
1702
1696
  */var ManyfestHashTranslation=/*#__PURE__*/function(){function ManyfestHashTranslation(pInfoLog,pErrorLog){_classCallCheck2(this,ManyfestHashTranslation);// Wire in logging
1703
1697
  this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}return _createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var _this43=this;// This adds a translation in the form of:
1704
1698
  // { "SourceHash": "DestinationHash", "SecondSourceHash":"SecondDestinationHash" }
1705
- if(_typeof(pTranslation)!='object'){this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(pTranslation)));return false;}var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){if(typeof pTranslation[pTranslationSource]!='string'){_this43.logError("Hash translation addTranslation expected a translation destination hash for [".concat(pTranslationSource,"] to be a string but the referrant was a ").concat(_typeof(pTranslation[pTranslationSource])));}else{_this43.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}},{key:"removeTranslationHash",value:function removeTranslationHash(pTranslationHash){if(this.translationTable.hasOwnProperty(pTranslationHash)){delete this.translationTable[pTranslationHash];}}// This removes translations.
1699
+ if(_typeof(pTranslation)!='object'){this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(pTranslation)));return false;}var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){if(typeof pTranslation[pTranslationSource]!='string'){_this43.logError("Hash translation addTranslation expected a translation destination hash for [".concat(pTranslationSource,"] to be a string but the referrant was a ").concat(_typeof(pTranslation[pTranslationSource])));}else{_this43.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}},{key:"removeTranslationHash",value:function removeTranslationHash(pTranslationHash){if(pTranslationHash in this.translationTable){delete this.translationTable[pTranslationHash];}}// This removes translations.
1706
1700
  // If passed a string, just removes the single one.
1707
1701
  // If passed an object, it does all the source keys.
1708
- },{key:"removeTranslation",value:function removeTranslation(pTranslation){var _this44=this;if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(_typeof(pTranslation)=='object'){var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){_this44.removeTranslation(pTranslationSource);});return true;}else{this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(_typeof(pTranslation)));return false;}}},{key:"clearTranslations",value:function clearTranslations(){this.translationTable={};}},{key:"translate",value:function translate(pTranslation){if(this.translationTable.hasOwnProperty(pTranslation)){return this.translationTable[pTranslation];}else{return pTranslation;}}}]);}();module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":101}],101:[function(require,module,exports){/**
1702
+ },{key:"removeTranslation",value:function removeTranslation(pTranslation){var _this44=this;if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(_typeof(pTranslation)=='object'){var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){_this44.removeTranslation(pTranslationSource);});return true;}else{this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(_typeof(pTranslation)));return false;}}},{key:"clearTranslations",value:function clearTranslations(){this.translationTable={};}},{key:"translate",value:function translate(pTranslation){if(pTranslation in this.translationTable){return this.translationTable[pTranslation];}else{return pTranslation;}}}]);}();module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":101}],101:[function(require,module,exports){/**
1709
1703
  * @author <steven@velozo.com>
1710
1704
  */ /**
1711
1705
  * Manyfest simple logging shim (for browser and dependency-free running)
@@ -1758,7 +1752,7 @@ var tmpFunctionStartIndex=pAddress.indexOf('(');// NOTE THAT FUNCTIONS MUST RESO
1758
1752
  // The requirements to detect a function are:
1759
1753
  // 1) The start bracket is after character 0
1760
1754
  if(tmpFunctionStartIndex>0// 2) The end bracket is after the start bracket
1761
- &&_MockFable.DataFormat.stringCountEnclosures(pAddress)>0){var tmpFunctionAddress=pAddress.substring(0,tmpFunctionStartIndex).trim();if(pObject.hasOwnProperty(tmpFunctionAddress)&&typeof pObject[tmpFunctionAddress]=='function'){return true;}else{// The address suggests it is a function, but it is not.
1755
+ &&_MockFable.DataFormat.stringCountEnclosures(pAddress)>0){var tmpFunctionAddress=pAddress.substring(0,tmpFunctionStartIndex).trim();if(tmpFunctionAddress in pObject&&typeof pObject[tmpFunctionAddress]=='function'){return true;}else{// The address suggests it is a function, but it is not.
1762
1756
  return false;}}// Boxed elements look like this:
1763
1757
  // MyValues[10]
1764
1758
  // MyValues['Name']
@@ -1785,9 +1779,9 @@ if(Array.isArray(pObject[tmpBoxedPropertyName])==isNaN(tmpBoxedPropertyNumber)){
1785
1779
  if(isNaN(tmpBoxedPropertyNumber)){// This isn't a number ... let's treat it as a dynamic object property.
1786
1780
  // We would expect the property to be wrapped in some kind of quotes so strip them
1787
1781
  tmpBoxedPropertyReference=this.cleanWrapCharacters('"',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters('`',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters("'",tmpBoxedPropertyReference);// Check if the property exists.
1788
- return pObject[tmpBoxedPropertyName].hasOwnProperty(tmpBoxedPropertyReference);}else{// Use the new in operator to see if the element is in the array
1782
+ return tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName];}else{// Use the new in operator to see if the element is in the array
1789
1783
  return tmpBoxedPropertyNumber in pObject[tmpBoxedPropertyName];}}else{// Check if the property exists
1790
- return pObject.hasOwnProperty(pAddress);}}else{var tmpSubObjectName=tmpAddressPartBeginning;var tmpNewAddress=pAddress.substring(tmpAddressPartBeginning.length+1);// Test if the tmpNewAddress is an array or object
1784
+ return pAddress in pObject;}}else{var tmpSubObjectName=tmpAddressPartBeginning;var tmpNewAddress=pAddress.substring(tmpAddressPartBeginning.length+1);// Test if the tmpNewAddress is an array or object
1791
1785
  // Check if it's a boxed property
1792
1786
  var _tmpBracketStartIndex=tmpSubObjectName.indexOf('[');var _tmpBracketStopIndex=tmpSubObjectName.indexOf(']');// Check if there is a function somewhere in the address... parenthesis start should only be in a function
1793
1787
  var _tmpFunctionStartIndex=tmpSubObjectName.indexOf('(');// NOTE THAT FUNCTIONS MUST RESOLVE FIRST
@@ -1846,7 +1840,7 @@ _tmpBoxedPropertyReference=this.cleanWrapCharacters('"',_tmpBoxedPropertyReferen
1846
1840
  return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyReference],tmpNewAddress,tmpRootObject);}else{// We parsed a valid number out of the boxed property name, so recurse into the array
1847
1841
  return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyNumber],tmpNewAddress,tmpRootObject);}}// If there is an object property already named for the sub object, but it isn't an object
1848
1842
  // then the system can't set the value in there. Error and abort!
1849
- if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!=='object'){return false;}else if(pObject.hasOwnProperty(tmpSubObjectName)){// If there is already a subobject pass that to the recursive thingy
1843
+ if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return false;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
1850
1844
  return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress,tmpRootObject);}else{// Create a subobject and then pass that
1851
1845
  pObject[tmpSubObjectName]={};return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress,tmpRootObject);}}}}]);}();;module.exports=ManyfestObjectAddressResolverCheckAddressExists;},{"./Manyfest-LogToConsole.js":101,"./Manyfest-ObjectAddress-GetValue.js":104,"./Manyfest-ObjectAddress-Parser.js":105}],103:[function(require,module,exports){/**
1852
1846
  * @author <steven@velozo.com>
@@ -1971,7 +1965,7 @@ tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.
1971
1965
  var _tmpContainerObject={};for(var _i18=0;_i18<tmpObjectPropertyKeys.length;_i18++){var _tmpPropertyParentAddress="".concat(tmpParentAddress,".").concat(tmpObjectPropertyKeys[_i18]);var _tmpValue2=this.deleteValueAtAddress(pObject[_tmpObjectPropertyName][tmpObjectPropertyKeys[_i18]],tmpNewAddress,_tmpPropertyParentAddress);// The filtering is complex but allows config-based metaprogramming directly from schema
1972
1966
  var _tmpKeepRecord=this.checkRecordFilters(pAddress,_tmpValue2);if(_tmpKeepRecord){_tmpContainerObject["".concat(_tmpPropertyParentAddress,".").concat(tmpNewAddress)]=_tmpValue2;}}return _tmpContainerObject;}// If there is an object property already named for the sub object, but it isn't an object
1973
1967
  // then the system can't set the value in there. Error and abort!
1974
- if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(pObject.hasOwnProperty(tmpSubObjectName)){// If there is already a subobject pass that to the recursive thingy
1968
+ if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
1975
1969
  // Continue to manage the parent address for recursion
1976
1970
  tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}else{// Create a subobject and then pass that
1977
1971
  // Continue to manage the parent address for recursion
@@ -2037,7 +2031,8 @@ return false;}// Now see if the function has arguments.
2037
2031
  // Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
2038
2032
  var tmpFunctionArguments=_MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(pAddress.substring(tmpFunctionAddress.length),0),',');if(tmpFunctionArguments.length==0||tmpFunctionArguments[0]==''){// No arguments... just call the function (bound to the scope of the object it is contained withing)
2039
2033
  return pObject[tmpFunctionAddress].apply(pObject);}else{var tmpArgumentValues=[];var _tmpRootObject2=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
2040
- for(var _i19=0;_i19<tmpFunctionArguments.length;_i19++){if(tmpFunctionArguments[_i19][0]=="'"&&tmpFunctionArguments[_i19][tmpFunctionArguments[_i19].length-1]=="'"){tmpArgumentValues.push(tmpFunctionArguments[_i19].substring(1,tmpFunctionArguments[_i19].length-1));}else if(tmpFunctionArguments[_i19][0]=='"'&&tmpFunctionArguments[_i19][tmpFunctionArguments[_i19].length-1]=='"'){tmpArgumentValues.push(tmpFunctionArguments[_i19].substring(1,tmpFunctionArguments[_i19].length-1));}else if(tmpFunctionArguments[_i19][0]=="`"&&tmpFunctionArguments[_i19][tmpFunctionArguments[_i19].length-1]=="`"){tmpArgumentValues.push(tmpFunctionArguments[_i19].substring(1,tmpFunctionArguments[_i19].length-1));}else{tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[_i19]));}}return pObject[tmpFunctionAddress].apply(pObject,tmpArgumentValues);}}// Boxed elements look like this:
2034
+ for(var _i19=0;_i19<tmpFunctionArguments.length;_i19++){// Resolve the values for each subsequent entry
2035
+ tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[_i19]));}return pObject[tmpFunctionAddress].apply(pObject,tmpArgumentValues);}}// Boxed elements look like this:
2041
2036
  // MyValues[10]
2042
2037
  // MyValues['Name']
2043
2038
  // MyValues["Age"]
@@ -2148,7 +2143,7 @@ tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.
2148
2143
  var _tmpContainerObject2={};for(var _i23=0;_i23<tmpObjectPropertyKeys.length;_i23++){var _tmpPropertyParentAddress2="".concat(tmpParentAddress,".").concat(tmpObjectPropertyKeys[_i23]);var _tmpValue3=this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[_i23]],tmpNewAddress,_tmpPropertyParentAddress2,tmpRootObject);// The filtering is complex but allows config-based metaprogramming directly from schema
2149
2144
  var _tmpKeepRecord2=this.checkRecordFilters(pAddress,_tmpValue3);if(_tmpKeepRecord2){_tmpContainerObject2["".concat(_tmpPropertyParentAddress2,".").concat(tmpNewAddress)]=_tmpValue3;}}return _tmpContainerObject2;}// If there is an object property already named for the sub object, but it isn't an object
2150
2145
  // then the system can't set the value in there. Error and abort!
2151
- if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(pObject.hasOwnProperty(tmpSubObjectName)){// If there is already a subobject pass that to the recursive thingy
2146
+ if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
2152
2147
  // Continue to manage the parent address for recursion
2153
2148
  tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}else{// Create a subobject and then pass that
2154
2149
  // Continue to manage the parent address for recursion
@@ -2170,9 +2165,9 @@ module.exports={/**
2170
2165
  if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
2171
2166
  &&tmpEnclosureStack.length==0){// Increment the segment count
2172
2167
  tmpSegmentCount++;}// IF This is the start of an enclosure
2173
- else if(tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])){// Add it to the stack!
2168
+ else if(tmpString[i]in tmpEnclosureStartSymbolMap){// Add it to the stack!
2174
2169
  tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);}// IF This is the end of an enclosure
2175
- else if(tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])// AND it matches the current nest level symbol
2170
+ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nest level symbol
2176
2171
  &&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
2177
2172
  tmpEnclosureStack.pop();}}return tmpSegmentCount;},/**
2178
2173
  * Get the first segment in a string, respecting enclosures
@@ -2186,9 +2181,9 @@ tmpEnclosureStack.pop();}}return tmpSegmentCount;},/**
2186
2181
  if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
2187
2182
  &&tmpEnclosureStack.length==0){// Return the segment
2188
2183
  return tmpString.substring(0,i);}// IF This is the start of an enclosure
2189
- else if(tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])){// Add it to the stack!
2184
+ else if(tmpString[i]in tmpEnclosureStartSymbolMap){// Add it to the stack!
2190
2185
  tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);}// IF This is the end of an enclosure
2191
- else if(tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])// AND it matches the current nest level symbol
2186
+ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nest level symbol
2192
2187
  &&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
2193
2188
  tmpEnclosureStack.pop();}}return tmpString;},/**
2194
2189
  * Get all segments in a string, respecting enclosures
@@ -2202,9 +2197,9 @@ tmpEnclosureStack.pop();}}return tmpString;},/**
2202
2197
  if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
2203
2198
  &&tmpEnclosureStack.length==0){// Return the segment
2204
2199
  tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart,i));tmpCurrentSegmentStart=i+1;}// IF This is the start of an enclosure
2205
- else if(tmpEnclosureStartSymbolMap.hasOwnProperty(tmpString[i])){// Add it to the stack!
2200
+ else if(tmpString[i]in tmpEnclosureStartSymbolMap){// Add it to the stack!
2206
2201
  tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);}// IF This is the end of an enclosure
2207
- else if(tmpEnclosureEndSymbolMap.hasOwnProperty(tmpString[i])// AND it matches the current nest level symbol
2202
+ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nest level symbol
2208
2203
  &&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
2209
2204
  tmpEnclosureStack.pop();}}if(tmpCurrentSegmentStart<tmpString.length){tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart));}return tmpSegmentList;},/**
2210
2205
  * Count the number of enclosures in a string based on the start and end characters.
@@ -2318,8 +2313,8 @@ _tmpBoxedPropertyReference4=this.cleanWrapCharacters('"',_tmpBoxedPropertyRefere
2318
2313
  return this.setValueAtAddress(pObject[_tmpBoxedPropertyName8][_tmpBoxedPropertyReference4],tmpNewAddress,pValue);}else{// We parsed a valid number out of the boxed property name, so recurse into the array
2319
2314
  return this.setValueAtAddress(pObject[_tmpBoxedPropertyName8][_tmpBoxedPropertyNumber4],tmpNewAddress,pValue);}}// If there is an object property already named for the sub object, but it isn't an object
2320
2315
  // then the system can't set the value in there. Error and abort!
2321
- if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!=='object'){if(!pObject.hasOwnProperty('__ERROR'))pObject['__ERROR']={};// Put it in an error object so data isn't lost
2322
- pObject['__ERROR'][pAddress]=pValue;return false;}else if(pObject.hasOwnProperty(tmpSubObjectName)){// If there is already a subobject pass that to the recursive thingy
2316
+ if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){if(!('__ERROR'in pObject))pObject['__ERROR']={};// Put it in an error object so data isn't lost
2317
+ pObject['__ERROR'][pAddress]=pValue;return false;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
2323
2318
  return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}else{// Create a subobject and then pass that
2324
2319
  pObject[tmpSubObjectName]={};return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}}}}]);}();;module.exports=ManyfestObjectAddressSetValue;},{"./Manyfest-CleanWrapCharacters.js":99,"./Manyfest-LogToConsole.js":101}],107:[function(require,module,exports){/**
2325
2320
  * @author <steven@velozo.com>
@@ -2417,13 +2412,13 @@ this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=ty
2417
2412
  // TODO: Discuss what should happen on collisions.
2418
2413
  return _createClass2(ManyfestSchemaManipulation,[{key:"resolveAddressMappings",value:function resolveAddressMappings(pManyfestSchemaDescriptors,pAddressMapping){if(_typeof(pManyfestSchemaDescriptors)!='object'){this.logError("Attempted to resolve address mapping but the descriptor was not an object.");return false;}if(_typeof(pAddressMapping)!='object'){// No mappings were passed in
2419
2414
  return true;}// Get the arrays of both the schema definition and the hash mapping
2420
- var tmpManyfestAddresses=Object.keys(pManyfestSchemaDescriptors);var tmpHashMapping={};tmpManyfestAddresses.forEach(function(pAddress){if(pManyfestSchemaDescriptors[pAddress].hasOwnProperty('Hash')){tmpHashMapping[pManyfestSchemaDescriptors[pAddress].Hash]=pAddress;}});var tmpAddressMappingSet=Object.keys(pAddressMapping);tmpAddressMappingSet.forEach(function(pInputAddress){var tmpNewDescriptorAddress=pAddressMapping[pInputAddress];var tmpOldDescriptorAddress=false;var tmpDescriptor=false;// See if there is a matching descriptor either by Address directly or Hash
2421
- if(pManyfestSchemaDescriptors.hasOwnProperty(pInputAddress)){tmpOldDescriptorAddress=pInputAddress;}else if(tmpHashMapping.hasOwnProperty(pInputAddress)){tmpOldDescriptorAddress=tmpHashMapping[pInputAddress];}// If there was a matching descriptor in the manifest, store it in the temporary descriptor
2415
+ var tmpManyfestAddresses=Object.keys(pManyfestSchemaDescriptors);var tmpHashMapping={};tmpManyfestAddresses.forEach(function(pAddress){if('Hash'in pManyfestSchemaDescriptors[pAddress]){tmpHashMapping[pManyfestSchemaDescriptors[pAddress].Hash]=pAddress;}});var tmpAddressMappingSet=Object.keys(pAddressMapping);tmpAddressMappingSet.forEach(function(pInputAddress){var tmpNewDescriptorAddress=pAddressMapping[pInputAddress];var tmpOldDescriptorAddress=false;var tmpDescriptor=false;// See if there is a matching descriptor either by Address directly or Hash
2416
+ if(pInputAddress in pManyfestSchemaDescriptors){tmpOldDescriptorAddress=pInputAddress;}else if(pInputAddress in tmpHashMapping){tmpOldDescriptorAddress=tmpHashMapping[pInputAddress];}// If there was a matching descriptor in the manifest, store it in the temporary descriptor
2422
2417
  if(tmpOldDescriptorAddress){tmpDescriptor=pManyfestSchemaDescriptors[tmpOldDescriptorAddress];delete pManyfestSchemaDescriptors[tmpOldDescriptorAddress];}else{// Create a new descriptor! Map it to the input address.
2423
2418
  tmpDescriptor={Hash:pInputAddress};}// Now re-add the descriptor to the manyfest schema
2424
2419
  pManyfestSchemaDescriptors[tmpNewDescriptorAddress]=tmpDescriptor;});return true;}},{key:"safeResolveAddressMappings",value:function safeResolveAddressMappings(pManyfestSchemaDescriptors,pAddressMapping){// This returns the descriptors as a new object, safely remapping without mutating the original schema Descriptors
2425
2420
  var tmpManyfestSchemaDescriptors=JSON.parse(JSON.stringify(pManyfestSchemaDescriptors));this.resolveAddressMappings(tmpManyfestSchemaDescriptors,pAddressMapping);return tmpManyfestSchemaDescriptors;}},{key:"mergeAddressMappings",value:function mergeAddressMappings(pManyfestSchemaDescriptorsDestination,pManyfestSchemaDescriptorsSource){if(_typeof(pManyfestSchemaDescriptorsSource)!='object'||_typeof(pManyfestSchemaDescriptorsDestination)!='object'){this.logError("Attempted to merge two schema descriptors but both were not objects.");return false;}var tmpSource=JSON.parse(JSON.stringify(pManyfestSchemaDescriptorsSource));var tmpNewManyfestSchemaDescriptors=JSON.parse(JSON.stringify(pManyfestSchemaDescriptorsDestination));// The first passed-in set of descriptors takes precedence.
2426
- var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach(function(pDescriptorAddress){if(!tmpNewManyfestSchemaDescriptors.hasOwnProperty(pDescriptorAddress)){tmpNewManyfestSchemaDescriptors[pDescriptorAddress]=tmpSource[pDescriptorAddress];}});return tmpNewManyfestSchemaDescriptors;}}]);}();module.exports=ManyfestSchemaManipulation;},{"./Manyfest-LogToConsole.js":101}],110:[function(require,module,exports){/**
2421
+ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach(function(pDescriptorAddress){if(!(pDescriptorAddress in tmpNewManyfestSchemaDescriptors)){tmpNewManyfestSchemaDescriptors[pDescriptorAddress]=tmpSource[pDescriptorAddress];}});return tmpNewManyfestSchemaDescriptors;}}]);}();module.exports=ManyfestSchemaManipulation;},{"./Manyfest-LogToConsole.js":101}],110:[function(require,module,exports){/**
2427
2422
  * @author <steven@velozo.com>
2428
2423
  */var libFableServiceProviderBase=require('fable-serviceproviderbase');var libSimpleLog=require('./Manyfest-LogToConsole.js');var libHashTranslation=require('./Manyfest-HashTranslation.js');var libObjectAddressCheckAddressExists=require('./Manyfest-ObjectAddress-CheckAddressExists.js');var libObjectAddressGetValue=require('./Manyfest-ObjectAddress-GetValue.js');var libObjectAddressSetValue=require('./Manyfest-ObjectAddress-SetValue.js');var libObjectAddressDeleteValue=require('./Manyfest-ObjectAddress-DeleteValue.js');var libObjectAddressGeneration=require('./Manyfest-ObjectAddressGeneration.js');var libSchemaManipulation=require('./Manyfest-SchemaManipulation.js');var _DefaultConfiguration={Scope:'DEFAULT',Descriptors:{}};/**
2429
2424
  * Manyfest object address-based descriptions and manipulations.
@@ -2431,7 +2426,7 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
2431
2426
  * @class Manyfest
2432
2427
  */var Manyfest=/*#__PURE__*/function(_libFableServiceProvi10){function Manyfest(pFable,pManifest,pServiceHash){var _this45;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this45=_callSuper(this,Manyfest,[{}]);}else{_this45=_callSuper(this,Manyfest,[pFable,pManifest,pServiceHash]);}_this45.serviceType='Manifest';// Wire in logging
2433
2428
  _this45.logInfo=libSimpleLog;_this45.logError=libSimpleLog;// Create an object address resolver and map in the functions
2434
- _this45.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this45.logInfo,_this45.logError);_this45.objectAddressGetValue=new libObjectAddressGetValue(_this45.logInfo,_this45.logError);_this45.objectAddressSetValue=new libObjectAddressSetValue(_this45.logInfo,_this45.logError);_this45.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this45.logInfo,_this45.logError);if(!_this45.options.hasOwnProperty('defaultValues')){_this45.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this45.options.hasOwnProperty('strict')){_this45.options.strict=false;}_this45.scope=undefined;_this45.elementAddresses=undefined;_this45.elementHashes=undefined;_this45.elementDescriptors=undefined;_this45.reset();if(_typeof(_this45.options)==='object'){_this45.loadManifest(_this45.options);}_this45.schemaManipulations=new libSchemaManipulation(_this45.logInfo,_this45.logError);_this45.objectAddressGeneration=new libObjectAddressGeneration(_this45.logInfo,_this45.logError);_this45.hashTranslations=new libHashTranslation(_this45.logInfo,_this45.logError);return _assertThisInitialized(_this45);}/*************************************************************************
2429
+ _this45.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this45.logInfo,_this45.logError);_this45.objectAddressGetValue=new libObjectAddressGetValue(_this45.logInfo,_this45.logError);_this45.objectAddressSetValue=new libObjectAddressSetValue(_this45.logInfo,_this45.logError);_this45.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this45.logInfo,_this45.logError);if(!('defaultValues'in _this45.options)){_this45.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!('strict'in _this45.options)){_this45.options.strict=false;}_this45.scope=undefined;_this45.elementAddresses=undefined;_this45.elementHashes=undefined;_this45.elementDescriptors=undefined;_this45.reset();if(_typeof(_this45.options)==='object'){_this45.loadManifest(_this45.options);}_this45.schemaManipulations=new libSchemaManipulation(_this45.logInfo,_this45.logError);_this45.objectAddressGeneration=new libObjectAddressGeneration(_this45.logInfo,_this45.logError);_this45.hashTranslations=new libHashTranslation(_this45.logInfo,_this45.logError);return _assertThisInitialized(_this45);}/*************************************************************************
2435
2430
  * Schema Manifest Loading, Reading, Manipulation and Serialization Functions
2436
2431
  */ // Reset critical manifest properties
2437
2432
  _inherits(Manyfest,_libFableServiceProvi10);return _createClass2(Manyfest,[{key:"reset",value:function reset(){this.scope='DEFAULT';this.elementAddresses=[];this.elementHashes={};this.elementDescriptors={};}},{key:"clone",value:function clone(){// Make a copy of the options in-place
@@ -2439,13 +2434,13 @@ var tmpNewOptions=JSON.parse(JSON.stringify(this.options));var tmpNewManyfest=ne
2439
2434
  tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);return tmpNewManyfest;}// Deserialize a Manifest from a string
2440
2435
  },{key:"deserialize",value:function deserialize(pManifestString){// TODO: Add guards for bad manifest string
2441
2436
  return this.loadManifest(JSON.parse(pManifestString));}// Load a manifest from an object
2442
- },{key:"loadManifest",value:function loadManifest(pManifest){if(_typeof(pManifest)!=='object'){this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(pManifest),"."));}var tmpManifest=_typeof(pManifest)=='object'?pManifest:{};var tmpDescriptorKeys=Object.keys(_DefaultConfiguration);for(var i=0;i<tmpDescriptorKeys.length;i++){if(!tmpManifest.hasOwnProperty(tmpDescriptorKeys[i])){tmpManifest[tmpDescriptorKeys[i]]=JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));}}if(tmpManifest.hasOwnProperty('Scope')){if(typeof tmpManifest.Scope==='string'){this.scope=tmpManifest.Scope;}else{this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(tmpManifest.Scope),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."),tmpManifest);}if(tmpManifest.hasOwnProperty('Descriptors')){if(_typeof(tmpManifest.Descriptors)==='object'){var tmpDescriptionAddresses=Object.keys(tmpManifest.Descriptors);for(var _i25=0;_i25<tmpDescriptionAddresses.length;_i25++){this.addDescriptor(tmpDescriptionAddresses[_i25],tmpManifest.Descriptors[tmpDescriptionAddresses[_i25]]);}}else{this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(tmpManifest.Descriptors),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading object description from manifest object. Property \"Descriptors\" does not exist in the root of the Manifest object."),tmpManifest);}if(tmpManifest.hasOwnProperty('HashTranslations')){if(_typeof(tmpManifest.HashTranslations)==='object'){for(var _i26=0;_i26<tmpManifest.HashTranslations.length;_i26++){// Each translation is
2437
+ },{key:"loadManifest",value:function loadManifest(pManifest){if(_typeof(pManifest)!=='object'){this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(pManifest),"."));}var tmpManifest=_typeof(pManifest)=='object'?pManifest:{};var tmpDescriptorKeys=Object.keys(_DefaultConfiguration);for(var i=0;i<tmpDescriptorKeys.length;i++){if(!(tmpDescriptorKeys[i]in tmpManifest)){tmpManifest[tmpDescriptorKeys[i]]=JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));}}if('Scope'in tmpManifest){if(typeof tmpManifest.Scope==='string'){this.scope=tmpManifest.Scope;}else{this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(tmpManifest.Scope),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."),tmpManifest);}if('Descriptors'in tmpManifest){if(_typeof(tmpManifest.Descriptors)==='object'){var tmpDescriptionAddresses=Object.keys(tmpManifest.Descriptors);for(var _i25=0;_i25<tmpDescriptionAddresses.length;_i25++){this.addDescriptor(tmpDescriptionAddresses[_i25],tmpManifest.Descriptors[tmpDescriptionAddresses[_i25]]);}}else{this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(tmpManifest.Descriptors),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading object description from manifest object. Property \"Descriptors\" does not exist in the root of the Manifest object."),tmpManifest);}if('HashTranslations'in tmpManifest){if(_typeof(tmpManifest.HashTranslations)==='object'){for(var _i26=0;_i26<tmpManifest.HashTranslations.length;_i26++){// Each translation is
2443
2438
  }}}}// Serialize the Manifest to a string
2444
2439
  },{key:"serialize",value:function serialize(){return JSON.stringify(this.getManifest());}},{key:"getManifest",value:function getManifest(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))};}// Add a descriptor to the manifest
2445
2440
  },{key:"addDescriptor",value:function addDescriptor(pAddress,pDescriptor){if(_typeof(pDescriptor)==='object'){// Add the Address into the Descriptor if it doesn't exist:
2446
- if(!pDescriptor.hasOwnProperty('Address')){pDescriptor.Address=pAddress;}if(!this.elementDescriptors.hasOwnProperty(pAddress)){this.elementAddresses.push(pAddress);}// Add the element descriptor to the schema
2441
+ if(!('Address'in pDescriptor)){pDescriptor.Address=pAddress;}if(!(pAddress in this.elementDescriptors)){this.elementAddresses.push(pAddress);}// Add the element descriptor to the schema
2447
2442
  this.elementDescriptors[pAddress]=pDescriptor;// Always add the address as a hash
2448
- this.elementHashes[pAddress]=pAddress;if(pDescriptor.hasOwnProperty('Hash')){// TODO: Check if this is a good idea or not..
2443
+ this.elementHashes[pAddress]=pAddress;if('Hash'in pDescriptor){// TODO: Check if this is a good idea or not..
2449
2444
  // Collisions are bound to happen with both representations of the address/hash in here and developers being able to create their own hashes.
2450
2445
  this.elementHashes[pDescriptor.Hash]=pAddress;}else{pDescriptor.Hash=pAddress;}return true;}else{this.logError("(".concat(this.scope,") Error loading object descriptor for address '").concat(pAddress,"' from manifest object. Expecting an object but property was type ").concat(_typeof(pDescriptor),"."));return false;}}},{key:"getDescriptorByHash",value:function getDescriptorByHash(pHash){return this.getDescriptor(this.resolveHashAddress(pHash));}},{key:"getDescriptor",value:function getDescriptor(pAddress){return this.elementDescriptors[pAddress];}// execute an action function for each descriptor
2451
2446
  },{key:"eachDescriptor",value:function eachDescriptor(fAction){var tmpDescriptorAddresses=Object.keys(this.elementDescriptors);for(var i=0;i<tmpDescriptorAddresses.length;i++){fAction(this.elementDescriptors[tmpDescriptorAddresses[i]]);}}/*************************************************************************
@@ -2453,9 +2448,9 @@ this.elementHashes[pDescriptor.Hash]=pAddress;}else{pDescriptor.Hash=pAddress;}r
2453
2448
  */ // Check if an element exists by its hash
2454
2449
  },{key:"checkAddressExistsByHash",value:function checkAddressExistsByHash(pObject,pHash){return this.checkAddressExists(pObject,this.resolveHashAddress(pHash));}// Check if an element exists at an address
2455
2450
  },{key:"checkAddressExists",value:function checkAddressExists(pObject,pAddress){return this.objectAddressCheckAddressExists.checkAddressExists(pObject,pAddress);}// Turn a hash into an address, factoring in the translation table.
2456
- },{key:"resolveHashAddress",value:function resolveHashAddress(pHash){var tmpAddress=undefined;var tmpInElementHashTable=this.elementHashes.hasOwnProperty(pHash);var tmpInTranslationTable=this.hashTranslations.translationTable.hasOwnProperty(pHash);// The most straightforward: the hash exists, no translations.
2451
+ },{key:"resolveHashAddress",value:function resolveHashAddress(pHash){var tmpAddress=undefined;var tmpInElementHashTable=(pHash in this.elementHashes);var tmpInTranslationTable=(pHash in this.hashTranslations.translationTable);// The most straightforward: the hash exists, no translations.
2457
2452
  if(tmpInElementHashTable&&!tmpInTranslationTable){tmpAddress=this.elementHashes[pHash];}// There is a translation from one hash to another, and, the elementHashes contains the pointer end
2458
- else if(tmpInTranslationTable&&this.elementHashes.hasOwnProperty(this.hashTranslations.translate(pHash))){tmpAddress=this.elementHashes[this.hashTranslations.translate(pHash)];}// Use the level of indirection only in the Translation Table
2453
+ else if(tmpInTranslationTable&&this.hashTranslations.translate(pHash)in this.elementHashes){tmpAddress=this.elementHashes[this.hashTranslations.translate(pHash)];}// Use the level of indirection only in the Translation Table
2459
2454
  else if(tmpInTranslationTable){tmpAddress=this.hashTranslations.translate(pHash);}// Just treat the hash as an address.
2460
2455
  // TODO: Discuss this ... it is magic but controversial
2461
2456
  else{tmpAddress=pHash;}return tmpAddress;}// Get the value of an element by its hash
@@ -2475,12 +2470,12 @@ if(tmpDescriptor.DataType){var tmpElementType=_typeof(tmpValue);switch(tmpDescri
2475
2470
  addValidationError(tmpDescriptor.Address,"has a DataType ".concat(tmpDescriptor.DataType," but has a decimal point in the number."));}}break;case'float':if(tmpElementType!='number'){addValidationError(tmpDescriptor.Address,"has a DataType ".concat(tmpDescriptor.DataType," but is of the type ").concat(tmpElementType));}break;case'DateTime':var tmpValueDate=new Date(tmpValue);if(tmpValueDate.toString()=='Invalid Date'){addValidationError(tmpDescriptor.Address,"has a DataType ".concat(tmpDescriptor.DataType," but is not parsable as a Date by Javascript"));}default:// Check if this is a string, in the default case
2476
2471
  // Note this is only when a DataType is specified and it is an unrecognized data type.
2477
2472
  if(tmpElementType!='string'){addValidationError(tmpDescriptor.Address,"has a DataType ".concat(tmpDescriptor.DataType," (which auto-converted to String because it was unrecognized) but is of the type ").concat(tmpElementType));}break;}}}return tmpValidationData;}// Returns a default value, or, the default value for the data type (which is overridable with configuration)
2478
- },{key:"getDefaultValue",value:function getDefaultValue(pDescriptor){if(_typeof(pDescriptor)!='object'){return undefined;}if(pDescriptor.hasOwnProperty('Default')){return pDescriptor.Default;}else{// Default to a null if it doesn't have a type specified.
2473
+ },{key:"getDefaultValue",value:function getDefaultValue(pDescriptor){if(_typeof(pDescriptor)!='object'){return undefined;}if('Default'in pDescriptor){return pDescriptor.Default;}else{// Default to a null if it doesn't have a type specified.
2479
2474
  // This will ensure a placeholder is created but isn't misinterpreted.
2480
- var tmpDataType=pDescriptor.hasOwnProperty('DataType')?pDescriptor.DataType:'String';if(this.options.defaultValues.hasOwnProperty(tmpDataType)){return this.options.defaultValues[tmpDataType];}else{// give up and return null
2475
+ var tmpDataType='DataType'in pDescriptor?pDescriptor.DataType:'String';if(tmpDataType in this.options.defaultValues){return this.options.defaultValues[tmpDataType];}else{// give up and return null
2481
2476
  return null;}}}// Enumerate through the schema and populate default values if they don't exist.
2482
2477
  },{key:"populateDefaults",value:function populateDefaults(pObject,pOverwriteProperties){return this.populateObject(pObject,pOverwriteProperties,// This just sets up a simple filter to see if there is a default set.
2483
- function(pDescriptor){return pDescriptor.hasOwnProperty('Default');});}// Forcefully populate all values even if they don't have defaults.
2478
+ function(pDescriptor){return'Default'in pDescriptor;});}// Forcefully populate all values even if they don't have defaults.
2484
2479
  // Based on type, this can do unexpected things.
2485
2480
  },{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var _this46=this;// Automatically create an object if one isn't passed in.
2486
2481
  var tmpObject=_typeof(pObject)==='object'?pObject:{};// Default to *NOT OVERWRITING* properties
@@ -3967,44 +3962,137 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
3967
3962
  // presumably different callback function.
3968
3963
  // This makes sure that own properties are retained, so that
3969
3964
  // decorations and such are not lost along the way.
3970
- module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],159:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],160:[function(require,module,exports){// Simple function to load a pict Application
3971
- module.exports=function(pPictApplication,pLogNoisiness){var tmpLogNoisiness=typeof pLogNoisiness=='undefined'?0:pLogNoisiness;// Set up a basal pict on the window object
3972
- if(pPictApplication&&pPictApplication.hasOwnProperty('default_configuration')&&pPictApplication.default_configuration.hasOwnProperty('pict_configuration')){window._Pict=new Pict(pPictApplication.default_configuration.pict_configuration);}else{window._Pict=new Pict();}window._Pict.LogNoisiness=tmpLogNoisiness;var tmpApplicationHash='DefaultApplication';var tmpDefaultConfiguration={};if(pPictApplication.hasOwnProperty('default_configuration')){tmpDefaultConfiguration=pPictApplication.default_configuration;if(pPictApplication.default_configuration.hasOwnProperty('Hash')){tmpDefaultConfiguration=pPictApplication.default_configuration;tmpApplicationHash=pPictApplication.default_configuration.Hash;}}_Pict.log.info("Loading the pict application [".concat(tmpApplicationHash,"] and associated views."));_Pict.addApplication(tmpApplicationHash,tmpDefaultConfiguration,pPictApplication);_Pict.PictApplication.initializeAsync(function(pError){if(pError){console.log('Error initializing the pict application: '+pError);}_Pict.log.info('Loading the Application and associated views.');});};},{}],161:[function(require,module,exports){// Provide a safe on document ready function (without needing a framework like jquery)
3973
- module.exports=function(fCallback){if(!document){console.log('No document object found; no initialization happening.');return;}// In case the document is already rendered
3965
+ module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],159:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],160:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
3966
+ /* global Pict, _Pict: writeable */ /**
3967
+ * Simple function to load a pict Application
3968
+ *
3969
+ * @param {import('pict-application')} pPictApplication - The pict application to load.
3970
+ * @param {number} pLogNoisiness - The log noisiness level.
3971
+ */module.exports=function(pPictApplication,pLogNoisiness){var tmpLogNoisiness=typeof pLogNoisiness=='undefined'?0:pLogNoisiness;// Set up a basal pict on the window object
3972
+ if(pPictApplication&&'default_configuration'in pPictApplication&&'pict_configuration'in pPictApplication.default_configuration){window._Pict=new Pict(pPictApplication.default_configuration.pict_configuration);}else{window._Pict=new Pict();}window._Pict.LogNoisiness=tmpLogNoisiness;var tmpApplicationHash='DefaultApplication';var tmpDefaultConfiguration={};if('default_configuration'in pPictApplication){tmpDefaultConfiguration=pPictApplication.default_configuration;if('Hash'in pPictApplication.default_configuration){tmpDefaultConfiguration=pPictApplication.default_configuration;tmpApplicationHash=pPictApplication.default_configuration.Hash;}}_Pict.log.info("Loading the pict application [".concat(tmpApplicationHash,"] and associated views."));_Pict.addApplication(tmpApplicationHash,tmpDefaultConfiguration,pPictApplication);_Pict.PictApplication.initializeAsync(function(pError){if(pError){console.log('Error initializing the pict application: '+pError);}_Pict.log.info('Loading the Application and associated views.');});};},{}],161:[function(require,module,exports){/**
3973
+ * Provide a safe on document ready function (without needing a framework like jquery)
3974
+ *
3975
+ * @param {function} fCallback - The function to call when the document is ready
3976
+ */module.exports=function(fCallback){if(!document){console.log('No document object found; no initialization happening.');return;}// In case the document is already rendered
3974
3977
  if(document.readyState!='loading')fCallback();// Modern browsers have event listener capabilities
3975
3978
  else if(document.addEventListener)document.addEventListener('DOMContentLoaded',fCallback);// IE <= 8 and ... other abominations
3976
- else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')callback();});};},{}],162:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
3979
+ else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')fCallback();});};},{}],162:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
3977
3980
  CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase17){function PictCSS(pFable,pOptions,pServiceHash){var _this63;_classCallCheck2(this,PictCSS);_this63=_callSuper(this,PictCSS,[pFable,pOptions,pServiceHash]);// No merging of options necessary
3978
3981
  if(typeof _this63.options.CSSElementAddress==='undefined'){_this63.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}_this63.inlineCSSMap={};return _this63;}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
3979
3982
  // Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
3980
3983
  _inherits(PictCSS,_libFableServiceBase17);return _createClass2(PictCSS,[{key:"addCSS",value:function addCSS(pHash,pContent,pPriority,pProvider){var tmpPriority=typeof pPriority!=='undefined'?pPriority:1000;var tmpProvidor=typeof pProvider==='string'?pProvider:'Unknown';this.inlineCSSMap[pHash]={Hash:pHash,Content:pContent,Provider:tmpProvidor,Priority:tmpPriority};}},{key:"removeCSS",value:function removeCSS(pHash){delete this.inlineCSSMap[pHash];}},{key:"generateCSS",value:function generateCSS(){var _this64=this;var tmpCSS='';var tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
3981
3984
  tmpCSSHashes.sort(function(a,b){return _this64.inlineCSSMap[a].Priority-_this64.inlineCSSMap[b].Priority;});for(var i=0;i<tmpCSSHashes.length;i++){var tmpCSSFragment=this.inlineCSSMap[tmpCSSHashes[i]];var tmpCSSComment=tmpCSSFragment.Hash;if(tmpCSSFragment.Hash!=tmpCSSFragment.Provider){tmpCSSComment="".concat(tmpCSSComment," from ").concat(tmpCSSFragment.Provider);}tmpCSS+="/* ".concat(tmpCSSComment," */\n").concat(tmpCSSFragment.Content,"\n");}return tmpCSS;}// Inject the CSS into the magic DOM element for it
3982
- },{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);}(libFableServiceBase);module.exports=PictCSS;},{"fable":58}],163:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase18){function PictContentAssignment(pFable,pOptions,pServiceHash){var _this65;_classCallCheck2(this,PictContentAssignment);_this65=_callSuper(this,PictContentAssignment,[pFable,pOptions,pServiceHash]);_this65.serviceType='PictContentAssignment';// Check to see if we are running in a browser
3985
+ },{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);}(libFableServiceBase);module.exports=PictCSS;},{"fable":58}],163:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;/**
3986
+ * Class for moving content around in the DOM.
3987
+ */var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase18){/**
3988
+ * @param {object} pFable - The Fable library instance.
3989
+ * @param {object} pOptions - The options for the service.
3990
+ * @param {object} pServiceHash - The hash of services.
3991
+ */function PictContentAssignment(pFable,pOptions,pServiceHash){var _this65;_classCallCheck2(this,PictContentAssignment);_this65=_callSuper(this,PictContentAssignment,[pFable,pOptions,pServiceHash]);_this65.serviceType='PictContentAssignment';// Check to see if we are running in a browser
3983
3992
  _this65.inBrowser=false;_this65.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this65.inBrowser=true;// Now check that the browser has a document object
3984
3993
  if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this65.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
3985
- _this65.hasJquery=false;_this65.jQuery=false;if(_this65.inBrowser&&typeof window.jQuery!=='undefined'){_this65.hasJquery=true;}// API Consumers can craft their own assign function
3986
- _this65.customAssignFunction=false;// API Consumers can also craft their own prepend function
3987
- _this65.customPrependFunction=false;// API Consumers can also craft their own append function
3988
- _this65.customAppendFunction=false;// API Consumers can also craft their own read function
3989
- _this65.customReadFunction=false;// API Consumers can even craft their own get element function.
3990
- _this65.customGetElementFunction=false;// API Consumers can also craft their own attribute read function
3994
+ _this65.hasJquery=false;_this65.jQuery=false;if(_this65.inBrowser&&typeof window.jQuery!=='undefined'){_this65.hasJquery=true;}/**
3995
+ * Set this to override the default mechanism for setting the content of a DOM element.
3996
+ *
3997
+ * @type {Function}
3998
+ * @param {string} pAddress - The address of the element. (a CSS selector)
3999
+ * @param {string} pContent - The content to set.
4000
+ */_this65.customAssignFunction=false;/**
4001
+ * Set this to override the default mechanism for prepend content to a DOM element.
4002
+ *
4003
+ * @type {Function}
4004
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4005
+ * @param {string} pContent - The content to prepend.
4006
+ */_this65.customPrependFunction=false;/**
4007
+ * Set this to override the default mechanism for appending content to a DOM element.
4008
+ *
4009
+ * @type {Function}
4010
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4011
+ * @param {string} pContent - The content to append.
4012
+ */_this65.customAppendFunction=false;/**
4013
+ * Set this to override the default mechanism for reading content from the DOM.
4014
+ *
4015
+ * @type {Function}
4016
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4017
+ * @return {string} - The content of the element.
4018
+ */_this65.customReadFunction=false;/**
4019
+ * Set this to override the default mechanism for getting elements.
4020
+ *
4021
+ * @type {Function}
4022
+ * @param {string} pAddress - The address of the element.
4023
+ * @return {Array<any>} - The matched elements.
4024
+ */_this65.customGetElementFunction=false;// API Consumers can also craft their own attribute read function
3991
4025
  _this65.customReadAttributeFunction=false;// API Consumers can also craft their own attribute set function
3992
4026
  _this65.customSetAttributeFunction=false;// API Consumers can also craft their own attribute remove function
3993
4027
  _this65.customRemoveAttributeFunction=false;// API Consumers can also craft their own class read function
3994
4028
  _this65.customReadClassFunction=false;// API Consumers can also craft their own class set function
3995
4029
  _this65.customSetClassFunction=false;// API Consumers can also craft their own class remove function
3996
- _this65.customRemoveClassFunction=false;return _this65;}_inherits(PictContentAssignment,_libFableServiceBase18);return _createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return[];}else{// TODO: This isn't the most efficient method, but it is the most compatible.
4030
+ _this65.customRemoveClassFunction=false;return _this65;}/**
4031
+ * Get an element from the DOM.
4032
+ *
4033
+ * @param {string} pAddress - The address of the element.
4034
+ * @return {Array<any>} - The matched elements.
4035
+ */_inherits(PictContentAssignment,_libFableServiceBase18);return _createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return[];}else{// TODO: This isn't the most efficient method, but it is the most compatible.
3997
4036
  var tmpElementSet=[];for(var i=0;i<tmpElements.length;i++){tmpElementSet.push(tmpElements[i]);}return tmpElementSet;}}else if(this.inBrowser&&this.hasDocument){return window.document.querySelectorAll(pAddress);}else{// Just log it out for now
3998
4037
  this.log.trace("PICT Content GET ELEMENT for [".concat(pAddress,"] will return empty because none of the browser methods are available"));return[];}}},{key:"assignContent",value:function assignContent(pAddress,pContent){if(this.customAssignFunction){return this.customAssignFunction(pAddress,pContent);}else if(this.hasJquery){// Get the element(s)
3999
4038
  var tmpTargetElementSet=window.jQuery(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){switch(tmpTargetElementSet[i].tagName){case'INPUT':case'SELECT':case'TEXTAREA':tmpTargetElementSet[i].value=pContent;break;case'SCRIPT':tmpTargetElementSet[i].text=pContent;break;default:tmpTargetElementSet[i].innerHTML=pContent;}}}else if(this.inBrowser&&this.hasDocument){// Get the element(s)
4000
4039
  var _tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var _i46=0;_i46<_tmpTargetElementSet.length;_i46++){switch(_tmpTargetElementSet[_i46].tagName){case'INPUT':case'SELECT':case'TEXTAREA':_tmpTargetElementSet[_i46].value=pContent;break;case'SCRIPT':_tmpTargetElementSet[_i46].text=pContent;break;default:_tmpTargetElementSet[_i46].innerHTML=pContent;}}}else{// Just log it out for now
4001
- this.log.trace("PICT Content ASSIGN to [".concat(pAddress,"]:"),pContent);}}},{key:"appendContent",value:function appendContent(pAddress,pContent){if(this.customAppendFunction){return this.customAppendFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.append(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("beforeend",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
4002
- this.log.trace("PICT Content APPEND to [".concat(pAddress,"]:"),pContent);}}},{key:"prependContent",value:function prependContent(pAddress,pContent){if(this.customAppendFunction){return this.customPrependFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.prepend(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("afterbegin",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
4003
- this.log.trace("PICT Content PREPEND in [".concat(pAddress,"]:"),pContent);}}},{key:"readContent",value:function readContent(pAddress){if(this.customReadFunction){return this.customReadFunction(pAddress);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);switch(tmpTargetElement.prop('tagName')){case'INPUT':case'SELECT':case'TEXTAREA':return tmpTargetElement.val();case'SCRIPT':return tmpTargetElement.text();default:return tmpTargetElement.html();}}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);if(tmpTargetElementSet.length<1){return null;}else if(tmpTargetElementSet.length==1){switch(tmpTargetElementSet[0].tagName){case'INPUT':case'SELECT':case'TEXTAREA':return tmpTargetElementSet[0].value;case'SCRIPT':return tmpTargetElementSet[0].text;default:return tmpTargetElementSet[0].innerHTML;}}}else{// Just log it out for now -- nothing browser in our mix.
4004
- this.log.trace("PICT Content READ from [".concat(pAddress,"]..."));return'';}}},{key:"addClass",value:function addClass(pAddress,pClass){if(this.customSetClassFunction){return this.customSetClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
4005
- var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.addClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.add(pClass);}}else{this.log.trace("PICT Content ADDCLASS to [".concat(pAddress,"]:"),pClass);}}},{key:"removeClass",value:function removeClass(pAddress,pClass){if(this.customRemoveClassFunction){return this.customRemoveClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
4006
- var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.remove(pClass);}}else{this.log.trace("PICT Content REMOVECLASS from [".concat(pAddress,"]:"),pClass);}}},{key:"readAttribute",value:function readAttribute(pAddress,pAttribute){if(this.customReadAttributeFunction){return this.customReadAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].getAttribute(pAttribute);}}else{this.log.trace("PICT Content READATTRIBUTE from [".concat(pAddress,"]:"),pAttribute);}}},{key:"setAttribute",value:function setAttribute(pAddress,pAttribute,pValue){if(this.customSetAttributeFunction){return this.customSetAttributeFunction(pAddress,pAttribute,pValue);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute,pValue);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].setAttribute(pAttribute,pValue);}}else{this.log.trace("PICT Content SETATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]:"),pValue);}}},{key:"removeAttribute",value:function removeAttribute(pAddress,pAttribute){if(this.customRemoveAttributeFunction){return this.customRemoveAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeAttr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].removeAttribute(pAttribute);}}else{this.log.trace("PICT Content REMOVEATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]"));}}},{key:"hasClass",value:function hasClass(pAddress,pClass){if(this.customReadClassFunction){return this.customReadClassFunction(pAddress,pClass);}if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.hasClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){return tmpTargetElementSet[i].classList.contains(pClass);}}else{this.log.trace("PICT Content HASCLASS for [".concat(pAddress,"] CLASS [").concat(pClass,"]:"));}}}]);}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":58}],164:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase19){function PictDataProvider(pFable,pOptions,pServiceHash){var _this66;_classCallCheck2(this,PictDataProvider);_this66=_callSuper(this,PictDataProvider,[pFable,pOptions,pServiceHash]);_this66.serviceType='PictDataProvider';return _this66;}_inherits(PictDataProvider,_libFableServiceBase19);return _createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":58}],165:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase20){function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this67;_classCallCheck2(this,PictMeadowEntityProvider);_this67=_callSuper(this,PictMeadowEntityProvider,[pFable,pOptions,pServiceHash]);_this67.serviceType='PictMeadowProvider';if(_this67.fable.settings.PictDefaultURLPrefix){_this67.options.urlPrefix=_this67.fable.settings.PictDefaultURLPrefix;}else if(!_this67.options.urlPrefix){_this67.options.urlPrefix='/1.0/';}if(_this67.fable.settings.PictDefaultDownloadBatchSize){_this67.options.downloadBatchSize=_this67.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this67.options.downloadBatchSize){_this67.options.downloadBatchSize=100;}_this67.restClient=_this67.fable.instantiateServiceProviderWithoutRegistration('RestClient');_this67.cache={};_this67.prepareRequestOptions=function(pOptions){return pOptions;};return _this67;}_inherits(PictMeadowEntityProvider,_libFableServiceBase20);return _createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
4007
- if(!this.cache.hasOwnProperty(pEntity)){this.cache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
4040
+ this.log.trace("PICT Content ASSIGN to [".concat(pAddress,"]:"),pContent);}}/**
4041
+ * Append content to an element.
4042
+ *
4043
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4044
+ * @param {string} pContent - The content to append.
4045
+ */},{key:"appendContent",value:function appendContent(pAddress,pContent){if(this.customAppendFunction){return this.customAppendFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.append(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("beforeend",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
4046
+ this.log.trace("PICT Content APPEND to [".concat(pAddress,"]:"),pContent);}}/**
4047
+ * Prepend content to an element.
4048
+ *
4049
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4050
+ * @param {string} pContent - The content to prepend.
4051
+ */},{key:"prependContent",value:function prependContent(pAddress,pContent){if(this.customAppendFunction){return this.customPrependFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.prepend(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("afterbegin",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
4052
+ this.log.trace("PICT Content PREPEND in [".concat(pAddress,"]:"),pContent);}}/**
4053
+ * Read content from an element.
4054
+ *
4055
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4056
+ *
4057
+ * @return {string} - The content of the element.
4058
+ */},{key:"readContent",value:function readContent(pAddress){if(this.customReadFunction){return this.customReadFunction(pAddress);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);switch(tmpTargetElement.prop('tagName')){case'INPUT':case'SELECT':case'TEXTAREA':return tmpTargetElement.val();case'SCRIPT':return tmpTargetElement.text();default:return tmpTargetElement.html();}}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);if(tmpTargetElementSet.length<1){return null;}else if(tmpTargetElementSet.length==1){switch(tmpTargetElementSet[0].tagName){case'INPUT':case'SELECT':case'TEXTAREA':return tmpTargetElementSet[0].value;case'SCRIPT':return tmpTargetElementSet[0].text;default:return tmpTargetElementSet[0].innerHTML;}}}else{// Just log it out for now -- nothing browser in our mix.
4059
+ this.log.trace("PICT Content READ from [".concat(pAddress,"]..."));return'';}}/**
4060
+ * Add a class to an element.
4061
+ *
4062
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4063
+ * @param {string} pClass - The class to add.
4064
+ */},{key:"addClass",value:function addClass(pAddress,pClass){if(this.customSetClassFunction){return this.customSetClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
4065
+ var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.addClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.add(pClass);}}else{this.log.trace("PICT Content ADDCLASS to [".concat(pAddress,"]:"),pClass);}}/**
4066
+ * Remove a class from an element.
4067
+ *
4068
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4069
+ * @param {string} pClass - The class to remove.
4070
+ */},{key:"removeClass",value:function removeClass(pAddress,pClass){if(this.customRemoveClassFunction){return this.customRemoveClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
4071
+ var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.remove(pClass);}}else{this.log.trace("PICT Content REMOVECLASS from [".concat(pAddress,"]:"),pClass);}}/**
4072
+ * Read an attribute from an element.
4073
+ *
4074
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4075
+ * @param {string} pAttribute - The attribute name to read.
4076
+ */},{key:"readAttribute",value:function readAttribute(pAddress,pAttribute){if(this.customReadAttributeFunction){return this.customReadAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.attr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].getAttribute(pAttribute);}return tmpTargetElementSet;}else{this.log.trace("PICT Content READATTRIBUTE from [".concat(pAddress,"]:"),pAttribute);}}/**
4077
+ * Set an attribute on an element.
4078
+ *
4079
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4080
+ * @param {string} pAttribute - The attribute name to set.
4081
+ * @param {string} pValue - The value to set.
4082
+ */},{key:"setAttribute",value:function setAttribute(pAddress,pAttribute,pValue){if(this.customSetAttributeFunction){return this.customSetAttributeFunction(pAddress,pAttribute,pValue);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute,pValue);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].setAttribute(pAttribute,pValue);}}else{this.log.trace("PICT Content SETATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]:"),pValue);}}/**
4083
+ * Remove an attribute from an element.
4084
+ *
4085
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4086
+ * @param {string} pAttribute - The attribute name to remove.
4087
+ */},{key:"removeAttribute",value:function removeAttribute(pAddress,pAttribute){if(this.customRemoveAttributeFunction){return this.customRemoveAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeAttr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].removeAttribute(pAttribute);}}else{this.log.trace("PICT Content REMOVEATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]"));}}/**
4088
+ * Check if an element has a class.
4089
+ *
4090
+ * @param {string} pAddress - The address of the element. (a CSS selector)
4091
+ * @param {string} pClass - The class to check for.
4092
+ *
4093
+ * @return {boolean} - Whether the element has the class. If multiple elements are matched, returns true if any have the class.
4094
+ */},{key:"hasClass",value:function hasClass(pAddress,pClass){if(this.customReadClassFunction){return this.customReadClassFunction(pAddress,pClass);}if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.hasClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){if(tmpTargetElementSet[i].classList.contains(pClass)){return true;}}return false;}else{this.log.trace("PICT Content HASCLASS for [".concat(pAddress,"] CLASS [").concat(pClass,"]:"));}}}]);}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":58}],164:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase19){function PictDataProvider(pFable,pOptions,pServiceHash){var _this66;_classCallCheck2(this,PictDataProvider);_this66=_callSuper(this,PictDataProvider,[pFable,pOptions,pServiceHash]);_this66.serviceType='PictDataProvider';return _this66;}_inherits(PictDataProvider,_libFableServiceBase19);return _createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":58}],165:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase20){function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this67;_classCallCheck2(this,PictMeadowEntityProvider);_this67=_callSuper(this,PictMeadowEntityProvider,[pFable,pOptions,pServiceHash]);_this67.serviceType='PictMeadowProvider';if(_this67.fable.settings.PictDefaultURLPrefix){_this67.options.urlPrefix=_this67.fable.settings.PictDefaultURLPrefix;}else if(!_this67.options.urlPrefix){_this67.options.urlPrefix='/1.0/';}if(_this67.fable.settings.PictDefaultDownloadBatchSize){_this67.options.downloadBatchSize=_this67.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this67.options.downloadBatchSize){_this67.options.downloadBatchSize=100;}_this67.restClient=_this67.fable.instantiateServiceProviderWithoutRegistration('RestClient');_this67.cache={};_this67.prepareRequestOptions=function(pOptions){return pOptions;};return _this67;}_inherits(PictMeadowEntityProvider,_libFableServiceBase20);return _createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
4095
+ if(!(pEntity in this.cache)){this.cache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
4008
4096
  // For now cache for 30 seconds.
4009
4097
  this.cache[pEntity].maxAge=30000;this.cache[pEntity].maxLength=10000;this.fable.Bundle[pEntity]=this.cache[pEntity].RecordMap;}}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
4010
4098
  this.cache[pEntity].prune(function(){var _this68=this;var tmpPossibleRecord=this.cache[pEntity].read(pIDRecord);if(tmpPossibleRecord){return fCallback(null,tmpPossibleRecord);}var tmpOptions={url:"".concat(this.options.urlPrefix).concat(pEntity,"/").concat(pIDRecord)};tmpOptions=this.prepareRequestOptions(tmpOptions);return this.restClient.getJSON(tmpOptions,function(pError,pResponse,pBody){if(pBody){_this68.cache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});}.bind(this));}},{key:"getEntitySetPage",value:function getEntitySetPage(pEntity,pMeadowFilterExpression,pRecordStartCursor,pRecordCount,fCallback){var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(pRecordStartCursor,"/").concat(pRecordCount);return this.restClient.getJSON(tmpURL,function(pDownloadError,pDownloadResponse,pDownloadBody){return fCallback(pDownloadError,pDownloadBody);}.bind(this));}},{key:"getEntitySetRecordCount",value:function getEntitySetRecordCount(pEntity,pMeadowFilterExpression,fCallback){var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s/Count/FilteredTo/").concat(pMeadowFilterExpression);return this.restClient.getJSON(tmpURL,function(pError,pResponse,pBody){if(pError){this.log.error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}return fCallback(pError,tmpRecordCount);}.bind(this));}},{key:"getEntitySet",value:function getEntitySet(pEntity,pMeadowFilterExpression,fCallback){// TODO: Should we test for too many record IDs here by string length in pMeadowFilterExpression?
@@ -4014,156 +4102,295 @@ this.initializeCache(pEntity);// Discard anything from the cache that has expire
4014
4102
  this.cache[pEntity].prune(function(){var _this69=this;return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this69.log.error("Entity count did not return a number for [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"]... something is fatally wrong from the server accessed in getEntitySet call."));return fCallback(new Error('Entity count did not return a number in getEntitySet.'));}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this69.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
4015
4103
  tmpDownloadURIFragments.push("".concat(_this69.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(i*tmpDownloadBatchSize,"/").concat(tmpDownloadBatchSize));}var tmpEntitySet=[];// Now run these in series (it's possible to parallelize the requests but they would not be in server order)
4016
4104
  _this69.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){_this69.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
4017
- return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":58}],166:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase21){function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this70;_classCallCheck2(this,PictTemplateProvider);_this70=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this70.serviceType='PictTemplateProvider';_this70.templates={};_this70.templateSources={};// Default templates are stored by prefix.
4105
+ return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":58}],166:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase21){/**
4106
+ * @param {Object} pFable - The Fable Framework instance
4107
+ * @param {Object} pOptions - The options for the service
4108
+ * @param {String} pServiceHash - The hash of the service
4109
+ */function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this70;_classCallCheck2(this,PictTemplateProvider);_this70=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this70.serviceType='PictTemplateProvider';_this70.templates={};_this70.templateSources={};// Default templates are stored by prefix.
4018
4110
  // The longest prefix match is used.
4019
4111
  // Case sensitive.
4020
- _this70.defaultTemplates=[];// This function can be overloaded to load templates from a database, in a page or other source.
4021
- _this70.loadTemplateFunction=function(pTemplateHash){return false;};return _this70;}_inherits(PictTemplateProvider,_libFableServiceBase21);return _createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}},{key:"addDefaultTemplate",value:function addDefaultTemplate(pPrefix,pPostfix,pTemplate,pSource){var tmpSource=typeof pSource=='string'?pSource:"Direct addDefaultTemplate('".concat(pPrefix,"','").concat(pPostfix,"',..) function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");var tmpDefaultTemplate={prefix:pPrefix,postfix:pPostfix,template:pTemplate,source:tmpSource};if(typeof pTemplate!='string'){this.log.error('PictTemplateProvider.addDefaultTemplate: pTemplate is not a string.');}this.defaultTemplates.push(tmpDefaultTemplate);}},{key:"checkDefaultTemplateHash",value:function checkDefaultTemplateHash(pTemplateHash){/*
4022
- * Default templates are managed by postfix and prefix. The use case is things like titles, headers, list
4023
- * wrappers, rows, etc.
4024
- *
4025
- * So we might have a default template for a list wrapper and it should expect "-ListWrap" as the postfix.
4026
- * And we might have a default template for a list row and it should expect "-ListRow" as the postfix.
4027
- * The list might have a "-ListTitle", or we might have shared titles and it would just be "-Title".
4028
- *
4029
- * The idea is to allow fallbacks on defaults.
4030
- */for(var i=0;i<this.defaultTemplates.length;i++){if(pTemplateHash.indexOf(this.defaultTemplates[i].postfix)==pTemplateHash.length-this.defaultTemplates[i].postfix.length&&pTemplateHash.indexOf(this.defaultTemplates[i].prefix)==0){this.templates[pTemplateHash]=this.defaultTemplates[i].template;this.templateSources[pTemplateHash]="Auto created in checkDefaultTemplateHash('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(this.defaultTemplates[i].prefix,"]...[").concat(this.defaultTemplates[i].postfix,"]");return this.templates[pTemplateHash];}}return false;}},{key:"getTemplate",value:function getTemplate(pTemplateHash){// TODO: Optimize this.
4112
+ _this70.defaultTemplates=[];/**
4113
+ * @property {Function} loadTemplateFunction - The function to load a template
4114
+ */_this70.loadTemplateFunction=function(){return false;};return _this70;}/**
4115
+ * Add a template to the provider.
4116
+ *
4117
+ * @param {String} pTemplateHash - The hash of the template
4118
+ * @param {String} pTemplate - The template
4119
+ * @param {String} [pTemplateSource] - (optional) The source of the template
4120
+ */_inherits(PictTemplateProvider,_libFableServiceBase21);return _createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}/**
4121
+ * Add a default template to the provider.
4122
+ *
4123
+ * @param {String} pPrefix - The prefix of the template identifier.
4124
+ * @param {String} pPostfix - The postfix of the template identifier.
4125
+ * @param {String} pTemplate - The template
4126
+ * @param {String} [pSource] - (optional) The source of the template
4127
+ */},{key:"addDefaultTemplate",value:function addDefaultTemplate(pPrefix,pPostfix,pTemplate,pSource){var tmpSource=typeof pSource=='string'?pSource:"Direct addDefaultTemplate('".concat(pPrefix,"','").concat(pPostfix,"',..) function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");var tmpDefaultTemplate={prefix:pPrefix,postfix:pPostfix,template:pTemplate,source:tmpSource};if(typeof pTemplate!='string'){this.log.error('PictTemplateProvider.addDefaultTemplate: pTemplate is not a string.');}this.defaultTemplates.push(tmpDefaultTemplate);}/**
4128
+ * Attempt to populate a template to a default template if it matches a given hash.
4129
+ *
4130
+ * Default templates are managed by postfix and prefix. The use case is things like titles, headers, list
4131
+ * wrappers, rows, etc.
4132
+ *
4133
+ * So we might have a default template for a list wrapper and it should expect "-ListWrap" as the postfix.
4134
+ * And we might have a default template for a list row and it should expect "-ListRow" as the postfix.
4135
+ * The list might have a "-ListTitle", or we might have shared titles and it would just be "-Title".
4136
+ *
4137
+ * The idea is to allow fallbacks on defaults.
4138
+ *
4139
+ * @param {String} pTemplateHash - The hash of the template
4140
+ * @return {string} - The template, or false if not found
4141
+ */},{key:"checkDefaultTemplateHash",value:function checkDefaultTemplateHash(pTemplateHash){for(var i=0;i<this.defaultTemplates.length;i++){if(pTemplateHash.indexOf(this.defaultTemplates[i].postfix)==pTemplateHash.length-this.defaultTemplates[i].postfix.length&&pTemplateHash.indexOf(this.defaultTemplates[i].prefix)==0){this.templates[pTemplateHash]=this.defaultTemplates[i].template;this.templateSources[pTemplateHash]="Auto created in checkDefaultTemplateHash('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(this.defaultTemplates[i].prefix,"]...[").concat(this.defaultTemplates[i].postfix,"]");return this.templates[pTemplateHash];}}return false;}/**
4142
+ * Get a template by hash.
4143
+ *
4144
+ * @param {String} pTemplateHash - The hash of the template
4145
+ * @return {String} - The template, or false if not found
4146
+ */},{key:"getTemplate",value:function getTemplate(pTemplateHash){// TODO: Optimize this.
4031
4147
  // If the template doesn't exist, try to load it with the loading function
4032
- if(!this.templates.hasOwnProperty(pTemplateHash)){this.loadTemplate(pTemplateHash);}// If the loading function fails, try to load it from the default templates
4033
- if(!this.templates.hasOwnProperty(pTemplateHash)){this.checkDefaultTemplateHash(pTemplateHash);}if(this.templates.hasOwnProperty(pTemplateHash)){return this.templates[pTemplateHash];}else{return false;}}},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":58}],167:[function(require,module,exports){/**
4148
+ if(!(pTemplateHash in this.templates)){this.loadTemplate(pTemplateHash);}// If the loading function fails, try to load it from the default templates
4149
+ if(!(pTemplateHash in this.templates)){this.checkDefaultTemplateHash(pTemplateHash);}if(pTemplateHash in this.templates){return this.templates[pTemplateHash];}else{return false;}}/**
4150
+ * Load a template by hash.
4151
+ *
4152
+ * @param {String} pTemplateHash - The hash of the template
4153
+ */},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":58}],167:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase22){/**
4154
+ * @param {Object} pFable - The Fable Framework instance
4155
+ * @param {Object} pOptions - The options for the service
4156
+ * @param {String} pServiceHash - The hash of the service
4157
+ */function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this71;_classCallCheck2(this,PictTemplateProvider);_this71=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this71.pict=_this71.fable;_this71.serviceType='PictTemplate';return _this71;}/**
4158
+ * Render a template expression, returning a string with the resulting content.
4159
+ *
4160
+ * @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
4161
+ * @param {object} pRecord - The json object to be used as the Record for the template render
4162
+ * @param {array} pContextArray - An array of context objects accessible from the template; safe to leave empty
4163
+ */_inherits(PictTemplateProvider,_libFableServiceBase22);return _createClass2(PictTemplateProvider,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){return'';}/**
4164
+ *
4165
+ * @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
4166
+ * @param {object} pRecord - The json object to be used as the Record for the template render
4167
+ * @param {array} pContextArray - An array of context objects accessible from the template; safe to leave empty
4168
+ * @param {*} fCallback
4169
+ * @returns
4170
+ */},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){return fCallback(null,this.render(pTemplateHash,pRecord,pContextArray));}/**
4171
+ * Provide a match criteria for a template expression. Anything between these two values is returned as the template hash.
4172
+ *
4173
+ * @param {string} pMatchStart - The string pattern to start a match in the template trie
4174
+ * @param {string} pMatchEnd - The string pattern to stop a match in the trie acyclic graph
4175
+ */},{key:"addPattern",value:function addPattern(pMatchStart,pMatchEnd){return this.pict.MetaTemplate.addPatternBoth(pMatchStart,pMatchEnd,this.render,this.renderAsync,this);}/**
4176
+ * Read a value from a nested object using a dot notation string.
4177
+ *
4178
+ * @param {string} pAddress - The address to resolve
4179
+ * @param {object} pRecord - The record to resolve
4180
+ * @param {Array<any>} pContextArray - The context array to resolve (optional)
4181
+ *
4182
+ * @returns {any} The value at the given address, or undefined
4183
+ */},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this.pict];return this.pict.manifest.getValueByHash({Pict:this.pict,AppData:this.pict.AppData,Bundle:this.pict.Bundle,Context:tmpContextArray,Record:pRecord},pAddress);}}]);}(libFableServiceBase);module.exports=PictTemplateProvider;module.exports.template_hash='Default';},{"fable":58}],168:[function(require,module,exports){/**
4034
4184
  * @author <steven@velozo.com>
4035
- */var libFable=require('fable');var Pict=/*#__PURE__*/function(_libFable){function Pict(pSettings){var _this71;_classCallCheck2(this,Pict);_this71=_callSuper(this,Pict,[pSettings]);_this71.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");// The templateProvider provides a basic key->template mapping with default fallback capabilities
4036
- _this71.addAndInstantiateServiceType('TemplateProvider',require('./Pict-Template-Provider.js'));_this71.addAndInstantiateServiceType('EntityProvider',require('./Pict-Meadow-EntityProvider.js'));_this71.addAndInstantiateServiceType('DataProvider',require('./Pict-DataProvider.js'));_this71.addAndInstantiateServiceType('ContentAssignment',require('./Pict-Content-Assignment.js'));_this71.addAndInstantiateServiceType('CSSMap',require('./Pict-CSS.js'));_this71.instantiateServiceProvider('MetaTemplate');_this71.instantiateServiceProvider('DataGeneration');_this71.manifest=_this71.instantiateServiceProvider('Manifest');_this71.AppData={};_this71.Bundle={};// Log noisness goes from 0 - 5, where 5 is show me everything.
4037
- _this71.LogNoisiness=0;// Although we have log noisiness, sometimes we need control flow without all the other noise for hard to diagnose interpreters.
4038
- _this71.LogControlFlow=false;// And an easy way to be introspective about data at various locations
4039
- _this71.LogControlFlowWatchAddressList=[];// Load manifest sets
4040
- if(_this71.settings.Manifests){_this71.loadManifestSet(_this71.settings.Manifests);}_this71._DefaultPictTemplatesInitialized=false;_this71.initializePictTemplateEngine();_this71.addServiceType('PictView',require('pict-view'));_this71.addServiceType('PictProvider',require('pict-provider'));_this71.addServiceType('PictApplication',require('pict-application'));// Expose the named views directly, through a convenience accessor
4041
- _this71.views=_this71.servicesMap.PictView;_this71.providers=_this71.servicesMap.PictProvider;return _this71;}// Load manifests in as Hashed services
4042
- _inherits(Pict,_libFable);return _createClass2(Pict,[{key:"loadManifestSet",value:function loadManifestSet(pManifestSet){if(_typeof(pManifestSet)!='object'){this.log.warn("PICT [".concat(this.UUID,"] could not load Manifest Set; pManifestSet was not an object."));return false;}var tmpManifestKeys=Object.keys(pManifestSet);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
4043
- var tmpManifestKey=tmpManifestKeys[i];this.instantiateServiceProvider('Manifest',pManifestSet[tmpManifestKey],tmpManifestKey);}}}// Just passing an options will construct one for us.
4044
- // Passing a hash will set the hash.
4045
- // Passing a prototype will use that!
4046
- },{key:"addView",value:function addView(pViewHash,pOptions,pViewPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpViewHash=typeof pViewHash=='string'?pViewHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addView [".concat(tmpViewHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addView [".concat(tmpViewHash,"]"));}}if(typeof pViewPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
4047
- if(pViewPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},JSON.parse(JSON.stringify(pViewPrototype.default_configuration)),tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictView',tmpOptions,tmpViewHash,pViewPrototype);}else{return this.instantiateServiceProvider('PictView',tmpOptions,tmpViewHash);}}// Just passing an options will construct one for us.
4185
+ */var libFable=require('fable');var PictTemplateProvider=require('./Pict-Template-Provider.js');var PictContentAssignment=require('./Pict-Content-Assignment.js');var PictDataProvider=require('./Pict-DataProvider.js');var PictCSS=require('./Pict-CSS.js');var PictMeadowEntityProvider=require('./Pict-Meadow-EntityProvider.js');/**
4186
+ * Pict management object.
4187
+ */var Pict=/*#__PURE__*/function(_libFable){/**
4188
+ * @param {Object} pSettings - The settings for the Pict instance.
4189
+ */function Pict(pSettings){var _this72;_classCallCheck2(this,Pict);_this72=_callSuper(this,Pict,[pSettings]);_this72.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");/**
4190
+ * The templateProvider provides a basic key->template mapping with default fallback capabilities
4191
+ *
4192
+ * @type {PictTemplateProvider}
4193
+ */_this72.TemplateProvider=null;_this72.addAndInstantiateServiceType('TemplateProvider',PictTemplateProvider);/**
4194
+ * The meadow entity provider.
4195
+ *
4196
+ * @type {PictMeadowEntityProvider}
4197
+ */_this72.EntityProvider=null;_this72.addAndInstantiateServiceType('EntityProvider',PictMeadowEntityProvider);/**
4198
+ * The data provider.
4199
+ *
4200
+ * @type {PictDataProvider}
4201
+ */_this72.DataProvider=null;_this72.addAndInstantiateServiceType('DataProvider',PictDataProvider);/**
4202
+ * The content assignment module.
4203
+ *
4204
+ * @type {PictContentAssignment}
4205
+ */_this72.ContentAssignment=null;_this72.addAndInstantiateServiceType('ContentAssignment',PictContentAssignment);/**
4206
+ * The CSS module.
4207
+ *
4208
+ * @type {PictCSS}
4209
+ * @public
4210
+ */_this72.CSSMap=null;_this72.addAndInstantiateServiceType('CSSMap',PictCSS);_this72.addServiceType('PictTemplate',require('./Pict-Template.js'));_this72.instantiateServiceProvider('MetaTemplate');_this72.instantiateServiceProvider('DataGeneration');_this72.manifest=_this72.instantiateServiceProvider('Manifest');_this72.AppData={};if('DefaultAppData'in _this72.fable.settings){_this72.AppData=_this72.fable.settings.DefaultAppData;}_this72.Bundle={};// Log noisness goes from 0 - 5, where 5 is show me everything.
4211
+ _this72.LogNoisiness=0;// Although we have log noisiness, sometimes we need control flow without all the other noise for hard to diagnose interpreters.
4212
+ _this72.LogControlFlow=false;// And an easy way to be introspective about data at various locations
4213
+ _this72.LogControlFlowWatchAddressList=[];// Load manifest sets
4214
+ if(_this72.settings.Manifests){_this72.loadManifestSet(_this72.settings.Manifests);}_this72._DefaultPictTemplatesInitialized=false;_this72.initializePictTemplateEngine();_this72.addServiceType('PictView',require('pict-view'));_this72.addServiceType('PictProvider',require('pict-provider'));_this72.addServiceType('PictApplication',require('pict-application'));// Expose the named views directly, through a convenience accessor
4215
+ _this72.providers=_this72.servicesMap.PictProvider;_this72.views=_this72.servicesMap.PictView;return _this72;}/**
4216
+ * Load manifests in as Hashed services
4217
+ *
4218
+ * @param {Object} pManifestSet - The manifest set to load.
4219
+ */_inherits(Pict,_libFable);return _createClass2(Pict,[{key:"loadManifestSet",value:function loadManifestSet(pManifestSet){if(_typeof(pManifestSet)!='object'){this.log.warn("PICT [".concat(this.UUID,"] could not load Manifest Set; pManifestSet was not an object."));return false;}var tmpManifestKeys=Object.keys(pManifestSet);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
4220
+ var tmpManifestKey=tmpManifestKeys[i];this.instantiateServiceProvider('Manifest',pManifestSet[tmpManifestKey],tmpManifestKey);}}}/**
4221
+ * Add a template expression to the template engine from the PictTemplate service.
4222
+ *
4223
+ * @param {Object} pTemplatePrototype - The prototype class for the template expression
4224
+ */},{key:"addTemplate",value:function addTemplate(pTemplatePrototype){if(typeof pTemplatePrototype!='function'){this.log.warn("PICT [".concat(this.UUID,"] could not add Template; pTemplatePrototype was not a class it was ").concat(_typeof(pTemplatePrototype),"."));return false;}var tmpTemplateHash=pTemplatePrototype.template_hash;if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addTemplate [".concat(tmpTemplateHash,"]"));}return this.instantiateServiceProviderFromPrototype('PictTemplate',{},tmpTemplateHash,pTemplatePrototype);}/**
4225
+ * Just passing an options will construct one for us.
4226
+ * Passing a hash will set the hash.
4227
+ * Passing a prototype will use that!
4228
+ *
4229
+ * @param {String} pViewHash - The hash of the view.
4230
+ * @param {Object} pOptions - The options for the view.
4231
+ * @param {Object} pViewPrototype - The prototype for the view.
4232
+ */},{key:"addView",value:function addView(pViewHash,pOptions,pViewPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpViewHash=typeof pViewHash=='string'?pViewHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addView [".concat(tmpViewHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addView [".concat(tmpViewHash,"]"));}}if(typeof pViewPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
4233
+ if('default_configuration'in pViewPrototype){tmpOptions=this.fable.Utility.extend({},JSON.parse(JSON.stringify(pViewPrototype.default_configuration)),tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictView',tmpOptions,tmpViewHash,pViewPrototype);}else{return this.instantiateServiceProvider('PictView',tmpOptions,tmpViewHash);}}// Just passing an options will construct one for us.
4048
4234
  // Passing a hash will set the hash.
4049
4235
  // Passing a prototype will use that!
4050
4236
  },{key:"addProvider",value:function addProvider(pProviderHash,pOptions,pProviderPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpProviderHash=typeof pProviderHash=='string'?pProviderHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addProvider [".concat(tmpProviderHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addProvider [".concat(tmpProviderHash,"]"));}}if(typeof pProviderPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
4051
- if(pProviderPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},pProviderPrototype.default_configuration,tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictProvider',tmpOptions,tmpProviderHash,pProviderPrototype);}else{return this.instantiateServiceProvider('PictProvider',tmpOptions,tmpProviderHash);}}// Just passing an options will construct one for us.
4052
- // Passing a hash will set the hash.
4053
- // Passing a prototype will use that!
4054
- },{key:"addApplication",value:function addApplication(pApplicationHash,pOptions,pApplicationPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpApplicationHash=typeof pApplicationHash=='string'?pApplicationHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addApplication [".concat(tmpApplicationHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addApplication [".concat(tmpApplicationHash,"]"));}}if(typeof pApplicationPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
4055
- if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},pApplicationPrototype.default_configuration,tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictApplication',tmpOptions,tmpApplicationHash,pApplicationPrototype);}else{return this.instantiateServiceProvider('PictApplication',tmpOptions,tmpApplicationHash);}}},{key:"initializePictTemplateEngine",value:function initializePictTemplateEngine(){var _this72=this;/*
4056
- *
4057
- * To stave off madness, these are inefficient for now. The wkhtmltopdf renderer leaves much to be desired
4058
- * in the way of feedback with regards to javascript compatibility.
4059
- *
4060
- */if(!this._DefaultPictTemplatesInitialized){// Expects one of the following:
4237
+ if('default_configuration'in pProviderPrototype){tmpOptions=this.fable.Utility.extend({},pProviderPrototype.default_configuration,tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictProvider',tmpOptions,tmpProviderHash,pProviderPrototype);}else{return this.instantiateServiceProvider('PictProvider',tmpOptions,tmpProviderHash);}}/**
4238
+ * Just passing an options will construct one for us.
4239
+ * Passing a hash will set the hash.
4240
+ * Passing a prototype will use that!
4241
+ *
4242
+ * @param {String} pApplicationHash - The hash of the application.
4243
+ * @param {Object} pOptions - The options for the application.
4244
+ * @param {Object} pApplicationPrototype - The prototype for the application.
4245
+ */},{key:"addApplication",value:function addApplication(pApplicationHash,pOptions,pApplicationPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpApplicationHash=typeof pApplicationHash=='string'?pApplicationHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addApplication [".concat(tmpApplicationHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addApplication [".concat(tmpApplicationHash,"]"));}}if(typeof pApplicationPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
4246
+ if('default_configuration'in pApplicationPrototype){tmpOptions=this.fable.Utility.extend({},pApplicationPrototype.default_configuration,tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictApplication',tmpOptions,tmpApplicationHash,pApplicationPrototype);}else{return this.instantiateServiceProvider('PictApplication',tmpOptions,tmpApplicationHash);}}/**
4247
+ * Attach the default template engine renderers.
4248
+ *
4249
+ * @private
4250
+ */},{key:"initializePictTemplateEngine",value:function initializePictTemplateEngine(){var _this73=this;//{~Data:AppData.Some.Value.to.Render~}
4251
+ this.addTemplate(require("./templates/Pict-Template-Data.js"));if(!this._DefaultPictTemplatesInitialized){// Expects one of the following:
4061
4252
  // {~E:Book^AppData.Some.Address.IDBook^Render-Book-Template~}
4062
4253
  // ...meaning GET BOOK with IDBook FROM AppData.Some.Address.IDBook and render it to Render-Book-Template
4063
- var fEntityRender=function fEntityRender(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"]"));}var tmpEntity=false;var tmpEntityID=false;var tmpEntityTemplate=false;// This expression requires 2 parts -- a third is optional, and, if present, is the template to render to.
4064
- var tmpAddressParts=tmpHash.split('^');if(tmpAddressParts.length<2){_this72.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]"));return tmpCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]")),'');}tmpEntity=tmpAddressParts[0].trim();tmpEntityID=tmpAddressParts[1].trim();tmpEntityTemplate=tmpAddressParts[2].trim();if(!isNaN(tmpEntityID)){try{tmpEntityID=parseInt(tmpEntityID);}catch(_unused){_this72.log.warn("Pict: Entity Render: Could not parse entity ID.");tmpEntityID=0;}}else{// This is an address, so we need to get the value at the address
4065
- tmpEntityID=_this72.resolveStateFromAddress(tmpEntityID,tmpData,pContextArray);}// No Entity or EntityID
4066
- if(!tmpEntity||!tmpEntityID){_this72.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"] Entity: ").concat(tmpEntity," ID: ").concat(tmpEntityID));return tmpCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"] Entity: ").concat(tmpEntity," ID: ").concat(tmpEntityID)),'');}if(_this72.LogNoisiness>3){_this72.log.trace("Pict: Entity Render: Entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] as template [").concat(tmpEntityTemplate,"] from [").concat(tmpHash,"]"));}// Now try to get the entity
4067
- _this72.EntityProvider.getEntity(tmpEntity,tmpEntityID,function(pError,pRecord){if(pError){this.log.error("Pict: Entity Render: Error getting entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] for [").concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}// Now render the template
4068
- if(tmpEntityTemplate){return this.parseTemplateByHash(tmpEntityTemplate,pRecord,tmpCallback,pContextArray);}else{return tmpCallback(null,'');}}.bind(_this72));};this.MetaTemplate.addPatternAsync('{~E:','~}',fEntityRender);this.MetaTemplate.addPatternAsync('{~Entity:','~}',fEntityRender);// {~T:Template:AddressOfData~}
4069
- var fTemplateRender=function fTemplateRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4254
+ var fEntityRender=function fEntityRender(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"]"));}var tmpEntity=false;var tmpEntityID=false;var tmpEntityTemplate=false;// This expression requires 2 parts -- a third is optional, and, if present, is the template to render to.
4255
+ var tmpAddressParts=tmpHash.split('^');if(tmpAddressParts.length<2){_this73.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]"));return tmpCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]")),'');}tmpEntity=tmpAddressParts[0].trim();tmpEntityID=tmpAddressParts[1].trim();tmpEntityTemplate=tmpAddressParts[2].trim();if(!isNaN(tmpEntityID)){try{tmpEntityID=parseInt(tmpEntityID);}catch(_unused){_this73.log.warn("Pict: Entity Render: Could not parse entity ID.");tmpEntityID=0;}}else{// This is an address, so we need to get the value at the address
4256
+ tmpEntityID=_this73.resolveStateFromAddress(tmpEntityID,tmpData,pContextArray);}// No Entity or EntityID
4257
+ if(!tmpEntity||!tmpEntityID){_this73.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"] Entity: ").concat(tmpEntity," ID: ").concat(tmpEntityID));return tmpCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"] Entity: ").concat(tmpEntity," ID: ").concat(tmpEntityID)),'');}if(_this73.LogNoisiness>3){_this73.log.trace("Pict: Entity Render: Entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] as template [").concat(tmpEntityTemplate,"] from [").concat(tmpHash,"]"));}// Now try to get the entity
4258
+ _this73.EntityProvider.getEntity(tmpEntity,tmpEntityID,function(pError,pRecord){if(pError){this.log.error("Pict: Entity Render: Error getting entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] for [").concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}// Now render the template
4259
+ if(tmpEntityTemplate){return this.parseTemplateByHash(tmpEntityTemplate,pRecord,tmpCallback,pContextArray);}else{return tmpCallback(null,'');}}.bind(_this73));};this.MetaTemplate.addPatternAsync('{~E:','~}',fEntityRender);this.MetaTemplate.addPatternAsync('{~Entity:','~}',fEntityRender);// {~T:Template:AddressOfData~}
4260
+ var fTemplateRender=function fTemplateRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4070
4261
  var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
4071
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4072
- return _this72.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}};var fTemplateRenderAsync=function fTemplateRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4262
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4263
+ return _this73.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}};var fTemplateRenderAsync=function fTemplateRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4073
4264
  var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
4074
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4265
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4075
4266
  // The async portion of this is a mind bender because of how entry can happen dynamically from templates
4076
- return _this72.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~T:','~}',fTemplateRender,fTemplateRenderAsync);this.MetaTemplate.addPatternBoth('{~Template:','~}',fTemplateRender,fTemplateRenderAsync);// {~TS:Template:AddressOfDataSet~}
4077
- var fTemplateSetRender=function fTemplateSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4267
+ return _this73.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~T:','~}',fTemplateRender,fTemplateRenderAsync);this.MetaTemplate.addPatternBoth('{~Template:','~}',fTemplateRender,fTemplateRenderAsync);// {~TS:Template:AddressOfDataSet~}
4268
+ var fTemplateSetRender=function fTemplateSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4078
4269
  var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
4079
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4080
- return _this72.parseTemplateSetByHash(tmpTemplateHash,pData,pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),pContextArray);}};var fTemplateSetRenderAsync=function fTemplateSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfData=false;// This is a 3 part hash with the map address and the key address both
4081
- var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){_this72.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
4082
- if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4083
- tmpData=_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);if(!tmpData){// No address was provided, just render the template with what this template has.
4270
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4271
+ return _this73.parseTemplateSetByHash(tmpTemplateHash,pData,pContextArray);}else{return _this73.parseTemplateSetByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),pContextArray);}};var fTemplateSetRenderAsync=function fTemplateSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfData=false;// This is a 3 part hash with the map address and the key address both
4272
+ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){_this73.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
4273
+ if(!tmpTemplateFromMapHash){_this73.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4274
+ tmpData=_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);if(!tmpData){// No address was provided, just render the template with what this template has.
4084
4275
  // The async portion of this is a mind bender because of how entry can happen dynamically from templates
4085
- return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TS:','~}',fTemplateSetRender,fTemplateSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateSet:','~}',fTemplateSetRender,fTemplateSetRenderAsync);// {~TemplateIfAbsolute:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
4276
+ return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TS:','~}',fTemplateSetRender,fTemplateSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateSet:','~}',fTemplateSetRender,fTemplateSetRenderAsync);// {~TemplateIfAbsolute:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
4086
4277
  // {~TIfAbs:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
4087
- var compareValues=function compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}};var fTemplateIfAbsoluteValueRender=function fTemplateIfAbsoluteValueRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return"Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]");}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4088
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
4089
- if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]");}// Now try to break the comparison into three parts...
4090
- var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]");}// Now look up the data at the comparison location
4091
- try{var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return'';}else{if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4092
- return _this72.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return"Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError);}};var fTemplateIfAbsoluteValueRenderAsync=function fTemplateIfAbsoluteValueRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]")));}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4093
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]")));}// No comparison operation
4094
- if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]")));}// Now try to break the comparison into three parts...
4095
- var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]")));}// Now look up the data at the comparison location
4096
- try{var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return tmpCallback(null,'');}else{if(!tmpAddressOfData){return _this72.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}};// {~TemplateIfAbsolute:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
4278
+ var compareValues=function compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}};var fTemplateIfAbsoluteValueRender=function fTemplateIfAbsoluteValueRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this73.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return"Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]");}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4279
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
4280
+ if(!tmpComparisonOperation){_this73.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]");}// Now try to break the comparison into three parts...
4281
+ var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this73.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]");}// Now look up the data at the comparison location
4282
+ try{var tmpComparisonResult=compareValues(_this73.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return'';}else{if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4283
+ return _this73.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}}catch(pError){_this73.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return"Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError);}};var fTemplateIfAbsoluteValueRenderAsync=function fTemplateIfAbsoluteValueRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this73.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]")));}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4284
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]")));}// No comparison operation
4285
+ if(!tmpComparisonOperation){_this73.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]")));}// Now try to break the comparison into three parts...
4286
+ var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this73.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]")));}// Now look up the data at the comparison location
4287
+ try{var tmpComparisonResult=compareValues(_this73.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return tmpCallback(null,'');}else{if(!tmpAddressOfData){return _this73.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}catch(pError){_this73.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}};// {~TemplateIfAbsolute:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
4097
4288
  // {~TIfAbs:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
4098
- this.MetaTemplate.addPatternBoth('{~TemplateIfAbsolute:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);this.MetaTemplate.addPatternBoth('{~TIfAbs:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);var fTemplateIfRender=function fTemplateIfRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return"Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]");}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4099
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
4100
- if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]");}// Now try to break the comparison into three parts...
4101
- var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]");}// Now look up the data at the comparison location
4102
- try{var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],_this72.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray));if(!tmpComparisonResult){return'';}else{if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4103
- return _this72.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return"Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError);}};var fTemplateIfRenderAsync=function fTemplateIfRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]")));}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4104
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]")));}// No comparison operation
4105
- if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]")));}// Now try to break the comparison into three parts...
4106
- var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]")));}// Now look up the data at the comparison location
4289
+ this.MetaTemplate.addPatternBoth('{~TemplateIfAbsolute:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);this.MetaTemplate.addPatternBoth('{~TIfAbs:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);var fTemplateIfRender=function fTemplateIfRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this73.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return"Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]");}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4290
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
4291
+ if(!tmpComparisonOperation){_this73.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]");}// Now try to break the comparison into three parts...
4292
+ var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this73.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]");}// Now look up the data at the comparison location
4293
+ try{var tmpComparisonResult=compareValues(_this73.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],_this73.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray));if(!tmpComparisonResult){return'';}else{if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
4294
+ return _this73.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}}catch(pError){_this73.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return"Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError);}};var fTemplateIfRenderAsync=function fTemplateIfRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this73.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]")));}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
4295
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]")));}// No comparison operation
4296
+ if(!tmpComparisonOperation){_this73.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]")));}// Now try to break the comparison into three parts...
4297
+ var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this73.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]")));}// Now look up the data at the comparison location
4107
4298
  try{// This is the only thing that's different from the absolute value function above. Collapse these.
4108
- var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],_this72.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray));if(!tmpComparisonResult){return tmpCallback(null,'');}else{if(!tmpAddressOfData){return _this72.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}};// {~TemplateIf:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^AppData.Some.Address2.IDBook~}
4299
+ var tmpComparisonResult=compareValues(_this73.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],_this73.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray));if(!tmpComparisonResult){return tmpCallback(null,'');}else{if(!tmpAddressOfData){return _this73.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateHash,_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}catch(pError){_this73.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}};// {~TemplateIf:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^AppData.Some.Address2.IDBook~}
4109
4300
  // {~TIf:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^AppData.Some.Address2.IDBook~}
4110
4301
  this.MetaTemplate.addPatternBoth('{~TemplateIf:','~}',fTemplateIfRender,fTemplateIfRenderAsync);this.MetaTemplate.addPatternBoth('{~TIf:','~}',fTemplateIfRender,fTemplateIfRenderAsync);// Refactor: #### DRY PROBLEM Too much dry needing fixed at this point
4111
4302
  // {~TS:Template:AddressOfDataSet~}
4112
- var fTemplateValueSetRender=function fTemplateValueSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4303
+ var fTemplateValueSetRender=function fTemplateValueSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
4113
4304
  var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
4114
- if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}tmpData=_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i]});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i47=0;_i47<tmpValueKeys.length;_i47++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i47]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
4115
- return _this72.parseTemplateSetByHash(tmpTemplateHash,pData,pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateHash,tmpData,pContextArray);}};var fTemplateValueSetRenderAsync=function fTemplateValueSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfData=false;// This is a 3 part hash with the map address and the key address both
4116
- var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){_this72.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
4117
- if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4118
- tmpData=_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i]});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i48=0;_i48<tmpValueKeys.length;_i48++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i48]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
4305
+ if(!tmpTemplateHash){_this73.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}tmpData=_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i]});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i47=0;_i47<tmpValueKeys.length;_i47++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i47]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
4306
+ return _this73.parseTemplateSetByHash(tmpTemplateHash,pData,pContextArray);}else{return _this73.parseTemplateSetByHash(tmpTemplateHash,tmpData,pContextArray);}};var fTemplateValueSetRenderAsync=function fTemplateValueSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfData=false;// This is a 3 part hash with the map address and the key address both
4307
+ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){_this73.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
4308
+ if(!tmpTemplateFromMapHash){_this73.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4309
+ tmpData=_this73.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i]});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i48=0;_i48<tmpValueKeys.length;_i48++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i48]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
4119
4310
  // The async portion of this is a mind bender because of how entry can happen dynamically from templates
4120
- return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TVS:','~}',fTemplateValueSetRender,fTemplateValueSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateValueSet:','~}',fTemplateValueSetRender,fTemplateValueSetRenderAsync);// {~T:TemplateFromMap:AddressOfData~}
4121
- var fTemplateFromMapRender=function fTemplateFromMapRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4122
- var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4123
- if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
4124
- var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return'';}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4125
- return _this72.parseTemplateByHash(tmpTemplateFromMapHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,null,pContextArray);}};var fTemplateFromMapRenderAsync=function fTemplateFromMapRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4126
- var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4127
- if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4128
- var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4311
+ return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TVS:','~}',fTemplateValueSetRender,fTemplateValueSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateValueSet:','~}',fTemplateValueSetRender,fTemplateValueSetRenderAsync);// {~T:TemplateFromMap:AddressOfData~}
4312
+ var fTemplateFromMapRender=function fTemplateFromMapRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4313
+ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4314
+ if(!tmpTemplateFromMapHash){_this73.log.warn("Pict: TemplateFromMap Render: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
4315
+ var tmpMap=_this73.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this73.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this73.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return'';}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4316
+ return _this73.parseTemplateByHash(tmpTemplateFromMapHash,pData,null,pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,null,pContextArray);}};var fTemplateFromMapRenderAsync=function fTemplateFromMapRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4317
+ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4318
+ if(!tmpTemplateFromMapHash){_this73.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4319
+ var tmpMap=_this73.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this73.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this73.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4129
4320
  // The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
4130
- return _this72.parseTemplateByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TFM:','~}',fTemplateFromMapRender,fTemplateFromMapRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateFromMap:','~}',fTemplateFromMapRender,fTemplateFromMapRenderAsync);// {~TS:TemplateFromMap:AddressOfDataSet~}
4131
- var fTemplateFromMapSetRender=function fTemplateFromMapSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4132
- var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4133
- if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
4134
- var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return'';}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4135
- return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,pContextArray);}};var fTemplateFromMapSetRenderAsync=function fTemplateFromMapSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4136
- var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4137
- if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMapSet Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4138
- var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMapSet Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4321
+ return _this73.parseTemplateByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TFM:','~}',fTemplateFromMapRender,fTemplateFromMapRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateFromMap:','~}',fTemplateFromMapRender,fTemplateFromMapRenderAsync);// {~TS:TemplateFromMap:AddressOfDataSet~}
4322
+ var fTemplateFromMapSetRender=function fTemplateFromMapSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4323
+ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4324
+ if(!tmpTemplateFromMapHash){_this73.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
4325
+ var tmpMap=_this73.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this73.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this73.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return'';}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4326
+ return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,pContextArray);}else{return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,pContextArray);}};var fTemplateFromMapSetRenderAsync=function fTemplateFromMapSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this73.LogNoisiness>4){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>0){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
4327
+ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this73.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
4328
+ if(!tmpTemplateFromMapHash){_this73.log.warn("Pict: TemplateFromMapSet Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
4329
+ var tmpMap=_this73.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this73.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this73.log.warn("Pict: TemplateFromMapSet Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
4139
4330
  // The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
4140
- return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TSFM:','~}',fTemplateFromMapSetRender,fTemplateFromMapSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateSetFromMap:','~}',fTemplateFromMapSetRender,fTemplateFromMapSetRenderAsync);// {~DataTree:AppData.Some.Value.to.Render~}
4141
- var fDataValueTree=function fDataValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=_this72.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused2){tmpData.TreeMaxDepth=1;}var tmpPictObjectWrapTemplate=_this72.TemplateProvider.getTemplate('PICT-Object-Wrap');if(!tmpPictObjectWrapTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Wrap
4142
- tmpPictObjectWrapTemplate="<div class=\"PICT PICTObjectSet\">{~D:Record.ObjectValueTree~}</div>";}if(tmpData.ResolvedValueType=='object'){tmpData.ObjectValueTree=fDataValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ResolvedValue,0,tmpData.TreeMaxDepth,pContextArray);}else{_this72.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);tmpData.ObjectValueTree=tmpData.ResolveValue;}return _this72.parseTemplate(tmpPictObjectWrapTemplate,tmpData,pContextArray);};var fDataValueTreeObjectSet=function fDataValueTreeObjectSet(pObject,pRootObject,pCurrentDepth,pMaxDepth,pContextArray){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);var tmpPictObjectBranchTemplate=_this72.TemplateProvider.getTemplate('PICT-Object-Branch');if(!tmpPictObjectBranchTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Branch
4143
- tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.CurrentDepth~}\"><div class=\"PICTObjectBranch\">{~D:Record.BranchKey~}</div><div class=\"PICTObjectBranchValue\">{~D:Record.BranchValue~}</div></div>\n";}for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':if(pCurrentDepth+1>pMaxDepth){tmpBranchValue='...';}else{tmpBranchValue=fDataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}var tmpDataValue={AppData:_this72.AppData,Bundle:_this72.Bundle,RootContainer:pRootObject,Container:pObject,BranchEntryCount:tmpObjectValueKeys.length,BranchIndex:i,BranchKey:tmpObjectValueKeys[i],BranchValue:tmpBranchValue,BranchDataType:tmpBranchType,CurrentDepth:pCurrentDepth,MaxDepth:pMaxDepth};tmpTemplateResult+=_this72.parseTemplate(tmpPictObjectBranchTemplate,tmpDataValue,pContextArray);}return tmpTemplateResult;};this.MetaTemplate.addPattern('{~DataTree:','~}',fDataValueTree);this.MetaTemplate.addPattern('{~DT:','~}',fDataValueTree);//{~Data:AppData.Some.Value.to.Render~}
4144
- var fDataRender=function fDataRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue='';if(tmpHash!=null){tmpValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);}if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;};this.MetaTemplate.addPattern('{~D:','~}',fDataRender);this.MetaTemplate.addPattern('{~Data:','~}',fDataRender);//<p>{~Join: - ^Record.d1^Record.d1~}</p>
4145
- var fJoinDataRender=function fJoinDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
4146
- var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=_this72.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){tmpValueList.push(tmpValueSet[j]);}}else if(tmpValueSet){tmpValueList.push(tmpValueSet);}}return tmpValueList.join(tmpSeparator);};this.MetaTemplate.addPattern('{~J:','~}',fJoinDataRender);this.MetaTemplate.addPattern('{~Join:','~}',fJoinDataRender);//<p>{~JoinUnique: - ^Record.d1^Record.d1~}</p>
4147
- var fJoinUniqueDataRender=function fJoinUniqueDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
4148
- var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={};for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=_this72.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){if(!tmpValueMap.hasOwnProperty(tmpValueSet[j])){tmpValueMap[tmpValueSet[j]]=true;tmpValueList.push(tmpValueSet[j]);}}}else if(tmpValueSet){if(!tmpValueMap.hasOwnProperty(tmpValueSet)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);};this.MetaTemplate.addPattern('{~JU:','~}',fJoinUniqueDataRender);this.MetaTemplate.addPattern('{~JoinUnique:','~}',fJoinUniqueDataRender);this.MetaTemplate.addPattern('{~Dollars:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"]"));}var tmpColumnData=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return _this72.DataFormat.formatterDollars(tmpColumnData);});this.MetaTemplate.addPattern('{~Digits:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"]"));}var tmpColumnData=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return _this72.DataFormat.formatterAddCommasToNumber(_this72.DataFormat.formatterRoundNumber(tmpColumnData,2));});// Output the date as a YYYY-MM-DD string
4149
- this.MetaTemplate.addPattern('{~DateYMD:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
4150
- var tmpDayJS=_this72.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
4151
- if(_this72.options.Timezone){tmpDayJS=tmpDayJS.tz(_this72.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}}catch(_unused3){//this.log.error(`Error casting timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
4331
+ return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this73.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TSFM:','~}',fTemplateFromMapSetRender,fTemplateFromMapSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateSetFromMap:','~}',fTemplateFromMapSetRender,fTemplateFromMapSetRenderAsync);// {~DataTree:AppData.Some.Value.to.Render~}
4332
+ var fDataValueTree=function fDataValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=_this73.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused2){tmpData.TreeMaxDepth=1;}var tmpPictObjectWrapTemplate=_this73.TemplateProvider.getTemplate('PICT-Object-Wrap');if(!tmpPictObjectWrapTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Wrap
4333
+ tmpPictObjectWrapTemplate="<div class=\"PICT PICTObjectSet\">{~D:Record.ObjectValueTree~}</div>";}if(tmpData.ResolvedValueType=='object'){tmpData.ObjectValueTree=fDataValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ResolvedValue,0,tmpData.TreeMaxDepth,pContextArray);}else{_this73.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);tmpData.ObjectValueTree=tmpData.ResolveValue;}return _this73.parseTemplate(tmpPictObjectWrapTemplate,tmpData,pContextArray);};var fDataValueTreeObjectSet=function fDataValueTreeObjectSet(pObject,pRootObject,pCurrentDepth,pMaxDepth,pContextArray){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);var tmpPictObjectBranchTemplate=_this73.TemplateProvider.getTemplate('PICT-Object-Branch');if(!tmpPictObjectBranchTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Branch
4334
+ tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.CurrentDepth~}\"><div class=\"PICTObjectBranch\">{~D:Record.BranchKey~}</div><div class=\"PICTObjectBranchValue\">{~D:Record.BranchValue~}</div></div>\n";}for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':if(pCurrentDepth+1>pMaxDepth){tmpBranchValue='...';}else{tmpBranchValue=fDataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}var tmpDataValue={AppData:_this73.AppData,Bundle:_this73.Bundle,RootContainer:pRootObject,Container:pObject,BranchEntryCount:tmpObjectValueKeys.length,BranchIndex:i,BranchKey:tmpObjectValueKeys[i],BranchValue:tmpBranchValue,BranchDataType:tmpBranchType,CurrentDepth:pCurrentDepth,MaxDepth:pMaxDepth};tmpTemplateResult+=_this73.parseTemplate(tmpPictObjectBranchTemplate,tmpDataValue,pContextArray);}return tmpTemplateResult;};this.MetaTemplate.addPattern('{~DataTree:','~}',fDataValueTree);this.MetaTemplate.addPattern('{~DT:','~}',fDataValueTree);//<p>{~Join: - ^Record.d1^Record.d1~}</p>
4335
+ var fJoinDataRender=function fJoinDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
4336
+ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=_this73.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){tmpValueList.push(tmpValueSet[j]);}}else if(tmpValueSet){tmpValueList.push(tmpValueSet);}}return tmpValueList.join(tmpSeparator);};this.MetaTemplate.addPattern('{~J:','~}',fJoinDataRender);this.MetaTemplate.addPattern('{~Join:','~}',fJoinDataRender);//<p>{~JoinUnique: - ^Record.d1^Record.d1~}</p>
4337
+ var fJoinUniqueDataRender=function fJoinUniqueDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
4338
+ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={};for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=_this73.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){if(!(tmpValueSet[j]in tmpValueMap)){tmpValueMap[tmpValueSet[j]]=true;tmpValueList.push(tmpValueSet[j]);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);};this.MetaTemplate.addPattern('{~JU:','~}',fJoinUniqueDataRender);this.MetaTemplate.addPattern('{~JoinUnique:','~}',fJoinUniqueDataRender);this.MetaTemplate.addPattern('{~Dollars:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"]"));}var tmpColumnData=_this73.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return _this73.DataFormat.formatterDollars(tmpColumnData);});this.MetaTemplate.addPattern('{~Digits:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"]"));}var tmpColumnData=_this73.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return _this73.DataFormat.formatterAddCommasToNumber(_this73.DataFormat.formatterRoundNumber(tmpColumnData,2));});// Output the date as a YYYY-MM-DD string
4339
+ this.MetaTemplate.addPattern('{~DateYMD:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValue=_this73.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
4340
+ var tmpDayJS=_this73.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
4341
+ if(_this73.options.Timezone){tmpDayJS=tmpDayJS.tz(_this73.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(_this73.fable.Dates.dayJS.tz.guess());}catch(pError){_this73.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}}catch(_unused3){//this.log.error(`Error casting timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
4152
4342
  // Day.js will try to guess the user's timezone for us
4153
- try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}return tmpDayJS.format('YYYY-MM-DD');});// Output the date as a YYYY-MM-DD string
4343
+ try{tmpDayJS=tmpDayJS.tz(_this73.fable.Dates.dayJS.tz.guess());}catch(pError){_this73.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}return tmpDayJS.format('YYYY-MM-DD');});// Output the date as a YYYY-MM-DD string
4154
4344
  // Takes in the format as the second parameter: {~DateYMD:AppData.Some.Date^YYYY-MM-DD~}
4155
- this.MetaTemplate.addPattern('{~DateFormat:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValueSet=tmpHash.split('^');if(tmpDateValueSet.length<2){_this72.log.error("PICT Template [fDateFormat]::[".concat(tmpHash,"] did not have a valid format string and date."));return'';}var tmpDateValue=_this72.resolveStateFromAddress(tmpDateValueSet[0],tmpData,pContextArray);if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
4156
- var tmpDayJS=_this72.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
4157
- if(_this72.options.Timezone){tmpDayJS=tmpDayJS.tz(_this72.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}}catch(_unused4){//this.log.error(`Error casting date passed timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
4345
+ this.MetaTemplate.addPattern('{~DateFormat:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValueSet=tmpHash.split('^');if(tmpDateValueSet.length<2){_this73.log.error("PICT Template [fDateFormat]::[".concat(tmpHash,"] did not have a valid format string and date."));return'';}var tmpDateValue=_this73.resolveStateFromAddress(tmpDateValueSet[0],tmpData,pContextArray);if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
4346
+ var tmpDayJS=_this73.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
4347
+ if(_this73.options.Timezone){tmpDayJS=tmpDayJS.tz(_this73.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(_this73.fable.Dates.dayJS.tz.guess());}catch(pError){_this73.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}}catch(_unused4){//this.log.error(`Error casting date passed timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
4158
4348
  // Day.js will try to guess the user's timezone for us
4159
- try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}return tmpDayJS.format(tmpDateValueSet[1]);});// {NE~Some.Address|If the left value is truthy, render this value.~}
4160
- var fNotEmptyRender=function fNotEmptyRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>2){_this72.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"]"));}// Should switch this to indexOf so pipes can be in the content.
4349
+ try{tmpDayJS=tmpDayJS.tz(_this73.fable.Dates.dayJS.tz.guess());}catch(pError){_this73.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}return tmpDayJS.format(tmpDateValueSet[1]);});// {NE~Some.Address|If the left value is truthy, render this value.~}
4350
+ var fNotEmptyRender=function fNotEmptyRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>2){_this73.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"]"));}// Should switch this to indexOf so pipes can be in the content.
4161
4351
  var tmpHashParts=tmpHash.split('|');// For now just check truthiness
4162
- if(_this72.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}else{return'';}};this.MetaTemplate.addPattern('{~NotEmpty:','~}',fNotEmptyRender);this.MetaTemplate.addPattern('{~NE:','~}',fNotEmptyRender);var fRandomNumberString=function fRandomNumberString(pHash){var tmpHash=pHash.trim();if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fRandomNumberString]::[".concat(tmpHash,"]"));}var tmpStringLength=4;var tmpMaxNumber=9999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpStringLength=parseInt(tmpHashParts[0]);}catch(_unused5){tmpStringLength=4;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused6){tmpMaxNumber=9999;}}}return _this72.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumberString:','~}',fRandomNumberString);this.MetaTemplate.addPattern('{~RNS:','~}',fRandomNumberString);var fRandomNumber=function fRandomNumber(pHash){var tmpHash=pHash.trim();if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fRandomNumber]::[".concat(tmpHash,"]"));}var tmpMinimumNumber=0;var tmpMaxNumber=9999999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpMinimumNumber=parseInt(tmpHashParts[0]);}catch(_unused7){tmpMinimumNumber=0;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused8){tmpMaxNumber=9999999;}}}return _this72.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumber:','~}',fRandomNumber);this.MetaTemplate.addPattern('{~RN:','~}',fRandomNumber);var fPascalCaseIdentifier=function fPascalCaseIdentifier(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"]"));}var tmpValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return _this72.DataFormat.cleanNonAlphaCharacters(_this72.DataFormat.capitalizeEachWord(tmpValue));};this.MetaTemplate.addPattern('{~PascalCaseIdentifier:','~}',fPascalCaseIdentifier);var fLogValue=function fLogValue(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);var tmpValueType=_typeof(tmpValue);if(tmpValue==null||tmpValueType=='undefined'){_this72.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is ").concat(tmpValueType,"."));}else if(tmpValueType=='object'){_this72.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is an object."),tmpValue);}else{_this72.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is a ").concat(tmpValueType," = [").concat(tmpValue,"]"));}return'';};this.MetaTemplate.addPattern('{~LogValue:','~}',fLogValue);this.MetaTemplate.addPattern('{~LV:','~}',fLogValue);var fLogValueTree=function fLogValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=_this72.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused9){tmpData.TreeMaxDepth=1;}if(tmpData.ResolvedValueType=='object'){fLogValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ValueTreeParameters[0],tmpData.ResolvedValue,0,tmpData.TreeMaxDepth);}else{_this72.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);}return'';};var fLogValueTreeObjectSet=function fLogValueTreeObjectSet(pObject,pBaseAddress,pRootObject,pCurrentDepth,pMaxDepth){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':tmpBranchValue='...';break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}_this72.log.trace("[".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i],"] (").concat(tmpBranchType,"): ").concat(tmpBranchValue));if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=fLogValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],"".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i]),pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';};this.MetaTemplate.addPattern('{~LogValueTree:','~}',fLogValueTree);this.MetaTemplate.addPattern('{~LVT:','~}',fLogValueTree);var fLogStatement=function fLogStatement(pHash,pData){var tmpHash=pHash.trim();_this72.log.trace("PICT Template Log Message: ".concat(tmpHash));return'';};this.MetaTemplate.addPattern('{~LogStatement:','~}',fLogStatement);this.MetaTemplate.addPattern('{~LS:','~}',fLogStatement);var fBreakpoint=function fBreakpoint(pHash,pData){var tmpHash=pHash.trim();var tmpError=new Error("PICT Template Breakpoint: ".concat(tmpHash));_this72.log.trace("PICT Template Breakpoint: ".concat(tmpHash),tmpError.stack);debugger;return'';};this.MetaTemplate.addPattern('{~Breakpoint','~}',fBreakpoint);this._DefaultPictTemplatesInitialized=true;}}},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];return this.manifest.getValueByHash({Pict:this,AppData:this.AppData,Bundle:this.Bundle,Context:tmpContextArray,Record:pRecord},pAddress);}},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var _this73=this;var tmpData=_typeof(pData)==='object'?pData:{};var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];var tmpParseUUID;if(this.LogControlFlow){tmpParseUUID=this.fable.getUUID();this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," [").concat(pTemplateString.substring(0,50).replace('\n','\\n'),"...").concat(pTemplateString.length,"] (fCallback: ").concat(_typeof(fCallback),") with data size [").concat(JSON.stringify(tmpData).length,"]"));if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," template:\n").concat(pTemplateString));}if(this.LogControlFlowWatchAddressList.length>0){for(var i=0;i<this.LogControlFlowWatchAddressList.length;i++){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Watch Value: [").concat(this.LogControlFlowWatchAddressList[i],"]=>[").concat(this.resolveStateFromAddress(this.LogControlFlowWatchAddressList[i],tmpData),"]"));}}}if(typeof fCallback==='function'){this.MetaTemplate.parseString(pTemplateString,tmpData,function(pError,pParsedTemplate){if(_this73.LogControlFlow&&_this73.LogNoisiness>1){_this73.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Template Async Return Value:\n").concat(pParsedTemplate));}return fCallback(pError,pParsedTemplate);},tmpContextArray);}else{var tmpResult=this.MetaTemplate.parseString(pTemplateString,tmpData,null,tmpContextArray);if(this.LogControlFlow&&this.LogNoisiness>1){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Template Return Value:\n").concat(tmpResult));}return tmpResult;}}},{key:"parseTemplateByHash",value:function parseTemplateByHash(pTemplateHash,pData,fCallback,pContextArray){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
4163
- if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplate(tmpTemplateString,pData,fCallback,pContextArray);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this74=this;// TODO: This will need streaming -- for now janky old string append does the trick
4164
- var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this74.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error('Pict: Template Set: pDataSet is not an array or object.'),'');}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i],pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i49=0;_i49<tmpKeys.length;_i49++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i49]],pContextArray);}}return tmpValue;}else{return'';}}}},{key:"parseTemplateSetByHash",value:function parseTemplateSetByHash(pTemplateHash,pDataSet,fCallback,pContextArray){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
4352
+ if(_this73.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}else{return'';}};this.MetaTemplate.addPattern('{~NotEmpty:','~}',fNotEmptyRender);this.MetaTemplate.addPattern('{~NE:','~}',fNotEmptyRender);var fRandomNumberString=function fRandomNumberString(pHash){var tmpHash=pHash.trim();if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fRandomNumberString]::[".concat(tmpHash,"]"));}var tmpStringLength=4;var tmpMaxNumber=9999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpStringLength=parseInt(tmpHashParts[0]);}catch(_unused5){tmpStringLength=4;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused6){tmpMaxNumber=9999;}}}return _this73.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumberString:','~}',fRandomNumberString);this.MetaTemplate.addPattern('{~RNS:','~}',fRandomNumberString);var fRandomNumber=function fRandomNumber(pHash){var tmpHash=pHash.trim();if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fRandomNumber]::[".concat(tmpHash,"]"));}var tmpMinimumNumber=0;var tmpMaxNumber=9999999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){try{tmpMinimumNumber=parseInt(tmpHashParts[0]);}catch(_unused7){tmpMinimumNumber=0;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused8){tmpMaxNumber=9999999;}}}return _this73.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumber:','~}',fRandomNumber);this.MetaTemplate.addPattern('{~RN:','~}',fRandomNumber);var fPascalCaseIdentifier=function fPascalCaseIdentifier(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this73.LogNoisiness>4){_this73.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this73.LogNoisiness>3){_this73.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"]"));}var tmpValue=_this73.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return _this73.DataFormat.cleanNonAlphaCharacters(_this73.DataFormat.capitalizeEachWord(tmpValue));};this.MetaTemplate.addPattern('{~PascalCaseIdentifier:','~}',fPascalCaseIdentifier);var fLogValue=function fLogValue(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpValue=_this73.resolveStateFromAddress(tmpHash,tmpData,pContextArray);var tmpValueType=_typeof(tmpValue);if(tmpValue==null||tmpValueType=='undefined'){_this73.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is ").concat(tmpValueType,"."));}else if(tmpValueType=='object'){_this73.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is an object."),tmpValue);}else{_this73.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is a ").concat(tmpValueType," = [").concat(tmpValue,"]"));}return'';};this.MetaTemplate.addPattern('{~LogValue:','~}',fLogValue);this.MetaTemplate.addPattern('{~LV:','~}',fLogValue);var fLogValueTree=function fLogValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=_this73.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused9){tmpData.TreeMaxDepth=1;}if(tmpData.ResolvedValueType=='object'){fLogValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ValueTreeParameters[0],tmpData.ResolvedValue,0,tmpData.TreeMaxDepth);}else{_this73.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);}return'';};var fLogValueTreeObjectSet=function fLogValueTreeObjectSet(pObject,pBaseAddress,pRootObject,pCurrentDepth,pMaxDepth){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':tmpBranchValue='...';break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}_this73.log.trace("[".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i],"] (").concat(tmpBranchType,"): ").concat(tmpBranchValue));if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=fLogValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],"".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i]),pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';};this.MetaTemplate.addPattern('{~LogValueTree:','~}',fLogValueTree);this.MetaTemplate.addPattern('{~LVT:','~}',fLogValueTree);var fLogStatement=function fLogStatement(pHash){var tmpHash=pHash.trim();_this73.log.trace("PICT Template Log Message: ".concat(tmpHash));return'';};this.MetaTemplate.addPattern('{~LogStatement:','~}',fLogStatement);this.MetaTemplate.addPattern('{~LS:','~}',fLogStatement);var fBreakpoint=function fBreakpoint(pHash){var tmpHash=pHash.trim();var tmpError=new Error("PICT Template Breakpoint: ".concat(tmpHash));_this73.log.trace("PICT Template Breakpoint: ".concat(tmpHash),tmpError.stack);debugger;// eslint-disable-line no-debugger
4353
+ return'';};this.MetaTemplate.addPattern('{~Breakpoint','~}',fBreakpoint);this._DefaultPictTemplatesInitialized=true;}}/**
4354
+ * Read a value from a nested object using a dot notation string.
4355
+ *
4356
+ * @param {string} pAddress - The address to resolve
4357
+ * @param {object} pRecord - The record to resolve
4358
+ * @param {Array<any>} pContextArray - The context array to resolve
4359
+ *
4360
+ * @returns {any} The value at the given address, or undefined
4361
+ */},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];return this.manifest.getValueByHash({Pict:this,AppData:this.AppData,Bundle:this.Bundle,Context:tmpContextArray,Record:pRecord},pAddress);}/**
4362
+ * Parse a template.
4363
+ *
4364
+ * @param {String} pTemplateString - The template string to parse
4365
+ * @param {Object} pData - The data to use in the template
4366
+ * @param {Function} fCallback - The callback to call when the template is parsed
4367
+ * @param {Array<any>} pContextArray - The context array to use in the template
4368
+ */},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var _this74=this;var tmpData=_typeof(pData)==='object'?pData:{};var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];var tmpParseUUID;if(this.LogControlFlow){tmpParseUUID=this.fable.getUUID();this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," [").concat(pTemplateString.substring(0,50).replace('\n','\\n'),"...").concat(pTemplateString.length,"] (fCallback: ").concat(_typeof(fCallback),") with data size [").concat(JSON.stringify(tmpData).length,"]"));if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," template:\n").concat(pTemplateString));}if(this.LogControlFlowWatchAddressList.length>0){for(var i=0;i<this.LogControlFlowWatchAddressList.length;i++){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Watch Value: [").concat(this.LogControlFlowWatchAddressList[i],"]=>[").concat(this.resolveStateFromAddress(this.LogControlFlowWatchAddressList[i],tmpData),"]"));}}}if(typeof fCallback==='function'){this.MetaTemplate.parseString(pTemplateString,tmpData,function(pError,pParsedTemplate){if(_this74.LogControlFlow&&_this74.LogNoisiness>1){_this74.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Template Async Return Value:\n").concat(pParsedTemplate));}return fCallback(pError,pParsedTemplate);},tmpContextArray);}else{var tmpResult=this.MetaTemplate.parseString(pTemplateString,tmpData,null,tmpContextArray);if(this.LogControlFlow&&this.LogNoisiness>1){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Template Return Value:\n").concat(tmpResult));}return tmpResult;}}/**
4369
+ * Parse a template by hash.
4370
+ *
4371
+ * @param {String} pTemplateHash - The hash of the template to parse
4372
+ * @param {Object} pData - The data to use in the template
4373
+ * @param {Function} fCallback - The callback to call when the template is parsed
4374
+ * @param {Array<any>} pContextArray - The context array to use in the template
4375
+ */},{key:"parseTemplateByHash",value:function parseTemplateByHash(pTemplateHash,pData,fCallback,pContextArray){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
4376
+ if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplate(tmpTemplateString,pData,fCallback,pContextArray);}/**
4377
+ * Parse a template set.
4378
+ *
4379
+ * @param {String} pTemplateString - The template string to parse
4380
+ * @param {Array|Object} pDataSet - The data set to use in the template
4381
+ * @param {Function} fCallback - The callback to call when the template is parsed
4382
+ * @param {Array<any>} pContextArray - The context array to use in the template
4383
+ */},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this75=this;// TODO: This will need streaming -- for now janky old string append does the trick
4384
+ var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this75.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error('Pict: Template Set: pDataSet is not an array or object.'),'');}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i],pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i49=0;_i49<tmpKeys.length;_i49++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i49]],pContextArray);}}return tmpValue;}else{return'';}}}/**
4385
+ * Parse a template set by hash.
4386
+ *
4387
+ * @param {String} pTemplateHash - The hash of the template to parse
4388
+ * @param {Array|Object} pDataSet - The data set to use in the template
4389
+ * @param {Function} fCallback - The callback to call when the template is parsed
4390
+ * @param {Array<any>} pContextArray - The context array to use in the template
4391
+ */},{key:"parseTemplateSetByHash",value:function parseTemplateSetByHash(pTemplateHash,pDataSet,fCallback,pContextArray){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
4165
4392
  if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplateSet(tmpTemplateString,pDataSet,fCallback,pContextArray);}}]);}(libFable);;module.exports=Pict;module.exports.PictApplicationClass=require('pict-application');module.exports.PictViewClass=require('pict-view');module.exports.PictProviderClass=require('pict-provider');module.exports.EnvironmentLog=require('./environments/Pict-Environment-Log.js');module.exports.EnvironmentObject=require('./environments/Pict-Environment-Object.js');// This is to help understand the type of enivironement we're executing in
4166
- module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");module.exports.safeOnDocumentReady=require("./Pict-Browser-SafeOnDocumentReady.js");module.exports.safeLoadPictApplication=require("./Pict-Browser-SafeLoad.js");},{"./Pict-Browser-SafeLoad.js":160,"./Pict-Browser-SafeOnDocumentReady.js":161,"./Pict-CSS.js":162,"./Pict-Content-Assignment.js":163,"./Pict-DataProvider.js":164,"./Pict-Meadow-EntityProvider.js":165,"./Pict-Template-Provider.js":166,"./environments/Pict-Environment-Log.js":168,"./environments/Pict-Environment-Object.js":169,"fable":58,"pict-application":114,"pict-provider":115,"pict-view":116}],168:[function(require,module,exports){/**
4393
+ module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");module.exports.safeOnDocumentReady=require("./Pict-Browser-SafeOnDocumentReady.js");module.exports.safeLoadPictApplication=require("./Pict-Browser-SafeLoad.js");},{"./Pict-Browser-SafeLoad.js":160,"./Pict-Browser-SafeOnDocumentReady.js":161,"./Pict-CSS.js":162,"./Pict-Content-Assignment.js":163,"./Pict-DataProvider.js":164,"./Pict-Meadow-EntityProvider.js":165,"./Pict-Template-Provider.js":166,"./Pict-Template.js":167,"./environments/Pict-Environment-Log.js":169,"./environments/Pict-Environment-Object.js":170,"./templates/Pict-Template-Data.js":171,"fable":58,"pict-application":114,"pict-provider":115,"pict-view":116}],169:[function(require,module,exports){/**
4167
4394
  * Pict browser shim loader
4168
4395
  * @author <steven@velozo.com>
4169
4396
  *
@@ -4185,10 +4412,53 @@ module.exports.isBrowser=new Function("try {return (this===window);} catch(pErro
4185
4412
  * 4. Pass your pict through this to get the custom functions mapped into the ContentAssignment service:
4186
4413
  * let tmpMockEnvironment = new libPictEnvironmentLog(_Pict, tmpContentMap);
4187
4414
  * 5. Now you can use your pict as normal, and it will log all of the read/write events out and keep a log of when they occurred.
4188
- */var PictEnvironmentLog=/*#__PURE__*/function(){function PictEnvironmentLog(pPict,pContentMap){_classCallCheck2(this,PictEnvironmentLog);this.contentMap=_typeof(pContentMap)=='object'?pContentMap:{};this.pict=pPict;// If this is set to false, we won't keep an array-based log of every read, assignment, append or get.
4415
+ */var PictEnvironmentLog=/*#__PURE__*/function(){/**
4416
+ * @typedef {import('../Pict')} Pict
4417
+ */ /**
4418
+ * @param {Pict} pPict - The pict object to attach the custom read/write functions to.
4419
+ * @param {Map<String, any>} pContentMap - The content map to use for custom reads.
4420
+ */function PictEnvironmentLog(pPict,pContentMap){_classCallCheck2(this,PictEnvironmentLog);this.contentMap=_typeof(pContentMap)=='object'?pContentMap:{};this.pict=pPict;// If this is set to false, we won't keep an array-based log of every read, assignment, append or get.
4189
4421
  this.truncateContentLength=256;this.storeEventLog=true;// Where to store each event type
4190
- this.eventLog={};this.eventLog.GetElement=[];this.eventLog.Read=[];this.eventLog.Prepend=[];this.eventLog.Append=[];this.eventLog.Assign=[];this.pict.ContentAssignment.customGetElementFunction=this.customGetElementFunction.bind(this);this.pict.ContentAssignment.customReadFunction=this.customReadFunction.bind(this);this.pict.ContentAssignment.customAppendFunction=this.customAppendFunction.bind(this);this.pict.ContentAssignment.customPrependFunction=this.customPrependFunction.bind(this);this.pict.ContentAssignment.customAssignFunction=this.customAssignFunction.bind(this);this.pict.ContentAssignment.customReadAttributeFunction=this.customReadAttributeFunction.bind(this);this.pict.ContentAssignment.customSetAttributeFunction=this.customSetAttributeFunction.bind(this);}return _createClass2(PictEnvironmentLog,[{key:"createEventLogEntry",value:function createEventLogEntry(pAddress,pContent){var tmpContent=typeof pContent=='undefined'?'':pContent;return{TimeStamp:this.pict.log.getTimeStamp(),Hash:pAddress,Content:tmpContent};}},{key:"customGetElementFunction",value:function customGetElementFunction(pAddress){if(this.storeEventLog)this.eventLog.GetElement.push(this.createEventLogEntry(pAddress));this.pict.log.info("Mocking an GET of Address -> [".concat(pAddress,"]"));return'';}},{key:"customReadFunction",value:function customReadFunction(pAddress){if(this.storeEventLog)this.eventLog.Read.push(this.createEventLogEntry(pAddress));this.pict.log.info("Mocking an READ from Address -> [".concat(pAddress,"]"));if(this.contentMap.hasOwnProperty(pAddress)){// The data is in the content map!
4191
- return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".concat(pAddress," did not find a value in the content map."));return'';}},{key:"customAppendFunction",value:function customAppendFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customPrependFunction",value:function customPrependFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customAssignFunction",value:function customAssignFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customReadAttributeFunction",value:function customReadAttributeFunction(pAddress,pAttribute){this.pict.log.info("Mocking an READ ATTRIBUTE from Address -> [".concat(pAddress,"]"),{Attribute:pAttribute});return'';}},{key:"customSetAttributeFunction",value:function customSetAttributeFunction(pAddress,pAttribute,pContent){if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an SET ATTRIBUTE to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Attribute:pAttribute,Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an SET ATTRIBUTE to Address -> [".concat(pAddress,"]"),{Attribute:pAttribute,Content:pContent});}return'';}}]);}();module.exports=PictEnvironmentLog;},{}],169:[function(require,module,exports){/**
4422
+ this.eventLog={};this.eventLog.GetElement=[];this.eventLog.Read=[];this.eventLog.Prepend=[];this.eventLog.Append=[];this.eventLog.Assign=[];this.pict.ContentAssignment.customGetElementFunction=this.customGetElementFunction.bind(this);this.pict.ContentAssignment.customReadFunction=this.customReadFunction.bind(this);this.pict.ContentAssignment.customAppendFunction=this.customAppendFunction.bind(this);this.pict.ContentAssignment.customPrependFunction=this.customPrependFunction.bind(this);this.pict.ContentAssignment.customAssignFunction=this.customAssignFunction.bind(this);this.pict.ContentAssignment.customReadAttributeFunction=this.customReadAttributeFunction.bind(this);this.pict.ContentAssignment.customSetAttributeFunction=this.customSetAttributeFunction.bind(this);}/**
4423
+ * Create an event log entry.
4424
+ *
4425
+ * @param {string} pAddress - The address of the event.
4426
+ * @param {string} pContent - The content of the event.
4427
+ */return _createClass2(PictEnvironmentLog,[{key:"createEventLogEntry",value:function createEventLogEntry(pAddress,pContent){var tmpContent=typeof pContent=='undefined'?'':pContent;return{TimeStamp:this.pict.log.getTimeStamp(),Hash:pAddress,Content:tmpContent};}/**
4428
+ * Custom GetElement function.
4429
+ *
4430
+ * @param {string} pAddress - The address of the element.
4431
+ */},{key:"customGetElementFunction",value:function customGetElementFunction(pAddress){if(this.storeEventLog)this.eventLog.GetElement.push(this.createEventLogEntry(pAddress));this.pict.log.info("Mocking an GET of Address -> [".concat(pAddress,"]"));return'';}/**
4432
+ * Custom Read function.
4433
+ *
4434
+ * @param {string} pAddress - The address of the element.
4435
+ */},{key:"customReadFunction",value:function customReadFunction(pAddress){if(this.storeEventLog)this.eventLog.Read.push(this.createEventLogEntry(pAddress));this.pict.log.info("Mocking an READ from Address -> [".concat(pAddress,"]"));if(pAddress in this.contentMap){// The data is in the content map!
4436
+ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".concat(pAddress," did not find a value in the content map."));return'';}/**
4437
+ * Custom Append function.
4438
+ *
4439
+ * @param {string} pAddress - The address of the element.
4440
+ * @param {string} pContent - The content to append.
4441
+ */},{key:"customAppendFunction",value:function customAppendFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}/**
4442
+ * Custom Prepend function.
4443
+ *
4444
+ * @param {string} pAddress - The address of the element.
4445
+ * @param {string} pContent - The content to prepend.
4446
+ */},{key:"customPrependFunction",value:function customPrependFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}/**
4447
+ * Custom Assign function.
4448
+ *
4449
+ * @param {string} pAddress - The address of the element.
4450
+ * @param {string} pContent - The content to assign.
4451
+ */},{key:"customAssignFunction",value:function customAssignFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}/**
4452
+ * Custom Read Attribute function.
4453
+ *
4454
+ * @param {string} pAddress - The address of the element.
4455
+ * @param {string} pAttribute - The attribute to read.
4456
+ */},{key:"customReadAttributeFunction",value:function customReadAttributeFunction(pAddress,pAttribute){this.pict.log.info("Mocking an READ ATTRIBUTE from Address -> [".concat(pAddress,"]"),{Attribute:pAttribute});return'';}/**
4457
+ * Custom Set Attribute function.
4458
+ *
4459
+ * @param {string} pAddress - The address of the element.
4460
+ * @param {string} pAttribute - The attribute to set.
4461
+ */},{key:"customSetAttributeFunction",value:function customSetAttributeFunction(pAddress,pAttribute,pContent){if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an SET ATTRIBUTE to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Attribute:pAttribute,Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an SET ATTRIBUTE to Address -> [".concat(pAddress,"]"),{Attribute:pAttribute,Content:pContent});}return'';}}]);}();module.exports=PictEnvironmentLog;},{}],170:[function(require,module,exports){/**
4192
4462
  * Pict browser shim loader with Object statefulness for the environement
4193
4463
  * @author <steven@velozo.com>
4194
4464
  *
@@ -4210,7 +4480,49 @@ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".c
4210
4480
  * 4. Pass your pict through this to get the custom functions mapped into the ContentAssignment service:
4211
4481
  * let tmpMockEnvironment = new libPictEnvironmentLog(_Pict, tmpContentMap);
4212
4482
  * 5. Now you can use your pict as normal, and it will log all of the read/write events out and keep a log of when they occurred.
4213
- */var PictEnvironmentObject=/*#__PURE__*/function(){function PictEnvironmentObject(pPict,pContentMap){_classCallCheck2(this,PictEnvironmentObject);this.contentMap=_typeof(pContentMap)=='object'?pContentMap:{};this.contentMap._ATTRIBUTE_MAP={};this.contentMap._CLASS_MAP={};this.pict=pPict;// If this is set to false, we won't keep an array-based log of every read, assignment, append or get.
4483
+ */var PictEnvironmentObject=/*#__PURE__*/function(){/**
4484
+ * @typedef {import('../Pict')} Pict
4485
+ */ /**
4486
+ * @param {Pict} pPict - The pict object to attach the custom read/write functions to.q
4487
+ * @param {Map<String, any>} pContentMap - The content map to use for custom reads.
4488
+ */function PictEnvironmentObject(pPict,pContentMap){_classCallCheck2(this,PictEnvironmentObject);this.contentMap=_typeof(pContentMap)=='object'?pContentMap:{};this.contentMap._ATTRIBUTE_MAP={};this.contentMap._CLASS_MAP={};this.pict=pPict;// If this is set to false, we won't keep an array-based log of every read, assignment, append or get.
4214
4489
  this.truncateContentLength=256;this.storeEventLog=true;// Where to store each event type
4215
- this.eventLog={};this.eventLog.GetElement=[];this.eventLog.Read=[];this.eventLog.Prepend=[];this.eventLog.Append=[];this.eventLog.Assign=[];this.eventLog.ReadAttribute=[];this.eventLog.SetAttribute=[];this.eventLog.RemoveAttribute=[];this.eventLog.ReadClass=[];this.eventLog.SetClass=[];this.eventLog.RemoveClass=[];this.pict.ContentAssignment.customGetElementFunction=this.customGetElementFunction.bind(this);this.pict.ContentAssignment.customReadFunction=this.customReadFunction.bind(this);this.pict.ContentAssignment.customAppendFunction=this.customAppendFunction.bind(this);this.pict.ContentAssignment.customPrependFunction=this.customPrependFunction.bind(this);this.pict.ContentAssignment.customAssignFunction=this.customAssignFunction.bind(this);this.pict.ContentAssignment.customReadAttributeFunction=this.customReadAttributeFunction.bind(this);this.pict.ContentAssignment.customSetAttributeFunction=this.customSetAttributeFunction.bind(this);this.pict.ContentAssignment.customRemoveAttributeFunction=this.customRemoveAttributeFunction.bind(this);this.pict.ContentAssignment.customReadClassFunction=this.customReadClassFunction.bind(this);this.pict.ContentAssignment.customSetClassFunction=this.customSetClassFunction.bind(this);this.pict.ContentAssignment.customRemoveClassFunction=this.customRemoveClassFunction.bind(this);}return _createClass2(PictEnvironmentObject,[{key:"createEventLogEntry",value:function createEventLogEntry(pAddress,pContent){var tmpContent=typeof pContent=='undefined'?'':pContent;return{TimeStamp:this.pict.log.getTimeStamp(),Hash:pAddress,Content:tmpContent};}},{key:"customGetElementFunction",value:function customGetElementFunction(pAddress){if(this.storeEventLog){this.eventLog.GetElement.push(this.createEventLogEntry(pAddress));}this.pict.log.info("Mocking an GET of Address -> [".concat(pAddress,"]"));return'';}},{key:"customReadFunction",value:function customReadFunction(pAddress){if(this.storeEventLog){this.eventLog.Read.push(this.createEventLogEntry(pAddress));}this.pict.log.info("Mocking an READ from Address -> [".concat(pAddress,"]"));if(this.contentMap.hasOwnProperty(pAddress)){// The data is in the content map!
4216
- return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".concat(pAddress," did not find a value in the content map."));return'';}},{key:"customAppendFunction",value:function customAppendFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:this.contentMap[pAddress]+pContent;if(this.storeEventLog){this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customPrependFunction",value:function customPrependFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:pContent+this.contentMap[pAddress];if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customAssignFunction",value:function customAssignFunction(pAddress,pContent){this.contentMap[pAddress]=pContent;if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"initializeAttributeMapLocation",value:function initializeAttributeMapLocation(pAddress,pAttribute){if(!this.contentMap._ATTRIBUTE_MAP.hasOwnProperty(pAddress)){this.contentMap._ATTRIBUTE_MAP[pAddress]={};}if(!this.contentMap._ATTRIBUTE_MAP[pAddress].hasOwnProperty(pAttribute)){this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=false;}}},{key:"initializeClassMapLocation",value:function initializeClassMapLocation(pAddress){if(!this.contentMap._CLASS_MAP.hasOwnProperty(pAddress)){this.contentMap._CLASS_MAP[pAddress]=[];}}},{key:"customReadAttributeFunction",value:function customReadAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);var tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ATTRIBUTE READ for Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ATTRIBUTE READ for Address -> [".concat(pAddress,"]::[").concat(pAttribute,"]"),{Content:tmpContent});}return tmpContent;}},{key:"customSetAttributeFunction",value:function customSetAttributeFunction(pAddress,pAttribute,pValue){this.initializeAttributeMapLocation(pAddress,pAttribute);this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=pValue;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(pValue.length>this.truncateContentLength){this.pict.log.info("Mocking an ATTRIBUTE SET for Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pValue.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ATTRIBUTE SET for Address -> [".concat(pAddress,"]::[").concat(pAttribute,"]"),{Content:pValue});}return pValue;}},{key:"customRemoveAttributeFunction",value:function customRemoveAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);var tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ATTRIBUTE REMOVE for Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ATTRIBUTE REMOVE for Address -> [".concat(pAddress,"]::[").concat(pAttribute,"]"),{Content:tmpContent});}delete this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];return true;}},{key:"customReadClassFunction",value:function customReadClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);var tmpContent=this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)>-1;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info("Mocking an CLASS READ for Address -> [".concat(pAddress,"]::[").concat(pClass,"]"),{Content:tmpContent});return tmpContent;}},{key:"customSetClassFunction",value:function customSetClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);var tmpContent=this.contentMap._CLASS_MAP[pAddress];if(!this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)>-1){this.contentMap._CLASS_MAP[pAddress].push(pClass);}if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info("Mocking an CLASS SET for Address -> [".concat(pAddress,"]::[").concat(pClass,"]"),{Content:tmpContent.join(' ')});return tmpContent;}},{key:"customRemoveClassFunction",value:function customRemoveClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);var tmpContent=this.contentMap._CLASS_MAP[pAddress];this.contentMap._CLASS_MAP[pAddress].splice(pClass);if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info("Mocking an CLASS REMOVE for Address -> [".concat(pAddress,"]::[").concat(pClass,"]"),{Content:tmpContent.join(' ')});return tmpContent;}}]);}();module.exports=PictEnvironmentObject;},{}]},{},[167])(167);});
4490
+ this.eventLog={};this.eventLog.GetElement=[];this.eventLog.Read=[];this.eventLog.Prepend=[];this.eventLog.Append=[];this.eventLog.Assign=[];this.eventLog.ReadAttribute=[];this.eventLog.SetAttribute=[];this.eventLog.RemoveAttribute=[];this.eventLog.ReadClass=[];this.eventLog.SetClass=[];this.eventLog.RemoveClass=[];this.pict.ContentAssignment.customGetElementFunction=this.customGetElementFunction.bind(this);this.pict.ContentAssignment.customReadFunction=this.customReadFunction.bind(this);this.pict.ContentAssignment.customAppendFunction=this.customAppendFunction.bind(this);this.pict.ContentAssignment.customPrependFunction=this.customPrependFunction.bind(this);this.pict.ContentAssignment.customAssignFunction=this.customAssignFunction.bind(this);this.pict.ContentAssignment.customReadAttributeFunction=this.customReadAttributeFunction.bind(this);this.pict.ContentAssignment.customSetAttributeFunction=this.customSetAttributeFunction.bind(this);this.pict.ContentAssignment.customRemoveAttributeFunction=this.customRemoveAttributeFunction.bind(this);this.pict.ContentAssignment.customReadClassFunction=this.customReadClassFunction.bind(this);this.pict.ContentAssignment.customSetClassFunction=this.customSetClassFunction.bind(this);this.pict.ContentAssignment.customRemoveClassFunction=this.customRemoveClassFunction.bind(this);}return _createClass2(PictEnvironmentObject,[{key:"createEventLogEntry",value:function createEventLogEntry(pAddress,pContent){var tmpContent=typeof pContent=='undefined'?'':pContent;return{TimeStamp:this.pict.log.getTimeStamp(),Hash:pAddress,Content:tmpContent};}},{key:"customGetElementFunction",value:function customGetElementFunction(pAddress){if(this.storeEventLog){this.eventLog.GetElement.push(this.createEventLogEntry(pAddress));}this.pict.log.info("Mocking an GET of Address -> [".concat(pAddress,"]"));return'';}},{key:"customReadFunction",value:function customReadFunction(pAddress){if(this.storeEventLog){this.eventLog.Read.push(this.createEventLogEntry(pAddress));}this.pict.log.info("Mocking an READ from Address -> [".concat(pAddress,"]"));if(pAddress in this.contentMap){// The data is in the content map!
4491
+ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".concat(pAddress," did not find a value in the content map."));return'';}},{key:"customAppendFunction",value:function customAppendFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:this.contentMap[pAddress]+pContent;if(this.storeEventLog){this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customPrependFunction",value:function customPrependFunction(pAddress,pContent){this.contentMap[pAddress]=typeof this.contentMap[pAddress]=='undefined'?pContent:pContent+this.contentMap[pAddress];if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customAssignFunction",value:function customAssignFunction(pAddress,pContent){this.contentMap[pAddress]=pContent;if(this.storeEventLog){this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));}if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"initializeAttributeMapLocation",value:function initializeAttributeMapLocation(pAddress,pAttribute){if(!(pAddress in this.contentMap._ATTRIBUTE_MAP)){this.contentMap._ATTRIBUTE_MAP[pAddress]={};}if(!(pAttribute in this.contentMap._ATTRIBUTE_MAP[pAddress])){this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=false;}}},{key:"initializeClassMapLocation",value:function initializeClassMapLocation(pAddress){if(!(pAddress in this.contentMap._CLASS_MAP)){this.contentMap._CLASS_MAP[pAddress]=[];}}},{key:"customReadAttributeFunction",value:function customReadAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);var tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ATTRIBUTE READ for Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ATTRIBUTE READ for Address -> [".concat(pAddress,"]::[").concat(pAttribute,"]"),{Content:tmpContent});}return tmpContent;}},{key:"customSetAttributeFunction",value:function customSetAttributeFunction(pAddress,pAttribute,pValue){this.initializeAttributeMapLocation(pAddress,pAttribute);this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute]=pValue;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(pValue.length>this.truncateContentLength){this.pict.log.info("Mocking an ATTRIBUTE SET for Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pValue.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ATTRIBUTE SET for Address -> [".concat(pAddress,"]::[").concat(pAttribute,"]"),{Content:pValue});}return pValue;}},{key:"customRemoveAttributeFunction",value:function customRemoveAttributeFunction(pAddress,pAttribute){this.initializeAttributeMapLocation(pAddress,pAttribute);var tmpContent=this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pAttribute));}if(tmpContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ATTRIBUTE REMOVE for Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:tmpContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ATTRIBUTE REMOVE for Address -> [".concat(pAddress,"]::[").concat(pAttribute,"]"),{Content:tmpContent});}delete this.contentMap._ATTRIBUTE_MAP[pAddress][pAttribute];return true;}},{key:"customReadClassFunction",value:function customReadClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);var tmpContent=this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)>-1;if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info("Mocking an CLASS READ for Address -> [".concat(pAddress,"]::[").concat(pClass,"]"),{Content:tmpContent});return tmpContent;}},{key:"customSetClassFunction",value:function customSetClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);var tmpContent=this.contentMap._CLASS_MAP[pAddress];if(!this.contentMap._CLASS_MAP[pAddress].indexOf(pClass)>-1){this.contentMap._CLASS_MAP[pAddress].push(pClass);}if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info("Mocking an CLASS SET for Address -> [".concat(pAddress,"]::[").concat(pClass,"]"),{Content:tmpContent.join(' ')});return tmpContent;}},{key:"customRemoveClassFunction",value:function customRemoveClassFunction(pAddress,pClass){this.initializeClassMapLocation(pAddress);var tmpContent=this.contentMap._CLASS_MAP[pAddress];this.contentMap._CLASS_MAP[pAddress].splice(pClass);if(this.storeEventLog){this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pClass));}this.pict.log.info("Mocking an CLASS REMOVE for Address -> [".concat(pAddress,"]::[").concat(pClass,"]"),{Content:tmpContent.join(' ')});return tmpContent;}}]);}();module.exports=PictEnvironmentObject;},{}],171:[function(require,module,exports){var libPictTemplate=require('../Pict-Template.js');var PictTemplateProvider=/*#__PURE__*/function(_libPictTemplate){/**
4492
+ * @param {Object} pFable - The Fable Framework instance
4493
+ * @param {Object} pOptions - The options for the service
4494
+ * @param {String} pServiceHash - The hash of the service
4495
+ */function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this76;_classCallCheck2(this,PictTemplateProvider);_this76=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this76.addPattern('{~Data:','~}');_this76.addPattern('{~D:','~}');return _this76;}_inherits(PictTemplateProvider,_libPictTemplate);return _createClass2(PictTemplateProvider,[{key:"render",value:function render(pHash,pRecord,pContextArray){var tmpHash=pHash.trim();var tmpRecord=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray);}if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;}}]);}(libPictTemplate);module.exports=PictTemplateProvider;/*
4496
+ # DEAR DEAD CODE DIARY:
4497
+
4498
+ ```javascript
4499
+ //{~Data:AppData.Some.Value.to.Render~}
4500
+ let fDataRender = (pHash, pData, pContextArray)=>
4501
+ {
4502
+ let tmpHash = pHash.trim();
4503
+ let tmpData = (typeof(pData) === 'object') ? pData : {};
4504
+
4505
+ if (this.LogNoisiness > 4)
4506
+ {
4507
+ this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`, tmpData);
4508
+ }
4509
+ else if (this.LogNoisiness > 3)
4510
+ {
4511
+ this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`);
4512
+ }
4513
+
4514
+ let tmpValue = '';
4515
+ if (tmpHash != null)
4516
+ {
4517
+ tmpValue = this.resolveStateFromAddress(tmpHash, tmpData, pContextArray);
4518
+ }
4519
+ if ((tmpValue == null) || (tmpValue == 'undefined') || (typeof(tmpValue) == 'undefined'))
4520
+ {
4521
+ return '';
4522
+ }
4523
+ return tmpValue;
4524
+ };
4525
+ this.MetaTemplate.addPattern('{~D:', '~}', fDataRender);
4526
+ this.MetaTemplate.addPattern('{~Data:', '~}', fDataRender);
4527
+ ```
4528
+ */},{"../Pict-Template.js":167}]},{},[168])(168);});