pict 1.0.88 → 1.0.90
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/pict.compatible.js +34 -35
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +32 -33
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +6 -6
package/dist/pict.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.servicesMap=this.fable.servicesMap;this.services=this.fable.services;});_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.
|
|
@@ -509,31 +509,32 @@ function autoConstruct(pSettings){return new FableUUID(pSettings);}module.export
|
|
|
509
509
|
* Fable Application Services Management
|
|
510
510
|
* @author <steven@velozo.com>
|
|
511
511
|
*/var libFableServiceBase=require('fable-serviceproviderbase');var FableService=/*#__PURE__*/function(_libFableServiceBase$){_inherits(FableService,_libFableServiceBase$);var _super7=_createSuper(FableService);function FableService(pSettings,pServiceHash){var _this12;_classCallCheck2(this,FableService);_this12=_super7.call(this,pSettings,pServiceHash);_this12.serviceType='ServiceManager';_this12.serviceTypes=[];// A map of instantiated services
|
|
512
|
-
_this12.
|
|
513
|
-
_this12.
|
|
512
|
+
_this12.servicesMap={};// A map of the default instantiated service by type
|
|
513
|
+
_this12.services={};// A map of class constructors for services
|
|
514
514
|
_this12.serviceClasses={};// If we need extra service initialization capabilities
|
|
515
|
-
_this12.extraServiceInitialization=false;return _this12;}_createClass2(FableService,[{key:"addServiceType",value:function addServiceType(pServiceType,pServiceClass){//
|
|
516
|
-
this.
|
|
517
|
-
this.
|
|
515
|
+
_this12.extraServiceInitialization=false;return _this12;}_createClass2(FableService,[{key:"addServiceType",value:function addServiceType(pServiceType,pServiceClass){if(this.servicesMap.hasOwnProperty(pServiceType)){// TODO: Check if any services are running?
|
|
516
|
+
this.fable.log.warn("Adding a service type [".concat(pServiceType,"] that already exists."));}else{// Add the container for instantiated services to go in
|
|
517
|
+
this.servicesMap[pServiceType]={};// Add the type to the list of types
|
|
518
|
+
this.serviceTypes.push(pServiceType);}// Using the static member of the class is a much more reliable way to check if it is a service class than instanceof
|
|
518
519
|
if(typeof pServiceClass=='function'&&pServiceClass.isFableService){// Add the class to the list of classes
|
|
519
520
|
this.serviceClasses[pServiceType]=pServiceClass;}else{// Add the base class to the list of classes
|
|
520
521
|
this.fable.log.error("Attempted to add service type [".concat(pServiceType,"] with an invalid class. Using base service class, which will not crash but won't provide meaningful services."));this.serviceClasses[pServiceType]=libFableServiceBase;}}// This is for the services that are meant to run mostly single-instance so need a default at initialization
|
|
521
|
-
},{key:"addAndInstantiateServiceType",value:function addAndInstantiateServiceType(pServiceType,pServiceClass){this.addServiceType(pServiceType,pServiceClass);this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}// Some services expect to be overloaded / customized class.
|
|
522
|
+
},{key:"addAndInstantiateServiceType",value:function addAndInstantiateServiceType(pServiceType,pServiceClass){this.addServiceType(pServiceType,pServiceClass);return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}// Some services expect to be overloaded / customized class.
|
|
522
523
|
},{key:"instantiateServiceProviderFromPrototype",value:function instantiateServiceProviderFromPrototype(pServiceType,pOptions,pCustomServiceHash,pServicePrototype){// Instantiate the service
|
|
523
524
|
var tmpService=new pServicePrototype(this.fable,pOptions,pCustomServiceHash);if(this.extraServiceInitialization){tmpService=this.extraServiceInitialization(tmpService);}// Add the service to the service map
|
|
524
|
-
this.
|
|
525
|
-
if(!this.
|
|
525
|
+
this.servicesMap[pServiceType][tmpService.Hash]=tmpService;// If this is the first service of this type, make it the default
|
|
526
|
+
if(!this.services.hasOwnProperty(pServiceType)){this.setDefaultServiceInstantiation(pServiceType,tmpService.Hash);}return tmpService;}},{key:"instantiateServiceProvider",value:function instantiateServiceProvider(pServiceType,pOptions,pCustomServiceHash){// Instantiate the service
|
|
526
527
|
var tmpService=this.instantiateServiceProviderWithoutRegistration(pServiceType,pOptions,pCustomServiceHash);// Add the service to the service map
|
|
527
|
-
this.
|
|
528
|
-
if(!this.
|
|
528
|
+
this.servicesMap[pServiceType][tmpService.Hash]=tmpService;// If this is the first service of this type, make it the default
|
|
529
|
+
if(!this.services.hasOwnProperty(pServiceType)){this.setDefaultServiceInstantiation(pServiceType,tmpService.Hash);}return tmpService;}// Create a service provider but don't register it to live forever in fable.services
|
|
529
530
|
},{key:"instantiateServiceProviderWithoutRegistration",value:function instantiateServiceProviderWithoutRegistration(pServiceType,pOptions,pCustomServiceHash){// Instantiate the service
|
|
530
531
|
var tmpService=new this.serviceClasses[pServiceType](this.fable,pOptions,pCustomServiceHash);if(this.extraServiceInitialization){tmpService=this.extraServiceInitialization(tmpService);}return tmpService;}// Connect an initialized service provider that came before Fable was initialized
|
|
531
532
|
},{key:"connectPreinitServiceProviderInstance",value:function connectPreinitServiceProviderInstance(pServiceInstance){var tmpServiceType=pServiceInstance.serviceType;var tmpServiceHash=pServiceInstance.Hash;// The service should already be instantiated, so just connect it to fable
|
|
532
|
-
pServiceInstance.connectFable(this.fable);if(!this.
|
|
533
|
+
pServiceInstance.connectFable(this.fable);if(!this.servicesMap.hasOwnProperty(tmpServiceType)){// If the core service hasn't registered itself yet, create the service container for it.
|
|
533
534
|
// This means you couldn't register another with this type unless it was later registered with a constructor class.
|
|
534
|
-
this.
|
|
535
|
-
this.
|
|
536
|
-
if(!this.
|
|
535
|
+
this.servicesMap[tmpServiceType]={};}// Add the service to the service map
|
|
536
|
+
this.servicesMap[tmpServiceType][tmpServiceHash]=pServiceInstance;// If this is the first service of this type, make it the default
|
|
537
|
+
if(!this.services.hasOwnProperty(tmpServiceType)){this.setDefaultServiceInstantiation(tmpServiceType,tmpServiceHash);}return pServiceInstance;}},{key:"setDefaultServiceInstantiation",value:function setDefaultServiceInstantiation(pServiceType,pServiceHash){if(this.servicesMap[pServiceType].hasOwnProperty(pServiceHash)){this.fable[pServiceType]=this.servicesMap[pServiceType][pServiceHash];this.services[pServiceType]=this.servicesMap[pServiceType][pServiceHash];return true;}return false;}}]);return FableService;}(libFableServiceBase.CoreServiceProviderBase);module.exports=FableService;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;},{"fable-serviceproviderbase":33}],40:[function(require,module,exports){/**
|
|
537
538
|
* Fable Application Services Support Library
|
|
538
539
|
* @author <steven@velozo.com>
|
|
539
540
|
*/ // Pre-init services
|
|
@@ -550,7 +551,7 @@ this._coreServices.ServiceManager=new libFableServiceManager(this);this.serviceM
|
|
|
550
551
|
// Initialization Phase 2: Map in the default services.
|
|
551
552
|
// They will then be available in the Default service provider set as well.
|
|
552
553
|
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
|
|
553
|
-
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:"
|
|
554
|
+
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:"servicesMap",get:function get(){return this._coreServices.ServiceManager.servicesMap;}},{key:"getUUID",value:function getUUID(){return this._coreServices.UUID.getUUID();}},{key:"fable",get:function get(){return this;}}]);return Fable;}();// This is for backwards compatibility
|
|
554
555
|
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":39,"./services/Fable-Service-Anticipate.js":41,"./services/Fable-Service-CSVParser.js":42,"./services/Fable-Service-DataFormat.js":43,"./services/Fable-Service-DataGeneration.js":45,"./services/Fable-Service-EnvironmentData.js":46,"./services/Fable-Service-FilePersistence.js":47,"./services/Fable-Service-MetaTemplate.js":48,"./services/Fable-Service-Operation.js":52,"./services/Fable-Service-RestClient.js":53,"./services/Fable-Service-Template.js":54,"./services/Fable-Service-Utility.js":55,"cachetrax":21,"fable-log":31,"fable-settings":36,"fable-uuid":38,"manyfest":69}],41:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceAnticipate=/*#__PURE__*/function(_libFableServiceBase){_inherits(FableServiceAnticipate,_libFableServiceBase);var _super8=_createSuper(FableServiceAnticipate);function FableServiceAnticipate(pFable,pOptions,pServiceHash){var _this13;_classCallCheck2(this,FableServiceAnticipate);_this13=_super8.call(this,pFable,pOptions,pServiceHash);_this13.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
|
|
555
556
|
_this13.operationQueue=[];_this13.erroredOperations=[];_this13.executingOperationCount=0;_this13.completedOperationCount=0;_this13.maxOperations=1;_this13.lastError=undefined;_this13.waitingFunctions=[];return _this13;}_createClass2(FableServiceAnticipate,[{key:"checkQueue",value:function checkQueue(){// This checks to see if we need to start any operations.
|
|
556
557
|
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.
|
|
@@ -780,7 +781,7 @@ return'';}if(tmpEnclosedValueEndIndex>0&&tmpEnclosedValueEndIndex>tmpEnclosedVal
|
|
|
780
781
|
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":33}],44:[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"]};},{}],45:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceDataGeneration=/*#__PURE__*/function(_libFableServiceBase2){_inherits(FableServiceDataGeneration,_libFableServiceBase2);var _super11=_createSuper(FableServiceDataGeneration);function FableServiceDataGeneration(pFable,pOptions,pServiceHash){var _this16;_classCallCheck2(this,FableServiceDataGeneration);_this16=_super11.call(this,pFable,pOptions,pServiceHash);_this16.serviceType='DataGeneration';_this16.defaultData=require('./Fable-Service-DataGeneration-DefaultValues.json');return _this16;}// Return a random integer between pMinimum and pMaximum
|
|
781
782
|
_createClass2(FableServiceDataGeneration,[{key:"randomIntegerBetween",value:function randomIntegerBetween(pMinimum,pMaximum){return Math.floor(Math.random()*(pMaximum-pMinimum))+pMinimum;}// Return a random integer up to the passed-in maximum
|
|
782
783
|
},{key:"randomIntegerUpTo",value:function randomIntegerUpTo(pMaximum){return this.randomIntegerBetween(0,pMaximum);}// Return a random integer between 0 and 9999999
|
|
783
|
-
},{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.
|
|
784
|
+
},{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.services.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":39,"./Fable-Service-DataGeneration-DefaultValues.json":44}],46:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceEnvironmentData=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableServiceEnvironmentData,_libFableServiceBase3);var _super12=_createSuper(FableServiceEnvironmentData);function FableServiceEnvironmentData(pFable,pOptions,pServiceHash){var _this17;_classCallCheck2(this,FableServiceEnvironmentData);_this17=_super12.call(this,pFable,pOptions,pServiceHash);_this17.serviceType='EnvironmentData';_this17.Environment="node.js";return _this17;}return _createClass2(FableServiceEnvironmentData);}(libFableServiceBase);module.exports=FableServiceEnvironmentData;},{"../Fable-ServiceManager.js":39}],47:[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 _super13=_createSuper(FableServiceFilePersistence);function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this18;_classCallCheck2(this,FableServiceFilePersistence);_this18=_super13.call(this,pFable,pOptions,pServiceHash);_this18.serviceType='FilePersistence';if(!_this18.options.hasOwnProperty('Mode')){_this18.options.Mode=parseInt('0777',8)&~process.umask();}_this18.currentInputFolder="/tmp";_this18.currentOutputFolder="/tmp";return _this18;}_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
|
|
784
785
|
},{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
|
|
785
786
|
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this19=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
|
|
786
787
|
if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
|
|
@@ -795,7 +796,7 @@ return _this19.makeFolderRecursive(tmpParameters,fCallback);}else{fCallback(pCre
|
|
|
795
796
|
* @author Steven Velozo <steven@velozo.com>
|
|
796
797
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
797
798
|
*/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 _super14=_createSuper(FableServiceMetaTemplate);function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this20;_classCallCheck2(this,FableServiceMetaTemplate);_this20=_super14.call(this,pFable,pOptions,pServiceHash);_this20.serviceType='MetaTemplate';_this20.WordTree=new libWordTree();// In order to allow asynchronous template processing we need to use the async.eachLimit function
|
|
798
|
-
_this20.StringParser=new libStringParser(_this20.fable.
|
|
799
|
+
_this20.StringParser=new libStringParser(_this20.fable.services.Utility.eachLimit);_this20.ParseTree=_this20.WordTree.ParseTree;return _this20;}/**
|
|
799
800
|
* Add a Pattern to the Parse Tree
|
|
800
801
|
* @method addPattern
|
|
801
802
|
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
@@ -926,7 +927,7 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
926
927
|
* @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.
|
|
927
928
|
* @return {bool} True if adding the pattern was successful
|
|
928
929
|
*/},{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;},{}],51:[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":[]};},{}],52:[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 _super15=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,FableOperation);_this23=_super15.call(this,pFable,pOptions,pServiceHash);_this23.serviceType='PhasedOperation';_this23.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
929
|
-
_this23.state.Metadata.Hash=_this23.Hash;_this23.state.Metadata.UUID=_this23.UUID;_this23.name=typeof _this23.options.Name=='string'?_this23.options.Name:"Unnamed Operation ".concat(_this23.state.Metadata.UUID);_this23.log=_assertThisInitialized(_this23);return _this23;}_createClass2(FableOperation,[{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":39,"./Fable-Service-Operation-DefaultSettings.js":51}],53:[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 _super16=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,FableServiceRestClient);_this24=_super16.call(this,pFable,pOptions,pServiceHash);_this24.TraceLog=false;if(_this24.options.TraceLog||_this24.fable.TraceLog){_this24.TraceLog=true;}_this24.dataFormat=_this24.fable.
|
|
930
|
+
_this23.state.Metadata.Hash=_this23.Hash;_this23.state.Metadata.UUID=_this23.UUID;_this23.name=typeof _this23.options.Name=='string'?_this23.options.Name:"Unnamed Operation ".concat(_this23.state.Metadata.UUID);_this23.log=_assertThisInitialized(_this23);return _this23;}_createClass2(FableOperation,[{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":39,"./Fable-Service-Operation-DefaultSettings.js":51}],53:[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 _super16=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,FableServiceRestClient);_this24=_super16.call(this,pFable,pOptions,pServiceHash);_this24.TraceLog=false;if(_this24.options.TraceLog||_this24.fable.TraceLog){_this24.TraceLog=true;}_this24.dataFormat=_this24.fable.services.DataFormat;_this24.serviceType='RestClient';_this24.cookie=false;// This is a function that can be overridden, to allow the management
|
|
930
931
|
// of the request options before they are passed to the request library.
|
|
931
932
|
_this24.prepareRequestOptions=function(pOptions){return pOptions;};return _this24;}_createClass2(FableServiceRestClient,[{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKey=Object.keys(this.cookie);pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKey,this.cookie[tmpCookieKey]);}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
932
933
|
var tmpOptions=this.prepareCookies(pOptions);return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this25=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(_this25.TraceLog){var tmpConnectTime=_this25.fable.log.getTimeStamp();_this25.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this25.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.
|
|
@@ -1598,19 +1599,17 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
1598
1599
|
* @class Manyfest
|
|
1599
1600
|
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi7){_inherits(Manyfest,_libFableServiceProvi7);var _super19=_createSuper(Manyfest);function Manyfest(pFable,pManifest,pServiceHash){var _this32;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this32=_super19.call(this,{});}else{_this32=_super19.call(this,pFable,pManifest,pServiceHash);}_this32.serviceType='Manifest';// Wire in logging
|
|
1600
1601
|
_this32.logInfo=libSimpleLog;_this32.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
1601
|
-
_this32.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this32.logInfo,_this32.logError);_this32.objectAddressGetValue=new libObjectAddressGetValue(_this32.logInfo,_this32.logError);_this32.objectAddressSetValue=new libObjectAddressSetValue(_this32.logInfo,_this32.logError);_this32.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this32.logInfo,_this32.logError);if(!_this32.options.hasOwnProperty('defaultValues')){_this32.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this32.options.hasOwnProperty('strict')){_this32.options.strict=false;}_this32.scope=undefined;_this32.elementAddresses=undefined;_this32.elementHashes=undefined;_this32.elementDescriptors=undefined
|
|
1602
|
-
_this32.dataSolvers=undefined;// So solvers can use their own state
|
|
1603
|
-
_this32.dataSolverState=undefined;_this32.reset();if(_typeof(_this32.options)==='object'){_this32.loadManifest(_this32.options);}_this32.schemaManipulations=new libSchemaManipulation(_this32.logInfo,_this32.logError);_this32.objectAddressGeneration=new libObjectAddressGeneration(_this32.logInfo,_this32.logError);_this32.hashTranslations=new libHashTranslation(_this32.logInfo,_this32.logError);return _possibleConstructorReturn(_this32);}/*************************************************************************
|
|
1602
|
+
_this32.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this32.logInfo,_this32.logError);_this32.objectAddressGetValue=new libObjectAddressGetValue(_this32.logInfo,_this32.logError);_this32.objectAddressSetValue=new libObjectAddressSetValue(_this32.logInfo,_this32.logError);_this32.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this32.logInfo,_this32.logError);if(!_this32.options.hasOwnProperty('defaultValues')){_this32.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this32.options.hasOwnProperty('strict')){_this32.options.strict=false;}_this32.scope=undefined;_this32.elementAddresses=undefined;_this32.elementHashes=undefined;_this32.elementDescriptors=undefined;_this32.reset();if(_typeof(_this32.options)==='object'){_this32.loadManifest(_this32.options);}_this32.schemaManipulations=new libSchemaManipulation(_this32.logInfo,_this32.logError);_this32.objectAddressGeneration=new libObjectAddressGeneration(_this32.logInfo,_this32.logError);_this32.hashTranslations=new libHashTranslation(_this32.logInfo,_this32.logError);return _possibleConstructorReturn(_this32);}/*************************************************************************
|
|
1604
1603
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
1605
1604
|
*/ // Reset critical manifest properties
|
|
1606
|
-
_createClass2(Manyfest,[{key:"reset",value:function reset(){this.scope='DEFAULT';this.elementAddresses=[];this.elementHashes={};this.elementDescriptors={};
|
|
1605
|
+
_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
|
|
1607
1606
|
var tmpNewOptions=JSON.parse(JSON.stringify(this.options));var tmpNewManyfest=new Manyfest(this.getManifest(),this.logInfo,this.logError,tmpNewOptions);// Import the hash translations
|
|
1608
1607
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);return tmpNewManyfest;}// Deserialize a Manifest from a string
|
|
1609
1608
|
},{key:"deserialize",value:function deserialize(pManifestString){// TODO: Add guards for bad manifest string
|
|
1610
1609
|
return this.loadManifest(JSON.parse(pManifestString));}// Load a manifest from an object
|
|
1611
|
-
},{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 _i10=0;_i10<tmpDescriptionAddresses.length;_i10++){this.addDescriptor(tmpDescriptionAddresses[_i10],tmpManifest.Descriptors[tmpDescriptionAddresses[_i10]]);}}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);}
|
|
1612
|
-
//
|
|
1613
|
-
},{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
|
|
1610
|
+
},{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 _i10=0;_i10<tmpDescriptionAddresses.length;_i10++){this.addDescriptor(tmpDescriptionAddresses[_i10],tmpManifest.Descriptors[tmpDescriptionAddresses[_i10]]);}}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);}if(tmpManifest.hasOwnProperty('HashTranslations')){if(_typeof(tmpManifest.HashTranslations)==='object'){for(var _i11=0;_i11<tmpManifest.HashTranslations.length;_i11++){// Each translation is
|
|
1611
|
+
}}}}// Serialize the Manifest to a string
|
|
1612
|
+
},{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)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))};}// Add a descriptor to the manifest
|
|
1614
1613
|
},{key:"addDescriptor",value:function addDescriptor(pAddress,pDescriptor){if(_typeof(pDescriptor)==='object'){// Add the Address into the Descriptor if it doesn't exist:
|
|
1615
1614
|
if(!pDescriptor.hasOwnProperty('Address')){pDescriptor.Address=pAddress;}if(!this.elementDescriptors.hasOwnProperty(pAddress)){this.elementAddresses.push(pAddress);}// Add the element descriptor to the schema
|
|
1616
1615
|
this.elementDescriptors[pAddress]=pDescriptor;// Always add the address as a hash
|
|
@@ -1744,17 +1743,17 @@ MainViewportView:'Default-View',MainViewportRenderable:'Application-Default-View
|
|
|
1744
1743
|
AutoRenderMainViewportView:false,Manifests:{},// The prefix to prepend on all template destination hashes
|
|
1745
1744
|
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this34=_super20.call(this,pFable,tmpOptions,pServiceHash);_this34.serviceType='PictApplication';_this34.AppData=_this34.fable.AppData;_this34.initializationFunctionSet=[];var tmpManifestKeys=Object.keys(_this34.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
1746
1745
|
var tmpManifestKey=tmpManifestKeys[i];_this34.fable.serviceManager.instantiateServiceProvider('Manifest',_this34.options.Manifests[tmpManifestKey],tmpManifestKey);}}if(_this34.options.InitializeOnLoad){return _possibleConstructorReturn(_this34,_this34.initialize());}if(_this34.options.AutoRenderMainViewportView){_this34.log.info("Pict Application ".concat(_this34.options.Name,"[").concat(_this34.UUID,"]::[").concat(_this34.Hash,"] beginning auto render of [").concat(_this34.options.MainViewportView,"::").concat(_this34.options.MainViewportRenderable,"]."));_this34.renderAsync(_this34.options.MainViewportView,_this34.options.MainViewportRenderable,_this34.options.MainViewportDestinationAddress,_this34.options.MainViewportDefaultDataAddress,function(){});}return _this34;}// TODO: do we need an asynchronous version of this?
|
|
1747
|
-
_createClass2(PictApplication,[{key:"solve",value:function solve(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] executing solve() function..."));return true;}},{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] beginning initialization..."));this.internalInitialize();this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] initialization complete."));}},{key:"render",value:function render(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpView=typeof pViewHash==='string'?this.
|
|
1746
|
+
_createClass2(PictApplication,[{key:"solve",value:function solve(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] executing solve() function..."));return true;}},{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] beginning initialization..."));this.internalInitialize();this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] initialization complete."));}},{key:"render",value:function render(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpView=typeof pViewHash==='string'?this.servicesMap.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.render(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress);}},{key:"renderAsync",value:function renderAsync(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var tmpView=typeof pViewHash==='string'?this.servicesMap.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback);}}]);return PictApplication;}(libFableServiceBase);module.exports=PictApplication;},{"fable-serviceproviderbase":33}],73:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:'DEFAULT',InitializeOnLoad:true,RenderOnLoad:false,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,PictView);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this35=_super21.call(this,pFable,tmpOptions,pServiceHash);_this35.serviceType='PictView';// Wire in the essential Pict service
|
|
1748
1747
|
_this35.AppData=_this35.fable.AppData;// Load all templates from the array in the options
|
|
1749
1748
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
1750
1749
|
for(var i=0;i<_this35.options.Templates.length;i++){var tmpTemplate=_this35.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," options object.");}_this35.fable.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
1751
1750
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
1752
|
-
for(var
|
|
1751
|
+
for(var _i12=0;_i12<_this35.options.DefaultTemplates.length;_i12++){var tmpDefaultTemplate=_this35.options.DefaultTemplates[_i12];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Default Template ").concat(_i12," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," options object.");}_this35.fable.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load all renderables
|
|
1753
1752
|
// Renderables are launchable renderable instructions with templates
|
|
1754
1753
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
1755
1754
|
// The only parts that are necessary are Identifier and Template
|
|
1756
1755
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
1757
|
-
_this35.renderables={};for(var
|
|
1756
|
+
_this35.renderables={};for(var _i13=0;_i13<_this35.options.Renderables.length;_i13++){var tmpRenderable=_this35.options.Renderables[_i13];if(!tmpRenderable.hasOwnProperty('RenderableHash')||!tmpRenderable.hasOwnProperty('TemplateHash')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Renderable ").concat(_i13," in the options array."),tmpRenderable);}else{_this35.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}if(_this35.options.InitializeOnLoad){_this35.initialize();}if(_this35.options.RenderOnLoad){_this35.render(_this35.options.DefaultRenderable,_this35.options.DefaultDestinationAddress,_this35.options.DefaultTemplateRecordAddress);_this35.postInitialRenderInitialize();}return _this35;}_createClass2(PictView,[{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"postInitialRenderInitialize",value:function postInitialRenderInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));this.internalInitialize();this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization complete."));}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;var tmpContent=this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData);return this.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this36=this;var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable.")));}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return fCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this36.log.error("PictView [".concat(_this36.UUID,"]::[").concat(_this36.Hash,"] ").concat(_this36.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it did not parse the template."),pError);return fCallback(pError);}_this36.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);return fCallback(null,pContent);});}}]);return PictView;}(libFableServiceBase);module.exports=PictView;},{"fable-serviceproviderbase":33}],74:[function(require,module,exports){/**
|
|
1758
1757
|
* Precedent Meta-Templating
|
|
1759
1758
|
*
|
|
1760
1759
|
* @license MIT
|
|
@@ -3046,20 +3045,20 @@ var _tmpHashEntitySeparator=tmpHash.indexOf(':');tmpEntity=tmpHash.substring(0,_
|
|
|
3046
3045
|
tmpEntityID=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpEntityID);}// No Entity or EntityID
|
|
3047
3046
|
if(!tmpEntity||!tmpEntityID){_this44.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]"));return fCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]")),'');}// Now try to get the entity
|
|
3048
3047
|
_this44.EntityProvider.getEntity(tmpEntity,tmpEntityID,function(pError,pRecord){if(pError){_this44.log.error("Pict: Entity Render: Error getting entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] for [").concat(tmpHash,"]: ").concat(pError),pError);return fCallback(pError,'');}// Now render the template
|
|
3049
|
-
if(tmpEntityTemplate){return fCallback(null,_this44.parseTemplateByHash(tmpEntityTemplate,pRecord));}else{return fCallback(null,'');}});};this.
|
|
3048
|
+
if(tmpEntityTemplate){return fCallback(null,_this44.parseTemplateByHash(tmpEntityTemplate,pRecord));}else{return fCallback(null,'');}});};this.MetaTemplate.addPatternAsync('{~E:','~}',fEntityRender);this.MetaTemplate.addPatternAsync('{~Entity:','~}',fEntityRender);// {NE~Some.Address|If the left value is truthy, render this value.~}
|
|
3050
3049
|
var fNotEmptyRender=function fNotEmptyRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>2){_this44.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"]"));}// Should switch this to indexOf so pipes can be in the content.
|
|
3051
3050
|
var tmpHashParts=tmpHash.split('|');// For now just check truthiness
|
|
3052
|
-
if(_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHashParts[0])){return tmpHashParts[1];}else{return'';}};this.
|
|
3051
|
+
if(_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHashParts[0])){return tmpHashParts[1];}else{return'';}};this.MetaTemplate.addPattern('{~NotEmpty:','~}',fNotEmptyRender);this.MetaTemplate.addPattern('{~NE:','~}',fNotEmptyRender);// {~T:Template:AddressOfData~}
|
|
3053
3052
|
var fTemplateRender=function fTemplateRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>0){_this44.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
|
|
3054
3053
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
3055
3054
|
if(!tmpTemplateHash){_this44.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
3056
|
-
return _this44.parseTemplateByHash(tmpTemplateHash,pData);}else{return _this44.parseTemplateByHash(tmpTemplateHash,_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpAddressOfData));}};this.
|
|
3055
|
+
return _this44.parseTemplateByHash(tmpTemplateHash,pData);}else{return _this44.parseTemplateByHash(tmpTemplateHash,_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpAddressOfData));}};this.MetaTemplate.addPattern('{~T:','~}',fTemplateRender);this.MetaTemplate.addPattern('{~Template:','~}',fTemplateRender);// {~TS:Template:AddressOfDataSet~}
|
|
3057
3056
|
var fTemplateSetRender=function fTemplateSetRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>0){_this44.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
|
|
3058
3057
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
3059
3058
|
if(!tmpTemplateHash){_this44.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
3060
|
-
return _this44.parseTemplateSetByHash(tmpTemplateHash,pData);}else{return _this44.parseTemplateSetByHash(tmpTemplateHash,_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpAddressOfData));}};this.
|
|
3061
|
-
var fDataRender=function fDataRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHash);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;};this.
|
|
3059
|
+
return _this44.parseTemplateSetByHash(tmpTemplateHash,pData);}else{return _this44.parseTemplateSetByHash(tmpTemplateHash,_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpAddressOfData));}};this.MetaTemplate.addPattern('{~TS:','~}',fTemplateSetRender);this.MetaTemplate.addPattern('{~TemplateSet:','~}',fTemplateSetRender);//{~Data:AppData.Some.Value.to.Render~}
|
|
3060
|
+
var fDataRender=function fDataRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHash);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;};this.MetaTemplate.addPattern('{~D:','~}',fDataRender);this.MetaTemplate.addPattern('{~Data:','~}',fDataRender);this.MetaTemplate.addPattern('{~Dollars:','~}',function(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"]"));}var tmpColumnData=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHash);return _this44.DataFormat.formatterDollars(tmpColumnData);});this.MetaTemplate.addPattern('{~Digits:','~}',function(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"]"));}var tmpColumnData=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHash);return _this44.DataFormat.formatterAddCommasToNumber(_this44.DataFormat.formatterRoundNumber(tmpColumnData,2));});var fRandomNumberString=function fRandomNumberString(pHash,pData){var tmpHash=pHash.trim();if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fRandomNumberString]::[".concat(tmpHash,"]"));}var tmpStringLength=4;var tmpMaxNumber=9999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){tmpStringLength=parseInt(tmpHashParts[0]);}if(tmpHashParts.length>1){tmpMaxNumber=parseInt(tmpHashParts[1]);}}return _this44.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumberString:','~}',fRandomNumberString);this.MetaTemplate.addPattern('{~RNS:','~}',fRandomNumberString);var fRandomNumber=function fRandomNumber(pHash,pData){var tmpHash=pHash.trim();if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fRandomNumber]::[".concat(tmpHash,"]"));}var tmpMinimumNumber=0;var tmpMaxNumber=9999999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){tmpMinimumNumber=parseInt(tmpHashParts[0]);}if(tmpHashParts.length>1){tmpMaxNumber=parseInt(tmpHashParts[1]);}}return _this44.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumber:','~}',fRandomNumber);this.MetaTemplate.addPattern('{~RN:','~}',fRandomNumber);var fPascalCaseIdentifier=function fPascalCaseIdentifier(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this44.LogNoisiness>4){_this44.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this44.LogNoisiness>3){_this44.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"]"));}var tmpValue=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHash);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return _this44.DataFormat.cleanNonAlphaCharacters(_this44.DataFormat.capitalizeEachWord(tmpValue));};this.MetaTemplate.addPattern('{~PascalCaseIdentifier:','~}',fPascalCaseIdentifier);var fLogValue=function fLogValue(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpValue=_this44.manifest.getValueByHash({AppData:_this44.AppData,Bundle:_this44.Bundle,Record:tmpData},tmpHash);var tmpValueType=_typeof(tmpValue);if(tmpValue==null||tmpValueType=='undefined'){_this44.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is ").concat(tmpValueType,"."));}else if(tmpValueType=='object'){_this44.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is an obect."),tmpValue);}else{_this44.log.trace("PICT Template Log Value: [".concat(tmpHash,"] if a ").concat(tmpValueType," = [").concat(tmpValue,"]"));}return'';};this.MetaTemplate.addPattern('{~LogValue:','~}',fLogValue);this.MetaTemplate.addPattern('{~LV:','~}',fLogValue);var fLogStatement=function fLogStatement(pHash,pData){var tmpHash=pHash.trim();_this44.log.trace("PICT Template Log Message: ".concat(tmpHash));return'';};this.MetaTemplate.addPattern('{~LogStatement:','~}',fLogStatement);this.MetaTemplate.addPattern('{~LS:','~}',fLogStatement);var fBreakpoint=function fBreakpoint(pHash,pData){var tmpHash=pHash.trim();var tmpError=new Error("PICT Template Breakpoint: ".concat(tmpHash));_this44.log.trace("PICT Template Breakpoint: ".concat(tmpHash),tmpError.stack);debugger;return'';};this.MetaTemplate.addPattern('{~Breakpoint','~}',fBreakpoint);this._DefaultPictTemplatesInitialized=true;}}},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback){var tmpData=_typeof(pData)==='object'?pData:{};return this.MetaTemplate.parseString(pTemplateString,tmpData,fCallback);}},{key:"parseTemplateByHash",value:function parseTemplateByHash(pTemplateHash,pData,fCallback){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
|
|
3062
3061
|
if(!tmpTemplateString){return'';}return this.parseTemplate(tmpTemplateString,pData,fCallback);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback){var _this45=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
3063
|
-
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.
|
|
3062
|
+
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this45.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error('Pict: Template Set: pDataSet is not an array or object.'),'');}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i]);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i14=0;_i14<tmpKeys.length;_i14++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i14]]);}}return tmpValue;}else{return'';}}}},{key:"parseTemplateSetByHash",value:function parseTemplateSetByHash(pTemplateHash,pDataSet,fCallback){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
|
|
3064
3063
|
if(!tmpTemplateString){return'';}return this.parseTemplateSet(tmpTemplateString,pDataSet,fCallback);}}]);return Pict;}(libFable);;module.exports=Pict;module.exports.PictApplicationClass=require('./Pict-Application.js');module.exports.PictViewClass=require('./Pict-View.js');// This is to help understand the type of enivironement we're executing in
|
|
3065
3064
|
module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");},{"./Pict-Application.js":111,"./Pict-Content-Assignment.js":112,"./Pict-DataProvider.js":113,"./Pict-Meadow-EntityProvider.js":114,"./Pict-Template-Provider.js":115,"./Pict-View.js":116,"fable":40}]},{},[117])(117);});
|