fable 3.0.70 → 3.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fable.compatible.js +13 -11
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +11 -9
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-Anticipate.js +1 -1
- package/source/services/Fable-Service-RestClient.js +4 -3
package/dist/fable.compatible.js
CHANGED
|
@@ -427,7 +427,7 @@ function connectFable(pFable){this.fable=pFable;return true;}}]);return FableCor
|
|
|
427
427
|
* Fable Service Base
|
|
428
428
|
* @author <steven@velozo.com>
|
|
429
429
|
*/var FableServiceProviderBase=/*#__PURE__*/_createClass2(function FableServiceProviderBase(pFable,pOptions,pServiceHash){_classCallCheck2(this,FableServiceProviderBase);this.fable=pFable;this.options=_typeof(pOptions)==='object'?pOptions:_typeof(pFable)==='object'&&!pFable.isFable?pFable:{};this.serviceType='Unknown';if(typeof pFable.getUUID=='function'){this.UUID=pFable.getUUID();}else{this.UUID="NoFABLESVC-".concat(Math.floor(Math.random()*(99999-10000)+10000));}this.Hash=typeof pServiceHash==='string'?pServiceHash:"".concat(this.UUID);// Pull back a few things
|
|
430
|
-
this.log=this.fable.log;this.
|
|
430
|
+
this.log=this.fable.log;this.services=this.fable.services;this.defaultServices=this.fable.defaultServices;});_defineProperty2(FableServiceProviderBase,"isFableService",true);module.exports=FableServiceProviderBase;module.exports.CoreServiceProviderBase=require('./Fable-ServiceProviderBase-Preinit.js');},{"./Fable-ServiceProviderBase-Preinit.js":32}],34:[function(require,module,exports){module.exports={"Product":"ApplicationNameHere","ProductVersion":"0.0.0","ConfigFile":false,"LogStreams":[{"level":"trace"}]};},{}],35:[function(require,module,exports){(function(process){(function(){/**
|
|
431
431
|
* Fable Settings Template Processor
|
|
432
432
|
*
|
|
433
433
|
* This class allows environment variables to come in via templated expressions, and defaults to be set.
|
|
@@ -1094,17 +1094,19 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
1094
1094
|
* @class Manyfest
|
|
1095
1095
|
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi5){_inherits(Manyfest,_libFableServiceProvi5);var _super7=_createSuper(Manyfest);function Manyfest(pFable,pManifest,pServiceHash){var _this14;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this14=_super7.call(this,{});}else{_this14=_super7.call(this,pFable,pManifest,pServiceHash);}_this14.serviceType='Manifest';// Wire in logging
|
|
1096
1096
|
_this14.logInfo=libSimpleLog;_this14.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
1097
|
-
_this14.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this14.logInfo,_this14.logError);_this14.objectAddressGetValue=new libObjectAddressGetValue(_this14.logInfo,_this14.logError);_this14.objectAddressSetValue=new libObjectAddressSetValue(_this14.logInfo,_this14.logError);_this14.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this14.logInfo,_this14.logError);if(!_this14.options.hasOwnProperty('defaultValues')){_this14.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this14.options.hasOwnProperty('strict')){_this14.options.strict=false;}_this14.scope=undefined;_this14.elementAddresses=undefined;_this14.elementHashes=undefined;_this14.elementDescriptors=undefined
|
|
1097
|
+
_this14.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this14.logInfo,_this14.logError);_this14.objectAddressGetValue=new libObjectAddressGetValue(_this14.logInfo,_this14.logError);_this14.objectAddressSetValue=new libObjectAddressSetValue(_this14.logInfo,_this14.logError);_this14.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this14.logInfo,_this14.logError);if(!_this14.options.hasOwnProperty('defaultValues')){_this14.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this14.options.hasOwnProperty('strict')){_this14.options.strict=false;}_this14.scope=undefined;_this14.elementAddresses=undefined;_this14.elementHashes=undefined;_this14.elementDescriptors=undefined;// This can cause a circular dependency chain, so it only gets initialized if the schema specifically calls for it.
|
|
1098
|
+
_this14.dataSolvers=undefined;// So solvers can use their own state
|
|
1099
|
+
_this14.dataSolverState=undefined;_this14.reset();if(_typeof(_this14.options)==='object'){_this14.loadManifest(_this14.options);}_this14.schemaManipulations=new libSchemaManipulation(_this14.logInfo,_this14.logError);_this14.objectAddressGeneration=new libObjectAddressGeneration(_this14.logInfo,_this14.logError);_this14.hashTranslations=new libHashTranslation(_this14.logInfo,_this14.logError);return _possibleConstructorReturn(_this14);}/*************************************************************************
|
|
1098
1100
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
1099
1101
|
*/ // Reset critical manifest properties
|
|
1100
|
-
_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
|
|
1102
|
+
_createClass2(Manyfest,[{key:"reset",value:function reset(){this.scope='DEFAULT';this.elementAddresses=[];this.elementHashes={};this.elementDescriptors={};this.dataSolvers=undefined;this.dataSolverState={};}},{key:"clone",value:function clone(){// Make a copy of the options in-place
|
|
1101
1103
|
var tmpNewOptions=JSON.parse(JSON.stringify(this.options));var tmpNewManyfest=new Manyfest(this.getManifest(),this.logInfo,this.logError,tmpNewOptions);// Import the hash translations
|
|
1102
1104
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);return tmpNewManyfest;}// Deserialize a Manifest from a string
|
|
1103
1105
|
},{key:"deserialize",value:function deserialize(pManifestString){// TODO: Add guards for bad manifest string
|
|
1104
1106
|
return this.loadManifest(JSON.parse(pManifestString));}// Load a manifest from an object
|
|
1105
|
-
},{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 _i8=0;_i8<tmpDescriptionAddresses.length;_i8++){this.addDescriptor(tmpDescriptionAddresses[_i8],tmpManifest.Descriptors[tmpDescriptionAddresses[_i8]]);}}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);}
|
|
1106
|
-
|
|
1107
|
-
},{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))
|
|
1107
|
+
},{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 _i8=0;_i8<tmpDescriptionAddresses.length;_i8++){this.addDescriptor(tmpDescriptionAddresses[_i8],tmpManifest.Descriptors[tmpDescriptionAddresses[_i8]]);}}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);}}// Serialize the Manifest to a string
|
|
1108
|
+
// TODO: Should this also serialize the translation table?
|
|
1109
|
+
},{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))};}// Add a descriptor to the manifest
|
|
1108
1110
|
},{key:"addDescriptor",value:function addDescriptor(pAddress,pDescriptor){if(_typeof(pDescriptor)==='object'){// Add the Address into the Descriptor if it doesn't exist:
|
|
1109
1111
|
if(!pDescriptor.hasOwnProperty('Address')){pDescriptor.Address=pAddress;}if(!this.elementDescriptors.hasOwnProperty(pAddress)){this.elementAddresses.push(pAddress);}// Add the element descriptor to the schema
|
|
1110
1112
|
this.elementDescriptors[pAddress]=pDescriptor;// Always add the address as a hash
|
|
@@ -2499,7 +2501,7 @@ function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fa
|
|
|
2499
2501
|
_this17.operationQueue=[];_this17.erroredOperations=[];_this17.executingOperationCount=0;_this17.completedOperationCount=0;_this17.maxOperations=1;_this17.lastError=undefined;_this17.waitingFunctions=[];return _this17;}_createClass2(FableServiceAnticipate,[{key:"checkQueue",value:function checkQueue(){// This checks to see if we need to start any operations.
|
|
2500
2502
|
if(this.operationQueue.length>0&&this.executingOperationCount<this.maxOperations){var tmpOperation=this.operationQueue.shift();this.executingOperationCount+=1;tmpOperation(this.buildAnticipatorCallback());}else if(this.waitingFunctions.length>0&&this.executingOperationCount<1){// If there are no operations left, and we have waiting functions, call them.
|
|
2501
2503
|
for(var i=0;i<this.waitingFunctions.length;i++){this.waitingFunctions[i](this.lastError);}// Reset our state
|
|
2502
|
-
this.lastError=undefined;}}// Expects a function fAsynchronousFunction(fCallback)
|
|
2504
|
+
this.lastError=undefined;this.waitingFunctions=[];}}// Expects a function fAsynchronousFunction(fCallback)
|
|
2503
2505
|
},{key:"anticipate",value:function anticipate(fAsynchronousFunction){this.operationQueue.push(fAsynchronousFunction);this.checkQueue();}},{key:"buildAnticipatorCallback",value:function buildAnticipatorCallback(){// This uses closure-scoped state to track the callback state
|
|
2504
2506
|
var tmpCallbackState={Called:false,Error:undefined,OperationSet:this};return hoistedCallback;function hoistedCallback(pError){if(tmpCallbackState.Called){// If they call the callback twice, throw an error
|
|
2505
2507
|
throw new Error("Anticipation async callback called twice...");}tmpCallbackState.Called=true;tmpCallbackState.error=pError;tmpCallbackState.OperationSet.executingOperationCount-=1;tmpCallbackState.OperationSet.completedOperationCount+=1;tmpCallbackState.OperationSet.checkQueue();}}},{key:"wait",value:function wait(fCallback){this.waitingFunctions.push(fCallback);this.checkQueue();}}]);return FableServiceAnticipate;}(libFableServiceBase);module.exports=FableServiceAnticipate;},{"../Fable-ServiceManager.js":92}],95:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');/**
|
|
@@ -2515,7 +2517,7 @@ throw new Error("Anticipation async callback called twice...");}tmpCallbackState
|
|
|
2515
2517
|
*
|
|
2516
2518
|
* @class CSVParser
|
|
2517
2519
|
*/var CSVParser=/*#__PURE__*/function(_libFableServiceProvi6){_inherits(CSVParser,_libFableServiceProvi6);var _super10=_createSuper(CSVParser);function CSVParser(pFable,pOptions,pServiceHash){var _this18;_classCallCheck2(this,CSVParser);_this18=_super10.call(this,pFable,pOptions,pServiceHash);_this18.serviceType='CSVParser';_this18.Header=[];_this18.HeaderFieldNames=[];_this18.Delimiter=',';_this18.QuoteCharacter='"';_this18.CleanCharacters=['\r'];_this18.HeaderLineIndex=0;_this18.HasHeader=true;_this18.HasSetHeader=false;_this18.EmitHeader=false;_this18.EmitJSON=true;_this18.EscapedQuoteString='"';// Current Line Parsing State
|
|
2518
|
-
_this18.CurrentLine='';_this18.CurrentRecord=[];_this18.InQuote=false;_this18.InEscapedQuote=false;_this18.LinesParsed=0;_this18.RowsEmitted=0;return _this18;}_createClass2(CSVParser,[{key:"marshalRowToJSON",value:function marshalRowToJSON(pRowArray){if(!Array.isArray(pRowArray)){return false;}for(var i=this.HeaderFieldNames.length;i<pRowArray.length;i++){this.HeaderFieldNames[i]="".concat(i);}var tmpObject={};for(var
|
|
2520
|
+
_this18.CurrentLine='';_this18.CurrentRecord=[];_this18.InQuote=false;_this18.InEscapedQuote=false;_this18.LinesParsed=0;_this18.RowsEmitted=0;return _this18;}_createClass2(CSVParser,[{key:"marshalRowToJSON",value:function marshalRowToJSON(pRowArray){if(!Array.isArray(pRowArray)){return false;}for(var i=this.HeaderFieldNames.length;i<pRowArray.length;i++){this.HeaderFieldNames[i]="".concat(i);}var tmpObject={};for(var _i9=0;_i9<pRowArray.length;_i9++){tmpObject[this.HeaderFieldNames[_i9]]=pRowArray[_i9];}return tmpObject;}// Set the header data, for use in marshalling to JSON.
|
|
2519
2521
|
},{key:"setHeader",value:function setHeader(pHeaderArray){this.Header=pHeaderArray;for(var i=0;i<this.Header.length;i++){if(typeof this.Header[i]=='undefined'){this.HeaderFieldNames[i]="".concat(i);}else{this.HeaderFieldNames[i]=this.Header[i].toString();}}}},{key:"resetRowState",value:function resetRowState(){this.CurrentRecord=[];}},{key:"pushLine",value:function pushLine(){for(var i=0;i<this.CleanCharacters.length;i++){this.CurrentLine=this.CurrentLine.replace(this.CleanCharacters[i],'');}this.CurrentRecord.push(this.CurrentLine);this.CurrentLine='';}},{key:"emitRow",value:function emitRow(pFormatAsJSON){var tmpFormatAsJSON=typeof pFormatAsJSON=='undefined'?this.EmitJSON:pFormatAsJSON;this.RowsEmitted++;var tmpCompletedRecord=this.CurrentRecord;this.CurrentRecord=[];if(tmpFormatAsJSON){return this.marshalRowToJSON(tmpCompletedRecord);}else{return tmpCompletedRecord;}}},{key:"parseCSVLine",value:function parseCSVLine(pLineString){this.LinesParsed++;for(var i=0;i<pLineString.length;i++){if(!this.InQuote&&pLineString[i]==this.Delimiter){this.pushLine();}else if(pLineString[i]==this.QuoteCharacter){// If we are in the second part of an escaped quote, ignore it.
|
|
2520
2522
|
if(this.InEscapedQuote){this.InEscapedQuote=false;}// If we aren't in a quote, enter quote
|
|
2521
2523
|
else if(!this.InQuote){this.InQuote=true;}// We are in a quote, so peek forward to see if this is an "escaped" quote pair
|
|
@@ -2863,7 +2865,7 @@ _this26.flushOutputBuffer(_tmpParserState);fCallback(pError,_tmpParserState.Outp
|
|
|
2863
2865
|
* @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.
|
|
2864
2866
|
* @return {bool} True if adding the pattern was successful
|
|
2865
2867
|
*/},{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
|
|
2866
|
-
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
|
|
2868
|
+
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
|
|
2867
2869
|
* @method addPattern
|
|
2868
2870
|
* @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
|
|
2869
2871
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
@@ -2872,8 +2874,8 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
2872
2874
|
*/},{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;},{}],104:[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":[]};},{}],105:[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(_libFableServiceBase6){_inherits(FableOperation,_libFableServiceBase6);var _super16=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this27;_classCallCheck2(this,FableOperation);_this27=_super16.call(this,pFable,pOptions,pServiceHash);_this27.serviceType='PhasedOperation';_this27.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
2873
2875
|
_this27.state.Metadata.Hash=_this27.Hash;_this27.state.Metadata.UUID=_this27.UUID;_this27.name=typeof _this27.options.Name=='string'?_this27.options.Name:"Unnamed Operation ".concat(_this27.state.Metadata.UUID);_this27.log=_assertThisInitialized(_this27);return _this27;}_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":104}],106:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceRestClient,_libFableServiceBase7);var _super17=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,FableServiceRestClient);_this28=_super17.call(this,pFable,pOptions,pServiceHash);_this28.TraceLog=false;if(_this28.options.TraceLog||_this28.fable.TraceLog){_this28.TraceLog=true;}_this28.dataFormat=_this28.fable.services.DataFormat;_this28.serviceType='RestClient';_this28.cookie=false;// This is a function that can be overridden, to allow the management
|
|
2874
2876
|
// of the request options before they are passed to the request library.
|
|
2875
|
-
_this28.prepareRequestOptions=function(pOptions){return pOptions;};return _this28;}_createClass2(FableServiceRestClient,[{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var
|
|
2876
|
-
pRequestOptions.headers.cookie=libCookie.serialize(
|
|
2877
|
+
_this28.prepareRequestOptions=function(pOptions){return pOptions;};return _this28;}_createClass2(FableServiceRestClient,[{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.
|
|
2878
|
+
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
2877
2879
|
var tmpOptions=this.prepareCookies(pOptions);return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this29=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(_this29.TraceLog){var tmpConnectTime=_this29.fable.log.getTimeStamp();_this29.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this29.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.
|
|
2878
2880
|
if(_this29.TraceLog){var tmpChunkTime=_this29.fable.log.getTimeStamp();_this29.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this29.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this29.TraceLog){var tmpCompletionTime=_this29.fable.log.getTimeStamp();_this29.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this29.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this30=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!tmpOptions.hasOwnProperty('headers')){tmpOptions.headers={};}/* Automated headers break some APIs
|
|
2879
2881
|
if (!tmpOptions.headers.hasOwnProperty('Content-Type'))
|