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/dist/fable.js
CHANGED
|
@@ -2666,7 +2666,7 @@ this.StringParser=new libStringParser(this.fable.defaultServices.Utility.eachLim
|
|
|
2666
2666
|
* @param {object} pData - Data to pass in as the second argument
|
|
2667
2667
|
* @return {string} The result from the parser
|
|
2668
2668
|
*/parseString(pString,pData,fCallback){return this.StringParser.parseString(pString,this.ParseTree,pData,fCallback);}}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
|
*/class StringParser{/**
|
|
@@ -2677,16 +2677,7 @@ this.StringParser=new libStringParser(this.fable.defaultServices.Utility.eachLim
|
|
|
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
|
-
*/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
|
-
*/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
|
+
*/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
|
-
*/flushOutputBuffer(pParserState){pParserState.Output+=pParserState.OutputBuffer;pParserState.OutputBuffer='';}
|
|
2702
|
-
|
|
2703
|
-
|
|
2692
|
+
*/flushOutputBuffer(pParserState){pParserState.Output+=pParserState.OutputBuffer;pParserState.OutputBuffer='';}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
|
-
*/
|
|
2707
|
-
//
|
|
2708
|
-
if(pParserState.Pattern.
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
pParserState.
|
|
2713
|
-
//
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
pParserState.Pattern
|
|
2717
|
-
this.
|
|
2718
|
-
|
|
2700
|
+
*/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
|
-
*/
|
|
2725
|
-
if(
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
else if(pParserState.
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2721
|
+
*/parseCharacterAsync(pCharacter,pParserState,pData,fCallback){// 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,(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;this.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,(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;this.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
|
*/parseString(pString,pParseTree,pData,fCallback){if(typeof fCallback!=='function'){let 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
|
-
let tmpParserState=this.newParserState(pParseTree);this.eachLimit(pString,1,(pCharacter,fCharacterCallback)=>{this.parseCharacterAsync(pCharacter,tmpParserState,pData,fCharacterCallback);},pError=>{// Flush the remaining data
|
|
2751
|
+
let tmpParserState=this.newParserState(pParseTree);tmpParserState.Asynchronous=true;this.eachLimit(pString,1,(pCharacter,fCharacterCallback)=>{this.parseCharacterAsync(pCharacter,tmpParserState,pData,fCharacterCallback);},pError=>{// Flush the remaining data
|
|
2748
2752
|
this.flushOutputBuffer(tmpParserState);fCallback(pError,tmpParserState.Output);});}}}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
|
*/class WordTree{/**
|
|
@@ -2756,24 +2760,29 @@ this.flushOutputBuffer(tmpParserState);fCallback(pError,tmpParserState.Output);}
|
|
|
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
|
-
*/addChild(pTree,pPattern
|
|
2765
|
+
*/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
|
+
*/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
|
-
*/addPattern(pPatternStart,pPatternEnd,
|
|
2769
|
-
for(var i=0;i<pPatternStart.length;i++)tmpLeaf=this.addChild(tmpLeaf,pPatternStart,i);tmpLeaf.
|
|
2778
|
+
*/addPattern(pPatternStart,pPatternEnd,fParser){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}let 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={};}let tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(let i=0;i<tmpPatternEnd.length;i++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[i],i);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?()=>{return fParser;}: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
|
-
*/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'?(pHash,pData,fCallback)=>{fCallback(pParserPromise);}:(pHash,pData,fCallback)=>{return fCallback(pHash);};tmpLeaf.isAsync=true;return true;}}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){const libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;const _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));class FableOperation extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PhasedOperation';this.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
2785
|
+
*/addPatternAsync(pPatternStart,pPatternEnd,fParser){let tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}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){const libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;const _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));class FableOperation extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='PhasedOperation';this.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
2777
2786
|
this.state.Metadata.Hash=this.Hash;this.state.Metadata.UUID=this.UUID;this.name=typeof this.options.Name=='string'?this.options.Name:"Unnamed Operation ".concat(this.state.Metadata.UUID);this.log=this;}writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(typeof pLogObject=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(typeof pLogObject=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}module.exports=FableOperation;},{"../Fable-ServiceManager.js":92,"./Fable-Service-Operation-DefaultSettings.js":100}],102:[function(require,module,exports){const libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;const libSimpleGet=require('simple-get');class FableServiceRestClient extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.TraceLog=false;if(this.options.TraceLog||this.fable.TraceLog){this.TraceLog=true;}this.dataFormat=this.fable.defaultServices.DataFormat;this.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
|
this.prepareRequestOptions=pOptions=>{return pOptions;};}preRequest(pOptions){// Validate the options object
|