fable 3.0.51 → 3.0.53
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 +37 -27
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +19 -9
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/Fable.js +1 -0
- package/source/services/Fable-Service-FilePersistence.js +166 -158
- package/test/DataGeneration_tests.js +1 -1
- package/test/FilePersistence_tests.js +120 -6
package/dist/fable.compatible.js
CHANGED
|
@@ -2428,8 +2428,8 @@ this._coreServices.ServiceManager=new libFableServiceManager(this);this.serviceM
|
|
|
2428
2428
|
// Initialization Phase 2: Map in the default services.
|
|
2429
2429
|
// They will then be available in the Default service provider set as well.
|
|
2430
2430
|
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.ServiceManager);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.UUID);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.Logging);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
2431
|
-
this.serviceManager.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));this.serviceManager.addServiceType('Template',require('./services/Fable-Service-Template.js'));this.serviceManager.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));this.serviceManager.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));this.serviceManager.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));this.serviceManager.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));this.serviceManager.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));this.serviceManager.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));this.serviceManager.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));this.serviceManager.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));this.serviceManager.addServiceType('Manifest',require('manyfest'));this.serviceManager.addServiceType('ObjectCache',require('cachetrax'));}_createClass2(Fable,[{key:"isFable",get:function get(){return true;}},{key:"settings",get:function get(){return this._coreServices.SettingsManager.settings;}},{key:"settingsManager",get:function get(){return this._coreServices.SettingsManager;}},{key:"log",get:function get(){return this._coreServices.Logging;}},{key:"services",get:function get(){return this._coreServices.ServiceManager.services;}},{key:"defaultServices",get:function get(){return this._coreServices.ServiceManager.defaultServices;}},{key:"getUUID",value:function getUUID(){return this._coreServices.UUID.getUUID();}},{key:"fable",get:function get(){return this;}}]);return Fable;}();// This is for backwards compatibility
|
|
2432
|
-
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceManager.ServiceProviderBase;module.exports.CoreServiceProviderBase=libFableServiceManager.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./Fable-ServiceManager.js":91,"./services/Fable-Service-Anticipate.js":93,"./services/Fable-Service-CSVParser.js":94,"./services/Fable-Service-DataFormat.js":95,"./services/Fable-Service-DataGeneration.js":97,"./services/Fable-Service-EnvironmentData.js":98,"./services/Fable-Service-
|
|
2431
|
+
this.serviceManager.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));this.serviceManager.addServiceType('Template',require('./services/Fable-Service-Template.js'));this.serviceManager.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));this.serviceManager.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));this.serviceManager.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));this.serviceManager.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));this.serviceManager.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));this.serviceManager.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));this.serviceManager.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));this.serviceManager.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));this.serviceManager.addServiceType('Manifest',require('manyfest'));this.serviceManager.addServiceType('ObjectCache',require('cachetrax'));this.serviceManager.addServiceType('FilePersistence',require('./services/Fable-Service-FilePersistence.js'));}_createClass2(Fable,[{key:"isFable",get:function get(){return true;}},{key:"settings",get:function get(){return this._coreServices.SettingsManager.settings;}},{key:"settingsManager",get:function get(){return this._coreServices.SettingsManager;}},{key:"log",get:function get(){return this._coreServices.Logging;}},{key:"services",get:function get(){return this._coreServices.ServiceManager.services;}},{key:"defaultServices",get:function get(){return this._coreServices.ServiceManager.defaultServices;}},{key:"getUUID",value:function getUUID(){return this._coreServices.UUID.getUUID();}},{key:"fable",get:function get(){return this;}}]);return Fable;}();// This is for backwards compatibility
|
|
2432
|
+
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceManager.ServiceProviderBase;module.exports.CoreServiceProviderBase=libFableServiceManager.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./Fable-ServiceManager.js":91,"./services/Fable-Service-Anticipate.js":93,"./services/Fable-Service-CSVParser.js":94,"./services/Fable-Service-DataFormat.js":95,"./services/Fable-Service-DataGeneration.js":97,"./services/Fable-Service-EnvironmentData.js":98,"./services/Fable-Service-FilePersistence.js":99,"./services/Fable-Service-MetaTemplate.js":100,"./services/Fable-Service-Operation.js":104,"./services/Fable-Service-RestClient.js":105,"./services/Fable-Service-Template.js":106,"./services/Fable-Service-Utility.js":107,"cachetrax":21,"fable-log":30,"fable-settings":35,"fable-uuid":37,"manyfest":51}],93:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceAnticipate=/*#__PURE__*/function(_libFableServiceBase){_inherits(FableServiceAnticipate,_libFableServiceBase);var _super9=_createSuper(FableServiceAnticipate);function FableServiceAnticipate(pFable,pOptions,pServiceHash){var _this17;_classCallCheck2(this,FableServiceAnticipate);_this17=_super9.call(this,pFable,pOptions,pServiceHash);_this17.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
|
|
2433
2433
|
_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.
|
|
2434
2434
|
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.
|
|
2435
2435
|
for(var i=0;i<this.waitingFunctions.length;i++){this.waitingFunctions[i](this.lastError);}// Reset our state
|
|
@@ -2658,12 +2658,22 @@ return'';}if(tmpEnclosedValueEndIndex>0&&tmpEnclosedValueEndIndex>tmpEnclosedVal
|
|
|
2658
2658
|
if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1){tmpEnclosureCount++;if(tmpEnclosureIndexToRemove==tmpEnclosureCount-1){tmpMatchedEnclosureIndex=true;tmpEnclosureStartIndex=i;}}}else if(tmpString[i]==tmpEnclosureEnd){tmpEnclosureDepth--;if(tmpEnclosureDepth==0&&tmpMatchedEnclosureIndex&&tmpEnclosureEndIndex<=tmpEnclosureStartIndex){tmpEnclosureEndIndex=i;tmpMatchedEnclosureIndex=false;}}}if(tmpEnclosureCount<=tmpEnclosureIndexToRemove){return tmpString;}var tmpReturnString='';if(tmpEnclosureStartIndex>1){tmpReturnString=tmpString.substring(0,tmpEnclosureStartIndex);}if(tmpString.length>tmpEnclosureEndIndex+1&&tmpEnclosureEndIndex>tmpEnclosureStartIndex){tmpReturnString+=tmpString.substring(tmpEnclosureEndIndex+1);}return tmpReturnString;}}]);return DataFormat;}(libFableServiceProviderBase);module.exports=DataFormat;},{"fable-serviceproviderbase":32}],96:[function(require,module,exports){module.exports={"DefaultIntegerMinimum":0,"DefaultIntegerMaximum":9999999,"DefaultNumericStringLength":10,"MonthSet":["January","February","March","April","May","June","July","August","September","October","November","December"],"WeekDaySet":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"ColorSet":["Red","Orange","Yellow","Green","Blue","Indigo","Violet","Pink","Purple","Turquoise","Gold","Lime","Maroon","Navy","Coral","Teal","Brown","White","Black","Sky","Berry","Grey","Straw","Silver","Sapphire"],"SurNameSet":["Smith","Johnson","Williams","Brown","Jones","Miller","Davis","Garcia","Rodriguez","Wilson","Martinez","Anderson","Taylor","Thomas","Hernandez","Moore","Martin","Jackson","Thompson","White","Lopez","Lee","Gonzalez","Harris","Clark","Lewis","Robinson","Walker","Perez","Hall","Young","Allen","Sanchez","Wright","King","Scott","Green","Baker","Adams","Nelson","Hill","Ramirez","Campbell","Mitchell","Roberts","Carter","Phillips","Evans","Turner","Torres","Parker","Collins","Edwards","Stewart","Flores","Morris","Nguyen","Murphy","Rivera","Cook","Rogers","Morgan","Peterson","Cooper","Reed","Bailey","Bell","Gomez","Kelly","Howard","Ward","Cox","Diaz","Richardson","Wood","Watson","Brooks","Bennett","Gray","James","Reyes","Cruz","Hughes","Price","Myers","Long","Foster","Sanders","Ross","Morales","Powell","Sullivan","Russell","Ortiz","Jenkins","Gutierrez","Perry","Butler","Barnes","Fisher"],"NameSet":["Mary","Patricia","Jennifer","Linda","Elizabeth","Barbara","Susan","Jessica","Sarah","Karen","Lisa","Nancy","Betty","Sandra","Margaret","Ashley","Kimberly","Emily","Donna","Michelle","Carol","Amanda","Melissa","Deborah","Stephanie","Dorothy","Rebecca","Sharon","Laura","Cynthia","Amy","Kathleen","Angela","Shirley","Brenda","Emma","Anna","Pamela","Nicole","Samantha","Katherine","Christine","Helen","Debra","Rachel","Carolyn","Janet","Maria","Catherine","Heather","Diane","Olivia","Julie","Joyce","Victoria","Ruth","Virginia","Lauren","Kelly","Christina","Joan","Evelyn","Judith","Andrea","Hannah","Megan","Cheryl","Jacqueline","Martha","Madison","Teresa","Gloria","Sara","Janice","Ann","Kathryn","Abigail","Sophia","Frances","Jean","Alice","Judy","Isabella","Julia","Grace","Amber","Denise","Danielle","Marilyn","Beverly","Charlotte","Natalie","Theresa","Diana","Brittany","Doris","Kayla","Alexis","Lori","Marie","James","Robert","John","Michael","David","William","Richard","Joseph","Thomas","Christopher","Charles","Daniel","Matthew","Anthony","Mark","Donald","Steven","Andrew","Paul","Joshua","Kenneth","Kevin","Brian","George","Timothy","Ronald","Jason","Edward","Jeffrey","Ryan","Jacob","Gary","Nicholas","Eric","Jonathan","Stephen","Larry","Justin","Scott","Brandon","Benjamin","Samuel","Gregory","Alexander","Patrick","Frank","Raymond","Jack","Dennis","Jerry","Tyler","Aaron","Jose","Adam","Nathan","Henry","Zachary","Douglas","Peter","Kyle","Noah","Ethan","Jeremy","Walter","Christian","Keith","Roger","Terry","Austin","Sean","Gerald","Carl","Harold","Dylan","Arthur","Lawrence","Jordan","Jesse","Bryan","Billy","Bruce","Gabriel","Joe","Logan","Alan","Juan","Albert","Willie","Elijah","Wayne","Randy","Vincent","Mason","Roy","Ralph","Bobby","Russell","Bradley","Philip","Eugene"]};},{}],97:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceDataGeneration=/*#__PURE__*/function(_libFableServiceBase2){_inherits(FableServiceDataGeneration,_libFableServiceBase2);var _super12=_createSuper(FableServiceDataGeneration);function FableServiceDataGeneration(pFable,pOptions,pServiceHash){var _this20;_classCallCheck2(this,FableServiceDataGeneration);_this20=_super12.call(this,pFable,pOptions,pServiceHash);_this20.serviceType='DataGeneration';_this20.defaultData=require('./Fable-Service-DataGeneration-DefaultValues.json');return _this20;}// Return a random integer between pMinimum and pMaximum
|
|
2659
2659
|
_createClass2(FableServiceDataGeneration,[{key:"randomIntegerBetween",value:function randomIntegerBetween(pMinimum,pMaximum){return Math.floor(Math.random()*(pMaximum-pMinimum+1))+pMinimum;}// Return a random integer up to the passed-in maximum
|
|
2660
2660
|
},{key:"randomIntegerUpTo",value:function randomIntegerUpTo(pMaximum){return this.randomIntegerBetween(0,pMaximum);}// Return a random integer between 0 and 9999999
|
|
2661
|
-
},{key:"randomInteger",value:function randomInteger(){return Math.floor(Math.random()*this.defaultData.DefaultIntegerMaximum);}},{key:"randomNumericString",value:function randomNumericString(pLength,pMaxNumber){var tmpLength=typeof pLength==='undefined'?10:pLength;var tmpMaxNumber=typeof pMaxNumber==='undefined'?Math.pow(10,tmpLength)-1:pMaxNumber;return this.defaultServices.DataFormat.stringPadStart(this.randomIntegerUpTo(tmpMaxNumber),pLength,'0');}},{key:"randomMonth",value:function randomMonth(){return this.defaultData.MonthSet[this.randomIntegerUpTo(this.defaultData.MonthSet.length-1)];}},{key:"randomDayOfWeek",value:function randomDayOfWeek(){return this.defaultData.WeekDaySet[this.randomIntegerUpTo(this.defaultData.WeekDaySet.length-1)];}},{key:"randomColor",value:function randomColor(){return this.defaultData.ColorSet[this.randomIntegerUpTo(this.defaultData.ColorSet.length-1)];}},{key:"randomName",value:function randomName(){return this.defaultData.NameSet[this.randomIntegerUpTo(this.defaultData.NameSet.length-1)];}},{key:"randomSurname",value:function randomSurname(){return this.defaultData.SurNameSet[this.randomIntegerUpTo(this.defaultData.SurNameSet.length-1)];}}]);return FableServiceDataGeneration;}(libFableServiceBase);module.exports=FableServiceDataGeneration;},{"../Fable-ServiceManager.js":91,"./Fable-Service-DataGeneration-DefaultValues.json":96}],98:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceEnvironmentData=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableServiceEnvironmentData,_libFableServiceBase3);var _super13=_createSuper(FableServiceEnvironmentData);function FableServiceEnvironmentData(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,FableServiceEnvironmentData);_this21=_super13.call(this,pFable,pOptions,pServiceHash);_this21.serviceType='EnvironmentData';_this21.Environment="node.js";return _this21;}return _createClass2(FableServiceEnvironmentData);}(libFableServiceBase);module.exports=FableServiceEnvironmentData;},{"../Fable-ServiceManager.js":91}],99:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase
|
|
2661
|
+
},{key:"randomInteger",value:function randomInteger(){return Math.floor(Math.random()*this.defaultData.DefaultIntegerMaximum);}},{key:"randomNumericString",value:function randomNumericString(pLength,pMaxNumber){var tmpLength=typeof pLength==='undefined'?10:pLength;var tmpMaxNumber=typeof pMaxNumber==='undefined'?Math.pow(10,tmpLength)-1:pMaxNumber;return this.defaultServices.DataFormat.stringPadStart(this.randomIntegerUpTo(tmpMaxNumber),pLength,'0');}},{key:"randomMonth",value:function randomMonth(){return this.defaultData.MonthSet[this.randomIntegerUpTo(this.defaultData.MonthSet.length-1)];}},{key:"randomDayOfWeek",value:function randomDayOfWeek(){return this.defaultData.WeekDaySet[this.randomIntegerUpTo(this.defaultData.WeekDaySet.length-1)];}},{key:"randomColor",value:function randomColor(){return this.defaultData.ColorSet[this.randomIntegerUpTo(this.defaultData.ColorSet.length-1)];}},{key:"randomName",value:function randomName(){return this.defaultData.NameSet[this.randomIntegerUpTo(this.defaultData.NameSet.length-1)];}},{key:"randomSurname",value:function randomSurname(){return this.defaultData.SurNameSet[this.randomIntegerUpTo(this.defaultData.SurNameSet.length-1)];}}]);return FableServiceDataGeneration;}(libFableServiceBase);module.exports=FableServiceDataGeneration;},{"../Fable-ServiceManager.js":91,"./Fable-Service-DataGeneration-DefaultValues.json":96}],98:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceEnvironmentData=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableServiceEnvironmentData,_libFableServiceBase3);var _super13=_createSuper(FableServiceEnvironmentData);function FableServiceEnvironmentData(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,FableServiceEnvironmentData);_this21=_super13.call(this,pFable,pOptions,pServiceHash);_this21.serviceType='EnvironmentData';_this21.Environment="node.js";return _this21;}return _createClass2(FableServiceEnvironmentData);}(libFableServiceBase);module.exports=FableServiceEnvironmentData;},{"../Fable-ServiceManager.js":91}],99:[function(require,module,exports){(function(process){(function(){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libFS=require('fs');var libPath=require('path');var FableServiceFilePersistence=/*#__PURE__*/function(_libFableServiceBase4){_inherits(FableServiceFilePersistence,_libFableServiceBase4);var _super14=_createSuper(FableServiceFilePersistence);function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this22;_classCallCheck2(this,FableServiceFilePersistence);_this22=_super14.call(this,pFable,pOptions,pServiceHash);_this22.serviceType='FilePersistence';if(!_this22.options.hasOwnProperty('Mode')){_this22.options.Mode=parseInt('0777',8)&~process.umask();}_this22.currentInputFolder="/tmp";_this22.currentOutputFolder="/tmp";return _this22;}_createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){return libPath.resolve.apply(libPath,arguments);}},{key:"existsSync",value:function existsSync(pPath){return libFS.existsSync(pPath);}},{key:"exists",value:function exists(pPath,fCallback){var tmpFileExists=this.existsSync(pPath);;return fCallback(null,tmpFileExists);}},{key:"writeFileSync",value:function writeFileSync(pFileName,pFileContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{key:"deleteFileSync",value:function deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}},{key:"deleteFolderSync",value:function deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}},{key:"writeFileSyncFromObject",value:function writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}},{key:"writeFileSyncFromArray",value:function writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error("File Persistence Service attempted to write ".concat(pFileName," from array but the expected array was not an array (it was a ").concat(_typeof(pFileArray),")."));return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(var i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,"".concat(pFileArray[i],"\n"));}}}// Default folder behaviors
|
|
2662
|
+
},{key:"getDefaultOutputPath",value:function getDefaultOutputPath(pFileName){return libPath.join(this.currentOutputFolder,pFileName);}},{key:"dataFolderWriteSync",value:function dataFolderWriteSync(pFileName,pFileContent){return this.writeFileSync(this.getDefaultOutputPath(pFileName),pFileContent);}},{key:"dataFolderWriteSyncFromObject",value:function dataFolderWriteSyncFromObject(pFileName,pObject){return this.writeFileSyncFromObject(this.getDefaultOutputPath(pFileName),pObject);}},{key:"dataFolderWriteSyncFromArray",value:function dataFolderWriteSyncFromArray(pFileName,pFileArray){return this.writeFileSyncFromArray(this.getDefaultOutputPath(pFileName),pFileArray);}// Folder management
|
|
2663
|
+
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this23=this;var tmpParameters=pParameters;if(typeof pParameters=='string'){tmpParameters={Path:pParameters};}else if(_typeof(pParameters)!=='object'){fCallback(new Error('Parameters object or string not properly passed to recursive folder create.'));return false;}if(typeof tmpParameters.Path!=='string'){fCallback(new Error('Parameters object needs a path to run the folder create operation.'));return false;}if(!tmpParameters.hasOwnProperty('Mode')){tmpParameters.Mode=this.options.Mode;}// Check if we are just starting .. if so, build the initial state for our recursive function
|
|
2664
|
+
if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
|
|
2665
|
+
tmpParameters.ActualPath=libPath.normalize(tmpParameters.Path);tmpParameters.ActualPathParts=tmpParameters.ActualPath.split(libPath.sep);tmpParameters.CurrentPathIndex=0;tmpParameters.CurrentPath='';}else{// This is not our first run, so we will continue the recursion.
|
|
2666
|
+
// Build the new base path
|
|
2667
|
+
if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParameters.CurrentPath+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex];}else{tmpParameters.CurrentPath=tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex];}// Increment the path index
|
|
2668
|
+
tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
2669
|
+
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){fCallback(null);return true;}// Check if the path exists (and is a folder)
|
|
2670
|
+
libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',function(pError,pFileDescriptor){if(pFileDescriptor){libFS.closeSync(pFileDescriptor);}if(pError&&pError.code=='ENOENT'){/* Path doesn't exist, create it */libFS.mkdir(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],tmpParameters.Mode,function(pCreateError){if(!pCreateError){// We have now created our folder and there was no error -- continue.
|
|
2671
|
+
return _this23.makeFolderRecursive(tmpParameters,fCallback);}else{fCallback(pCreateError);return false;}});}else{return _this23.makeFolderRecursive(tmpParameters,fCallback);}});}}]);return FableServiceFilePersistence;}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"../Fable-ServiceManager.js":91,"_process":57,"fs":18,"path":53}],100:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;/**
|
|
2662
2672
|
* Precedent Meta-Templating
|
|
2663
2673
|
* @author Steven Velozo <steven@velozo.com>
|
|
2664
2674
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
2665
|
-
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(
|
|
2666
|
-
|
|
2675
|
+
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase5){_inherits(FableServiceMetaTemplate,_libFableServiceBase5);var _super15=_createSuper(FableServiceMetaTemplate);function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,FableServiceMetaTemplate);_this24=_super15.call(this,pFable,pOptions,pServiceHash);_this24.serviceType='MetaTemplate';_this24.WordTree=new libWordTree();// In order to allow asynchronous template processing we need to use the async.eachLimit function
|
|
2676
|
+
_this24.StringParser=new libStringParser(_this24.fable.defaultServices.Utility.eachLimit);_this24.ParseTree=_this24.WordTree.ParseTree;return _this24;}/**
|
|
2667
2677
|
* Add a Pattern to the Parse Tree
|
|
2668
2678
|
* @method addPattern
|
|
2669
2679
|
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
@@ -2676,7 +2686,7 @@ _this22.StringParser=new libStringParser(_this22.fable.defaultServices.Utility.e
|
|
|
2676
2686
|
* @param {string} pString - The string to parse
|
|
2677
2687
|
* @param {object} pData - Data to pass in as the second argument
|
|
2678
2688
|
* @return {string} The result from the parser
|
|
2679
|
-
*/},{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":91,"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":
|
|
2689
|
+
*/},{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":91,"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":101,"./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js":102}],101:[function(require,module,exports){/**
|
|
2680
2690
|
* String Parser
|
|
2681
2691
|
* @author Steven Velozo <steven@velozo.com>
|
|
2682
2692
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
@@ -2729,7 +2739,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
2729
2739
|
* @param {string} pCharacter - The character to append
|
|
2730
2740
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2731
2741
|
* @private
|
|
2732
|
-
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback){var
|
|
2742
|
+
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback){var _this25=this;// If we are already in a pattern match traversal
|
|
2733
2743
|
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
2734
2744
|
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.
|
|
2735
2745
|
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
@@ -2737,7 +2747,7 @@ this.appendOutputBuffer(pCharacter,pParserState);// If this last character is th
|
|
|
2737
2747
|
if(pParserState.Pattern.hasOwnProperty('Parse')){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2738
2748
|
// Trim the start and end tags off the output buffer now
|
|
2739
2749
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
2740
|
-
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;
|
|
2750
|
+
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;_this25.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
2741
2751
|
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.
|
|
2742
2752
|
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.
|
|
2743
2753
|
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
@@ -2745,7 +2755,7 @@ pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last
|
|
|
2745
2755
|
if(pParserState.Pattern.hasOwnProperty('Parse')){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2746
2756
|
// Trim the start and end tags off the output buffer now
|
|
2747
2757
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
2748
|
-
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;
|
|
2758
|
+
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;_this25.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
2749
2759
|
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.
|
|
2750
2760
|
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)....
|
|
2751
2761
|
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
@@ -2757,10 +2767,10 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
2757
2767
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
2758
2768
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
2759
2769
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
2760
|
-
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback){var
|
|
2770
|
+
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback){var _this26=this;if(typeof fCallback!=='function'){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
|
|
2761
2771
|
this.parseCharacter(pString[i],tmpParserState,pData,fCallback);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
2762
|
-
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;this.eachLimit(pString,1,function(pCharacter,fCharacterCallback){
|
|
2763
|
-
|
|
2772
|
+
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;this.eachLimit(pString,1,function(pCharacter,fCharacterCallback){_this26.parseCharacterAsync(pCharacter,_tmpParserState,pData,fCharacterCallback);},function(pError){// Flush the remaining data
|
|
2773
|
+
_this26.flushOutputBuffer(_tmpParserState);fCallback(pError,_tmpParserState.Output);});}}}]);return StringParser;}();module.exports=StringParser;},{}],102:[function(require,module,exports){/**
|
|
2764
2774
|
* Word Tree
|
|
2765
2775
|
* @author Steven Velozo <steven@velozo.com>
|
|
2766
2776
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -2793,13 +2803,13 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
2793
2803
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
2794
2804
|
* @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.
|
|
2795
2805
|
* @return {bool} True if adding the pattern was successful
|
|
2796
|
-
*/},{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;},{}],
|
|
2797
|
-
|
|
2806
|
+
*/},{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;},{}],103:[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":[]};},{}],104:[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.
|
|
2807
|
+
_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":91,"./Fable-Service-Operation-DefaultSettings.js":103}],105:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');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.defaultServices.DataFormat;_this28.serviceType='RestClient';// This is a function that can be overridden, to allow the management
|
|
2798
2808
|
// of the request options before they are passed to the request library.
|
|
2799
|
-
|
|
2800
|
-
return this.prepareRequestOptions(pOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var
|
|
2801
|
-
if(
|
|
2802
|
-
return fCallback(pError,pResponse,JSON.parse(pChunk));});pResponse.on('end',function(){if(
|
|
2809
|
+
_this28.prepareRequestOptions=function(pOptions){return pOptions;};return _this28;}_createClass2(FableServiceRestClient,[{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
2810
|
+
return this.prepareRequestOptions(pOptions);}},{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.
|
|
2811
|
+
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);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this30.TraceLog){var tmpConnectTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}pResponse.on('data',function(pChunk){if(_this30.TraceLog){var tmpChunkTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}// In a JSON request, the chunk is the serialized method.
|
|
2812
|
+
return fCallback(pError,pResponse,JSON.parse(pChunk));});pResponse.on('end',function(){if(_this30.TraceLog){var tmpCompletionTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}});});}},{key:"getJSON",value:function getJSON(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}},{key:"putJSON",value:function putJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PUT JSON Error Invalid options object"));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}},{key:"postJSON",value:function postJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("POST JSON Error Invalid options object"));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}},{key:"patchJSON",value:function patchJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PATCH JSON Error Invalid options object"));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}},{key:"headJSON",value:function headJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("HEAD JSON Error Invalid options object"));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}},{key:"delJSON",value:function delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}},{key:"getRawText",value:function getRawText(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}]);return FableServiceRestClient;}(libFableServiceBase);module.exports=FableServiceRestClient;},{"../Fable-ServiceManager.js":91,"simple-get":64}],106:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase8){_inherits(FableServiceTemplate,_libFableServiceBase8);var _super18=_createSuper(FableServiceTemplate);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2803
2813
|
// string-based template with code snippets into simple executable pieces,
|
|
2804
2814
|
// with the added twist of returning a precompiled function ready to go.
|
|
2805
2815
|
//
|
|
@@ -2808,19 +2818,19 @@ return fCallback(pError,pResponse,JSON.parse(pChunk));});pResponse.on('end',func
|
|
|
2808
2818
|
//
|
|
2809
2819
|
// This is an implementation of that.
|
|
2810
2820
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2811
|
-
function FableServiceTemplate(pFable,pOptions,pServiceHash){var
|
|
2821
|
+
function FableServiceTemplate(pFable,pOptions,pServiceHash){var _this31;_classCallCheck2(this,FableServiceTemplate);_this31=_super18.call(this,pFable,pOptions,pServiceHash);_this31.serviceType='Template';// These are the exact regex's used in lodash/underscore
|
|
2812
2822
|
// TODO: Switch this to precedent
|
|
2813
|
-
|
|
2823
|
+
_this31.Matchers={Evaluate:/<%([\s\S]+?)%>/g,Interpolate:/<%=([\s\S]+?)%>/g,Escaper:/\\|'|\r|\n|\t|\u2028|\u2029/g,Unescaper:/\\(\\|'|r|n|t|u2028|u2029)/g,// This is how underscore does it, so we are keeping it for now.
|
|
2814
2824
|
GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper functions.
|
|
2815
2825
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
2816
|
-
|
|
2826
|
+
_this31.templateEscapes={'\\':'\\',"'":"'",'r':'\r','\r':'r','n':'\n','\n':'n','t':'\t','\t':'t','u2028':"\u2028","\u2028":'u2028','u2029':"\u2029","\u2029":'u2029'};// This is defined as such to underscore that it is a dynamic programming
|
|
2817
2827
|
// function on this class.
|
|
2818
|
-
|
|
2828
|
+
_this31.renderFunction=false;_this31.templateString=false;return _this31;}_createClass2(FableServiceTemplate,[{key:"renderTemplate",value:function renderTemplate(pData){return this.renderFunction(pData);}},{key:"templateFunction",value:function templateFunction(pData){var fRenderTemplateBound=this.renderTemplate.bind(this);return fRenderTemplateBound;}},{key:"buildTemplateFunction",value:function buildTemplateFunction(pTemplateText,pData){var _this32=this;// For now this is being kept in a weird form ... this is to mimic the old
|
|
2819
2829
|
// underscore code until this is rewritten using precedent.
|
|
2820
|
-
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(
|
|
2830
|
+
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(_this32.templateEscapes[pMatch]);}).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"'+\n(".concat(decodeURIComponent(pCode),")+\n'");}).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"';\n".concat(decodeURIComponent(pCode),"\n;__p+='");})+"';\n";this.TemplateSource="with(pTemplateDataObject||{}){\n".concat(this.TemplateSource,"}\n");this.TemplateSource="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n".concat(this.TemplateSource,"return __p;\n");this.renderFunction=new Function('pTemplateDataObject',this.TemplateSource);if(typeof pData!='undefined'){return this.renderFunction(pData);}// Provide the compiled function source as a convenience for build time
|
|
2821
2831
|
// precompilation.
|
|
2822
|
-
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);return FableServiceTemplate;}(libFableServiceBase);module.exports=FableServiceTemplate;},{"../Fable-ServiceManager.js":91}],
|
|
2823
|
-
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var FableServiceUtility=/*#__PURE__*/function(
|
|
2832
|
+
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);return FableServiceTemplate;}(libFableServiceBase);module.exports=FableServiceTemplate;},{"../Fable-ServiceManager.js":91}],107:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2833
|
+
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var FableServiceUtility=/*#__PURE__*/function(_libFableServiceBase9){_inherits(FableServiceUtility,_libFableServiceBase9);var _super19=_createSuper(FableServiceUtility);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2824
2834
|
// string-based template with code snippets into simple executable pieces,
|
|
2825
2835
|
// with the added twist of returning a precompiled function ready to go.
|
|
2826
2836
|
//
|
|
@@ -2829,8 +2839,8 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
2829
2839
|
//
|
|
2830
2840
|
// This is an implementation of that.
|
|
2831
2841
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2832
|
-
function FableServiceUtility(pFable,pOptions,pServiceHash){var
|
|
2833
|
-
|
|
2842
|
+
function FableServiceUtility(pFable,pOptions,pServiceHash){var _this33;_classCallCheck2(this,FableServiceUtility);_this33=_super19.call(this,pFable,pOptions,pServiceHash);_this33.templates={};// These two functions are used extensively throughout
|
|
2843
|
+
_this33.waterfall=libAsyncWaterfall;_this33.eachLimit=libAsyncEachLimit;return _this33;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
2834
2844
|
// Now that es6 gives us this, use the native thingy.
|
|
2835
2845
|
_createClass2(FableServiceUtility,[{key:"extend",value:function extend(pDestinationObject){for(var _len2=arguments.length,pSourceObjects=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){pSourceObjects[_key2-1]=arguments[_key2];}return Object.assign.apply(Object,[pDestinationObject].concat(pSourceObjects));}// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2836
2846
|
// string-based template with code snippets into simple executable pieces,
|