fable 3.0.130 → 3.0.132

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.
@@ -1149,7 +1149,10 @@ return false;}// Now see if the function has arguments.
1149
1149
  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)
1150
1150
  return pObject[tmpFunctionAddress].apply(pObject);}else{var tmpArgumentValues=[];var _tmpRootObject2=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
1151
1151
  for(var _i4=0;_i4<tmpFunctionArguments.length;_i4++){// Resolve the values for each subsequent entry
1152
- tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[_i4]));}return pObject[tmpFunctionAddress].apply(pObject,tmpArgumentValues);}}// Boxed elements look like this:
1152
+ // Check if the argument value is a string literal or a reference to an address
1153
+ if(tmpFunctionArguments[_i4].length>=2&&(tmpFunctionArguments[_i4].charAt(0)=='"'||tmpFunctionArguments[_i4].charAt(0)=="'"||tmpFunctionArguments[_i4].charAt(0)=="`")&&(tmpFunctionArguments[_i4].charAt(tmpFunctionArguments[_i4].length-1)=='"'||tmpFunctionArguments[_i4].charAt(tmpFunctionArguments[_i4].length-1)=="'"||tmpFunctionArguments[_i4].charAt(tmpFunctionArguments[_i4].length-1)=="`")){// This is a string literal
1154
+ tmpArgumentValues.push(tmpFunctionArguments[_i4].substring(1,tmpFunctionArguments[_i4].length-1));}else{// This is a hash address
1155
+ tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[_i4]));}}return pObject[tmpFunctionAddress].apply(pObject,tmpArgumentValues);}}// Boxed elements look like this:
1153
1156
  // MyValues[10]
1154
1157
  // MyValues['Name']
1155
1158
  // MyValues["Age"]
@@ -1209,7 +1212,10 @@ return false;}// Now see if the function has arguments.
1209
1212
  var _tmpFunctionArguments=_MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(tmpSubObjectName.substring(_tmpFunctionAddress2.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)
1210
1213
  return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject),tmpNewAddress,tmpParentAddress,tmpRootObject);}else{var _tmpArgumentValues=[];var _tmpRootObject3=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
1211
1214
  for(var _i6=0;_i6<_tmpFunctionArguments.length;_i6++){// Resolve the values for each subsequent entry
1212
- _tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3,_tmpFunctionArguments[_i6]));}return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject,_tmpArgumentValues),tmpNewAddress,tmpParentAddress,_tmpRootObject3);}}// Boxed elements look like this:
1215
+ // Check if the argument value is a string literal or a reference to an address
1216
+ if(_tmpFunctionArguments[_i6].length>=2&&(_tmpFunctionArguments[_i6].charAt(0)=='"'||_tmpFunctionArguments[_i6].charAt(0)=="'"||_tmpFunctionArguments[_i6].charAt(0)=="`")&&(_tmpFunctionArguments[_i6].charAt(_tmpFunctionArguments[_i6].length-1)=='"'||_tmpFunctionArguments[_i6].charAt(_tmpFunctionArguments[_i6].length-1)=="'"||_tmpFunctionArguments[_i6].charAt(_tmpFunctionArguments[_i6].length-1)=="`")){// This is a string literal
1217
+ _tmpArgumentValues.push(_tmpFunctionArguments[_i6].substring(1,_tmpFunctionArguments[_i6].length-1));}else{// This is a hash address
1218
+ _tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3,_tmpFunctionArguments[_i6]));}}return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject,_tmpArgumentValues),tmpNewAddress,tmpParentAddress,_tmpRootObject3);}}// Boxed elements look like this:
1213
1219
  // MyValues[42]
1214
1220
  // MyValues['Color']
1215
1221
  // MyValues["Weight"]
@@ -3630,7 +3636,7 @@ var tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.
3630
3636
  * Precedent Meta-Templating
3631
3637
  * @author Steven Velozo <steven@velozo.com>
3632
3638
  * @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
3633
- */var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceMetaTemplate,_libFableServiceBase7);function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this33;_classCallCheck2(this,FableServiceMetaTemplate);_this33=_callSuper(this,FableServiceMetaTemplate,[pFable,pOptions,pServiceHash]);_this33.serviceType='MetaTemplate';_this33.WordTree=new libWordTree();_this33.StringParser=new libStringParser(_this33.fable);_this33.ParseTree=_this33.WordTree.ParseTree;return _this33;}_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);}/**
3639
+ */var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceMetaTemplate,_libFableServiceBase7);function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this33;_classCallCheck2(this,FableServiceMetaTemplate);_this33=_callSuper(this,FableServiceMetaTemplate,[pFable,pOptions,pServiceHash]);_this33.serviceType='MetaTemplate';_this33.WordTree=new libWordTree();_this33.StringParser=new libStringParser(_this33.fable);_this33.ParseTree=_this33.WordTree.ParseTree;return _this33;}_createClass2(FableServiceMetaTemplate,[{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,pParser,pParserContext){return this.WordTree.addPattern(pPatternStart,pPatternEnd,pParser,pParserContext);}},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise,pParserContext){return this.WordTree.addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise,pParserContext);}/**
3634
3640
  * Parse a string with the existing parse tree
3635
3641
  * @method parseString
3636
3642
  * @param {string} pString - The string to parse
@@ -3675,22 +3681,21 @@ if(pParserState.PatternMatch){// If the pattern is still matching the start and
3675
3681
  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.
3676
3682
  pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
3677
3683
  this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
3678
- if('Parse'in pParserState.Pattern&&(!pParserState.Pattern.isAsync||pParserState.Pattern.isBoth)){// Run the function
3679
- 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.
3684
+ // Run the function
3685
+ 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 if(pCharacter in pParserState.PatternStartNode.PatternEnd){// We broke out of the end -- see if this is a new start of the end.
3680
3686
  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.
3681
3687
  pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
3682
3688
  pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
3683
- 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
3684
- 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.
3689
+ if('Parse'in pParserState.Pattern){// Run the t*mplate function
3690
+ 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.
3685
3691
  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)....
3686
3692
  if(!pParserState.PatternMatch){// This may be the start of a new pattern....
3687
3693
  if(pCharacter in pParserState.ParseTree){// ... assign the root node as the matched node.
3688
3694
  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 _this34=this;// ... this is the end of a pattern, cut off the end tag and parse it.
3689
3695
  // Trim the start and end tags off the output buffer now
3690
- if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){// Run the function
3691
- 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){_this34.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this34.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){_this34.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this34.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
3692
- 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){_this34.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this34.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){_this34.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this34.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}}else{// Run the t*mplate function
3693
- 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();}}/**
3696
+ if(pParserState.Pattern.isAsync){// Run the function
3697
+ var tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(tmpFunctionContext){return pParserState.Pattern.ParseAsync.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){_this34.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this34.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){_this34.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this34.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}}else{// Run the t*mplate function
3698
+ var _tmpFunctionContext2='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(_tmpFunctionContext2){pParserState.OutputBuffer=pParserState.Pattern.Parse.call(_tmpFunctionContext2,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();}}/**
3694
3699
  * Parse a character in the buffer.
3695
3700
  * @method parseCharacterAsync
3696
3701
  * @param {string} pCharacter - The character to append
@@ -3746,28 +3751,23 @@ _this35.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserSta
3746
3751
  * @param {string} pPattern - The string to add to the tree
3747
3752
  * @returns {Object} The resulting leaf node that was added (or found)
3748
3753
  * @private
3749
- */},{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
3750
- * @method addPattern
3754
+ */},{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 with both function parameter types
3755
+ * @method addPatternAll
3751
3756
  * @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
3752
3757
  * @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
3753
3758
  * @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.
3754
- * @return {bool} True if adding the pattern was successful
3755
- */},{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
3756
- 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 _i27=0;_i27<tmpPatternEnd.length;_i27++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i27],_i27);}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
3757
- if(pParserContext){tmpLeaf.ParserContext=pParserContext;}return tmpLeaf;}/** Add a Pattern to the Parse Tree
3758
- * @method addPatternAsync
3759
- * @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
3760
- * @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
3761
3759
  * @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.
3762
- * @return {bool} True if adding the pattern was successful
3763
- */},{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
3764
- * @method addPatternBoth
3760
+ * @param {Object} pParserContext - The context to pass to the parser function
3761
+ * @return {Object} The leaf parser from the tree
3762
+ */},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,fParser,fParserAsync,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
3763
+ 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 _i27=0;_i27<tmpPatternEnd.length;_i27++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i27],_i27);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(pHash,pData){return fParser;}:function(pHash,pData){return pHash;};tmpLeaf.ParseAsync=typeof fParserAsync==='function'?fParserAsync:typeof fParserAsync==='string'?function(pHash,pData,fCallback){return fCallback(null,fParserAsync);}:function(pHash,pData,fCallback){return fCallback(null,tmpLeaf.Parse(pHash,pData));};// A "this" for every object
3764
+ if(pParserContext){tmpLeaf.ParserContext=pParserContext;}tmpLeaf.isAsync=true;return tmpLeaf;}/** Add a Pattern to the Parse Tree with both function parameter types
3765
+ * @method addPatternAll
3765
3766
  * @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
3766
3767
  * @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
3767
3768
  * @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.
3768
- * @return {bool} True if adding the pattern was successful
3769
- */},{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.
3770
- tmpLeaf.ParseAsync=fParserAsync;}}}]);return WordTree;}();module.exports=WordTree;},{}],148:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":0},"Steps":[],"Errors":[],"Log":[]};},{}],149:[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){_inherits(FableOperation,_libFableServiceBase8);function FableOperation(pFable,pOptions,pServiceHash){var _this36;_classCallCheck2(this,FableOperation);_this36=_callSuper(this,FableOperation,[pFable,pOptions,pServiceHash]);// Timestamps will just be the long ints
3769
+ * @param {Object} pParserContext - The context to pass to the parser function
3770
+ */},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);return WordTree;}();module.exports=WordTree;},{}],148:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":0},"Steps":[],"Errors":[],"Log":[]};},{}],149:[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){_inherits(FableOperation,_libFableServiceBase8);function FableOperation(pFable,pOptions,pServiceHash){var _this36;_classCallCheck2(this,FableOperation);_this36=_callSuper(this,FableOperation,[pFable,pOptions,pServiceHash]);// Timestamps will just be the long ints
3771
3771
  _this36.timeStamps={};_this36.serviceType='PhasedOperation';_this36.state=JSON.parse(_OperationStatePrototypeString);_this36.stepMap={};_this36.stepFunctions={};// Match the service instantiation to the operation.
3772
3772
  _this36.state.Metadata.Hash=_this36.Hash;_this36.state.Metadata.UUID=_this36.UUID;_this36.state.Metadata.Name=typeof _this36.options.Name=='string'?_this36.options.Name:"Unnamed Operation ".concat(_this36.state.Metadata.UUID);_this36.name=_this36.state.Metadata.Name;_this36.progressTrackerSet=_this36.fable.instantiateServiceProviderWithoutRegistration('ProgressTrackerSet');_this36.state.OverallProgressTracker=_this36.progressTrackerSet.createProgressTracker("Overall-".concat(_this36.state.Metadata.UUID));// This is here to use the pass-through logging functions in the operation itself.
3773
3773
  _this36.log=_assertThisInitialized(_this36);return _this36;}_createClass2(FableOperation,[{key:"execute",value:function execute(fExecutionCompleteCallback){var _this37=this;// TODO: Should the same operation be allowed to execute more than one time?