pict 1.0.178 → 1.0.180
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 +174 -166
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +41 -33
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +4 -4
package/dist/pict.compatible.js
CHANGED
|
@@ -1121,8 +1121,7 @@ return _this18;}_inherits(DateManipulation,_libFableServiceProvi8);return _creat
|
|
|
1121
1121
|
* longer amount of time than just writing the parser from scratch, et voila.
|
|
1122
1122
|
*/var FableServiceExpressionParser=/*#__PURE__*/function(_libFableServiceBase4){function FableServiceExpressionParser(pFable,pOptions,pServiceHash){var _this20;_classCallCheck2(this,FableServiceExpressionParser);_this20=_callSuper(this,FableServiceExpressionParser,[pFable,pOptions,pServiceHash]);_this20.tokenMap=require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json');// This precedence is higher than defined in our token map
|
|
1123
1123
|
_this20.tokenMaxPrecedence=5;_this20.functionMap=require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json');_this20.serviceType='ExpressionParser';_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Tokenizer',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Linter',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Postfix',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Solver',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js'));_this20.Tokenizer=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Tokenizer');_this20.Linter=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Linter');_this20.Postfix=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Postfix');_this20.Solver=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Solver');// Now wire each of these up. Not in love with this pattern but better than a giant file here.
|
|
1124
|
-
_this20.Tokenizer.connectExpressionParser(_this20);_this20.Linter.connectExpressionParser(_this20);_this20.Postfix.connectExpressionParser(_this20);_this20.Solver.connectExpressionParser(_this20);return _this20;}_inherits(FableServiceExpressionParser,_libFableServiceBase4);return _createClass2(FableServiceExpressionParser,[{key:"substituteValuesInTokenizedObjects",value:function substituteValuesInTokenizedObjects(pTokenizedObjects,pDataSource,pResultObject,
|
|
1125
|
-
var tmpManifest=this.fable.newManyfest(pManifestDefinition);for(var i=0;i<pTokenizedObjects.length;i++){if(_typeof(pTokenizedObjects[i])!=='object'){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.substituteValuesInTokenizedObjects found a non-object tokenized object at index ".concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}var tmpToken=pTokenizedObjects[i];if(pTokenizedObjects[i].Type==='Token.Symbol'&&!tmpToken.Resolved){// Symbols always look up values by hash first
|
|
1124
|
+
_this20.Tokenizer.connectExpressionParser(_this20);_this20.Linter.connectExpressionParser(_this20);_this20.Postfix.connectExpressionParser(_this20);_this20.Solver.connectExpressionParser(_this20);return _this20;}_inherits(FableServiceExpressionParser,_libFableServiceBase4);return _createClass2(FableServiceExpressionParser,[{key:"substituteValuesInTokenizedObjects",value:function substituteValuesInTokenizedObjects(pTokenizedObjects,pDataSource,pResultObject,pManifest){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};if(!Array.isArray(pTokenizedObjects)){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects was passed a non-array tokenized object list.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedObjects;}if(_typeof(pDataSource)!=='object'){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects either was passed no data source, or was passed a non-object data source.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedObjects;}var tmpDataSource=pDataSource;var tmpManifest=_typeof(pManifest)=='object'?pManifest:this.fable.newManyfest(pManifest);for(var i=0;i<pTokenizedObjects.length;i++){if(_typeof(pTokenizedObjects[i])!=='object'){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.substituteValuesInTokenizedObjects found a non-object tokenized object at index ".concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}var tmpToken=pTokenizedObjects[i];if(pTokenizedObjects[i].Type==='Token.Symbol'&&!tmpToken.Resolved){// Symbols always look up values by hash first
|
|
1126
1125
|
var tmpValue=tmpManifest.getValueByHash(tmpDataSource,tmpToken.Token);// if (!tmpValue)
|
|
1127
1126
|
// {
|
|
1128
1127
|
// // If no hash resolves, try by address.
|
|
@@ -1130,7 +1129,7 @@ var tmpValue=tmpManifest.getValueByHash(tmpDataSource,tmpToken.Token);// if (!tm
|
|
|
1130
1129
|
// }
|
|
1131
1130
|
if(!tmpValue){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.substituteValuesInTokenizedObjects found no value for the symbol hash or address ".concat(tmpToken.Token," at index ").concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}else{tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(tmpValue,"] for the state address ").concat(tmpToken.Token," at index ").concat(i));this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{var tmpValueParsed=new this.fable.Utility.bigNumber(tmpValue);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}if(pTokenizedObjects[i].Type==='Token.StateAddress'&&!tmpToken.Resolved){// Symbols are always hashes. This gracefully works for simple shallow objects because hashes default to the address in Manyfest.
|
|
1132
1131
|
var _tmpValue=tmpManifest.getValueAtAddress(tmpDataSource,tmpToken.Token);if(!_tmpValue){tmpResults.ExpressionParserLog.push("WARNING: ExpressionParser.substituteValuesInTokenizedObjects found no value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}else{tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(_tmpValue,"] for the state address ").concat(tmpToken.Token," at index ").concat(i));this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{var _tmpValueParsed=new this.fable.Utility.bigNumber(_tmpValue);tmpToken.Resolved=true;tmpToken.Value=_tmpValueParsed.toString();}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}if(pTokenizedObjects[i].Type==='Token.Constant'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(tmpToken.Token,"] for the constant ").concat(tmpToken.Token," at index ").concat(i));this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{var _tmpValueParsed2=new this.fable.Utility.bigNumber(tmpToken.Token);tmpToken.Resolved=true;tmpToken.Value=_tmpValueParsed2.toString();}catch(pError){// This constant has the right symbols but apparently isn't a parsable number.
|
|
1133
|
-
tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}return pTokenizedObjects;}},{key:"tokenize",value:function tokenize(pExpression,pResultObject){return this.Tokenizer.tokenize(pExpression,pResultObject);}},{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){return this.Linter.lintTokenizedExpression(pTokenizedExpression,pResultObject);}},{key:"buildPostfixedSolveList",value:function buildPostfixedSolveList(pTokenizedExpression,pResultObject){return this.Postfix.buildPostfixedSolveList(pTokenizedExpression,pResultObject);}},{key:"solvePostfixedExpression",value:function solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){return this.Solver.solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest);}},{key:"solve",value:function solve(pExpression,pDataSourceObject,pResultObject,
|
|
1132
|
+
tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ".concat(tmpToken.Token," at index ").concat(i));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}return pTokenizedObjects;}},{key:"tokenize",value:function tokenize(pExpression,pResultObject){return this.Tokenizer.tokenize(pExpression,pResultObject);}},{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){return this.Linter.lintTokenizedExpression(pTokenizedExpression,pResultObject);}},{key:"buildPostfixedSolveList",value:function buildPostfixedSolveList(pTokenizedExpression,pResultObject){return this.Postfix.buildPostfixedSolveList(pTokenizedExpression,pResultObject);}},{key:"solvePostfixedExpression",value:function solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){return this.Solver.solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest);}},{key:"solve",value:function solve(pExpression,pDataSourceObject,pResultObject,pManifest,pDataDestinationObject){var tmpResultsObject=_typeof(pResultObject)==='object'?pResultObject:{};var tmpDataSourceObject=_typeof(pDataSourceObject)==='object'?pDataSourceObject:{};var tmpDataDestinationObject=_typeof(pDataDestinationObject)==='object'?pDataDestinationObject:{};this.tokenize(pExpression,tmpResultsObject);this.lintTokenizedExpression(tmpResultsObject.RawTokens,tmpResultsObject);this.buildPostfixedSolveList(tmpResultsObject.RawTokens,tmpResultsObject);this.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects,tmpDataSourceObject,tmpResultsObject,pManifest);return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}]);}(libFableServiceBase);module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":68,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json":69,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js":70,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js":71,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js":72,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json":73,"big.js":17,"fable-serviceproviderbase":52}],67:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');var ExpressionParserOperationBase=/*#__PURE__*/function(_libFableServiceProvi9){function ExpressionParserOperationBase(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,ExpressionParserOperationBase);_this21=_callSuper(this,ExpressionParserOperationBase,[pFable,pOptions,pServiceHash]);_this21.serviceType='ExpressionParserOperationBase';_this21.numberTest=/^-{0,1}\d*\.{0,1}\d+$/;_this21.ExpressionParser=false;return _this21;}_inherits(ExpressionParserOperationBase,_libFableServiceProvi9);return _createClass2(ExpressionParserOperationBase,[{key:"connectExpressionParser",value:function connectExpressionParser(pExpressionParser){this.ExpressionParser=pExpressionParser;}},{key:"getTokenType",value:function getTokenType(pToken){if(this.ExpressionParser.tokenMap.hasOwnProperty(pToken)){return"Token.".concat(this.ExpressionParser.tokenMap[pToken].Type);}else if(pToken.length>2&&pToken[0]==='{'&&pToken[pToken.length-1]==='}'){return'Token.StateAddress';}else if(this.numberTest.test(pToken)){return'Token.Constant';}else{return'Token.Symbol';}// Just for documentation sake:
|
|
1134
1133
|
// There is a fifth token type, VirtualSymbol
|
|
1135
1134
|
// This is a value that's added during solve and looked up by address in the VirtualSymbol object.
|
|
1136
1135
|
}},{key:"getTokenContainerObject",value:function getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:this.ExpressionParser.tokenMap.hasOwnProperty(pToken)?this.ExpressionParser.tokenMap[pToken]:false};}}]);}(libFableServiceProviderBase);module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":52}],68:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionTokenizer=/*#__PURE__*/function(_libExpressionParserO){function ExpressionTokenizer(pFable,pOptions,pServiceHash){var _this22;_classCallCheck2(this,ExpressionTokenizer);_this22=_callSuper(this,ExpressionTokenizer,[pFable,pOptions,pServiceHash]);_this22.serviceType='ExpressionParser-Tokenizer';return _this22;}_inherits(ExpressionTokenizer,_libExpressionParserO);return _createClass2(ExpressionTokenizer,[{key:"tokenize",value:function tokenize(pExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.RawExpression=pExpression;tmpResults.RawTokens=[];tmpResults.ExpressionParserLog=[];if(typeof pExpression!=='string'){this.log.warn('ExpressionParser.tokenize was passed a non-string expression.');return tmpResults.RawTokens;}/* Tokenize the expression
|
|
@@ -1312,24 +1311,19 @@ var tmpParenthesisCacheLIFOStack=[];for(var _i12=0;_i12<tmpResults.PostfixTokenO
|
|
|
1312
1311
|
tmpPostfixTokenObject.ParenthesisStack=tmpPostfixTokenObject.VirtualSymbolName;if(tmpPostfixTokenObject.Token==='('){// It's an open parenthesis. If the previous token was an operator, get its precedence.
|
|
1313
1312
|
if(_i12>0){if(tmpResults.PostfixTokenObjects[_i12-1].Type==='Token.Operator'){tmpPostfixTokenObject.PreviousPrecedence=tmpResults.PostfixTokenObjects[_i12-1].Descriptor.Precedence;tmpPostfixTokenObject.IsFunction=false;tmpPostfixTokenObject.PreviousVirtualSymbolName=tmpResults.PostfixTokenObjects[_i12-1].VirtualSymbolName;tmpPostfixTokenObject.VirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];}// This is a function, we will create a virtual symbol for the discrete parenthesis
|
|
1314
1313
|
else if(tmpResults.PostfixTokenObjects[_i12-1].Type==='Token.Function'){tmpPostfixTokenObject.PreviousPrecedence=0;tmpPostfixTokenObject.IsFunction=true;tmpPostfixTokenObject.PreviousVirtualSymbolName=tmpResults.PostfixTokenObjects[_i12-1].VirtualSymbolName;var tmpVirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];if(!tmpVirtualSymbolName){// This is a parenthesis group with no operators in it; make a virtual symbol name.
|
|
1315
|
-
tmpVirtualSymbolName="V_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=tmpVirtualSymbolName;if(_i12>1){
|
|
1314
|
+
tmpVirtualSymbolName="V_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=tmpVirtualSymbolName;if(_i12>1){// Todo: This needs to be enhanced to deal with negations
|
|
1315
|
+
var tmpTokenBeforeFunction=tmpResults.PostfixTokenObjects[_i12-2];if(tmpTokenBeforeFunction.Type==='Token.Operator'){tmpPostfixTokenObject.PreviousVirtualSymbolName=tmpResults.PostfixTokenObjects[_i12-2].VirtualSymbolName;tmpPostfixTokenObject.PreviousPrecedence=tmpResults.PostfixTokenObjects[_i12-2].Descriptor.Precedence;}}}}else{tmpPostfixTokenObject.VirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];}tmpParenthesisCacheLIFOStack.push(tmpPostfixTokenObject);}if(tmpPostfixTokenObject.Token===')'){// There are three options for assigning this:
|
|
1316
1316
|
var tmpOpenParenthesis=tmpParenthesisCacheLIFOStack.pop();// It's at the end of the tokens -- use the stack's identifier
|
|
1317
|
-
if(_i12>=tmpResults.PostfixTokenObjects.length-1){if(tmpOpenParenthesis.IsFunction){tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName;}else{tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.VirtualSymbolName;}}else{//
|
|
1317
|
+
if(_i12>=tmpResults.PostfixTokenObjects.length-1){if(tmpOpenParenthesis.IsFunction){tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName;}else{tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.VirtualSymbolName;}}else{// The next token is an operator and we're a function
|
|
1318
1318
|
var tmpPeekedNextToken=tmpResults.PostfixTokenObjects[_i12+1];if(tmpPeekedNextToken.Type=='Token.Operator'&&tmpOpenParenthesis.IsFunction){// This is the most complex case -- the next token is an operator AND this is a function.
|
|
1319
1319
|
// The following is just pointer math.
|
|
1320
1320
|
// If the operater is at the same precedence or higher than the open parenthesis previous operator, use the previous operator's identifier
|
|
1321
1321
|
// NOTE: This line of code is insanely complex
|
|
1322
|
-
tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName
|
|
1323
|
-
//
|
|
1324
|
-
|
|
1325
|
-
//
|
|
1326
|
-
|
|
1327
|
-
// else
|
|
1328
|
-
// {
|
|
1329
|
-
// tmpPostfixTokenObject.VirtualSymbolName = tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];
|
|
1330
|
-
// tmpOpenParenthesis.VirtualSymbolName = tmpPeekedNextToken.VirtualSymbolName;
|
|
1331
|
-
// }
|
|
1332
|
-
}else if(tmpPeekedNextToken.Type=='Token.Operator'&&tmpOpenParenthesis.hasOwnProperty('PreviousPrecedence')){// This is the second most complex case -- the next token is an operator.
|
|
1322
|
+
//tmpPostfixTokenObject.VirtualSymbolName = tmpOpenParenthesis.PreviousVirtualSymbolName;
|
|
1323
|
+
// If the next token has higher precedence than what's before the open parenthesis, use it for the open as well
|
|
1324
|
+
if(tmpPeekedNextToken.Descriptor.Precedence<tmpOpenParenthesis.PreviousPrecedence){tmpOpenParenthesis.VirtualSymbolName=tmpPeekedNextToken.VirtualSymbolName;tmpPostfixTokenObject.VirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];}// Otherwise use this one -- it is the higher precedence. And update the previous parenthesis operator's virtual symbol to be the peeked token's virtual symbol.
|
|
1325
|
+
else{tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName;}}// The next token is an operator and it isn't a function
|
|
1326
|
+
else if(tmpPeekedNextToken.Type=='Token.Operator'&&tmpOpenParenthesis.hasOwnProperty('PreviousPrecedence')){// This is the second most complex case -- the next token is an operator.
|
|
1333
1327
|
// If the operater is at the same precedence or higher than the open parenthesis previous operator, use the previous operator's identifier
|
|
1334
1328
|
// NOTE: This line of code is insanely complex
|
|
1335
1329
|
if(tmpPeekedNextToken.Descriptor.Precedence<=tmpOpenParenthesis.PreviousPrecedence){tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.PreviousVirtualSymbolName;}// Otherwise use this one -- it is the higher precedence. And update the previous parenthesis operator's virtual symbol to be the peeked token's virtual symbol.
|
|
@@ -2595,65 +2589,78 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
|
|
|
2595
2589
|
preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
|
|
2596
2590
|
preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
2597
2591
|
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":120}],114:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictSettings={Name:'DefaultPictApplication',// The main "viewport" is the view that is used to host our application
|
|
2598
|
-
MainViewportViewIdentifier:'Default-View',MainViewportRenderableHash:false,MainViewportDestinationAddress:false,MainViewportDefaultDataAddress:false,// Whether or not we should automatically render the main viewport after we initialize the pict application
|
|
2599
|
-
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,Manifests:{},// The prefix to prepend on all template destination hashes
|
|
2592
|
+
MainViewportViewIdentifier:'Default-View',MainViewportRenderableHash:false,MainViewportDestinationAddress:false,MainViewportDefaultDataAddress:false,// Whether or not we should automatically render the main viewport and other autorender views after we initialize the pict application
|
|
2593
|
+
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,AutoRenderViewsAfterInitialize:false,Manifests:{},// The prefix to prepend on all template destination hashes
|
|
2600
2594
|
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase14){function PictApplication(pFable,pOptions,pServiceHash){var _this47;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this47=_callSuper(this,PictApplication,[pFable,tmpOptions,pServiceHash]);_this47.serviceType='PictApplication';// Convenience and consistency naming
|
|
2601
2595
|
_this47.pict=_this47.fable;// Wire in the essential Pict state
|
|
2602
|
-
_this47.AppData=_this47.fable.AppData;_this47.initializeTimestamp=false;_this47.lastSolvedTimestamp=false;_this47.lastMarshalFromViewsTimestamp=false;_this47.lastMarshalToViewsTimestamp=false;// Load all the manifests for the application
|
|
2596
|
+
_this47.AppData=_this47.fable.AppData;_this47.initializeTimestamp=false;_this47.lastSolvedTimestamp=false;_this47.lastMarshalFromViewsTimestamp=false;_this47.lastMarshalToViewsTimestamp=false;_this47.lastAutoRenderTimestamp=false;// Load all the manifests for the application
|
|
2603
2597
|
var tmpManifestKeys=Object.keys(_this47.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
2604
2598
|
var tmpManifestKey=tmpManifestKeys[i];_this47.fable.instantiateServiceProvider('Manifest',_this47.options.Manifests[tmpManifestKey],tmpManifestKey);}}return _this47;}/* -------------------------------------------------------------------------- */ /* Code Section: Solve All Views */ /* -------------------------------------------------------------------------- */_inherits(PictApplication,_libFableServiceBase14);return _createClass2(PictApplication,[{key:"onPreSolve",value:function onPreSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onPreSolve:"));}return true;}},{key:"onPreSolveAsync",value:function onPreSolveAsync(fCallback){this.onPreSolve();return fCallback();}},{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," executing solve() function..."));}// Walk through any loaded providers and solve them as well.
|
|
2605
2599
|
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToSolve=[];for(var i=0;i<tmpLoadedProviders.length;i++){var tmpProvider=this.pict.providers[tmpLoadedProviders[i]];if(tmpProvider.options.AutoSolveWithApp){tmpProvidersToSolve.push(tmpProvider);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2606
2600
|
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i27=0;_i27<tmpProvidersToSolve.length;_i27++){tmpProvidersToSolve[_i27].solve(tmpProvidersToSolve[_i27]);}this.onBeforeSolve();// Now walk through any loaded views and initialize them as well.
|
|
2607
2601
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var _i28=0;_i28<tmpLoadedViews.length;_i28++){var tmpView=this.pict.views[tmpLoadedViews[_i28]];if(tmpView.options.AutoInitialize){tmpViewsToSolve.push(tmpView);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2608
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i29=0;_i29<tmpViewsToSolve.length;_i29++){tmpViewsToSolve[_i29].solve();}this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this48=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));//
|
|
2602
|
+
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i29=0;_i29<tmpViewsToSolve.length;_i29++){tmpViewsToSolve[_i29].solve();}this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this48=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));// Allow the callback to be passed in as the last parameter no matter what
|
|
2603
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this48.log.error("PictApp [".concat(_this48.UUID,"]::[").concat(_this48.Hash,"] ").concat(_this48.options.Name," solveAsync Auto Callback Error: ").concat(pError),pError);}};}// Walk through any loaded providers and solve them as well.
|
|
2609
2604
|
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToSolve=[];for(var i=0;i<tmpLoadedProviders.length;i++){var tmpProvider=this.pict.providers[tmpLoadedProviders[i]];if(tmpProvider.options.AutoSolveWithApp){tmpProvidersToSolve.push(tmpProvider);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2610
2605
|
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i30=0;_i30<tmpProvidersToSolve.length;_i30++){tmpAnticipate.anticipate(tmpProvidersToSolve[_i30].solveAsync.bind(tmpProvidersToSolve[_i30]));}// Walk through any loaded views and solve them as well.
|
|
2611
2606
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var _i31=0;_i31<tmpLoadedViews.length;_i31++){var tmpView=this.pict.views[tmpLoadedViews[_i31]];if(tmpView.options.AutoSolveWithApp){tmpViewsToSolve.push(tmpView);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2612
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i32=0;_i32<tmpViewsToSolve.length;_i32++){tmpAnticipate.anticipate(tmpViewsToSolve[_i32].solveAsync.bind(tmpViewsToSolve[_i32]));}tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this48.pict.LogNoisiness>2){_this48.log.trace("PictApp [".concat(_this48.UUID,"]::[").concat(_this48.Hash,"] ").concat(_this48.options.Name," solveAsync() complete."));}_this48.lastSolvedTimestamp=_this48.fable.log.getTimeStamp();return
|
|
2607
|
+
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i32=0;_i32<tmpViewsToSolve.length;_i32++){tmpAnticipate.anticipate(tmpViewsToSolve[_i32].solveAsync.bind(tmpViewsToSolve[_i32]));}tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this48.pict.LogNoisiness>2){_this48.log.trace("PictApp [".concat(_this48.UUID,"]::[").concat(_this48.Hash,"] ").concat(_this48.options.Name," solveAsync() complete."));}_this48.lastSolvedTimestamp=_this48.fable.log.getTimeStamp();return tmpCallback(pError);});}},{key:"onAfterSolve",value:function onAfterSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterSolve:"));}return true;}},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Initialize Application */ /* -------------------------------------------------------------------------- */},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();// Walk through any loaded providers and initialize them as well.
|
|
2613
2608
|
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var i=0;i<tmpLoadedProviders.length;i++){var tmpProvider=this.pict.providers[tmpLoadedProviders[i]];if(tmpProvider.options.AutoInitialize){tmpProvidersToInitialize.push(tmpProvider);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2614
2609
|
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i33=0;_i33<tmpProvidersToInitialize.length;_i33++){tmpProvidersToInitialize[_i33].initialize();}// Now walk through any loaded views and initialize them as well.
|
|
2615
2610
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var _i34=0;_i34<tmpLoadedViews.length;_i34++){var tmpView=this.pict.views[tmpLoadedViews[_i34]];if(tmpView.options.AutoInitialize){tmpViewsToInitialize.push(tmpView);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2616
2611
|
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i35=0;_i35<tmpViewsToInitialize.length;_i35++){tmpViewsToInitialize[_i35].initialize();}this.onAfterInitialize();if(this.options.AutoSolveAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto solving after initialization..."));}// Solve the template synchronously
|
|
2617
2612
|
this.solve();}// Now check and see if we should automatically render as well
|
|
2618
2613
|
if(this.options.AutoRenderMainViewportViewAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto rendering after initialization..."));}// Render the template synchronously
|
|
2619
|
-
this.render();}this.initializeTimestamp=this.fable.log.getTimeStamp();return true;}else{this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(
|
|
2614
|
+
this.render();}this.initializeTimestamp=this.fable.log.getTimeStamp();return true;}else{this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this49=this;if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initializeAsync:"));}// Allow the callback to be passed in as the last parameter no matter what
|
|
2615
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initializeAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this49.log.error("PictApp [".concat(_this49.UUID,"]::[").concat(_this49.Hash,"] ").concat(_this49.options.Name," initializeAsync Auto Callback Error: ").concat(pError),pError);}};}if(!this.initializeTimestamp){var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));// Walk through any loaded providers and solve them as well.
|
|
2620
2616
|
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var i=0;i<tmpLoadedProviders.length;i++){var tmpProvider=this.pict.providers[tmpLoadedProviders[i]];if(tmpProvider.options.AutoInitialize){tmpProvidersToInitialize.push(tmpProvider);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
2621
2617
|
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i36=0;_i36<tmpProvidersToInitialize.length;_i36++){tmpAnticipate.anticipate(tmpProvidersToInitialize[_i36].initializeAsync.bind(tmpProvidersToInitialize[_i36]));}// Now walk through any loaded views and initialize them as well.
|
|
2622
2618
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
2623
2619
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var _i37=0;_i37<tmpLoadedViews.length;_i37++){var tmpView=this.pict.views[tmpLoadedViews[_i37]];if(tmpView.options.AutoInitialize){tmpViewsToInitialize.push(tmpView);}}// Sort the views by their priority
|
|
2624
2620
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
2625
|
-
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i38=0;_i38<tmpViewsToInitialize.length;_i38++){var _tmpView=tmpViewsToInitialize[_i38];tmpAnticipate.anticipate(_tmpView.initializeAsync.bind(_tmpView));}tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));if(this.options.AutoSolveAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto solving (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.solveAsync.bind(this));}if(this.options.AutoRenderMainViewportViewAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto rendering (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.renderMainViewportAsync.bind(this));}tmpAnticipate.wait(function(pError){_this49.initializeTimestamp=_this49.fable.log.getTimeStamp();if(_this49.pict.LogNoisiness>2){_this49.log.trace("PictApp [".concat(_this49.UUID,"]::[").concat(_this49.Hash,"] ").concat(_this49.options.Name," initialization complete."));}return
|
|
2626
|
-
return
|
|
2627
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalFromViews=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];tmpViewsToMarshalFromViews.push(tmpView);}for(var _i39=0;_i39<tmpViewsToMarshalFromViews.length;_i39++){tmpViewsToMarshalFromViews[_i39].marshalFromView();}this.onMarshalFromViews();this.onAfterMarshalFromViews();this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var _this50=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate')
|
|
2628
|
-
var
|
|
2629
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var
|
|
2630
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalToViews=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];tmpViewsToMarshalToViews.push(tmpView);}for(var
|
|
2631
|
-
var
|
|
2621
|
+
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i38=0;_i38<tmpViewsToInitialize.length;_i38++){var _tmpView=tmpViewsToInitialize[_i38];tmpAnticipate.anticipate(_tmpView.initializeAsync.bind(_tmpView));}tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));if(this.options.AutoSolveAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto solving (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.solveAsync.bind(this));}if(this.options.AutoRenderMainViewportViewAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto rendering (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.renderMainViewportAsync.bind(this));}tmpAnticipate.wait(function(pError){_this49.initializeTimestamp=_this49.fable.log.getTimeStamp();if(_this49.pict.LogNoisiness>2){_this49.log.trace("PictApp [".concat(_this49.UUID,"]::[").concat(_this49.Hash,"] ").concat(_this49.options.Name," initialization complete."));}return tmpCallback();});}else{this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," async initialize called but initialization is already completed. Aborting."));// TODO: Should this be an error?
|
|
2622
|
+
return tmpCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Marshal Data From All Views */ /* -------------------------------------------------------------------------- */},{key:"onBeforeMarshalFromViews",value:function onBeforeMarshalFromViews(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeMarshalFromViews:"));}return true;}},{key:"onBeforeMarshalFromViewsAsync",value:function onBeforeMarshalFromViewsAsync(fCallback){this.onBeforeMarshalFromViews();return fCallback();}},{key:"onMarshalFromViews",value:function onMarshalFromViews(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onMarshalFromViews:"));}return true;}},{key:"onMarshalFromViewsAsync",value:function onMarshalFromViewsAsync(fCallback){this.onMarshalFromViews();return fCallback();}},{key:"marshalFromViews",value:function marshalFromViews(){if(this.pict.LogNoisiness>2){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," executing marshalFromViews() function..."));}this.onBeforeMarshalFromViews();// Now walk through any loaded views and initialize them as well.
|
|
2623
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalFromViews=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];tmpViewsToMarshalFromViews.push(tmpView);}for(var _i39=0;_i39<tmpViewsToMarshalFromViews.length;_i39++){tmpViewsToMarshalFromViews[_i39].marshalFromView();}this.onMarshalFromViews();this.onAfterMarshalFromViews();this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var _this50=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
2624
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this50.log.error("PictApp [".concat(_this50.UUID,"]::[").concat(_this50.Hash,"] ").concat(_this50.options.Name," marshalFromViewsAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeMarshalFromViewsAsync.bind(this));// Walk through any loaded views and marshalFromViews them as well.
|
|
2625
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalFromViews=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];tmpViewsToMarshalFromViews.push(tmpView);}for(var _i40=0;_i40<tmpViewsToMarshalFromViews.length;_i40++){tmpAnticipate.anticipate(tmpViewsToMarshalFromViews[_i40].marshalFromViewAsync.bind(tmpViewsToMarshalFromViews[_i40]));}tmpAnticipate.anticipate(this.onMarshalFromViewsAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalFromViewsAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this50.pict.LogNoisiness>2){_this50.log.trace("PictApp [".concat(_this50.UUID,"]::[").concat(_this50.Hash,"] ").concat(_this50.options.Name," marshalFromViewsAsync() complete."));}_this50.lastMarshalFromViewsTimestamp=_this50.fable.log.getTimeStamp();return tmpCallback(pError);});}},{key:"onAfterMarshalFromViews",value:function onAfterMarshalFromViews(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterMarshalFromViews:"));}return true;}},{key:"onAfterMarshalFromViewsAsync",value:function onAfterMarshalFromViewsAsync(fCallback){this.onAfterMarshalFromViews();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Marshal Data To All Views */ /* -------------------------------------------------------------------------- */},{key:"onBeforeMarshalToViews",value:function onBeforeMarshalToViews(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeMarshalToViews:"));}return true;}},{key:"onBeforeMarshalToViewsAsync",value:function onBeforeMarshalToViewsAsync(fCallback){this.onBeforeMarshalToViews();return fCallback();}},{key:"onMarshalToViews",value:function onMarshalToViews(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onMarshalToViews:"));}return true;}},{key:"onMarshalToViewsAsync",value:function onMarshalToViewsAsync(fCallback){this.onMarshalToViews();return fCallback();}},{key:"marshalToViews",value:function marshalToViews(){if(this.pict.LogNoisiness>2){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," executing marshalToViews() function..."));}this.onBeforeMarshalToViews();// Now walk through any loaded views and initialize them as well.
|
|
2626
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalToViews=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];tmpViewsToMarshalToViews.push(tmpView);}for(var _i41=0;_i41<tmpViewsToMarshalToViews.length;_i41++){tmpViewsToMarshalToViews[_i41].marshalToView();}this.onMarshalToViews();this.onAfterMarshalToViews();this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"marshalToViewsAsync",value:function marshalToViewsAsync(fCallback){var _this51=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
2627
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this51.log.error("PictApp [".concat(_this51.UUID,"]::[").concat(_this51.Hash,"] ").concat(_this51.options.Name," marshalToViewsAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeMarshalToViewsAsync.bind(this));// Walk through any loaded views and marshalToViews them as well.
|
|
2628
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalToViews=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];tmpViewsToMarshalToViews.push(tmpView);}for(var _i42=0;_i42<tmpViewsToMarshalToViews.length;_i42++){tmpAnticipate.anticipate(tmpViewsToMarshalToViews[_i42].marshalToViewAsync.bind(tmpViewsToMarshalToViews[_i42]));}tmpAnticipate.anticipate(this.onMarshalToViewsAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalToViewsAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this51.pict.LogNoisiness>2){_this51.log.trace("PictApp [".concat(_this51.UUID,"]::[").concat(_this51.Hash,"] ").concat(_this51.options.Name," marshalToViewsAsync() complete."));}_this51.lastMarshalToViewsTimestamp=_this51.fable.log.getTimeStamp();return tmpCallback(pError);});}},{key:"onAfterMarshalToViews",value:function onAfterMarshalToViews(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterMarshalToViews:"));}return true;}},{key:"onAfterMarshalToViewsAsync",value:function onAfterMarshalToViewsAsync(fCallback){this.onAfterMarshalToViews();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Render View */ /* -------------------------------------------------------------------------- */},{key:"render",value:function render(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpViewIdentifier=typeof pViewIdentifier==='undefined'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash==='undefined'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='undefined'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress==='undefined'?this.options.MainViewportDefaultDataAddress:pTemplateDataAddress;if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," VIEW Renderable[").concat(tmpRenderableHash,"] Destination[").concat(tmpRenderDestinationAddress,"] TemplateDataAddress[").concat(tmpTemplateDataAddress,"] render:"));}// Now get the view (by hash) from the loaded views
|
|
2629
|
+
var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpViewIdentifier]:false;if(!tmpView){this.log.error("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(tmpViewIdentifier," because it is not a valid view."));return false;}return tmpView.render(tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress);}},{key:"renderMainViewport",value:function renderMainViewport(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderMainViewport:"));}return this.render();}},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this52=this;var tmpViewIdentifier=typeof pViewIdentifier==='undefined'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash==='undefined'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='undefined'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress==='undefined'?this.options.MainViewportDefaultDataAddress:pTemplateDataAddress;// Allow the callback to be passed in as the last parameter no matter what
|
|
2630
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateDataAddress==='function'?pTemplateDataAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:typeof pViewIdentifier==='function'?pViewIdentifier:false;if(!tmpCallback){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this52.log.error("PictApp [".concat(_this52.UUID,"]::[").concat(_this52.Hash,"] ").concat(_this52.options.Name," renderAsync Auto Callback Error: ").concat(pError),pError);}};}if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," VIEW Renderable[").concat(tmpRenderableHash,"] Destination[").concat(tmpRenderDestinationAddress,"] TemplateDataAddress[").concat(tmpTemplateDataAddress,"] renderAsync:"));}var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpViewIdentifier]:false;if(!tmpView){var tmpErrorMessage="PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not asynchronously render from View ").concat(tmpViewIdentifier," because it is not a valid view.");if(this.pict.LogNoisiness>3){this.log.error(tmpErrorMessage);}return tmpCallback(new Error(tmpErrorMessage));}return tmpView.renderAsync(tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress,tmpCallback);}},{key:"renderMainViewportAsync",value:function renderMainViewportAsync(fCallback){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderMainViewportAsync:"));}return this.renderAsync(fCallback);}},{key:"renderAutoViews",value:function renderAutoViews(){var _this53=this;if(this.pict.LogNoisiness>0){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," beginning renderAutoViews..."));}// Now walk through any loaded views and sort them by the AutoRender ordinal
|
|
2631
|
+
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
2632
|
+
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
2633
|
+
tmpLoadedViews.sort(function(a,b){return _this53.pict.views[a].options.AutoRenderOrdinal-_this53.pict.views[b].options.AutoRenderOrdinal;});for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];if(tmpView.options.AutoRender){tmpView.render();}}if(this.pict.LogNoisiness>0){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAutoViewsAsync complete."));}}},{key:"renderAutoViewsAsync",value:function renderAutoViewsAsync(fCallback){var _this54=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
2634
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateDataAddress==='function'?pTemplateDataAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:typeof pViewIdentifier==='function'?pViewIdentifier:false;if(!tmpCallback){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAutoViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this54.log.error("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.options.Name," renderAutoViewsAsync Auto Callback Error: ").concat(pError),pError);}};}if(this.pict.LogNoisiness>0){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," beginning renderAutoViewsAsync..."));}// Now walk through any loaded views and sort them by the AutoRender ordinal
|
|
2635
|
+
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
2636
|
+
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
2637
|
+
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
2638
|
+
tmpLoadedViews.sort(function(a,b){return _this54.pict.views[a].options.AutoRenderOrdinal-_this54.pict.views[b].options.AutoRenderOrdinal;});for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];if(tmpView.options.AutoRender){tmpAnticipate.anticipate(tmpView.renderAsync.bind(tmpView));}}tmpAnticipate.wait(function(pError){_this54.lastAutoRenderTimestamp=_this54.fable.log.getTimeStamp();if(_this54.pict.LogNoisiness>0){_this54.log.trace("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.options.Name," renderAutoViewsAsync complete."));}return tmpCallback(pError);});}}]);}(libFableServiceBase);module.exports=PictApplication;},{"fable-serviceproviderbase":52}],115:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictProviderSettings={ProviderIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
2632
2639
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
2633
|
-
AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase15){function PictProvider(pFable,pOptions,pServiceHash){var
|
|
2634
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);
|
|
2635
|
-
|
|
2636
|
-
|
|
2640
|
+
AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase15){function PictProvider(pFable,pOptions,pServiceHash){var _this55;_classCallCheck2(this,PictProvider);// Intersect default options, parent constructor, service information
|
|
2641
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);_this55=_callSuper(this,PictProvider,[pFable,tmpOptions,pServiceHash]);if(!_this55.options.ProviderIdentifier){_this55.options.ProviderIdentifier="AutoProviderID-".concat(_this55.fable.getUUID());}_this55.serviceType='PictProvider';// Convenience and consistency naming
|
|
2642
|
+
_this55.pict=_this55.fable;// Wire in the essential Pict application state
|
|
2643
|
+
_this55.AppData=_this55.pict.AppData;_this55.initializeTimestamp=false;_this55.lastSolvedTimestamp=false;for(var i=0;i<_this55.options.Templates.length;i++){var tmpDefaultTemplate=_this55.options.Templates[i];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this55.log.error("PictProvider [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.options.ProviderIdentifier," could not load Default Template ").concat(i," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictProvider [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.options.ProviderIdentifier," options object.");}_this55.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}return _this55;}/* -------------------------------------------------------------------------- */ /* Code Section: Initialization */ /* -------------------------------------------------------------------------- */_inherits(PictProvider,_libFableServiceBase15);return _createClass2(PictProvider,[{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow PROVIDER [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this56=this;if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow PROVIDER [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initializeAsync:"));}if(!this.initializeTimestamp){var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>0){this.log.info("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));tmpAnticipate.wait(function(pError){_this56.initializeTimestamp=_this56.pict.log.getTimeStamp();if(_this56.pict.LogNoisiness>0){_this56.log.info("PictProvider [".concat(_this56.UUID,"]::[").concat(_this56.Hash,"] ").concat(_this56.options.ProviderIdentifier," initialization complete."));}return fCallback();});}else{this.log.warn("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," async initialize called but initialization is already completed. Aborting."));// TODO: Should this be an error?
|
|
2637
2644
|
return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}},{key:"onPreRender",value:function onPreRender(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onPreRender:"));}return true;}},{key:"onPreRenderAsync",value:function onPreRenderAsync(fCallback){this.onPreRender();return fCallback();}},{key:"render",value:function render(){return this.onPreRender();}},{key:"renderAsync",value:function renderAsync(fCallback){this.onPreRender();return fCallback();}},{key:"onPreSolve",value:function onPreSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onPreSolve:"));}return true;}},{key:"onPreSolveAsync",value:function onPreSolveAsync(fCallback){this.onPreSolve();return fCallback();}},{key:"solve",value:function solve(){return this.onPreSolve();}},{key:"solveAsync",value:function solveAsync(fCallback){this.onPreSolve();return fCallback();}}]);}(libFableServiceBase);module.exports=PictProvider;},{"fable-serviceproviderbase":52}],116:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
2638
2645
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
2639
2646
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
2640
2647
|
// After the App initializes, render will be called as soon as it's added.
|
|
2641
|
-
AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSSHash:false,CSS:false,CSSProvider:false,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase16){function PictView(pFable,pOptions,pServiceHash){var
|
|
2642
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);
|
|
2643
|
-
|
|
2644
|
-
|
|
2648
|
+
AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSSHash:false,CSS:false,CSSProvider:false,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase16){function PictView(pFable,pOptions,pServiceHash){var _this57;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
2649
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this57=_callSuper(this,PictView,[pFable,tmpOptions,pServiceHash]);if(!_this57.options.ViewIdentifier){_this57.options.ViewIdentifier="AutoViewID-".concat(_this57.fable.getUUID());}_this57.serviceType='PictView';// Convenience and consistency naming
|
|
2650
|
+
_this57.pict=_this57.fable;// Wire in the essential Pict application state
|
|
2651
|
+
_this57.AppData=_this57.pict.AppData;_this57.initializeTimestamp=false;_this57.lastSolvedTimestamp=false;_this57.lastRenderedTimestamp=false;_this57.lastMarshalFromViewTimestamp=false;_this57.lastMarshalToViewTimestamp=false;// Load all templates from the array in the options
|
|
2645
2652
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
2646
|
-
for(var i=0;i<
|
|
2653
|
+
for(var i=0;i<_this57.options.Templates.length;i++){var tmpTemplate=_this57.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this57.log.error("PictView [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.options.ViewIdentifier," options object.");}_this57.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
2647
2654
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
2648
|
-
for(var _i43=0;_i43<
|
|
2649
|
-
if(
|
|
2655
|
+
for(var _i43=0;_i43<_this57.options.DefaultTemplates.length;_i43++){var tmpDefaultTemplate=_this57.options.DefaultTemplates[_i43];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this57.log.error("PictView [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.options.ViewIdentifier," could not load Default Template ").concat(_i43," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.options.ViewIdentifier," options object.");}_this57.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load the CSS if it's available
|
|
2656
|
+
if(_this57.options.CSS){var tmpCSSHash=_this57.options.CSSHash?_this57.options.CSSHash:"View-".concat(_this57.options.ViewIdentifier);var tmpCSSProvider=_this57.options.CSSProvider?_this57.options.CSSProvider:tmpCSSHash;_this57.pict.CSSMap.addCSS(tmpCSSHash,_this57.options.CSS,tmpCSSProvider,_this57.options.CSSPriority);}// Load all renderables
|
|
2650
2657
|
// Renderables are launchable renderable instructions with templates
|
|
2651
2658
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
2652
2659
|
// The only parts that are necessary are Identifier and Template
|
|
2653
2660
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
2654
|
-
|
|
2661
|
+
_this57.renderables={};for(var _i44=0;_i44<_this57.options.Renderables.length;_i44++){var tmpRenderable=_this57.options.Renderables[_i44];_this57.addRenderable(_this57.options.Renderables[_i44]);}return _this57;}_inherits(PictView,_libFableServiceBase16);return _createClass2(PictView,[{key:"addRenderable",value:function addRenderable(pRenderableHash,pTemplateHash,pDefaultTemplateDataAddress,pDefaultDestinationAddress,pRenderMethod){var tmpRenderable=false;if(_typeof(pRenderableHash)=='object'){// The developer passed in the renderable as an object.
|
|
2655
2662
|
// Use theirs instead!
|
|
2656
|
-
tmpRenderable=pRenderableHash;}else{var tmpRenderMethod=typeof pRenderMethod!=='string'?pRenderMethod:'replace';tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateDataAddress:pDefaultTemplateDataAddress,DefaultDestinationAddress:pDefaultDestinationAddress,RenderMethod:tmpRenderMethod};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}/* -------------------------------------------------------------------------- */ /* Code Section: Initialization */ /* -------------------------------------------------------------------------- */},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var
|
|
2663
|
+
tmpRenderable=pRenderableHash;}else{var tmpRenderMethod=typeof pRenderMethod!=='string'?pRenderMethod:'replace';tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateDataAddress:pDefaultTemplateDataAddress,DefaultDestinationAddress:pDefaultDestinationAddress,RenderMethod:tmpRenderMethod};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}/* -------------------------------------------------------------------------- */ /* Code Section: Initialization */ /* -------------------------------------------------------------------------- */},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this58=this;if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initializeAsync:"));}if(!this.initializeTimestamp){var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>0){this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));tmpAnticipate.wait(function(pError){_this58.initializeTimestamp=_this58.pict.log.getTimeStamp();if(_this58.pict.LogNoisiness>0){_this58.log.info("PictView [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.options.ViewIdentifier," initialization complete."));}return fCallback();});}else{this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," async initialize called but initialization is already completed. Aborting."));// TODO: Should this be an error?
|
|
2657
2664
|
return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Render */ /* -------------------------------------------------------------------------- */},{key:"onBeforeRender",value:function onBeforeRender(pRenderable,pRenderDestinationAddress,pData){// Overload this to mess with stuff before the content gets generated from the template
|
|
2658
2665
|
if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeRender:"));}return true;}},{key:"onBeforeRenderAsync",value:function onBeforeRenderAsync(fCallback){return fCallback();}},{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;var tmpData;if(_typeof(pTemplateDataAddress)==='object'){tmpData=pTemplateDataAddress;tmpDataAddress='Passed in as object';}else{tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;tmpData=typeof tmpDataAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpDataAddress):undefined;}// Execute the developer-overridable pre-render behavior
|
|
2659
2666
|
this.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(tmpRenderableHash,"] Destination[").concat(tmpRenderDestinationAddress,"] TemplateDataAddress[").concat(tmpDataAddress,"] render:"));}if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Render of Renderable[").concat(tmpRenderableHash,"] to Destination [").concat(tmpRenderDestinationAddress,"]..."));}// Generate the content output from the template and data
|
|
@@ -2661,12 +2668,13 @@ var tmpContent=this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,
|
|
|
2661
2668
|
switch(tmpRenderable.RenderMethod){case'append':this.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,tmpContent);break;case'prepend':this.pict.ContentAssignment.prependContent(tmpRenderDestinationAddress,tmpContent);break;case'append_once':// Try to find the content in the destination address
|
|
2662
2669
|
var tmpExistingContent=this.pict.ContentAssignment.getElement("#".concat(tmpRenderableHash));if(tmpExistingContent.length<1){this.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,tmpContent);}break;case'replace':// TODO: Should this be the default?
|
|
2663
2670
|
default:this.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);break;}// Execute the developer-overridable post-render behavior
|
|
2664
|
-
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"renderAsync",value:function renderAsync(
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2671
|
+
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this59=this;var tmpRenderableHash=typeof pRenderableHash==='string'?pRenderableHash:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;// Allow the callback to be passed in as the last parameter no matter what
|
|
2672
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateDataAddress==='function'?pTemplateDataAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:false;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this59.log.error("PictView [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.options.Name," renderAsync Auto Callback Error: ").concat(pError),pError);}};}if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,"because it is not a valid renderable."));return tmpCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,"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(pRenderableHash,") because it does not exist."));return tmpCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") 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(pRenderableHash,") because it does not have a valid destination address."));return tmpCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress;var tmpData;if(_typeof(pTemplateDataAddress)==='object'){tmpData=pTemplateDataAddress;tmpDataAddress='Passed in as object';}else{tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;tmpData=typeof tmpDataAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpDataAddress):undefined;}if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(tmpRenderableHash,"] Destination[").concat(tmpRenderDestinationAddress,"] TemplateDataAddress[").concat(tmpDataAddress,"] renderAsync:"));}if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Asynchronous Render (callback-style)..."));}var tmpAnticipate=this.fable.newAnticipate();tmpAnticipate.anticipate(function(fOnBeforeRenderCallback){_this59.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);_this59.onBeforeRenderAsync(fOnBeforeRenderCallback);});tmpAnticipate.anticipate(function(fAsyncTemplateCallback){// Render the template (asynchronously)
|
|
2673
|
+
_this59.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this59.log.error("PictView [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it did not parse the template."),pError);return fAsyncTemplateCallback(pError);}if(_this59.pict.LogNoisiness>0){_this59.log.trace("PictView [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.options.ViewIdentifier," Assigning Renderable[").concat(tmpRenderableHash,"] content length ").concat(pContent.length," to Destination [").concat(tmpRenderDestinationAddress,"] using Async render method ").concat(tmpRenderable.RenderMethod,"."));}// Assign the content to the destination address
|
|
2674
|
+
switch(tmpRenderable.RenderMethod){case'append':_this59.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,pContent);break;case'prepend':_this59.pict.ContentAssignment.prependContent(tmpRenderDestinationAddress,pContent);break;case'append_once':// Try to find the content in the destination address
|
|
2675
|
+
var tmpExistingContent=_this59.pict.ContentAssignment.getElement("#".concat(tmpRenderableHash));if(tmpExistingContent.length<1){_this59.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,pContent);}case'replace':default:_this59.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);break;}// Execute the developer-overridable asynchronous post-render behavior
|
|
2676
|
+
_this59.lastRenderedTimestamp=_this59.pict.log.getTimeStamp();return fAsyncTemplateCallback();},[_this59]);});tmpAnticipate.anticipate(function(fOnAfterRenderCallback){_this59.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);_this59.onAfterRenderAsync(fOnAfterRenderCallback);});tmpAnticipate.wait(tmpCallback);}},{key:"renderDefaultAsync",value:function renderDefaultAsync(fCallback){// Render the default renderable
|
|
2677
|
+
this.renderAsync(fCallback);}},{key:"onAfterRender",value:function onAfterRender(pRenderable,pRenderDestinationAddress,pData){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender:"));}return true;}},{key:"onAfterRenderAsync",value:function onAfterRenderAsync(fCallback){return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Solver */ /* -------------------------------------------------------------------------- */},{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeSolve();this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this60=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this60.log.error("PictView [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.options.Name," solveAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this60.pict.LogNoisiness>2){_this60.log.trace("PictView [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.options.ViewIdentifier," solveAsync() complete."));}_this60.lastSolvedTimestamp=_this60.pict.log.getTimeStamp();return tmpCallback(pError);});}},{key:"onAfterSolve",value:function onAfterSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterSolve:"));}return true;}},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Marshal From View */ /* -------------------------------------------------------------------------- */},{key:"onBeforeMarshalFromView",value:function onBeforeMarshalFromView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeMarshalFromView:"));}return true;}},{key:"onBeforeMarshalFromViewAsync",value:function onBeforeMarshalFromViewAsync(fCallback){this.onBeforeMarshalFromView();return fCallback();}},{key:"onMarshalFromView",value:function onMarshalFromView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onMarshalFromView:"));}return true;}},{key:"onMarshalFromViewAsync",value:function onMarshalFromViewAsync(fCallback){this.onMarshalFromView();return fCallback();}},{key:"marshalFromView",value:function marshalFromView(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeMarshalFromView();this.onMarshalFromView();this.onAfterMarshalFromView();this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var _this61=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this61.log.error("PictView [".concat(_this61.UUID,"]::[").concat(_this61.Hash,"] ").concat(_this61.options.Name," marshalFromViewAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeMarshalFromViewAsync.bind(this));tmpAnticipate.anticipate(this.onMarshalFromViewAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalFromViewAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this61.pict.LogNoisiness>2){_this61.log.trace("PictView [".concat(_this61.UUID,"]::[").concat(_this61.Hash,"] ").concat(_this61.options.ViewIdentifier," marshalFromViewAsync() complete."));}_this61.lastMarshalFromViewTimestamp=_this61.pict.log.getTimeStamp();return tmpCallback(pError);});}},{key:"onAfterMarshalFromView",value:function onAfterMarshalFromView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalFromView:"));}return true;}},{key:"onAfterMarshalFromViewAsync",value:function onAfterMarshalFromViewAsync(fCallback){this.onAfterMarshalFromView();return fCallback();}/* -------------------------------------------------------------------------- */ /* Code Section: Marshal To View */ /* -------------------------------------------------------------------------- */},{key:"onBeforeMarshalToView",value:function onBeforeMarshalToView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeMarshalToView:"));}return true;}},{key:"onBeforeMarshalToViewAsync",value:function onBeforeMarshalToViewAsync(fCallback){this.onBeforeMarshalToView();return fCallback();}},{key:"onMarshalToView",value:function onMarshalToView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onMarshalToView:"));}return true;}},{key:"onMarshalToViewAsync",value:function onMarshalToViewAsync(fCallback){this.onMarshalToView();return fCallback();}},{key:"marshalToView",value:function marshalToView(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeMarshalToView();this.onMarshalToView();this.onAfterMarshalToView();this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var _this62=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');var tmpCallback=typeof fCallback==='function'?fCallback:false;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this62.log.error("PictView [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.options.Name," marshalToViewAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeMarshalToViewAsync.bind(this));tmpAnticipate.anticipate(this.onMarshalToViewAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalToViewAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this62.pict.LogNoisiness>2){_this62.log.trace("PictView [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.options.ViewIdentifier," marshalToViewAsync() complete."));}_this62.lastMarshalToViewTimestamp=_this62.pict.log.getTimeStamp();return tmpCallback(pError);});}},{key:"onAfterMarshalToView",value:function onAfterMarshalToView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalToView:"));}return true;}},{key:"onAfterMarshalToViewAsync",value:function onAfterMarshalToViewAsync(fCallback){this.onAfterMarshalToView();return fCallback();}}]);}(libFableServiceBase);module.exports=PictView;},{"fable-serviceproviderbase":52}],117:[function(require,module,exports){/**
|
|
2670
2678
|
* Precedent Meta-Templating
|
|
2671
2679
|
*
|
|
2672
2680
|
* @license MIT
|
|
@@ -3967,26 +3975,26 @@ module.exports=function(fCallback){if(!document){console.log('No document object
|
|
|
3967
3975
|
if(document.readyState!='loading')fCallback();// Modern browsers have event listener capabilities
|
|
3968
3976
|
else if(document.addEventListener)document.addEventListener('DOMContentLoaded',fCallback);// IE <= 8 and ... other abominations
|
|
3969
3977
|
else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')callback();});};},{}],162:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
|
|
3970
|
-
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase17){function PictCSS(pFable,pOptions,pServiceHash){var
|
|
3971
|
-
if(typeof
|
|
3978
|
+
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase17){function PictCSS(pFable,pOptions,pServiceHash){var _this63;_classCallCheck2(this,PictCSS);_this63=_callSuper(this,PictCSS,[pFable,pOptions,pServiceHash]);// No merging of options necessary
|
|
3979
|
+
if(typeof _this63.options.CSSElementAddress==='undefined'){_this63.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}_this63.inlineCSSMap={};return _this63;}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
|
|
3972
3980
|
// Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
|
|
3973
|
-
_inherits(PictCSS,_libFableServiceBase17);return _createClass2(PictCSS,[{key:"addCSS",value:function addCSS(pHash,pContent,pPriority,pProvider){var tmpPriority=typeof pPriority!=='undefined'?pPriority:1000;var tmpProvidor=typeof pProvider==='string'?pProvider:'Unknown';this.inlineCSSMap[pHash]={Hash:pHash,Content:pContent,Provider:tmpProvidor,Priority:tmpPriority};}},{key:"removeCSS",value:function removeCSS(pHash){delete this.inlineCSSMap[pHash];}},{key:"generateCSS",value:function generateCSS(){var
|
|
3974
|
-
tmpCSSHashes.sort(function(a,b){return
|
|
3975
|
-
},{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);}(libFableServiceBase);module.exports=PictCSS;},{"fable":58}],163:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase18){function PictContentAssignment(pFable,pOptions,pServiceHash){var
|
|
3976
|
-
|
|
3977
|
-
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3981
|
+
_inherits(PictCSS,_libFableServiceBase17);return _createClass2(PictCSS,[{key:"addCSS",value:function addCSS(pHash,pContent,pPriority,pProvider){var tmpPriority=typeof pPriority!=='undefined'?pPriority:1000;var tmpProvidor=typeof pProvider==='string'?pProvider:'Unknown';this.inlineCSSMap[pHash]={Hash:pHash,Content:pContent,Provider:tmpProvidor,Priority:tmpPriority};}},{key:"removeCSS",value:function removeCSS(pHash){delete this.inlineCSSMap[pHash];}},{key:"generateCSS",value:function generateCSS(){var _this64=this;var tmpCSS='';var tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
|
|
3982
|
+
tmpCSSHashes.sort(function(a,b){return _this64.inlineCSSMap[a].Priority-_this64.inlineCSSMap[b].Priority;});for(var i=0;i<tmpCSSHashes.length;i++){var tmpCSSFragment=this.inlineCSSMap[tmpCSSHashes[i]];var tmpCSSComment=tmpCSSFragment.Hash;if(tmpCSSFragment.Hash!=tmpCSSFragment.Provider){tmpCSSComment="".concat(tmpCSSComment," from ").concat(tmpCSSFragment.Provider);}tmpCSS+="/* ".concat(tmpCSSComment," */\n").concat(tmpCSSFragment.Content,"\n");}return tmpCSS;}// Inject the CSS into the magic DOM element for it
|
|
3983
|
+
},{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);}(libFableServiceBase);module.exports=PictCSS;},{"fable":58}],163:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase18){function PictContentAssignment(pFable,pOptions,pServiceHash){var _this65;_classCallCheck2(this,PictContentAssignment);_this65=_callSuper(this,PictContentAssignment,[pFable,pOptions,pServiceHash]);_this65.serviceType='PictContentAssignment';// Check to see if we are running in a browser
|
|
3984
|
+
_this65.inBrowser=false;_this65.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this65.inBrowser=true;// Now check that the browser has a document object
|
|
3985
|
+
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this65.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
|
|
3986
|
+
_this65.hasJquery=false;_this65.jQuery=false;if(_this65.inBrowser&&typeof window.jQuery!=='undefined'){_this65.hasJquery=true;}// API Consumers can craft their own assign function
|
|
3987
|
+
_this65.customAssignFunction=false;// API Consumers can also craft their own prepend function
|
|
3988
|
+
_this65.customPrependFunction=false;// API Consumers can also craft their own append function
|
|
3989
|
+
_this65.customAppendFunction=false;// API Consumers can also craft their own read function
|
|
3990
|
+
_this65.customReadFunction=false;// API Consumers can even craft their own get element function.
|
|
3991
|
+
_this65.customGetElementFunction=false;// API Consumers can also craft their own attribute read function
|
|
3992
|
+
_this65.customReadAttributeFunction=false;// API Consumers can also craft their own attribute set function
|
|
3993
|
+
_this65.customSetAttributeFunction=false;// API Consumers can also craft their own attribute remove function
|
|
3994
|
+
_this65.customRemoveAttributeFunction=false;// API Consumers can also craft their own class read function
|
|
3995
|
+
_this65.customReadClassFunction=false;// API Consumers can also craft their own class set function
|
|
3996
|
+
_this65.customSetClassFunction=false;// API Consumers can also craft their own class remove function
|
|
3997
|
+
_this65.customRemoveClassFunction=false;return _this65;}_inherits(PictContentAssignment,_libFableServiceBase18);return _createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return[];}else{// TODO: This isn't the most efficient method, but it is the most compatible.
|
|
3990
3998
|
var tmpElementSet=[];for(var i=0;i<tmpElements.length;i++){tmpElementSet.push(tmpElements[0]);}return tmpElementSet;}}else if(this.inBrowser&&this.hasDocument){return window.document.querySelectorAll(pAddress);}else{// Just log it out for now
|
|
3991
3999
|
this.log.trace("PICT Content GET ELEMENT for [".concat(pAddress,"] will return empty because none of the browser methods are available"));return[];}}},{key:"assignContent",value:function assignContent(pAddress,pContent){if(this.customAssignFunction){return this.customAssignFunction(pAddress,pContent);}else if(this.hasJquery){// Get the element(s)
|
|
3992
4000
|
var tmpTargetElementSet=window.jQuery(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){switch(tmpTargetElementSet[i].tagName){case'INPUT':case'SELECT':case'TEXTAREA':tmpTargetElementSet[i].value=pContent;break;case'SCRIPT':tmpTargetElementSet[i].text=pContent;break;default:tmpTargetElementSet[i].innerHTML=pContent;}}}else if(this.inBrowser&&this.hasDocument){// Get the element(s)
|
|
@@ -3996,22 +4004,22 @@ this.log.trace("PICT Content APPEND to [".concat(pAddress,"]:"),pContent);}}},{k
|
|
|
3996
4004
|
this.log.trace("PICT Content PREPEND in [".concat(pAddress,"]:"),pContent);}}},{key:"readContent",value:function readContent(pAddress){if(this.customReadFunction){return this.customReadFunction(pAddress);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);switch(tmpTargetElement.prop('tagName')){case'INPUT':case'SELECT':case'TEXTAREA':return tmpTargetElement.val();case'SCRIPT':return tmpTargetElement.text();default:return tmpTargetElement.html();}}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);if(tmpTargetElementSet.length<1){return null;}else if(tmpTargetElementSet.length==1){switch(tmpTargetElementSet[0].tagName){case'INPUT':case'SELECT':case'TEXTAREA':return tmpTargetElementSet[0].value;case'SCRIPT':return tmpTargetElementSet[0].text;default:return tmpTargetElementSet[0].innerHTML;}}}else{// Just log it out for now -- nothing browser in our mix.
|
|
3997
4005
|
this.log.trace("PICT Content READ from [".concat(pAddress,"]..."));return'';}}},{key:"addClass",value:function addClass(pAddress,pClass){if(this.customSetClassFunction){return this.customSetClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
|
|
3998
4006
|
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.addClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.add(pClass);}}else{this.log.trace("PICT Content ADDCLASS to [".concat(pAddress,"]:"),pClass);}}},{key:"removeClass",value:function removeClass(pAddress,pClass){if(this.customRemoveClassFunction){return this.customRemoveClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
|
|
3999
|
-
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.remove(pClass);}}else{this.log.trace("PICT Content REMOVECLASS from [".concat(pAddress,"]:"),pClass);}}},{key:"readAttribute",value:function readAttribute(pAddress,pAttribute){if(this.customReadAttributeFunction){return this.customReadAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].getAttribute(pAttribute);}}else{this.log.trace("PICT Content READATTRIBUTE from [".concat(pAddress,"]:"),pAttribute);}}},{key:"setAttribute",value:function setAttribute(pAddress,pAttribute,pValue){if(this.customSetAttributeFunction){return this.customSetAttributeFunction(pAddress,pAttribute,pValue);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute,pValue);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].setAttribute(pAttribute,pValue);}}else{this.log.trace("PICT Content SETATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]:"),pValue);}}},{key:"removeAttribute",value:function removeAttribute(pAddress,pAttribute){if(this.customRemoveAttributeFunction){return this.customRemoveAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeAttr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].removeAttribute(pAttribute);}}else{this.log.trace("PICT Content REMOVEATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]"));}}},{key:"hasClass",value:function hasClass(pAddress,pClass){if(this.customReadClassFunction){return this.customReadClassFunction(pAddress,pClass);}if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.hasClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){return tmpTargetElementSet[i].classList.contains(pClass);}}else{this.log.trace("PICT Content HASCLASS for [".concat(pAddress,"] CLASS [").concat(pClass,"]:"));}}}]);}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":58}],164:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase19){function PictDataProvider(pFable,pOptions,pServiceHash){var
|
|
4007
|
+
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.remove(pClass);}}else{this.log.trace("PICT Content REMOVECLASS from [".concat(pAddress,"]:"),pClass);}}},{key:"readAttribute",value:function readAttribute(pAddress,pAttribute){if(this.customReadAttributeFunction){return this.customReadAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].getAttribute(pAttribute);}}else{this.log.trace("PICT Content READATTRIBUTE from [".concat(pAddress,"]:"),pAttribute);}}},{key:"setAttribute",value:function setAttribute(pAddress,pAttribute,pValue){if(this.customSetAttributeFunction){return this.customSetAttributeFunction(pAddress,pAttribute,pValue);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.attr(pAttribute,pValue);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].setAttribute(pAttribute,pValue);}}else{this.log.trace("PICT Content SETATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]:"),pValue);}}},{key:"removeAttribute",value:function removeAttribute(pAddress,pAttribute){if(this.customRemoveAttributeFunction){return this.customRemoveAttributeFunction(pAddress,pAttribute);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeAttr(pAttribute);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].removeAttribute(pAttribute);}}else{this.log.trace("PICT Content REMOVEATTRIBUTE for [".concat(pAddress,"] ATTRIBUTE [").concat(pAttribute,"]"));}}},{key:"hasClass",value:function hasClass(pAddress,pClass){if(this.customReadClassFunction){return this.customReadClassFunction(pAddress,pClass);}if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.hasClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){return tmpTargetElementSet[i].classList.contains(pClass);}}else{this.log.trace("PICT Content HASCLASS for [".concat(pAddress,"] CLASS [").concat(pClass,"]:"));}}}]);}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":58}],164:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase19){function PictDataProvider(pFable,pOptions,pServiceHash){var _this66;_classCallCheck2(this,PictDataProvider);_this66=_callSuper(this,PictDataProvider,[pFable,pOptions,pServiceHash]);_this66.serviceType='PictDataProvider';return _this66;}_inherits(PictDataProvider,_libFableServiceBase19);return _createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":58}],165:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase20){function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this67;_classCallCheck2(this,PictMeadowEntityProvider);_this67=_callSuper(this,PictMeadowEntityProvider,[pFable,pOptions,pServiceHash]);_this67.serviceType='PictMeadowProvider';if(_this67.fable.settings.PictDefaultURLPrefix){_this67.options.urlPrefix=_this67.fable.settings.PictDefaultURLPrefix;}else if(!_this67.options.urlPrefix){_this67.options.urlPrefix='/1.0/';}if(_this67.fable.settings.PictDefaultDownloadBatchSize){_this67.options.downloadBatchSize=_this67.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this67.options.downloadBatchSize){_this67.options.downloadBatchSize=100;}_this67.restClient=_this67.fable.instantiateServiceProviderWithoutRegistration('RestClient');_this67.cache={};_this67.prepareRequestOptions=function(pOptions){return pOptions;};return _this67;}_inherits(PictMeadowEntityProvider,_libFableServiceBase20);return _createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
|
|
4000
4008
|
if(!this.cache.hasOwnProperty(pEntity)){this.cache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
4001
4009
|
// For now cache for 30 seconds.
|
|
4002
4010
|
this.cache[pEntity].maxAge=30000;this.cache[pEntity].maxLength=10000;this.fable.Bundle[pEntity]=this.cache[pEntity].RecordMap;}}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
4003
|
-
this.cache[pEntity].prune(function(){var
|
|
4011
|
+
this.cache[pEntity].prune(function(){var _this68=this;var tmpPossibleRecord=this.cache[pEntity].read(pIDRecord);if(tmpPossibleRecord){return fCallback(null,tmpPossibleRecord);}var tmpOptions={url:"".concat(this.options.urlPrefix).concat(pEntity,"/").concat(pIDRecord)};tmpOptions=this.prepareRequestOptions(tmpOptions);return this.restClient.getJSON(tmpOptions,function(pError,pResponse,pBody){if(pBody){_this68.cache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});}.bind(this));}},{key:"getEntitySetPage",value:function getEntitySetPage(pEntity,pMeadowFilterExpression,pRecordStartCursor,pRecordCount,fCallback){var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(pRecordStartCursor,"/").concat(pRecordCount);return this.restClient.getJSON(tmpURL,function(pDownloadError,pDownloadResponse,pDownloadBody){return fCallback(pDownloadError,pDownloadBody);}.bind(this));}},{key:"getEntitySetRecordCount",value:function getEntitySetRecordCount(pEntity,pMeadowFilterExpression,fCallback){var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s/Count/FilteredTo/").concat(pMeadowFilterExpression);return this.restClient.getJSON(tmpURL,function(pError,pResponse,pBody){if(pError){this.log.error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}return fCallback(pError,tmpRecordCount);}.bind(this));}},{key:"getEntitySet",value:function getEntitySet(pEntity,pMeadowFilterExpression,fCallback){// TODO: Should we test for too many record IDs here by string length in pMeadowFilterExpression?
|
|
4004
4012
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
4005
4013
|
// If the list is mega-long we can parse it and break it into chunks.
|
|
4006
4014
|
this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
4007
|
-
this.cache[pEntity].prune(function(){var
|
|
4008
|
-
tmpDownloadURIFragments.push("".concat(
|
|
4009
|
-
|
|
4010
|
-
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":58}],166:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase21){function PictTemplateProvider(pFable,pOptions,pServiceHash){var
|
|
4015
|
+
this.cache[pEntity].prune(function(){var _this69=this;return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this69.log.error("Entity count did not return a number for [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"]... something is fatally wrong from the server accessed in getEntitySet call."));return fCallback(new Error('Entity count did not return a number in getEntitySet.'));}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this69.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
4016
|
+
tmpDownloadURIFragments.push("".concat(_this69.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(i*tmpDownloadBatchSize,"/").concat(tmpDownloadBatchSize));}var tmpEntitySet=[];// Now run these in series (it's possible to parallelize the requests but they would not be in server order)
|
|
4017
|
+
_this69.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){_this69.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
|
|
4018
|
+
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":58}],166:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase21){function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this70;_classCallCheck2(this,PictTemplateProvider);_this70=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this70.serviceType='PictTemplateProvider';_this70.templates={};_this70.templateSources={};// Default templates are stored by prefix.
|
|
4011
4019
|
// The longest prefix match is used.
|
|
4012
4020
|
// Case sensitive.
|
|
4013
|
-
|
|
4014
|
-
|
|
4021
|
+
_this70.defaultTemplates=[];// This function can be overloaded to load templates from a database, in a page or other source.
|
|
4022
|
+
_this70.loadTemplateFunction=function(pTemplateHash){return false;};return _this70;}_inherits(PictTemplateProvider,_libFableServiceBase21);return _createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}},{key:"addDefaultTemplate",value:function addDefaultTemplate(pPrefix,pPostfix,pTemplate,pSource){var tmpSource=typeof pSource=='string'?pSource:"Direct addDefaultTemplate('".concat(pPrefix,"','").concat(pPostfix,"',..) function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");var tmpDefaultTemplate={prefix:pPrefix,postfix:pPostfix,template:pTemplate,source:tmpSource};if(typeof pTemplate!='string'){this.log.error('PictTemplateProvider.addDefaultTemplate: pTemplate is not a string.');}this.defaultTemplates.push(tmpDefaultTemplate);}},{key:"checkDefaultTemplateHash",value:function checkDefaultTemplateHash(pTemplateHash){/*
|
|
4015
4023
|
* Default templates are managed by postfix and prefix. The use case is things like titles, headers, list
|
|
4016
4024
|
* wrappers, rows, etc.
|
|
4017
4025
|
*
|
|
@@ -4025,13 +4033,13 @@ _this67.loadTemplateFunction=function(pTemplateHash){return false;};return _this
|
|
|
4025
4033
|
if(!this.templates.hasOwnProperty(pTemplateHash)){this.loadTemplate(pTemplateHash);}// If the loading function fails, try to load it from the default templates
|
|
4026
4034
|
if(!this.templates.hasOwnProperty(pTemplateHash)){this.checkDefaultTemplateHash(pTemplateHash);}if(this.templates.hasOwnProperty(pTemplateHash)){return this.templates[pTemplateHash];}else{return false;}}},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":58}],167:[function(require,module,exports){/**
|
|
4027
4035
|
* @author <steven@velozo.com>
|
|
4028
|
-
*/var libFable=require('fable');var Pict=/*#__PURE__*/function(_libFable){function Pict(pSettings){var
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
if(
|
|
4034
|
-
|
|
4036
|
+
*/var libFable=require('fable');var Pict=/*#__PURE__*/function(_libFable){function Pict(pSettings){var _this71;_classCallCheck2(this,Pict);_this71=_callSuper(this,Pict,[pSettings]);_this71.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");// The templateProvider provides a basic key->template mapping with default fallback capabilities
|
|
4037
|
+
_this71.addAndInstantiateServiceType('TemplateProvider',require('./Pict-Template-Provider.js'));_this71.addAndInstantiateServiceType('EntityProvider',require('./Pict-Meadow-EntityProvider.js'));_this71.addAndInstantiateServiceType('DataProvider',require('./Pict-DataProvider.js'));_this71.addAndInstantiateServiceType('ContentAssignment',require('./Pict-Content-Assignment.js'));_this71.addAndInstantiateServiceType('CSSMap',require('./Pict-CSS.js'));_this71.instantiateServiceProvider('MetaTemplate');_this71.instantiateServiceProvider('DataGeneration');_this71.manifest=_this71.instantiateServiceProvider('Manifest');_this71.AppData={};_this71.Bundle={};// Log noisness goes from 0 - 5, where 5 is show me everything.
|
|
4038
|
+
_this71.LogNoisiness=0;// Although we have log noisiness, sometimes we need control flow without all the other noise for hard to diagnose interpreters.
|
|
4039
|
+
_this71.LogControlFlow=false;// And an easy way to be introspective about data at various locations
|
|
4040
|
+
_this71.LogControlFlowWatchAddressList=[];// Load manifest sets
|
|
4041
|
+
if(_this71.settings.Manifests){_this71.loadManifestSet(_this71.settings.Manifests);}_this71._DefaultPictTemplatesInitialized=false;_this71.initializePictTemplateEngine();_this71.addServiceType('PictView',require('pict-view'));_this71.addServiceType('PictProvider',require('pict-provider'));_this71.addServiceType('PictApplication',require('pict-application'));// Expose the named views directly, through a convenience accessor
|
|
4042
|
+
_this71.views=_this71.servicesMap.PictView;_this71.providers=_this71.servicesMap.PictProvider;return _this71;}// Load manifests in as Hashed services
|
|
4035
4043
|
_inherits(Pict,_libFable);return _createClass2(Pict,[{key:"loadManifestSet",value:function loadManifestSet(pManifestSet){if(_typeof(pManifestSet)!='object'){this.log.warn("PICT [".concat(this.UUID,"] could not load Manifest Set; pManifestSet was not an object."));return false;}var tmpManifestKeys=Object.keys(pManifestSet);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
4036
4044
|
var tmpManifestKey=tmpManifestKeys[i];this.instantiateServiceProvider('Manifest',pManifestSet[tmpManifestKey],tmpManifestKey);}}}// Just passing an options will construct one for us.
|
|
4037
4045
|
// Passing a hash will set the hash.
|
|
@@ -4045,7 +4053,7 @@ if(pProviderPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.f
|
|
|
4045
4053
|
// Passing a hash will set the hash.
|
|
4046
4054
|
// Passing a prototype will use that!
|
|
4047
4055
|
},{key:"addApplication",value:function addApplication(pApplicationHash,pOptions,pApplicationPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpApplicationHash=typeof pApplicationHash=='string'?pApplicationHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addApplication [".concat(tmpApplicationHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addApplication [".concat(tmpApplicationHash,"]"));}}if(typeof pApplicationPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
|
|
4048
|
-
if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},pApplicationPrototype.default_configuration,tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictApplication',tmpOptions,tmpApplicationHash,pApplicationPrototype);}else{return this.instantiateServiceProvider('PictApplication',tmpOptions,tmpApplicationHash);}}},{key:"initializePictTemplateEngine",value:function initializePictTemplateEngine(){var
|
|
4056
|
+
if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},pApplicationPrototype.default_configuration,tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictApplication',tmpOptions,tmpApplicationHash,pApplicationPrototype);}else{return this.instantiateServiceProvider('PictApplication',tmpOptions,tmpApplicationHash);}}},{key:"initializePictTemplateEngine",value:function initializePictTemplateEngine(){var _this72=this;/*
|
|
4049
4057
|
*
|
|
4050
4058
|
* To stave off madness, these are inefficient for now. The wkhtmltopdf renderer leaves much to be desired
|
|
4051
4059
|
* in the way of feedback with regards to javascript compatibility.
|
|
@@ -4053,108 +4061,108 @@ if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=thi
|
|
|
4053
4061
|
*/if(!this._DefaultPictTemplatesInitialized){// Expects one of the following:
|
|
4054
4062
|
// {~E:Book^AppData.Some.Address.IDBook^Render-Book-Template~}
|
|
4055
4063
|
// ...meaning GET BOOK with IDBook FROM AppData.Some.Address.IDBook and render it to Render-Book-Template
|
|
4056
|
-
var fEntityRender=function fEntityRender(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(
|
|
4057
|
-
var tmpAddressParts=tmpHash.split('^');if(tmpAddressParts.length<2){
|
|
4058
|
-
tmpEntityID=
|
|
4059
|
-
if(!tmpEntity||!tmpEntityID){
|
|
4060
|
-
|
|
4061
|
-
if(tmpEntityTemplate){return this.parseTemplateByHash(tmpEntityTemplate,pRecord,tmpCallback,pContextArray);}else{return tmpCallback(null,'');}}.bind(
|
|
4062
|
-
var fTemplateRender=function fTemplateRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4064
|
+
var fEntityRender=function fEntityRender(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"]"));}var tmpEntity=false;var tmpEntityID=false;var tmpEntityTemplate=false;// This expression requires 2 parts -- a third is optional, and, if present, is the template to render to.
|
|
4065
|
+
var tmpAddressParts=tmpHash.split('^');if(tmpAddressParts.length<2){_this72.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]"));return tmpCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]")),'');}tmpEntity=tmpAddressParts[0].trim();tmpEntityID=tmpAddressParts[1].trim();tmpEntityTemplate=tmpAddressParts[2].trim();if(!isNaN(tmpEntityID)){try{tmpEntityID=parseInt(tmpEntityID);}catch(_unused){_this72.log.warn("Pict: Entity Render: Could not parse entity ID.");tmpEntityID=0;}}else{// This is an address, so we need to get the value at the address
|
|
4066
|
+
tmpEntityID=_this72.resolveStateFromAddress(tmpEntityID,tmpData,pContextArray);}// No Entity or EntityID
|
|
4067
|
+
if(!tmpEntity||!tmpEntityID){_this72.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"] Entity: ").concat(tmpEntity," ID: ").concat(tmpEntityID));return tmpCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"] Entity: ").concat(tmpEntity," ID: ").concat(tmpEntityID)),'');}if(_this72.LogNoisiness>3){_this72.log.trace("Pict: Entity Render: Entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] as template [").concat(tmpEntityTemplate,"] from [").concat(tmpHash,"]"));}// Now try to get the entity
|
|
4068
|
+
_this72.EntityProvider.getEntity(tmpEntity,tmpEntityID,function(pError,pRecord){if(pError){this.log.error("Pict: Entity Render: Error getting entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] for [").concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}// Now render the template
|
|
4069
|
+
if(tmpEntityTemplate){return this.parseTemplateByHash(tmpEntityTemplate,pRecord,tmpCallback,pContextArray);}else{return tmpCallback(null,'');}}.bind(_this72));};this.MetaTemplate.addPatternAsync('{~E:','~}',fEntityRender);this.MetaTemplate.addPatternAsync('{~Entity:','~}',fEntityRender);// {~T:Template:AddressOfData~}
|
|
4070
|
+
var fTemplateRender=function fTemplateRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.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)
|
|
4063
4071
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4064
|
-
if(!tmpTemplateHash){
|
|
4065
|
-
return
|
|
4072
|
+
if(!tmpTemplateHash){_this72.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.
|
|
4073
|
+
return _this72.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}};var fTemplateRenderAsync=function fTemplateRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
|
|
4066
4074
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4067
|
-
if(!tmpTemplateHash){
|
|
4075
|
+
if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
4068
4076
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
4069
|
-
return
|
|
4070
|
-
var fTemplateSetRender=function fTemplateSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4077
|
+
return _this72.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~T:','~}',fTemplateRender,fTemplateRenderAsync);this.MetaTemplate.addPatternBoth('{~Template:','~}',fTemplateRender,fTemplateRenderAsync);// {~TS:Template:AddressOfDataSet~}
|
|
4078
|
+
var fTemplateSetRender=function fTemplateSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.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)
|
|
4071
4079
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4072
|
-
if(!tmpTemplateHash){
|
|
4073
|
-
return
|
|
4074
|
-
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){
|
|
4075
|
-
if(!tmpTemplateFromMapHash){
|
|
4076
|
-
tmpData=
|
|
4080
|
+
if(!tmpTemplateHash){_this72.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.
|
|
4081
|
+
return _this72.parseTemplateSetByHash(tmpTemplateHash,pData,pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),pContextArray);}};var fTemplateSetRenderAsync=function fTemplateSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfData=false;// This is a 3 part hash with the map address and the key address both
|
|
4082
|
+
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){_this72.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
|
|
4083
|
+
if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
4084
|
+
tmpData=_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
4077
4085
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
4078
|
-
return
|
|
4086
|
+
return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TS:','~}',fTemplateSetRender,fTemplateSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateSet:','~}',fTemplateSetRender,fTemplateSetRenderAsync);// {~TemplateIfAbsolute:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
|
|
4079
4087
|
// {~TIfAbs:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
|
|
4080
|
-
var compareValues=function compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}};var fTemplateIfAbsoluteValueRender=function fTemplateIfAbsoluteValueRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4081
|
-
if(!tmpTemplateHash){
|
|
4082
|
-
if(!tmpComparisonOperation){
|
|
4083
|
-
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){
|
|
4084
|
-
try{var tmpComparisonResult=compareValues(
|
|
4085
|
-
return
|
|
4086
|
-
if(!tmpTemplateHash){
|
|
4087
|
-
if(!tmpComparisonOperation){
|
|
4088
|
-
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){
|
|
4089
|
-
try{var tmpComparisonResult=compareValues(
|
|
4088
|
+
var compareValues=function compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}};var fTemplateIfAbsoluteValueRender=function fTemplateIfAbsoluteValueRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return"Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]");}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
|
|
4089
|
+
if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
|
|
4090
|
+
if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]");}// Now try to break the comparison into three parts...
|
|
4091
|
+
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]");}// Now look up the data at the comparison location
|
|
4092
|
+
try{var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return'';}else{if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
4093
|
+
return _this72.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return"Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError);}};var fTemplateIfAbsoluteValueRenderAsync=function fTemplateIfAbsoluteValueRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]")));}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
|
|
4094
|
+
if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]")));}// No comparison operation
|
|
4095
|
+
if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]")));}// Now try to break the comparison into three parts...
|
|
4096
|
+
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]")));}// Now look up the data at the comparison location
|
|
4097
|
+
try{var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],tmpComparisonParts[2]);if(!tmpComparisonResult){return tmpCallback(null,'');}else{if(!tmpAddressOfData){return _this72.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}};// {~TemplateIfAbsolute:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
|
|
4090
4098
|
// {~TIfAbs:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^Absolute_Value~}
|
|
4091
|
-
this.MetaTemplate.addPatternBoth('{~TemplateIfAbsolute:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);this.MetaTemplate.addPatternBoth('{~TIfAbs:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);var fTemplateIfRender=function fTemplateIfRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4092
|
-
if(!tmpTemplateHash){
|
|
4093
|
-
if(!tmpComparisonOperation){
|
|
4094
|
-
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){
|
|
4095
|
-
try{var tmpComparisonResult=compareValues(
|
|
4096
|
-
return
|
|
4097
|
-
if(!tmpTemplateHash){
|
|
4098
|
-
if(!tmpComparisonOperation){
|
|
4099
|
-
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){
|
|
4099
|
+
this.MetaTemplate.addPatternBoth('{~TemplateIfAbsolute:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);this.MetaTemplate.addPatternBoth('{~TIfAbs:','~}',fTemplateIfAbsoluteValueRender,fTemplateIfAbsoluteValueRenderAsync);var fTemplateIfRender=function fTemplateIfRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return"Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]");}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
|
|
4100
|
+
if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
|
|
4101
|
+
if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]");}// Now try to break the comparison into three parts...
|
|
4102
|
+
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return"Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]");}// Now look up the data at the comparison location
|
|
4103
|
+
try{var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],_this72.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray));if(!tmpComparisonResult){return'';}else{if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
4104
|
+
return _this72.parseTemplateByHash(tmpTemplateHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return"Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError);}};var fTemplateIfRenderAsync=function fTemplateIfRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){_this72.log.warn("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template If Absolute Value Render: TemplateHash not complete for [".concat(tmpHash,"]")));}tmpTemplateHash=tmpHashParts[0];tmpAddressOfData=tmpHashParts[1];tmpComparisonOperation=tmpHashParts[2];// No template hash
|
|
4105
|
+
if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]")));}// No comparison operation
|
|
4106
|
+
if(!tmpComparisonOperation){_this72.log.warn("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not resolved for [".concat(tmpHash,"]")));}// Now try to break the comparison into three parts...
|
|
4107
|
+
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){_this72.log.warn("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]"));return tmpCallback(new Error("Pict: Template Render: Comparison Operation not complete (three parts expected) for [".concat(tmpHash,"]")));}// Now look up the data at the comparison location
|
|
4100
4108
|
try{// This is the only thing that's different from the absolute value function above. Collapse these.
|
|
4101
|
-
var tmpComparisonResult=compareValues(
|
|
4109
|
+
var tmpComparisonResult=compareValues(_this72.resolveStateFromAddress(tmpComparisonParts[0],tmpData,pContextArray),tmpComparisonParts[1],_this72.resolveStateFromAddress(tmpComparisonParts[2],tmpData,pContextArray));if(!tmpComparisonResult){return tmpCallback(null,'');}else{if(!tmpAddressOfData){return _this72.parseTemplateByHash(tmpTemplateHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateHash,_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}catch(pError){_this72.log.error("Pict: Template Render: Error looking up comparison data for [".concat(tmpHash,"]: ").concat(pError),pError);return tmpCallback(pError,'');}};// {~TemplateIf:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^AppData.Some.Address2.IDBook~}
|
|
4102
4110
|
// {~TIf:Template:AddressOfData:AppData.Some.Address.IDBook^OPERATOR^AppData.Some.Address2.IDBook~}
|
|
4103
4111
|
this.MetaTemplate.addPatternBoth('{~TemplateIf:','~}',fTemplateIfRender,fTemplateIfRenderAsync);this.MetaTemplate.addPatternBoth('{~TIf:','~}',fTemplateIfRender,fTemplateIfRenderAsync);// Refactor: #### DRY PROBLEM Too much dry needing fixed at this point
|
|
4104
4112
|
// {~TS:Template:AddressOfDataSet~}
|
|
4105
|
-
var fTemplateValueSetRender=function fTemplateValueSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4113
|
+
var fTemplateValueSetRender=function fTemplateValueSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
|
|
4106
4114
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4107
|
-
if(!tmpTemplateHash){
|
|
4108
|
-
return
|
|
4109
|
-
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){
|
|
4110
|
-
if(!tmpTemplateFromMapHash){
|
|
4111
|
-
tmpData=
|
|
4115
|
+
if(!tmpTemplateHash){_this72.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}tmpData=_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i]});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i47=0;_i47<tmpValueKeys.length;_i47++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i47]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
4116
|
+
return _this72.parseTemplateSetByHash(tmpTemplateHash,pData,pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateHash,tmpData,pContextArray);}};var fTemplateValueSetRenderAsync=function fTemplateValueSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfData=false;// This is a 3 part hash with the map address and the key address both
|
|
4117
|
+
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){_this72.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
|
|
4118
|
+
if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
4119
|
+
tmpData=_this72.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i]});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i48=0;_i48<tmpValueKeys.length;_i48++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i48]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
4112
4120
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
4113
|
-
return
|
|
4114
|
-
var fTemplateFromMapRender=function fTemplateFromMapRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4115
|
-
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){
|
|
4116
|
-
if(!tmpTemplateFromMapHash){
|
|
4117
|
-
var tmpMap=
|
|
4118
|
-
return
|
|
4119
|
-
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){
|
|
4120
|
-
if(!tmpTemplateFromMapHash){
|
|
4121
|
-
var tmpMap=
|
|
4121
|
+
return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TVS:','~}',fTemplateValueSetRender,fTemplateValueSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateValueSet:','~}',fTemplateValueSetRender,fTemplateValueSetRenderAsync);// {~T:TemplateFromMap:AddressOfData~}
|
|
4122
|
+
var fTemplateFromMapRender=function fTemplateFromMapRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
|
|
4123
|
+
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
|
|
4124
|
+
if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
4125
|
+
var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return'';}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
4126
|
+
return _this72.parseTemplateByHash(tmpTemplateFromMapHash,pData,null,pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,null,pContextArray);}};var fTemplateFromMapRenderAsync=function fTemplateFromMapRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
|
|
4127
|
+
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
|
|
4128
|
+
if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
4129
|
+
var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
4122
4130
|
// The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
|
|
4123
|
-
return
|
|
4124
|
-
var fTemplateFromMapSetRender=function fTemplateFromMapSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4125
|
-
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){
|
|
4126
|
-
if(!tmpTemplateFromMapHash){
|
|
4127
|
-
var tmpMap=
|
|
4128
|
-
return
|
|
4129
|
-
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){
|
|
4130
|
-
if(!tmpTemplateFromMapHash){
|
|
4131
|
-
var tmpMap=
|
|
4131
|
+
return _this72.parseTemplateByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TFM:','~}',fTemplateFromMapRender,fTemplateFromMapRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateFromMap:','~}',fTemplateFromMapRender,fTemplateFromMapRenderAsync);// {~TS:TemplateFromMap:AddressOfDataSet~}
|
|
4132
|
+
var fTemplateFromMapSetRender=function fTemplateFromMapSetRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
|
|
4133
|
+
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
|
|
4134
|
+
if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
4135
|
+
var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMap Render: Map not resolved for [".concat(tmpHash,"]"));return'';}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
4136
|
+
return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,pContextArray);}};var fTemplateFromMapSetRenderAsync=function fTemplateFromMapSetRenderAsync(pHash,pData,fCallback,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(_this72.LogNoisiness>4){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>0){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash=false;var tmpAddressOfMap=false;var tmpAddressOfKey=false;// This is a 3 part hash with the map address and the key address both
|
|
4137
|
+
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){_this72.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
|
|
4138
|
+
if(!tmpTemplateFromMapHash){_this72.log.warn("Pict: TemplateFromMapSet Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
4139
|
+
var tmpMap=_this72.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=_this72.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){_this72.log.warn("Pict: TemplateFromMapSet Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
4132
4140
|
// The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
|
|
4133
|
-
return
|
|
4134
|
-
var fDataValueTree=function fDataValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=
|
|
4135
|
-
tmpPictObjectWrapTemplate="<div class=\"PICT PICTObjectSet\">{~D:Record.ObjectValueTree~}</div>";}if(tmpData.ResolvedValueType=='object'){tmpData.ObjectValueTree=fDataValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ResolvedValue,0,tmpData.TreeMaxDepth,pContextArray);}else{
|
|
4136
|
-
tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.CurrentDepth~}\"><div class=\"PICTObjectBranch\">{~D:Record.BranchKey~}</div><div class=\"PICTObjectBranchValue\">{~D:Record.BranchValue~}</div></div>\n";}for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':if(pCurrentDepth+1>pMaxDepth){tmpBranchValue='...';}else{tmpBranchValue=fDataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}var tmpDataValue={AppData:
|
|
4137
|
-
var fDataRender=function fDataRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4138
|
-
var fJoinDataRender=function fJoinDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4139
|
-
var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=
|
|
4140
|
-
var fJoinUniqueDataRender=function fJoinUniqueDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4141
|
-
var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={};for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=
|
|
4142
|
-
this.MetaTemplate.addPattern('{~DateYMD:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValue=
|
|
4143
|
-
var tmpDayJS=
|
|
4144
|
-
if(
|
|
4141
|
+
return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,pData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return _this72.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}};this.MetaTemplate.addPatternBoth('{~TSFM:','~}',fTemplateFromMapSetRender,fTemplateFromMapSetRenderAsync);this.MetaTemplate.addPatternBoth('{~TemplateSetFromMap:','~}',fTemplateFromMapSetRender,fTemplateFromMapSetRenderAsync);// {~DataTree:AppData.Some.Value.to.Render~}
|
|
4142
|
+
var fDataValueTree=function fDataValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=_this72.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused2){tmpData.TreeMaxDepth=1;}var tmpPictObjectWrapTemplate=_this72.TemplateProvider.getTemplate('PICT-Object-Wrap');if(!tmpPictObjectWrapTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Wrap
|
|
4143
|
+
tmpPictObjectWrapTemplate="<div class=\"PICT PICTObjectSet\">{~D:Record.ObjectValueTree~}</div>";}if(tmpData.ResolvedValueType=='object'){tmpData.ObjectValueTree=fDataValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ResolvedValue,0,tmpData.TreeMaxDepth,pContextArray);}else{_this72.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);tmpData.ObjectValueTree=tmpData.ResolveValue;}return _this72.parseTemplate(tmpPictObjectWrapTemplate,tmpData,pContextArray);};var fDataValueTreeObjectSet=function fDataValueTreeObjectSet(pObject,pRootObject,pCurrentDepth,pMaxDepth,pContextArray){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);var tmpPictObjectBranchTemplate=_this72.TemplateProvider.getTemplate('PICT-Object-Branch');if(!tmpPictObjectBranchTemplate){// This template is here because it is a default template. Users can override this template by providing their own as PICT-Object-Branch
|
|
4144
|
+
tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.CurrentDepth~}\"><div class=\"PICTObjectBranch\">{~D:Record.BranchKey~}</div><div class=\"PICTObjectBranchValue\">{~D:Record.BranchValue~}</div></div>\n";}for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':if(pCurrentDepth+1>pMaxDepth){tmpBranchValue='...';}else{tmpBranchValue=fDataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}var tmpDataValue={AppData:_this72.AppData,Bundle:_this72.Bundle,RootContainer:pRootObject,Container:pObject,BranchEntryCount:tmpObjectValueKeys.length,BranchIndex:i,BranchKey:tmpObjectValueKeys[i],BranchValue:tmpBranchValue,BranchDataType:tmpBranchType,CurrentDepth:pCurrentDepth,MaxDepth:pMaxDepth};tmpTemplateResult+=_this72.parseTemplate(tmpPictObjectBranchTemplate,tmpDataValue,pContextArray);}return tmpTemplateResult;};this.MetaTemplate.addPattern('{~DataTree:','~}',fDataValueTree);this.MetaTemplate.addPattern('{~DT:','~}',fDataValueTree);//{~Data:AppData.Some.Value.to.Render~}
|
|
4145
|
+
var fDataRender=function fDataRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue='';if(tmpHash!=null){tmpValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);}if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;};this.MetaTemplate.addPattern('{~D:','~}',fDataRender);this.MetaTemplate.addPattern('{~Data:','~}',fDataRender);//<p>{~Join: - ^Record.d1^Record.d1~}</p>
|
|
4146
|
+
var fJoinDataRender=function fJoinDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
|
|
4147
|
+
var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=_this72.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){tmpValueList.push(tmpValueSet[j]);}}else if(tmpValueSet){tmpValueList.push(tmpValueSet);}}return tmpValueList.join(tmpSeparator);};this.MetaTemplate.addPattern('{~J:','~}',fJoinDataRender);this.MetaTemplate.addPattern('{~Join:','~}',fJoinDataRender);//<p>{~JoinUnique: - ^Record.d1^Record.d1~}</p>
|
|
4148
|
+
var fJoinUniqueDataRender=function fJoinUniqueDataRender(pHash,pData,pContextArray){var tmpHash=pHash;var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
|
|
4149
|
+
var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={};for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=_this72.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){if(!tmpValueMap.hasOwnProperty(tmpValueSet[j])){tmpValueMap[tmpValueSet[j]]=true;tmpValueList.push(tmpValueSet[j]);}}}else if(tmpValueSet){if(!tmpValueMap.hasOwnProperty(tmpValueSet)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);};this.MetaTemplate.addPattern('{~JU:','~}',fJoinUniqueDataRender);this.MetaTemplate.addPattern('{~JoinUnique:','~}',fJoinUniqueDataRender);this.MetaTemplate.addPattern('{~Dollars:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"]"));}var tmpColumnData=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return _this72.DataFormat.formatterDollars(tmpColumnData);});this.MetaTemplate.addPattern('{~Digits:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"]"));}var tmpColumnData=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return _this72.DataFormat.formatterAddCommasToNumber(_this72.DataFormat.formatterRoundNumber(tmpColumnData,2));});// Output the date as a YYYY-MM-DD string
|
|
4150
|
+
this.MetaTemplate.addPattern('{~DateYMD:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
4151
|
+
var tmpDayJS=_this72.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
|
|
4152
|
+
if(_this72.options.Timezone){tmpDayJS=tmpDayJS.tz(_this72.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}}catch(_unused3){//this.log.error(`Error casting timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
|
|
4145
4153
|
// Day.js will try to guess the user's timezone for us
|
|
4146
|
-
try{tmpDayJS=tmpDayJS.tz(
|
|
4154
|
+
try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}return tmpDayJS.format('YYYY-MM-DD');});// Output the date as a YYYY-MM-DD string
|
|
4147
4155
|
// Takes in the format as the second parameter: {~DateYMD:AppData.Some.Date^YYYY-MM-DD~}
|
|
4148
|
-
this.MetaTemplate.addPattern('{~DateFormat:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValueSet=tmpHash.split('^');if(tmpDateValueSet.length<2){
|
|
4149
|
-
var tmpDayJS=
|
|
4150
|
-
if(
|
|
4156
|
+
this.MetaTemplate.addPattern('{~DateFormat:','~}',function(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpDateValueSet=tmpHash.split('^');if(tmpDateValueSet.length<2){_this72.log.error("PICT Template [fDateFormat]::[".concat(tmpHash,"] did not have a valid format string and date."));return'';}var tmpDateValue=_this72.resolveStateFromAddress(tmpDateValueSet[0],tmpData,pContextArray);if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
4157
|
+
var tmpDayJS=_this72.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
|
|
4158
|
+
if(_this72.options.Timezone){tmpDayJS=tmpDayJS.tz(_this72.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}}catch(_unused4){//this.log.error(`Error casting date passed timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
|
|
4151
4159
|
// Day.js will try to guess the user's timezone for us
|
|
4152
|
-
try{tmpDayJS=tmpDayJS.tz(
|
|
4153
|
-
var fNotEmptyRender=function fNotEmptyRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
4160
|
+
try{tmpDayJS=tmpDayJS.tz(_this72.fable.Dates.dayJS.tz.guess());}catch(pError){_this72.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default.");}}return tmpDayJS.format(tmpDateValueSet[1]);});// {NE~Some.Address|If the left value is truthy, render this value.~}
|
|
4161
|
+
var fNotEmptyRender=function fNotEmptyRender(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>2){_this72.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"]"));}// Should switch this to indexOf so pipes can be in the content.
|
|
4154
4162
|
var tmpHashParts=tmpHash.split('|');// For now just check truthiness
|
|
4155
|
-
if(
|
|
4156
|
-
if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplate(tmpTemplateString,pData,fCallback,pContextArray);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var
|
|
4157
|
-
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return
|
|
4163
|
+
if(_this72.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}else{return'';}};this.MetaTemplate.addPattern('{~NotEmpty:','~}',fNotEmptyRender);this.MetaTemplate.addPattern('{~NE:','~}',fNotEmptyRender);var fRandomNumberString=function fRandomNumberString(pHash){var tmpHash=pHash.trim();if(_this72.LogNoisiness>3){_this72.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){try{tmpStringLength=parseInt(tmpHashParts[0]);}catch(_unused5){tmpStringLength=4;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused6){tmpMaxNumber=9999;}}}return _this72.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumberString:','~}',fRandomNumberString);this.MetaTemplate.addPattern('{~RNS:','~}',fRandomNumberString);var fRandomNumber=function fRandomNumber(pHash){var tmpHash=pHash.trim();if(_this72.LogNoisiness>3){_this72.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){try{tmpMinimumNumber=parseInt(tmpHashParts[0]);}catch(_unused7){tmpMinimumNumber=0;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused8){tmpMaxNumber=9999999;}}}return _this72.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumber:','~}',fRandomNumber);this.MetaTemplate.addPattern('{~RN:','~}',fRandomNumber);var fPascalCaseIdentifier=function fPascalCaseIdentifier(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this72.LogNoisiness>4){_this72.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this72.LogNoisiness>3){_this72.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"]"));}var tmpValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return _this72.DataFormat.cleanNonAlphaCharacters(_this72.DataFormat.capitalizeEachWord(tmpValue));};this.MetaTemplate.addPattern('{~PascalCaseIdentifier:','~}',fPascalCaseIdentifier);var fLogValue=function fLogValue(pHash,pData,pContextArray){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpValue=_this72.resolveStateFromAddress(tmpHash,tmpData,pContextArray);var tmpValueType=_typeof(tmpValue);if(tmpValue==null||tmpValueType=='undefined'){_this72.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is ").concat(tmpValueType,"."));}else if(tmpValueType=='object'){_this72.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is an object."),tmpValue);}else{_this72.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is a ").concat(tmpValueType," = [").concat(tmpValue,"]"));}return'';};this.MetaTemplate.addPattern('{~LogValue:','~}',fLogValue);this.MetaTemplate.addPattern('{~LV:','~}',fLogValue);var fLogValueTree=function fLogValueTree(pHash,pData,pContextArray){var tmpData=_typeof(pData)==='object'?pData:{};tmpData.TemplateHash=pHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=_this72.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused9){tmpData.TreeMaxDepth=1;}if(tmpData.ResolvedValueType=='object'){fLogValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ValueTreeParameters[0],tmpData.ResolvedValue,0,tmpData.TreeMaxDepth);}else{_this72.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);}return'';};var fLogValueTreeObjectSet=function fLogValueTreeObjectSet(pObject,pBaseAddress,pRootObject,pCurrentDepth,pMaxDepth){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);for(var i=0;i<tmpObjectValueKeys.length;i++){var tmpBranchType=_typeof(pObject[tmpObjectValueKeys[i]]);var tmpBranchValue='';switch(tmpBranchType){case'object':tmpBranchValue='...';break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}_this72.log.trace("[".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i],"] (").concat(tmpBranchType,"): ").concat(tmpBranchValue));if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=fLogValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],"".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i]),pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';};this.MetaTemplate.addPattern('{~LogValueTree:','~}',fLogValueTree);this.MetaTemplate.addPattern('{~LVT:','~}',fLogValueTree);var fLogStatement=function fLogStatement(pHash,pData){var tmpHash=pHash.trim();_this72.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));_this72.log.trace("PICT Template Breakpoint: ".concat(tmpHash),tmpError.stack);debugger;return'';};this.MetaTemplate.addPattern('{~Breakpoint','~}',fBreakpoint);this._DefaultPictTemplatesInitialized=true;}}},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];return this.manifest.getValueByHash({Pict:this,AppData:this.AppData,Bundle:this.Bundle,Context:tmpContextArray,Record:pRecord},pAddress);}},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var _this73=this;var tmpData=_typeof(pData)==='object'?pData:{};var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];var tmpParseUUID;if(this.LogControlFlow){tmpParseUUID=this.fable.getUUID();this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," [").concat(pTemplateString.substring(0,50).replace('\n','\\n'),"...").concat(pTemplateString.length,"] (fCallback: ").concat(_typeof(fCallback),") with data size [").concat(JSON.stringify(tmpData).length,"]"));if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," template:\n").concat(pTemplateString));}if(this.LogControlFlowWatchAddressList.length>0){for(var i=0;i<this.LogControlFlowWatchAddressList.length;i++){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Watch Value: [").concat(this.LogControlFlowWatchAddressList[i],"]=>[").concat(this.resolveStateFromAddress(this.LogControlFlowWatchAddressList[i],tmpData),"]"));}}}if(typeof fCallback==='function'){this.MetaTemplate.parseString(pTemplateString,tmpData,function(pError,pParsedTemplate){if(_this73.LogControlFlow&&_this73.LogNoisiness>1){_this73.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Template Async Return Value:\n").concat(pParsedTemplate));}return fCallback(pError,pParsedTemplate);},tmpContextArray);}else{var tmpResult=this.MetaTemplate.parseString(pTemplateString,tmpData,null,tmpContextArray);if(this.LogControlFlow&&this.LogNoisiness>1){this.log.info("PICT-ControlFlow parseTemplate ".concat(tmpParseUUID," Template Return Value:\n").concat(tmpResult));}return tmpResult;}}},{key:"parseTemplateByHash",value:function parseTemplateByHash(pTemplateHash,pData,fCallback,pContextArray){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
|
|
4164
|
+
if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplate(tmpTemplateString,pData,fCallback,pContextArray);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this74=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
4165
|
+
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this74.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],pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i49=0;_i49<tmpKeys.length;_i49++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i49]],pContextArray);}}return tmpValue;}else{return'';}}}},{key:"parseTemplateSetByHash",value:function parseTemplateSetByHash(pTemplateHash,pDataSet,fCallback,pContextArray){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
|
|
4158
4166
|
if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplateSet(tmpTemplateString,pDataSet,fCallback,pContextArray);}}]);}(libFable);;module.exports=Pict;module.exports.PictApplicationClass=require('pict-application');module.exports.PictViewClass=require('pict-view');module.exports.PictProviderClass=require('pict-provider');module.exports.EnvironmentLog=require('./environments/Pict-Environment-Log.js');module.exports.EnvironmentObject=require('./environments/Pict-Environment-Object.js');// This is to help understand the type of enivironement we're executing in
|
|
4159
4167
|
module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");module.exports.safeOnDocumentReady=require("./Pict-Browser-SafeOnDocumentReady.js");module.exports.safeLoadPictApplication=require("./Pict-Browser-SafeLoad.js");},{"./Pict-Browser-SafeLoad.js":160,"./Pict-Browser-SafeOnDocumentReady.js":161,"./Pict-CSS.js":162,"./Pict-Content-Assignment.js":163,"./Pict-DataProvider.js":164,"./Pict-Meadow-EntityProvider.js":165,"./Pict-Template-Provider.js":166,"./environments/Pict-Environment-Log.js":168,"./environments/Pict-Environment-Object.js":169,"fable":58,"pict-application":114,"pict-provider":115,"pict-view":116}],168:[function(require,module,exports){/**
|
|
4160
4168
|
* Pict browser shim loader
|