fable 3.0.48 → 3.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +1 -1
- package/dist/fable.compatible.js +61 -52
- package/dist/fable.compatible.min.js +5 -5
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +61 -52
- package/dist/fable.min.js +4 -4
- package/dist/fable.min.js.map +1 -1
- package/gulpfile-config.json +2 -2
- package/gulpfile.js +2 -2
- package/package.json +1 -1
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-StringParser.js +222 -128
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-WordTree.js +62 -39
- package/test/MetaTemplating_tests.js +0 -3
package/.browserslistrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
since 2018
|
package/dist/fable.compatible.js
CHANGED
|
@@ -2666,7 +2666,7 @@ _this20.StringParser=new libStringParser(_this20.fable.defaultServices.Utility.e
|
|
|
2666
2666
|
* @param {object} pData - Data to pass in as the second argument
|
|
2667
2667
|
* @return {string} The result from the parser
|
|
2668
2668
|
*/},{key:"parseString",value:function parseString(pString,pData,fCallback){return this.StringParser.parseString(pString,this.ParseTree,pData,fCallback);}}]);return FableServiceMetaTemplate;}(libFableServiceBase);module.exports=FableServiceMetaTemplate;},{"../Fable-ServiceManager.js":92,"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":98,"./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js":99}],98:[function(require,module,exports){/**
|
|
2669
|
-
*
|
|
2669
|
+
* String Parser
|
|
2670
2670
|
* @author Steven Velozo <steven@velozo.com>
|
|
2671
2671
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
2672
2672
|
*/var StringParser=/*#__PURE__*/function(){/**
|
|
@@ -2677,16 +2677,7 @@ _this20.StringParser=new libStringParser(_this20.fable.defaultServices.Utility.e
|
|
|
2677
2677
|
* @param {Object} pParseTree - A node on the parse tree to begin parsing from (usually root)
|
|
2678
2678
|
* @return {Object} A new parser state object for running a character parser on
|
|
2679
2679
|
* @private
|
|
2680
|
-
*/_createClass2(StringParser,[{key:"newParserState",value:function newParserState(pParseTree){return{ParseTree:pParseTree,Asynchronous:false,Output:'',OutputBuffer:'',Pattern:
|
|
2681
|
-
* Assign a node of the parser tree to be the next potential match.
|
|
2682
|
-
* If the node has a PatternEnd property, it is a valid match and supercedes the last valid match (or becomes the initial match).
|
|
2683
|
-
* @method assignNode
|
|
2684
|
-
* @param {Object} pNode - A node on the parse tree to assign
|
|
2685
|
-
* @param {Object} pParserState - The state object for the current parsing task
|
|
2686
|
-
* @private
|
|
2687
|
-
*/},{key:"assignNode",value:function assignNode(pNode,pParserState){pParserState.PatternMatch=pNode;// If the pattern has a END we can assume it has a parse function...
|
|
2688
|
-
if(pParserState.PatternMatch.hasOwnProperty('PatternEnd')){// ... this is the legitimate start of a pattern.
|
|
2689
|
-
pParserState.Pattern=pParserState.PatternMatch;}}/**
|
|
2680
|
+
*/_createClass2(StringParser,[{key:"newParserState",value:function newParserState(pParseTree){return{ParseTree:pParseTree,Asynchronous:false,Output:'',OutputBuffer:'',Pattern:{},PatternMatch:false,PatternMatchEnd:false};}/**
|
|
2690
2681
|
* Append a character to the output buffer in the parser state.
|
|
2691
2682
|
* This output buffer is used when a potential match is being explored, or a match is being explored.
|
|
2692
2683
|
* @method appendOutputBuffer
|
|
@@ -2698,44 +2689,57 @@ pParserState.Pattern=pParserState.PatternMatch;}}/**
|
|
|
2698
2689
|
* @method flushOutputBuffer
|
|
2699
2690
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2700
2691
|
* @private
|
|
2701
|
-
*/},{key:"flushOutputBuffer",value:function flushOutputBuffer(pParserState){pParserState.Output+=pParserState.OutputBuffer;pParserState.OutputBuffer='';}
|
|
2702
|
-
|
|
2703
|
-
|
|
2692
|
+
*/},{key:"flushOutputBuffer",value:function flushOutputBuffer(pParserState){pParserState.Output+=pParserState.OutputBuffer;pParserState.OutputBuffer='';}},{key:"resetOutputBuffer",value:function resetOutputBuffer(pParserState){// Flush the output buffer.
|
|
2693
|
+
this.flushOutputBuffer(pParserState);// End pattern mode
|
|
2694
|
+
pParserState.Pattern=false;pParserState.PatternStartNode=false;pParserState.StartPatternMatchComplete=false;pParserState.EndPatternMatchBegan=false;pParserState.PatternMatch=false;return true;}/**
|
|
2695
|
+
* Parse a character in the buffer.
|
|
2696
|
+
* @method parseCharacter
|
|
2697
|
+
* @param {string} pCharacter - The character to append
|
|
2704
2698
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2705
2699
|
* @private
|
|
2706
|
-
*/},{key:"
|
|
2707
|
-
//
|
|
2708
|
-
if(pParserState.Pattern.
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
pParserState.
|
|
2713
|
-
//
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
pParserState.Pattern
|
|
2717
|
-
this.
|
|
2718
|
-
|
|
2700
|
+
*/},{key:"parseCharacter",value:function parseCharacter(pCharacter,pParserState,pData){// If we are already in a pattern match traversal
|
|
2701
|
+
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
2702
|
+
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.
|
|
2703
|
+
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
2704
|
+
this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
|
|
2705
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){// Run the function
|
|
2706
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);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.
|
|
2707
|
+
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.
|
|
2708
|
+
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
2709
|
+
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
|
|
2710
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){if(pParserState.Pattern.isAsync){this.log.error("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
|
|
2711
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);return this.resetOutputBuffer(pParserState);}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
2712
|
+
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)....
|
|
2713
|
+
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
2714
|
+
if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
|
|
2715
|
+
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}/**
|
|
2719
2716
|
* Parse a character in the buffer.
|
|
2720
2717
|
* @method parseCharacter
|
|
2721
2718
|
* @param {string} pCharacter - The character to append
|
|
2722
2719
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2723
2720
|
* @private
|
|
2724
|
-
*/},{key:"
|
|
2725
|
-
if(
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
else if(pParserState.
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2721
|
+
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback){var _this21=this;// If we are already in a pattern match traversal
|
|
2722
|
+
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
2723
|
+
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.
|
|
2724
|
+
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
2725
|
+
this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
|
|
2726
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2727
|
+
// Trim the start and end tags off the output buffer now
|
|
2728
|
+
if(pParserState.Pattern.isAsync){// Run the function
|
|
2729
|
+
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){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this21.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
2730
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return fCallback();}}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
2731
|
+
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.
|
|
2732
|
+
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
2733
|
+
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
|
|
2734
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2735
|
+
// Trim the start and end tags off the output buffer now
|
|
2736
|
+
if(pParserState.Pattern.isAsync){// Run the function
|
|
2737
|
+
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){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this21.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
2738
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return fCallback();}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
2739
|
+
this.resetOutputBuffer(pParserState);return fCallback();}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
2740
|
+
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
2741
|
+
if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
|
|
2742
|
+
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return fCallback();}/**
|
|
2739
2743
|
* Parse a string for matches, and process any template segments that occur.
|
|
2740
2744
|
* @method parseString
|
|
2741
2745
|
* @param {string} pString - The string to parse.
|
|
@@ -2744,9 +2748,9 @@ else{pParserState.Output+=pCharacter;}return fCallback(null);}/**
|
|
|
2744
2748
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
2745
2749
|
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback){var _this22=this;if(typeof fCallback!=='function'){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
|
|
2746
2750
|
this.parseCharacter(pString[i],tmpParserState,pData,fCallback);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
2747
|
-
var _tmpParserState=this.newParserState(pParseTree);this.eachLimit(pString,1,function(pCharacter,fCharacterCallback){_this22.parseCharacterAsync(pCharacter,_tmpParserState,pData,fCharacterCallback);},function(pError){// Flush the remaining data
|
|
2751
|
+
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;this.eachLimit(pString,1,function(pCharacter,fCharacterCallback){_this22.parseCharacterAsync(pCharacter,_tmpParserState,pData,fCharacterCallback);},function(pError){// Flush the remaining data
|
|
2748
2752
|
_this22.flushOutputBuffer(_tmpParserState);fCallback(pError,_tmpParserState.Output);});}}}]);return StringParser;}();module.exports=StringParser;},{}],99:[function(require,module,exports){/**
|
|
2749
|
-
*
|
|
2753
|
+
* Word Tree
|
|
2750
2754
|
* @author Steven Velozo <steven@velozo.com>
|
|
2751
2755
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
2752
2756
|
*/var WordTree=/*#__PURE__*/function(){/**
|
|
@@ -2756,24 +2760,29 @@ _this22.flushOutputBuffer(_tmpParserState);fCallback(pError,_tmpParserState.Outp
|
|
|
2756
2760
|
* @method addChild
|
|
2757
2761
|
* @param {Object} pTree - A parse tree to push the characters into
|
|
2758
2762
|
* @param {string} pPattern - The string to add to the tree
|
|
2759
|
-
* @param {number} pIndex - The index of the character in the pattern
|
|
2760
2763
|
* @returns {Object} The resulting leaf node that was added (or found)
|
|
2761
2764
|
* @private
|
|
2762
|
-
*/_createClass2(WordTree,[{key:"addChild",value:function addChild(pTree,pPattern
|
|
2765
|
+
*/_createClass2(WordTree,[{key:"addChild",value:function addChild(pTree,pPattern){if(!pTree.hasOwnProperty(pPattern)){pTree[pPattern]={};}return pTree[pPattern];}/**
|
|
2766
|
+
* Add a child character to a Parse Tree PatternEnd subtree
|
|
2767
|
+
* @method addChild
|
|
2768
|
+
* @param {Object} pTree - A parse tree to push the characters into
|
|
2769
|
+
* @param {string} pPattern - The string to add to the tree
|
|
2770
|
+
* @returns {Object} The resulting leaf node that was added (or found)
|
|
2771
|
+
* @private
|
|
2772
|
+
*/},{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
|
|
2763
2773
|
* @method addPattern
|
|
2764
2774
|
* @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
|
|
2765
2775
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
2766
|
-
* @param {
|
|
2776
|
+
* @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.
|
|
2767
2777
|
* @return {bool} True if adding the pattern was successful
|
|
2768
|
-
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,
|
|
2769
|
-
for(var i=0;i<pPatternStart.length;i++)tmpLeaf=this.addChild(tmpLeaf,pPatternStart,i);tmpLeaf.
|
|
2778
|
+
*/},{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
|
|
2779
|
+
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 _i10=0;_i10<tmpPatternEnd.length;_i10++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i10],_i10);}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
|
|
2770
2780
|
* @method addPattern
|
|
2771
2781
|
* @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
|
|
2772
2782
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
2773
|
-
* @param {
|
|
2783
|
+
* @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.
|
|
2774
2784
|
* @return {bool} True if adding the pattern was successful
|
|
2775
|
-
*/},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,
|
|
2776
|
-
for(var i=0;i<pPatternStart.length;i++)tmpLeaf=this.addChild(tmpLeaf,pPatternStart,i);tmpLeaf.PatternStart=pPatternStart;tmpLeaf.PatternEnd=typeof pPatternEnd==='string'&&pPatternEnd.length>0?pPatternEnd:pPatternStart;tmpLeaf.Parse=typeof pParserAsync==='function'?pParserAsync:typeof pParserAsync==='string'?function(pHash,pData,fCallback){fCallback(pParserPromise);}:function(pHash,pData,fCallback){return fCallback(pHash);};tmpLeaf.isAsync=true;return true;}}]);return WordTree;}();module.exports=WordTree;},{}],100:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Title":"","Summary":"","Version":0},"Status":{"Completed":false,"CompletionProgress":0,"CompletionTimeElapsed":0,"Steps":1,"StepsCompleted":0,"StartTime":0,"EndTime":0},"Errors":[],"Log":[]};},{}],101:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableOperation,_libFableServiceBase3);var _super13=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,FableOperation);_this23=_super13.call(this,pFable,pOptions,pServiceHash);_this23.serviceType='PhasedOperation';_this23.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
2785
|
+
*/},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParser){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}]);return WordTree;}();module.exports=WordTree;},{}],100:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Title":"","Summary":"","Version":0},"Status":{"Completed":false,"CompletionProgress":0,"CompletionTimeElapsed":0,"Steps":1,"StepsCompleted":0,"StartTime":0,"EndTime":0},"Errors":[],"Log":[]};},{}],101:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableOperation,_libFableServiceBase3);var _super13=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,FableOperation);_this23=_super13.call(this,pFable,pOptions,pServiceHash);_this23.serviceType='PhasedOperation';_this23.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
2777
2786
|
_this23.state.Metadata.Hash=_this23.Hash;_this23.state.Metadata.UUID=_this23.UUID;_this23.name=typeof _this23.options.Name=='string'?_this23.options.Name:"Unnamed Operation ".concat(_this23.state.Metadata.UUID);_this23.log=_assertThisInitialized(_this23);return _this23;}_createClass2(FableOperation,[{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);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":92,"./Fable-Service-Operation-DefaultSettings.js":100}],102:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase4){_inherits(FableServiceRestClient,_libFableServiceBase4);var _super14=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,FableServiceRestClient);_this24=_super14.call(this,pFable,pOptions,pServiceHash);_this24.TraceLog=false;if(_this24.options.TraceLog||_this24.fable.TraceLog){_this24.TraceLog=true;}_this24.dataFormat=_this24.fable.defaultServices.DataFormat;_this24.serviceType='RestClient';// This is a function that can be overridden, to allow the management
|
|
2778
2787
|
// of the request options before they are passed to the request library.
|
|
2779
2788
|
_this24.prepareRequestOptions=function(pOptions){return pOptions;};return _this24;}_createClass2(FableServiceRestClient,[{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|