pict 1.0.197 → 1.0.198
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 +424 -205
- package/dist/pict.compatible.min.js +1 -1
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +239 -20
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +2 -2
package/dist/pict.compatible.js
CHANGED
|
@@ -1127,9 +1127,19 @@ var tmpValue=tmpManifest.getValueByHash(tmpDataSource,tmpToken.Token);// if (!tm
|
|
|
1127
1127
|
// // If no hash resolves, try by address.
|
|
1128
1128
|
// tmpValue = tmpManifest.getValueAtAddress(tmpToken.Token, tmpDataSource);
|
|
1129
1129
|
// }
|
|
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){
|
|
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){// TODO: Should we allow this to be a function? Good god the complexity and beauty of that...
|
|
1131
|
+
if(Array.isArray(tmpValue)||_typeof(tmpValue)==='object'){tmpToken.Resolved=true;tmpToken.Value=tmpValue;}else{tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric, non-set 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.
|
|
1131
1132
|
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.
|
|
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);}
|
|
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);}/**
|
|
1134
|
+
* Solves the given expression using the provided data and manifest.
|
|
1135
|
+
*
|
|
1136
|
+
* @param {string} pExpression - The expression to solve.
|
|
1137
|
+
* @param {object} pDataSourceObject - (optional) The data source object (e.g. AppData).
|
|
1138
|
+
* @param {object} pResultObject - (optional) The result object containing the full postfix expression list, internal variables and solver history.
|
|
1139
|
+
* @param {object} pManifest - (optional) The manifest object for dereferencing variables.
|
|
1140
|
+
* @param {object} pDataDestinationObject - (optional) The data destination object for where to marshal the result into.
|
|
1141
|
+
* @returns {any} - The result of solving the expression.
|
|
1142
|
+
*/},{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(pToken in this.ExpressionParser.tokenMap){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:
|
|
1133
1143
|
// There is a fifth token type, VirtualSymbol
|
|
1134
1144
|
// This is a value that's added during solve and looked up by address in the VirtualSymbol object.
|
|
1135
1145
|
}},{key:"getTokenContainerObject",value:function getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:pToken in this.ExpressionParser.tokenMap?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
|
|
@@ -1180,7 +1190,7 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
1180
1190
|
// }
|
|
1181
1191
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
1182
1192
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
1183
|
-
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}return tmpResults.RawTokens;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":67}],69:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"}};},{}],70:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserLinter=/*#__PURE__*/function(_libExpressionParserO2){function ExpressionParserLinter(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,ExpressionParserLinter);_this23=_callSuper(this,ExpressionParserLinter,[pFable,pOptions,pServiceHash]);_this23.serviceType='ExpressionParser-Linter';return _this23;}_inherits(ExpressionParserLinter,_libExpressionParserO2);return _createClass2(ExpressionParserLinter,[{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
1193
|
+
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}return tmpResults.RawTokens;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":67}],69:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"}};},{}],70:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserLinter=/*#__PURE__*/function(_libExpressionParserO2){function ExpressionParserLinter(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,ExpressionParserLinter);_this23=_callSuper(this,ExpressionParserLinter,[pFable,pOptions,pServiceHash]);_this23.serviceType='ExpressionParser-Linter';return _this23;}_inherits(ExpressionParserLinter,_libExpressionParserO2);return _createClass2(ExpressionParserLinter,[{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
1184
1194
|
if(!Array.isArray(pTokenizedExpression)){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.lintTokenizedExpression was passed a non-array tokenized expression.");tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}if(pTokenizedExpression.length<1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.lintTokenizedExpression was passed an empty tokenized expression.");tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}// 1. Check for balanced parenthesis
|
|
1185
1195
|
var tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
1186
1196
|
// State addresses are between squiggly brackets
|
|
@@ -1284,17 +1294,17 @@ tmpFinalChainToken=_tmpToken2;}else if(_tmpToken2.Descriptor.Precedence<tmpLastP
|
|
|
1284
1294
|
if(tmpDecreasingPrecedenceStack.length>0){for(var _j=tmpDecreasingPrecedenceStack.length-1;_j>=0;_j--){if(tmpDecreasingPrecedenceStack[_j].Descriptor.Precedence>=_tmpToken3.Descriptor.Precedence){//console.log(`Hoisting ${tmpDecreasingPrecedenceStack[j].Token} up to ${tmpToken.Token}`);
|
|
1285
1295
|
tmpDecreasingPrecedenceStack[_j].LeftVirtualSymbolName=_tmpToken3.VirtualSymbolName;tmpDecreasingPrecedenceStack.slice(_j,1);break;}}}tmpLastToken=_tmpToken3;}else if(_tmpToken3.Descriptor.Precedence<tmpLastPrecedence){tmpDecreasingPrecedenceStack.push(tmpLastToken);tmpLastToken=_tmpToken3;}tmpLastPrecedence=_tmpToken3.Descriptor.Precedence;}}}// 5.3: Generate the Postfix Solve List
|
|
1286
1296
|
for(var _tmpSolveLayerIndex3=0;_tmpSolveLayerIndex3<tmpSolveLayerKeys.length;_tmpSolveLayerIndex3++){var _tmpSolveLayerTokens3=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex3]];// If this is a layer with one value, presume it's an assignment.
|
|
1287
|
-
if(_tmpSolveLayerTokens3.length===1){var
|
|
1288
|
-
if(!
|
|
1297
|
+
if(_tmpSolveLayerTokens3.length===1){var tmpAbstractAssignToken=this.getTokenContainerObject('=');tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixLayerstackMap[_tmpSolveLayerTokens3[0].SolveLayerStack];// If this doesn't have a matching solvelayerstack, get the virtual symbol name from the parenthesis group it's in
|
|
1298
|
+
if(!tmpAbstractAssignToken.VirtualSymbolName){for(var _i15=0;_i15<tmpResults.PostfixTokenObjects.length;_i15++){if(tmpResults.PostfixTokenObjects[_i15].ParenthesisStack===_tmpSolveLayerTokens3[0].SolveLayerStack){tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixTokenObjects[_i15].VirtualSymbolName;break;}}}tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpAbstractAssignToken,_tmpSolveLayerTokens3[0],this.getTokenContainerObject('0.0')));continue;}// For each precedence level in the layer
|
|
1289
1299
|
for(var _tmpPrecedence=0;_tmpPrecedence<=this.ExpressionParser.tokenMaxPrecedence;_tmpPrecedence++){// Enumerate all tokens in a layer's expression.
|
|
1290
1300
|
// There is a recursive way to do this, but given the short length of even the most complex equations we're favoring readability.
|
|
1291
1301
|
for(var _i16=0;_i16<_tmpSolveLayerTokens3.length;_i16++){// If the token is an operator and at the current precedence, add it to the postfix solve list and mutate the array.
|
|
1292
1302
|
if(_tmpSolveLayerTokens3[_i16].Type==='Token.Operator'&&_tmpSolveLayerTokens3[_i16].Descriptor.Precedence===_tmpPrecedence){var _tmpToken4=_tmpSolveLayerTokens3[_i16];// The - at the beginning of an expression is a number line orientation modifier
|
|
1293
1303
|
if(_i16==0&&_tmpToken4.Token=='-'){// The number line negation operator is a special case that generates a virtual constant (-1.0) and multiplies it by the next token
|
|
1294
1304
|
// This is an abstract operation that isn't in the expression.
|
|
1295
|
-
var
|
|
1305
|
+
var tmpAbstractMultiplyToken=this.getTokenContainerObject('*');tmpAbstractMultiplyToken.VirtualSymbolName=_tmpToken4.VirtualSymbolName;tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpAbstractMultiplyToken,this.getTokenContainerObject('-1.0'),_tmpSolveLayerTokens3[_i16+1]));}// The - after an operator or an open parenthesis is also a number line orientation modifier
|
|
1296
1306
|
else if(_i16>0&&_tmpToken4.Token=='-'&&(_tmpSolveLayerTokens3[_i16-1].Type==='Token.Operator'||_tmpSolveLayerTokens3[_i16-1].Token==='(')){// The number line negation operator is a special case that generates a virtual constant (-1.0) and multiplies it by the next token
|
|
1297
|
-
var
|
|
1307
|
+
var _tmpAbstractMultiplyToken=this.getTokenContainerObject('*');_tmpAbstractMultiplyToken.VirtualSymbolName=_tmpToken4.VirtualSymbolName;tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpAbstractMultiplyToken,this.getTokenContainerObject('-1.0'),_tmpSolveLayerTokens3[_i16+1]));}// The + at the beginning is also a number line orientation modifier ... THAT WE IGNORE
|
|
1298
1308
|
else if(_i16==0&&_tmpToken4.Token=='+'){continue;}// The + after an operator or a parenthesis is also a number line orientation modifier ... THAT WE IGNORE
|
|
1299
1309
|
else if(_i16>0&&_tmpToken4.Token=='+'&&(_tmpSolveLayerTokens3[_i16-1].Type==='Token.Operator'||_tmpSolveLayerTokens3[_i16-1].Token==='(')){continue;}// Finally add the dang thing.
|
|
1300
1310
|
else{tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken4,_tmpSolveLayerTokens3[_i16-1],_tmpSolveLayerTokens3[_i16+1],_tmpSolveLayerTokens3,_i16));}}else if(_tmpSolveLayerTokens3[_i16].Type==='Token.Function'&&_tmpPrecedence===0){var _tmpToken5=_tmpSolveLayerTokens3[_i16];tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken5,_tmpSolveLayerTokens3[_i16+1],this.getTokenContainerObject('0.0')));}}}}// 7. Lastly set the assignment address.
|
|
@@ -1305,10 +1315,10 @@ if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.VirtualSymbol'){tm
|
|
|
1305
1315
|
if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.VirtualSymbolName);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.VirtualSymbolName);}// Virtual Constants
|
|
1306
1316
|
if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Constant'&&!('Value'in tmpStepResultObject.ExpressionStep.LeftValue)){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpStepResultObject.ExpressionStep.LeftValue.Token;}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.Constant'&&!('Value'in tmpStepResultObject.ExpressionStep.RightValue)){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpStepResultObject.ExpressionStep.RightValue.Token;}if(tmpStepResultObject.ExpressionStep.Operation.Type='Operator'){// TODO: This can be optimized. A lot. If necessary. Seems pretty fast honestly for even thousands of operations. Slowest part is arbitrary precision.
|
|
1307
1317
|
// An operator always has a left and right value.
|
|
1308
|
-
var tmpFunctionAddress=false;if(tmpStepResultObject.ExpressionStep.Operation.Token in this.ExpressionParser.tokenMap){tmpFunctionAddress="ResultsObject.".concat(tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function);}else if(tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()in this.ExpressionParser.functionMap){tmpFunctionAddress="ResultsObject.".concat(this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address);}try{this.log.trace("Solving Step ".concat(i," [").concat(tmpStepResultObject.ExpressionStep.VirtualSymbolName,"] --> [").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"]: ( ").concat(tmpStepResultObject.ExpressionStep.LeftValue.Value," , ").concat(tmpStepResultObject.ExpressionStep.RightValue.Value," )"));tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]=tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)"));this.log.trace(" ---> Step ".concat(i,": ").concat(tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]));}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"
|
|
1318
|
+
var tmpFunctionAddress=false;if(tmpStepResultObject.ExpressionStep.Operation.Token in this.ExpressionParser.tokenMap){tmpFunctionAddress="ResultsObject.".concat(tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function);}else if(tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()in this.ExpressionParser.functionMap){tmpFunctionAddress="ResultsObject.".concat(this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address);}try{this.log.trace("Solving Step ".concat(i," [").concat(tmpStepResultObject.ExpressionStep.VirtualSymbolName,"] --> [").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"]: ( ").concat(tmpStepResultObject.ExpressionStep.LeftValue.Value," , ").concat(tmpStepResultObject.ExpressionStep.RightValue.Value," )"));tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]=tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)"));this.log.trace(" ---> Step ".concat(i,": ").concat(tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]));}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,": ").concat(pError));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// Equations don't always solve in virtual symbol order.
|
|
1309
1319
|
tmpResults.SolverFinalVirtualSymbol=tmpStepResultObject.ExpressionStep.VirtualSymbolName;}}var tmpSolverResultValue=tmpManifest.getValueAtAddress(tmpResults,"VirtualSymbols.".concat(tmpResults.SolverFinalVirtualSymbol));// Now deal with final assignment
|
|
1310
1320
|
for(var _i17=0;_i17<pPostfixedExpression.length;_i17++){if(pPostfixedExpression[_i17].Operation.Type==='Token.SolverInstruction'&&pPostfixedExpression[_i17].Operation.Token=='Assign'){tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);}}// Clean up the reference if we added it to the object.
|
|
1311
|
-
if(!tmpPassedInFable){delete tmpResults.fable;}return tmpSolverResultValue.toString();}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":67}],73:[function(require,module,exports){module.exports={"=":{"Name":"Equals","Token":"=","Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":1,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],74:[function(require,module,exports){(function(process){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libFS=require('fs');var libPath=require('path');var libReadline=require('readline');var FableServiceFilePersistence=/*#__PURE__*/function(_libFableServiceBase5){function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this26;_classCallCheck2(this,FableServiceFilePersistence);_this26=_callSuper(this,FableServiceFilePersistence,[pFable,pOptions,pServiceHash]);_this26.serviceType='FilePersistence';if(!('Mode'in _this26.options)){_this26.options.Mode=parseInt('0777',8)&~process.umask();}_this26.libFS=libFS;_this26.libPath=libPath;_this26.libReadline=libReadline;return _this26;}_inherits(FableServiceFilePersistence,_libFableServiceBase5);return _createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){return libPath.resolve.apply(libPath,arguments);}},{key:"existsSync",value:function existsSync(pPath){return libFS.existsSync(pPath);}},{key:"exists",value:function exists(pPath,fCallback){var tmpFileExists=this.existsSync(pPath);;return fCallback(null,tmpFileExists);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{key:"deleteFileSync",value:function deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}},{key:"deleteFolderSync",value:function deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}},{key:"readFileSync",value:function readFileSync(pFilePath,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFileSync(pFilePath,tmpOptions);}},{key:"readFile",value:function readFile(pFilePath,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFile(pFilePath,tmpOptions,fCallback);}},{key:"writeFileSync",value:function writeFileSync(pFileName,pFileContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}},{key:"writeFileSyncFromObject",value:function writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}},{key:"writeFileSyncFromArray",value:function writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error("File Persistence Service attempted to write ".concat(pFileName," from array but the expected array was not an array (it was a ").concat(_typeof(pFileArray),")."));return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(var i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,"".concat(pFileArray[i],"\n"));}}}},{key:"writeFile",value:function writeFile(pFileName,pFileContent,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFile(pFileName,pFileContent,tmpOptions,fCallback);}},{key:"lineReaderFactory",value:function lineReaderFactory(pFilePath,fOnLine,fOnComplete,fOnError){var tmpLineReader={};if(typeof pFilePath!='string'){return false;}tmpLineReader.filePath=pFilePath;tmpLineReader.fileStream=libFS.createReadStream(tmpLineReader.filePath);tmpLineReader.reader=libReadline.createInterface({input:tmpLineReader.fileStream,crlfDelay:Infinity});if(typeof fOnError==='function'){tmpLineReader.reader.on('error',fOnError);}tmpLineReader.reader.on('line',typeof fOnLine==='function'?fOnLine:function(){});if(typeof fOnComplete==='function'){tmpLineReader.reader.on('close',fOnComplete);}return tmpLineReader;}// Folder management
|
|
1321
|
+
if(!tmpPassedInFable){delete tmpResults.fable;}return tmpSolverResultValue.toString();}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":67}],73:[function(require,module,exports){module.exports={"=":{"Name":"Equals","Token":"=","Function":"fable.Math.assignValue","Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":1,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],74:[function(require,module,exports){(function(process){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libFS=require('fs');var libPath=require('path');var libReadline=require('readline');var FableServiceFilePersistence=/*#__PURE__*/function(_libFableServiceBase5){function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this26;_classCallCheck2(this,FableServiceFilePersistence);_this26=_callSuper(this,FableServiceFilePersistence,[pFable,pOptions,pServiceHash]);_this26.serviceType='FilePersistence';if(!('Mode'in _this26.options)){_this26.options.Mode=parseInt('0777',8)&~process.umask();}_this26.libFS=libFS;_this26.libPath=libPath;_this26.libReadline=libReadline;return _this26;}_inherits(FableServiceFilePersistence,_libFableServiceBase5);return _createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){return libPath.resolve.apply(libPath,arguments);}},{key:"existsSync",value:function existsSync(pPath){return libFS.existsSync(pPath);}},{key:"exists",value:function exists(pPath,fCallback){var tmpFileExists=this.existsSync(pPath);;return fCallback(null,tmpFileExists);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{key:"deleteFileSync",value:function deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}},{key:"deleteFolderSync",value:function deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}},{key:"readFileSync",value:function readFileSync(pFilePath,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFileSync(pFilePath,tmpOptions);}},{key:"readFile",value:function readFile(pFilePath,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFile(pFilePath,tmpOptions,fCallback);}},{key:"writeFileSync",value:function writeFileSync(pFileName,pFileContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}},{key:"writeFileSyncFromObject",value:function writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}},{key:"writeFileSyncFromArray",value:function writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error("File Persistence Service attempted to write ".concat(pFileName," from array but the expected array was not an array (it was a ").concat(_typeof(pFileArray),")."));return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(var i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,"".concat(pFileArray[i],"\n"));}}}},{key:"writeFile",value:function writeFile(pFileName,pFileContent,pOptions,fCallback){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFile(pFileName,pFileContent,tmpOptions,fCallback);}},{key:"lineReaderFactory",value:function lineReaderFactory(pFilePath,fOnLine,fOnComplete,fOnError){var tmpLineReader={};if(typeof pFilePath!='string'){return false;}tmpLineReader.filePath=pFilePath;tmpLineReader.fileStream=libFS.createReadStream(tmpLineReader.filePath);tmpLineReader.reader=libReadline.createInterface({input:tmpLineReader.fileStream,crlfDelay:Infinity});if(typeof fOnError==='function'){tmpLineReader.reader.on('error',fOnError);}tmpLineReader.reader.on('line',typeof fOnLine==='function'?fOnLine:function(){});if(typeof fOnComplete==='function'){tmpLineReader.reader.on('close',fOnComplete);}return tmpLineReader;}// Folder management
|
|
1312
1322
|
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this27=this;var tmpParameters=pParameters;if(typeof pParameters=='string'){tmpParameters={Path:pParameters};}else if(_typeof(pParameters)!=='object'){fCallback(new Error('Parameters object or string not properly passed to recursive folder create.'));return false;}if(typeof tmpParameters.Path!=='string'){fCallback(new Error('Parameters object needs a path to run the folder create operation.'));return false;}if(!('Mode'in tmpParameters)){tmpParameters.Mode=this.options.Mode;}// Check if we are just starting .. if so, build the initial state for our recursive function
|
|
1313
1323
|
if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
|
|
1314
1324
|
tmpParameters.ActualPath=libPath.normalize(tmpParameters.Path);tmpParameters.ActualPathParts=tmpParameters.ActualPath.split(libPath.sep);tmpParameters.CurrentPathIndex=0;tmpParameters.CurrentPath='';}else{// This is not our first run, so we will continue the recursion.
|
|
@@ -1318,28 +1328,237 @@ tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
|
1318
1328
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
1319
1329
|
libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',function(pError,pFileDescriptor){if(pFileDescriptor){libFS.closeSync(pFileDescriptor);}if(pError&&pError.code=='ENOENT'){/* Path doesn't exist, create it */libFS.mkdir(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],tmpParameters.Mode,function(pCreateError){if(!pCreateError){// We have now created our folder and there was no error -- continue.
|
|
1320
1330
|
return _this27.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
1321
|
-
return _this27.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return _this27.makeFolderRecursive(tmpParameters,fCallback);}});}}]);}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":120,"fable-serviceproviderbase":52,"fs":19,"path":113,"readline":19}],75:[function(require,module,exports){
|
|
1331
|
+
return _this27.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return _this27.makeFolderRecursive(tmpParameters,fCallback);}});}}]);}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":120,"fable-serviceproviderbase":52,"fs":19,"path":113,"readline":19}],75:[function(require,module,exports){/**
|
|
1332
|
+
* @file Fable-Service-Math.js
|
|
1333
|
+
* @description This file contains the implementation of the FableServiceMath class, which provides simple functions for performing arbitrary precision math operations.
|
|
1334
|
+
* @module FableServiceMath
|
|
1335
|
+
* @extends libFableServiceBase
|
|
1336
|
+
*/var libFableServiceBase=require('fable-serviceproviderbase');/**
|
|
1322
1337
|
* Arbitrary Precision Math Operations
|
|
1323
1338
|
* @author Steven Velozo <steven@velozo.com>
|
|
1324
1339
|
* @description Simple functions that perform arbitrary precision math operations and return string resultant values. Wraps big.js
|
|
1325
1340
|
* @class FableServiceMath
|
|
1326
1341
|
* @extends libFableServiceBase
|
|
1327
|
-
*/var FableServiceMath=/*#__PURE__*/function(_libFableServiceBase6){function FableServiceMath(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,FableServiceMath);_this28=_callSuper(this,FableServiceMath,[pFable,pOptions,pServiceHash]);_this28.serviceType='Math';return _this28;}/*
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
*/_inherits(FableServiceMath,_libFableServiceBase6);return _createClass2(FableServiceMath,[{key:"roundDown",get:function get(){return this.fable.Utility.bigNumber.roundDown;}},{key:"roundHalfUp",get:function get(){return this.fable.Utility.bigNumber.roundHalfUp;}},{key:"roundHalfEven",get:function get(){return this.fable.Utility.bigNumber.roundHalfEven;}},{key:"roundUp",get:function get(){return this.fable.Utility.bigNumber.roundUp;}
|
|
1337
|
-
|
|
1338
|
-
|
|
1342
|
+
*/var FableServiceMath=/*#__PURE__*/function(_libFableServiceBase6){function FableServiceMath(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,FableServiceMath);_this28=_callSuper(this,FableServiceMath,[pFable,pOptions,pServiceHash]);_this28.serviceType='Math';_this28.pi='3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679';return _this28;}/*
|
|
1343
|
+
Pass-through Rounding Method Constants
|
|
1344
|
+
|
|
1345
|
+
Property Value BigDecimal Equiv Description
|
|
1346
|
+
---------- ----- ---------------- -----------
|
|
1347
|
+
roundDown 0 ROUND_DOWN Rounds towards zero. (_I.e. truncate, no rounding._)
|
|
1348
|
+
roundHalfUp 1 ROUND_HALF_UP Rounds towards nearest neighbour. (_If equidistant, rounds away from zero._)
|
|
1349
|
+
roundHalfEven 2 ROUND_HALF_EVEN Rounds towards nearest neighbour. (_If equidistant, rounds towards even neighbour._)
|
|
1350
|
+
roundUp 3 ROUND_UP Rounds positively away from zero. (_Always round up._)
|
|
1351
|
+
*/_inherits(FableServiceMath,_libFableServiceBase6);return _createClass2(FableServiceMath,[{key:"roundDown",get:function get(){return this.fable.Utility.bigNumber.roundDown;}},{key:"roundHalfUp",get:function get(){return this.fable.Utility.bigNumber.roundHalfUp;}},{key:"roundHalfEven",get:function get(){return this.fable.Utility.bigNumber.roundHalfEven;}},{key:"roundUp",get:function get(){return this.fable.Utility.bigNumber.roundUp;}/**
|
|
1352
|
+
* Parses a precise number value.
|
|
1353
|
+
*
|
|
1354
|
+
* @param {number} pValue - The value to parse.
|
|
1355
|
+
* @param {any} pNonNumberValue - The value to use if parsing fails.
|
|
1356
|
+
* @returns {string} - The parsed number as a string.
|
|
1357
|
+
*/},{key:"parsePrecise",value:function parsePrecise(pValue,pNonNumberValue){var tmpNumber;try{tmpNumber=new this.fable.Utility.bigNumber(pValue);}catch(pError){this.log.warn("Error parsing number (type ".concat(_typeof(pValue),"): ").concat(pError));tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmpNumber.toString();}/**
|
|
1358
|
+
* Assigns the given value. For equals operations in the solver.
|
|
1359
|
+
* @param {*} pValue - The value to be assigned.
|
|
1360
|
+
* @returns {*} The assigned value.
|
|
1361
|
+
*/},{key:"assignValue",value:function assignValue(pValue){return pValue;}/**
|
|
1362
|
+
* Calculates the precise percentage of a given value compared to another value.
|
|
1363
|
+
*
|
|
1364
|
+
* @param {number} pIs - The value to calculate the percentage of.
|
|
1365
|
+
* @param {number} pOf - The value to calculate the percentage against.
|
|
1366
|
+
* @returns {string} The precise percentage as a string.
|
|
1367
|
+
*/},{key:"percentagePrecise",value:function percentagePrecise(pIs,pOf){var tmpLeftValue=isNaN(pIs)?0:pIs;var tmpRightValue=isNaN(pOf)?0:pOf;if(tmpRightValue==0){return'0';}var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.div(tmpRightValue);tmpResult=tmpResult.times(100);return tmpResult.toString();}/**
|
|
1368
|
+
* Rounds a value to a specified number of decimal places using a specified rounding method.
|
|
1369
|
+
*
|
|
1370
|
+
* @param {number} pValue - The value to be rounded.
|
|
1371
|
+
* @param {number} pDecimals - The number of decimal places to round to.
|
|
1372
|
+
* @param {function} [pRoundingMethod] - The rounding method to use. Defaults to `this.roundHalfUp`.
|
|
1373
|
+
* @returns {string} - The rounded value as a string.
|
|
1374
|
+
*/},{key:"roundPrecise",value:function roundPrecise(pValue,pDecimals,pRoundingMethod){var tmpValue=isNaN(pValue)?0:pValue;var tmpDecimals=isNaN(pDecimals)?0:pDecimals;var tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:pRoundingMethod;var tmpArbitraryValue=new this.fable.Utility.bigNumber(tmpValue);var tmpResult=tmpArbitraryValue.round(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
1375
|
+
* Returns a string representation of a number with a specified number of decimals.
|
|
1376
|
+
*
|
|
1377
|
+
* @param {number} pValue - The number to be formatted.
|
|
1378
|
+
* @param {number} pDecimals - The number of decimals to include in the formatted string.
|
|
1379
|
+
* @param {string} [pRoundingMethod] - The rounding method to use. Defaults to 'roundHalfUp'.
|
|
1380
|
+
* @returns {string} - The formatted number as a string.
|
|
1381
|
+
*/},{key:"toFixedPrecise",value:function toFixedPrecise(pValue,pDecimals,pRoundingMethod){var tmpValue=isNaN(pValue)?0:pValue;var tmpDecimals=isNaN(pDecimals)?0:pDecimals;var tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:pRoundingMethod;var tmpArbitraryValue=new this.fable.Utility.bigNumber(tmpValue);var tmpResult=tmpArbitraryValue.toFixed(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
1382
|
+
* Adds two values precisely.
|
|
1383
|
+
* @param {number} pLeftValue - The left value to be added.
|
|
1384
|
+
* @param {number} pRightValue - The right value to be added.
|
|
1385
|
+
* @returns {string} - The result of adding the two values as a string.
|
|
1386
|
+
*/},{key:"addPrecise",value:function addPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.plus(tmpRightValue);return tmpResult.toString();}/**
|
|
1387
|
+
* Subtracts two values precisely.
|
|
1388
|
+
*
|
|
1389
|
+
* @param {number} pLeftValue - The left value to subtract.
|
|
1390
|
+
* @param {number} pRightValue - The right value to subtract.
|
|
1391
|
+
* @returns {string} The result of the subtraction as a string.
|
|
1392
|
+
*/},{key:"subtractPrecise",value:function subtractPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.minus(tmpRightValue);return tmpResult.toString();}/**
|
|
1393
|
+
* Calculates the precise power of two numbers.
|
|
1394
|
+
*
|
|
1395
|
+
* @param {number} pLeftValue - The base value.
|
|
1396
|
+
* @param {number} pRightValue - The exponent value.
|
|
1397
|
+
* @returns {string} The result of raising the base value to the exponent value.
|
|
1398
|
+
*/},{key:"powerPrecise",value:function powerPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:parseInt(pRightValue);var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.pow(tmpRightValue);return tmpResult.toString();}/**
|
|
1399
|
+
* Multiplies two values precisely.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {number} pLeftValue - The left value to multiply.
|
|
1402
|
+
* @param {number} pRightValue - The right value to multiply.
|
|
1403
|
+
* @returns {string} The result of the multiplication as a string.
|
|
1404
|
+
*/},{key:"multiplyPrecise",value:function multiplyPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.times(tmpRightValue);return tmpResult.toString();}/**
|
|
1405
|
+
* Divides two values precisely.
|
|
1406
|
+
*
|
|
1407
|
+
* @param {number} pLeftValue - The left value to be divided.
|
|
1408
|
+
* @param {number} pRightValue - The right value to divide by.
|
|
1409
|
+
* @returns {string} The result of the division as a string.
|
|
1410
|
+
*/},{key:"dividePrecise",value:function dividePrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.div(tmpRightValue);return tmpResult.toString();}/**
|
|
1411
|
+
* Calculates the modulus of two values with precision.
|
|
1412
|
+
*
|
|
1413
|
+
* @param {number} pLeftValue - The left value.
|
|
1414
|
+
* @param {number} pRightValue - The right value.
|
|
1415
|
+
* @returns {string} The result of the modulus operation as a string.
|
|
1416
|
+
*/},{key:"modPrecise",value:function modPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.mod(tmpRightValue);return tmpResult.toString();}/**
|
|
1417
|
+
* Calculates the square root of a number with precise decimal places.
|
|
1418
|
+
*
|
|
1419
|
+
* @param {number} pValue - The number to calculate the square root of.
|
|
1420
|
+
* @returns {string} The square root of the input number as a string.
|
|
1421
|
+
*/},{key:"sqrtPrecise",value:function sqrtPrecise(pValue){var tmpValue=isNaN(pValue)?0:pValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpValue);var tmpResult=tmpLeftArbitraryValue.sqrt();return tmpResult.toString();}/**
|
|
1422
|
+
* Calculates the absolute value of a number precisely.
|
|
1423
|
+
*
|
|
1424
|
+
* @param {number} pValue - The number to calculate the absolute value of.
|
|
1425
|
+
* @returns {string} The absolute value of the input number as a string.
|
|
1426
|
+
*/},{key:"absPrecise",value:function absPrecise(pValue){var tmpValue=isNaN(pValue)?0:pValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpValue);var tmpResult=tmpLeftArbitraryValue.abs();return tmpResult.toString();}/**
|
|
1427
|
+
* Compares two values precisely.
|
|
1428
|
+
*
|
|
1429
|
+
* @param {number} pLeftValue - The left value to compare.
|
|
1430
|
+
* @param {number} pRightValue - The right value to compare.
|
|
1431
|
+
* @returns {number} - Returns the result of the comparison.
|
|
1432
|
+
*/},{key:"comparePrecise",value:function comparePrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.cmp(tmpRightValue);}/**
|
|
1433
|
+
* Determines if the left value is greater than the right value precisely.
|
|
1434
|
+
*
|
|
1435
|
+
* @param {number} pLeftValue - The left value to compare.
|
|
1436
|
+
* @param {number} pRightValue - The right value to compare.
|
|
1437
|
+
* @returns {boolean} - Returns true if the left value is greater than the right value, otherwise returns false.
|
|
1438
|
+
*/},{key:"gtPrecise",value:function gtPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.gt(tmpRightValue);}/**
|
|
1439
|
+
* Checks if the left value is greater than or equal to the right value.
|
|
1440
|
+
* If either value is not a number, it is treated as 0.
|
|
1441
|
+
*
|
|
1442
|
+
* @param {number} pLeftValue - The left value to compare.
|
|
1443
|
+
* @param {number} pRightValue - The right value to compare.
|
|
1444
|
+
* @returns {boolean} - True if the left value is greater than or equal to the right value, false otherwise.
|
|
1445
|
+
*/},{key:"gtePrecise",value:function gtePrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.gte(tmpRightValue);}/**
|
|
1446
|
+
* Determines if the left value is less than the right value precisely.
|
|
1447
|
+
*
|
|
1448
|
+
* @param {number} pLeftValue - The left value to compare.
|
|
1449
|
+
* @param {number} pRightValue - The right value to compare.
|
|
1450
|
+
* @returns {boolean} - Returns true if the left value is less than the right value, otherwise returns false.
|
|
1451
|
+
*/},{key:"ltPrecise",value:function ltPrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.lt(tmpRightValue);}/**
|
|
1452
|
+
* Determines if the left value is less than or equal to the right value.
|
|
1453
|
+
*
|
|
1454
|
+
* @param {number} pLeftValue - The left value to compare.
|
|
1455
|
+
* @param {number} pRightValue - The right value to compare.
|
|
1456
|
+
* @returns {boolean} - Returns true if the left value is less than or equal to the right value, otherwise returns false.
|
|
1457
|
+
*/},{key:"ltePrecise",value:function ltePrecise(pLeftValue,pRightValue){var tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;var tmpRightValue=isNaN(pRightValue)?0:pRightValue;var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.lt(tmpRightValue);}/**
|
|
1458
|
+
* Converts degrees to radians with arbitrary precision.
|
|
1459
|
+
*
|
|
1460
|
+
* @param {number} pDegrees - The degrees to convert to radians.
|
|
1461
|
+
* @returns {string} - The converted radians as a string.
|
|
1462
|
+
*/},{key:"radPrecise",value:function radPrecise(pDegrees){var tmpDegrees=isNaN(pDegrees)?0:pDegrees;var tmpDegreesArbitraryValue=new this.fable.Utility.bigNumber(tmpDegrees);// TODO: Const for pi in arbitrary precision?
|
|
1463
|
+
var tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.toString();}/**
|
|
1464
|
+
* Calculates the value of pi with the specified precision.
|
|
1465
|
+
* If no precision is provided, returns 100 digits after the decimal.
|
|
1466
|
+
*
|
|
1467
|
+
* @param {number} [pPrecision] - The precision to use for calculating pi.
|
|
1468
|
+
* @returns {number} - The calculated value of pi.
|
|
1469
|
+
*/},{key:"piPrecise",value:function piPrecise(pPrecision){if(typeof pPrecision==='undefined'){return this.pi;}else{return this.roundPrecise(this.pi,pPrecision);}}/**
|
|
1470
|
+
* Calculates the sine of the given angle in radians.
|
|
1471
|
+
*
|
|
1472
|
+
* @param {number} pRadians - The angle in radians.
|
|
1473
|
+
* @returns {number} The sine of the angle.
|
|
1474
|
+
*/},{key:"sin",value:function sin(pRadians){var tmpRadians=isNaN(pRadians)?0:pRadians;return Math.sin(tmpRadians);}/**
|
|
1475
|
+
* Calculates the cosine of the given angle in radians.
|
|
1476
|
+
*
|
|
1477
|
+
* @param {number} pRadians - The angle in radians.
|
|
1478
|
+
* @returns {number} The cosine of the angle.
|
|
1479
|
+
*/},{key:"cos",value:function cos(pRadians){var tmpRadians=isNaN(pRadians)?0:pRadians;return Math.cos(tmpRadians);}/**
|
|
1480
|
+
* Calculates the tangent of an angle in radians.
|
|
1481
|
+
*
|
|
1482
|
+
* @param {number} pRadians - The angle in radians.
|
|
1483
|
+
* @returns {number} The tangent of the angle.
|
|
1484
|
+
*/},{key:"tan",value:function tan(pRadians){var tmpRadians=isNaN(pRadians)?0:pRadians;return Math.tan(tmpRadians);}/* * * * * * * * * * * * * * * *
|
|
1485
|
+
* Set functions
|
|
1486
|
+
* These are meant to work fine with arrays and more complex set descriptions returned by Manyfest.
|
|
1487
|
+
* Manyfest sometimes returns values as arrays and sometimes as a map of addresses with values depending
|
|
1488
|
+
* on what was requested.
|
|
1489
|
+
*
|
|
1490
|
+
* The following functions will likely be broken into their own service.
|
|
1491
|
+
*/ /**
|
|
1492
|
+
* Counts the number of elements in a set.
|
|
1493
|
+
*
|
|
1494
|
+
* @param {Array|Object|any} pValueSet - The set to count the elements of.
|
|
1495
|
+
* @returns {number} The number of elements in the set.
|
|
1496
|
+
*/},{key:"countSetElements",value:function countSetElements(pValueSet){if(Array.isArray(pValueSet)){return pValueSet.length;}else if(_typeof(pValueSet)==='object'){return Object.keys(pValueSet).length;}else if(pValueSet){// This is controversial. Discuss with colleagues!
|
|
1497
|
+
return 1;}return 0;}/**
|
|
1498
|
+
* Sorts the elements in the given value set in ascending order using the precise parsing and comparison.
|
|
1499
|
+
*
|
|
1500
|
+
* @param {Array|Object} pValueSet - The value set to be sorted.
|
|
1501
|
+
* @returns {Array} - The sorted value set.
|
|
1502
|
+
*/},{key:"sortSetPrecise",value:function sortSetPrecise(pValueSet){var _this29=this;var tmpSortedSet=[];if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){tmpSortedSet.push(this.parsePrecise(pValueSet[i],NaN));}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i18=0;_i18<tmpKeys.length;_i18++){tmpSortedSet.push(this.parsePrecise(pValueSet[tmpKeys[_i18]],NaN));}}tmpSortedSet.sort(function(pLeft,pRight){return _this29.comparePrecise(pLeft,pRight);});return tmpSortedSet;}/**
|
|
1503
|
+
* Bucketizes a set of values based on a specified bucket size.
|
|
1504
|
+
*
|
|
1505
|
+
* @param {Array|Object} pValueSet - The set of values to be bucketized.
|
|
1506
|
+
* @param {number} pBucketSize - The size of each bucket. Optional - If NaN, the values will be bucketized by their value.
|
|
1507
|
+
* @returns {Object} - The bucketized set of values.
|
|
1508
|
+
*/},{key:"bucketSetPrecise",value:function bucketSetPrecise(pValueSet,pBucketSize){var tmpBucketedSet={};var tmpBucketSize=this.parsePrecise(pBucketSize,NaN);if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){var tmpValue=this.parsePrecise(pValueSet[i],NaN);var tmpBucket=tmpValue.toString();if(!isNaN(tmpBucketSize)){tmpBucket=this.dividePrecise(pValueSet[i],tmpBucketSize);}if(!(tmpBucket in tmpBucketedSet)){tmpBucketedSet[tmpBucket]=0;}tmpBucketedSet[tmpBucket]=tmpBucketedSet[tmpBucket]+1;}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i19=0;_i19<tmpKeys.length;_i19++){var _tmpValue2=this.parsePrecise(pValueSet[tmpKeys[_i19]],NaN);var _tmpBucket=_tmpValue2.toString();if(!isNaN(tmpBucketSize)){_tmpBucket=this.dividePrecise(pValueSet[_i19],tmpBucketSize);}if(!(_tmpBucket in tmpBucketedSet)){tmpBucketedSet[_tmpBucket]=0;}tmpBucketedSet[_tmpBucket]=tmpBucketedSet[_tmpBucket]+1;}}return tmpBucketedSet;}/**
|
|
1509
|
+
* Calculates the histogram using precise bucket set for the given pValueSet.
|
|
1510
|
+
*
|
|
1511
|
+
* @param {Array<number>} pValueSet - The array of p-values.
|
|
1512
|
+
* @returns {Array<number>} The histogram of the p-values.
|
|
1513
|
+
*/},{key:"histogramPrecise",value:function histogramPrecise(pValueSet){return this.bucketSetPrecise(pValueSet);}/**
|
|
1514
|
+
* Sorts the histogram object in ascending order based on the frequencies of the buckets.
|
|
1515
|
+
*
|
|
1516
|
+
* @param {Object} pHistogram - The histogram object to be sorted.
|
|
1517
|
+
* @returns {Object} - The sorted histogram object.
|
|
1518
|
+
*/},{key:"sortHistogramPrecise",value:function sortHistogramPrecise(pHistogram){var tmpSortedHistogram={};var tmpKeys=Object.keys(pHistogram);tmpKeys.sort(function(pLeft,pRight){return pHistogram[pLeft]-pHistogram[pRight];});for(var i=0;i<tmpKeys.length;i++){tmpSortedHistogram[tmpKeys[i]]=pHistogram[tmpKeys[i]];}return tmpSortedHistogram;}/**
|
|
1519
|
+
* Finds the maximum value from a set of precise values.
|
|
1520
|
+
*
|
|
1521
|
+
* @param {Array|Object} pValueSet - The set of values to find the maximum from.
|
|
1522
|
+
* @returns {number} - The maximum value from the set.
|
|
1523
|
+
*/},{key:"maxPrecise",value:function maxPrecise(pValueSet){var tmpMaxValue=NaN;if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[i],NaN);}else{var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(this.gtPrecise(tmpComparisonValue,tmpMaxValue)){tmpMaxValue=tmpComparisonValue;}}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i20=0;_i20<tmpKeys.length;_i20++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[tmpKeys[_i20]],NaN);}else{var _tmpComparisonValue=this.parsePrecise(pValueSet[tmpKeys[_i20]],NaN);if(this.gtPrecise(_tmpComparisonValue,tmpMaxValue)){tmpMaxValue=_tmpComparisonValue;}}}}return tmpMaxValue;}/**
|
|
1524
|
+
* Finds the minimum value from a set of values.
|
|
1525
|
+
*
|
|
1526
|
+
* @param {Array|Object} pValueSet - The set of values to find the minimum from.
|
|
1527
|
+
* @returns {number} The minimum value from the set.
|
|
1528
|
+
*/},{key:"minPrecise",value:function minPrecise(pValueSet){var tmpMinValue=NaN;if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[i],NaN);}else{var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)&&this.ltPrecise(tmpComparisonValue,tmpMinValue)){tmpMinValue=tmpComparisonValue;}}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i21=0;_i21<tmpKeys.length;_i21++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[tmpKeys[_i21]],NaN);}else{var _tmpComparisonValue2=this.parsePrecise(pValueSet[tmpKeys[_i21]],NaN);if(!isNaN(_tmpComparisonValue2)&&this.ltPrecise(_tmpComparisonValue2,tmpMinValue)){tmpMinValue=_tmpComparisonValue2;}}}}return tmpMinValue;}/**
|
|
1529
|
+
* Calculates the precise sum of values in the given value set.
|
|
1530
|
+
*
|
|
1531
|
+
* @param {Array|Object} pValueSet - The value set to calculate the sum from.
|
|
1532
|
+
* @returns {string} The precise sum value as a string.
|
|
1533
|
+
*/},{key:"sumPrecise",value:function sumPrecise(pValueSet){var tmpSumValue="0.0";if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)){tmpSumValue=this.addPrecise(tmpSumValue,tmpComparisonValue);}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i22=0;_i22<tmpKeys.length;_i22++){var _tmpComparisonValue3=this.parsePrecise(pValueSet[tmpKeys[_i22]],NaN);if(!isNaN(_tmpComparisonValue3)){tmpSumValue=this.addPrecise(tmpSumValue,_tmpComparisonValue3);}}}return tmpSumValue;}/**
|
|
1534
|
+
* Calculates the precise mean of a given value set.
|
|
1535
|
+
*
|
|
1536
|
+
* @param {Array<number>} pValueSet - The array of values to calculate the mean.
|
|
1537
|
+
* @returns {string} The precise mean value as a string.
|
|
1538
|
+
*/},{key:"meanPrecise",value:function meanPrecise(pValueSet){var tmpSumValue=this.sumPrecise(pValueSet);var tmpCount=this.countSetElements(pValueSet);if(tmpCount==0){return'0.0';}return this.dividePrecise(tmpSumValue,tmpCount);}/**
|
|
1539
|
+
* Calculates the average of an array of values precisely.
|
|
1540
|
+
*
|
|
1541
|
+
* @param {Array<number>} pValueSet - The array of values to calculate the average of.
|
|
1542
|
+
* @returns {number} The precise average of the values.
|
|
1543
|
+
*/},{key:"averagePrecise",value:function averagePrecise(pValueSet){return this.meanPrecise(pValueSet);}/**
|
|
1544
|
+
* Calculates the precise median value of a given value set.
|
|
1545
|
+
*
|
|
1546
|
+
* @param {Array<number>} pValueSet - The array of values to calculate the median from.
|
|
1547
|
+
* @returns {number|string} - The median value of the given value set. If the value set is empty, returns '0.0'.
|
|
1548
|
+
*/},{key:"medianPrecise",value:function medianPrecise(pValueSet){var tmpCount=this.countSetElements(pValueSet);// If there are no elements, return 0 ... should this be NaN?
|
|
1549
|
+
if(tmpCount==0){return'0.0';}var tmpSortedValueSet=this.sortSetPrecise(pValueSet);var tmpMiddleElement=Math.floor(tmpCount/2);// If the count is odd, return the middle element
|
|
1550
|
+
if(tmpCount%2==1){return tmpSortedValueSet[tmpMiddleElement];}// If the count is even, return the average of the two middle elements
|
|
1551
|
+
else{var tmpLeftMiddleValue=tmpSortedValueSet[tmpMiddleElement-1];var tmpRightMiddleValue=tmpSortedValueSet[tmpMiddleElement];return this.dividePrecise(this.addPrecise(tmpLeftMiddleValue,tmpRightMiddleValue),2);}}/**
|
|
1552
|
+
* Calculates the mode (most frequently occurring value) of a given value set using precise mode calculation.
|
|
1553
|
+
*
|
|
1554
|
+
* @param {Array} pValueSet - The array of values to calculate the mode from.
|
|
1555
|
+
* @returns {Array} - An array containing the mode value(s) from the given value set.
|
|
1556
|
+
*/},{key:"modePrecise",value:function modePrecise(pValueSet){var tmpHistogram=this.bucketSetPrecise(pValueSet);var tmpMaxCount=0;// Philosophical question about whether the values should be returned sorted.
|
|
1557
|
+
var tmpHistogramValueSet=Object.keys(tmpHistogram);var tmpModeValueSet=[];for(var i=0;i<tmpHistogramValueSet.length;i++){if(tmpHistogram[tmpHistogramValueSet[i]]>tmpMaxCount){tmpMaxCount=tmpHistogram[tmpHistogramValueSet[i]];tmpModeValueSet=[tmpHistogramValueSet[i]];}else if(tmpHistogram[tmpHistogramValueSet[i]]==tmpMaxCount){tmpModeValueSet.push(tmpHistogramValueSet[i]);}}return tmpModeValueSet;}}]);}(libFableServiceBase);module.exports=FableServiceMath;},{"fable-serviceproviderbase":52}],76:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');/**
|
|
1339
1558
|
* Precedent Meta-Templating
|
|
1340
1559
|
* @author Steven Velozo <steven@velozo.com>
|
|
1341
1560
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
1342
|
-
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase7){function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var
|
|
1561
|
+
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase7){function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this30;_classCallCheck2(this,FableServiceMetaTemplate);_this30=_callSuper(this,FableServiceMetaTemplate,[pFable,pOptions,pServiceHash]);_this30.serviceType='MetaTemplate';_this30.WordTree=new libWordTree();_this30.StringParser=new libStringParser(_this30.fable);_this30.ParseTree=_this30.WordTree.ParseTree;return _this30;}_inherits(FableServiceMetaTemplate,_libFableServiceBase7);return _createClass2(FableServiceMetaTemplate,[{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,pParser,pParserContext){return this.WordTree.addPattern(pPatternStart,pPatternEnd,pParser,pParserContext);}},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise,pParserContext){return this.WordTree.addPatternBoth(pPatternStart,pPatternEnd,pParser,pParserPromise,pParserContext);}/**
|
|
1343
1562
|
* Parse a string with the existing parse tree
|
|
1344
1563
|
* @method parseString
|
|
1345
1564
|
* @param {string} pString - The string to parse
|
|
@@ -1394,10 +1613,10 @@ var _tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Patt
|
|
|
1394
1613
|
this.resetOutputBuffer(pParserState);}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
1395
1614
|
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
1396
1615
|
if(pCharacter in pParserState.ParseTree){// ... assign the root node as the matched node.
|
|
1397
|
-
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}},{key:"executePatternAsync",value:function executePatternAsync(pParserState,pData,fCallback,pDataContext){var
|
|
1616
|
+
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}},{key:"executePatternAsync",value:function executePatternAsync(pParserState,pData,fCallback,pDataContext){var _this31=this;// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
1398
1617
|
// Trim the start and end tags off the output buffer now
|
|
1399
1618
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
1400
|
-
var tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(tmpFunctionContext){return pParserState.Pattern.ParseAsync.call(tmpFunctionContext,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){
|
|
1619
|
+
var tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(tmpFunctionContext){return pParserState.Pattern.ParseAsync.call(tmpFunctionContext,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this31.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this31.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else{return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this31.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this31.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}}else{// Run the t*mplate function
|
|
1401
1620
|
var _tmpFunctionContext2='ParserContext'in pParserState.Pattern?pParserState.Pattern.ParserContext:false;if(_tmpFunctionContext2){pParserState.OutputBuffer=pParserState.Pattern.Parse.call(_tmpFunctionContext2,pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}else{pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);}this.resetOutputBuffer(pParserState);return fCallback();}}/**
|
|
1402
1621
|
* Parse a character in the buffer.
|
|
1403
1622
|
* @method parseCharacterAsync
|
|
@@ -1430,11 +1649,11 @@ return fCallback();}/**
|
|
|
1430
1649
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
1431
1650
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
1432
1651
|
* @param {array} pDataContext - The history of data objects/context already passed in
|
|
1433
|
-
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback,pDataContext){var
|
|
1652
|
+
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback,pDataContext){var _this32=this;// TODO: There is danger here if a template function attempts to functionally recurse and doesn't pass this in.
|
|
1434
1653
|
var tmpPreviousDataContext=Array.isArray(pDataContext)?pDataContext:[];var tmpDataContext=Array.from(tmpPreviousDataContext);tmpDataContext.push(pData);if(typeof fCallback!=='function'){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
|
|
1435
1654
|
this.parseCharacter(pString[i],tmpParserState,pData,tmpDataContext);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
1436
|
-
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var _loop=function _loop(
|
|
1437
|
-
|
|
1655
|
+
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var _loop=function _loop(_i23){tmpAnticipate.anticipate(function(fCallback){_this32.parseCharacterAsync(pString[_i23],_tmpParserState,pData,fCallback,tmpDataContext);});};for(var _i23=0;_i23<pString.length;_i23++){_loop(_i23);}tmpAnticipate.wait(function(pError){// Flush the remaining data
|
|
1656
|
+
_this32.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserState.Output);});}}}]);}();module.exports=StringParser;},{}],78:[function(require,module,exports){/**
|
|
1438
1657
|
* Word Tree
|
|
1439
1658
|
* @author Steven Velozo <steven@velozo.com>
|
|
1440
1659
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -1463,20 +1682,20 @@ _this31.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserSta
|
|
|
1463
1682
|
* @param {Object} pParserContext - The context to pass to the parser function
|
|
1464
1683
|
* @return {Object} The leaf parser from the tree
|
|
1465
1684
|
*/},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,fParser,fParserAsync,pParserContext){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
|
|
1466
|
-
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!('PatternEnd'in tmpLeaf)){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var
|
|
1685
|
+
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!('PatternEnd'in tmpLeaf)){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var _i24=0;_i24<tmpPatternEnd.length;_i24++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i24],_i24);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(pHash,pData){return fParser;}:function(pHash,pData){return pHash;};tmpLeaf.ParseAsync=typeof fParserAsync==='function'?fParserAsync:typeof fParserAsync==='string'?function(pHash,pData,fCallback){return fCallback(null,fParserAsync);}:function(pHash,pData,fCallback){return fCallback(null,tmpLeaf.Parse(pHash,pData));};// A "this" for every object
|
|
1467
1686
|
if(pParserContext){tmpLeaf.ParserContext=pParserContext;}tmpLeaf.isAsync=true;return tmpLeaf;}/** Add a Pattern to the Parse Tree with both function parameter types
|
|
1468
1687
|
* @method addPatternAll
|
|
1469
1688
|
* @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
|
|
1470
1689
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
1471
1690
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
1472
1691
|
* @param {Object} pParserContext - The context to pass to the parser function
|
|
1473
|
-
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);}();module.exports=WordTree;},{}],79:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":0},"Steps":[],"Errors":[],"Log":[]};},{}],80:[function(require,module,exports){var _require4=require('big.js'),PE=_require4.PE;var libFableServiceBase=require('fable-serviceproviderbase');var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase8){function FableOperation(pFable,pOptions,pServiceHash){var
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
if(this.state.OverallProgressTracker.StartTimeStamp>0){return fExecutionCompleteCallback(new Error("Operation [".concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," has already been executed!")));}var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');this.progressTrackerSet.setProgressTrackerTotalOperations(this.state.OverallProgressTracker.Hash,this.state.Status.StepCount);this.progressTrackerSet.startProgressTracker(this.state.OverallProgressTracker.Hash);this.info("Operation [".concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," starting..."));var _loop2=function _loop2(i){tmpAnticipate.anticipate(function(fNext){this.fable.log.info("Step #".concat(i," [").concat(this.state.Steps[i].GUIDStep,"] ").concat(this.state.Steps[i].Name," starting..."));this.progressTrackerSet.startProgressTracker(this.state.Steps[i].ProgressTracker.Hash);return fNext();}.bind(
|
|
1478
|
-
tmpAnticipate.anticipate(
|
|
1479
|
-
tmpAnticipate.wait(function(pError){if(pError){
|
|
1692
|
+
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);}();module.exports=WordTree;},{}],79:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":0},"Steps":[],"Errors":[],"Log":[]};},{}],80:[function(require,module,exports){var _require4=require('big.js'),PE=_require4.PE;var libFableServiceBase=require('fable-serviceproviderbase');var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase8){function FableOperation(pFable,pOptions,pServiceHash){var _this33;_classCallCheck2(this,FableOperation);_this33=_callSuper(this,FableOperation,[pFable,pOptions,pServiceHash]);// Timestamps will just be the long ints
|
|
1693
|
+
_this33.timeStamps={};_this33.serviceType='PhasedOperation';_this33.state=JSON.parse(_OperationStatePrototypeString);_this33.stepMap={};_this33.stepFunctions={};// Match the service instantiation to the operation.
|
|
1694
|
+
_this33.state.Metadata.Hash=_this33.Hash;_this33.state.Metadata.UUID=_this33.UUID;_this33.state.Metadata.Name=typeof _this33.options.Name=='string'?_this33.options.Name:"Unnamed Operation ".concat(_this33.state.Metadata.UUID);_this33.name=_this33.state.Metadata.Name;_this33.progressTrackerSet=_this33.fable.instantiateServiceProviderWithoutRegistration('ProgressTrackerSet');_this33.state.OverallProgressTracker=_this33.progressTrackerSet.createProgressTracker("Overall-".concat(_this33.state.Metadata.UUID));// This is here to use the pass-through logging functions in the operation itself.
|
|
1695
|
+
_this33.log=_this33;return _this33;}_inherits(FableOperation,_libFableServiceBase8);return _createClass2(FableOperation,[{key:"execute",value:function execute(fExecutionCompleteCallback){var _this34=this;// TODO: Should the same operation be allowed to execute more than one time?
|
|
1696
|
+
if(this.state.OverallProgressTracker.StartTimeStamp>0){return fExecutionCompleteCallback(new Error("Operation [".concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," has already been executed!")));}var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');this.progressTrackerSet.setProgressTrackerTotalOperations(this.state.OverallProgressTracker.Hash,this.state.Status.StepCount);this.progressTrackerSet.startProgressTracker(this.state.OverallProgressTracker.Hash);this.info("Operation [".concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," starting..."));var _loop2=function _loop2(i){tmpAnticipate.anticipate(function(fNext){this.fable.log.info("Step #".concat(i," [").concat(this.state.Steps[i].GUIDStep,"] ").concat(this.state.Steps[i].Name," starting..."));this.progressTrackerSet.startProgressTracker(this.state.Steps[i].ProgressTracker.Hash);return fNext();}.bind(_this34));// Steps are executed in a custom context with
|
|
1697
|
+
tmpAnticipate.anticipate(_this34.stepFunctions[_this34.state.Steps[i].GUIDStep].bind({log:_this34,fable:_this34.fable,options:_this34.state.Steps[i].Metadata,metadata:_this34.state.Steps[i].Metadata,ProgressTracker:_this34.progressTrackerSet.getProgressTracker(_this34.state.Steps[i].ProgressTracker.Hash),logProgressTrackerStatus:function(){return this.log.info("Step #".concat(i," [").concat(this.state.Steps[i].GUIDStep,"]: ").concat(this.progressTrackerSet.getProgressTrackerStatusString(this.state.Steps[i].ProgressTracker.Hash)));}.bind(_this34),OperationState:_this34.state,StepState:_this34.state.Steps[i]}));tmpAnticipate.anticipate(function(fNext){this.progressTrackerSet.endProgressTracker(this.state.Steps[i].ProgressTracker.Hash);var tmpStepTimingMessage=this.progressTrackerSet.getProgressTrackerStatusString(this.state.Steps[i].ProgressTracker.Hash);this.fable.log.info("Step #".concat(i," [").concat(this.state.Steps[i].GUIDStep,"] ").concat(this.state.Steps[i].Name," complete."));this.fable.log.info("Step #".concat(i," [").concat(this.state.Steps[i].GUIDStep,"] ").concat(this.state.Steps[i].Name," ").concat(tmpStepTimingMessage,"."));this.progressTrackerSet.incrementProgressTracker(this.state.OverallProgressTracker.Hash,1);var tmpOperationTimingMessage=this.progressTrackerSet.getProgressTrackerStatusString(this.state.OverallProgressTracker.Hash);this.fable.log.info("Operation [".concat(this.state.Metadata.UUID,"] ").concat(tmpOperationTimingMessage,"."));return fNext();}.bind(_this34));};for(var i=0;i<this.state.Steps.length;i++){_loop2(i);}// Wait for the anticipation to complete
|
|
1698
|
+
tmpAnticipate.wait(function(pError){if(pError){_this34.fable.log.error("Operation [".concat(_this34.state.Metadata.UUID,"] ").concat(_this34.state.Metadata.Name," had an error: ").concat(pError),pError);return fExecutionCompleteCallback(pError);}_this34.info("Operation [".concat(_this34.state.Metadata.UUID,"] ").concat(_this34.state.Metadata.Name," complete."));var tmpOperationTimingMessage=_this34.progressTrackerSet.getProgressTrackerStatusString(_this34.state.OverallProgressTracker.Hash);_this34.progressTrackerSet.endProgressTracker(_this34.state.OverallProgressTracker.Hash);_this34.fable.log.info("Operation [".concat(_this34.state.Metadata.UUID,"] ").concat(tmpOperationTimingMessage,"."));return fExecutionCompleteCallback();});}// There are three ways to add steps:
|
|
1480
1699
|
// 1. As a basic javascript function
|
|
1481
1700
|
// --
|
|
1482
1701
|
// This is the most basic, java"script" way to add a step. It will
|
|
@@ -1485,11 +1704,11 @@ tmpAnticipate.wait(function(pError){if(pError){_this33.fable.log.error("Operatio
|
|
|
1485
1704
|
},{key:"addStep",value:function addStep(fStepFunction,pStepMetadata,pStepName,pStepDescription,pGUIDStep){var tmpStep={};// GUID is optional
|
|
1486
1705
|
tmpStep.GUIDStep=typeof pGUIDStep!=='undefined'?pGUIDStep:"STEP-".concat(this.state.Steps.length,"-").concat(this.fable.DataGeneration.randomNumericString());// Name is optional
|
|
1487
1706
|
tmpStep.Name=typeof pStepName!=='undefined'?pStepName:"Step [".concat(tmpStep.GUIDStep,"]");tmpStep.Description=typeof pStepDescription!=='undefined'?pStepDescription:"Step execution of ".concat(tmpStep.Name,".");tmpStep.ProgressTracker=this.progressTrackerSet.createProgressTracker(tmpStep.GUIDStep);tmpStep.Metadata=_typeof(pStepMetadata)==='object'?pStepMetadata:{};// There is an array of steps, in the Operation State itself ... push a step there
|
|
1488
|
-
this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep]=tmpStep;this.stepFunctions[tmpStep.GUIDStep]=typeof fStepFunction=='function'?fStepFunction:function(fDone){return fDone();};this.state.Status.StepCount++;return tmpStep;}},{key:"setStepTotalOperations",value:function setStepTotalOperations(pGUIDStep,pTotalOperationCount){if(!(pGUIDStep in this.stepMap)){return new Error("Step [".concat(pGUIDStep,"] does not exist in operation [").concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," when attempting to set total operations to ").concat(pTotalOperationCount,"."));}this.progressTrackerSet.setProgressTrackerTotalOperations(this.stepMap[pGUIDStep].ProgressTracker.Hash,pTotalOperationCount);}},{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("[".concat(new Date().toUTCString(),"]-[").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);}(libFableServiceBase);module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":79,"big.js":17,"fable-serviceproviderbase":52}],81:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase9){function FableServiceProgressTime(pFable,pOptions,pServiceHash){var
|
|
1707
|
+
this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep]=tmpStep;this.stepFunctions[tmpStep.GUIDStep]=typeof fStepFunction=='function'?fStepFunction:function(fDone){return fDone();};this.state.Status.StepCount++;return tmpStep;}},{key:"setStepTotalOperations",value:function setStepTotalOperations(pGUIDStep,pTotalOperationCount){if(!(pGUIDStep in this.stepMap)){return new Error("Step [".concat(pGUIDStep,"] does not exist in operation [").concat(this.state.Metadata.UUID,"] ").concat(this.state.Metadata.Name," when attempting to set total operations to ").concat(pTotalOperationCount,"."));}this.progressTrackerSet.setProgressTrackerTotalOperations(this.stepMap[pGUIDStep].ProgressTracker.Hash,pTotalOperationCount);}},{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("[".concat(new Date().toUTCString(),"]-[").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);}(libFableServiceBase);module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":79,"big.js":17,"fable-serviceproviderbase":52}],81:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase9){function FableServiceProgressTime(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,FableServiceProgressTime);_this35=_callSuper(this,FableServiceProgressTime,[pFable,pOptions,pServiceHash]);_this35.serviceType='ProgressTime';_this35.timeStamps={};return _this35;}_inherits(FableServiceProgressTime,_libFableServiceBase9);return _createClass2(FableServiceProgressTime,[{key:"formatTimeDuration",value:function formatTimeDuration(pTimeDurationInMilliseconds){var tmpTimeDuration=typeof pTimeDurationInMilliseconds=='number'?pTimeDurationInMilliseconds:0;if(pTimeDurationInMilliseconds<0){return'unknown';}var tmpTimeDurationString='';if(tmpTimeDuration>3600000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/3600000)+'h ';tmpTimeDuration=tmpTimeDuration%3600000;}if(tmpTimeDuration>60000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/60000)+'m ';tmpTimeDuration=tmpTimeDuration%60000;}if(tmpTimeDuration>1000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/1000)+'s ';tmpTimeDuration=tmpTimeDuration%1000;}tmpTimeDurationString+=Math.round(tmpTimeDuration)+'ms';return tmpTimeDurationString;}},{key:"createTimeStamp",value:function createTimeStamp(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';this.timeStamps[tmpTimeStampHash]=+new Date();return this.timeStamps[tmpTimeStampHash];}},{key:"getTimeStampValue",value:function getTimeStampValue(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';return tmpTimeStampHash in this.timeStamps?this.timeStamps[tmpTimeStampHash]:-1;}},{key:"updateTimeStampValue",value:function updateTimeStampValue(pTimeStampHash,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
|
|
1489
1708
|
if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){this.timeStamps[tmpTimeStampHash]=tmpReferenceTime;return this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"removeTimeStamp",value:function removeTimeStamp(pTimeStampHash){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';if(tmpTimeStampHash in this.timeStamps){delete this.timeStamps[tmpTimeStampHash];return true;}else{return false;}}},{key:"getTimeStampDelta",value:function getTimeStampDelta(pTimeStampHash,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
|
|
1490
|
-
if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"getDurationBetweenTimestamps",value:function getDurationBetweenTimestamps(pTimeStampHashStart,pTimeStampHashEnd){var tmpTimeStampHashStart=typeof pTimeStampHashStart=='string'?pTimeStampHashStart:'Default';var tmpTimeStampHashEnd=typeof pTimeStampHashEnd=='string'?pTimeStampHashEnd:'Default';if(tmpTimeStampHashStart in this.timeStamps&&tmpTimeStampHashEnd in this.timeStamps){return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];}else{return-1;}}},{key:"getTimeStampDeltaMessage",value:function getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpMessage=typeof pMessage!=='undefined'?pMessage:"Elapsed for ".concat(tmpTimeStampHash,": ");var tmpOperationTime=this.getTimeStampDelta(tmpTimeStampHash,pReferenceTime);return"".concat(tmpMessage," ").concat(this.formatTimeDuration(tmpOperationTime));}},{key:"logTimeStampDelta",value:function logTimeStampDelta(pTimeStampHash,pMessage,pReferenceTime){this.fable.log.info(this.getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTime;},{"fable-serviceproviderbase":52}],82:[function(require,module,exports){var ProgressTracker=/*#__PURE__*/function(){function ProgressTracker(pProgressTrackerSet,pProgressTrackerHash){_classCallCheck2(this,ProgressTracker);this.progressTrackerSet=pProgressTrackerSet;this.progressTrackerHash=pProgressTrackerHash;this.data=this.progressTrackerSet.getProgressTrackerData(this.progressTrackerHash);}return _createClass2(ProgressTracker,[{key:"updateProgressTracker",value:function updateProgressTracker(pProgressAmount){return this.progressTrackerSet.updateProgressTracker(this.progressTrackerHash,pProgressAmount);}},{key:"incrementProgressTracker",value:function incrementProgressTracker(pProgressIncrementAmount){return this.progressTrackerSet.incrementProgressTracker(this.progressTrackerHash,pProgressIncrementAmount);}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pTotalOperationCount){return this.progressTrackerSet.setProgressTrackerTotalOperations(this.progressTrackerHash,pTotalOperationCount);}},{key:"getProgressTrackerStatusString",value:function getProgressTrackerStatusString(){return this.progressTrackerSet.getProgressTrackerStatusString(this.progressTrackerHash);}}]);}();module.exports=ProgressTracker;},{}],83:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');var FableServiceProgressTrackerSet=/*#__PURE__*/function(_libFableServiceBase10){function FableServiceProgressTrackerSet(pFable,pOptions,pServiceHash){var
|
|
1491
|
-
|
|
1492
|
-
|
|
1709
|
+
if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}},{key:"getDurationBetweenTimestamps",value:function getDurationBetweenTimestamps(pTimeStampHashStart,pTimeStampHashEnd){var tmpTimeStampHashStart=typeof pTimeStampHashStart=='string'?pTimeStampHashStart:'Default';var tmpTimeStampHashEnd=typeof pTimeStampHashEnd=='string'?pTimeStampHashEnd:'Default';if(tmpTimeStampHashStart in this.timeStamps&&tmpTimeStampHashEnd in this.timeStamps){return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];}else{return-1;}}},{key:"getTimeStampDeltaMessage",value:function getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime){var tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';var tmpMessage=typeof pMessage!=='undefined'?pMessage:"Elapsed for ".concat(tmpTimeStampHash,": ");var tmpOperationTime=this.getTimeStampDelta(tmpTimeStampHash,pReferenceTime);return"".concat(tmpMessage," ").concat(this.formatTimeDuration(tmpOperationTime));}},{key:"logTimeStampDelta",value:function logTimeStampDelta(pTimeStampHash,pMessage,pReferenceTime){this.fable.log.info(this.getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTime;},{"fable-serviceproviderbase":52}],82:[function(require,module,exports){var ProgressTracker=/*#__PURE__*/function(){function ProgressTracker(pProgressTrackerSet,pProgressTrackerHash){_classCallCheck2(this,ProgressTracker);this.progressTrackerSet=pProgressTrackerSet;this.progressTrackerHash=pProgressTrackerHash;this.data=this.progressTrackerSet.getProgressTrackerData(this.progressTrackerHash);}return _createClass2(ProgressTracker,[{key:"updateProgressTracker",value:function updateProgressTracker(pProgressAmount){return this.progressTrackerSet.updateProgressTracker(this.progressTrackerHash,pProgressAmount);}},{key:"incrementProgressTracker",value:function incrementProgressTracker(pProgressIncrementAmount){return this.progressTrackerSet.incrementProgressTracker(this.progressTrackerHash,pProgressIncrementAmount);}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pTotalOperationCount){return this.progressTrackerSet.setProgressTrackerTotalOperations(this.progressTrackerHash,pTotalOperationCount);}},{key:"getProgressTrackerStatusString",value:function getProgressTrackerStatusString(){return this.progressTrackerSet.getProgressTrackerStatusString(this.progressTrackerHash);}}]);}();module.exports=ProgressTracker;},{}],83:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');var FableServiceProgressTrackerSet=/*#__PURE__*/function(_libFableServiceBase10){function FableServiceProgressTrackerSet(pFable,pOptions,pServiceHash){var _this36;_classCallCheck2(this,FableServiceProgressTrackerSet);_this36=_callSuper(this,FableServiceProgressTrackerSet,[pFable,pOptions,pServiceHash]);_this36.serviceType='ProgressTrackerSet';_this36.progressTrackers={};// Create an internal PorgressTime service to track timestamps
|
|
1710
|
+
_this36.progressTimes=_this36.fable.instantiateServiceProviderWithoutRegistration('ProgressTime');// This timestamp is used and updated by *all* progress trackers.
|
|
1711
|
+
_this36.progressTimes.createTimeStamp('CurrentTime');return _this36;}_inherits(FableServiceProgressTrackerSet,_libFableServiceBase10);return _createClass2(FableServiceProgressTrackerSet,[{key:"getProgressTracker",value:function getProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,100);}return new libProgressTrackerClass(this,pProgressTrackerHash);}},{key:"getProgressTrackerData",value:function getProgressTrackerData(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,100);}return this.progressTrackers[tmpProgressTrackerHash];}},{key:"createProgressTracker",value:function createProgressTracker(pProgressTrackerHash,pTotalOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;var tmpProgressTracker={Hash:tmpProgressTrackerHash,StartTimeHash:"".concat(tmpProgressTrackerHash,"-Start"),StartTimeStamp:-1,CurrentTimeStamp:-1,EndTimeHash:"".concat(tmpProgressTrackerHash,"-End"),EndTimeStamp:-1,PercentComplete:-1,// If this is set to true, PercentComplete will be calculated as CurrentCount / TotalCount even if it goes over 100%
|
|
1493
1712
|
AllowTruePercentComplete:false,ElapsedTime:-1,AverageOperationTime:-1,EstimatedCompletionTime:-1,TotalCount:tmpTotalOperations,CurrentCount:-1};if(tmpProgressTrackerHash in this.progressTrackers){this.fable.log.warn("ProgressTracker ".concat(tmpProgressTrackerHash," already exists! Overwriting with a new tracker..."));this.progressTimes.removeTimeStamp(tmpProgressTracker.StartTimeHash);this.progressTimes.removeTimeStamp(tmpProgressTracker.EndTimeHash);}this.progressTrackers[tmpProgressTrackerHash]=tmpProgressTracker;return tmpProgressTracker;}},{key:"setProgressTrackerTotalOperations",value:function setProgressTrackerTotalOperations(pProgressTrackerHash,pTotalOperations){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';var tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn("Attempted to set the total operations of ProgressTracker ".concat(tmpProgressTrackerHash," but it does not exist! Creating a new tracker..."));this.createProgressTracker(tmpProgressTrackerHash,tmpTotalOperations);}this.progressTrackers[tmpProgressTrackerHash].TotalCount=tmpTotalOperations;return this.progressTrackers[tmpProgressTrackerHash];}},{key:"startProgressTracker",value:function startProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This is the only method to lazily create ProgressTrackers now
|
|
1494
1713
|
if(!(tmpProgressTrackerHash in this.progressTrackers)){this.createProgressTracker(tmpProgressTrackerHash,100);}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];this.progressTimes.createTimeStamp(this.progressTrackers[tmpProgressTrackerHash].StartTimeHash);tmpProgressTracker.StartTimeStamp=this.progressTimes.getTimeStampValue(this.progressTrackers[tmpProgressTrackerHash].StartTimeHash);if(tmpProgressTracker.CurrentCount<0){tmpProgressTracker.CurrentCount=0;}return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"endProgressTracker",value:function endProgressTracker(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.error("Attempted to end ProgressTracker ".concat(tmpProgressTrackerHash," that does not exist!"));return false;}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];this.progressTimes.createTimeStamp(this.progressTrackers[tmpProgressTrackerHash].EndTimeHash);tmpProgressTracker.EndTimeStamp=this.progressTimes.getTimeStampValue(this.progressTrackers[tmpProgressTrackerHash].EndTimeHash);return this.solveProgressTrackerStatus(tmpProgressTrackerHash);}},{key:"solveProgressTrackerStatus",value:function solveProgressTrackerStatus(pProgressTrackerHash){var tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.error("Attempted to solve ProgressTracker ".concat(tmpProgressTrackerHash," that does not exist!"));return false;}var tmpProgressTracker=this.progressTrackers[tmpProgressTrackerHash];if(tmpProgressTracker.TotalCount<1||isNaN(tmpProgressTracker.TotalCount)){this.fable.log.error("ProgressTracker ".concat(tmpProgressTracker.Hash," has an invalid total count of operations (").concat(tmpProgressTracker.TotalCount,"! Setting it to the default of 100..."));tmpProgressTracker.TotalCount=100;}// Compute the percentage of progress that is complete.
|
|
1495
1714
|
if(tmpProgressTracker.CurrentCount<1){tmpProgressTracker.PercentComplete=0;}else{tmpProgressTracker.PercentComplete=tmpProgressTracker.CurrentCount/tmpProgressTracker.TotalCount*100.0;}if(!tmpProgressTracker.AllowTruePercentComplete&&tmpProgressTracker.PercentComplete>100){tmpProgressTracker.PercentComplete=100;}// Compute the average time per operation
|
|
@@ -1510,20 +1729,20 @@ this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!(tmpProgressTrackerH
|
|
|
1510
1729
|
if(tmpProgressTracker.StartTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," has not been started yet.");}// 2. Started, but no operations completed
|
|
1511
1730
|
if(tmpProgressTracker.CurrentCount<1&&tmpProgressTracker.EndTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," has no completed operations. ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," have elapsed since it was started.");}// 3. Started, some operations completed
|
|
1512
1731
|
else if(tmpProgressTracker.EndTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," is ").concat(tmpProgressTracker.PercentComplete.toFixed(3),"% completed - ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations over ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," (median ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)," per). Estimated completion: ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.EstimatedCompletionTime));}// 4. Done
|
|
1513
|
-
else{return"ProgressTracker ".concat(tmpProgressTracker.Hash," is done. ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations were completed in ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," (median ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)," per).");}}}},{key:"logProgressTrackerStatus",value:function logProgressTrackerStatus(pProgressTrackerHash){this.fable.log.info(this.getProgressTrackerStatusString(pProgressTrackerHash));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTrackerSet;},{"./Fable-Service-ProgressTracker/ProgressTracker.js":82,"fable-serviceproviderbase":52}],84:[function(require,module,exports){(function(Buffer){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase11){function FableServiceRestClient(pFable,pOptions,pServiceHash){var
|
|
1732
|
+
else{return"ProgressTracker ".concat(tmpProgressTracker.Hash," is done. ").concat(tmpProgressTracker.CurrentCount," / ").concat(tmpProgressTracker.TotalCount," operations were completed in ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)," (median ").concat(this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)," per).");}}}},{key:"logProgressTrackerStatus",value:function logProgressTrackerStatus(pProgressTrackerHash){this.fable.log.info(this.getProgressTrackerStatusString(pProgressTrackerHash));}}]);}(libFableServiceBase);module.exports=FableServiceProgressTrackerSet;},{"./Fable-Service-ProgressTracker/ProgressTracker.js":82,"fable-serviceproviderbase":52}],84:[function(require,module,exports){(function(Buffer){(function(){var libFableServiceBase=require('fable-serviceproviderbase');var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase11){function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this37;_classCallCheck2(this,FableServiceRestClient);_this37=_callSuper(this,FableServiceRestClient,[pFable,pOptions,pServiceHash]);_this37.TraceLog=false;if(_this37.options.TraceLog||_this37.fable.TraceLog){_this37.TraceLog=true;}_this37.dataFormat=_this37.fable.services.DataFormat;_this37.serviceType='RestClient';_this37.cookie=false;// This is a function that can be overridden, to allow the management
|
|
1514
1733
|
// of the request options before they are passed to the request library.
|
|
1515
|
-
|
|
1734
|
+
_this37.prepareRequestOptions=function(pOptions){return pOptions;};return _this37;}_inherits(FableServiceRestClient,_libFableServiceBase11);return _createClass2(FableServiceRestClient,[{key:"simpleGet",get:function get(){return libSimpleGet;}},{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){var tmpCookieObject=this.cookie;if(!('headers'in pRequestOptions)){pRequestOptions.headers={};}var tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
|
|
1516
1735
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
1517
1736
|
var tmpOptions=this.prepareCookies(pOptions);// Prepend a string to the URL if it exists in the Fable Config
|
|
1518
|
-
if('RestClientURLPrefix'in this.fable.settings){tmpOptions.url=this.fable.settings.RestClientURLPrefix+tmpOptions.url;}return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var
|
|
1519
|
-
if(
|
|
1520
|
-
if(
|
|
1521
|
-
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(
|
|
1737
|
+
if('RestClientURLPrefix'in this.fable.settings){tmpOptions.url=this.fable.settings.RestClientURLPrefix+tmpOptions.url;}return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this38=this;var tmpOptions=this.preRequest(pOptions);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this38.TraceLog){var tmpConnectTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpData='';pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
|
|
1738
|
+
if(_this38.TraceLog){var tmpChunkTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this38.TraceLog){var tmpCompletionTime=_this38.fable.log.getTimeStamp();_this38.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this38.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeChunkedRequestBinary",value:function executeChunkedRequestBinary(pOptions,fCallback){var _this39=this;var tmpOptions=this.preRequest(pOptions);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}tmpOptions.json=false;tmpOptions.encoding=null;return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this39.TraceLog){var tmpConnectTime=_this39.fable.log.getTimeStamp();_this39.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this39.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpDataBuffer=false;pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
|
|
1739
|
+
if(_this39.TraceLog){var tmpChunkTime=_this39.fable.log.getTimeStamp();_this39.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this39.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}// TODO: Potentially create a third option that streams this to a file? So it doesn't have to hold it all in memory.
|
|
1740
|
+
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(_this39.TraceLog){var tmpCompletionTime=_this39.fable.log.getTimeStamp();_this39.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpDataBuffer.length,"b received in ").concat(_this39.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpDataBuffer);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this40=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!('headers'in tmpOptions)){tmpOptions.headers={};}/* Automated headers break some APIs
|
|
1522
1741
|
if (!('Content-Type' in tmpOptions.headers))
|
|
1523
1742
|
{
|
|
1524
1743
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
1525
1744
|
}
|
|
1526
|
-
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(
|
|
1745
|
+
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this40.TraceLog){var tmpConnectTime=_this40.fable.log.getTimeStamp();_this40.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this40.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this40.TraceLog){var tmpChunkTime=_this40.fable.log.getTimeStamp();_this40.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this40.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this40.TraceLog){var tmpCompletionTime=_this40.fable.log.getTimeStamp();_this40.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this40.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}},{key:"getJSON",value:function getJSON(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}},{key:"putJSON",value:function putJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PUT JSON Error Invalid options object"));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}},{key:"postJSON",value:function postJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("POST JSON Error Invalid options object"));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}},{key:"patchJSON",value:function patchJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PATCH JSON Error Invalid options object"));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}},{key:"headJSON",value:function headJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("HEAD JSON Error Invalid options object"));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}},{key:"delJSON",value:function delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}},{key:"getRawText",value:function getRawText(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}]);}(libFableServiceBase);module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20,"cookie":27,"fable-serviceproviderbase":52,"simple-get":134}],85:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase12){// Underscore and lodash have a behavior, _.template, which compiles a
|
|
1527
1746
|
// string-based template with code snippets into simple executable pieces,
|
|
1528
1747
|
// with the added twist of returning a precompiled function ready to go.
|
|
1529
1748
|
//
|
|
@@ -1532,16 +1751,16 @@ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.
|
|
|
1532
1751
|
//
|
|
1533
1752
|
// This is an implementation of that.
|
|
1534
1753
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
1535
|
-
function FableServiceTemplate(pFable,pOptions,pServiceHash){var
|
|
1754
|
+
function FableServiceTemplate(pFable,pOptions,pServiceHash){var _this41;_classCallCheck2(this,FableServiceTemplate);_this41=_callSuper(this,FableServiceTemplate,[pFable,pOptions,pServiceHash]);_this41.serviceType='Template';// These are the exact regex's used in lodash/underscore
|
|
1536
1755
|
// TODO: Switch this to precedent
|
|
1537
|
-
|
|
1756
|
+
_this41.Matchers={Evaluate:/<%([\s\S]+?)%>/g,Interpolate:/<%=([\s\S]+?)%>/g,Escaper:/\\|'|\r|\n|\t|\u2028|\u2029/g,Unescaper:/\\(\\|'|r|n|t|u2028|u2029)/g,// This is how underscore does it, so we are keeping it for now.
|
|
1538
1757
|
GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper functions.
|
|
1539
1758
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
1540
|
-
|
|
1759
|
+
_this41.templateEscapes={'\\':'\\',"'":"'",'r':'\r','\r':'r','n':'\n','\n':'n','t':'\t','\t':'t','u2028':"\u2028","\u2028":'u2028','u2029':"\u2029","\u2029":'u2029'};// This is defined as such to underscore that it is a dynamic programming
|
|
1541
1760
|
// function on this class.
|
|
1542
|
-
|
|
1761
|
+
_this41.renderFunction=false;_this41.templateString=false;return _this41;}_inherits(FableServiceTemplate,_libFableServiceBase12);return _createClass2(FableServiceTemplate,[{key:"renderTemplate",value:function renderTemplate(pData){return this.renderFunction(pData);}},{key:"templateFunction",value:function templateFunction(){var fRenderTemplateBound=this.renderTemplate.bind(this);return fRenderTemplateBound;}},{key:"buildTemplateFunction",value:function buildTemplateFunction(pTemplateText,pData){var _this42=this;// For now this is being kept in a weird form ... this is to mimic the old
|
|
1543
1762
|
// underscore code until this is rewritten using precedent.
|
|
1544
|
-
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(
|
|
1763
|
+
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(_this42.templateEscapes[pMatch]);}).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"'+\n(".concat(decodeURIComponent(pCode),")+\n'");}).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"';\n".concat(decodeURIComponent(pCode),"\n;__p+='");})+"';\n";this.TemplateSource="with(pTemplateDataObject||{}){\n".concat(this.TemplateSource,"}\n");this.TemplateSource="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n".concat(this.TemplateSource,"return __p;\n");this.renderFunction=new Function('pTemplateDataObject',this.TemplateSource);if(typeof pData!='undefined'){return this.renderFunction(pData);}// Provide the compiled function source as a convenience for build time
|
|
1545
1764
|
// precompilation.
|
|
1546
1765
|
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);}(libFableServiceBase);module.exports=FableServiceTemplate;},{"fable-serviceproviderbase":52}],86:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');// TODO: These are still pretty big -- consider the smaller polyfills
|
|
1547
1766
|
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var libBigNumber=require('big.js');var FableServiceUtility=/*#__PURE__*/function(_libFableServiceBase13){// Underscore and lodash have a behavior, _.template, which compiles a
|
|
@@ -1553,8 +1772,8 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
1553
1772
|
//
|
|
1554
1773
|
// This is an implementation of that.
|
|
1555
1774
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
1556
|
-
function FableServiceUtility(pFable,pOptions,pServiceHash){var
|
|
1557
|
-
|
|
1775
|
+
function FableServiceUtility(pFable,pOptions,pServiceHash){var _this43;_classCallCheck2(this,FableServiceUtility);_this43=_callSuper(this,FableServiceUtility,[pFable,pOptions,pServiceHash]);_this43.templates={};// These two functions are used extensively throughout
|
|
1776
|
+
_this43.waterfall=libAsyncWaterfall;_this43.eachLimit=libAsyncEachLimit;_this43.bigNumber=libBigNumber;return _this43;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
1558
1777
|
// Now that es6 gives us this, use the native thingy.
|
|
1559
1778
|
// Nevermind, the native thing is not stable enough across environments
|
|
1560
1779
|
// Basic shallow copy
|
|
@@ -1640,12 +1859,12 @@ var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pStr
|
|
|
1640
1859
|
*
|
|
1641
1860
|
* @class ManyfestHashTranslation
|
|
1642
1861
|
*/var ManyfestHashTranslation=/*#__PURE__*/function(){function ManyfestHashTranslation(pInfoLog,pErrorLog){_classCallCheck2(this,ManyfestHashTranslation);// Wire in logging
|
|
1643
|
-
this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}return _createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var
|
|
1862
|
+
this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}return _createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var _this44=this;// This adds a translation in the form of:
|
|
1644
1863
|
// { "SourceHash": "DestinationHash", "SecondSourceHash":"SecondDestinationHash" }
|
|
1645
|
-
if(_typeof(pTranslation)!='object'){this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(pTranslation)));return false;}var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){if(typeof pTranslation[pTranslationSource]!='string'){
|
|
1864
|
+
if(_typeof(pTranslation)!='object'){this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(pTranslation)));return false;}var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){if(typeof pTranslation[pTranslationSource]!='string'){_this44.logError("Hash translation addTranslation expected a translation destination hash for [".concat(pTranslationSource,"] to be a string but the referrant was a ").concat(_typeof(pTranslation[pTranslationSource])));}else{_this44.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}},{key:"removeTranslationHash",value:function removeTranslationHash(pTranslationHash){if(pTranslationHash in this.translationTable){delete this.translationTable[pTranslationHash];}}// This removes translations.
|
|
1646
1865
|
// If passed a string, just removes the single one.
|
|
1647
1866
|
// If passed an object, it does all the source keys.
|
|
1648
|
-
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var
|
|
1867
|
+
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var _this45=this;if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(_typeof(pTranslation)=='object'){var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){_this45.removeTranslation(pTranslationSource);});return true;}else{this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(_typeof(pTranslation)));return false;}}},{key:"clearTranslations",value:function clearTranslations(){this.translationTable={};}},{key:"translate",value:function translate(pTranslation){if(pTranslation in this.translationTable){return this.translationTable[pTranslation];}else{return pTranslation;}}}]);}();module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":101}],101:[function(require,module,exports){/**
|
|
1649
1868
|
* @author <steven@velozo.com>
|
|
1650
1869
|
*/ /**
|
|
1651
1870
|
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
@@ -1902,14 +2121,14 @@ else if(_tmpBracketStartIndex2>0// 2) The end bracket is after the start brac
|
|
|
1902
2121
|
return false;}// We need to enumerate the array and grab the addresses from there.
|
|
1903
2122
|
var tmpArrayProperty=pObject[_tmpBoxedPropertyName4];// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
1904
2123
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpBoxedPropertyName4);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
1905
|
-
var tmpContainerObject={};for(var
|
|
2124
|
+
var tmpContainerObject={};for(var _i25=0;_i25<tmpArrayProperty.length;_i25++){var tmpPropertyParentAddress="".concat(tmpParentAddress,"[").concat(_i25,"]");var tmpValue=this.deleteValueAtAddress(pObject[_tmpBoxedPropertyName4][_i25],tmpNewAddress,tmpPropertyParentAddress);tmpContainerObject["".concat(tmpPropertyParentAddress,".").concat(tmpNewAddress)]=tmpValue;}return tmpContainerObject;}// OBJECT SET
|
|
1906
2125
|
// Note this will not work with a bracket in the same address box set
|
|
1907
2126
|
var _tmpObjectTypeMarkerIndex=pAddress.indexOf('{}');if(_tmpObjectTypeMarkerIndex>0){var _tmpObjectPropertyName=pAddress.substring(0,_tmpObjectTypeMarkerIndex).trim();if(_typeof(pObject[_tmpObjectPropertyName])!='object'){// We asked for a set from an array but it isnt' an array.
|
|
1908
2127
|
return false;}// We need to enumerate the Object and grab the addresses from there.
|
|
1909
2128
|
var tmpObjectProperty=pObject[_tmpObjectPropertyName];var tmpObjectPropertyKeys=Object.keys(tmpObjectProperty);// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
1910
2129
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpObjectPropertyName);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
1911
|
-
var _tmpContainerObject={};for(var
|
|
1912
|
-
var _tmpKeepRecord=this.checkRecordFilters(pAddress,
|
|
2130
|
+
var _tmpContainerObject={};for(var _i26=0;_i26<tmpObjectPropertyKeys.length;_i26++){var _tmpPropertyParentAddress="".concat(tmpParentAddress,".").concat(tmpObjectPropertyKeys[_i26]);var _tmpValue3=this.deleteValueAtAddress(pObject[_tmpObjectPropertyName][tmpObjectPropertyKeys[_i26]],tmpNewAddress,_tmpPropertyParentAddress);// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
2131
|
+
var _tmpKeepRecord=this.checkRecordFilters(pAddress,_tmpValue3);if(_tmpKeepRecord){_tmpContainerObject["".concat(_tmpPropertyParentAddress,".").concat(tmpNewAddress)]=_tmpValue3;}}return _tmpContainerObject;}// If there is an object property already named for the sub object, but it isn't an object
|
|
1913
2132
|
// then the system can't set the value in there. Error and abort!
|
|
1914
2133
|
if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
|
|
1915
2134
|
// Continue to manage the parent address for recursion
|
|
@@ -1977,11 +2196,11 @@ return false;}// Now see if the function has arguments.
|
|
|
1977
2196
|
// Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
|
|
1978
2197
|
var tmpFunctionArguments=_MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(pAddress.substring(tmpFunctionAddress.length),0),',');if(tmpFunctionArguments.length==0||tmpFunctionArguments[0]==''){// No arguments... just call the function (bound to the scope of the object it is contained withing)
|
|
1979
2198
|
return pObject[tmpFunctionAddress].apply(pObject);}else{var tmpArgumentValues=[];var _tmpRootObject2=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
|
|
1980
|
-
for(var
|
|
2199
|
+
for(var _i27=0;_i27<tmpFunctionArguments.length;_i27++){// Resolve the values for each subsequent entry
|
|
1981
2200
|
// Check if the argument value is a string literal or a reference to an address
|
|
1982
|
-
if(tmpFunctionArguments[
|
|
1983
|
-
tmpArgumentValues.push(tmpFunctionArguments[
|
|
1984
|
-
tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[
|
|
2201
|
+
if(tmpFunctionArguments[_i27].length>=2&&(tmpFunctionArguments[_i27].charAt(0)=='"'||tmpFunctionArguments[_i27].charAt(0)=="'"||tmpFunctionArguments[_i27].charAt(0)=="`")&&(tmpFunctionArguments[_i27].charAt(tmpFunctionArguments[_i27].length-1)=='"'||tmpFunctionArguments[_i27].charAt(tmpFunctionArguments[_i27].length-1)=="'"||tmpFunctionArguments[_i27].charAt(tmpFunctionArguments[_i27].length-1)=="`")){// This is a string literal
|
|
2202
|
+
tmpArgumentValues.push(tmpFunctionArguments[_i27].substring(1,tmpFunctionArguments[_i27].length-1));}else{// This is a hash address
|
|
2203
|
+
tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[_i27]));}}return pObject[tmpFunctionAddress].apply(pObject,tmpArgumentValues);}}// Boxed elements look like this:
|
|
1985
2204
|
// MyValues[10]
|
|
1986
2205
|
// MyValues['Name']
|
|
1987
2206
|
// MyValues["Age"]
|
|
@@ -2012,8 +2231,8 @@ return pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference];}else{return pOb
|
|
|
2012
2231
|
else if(tmpBracketStartIndex>0// 2) The end bracket is after the start bracket
|
|
2013
2232
|
&&tmpBracketStopIndex>tmpBracketStartIndex// 3) There is nothing in the brackets
|
|
2014
2233
|
&&tmpBracketStopIndex-tmpBracketStartIndex==1){var _tmpBoxedPropertyName5=pAddress.substring(0,tmpBracketStartIndex).trim();if(!Array.isArray(pObject[_tmpBoxedPropertyName5])){// We asked for a set from an array but it isnt' an array.
|
|
2015
|
-
return false;}var tmpInputArray=pObject[_tmpBoxedPropertyName5];var tmpOutputArray=[];for(var
|
|
2016
|
-
var tmpKeepRecord=this.checkRecordFilters(pAddress,tmpInputArray[
|
|
2234
|
+
return false;}var tmpInputArray=pObject[_tmpBoxedPropertyName5];var tmpOutputArray=[];for(var _i28=0;_i28<tmpInputArray.length;_i28++){// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
2235
|
+
var tmpKeepRecord=this.checkRecordFilters(pAddress,tmpInputArray[_i28]);if(tmpKeepRecord){tmpOutputArray.push(tmpInputArray[_i28]);}}return tmpOutputArray;}// The object has been flagged as an object set, so treat it as such
|
|
2017
2236
|
else if(tmpObjectTypeMarkerIndex>0){var tmpObjectPropertyName=pAddress.substring(0,tmpObjectTypeMarkerIndex).trim();if(_typeof(pObject[tmpObjectPropertyName])!='object'){// We asked for a set from an array but it isnt' an array.
|
|
2018
2237
|
return false;}return pObject[tmpObjectPropertyName];}else{// Now is the point in recursion to return the value in the address
|
|
2019
2238
|
if(_typeof(pObject[pAddress])!=null){return pObject[pAddress];}else{return undefined;}}}else{//let tmpSubObjectName = pAddress.substring(0, tmpSeparatorIndex);
|
|
@@ -2040,11 +2259,11 @@ return false;}// Now see if the function has arguments.
|
|
|
2040
2259
|
// Implementation notes: * ARGUMENTS MUST SHARE THE SAME ROOT OBJECT CONTEXT *
|
|
2041
2260
|
var _tmpFunctionArguments=_MockFable.DataFormat.stringGetSegments(_MockFable.DataFormat.stringGetEnclosureValueByIndex(tmpSubObjectName.substring(_tmpFunctionAddress2.length),0),',');if(_tmpFunctionArguments.length==0||_tmpFunctionArguments[0]==''){// No arguments... just call the function (bound to the scope of the object it is contained withing)
|
|
2042
2261
|
return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject),tmpNewAddress,tmpParentAddress,tmpRootObject);}else{var _tmpArgumentValues=[];var _tmpRootObject3=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
|
|
2043
|
-
for(var
|
|
2262
|
+
for(var _i29=0;_i29<_tmpFunctionArguments.length;_i29++){// Resolve the values for each subsequent entry
|
|
2044
2263
|
// Check if the argument value is a string literal or a reference to an address
|
|
2045
|
-
if(_tmpFunctionArguments[
|
|
2046
|
-
_tmpArgumentValues.push(_tmpFunctionArguments[
|
|
2047
|
-
_tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3,_tmpFunctionArguments[
|
|
2264
|
+
if(_tmpFunctionArguments[_i29].length>=2&&(_tmpFunctionArguments[_i29].charAt(0)=='"'||_tmpFunctionArguments[_i29].charAt(0)=="'"||_tmpFunctionArguments[_i29].charAt(0)=="`")&&(_tmpFunctionArguments[_i29].charAt(_tmpFunctionArguments[_i29].length-1)=='"'||_tmpFunctionArguments[_i29].charAt(_tmpFunctionArguments[_i29].length-1)=="'"||_tmpFunctionArguments[_i29].charAt(_tmpFunctionArguments[_i29].length-1)=="`")){// This is a string literal
|
|
2265
|
+
_tmpArgumentValues.push(_tmpFunctionArguments[_i29].substring(1,_tmpFunctionArguments[_i29].length-1));}else{// This is a hash address
|
|
2266
|
+
_tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3,_tmpFunctionArguments[_i29]));}}return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject,_tmpArgumentValues),tmpNewAddress,tmpParentAddress,_tmpRootObject3);}}// Boxed elements look like this:
|
|
2048
2267
|
// MyValues[42]
|
|
2049
2268
|
// MyValues['Color']
|
|
2050
2269
|
// MyValues["Weight"]
|
|
@@ -2086,14 +2305,14 @@ else if(_tmpBracketStartIndex3>0// 2) The end bracket is after the start brac
|
|
|
2086
2305
|
return false;}// We need to enumerate the array and grab the addresses from there.
|
|
2087
2306
|
var tmpArrayProperty=pObject[_tmpBoxedPropertyName7];// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
2088
2307
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpBoxedPropertyName7);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
2089
|
-
var tmpContainerObject={};for(var
|
|
2308
|
+
var tmpContainerObject={};for(var _i30=0;_i30<tmpArrayProperty.length;_i30++){var tmpPropertyParentAddress="".concat(tmpParentAddress,"[").concat(_i30,"]");var tmpValue=this.getValueAtAddress(pObject[_tmpBoxedPropertyName7][_i30],tmpNewAddress,tmpPropertyParentAddress,tmpRootObject);tmpContainerObject["".concat(tmpPropertyParentAddress,".").concat(tmpNewAddress)]=tmpValue;}return tmpContainerObject;}// OBJECT SET
|
|
2090
2309
|
// Note this will not work with a bracket in the same address box set
|
|
2091
2310
|
var _tmpObjectTypeMarkerIndex2=pAddress.indexOf('{}');if(_tmpObjectTypeMarkerIndex2>0){var _tmpObjectPropertyName2=pAddress.substring(0,_tmpObjectTypeMarkerIndex2).trim();if(_typeof(pObject[_tmpObjectPropertyName2])!='object'){// We asked for a set from an array but it isnt' an array.
|
|
2092
2311
|
return false;}// We need to enumerate the Object and grab the addresses from there.
|
|
2093
2312
|
var tmpObjectProperty=pObject[_tmpObjectPropertyName2];var tmpObjectPropertyKeys=Object.keys(tmpObjectProperty);// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
2094
2313
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpObjectPropertyName2);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
2095
|
-
var _tmpContainerObject2={};for(var
|
|
2096
|
-
var _tmpKeepRecord2=this.checkRecordFilters(pAddress,
|
|
2314
|
+
var _tmpContainerObject2={};for(var _i31=0;_i31<tmpObjectPropertyKeys.length;_i31++){var _tmpPropertyParentAddress2="".concat(tmpParentAddress,".").concat(tmpObjectPropertyKeys[_i31]);var _tmpValue4=this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[_i31]],tmpNewAddress,_tmpPropertyParentAddress2,tmpRootObject);// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
2315
|
+
var _tmpKeepRecord2=this.checkRecordFilters(pAddress,_tmpValue4);if(_tmpKeepRecord2){_tmpContainerObject2["".concat(_tmpPropertyParentAddress2,".").concat(tmpNewAddress)]=_tmpValue4;}}return _tmpContainerObject2;}// If there is an object property already named for the sub object, but it isn't an object
|
|
2097
2316
|
// then the system can't set the value in there. Error and abort!
|
|
2098
2317
|
if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
|
|
2099
2318
|
// Continue to manage the parent address for recursion
|
|
@@ -2302,7 +2521,7 @@ this.logInfo=typeof pInfoLog=='function'?pInfoLog:libSimpleLog;this.logError=typ
|
|
|
2302
2521
|
// This will return a mega set of key:value pairs with all possible schema
|
|
2303
2522
|
// permutations and default values (when not an object) and everything else.
|
|
2304
2523
|
return _createClass2(ManyfestObjectAddressGeneration,[{key:"generateAddressses",value:function generateAddressses(pObject,pBaseAddress,pSchema){var tmpBaseAddress=typeof pBaseAddress=='string'?pBaseAddress:'';var tmpSchema=_typeof(pSchema)=='object'?pSchema:{};var tmpObjectType=_typeof(pObject);var tmpSchemaObjectEntry={Address:tmpBaseAddress,Hash:tmpBaseAddress,Name:tmpBaseAddress,// This is so scripts and UI controls can force a developer to opt-in.
|
|
2305
|
-
InSchema:false};if(tmpObjectType=='object'&&pObject==null){tmpObjectType='null';}switch(tmpObjectType){case'string':tmpSchemaObjectEntry.DataType='String';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'number':case'bigint':tmpSchemaObjectEntry.DataType='Number';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'undefined':case'null':tmpSchemaObjectEntry.DataType='Any';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'object':if(Array.isArray(pObject)){tmpSchemaObjectEntry.DataType='Array';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;}for(var i=0;i<pObject.length;i++){this.generateAddressses(pObject[i],"".concat(tmpBaseAddress,"[").concat(i,"]"),tmpSchema);}}else{tmpSchemaObjectEntry.DataType='Object';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;tmpBaseAddress+='.';}var tmpObjectProperties=Object.keys(pObject);for(var
|
|
2524
|
+
InSchema:false};if(tmpObjectType=='object'&&pObject==null){tmpObjectType='null';}switch(tmpObjectType){case'string':tmpSchemaObjectEntry.DataType='String';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'number':case'bigint':tmpSchemaObjectEntry.DataType='Number';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'undefined':case'null':tmpSchemaObjectEntry.DataType='Any';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'object':if(Array.isArray(pObject)){tmpSchemaObjectEntry.DataType='Array';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;}for(var i=0;i<pObject.length;i++){this.generateAddressses(pObject[i],"".concat(tmpBaseAddress,"[").concat(i,"]"),tmpSchema);}}else{tmpSchemaObjectEntry.DataType='Object';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;tmpBaseAddress+='.';}var tmpObjectProperties=Object.keys(pObject);for(var _i32=0;_i32<tmpObjectProperties.length;_i32++){this.generateAddressses(pObject[tmpObjectProperties[_i32]],"".concat(tmpBaseAddress).concat(tmpObjectProperties[_i32]),tmpSchema);}}break;case'symbol':case'function':// Symbols and functions neither recurse nor get added to the schema
|
|
2306
2525
|
break;}return tmpSchema;}}]);}();;module.exports=ManyfestObjectAddressGeneration;},{"./Manyfest-LogToConsole.js":101}],108:[function(require,module,exports){// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
2307
2526
|
//
|
|
2308
2527
|
// For instance:
|
|
@@ -2376,9 +2595,9 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
2376
2595
|
* Manyfest object address-based descriptions and manipulations.
|
|
2377
2596
|
*
|
|
2378
2597
|
* @class Manyfest
|
|
2379
|
-
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi10){function Manyfest(pFable,pManifest,pServiceHash){var
|
|
2380
|
-
|
|
2381
|
-
|
|
2598
|
+
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi10){function Manyfest(pFable,pManifest,pServiceHash){var _this46;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this46=_callSuper(this,Manyfest,[{}]);}else{_this46=_callSuper(this,Manyfest,[pFable,pManifest,pServiceHash]);}_this46.serviceType='Manifest';// Wire in logging
|
|
2599
|
+
_this46.logInfo=libSimpleLog;_this46.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
2600
|
+
_this46.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this46.logInfo,_this46.logError);_this46.objectAddressGetValue=new libObjectAddressGetValue(_this46.logInfo,_this46.logError);_this46.objectAddressSetValue=new libObjectAddressSetValue(_this46.logInfo,_this46.logError);_this46.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this46.logInfo,_this46.logError);if(!('defaultValues'in _this46.options)){_this46.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"PreciseNumber":"0.0","Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!('strict'in _this46.options)){_this46.options.strict=false;}_this46.scope=undefined;_this46.elementAddresses=undefined;_this46.elementHashes=undefined;_this46.elementDescriptors=undefined;_this46.reset();if(_typeof(_this46.options)==='object'){_this46.loadManifest(_this46.options);}_this46.schemaManipulations=new libSchemaManipulation(_this46.logInfo,_this46.logError);_this46.objectAddressGeneration=new libObjectAddressGeneration(_this46.logInfo,_this46.logError);_this46.hashTranslations=new libHashTranslation(_this46.logInfo,_this46.logError);_this46.numberRegex=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;return _assertThisInitialized(_this46);}/*************************************************************************
|
|
2382
2601
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
2383
2602
|
*/ // Reset critical manifest properties
|
|
2384
2603
|
_inherits(Manyfest,_libFableServiceProvi10);return _createClass2(Manyfest,[{key:"reset",value:function reset(){this.scope='DEFAULT';this.elementAddresses=[];this.elementHashes={};this.elementDescriptors={};}},{key:"clone",value:function clone(){// Make a copy of the options in-place
|
|
@@ -2386,7 +2605,7 @@ var tmpNewOptions=JSON.parse(JSON.stringify(this.options));var tmpNewManyfest=ne
|
|
|
2386
2605
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);return tmpNewManyfest;}// Deserialize a Manifest from a string
|
|
2387
2606
|
},{key:"deserialize",value:function deserialize(pManifestString){// TODO: Add guards for bad manifest string
|
|
2388
2607
|
return this.loadManifest(JSON.parse(pManifestString));}// Load a manifest from an object
|
|
2389
|
-
},{key:"loadManifest",value:function loadManifest(pManifest){if(_typeof(pManifest)!=='object'){this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(pManifest),"."));}var tmpManifest=_typeof(pManifest)=='object'?pManifest:{};var tmpDescriptorKeys=Object.keys(_DefaultConfiguration);for(var i=0;i<tmpDescriptorKeys.length;i++){if(!(tmpDescriptorKeys[i]in tmpManifest)){tmpManifest[tmpDescriptorKeys[i]]=JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));}}if('Scope'in tmpManifest){if(typeof tmpManifest.Scope==='string'){this.scope=tmpManifest.Scope;}else{this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(tmpManifest.Scope),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."),tmpManifest);}if('Descriptors'in tmpManifest){if(_typeof(tmpManifest.Descriptors)==='object'){var tmpDescriptionAddresses=Object.keys(tmpManifest.Descriptors);for(var
|
|
2608
|
+
},{key:"loadManifest",value:function loadManifest(pManifest){if(_typeof(pManifest)!=='object'){this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(pManifest),"."));}var tmpManifest=_typeof(pManifest)=='object'?pManifest:{};var tmpDescriptorKeys=Object.keys(_DefaultConfiguration);for(var i=0;i<tmpDescriptorKeys.length;i++){if(!(tmpDescriptorKeys[i]in tmpManifest)){tmpManifest[tmpDescriptorKeys[i]]=JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));}}if('Scope'in tmpManifest){if(typeof tmpManifest.Scope==='string'){this.scope=tmpManifest.Scope;}else{this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(tmpManifest.Scope),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."),tmpManifest);}if('Descriptors'in tmpManifest){if(_typeof(tmpManifest.Descriptors)==='object'){var tmpDescriptionAddresses=Object.keys(tmpManifest.Descriptors);for(var _i33=0;_i33<tmpDescriptionAddresses.length;_i33++){this.addDescriptor(tmpDescriptionAddresses[_i33],tmpManifest.Descriptors[tmpDescriptionAddresses[_i33]]);}}else{this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(tmpManifest.Descriptors),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading object description from manifest object. Property \"Descriptors\" does not exist in the root of the Manifest object."),tmpManifest);}if('HashTranslations'in tmpManifest){if(_typeof(tmpManifest.HashTranslations)==='object'){for(var _i34=0;_i34<tmpManifest.HashTranslations.length;_i34++){// Each translation is
|
|
2390
2609
|
}}}}// Serialize the Manifest to a string
|
|
2391
2610
|
},{key:"serialize",value:function serialize(){return JSON.stringify(this.getManifest());}},{key:"getManifest",value:function getManifest(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))};}// Add a descriptor to the manifest
|
|
2392
2611
|
},{key:"addDescriptor",value:function addDescriptor(pAddress,pDescriptor){if(_typeof(pDescriptor)==='object'){// Add the Address into the Descriptor if it doesn't exist:
|
|
@@ -2429,13 +2648,13 @@ return null;}}}// Enumerate through the schema and populate default values if th
|
|
|
2429
2648
|
},{key:"populateDefaults",value:function populateDefaults(pObject,pOverwriteProperties){return this.populateObject(pObject,pOverwriteProperties,// This just sets up a simple filter to see if there is a default set.
|
|
2430
2649
|
function(pDescriptor){return'Default'in pDescriptor;});}// Forcefully populate all values even if they don't have defaults.
|
|
2431
2650
|
// Based on type, this can do unexpected things.
|
|
2432
|
-
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var
|
|
2651
|
+
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var _this47=this;// Automatically create an object if one isn't passed in.
|
|
2433
2652
|
var tmpObject=_typeof(pObject)==='object'?pObject:{};// Default to *NOT OVERWRITING* properties
|
|
2434
2653
|
var tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverwriteProperties;// This is a filter function, which is passed the schema and allows complex filtering of population
|
|
2435
2654
|
// The default filter function just returns true, populating everything.
|
|
2436
|
-
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=
|
|
2655
|
+
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=_this47.getDescriptor(pAddress);// Check the filter function to see if this is an address we want to set the value for.
|
|
2437
2656
|
if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
|
|
2438
|
-
if(tmpOverwriteProperties||!
|
|
2657
|
+
if(tmpOverwriteProperties||!_this47.checkAddressExists(tmpObject,pAddress)){_this47.setValueAtAddress(tmpObject,pAddress,_this47.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":100,"./Manyfest-LogToConsole.js":101,"./Manyfest-ObjectAddress-CheckAddressExists.js":102,"./Manyfest-ObjectAddress-DeleteValue.js":103,"./Manyfest-ObjectAddress-GetValue.js":104,"./Manyfest-ObjectAddress-SetValue.js":106,"./Manyfest-ObjectAddressGeneration.js":107,"./Manyfest-SchemaManipulation.js":109,"fable-serviceproviderbase":52}],111:[function(require,module,exports){(function(global){(function(){var hasMap=typeof Map==='function'&&Map.prototype;var mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,'size'):null;var mapSize=hasMap&&mapSizeDescriptor&&typeof mapSizeDescriptor.get==='function'?mapSizeDescriptor.get:null;var mapForEach=hasMap&&Map.prototype.forEach;var hasSet=typeof Set==='function'&&Set.prototype;var setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,'size'):null;var setSize=hasSet&&setSizeDescriptor&&typeof setSizeDescriptor.get==='function'?setSizeDescriptor.get:null;var setForEach=hasSet&&Set.prototype.forEach;var hasWeakMap=typeof WeakMap==='function'&&WeakMap.prototype;var weakMapHas=hasWeakMap?WeakMap.prototype.has:null;var hasWeakSet=typeof WeakSet==='function'&&WeakSet.prototype;var weakSetHas=hasWeakSet?WeakSet.prototype.has:null;var hasWeakRef=typeof WeakRef==='function'&&WeakRef.prototype;var weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null;var booleanValueOf=Boolean.prototype.valueOf;var objectToString=Object.prototype.toString;var functionToString=Function.prototype.toString;var $match=String.prototype.match;var $slice=String.prototype.slice;var $replace=String.prototype.replace;var $toUpperCase=String.prototype.toUpperCase;var $toLowerCase=String.prototype.toLowerCase;var $test=RegExp.prototype.test;var $concat=Array.prototype.concat;var $join=Array.prototype.join;var $arrSlice=Array.prototype.slice;var $floor=Math.floor;var bigIntValueOf=typeof BigInt==='function'?BigInt.prototype.valueOf:null;var gOPS=Object.getOwnPropertySymbols;var symToString=typeof Symbol==='function'&&_typeof(Symbol.iterator)==='symbol'?Symbol.prototype.toString:null;var hasShammedSymbols=typeof Symbol==='function'&&_typeof(Symbol.iterator)==='object';// ie, `has-tostringtag/shams
|
|
2439
2658
|
var toStringTag=typeof Symbol==='function'&&Symbol.toStringTag&&(_typeof(Symbol.toStringTag)===hasShammedSymbols?'object':'symbol')?Symbol.toStringTag:null;var isEnumerable=Object.prototype.propertyIsEnumerable;var gPO=(typeof Reflect==='function'?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype// eslint-disable-line no-proto
|
|
2440
2659
|
?function(O){return O.__proto__;// eslint-disable-line no-proto
|
|
2441
2660
|
}:null);function addNumericSeparator(num,str){if(num===Infinity||num===-Infinity||num!==num||num&&num>-1000&&num<1000||$test.call(/e/,str)){return str;}var sepRegex=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof num==='number'){var _int=num<0?-$floor(-num):$floor(num);// trunc(num)
|
|
@@ -2537,78 +2756,78 @@ preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
|
2537
2756
|
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
|
|
2538
2757
|
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
|
|
2539
2758
|
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,AutoRenderViewsAfterInitialize:false,ConfigurationOnlyViews:[],Manifests:{},// The prefix to prepend on all template destination hashes
|
|
2540
|
-
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase14){function PictApplication(pFable,pOptions,pServiceHash){var
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
var tmpManifestKeys=Object.keys(
|
|
2544
|
-
var tmpManifestKey=tmpManifestKeys[i];
|
|
2759
|
+
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase14){function PictApplication(pFable,pOptions,pServiceHash){var _this48;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this48=_callSuper(this,PictApplication,[pFable,tmpOptions,pServiceHash]);_this48.serviceType='PictApplication';// Convenience and consistency naming
|
|
2760
|
+
_this48.pict=_this48.fable;// Wire in the essential Pict state
|
|
2761
|
+
_this48.AppData=_this48.fable.AppData;_this48.initializeTimestamp=false;_this48.lastSolvedTimestamp=false;_this48.lastMarshalFromViewsTimestamp=false;_this48.lastMarshalToViewsTimestamp=false;_this48.lastAutoRenderTimestamp=false;// Load all the manifests for the application
|
|
2762
|
+
var tmpManifestKeys=Object.keys(_this48.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
2763
|
+
var tmpManifestKey=tmpManifestKeys[i];_this48.fable.instantiateServiceProvider('Manifest',_this48.options.Manifests[tmpManifestKey],tmpManifestKey);}}return _this48;}/* -------------------------------------------------------------------------- */ /* 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.
|
|
2545
2764
|
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)
|
|
2546
|
-
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var
|
|
2547
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var
|
|
2548
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
2549
|
-
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){
|
|
2765
|
+
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i35=0;_i35<tmpProvidersToSolve.length;_i35++){tmpProvidersToSolve[_i35].solve(tmpProvidersToSolve[_i35]);}this.onBeforeSolve();// Now walk through any loaded views and initialize them as well.
|
|
2766
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var _i36=0;_i36<tmpLoadedViews.length;_i36++){var tmpView=this.pict.views[tmpLoadedViews[_i36]];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)
|
|
2767
|
+
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i37=0;_i37<tmpViewsToSolve.length;_i37++){tmpViewsToSolve[_i37].solve();}this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this49=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
|
|
2768
|
+
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){_this49.log.error("PictApp [".concat(_this49.UUID,"]::[").concat(_this49.Hash,"] ").concat(_this49.options.Name," solveAsync Auto Callback Error: ").concat(pError),pError);}};}// Walk through any loaded providers and solve them as well.
|
|
2550
2769
|
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)
|
|
2551
|
-
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var
|
|
2552
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var
|
|
2553
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var
|
|
2770
|
+
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i38=0;_i38<tmpProvidersToSolve.length;_i38++){tmpAnticipate.anticipate(tmpProvidersToSolve[_i38].solveAsync.bind(tmpProvidersToSolve[_i38]));}// Walk through any loaded views and solve them as well.
|
|
2771
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var _i39=0;_i39<tmpLoadedViews.length;_i39++){var tmpView=this.pict.views[tmpLoadedViews[_i39]];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)
|
|
2772
|
+
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i40=0;_i40<tmpViewsToSolve.length;_i40++){tmpAnticipate.anticipate(tmpViewsToSolve[_i40].solveAsync.bind(tmpViewsToSolve[_i40]));}tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this49.pict.LogNoisiness>2){_this49.log.trace("PictApp [".concat(_this49.UUID,"]::[").concat(_this49.Hash,"] ").concat(_this49.options.Name," solveAsync() complete."));}_this49.lastSolvedTimestamp=_this49.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();if('ConfigurationOnlyViews'in this.options){// Load all the configuration only views
|
|
2554
2773
|
for(var i=0;i<this.options.ConfigurationOnlyViews.length;i++){var tmpViewIdentifier=typeof this.options.ConfigurationOnlyViews[i].ViewIdentifier==='undefined'?"AutoView-".concat(this.fable.getUUID()):this.options.ConfigurationOnlyViews[i].ViewIdentifier;this.log.info("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," adding configuration only view: ").concat(tmpViewIdentifier));this.pict.addView(tmpViewIdentifier,this.options.ConfigurationOnlyViews[i]);}}this.onInitialize();// Walk through any loaded providers and initialize them as well.
|
|
2555
|
-
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var
|
|
2556
|
-
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
2557
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var
|
|
2558
|
-
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
2774
|
+
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var _i41=0;_i41<tmpLoadedProviders.length;_i41++){var tmpProvider=this.pict.providers[tmpLoadedProviders[_i41]];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)
|
|
2775
|
+
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i42=0;_i42<tmpProvidersToInitialize.length;_i42++){tmpProvidersToInitialize[_i42].initialize();}// Now walk through any loaded views and initialize them as well.
|
|
2776
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var _i43=0;_i43<tmpLoadedViews.length;_i43++){var tmpView=this.pict.views[tmpLoadedViews[_i43]];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)
|
|
2777
|
+
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i44=0;_i44<tmpViewsToInitialize.length;_i44++){tmpViewsToInitialize[_i44].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
|
|
2559
2778
|
this.solve();}// Now check and see if we should automatically render as well
|
|
2560
2779
|
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
|
|
2561
|
-
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
|
|
2562
|
-
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){
|
|
2780
|
+
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 _this50=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
|
|
2781
|
+
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){_this50.log.error("PictApp [".concat(_this50.UUID,"]::[").concat(_this50.Hash,"] ").concat(_this50.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..."));}if('ConfigurationOnlyViews'in this.options){// Load all the configuration only views
|
|
2563
2782
|
for(var i=0;i<this.options.ConfigurationOnlyViews.length;i++){var tmpViewIdentifier=typeof this.options.ConfigurationOnlyViews[i].ViewIdentifier==='undefined'?"AutoView-".concat(this.fable.getUUID()):this.options.ConfigurationOnlyViews[i].ViewIdentifier;this.log.info("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," adding configuration only view: ").concat(tmpViewIdentifier));this.pict.addView(tmpViewIdentifier,this.options.ConfigurationOnlyViews[i]);}}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));// Walk through any loaded providers and solve them as well.
|
|
2564
|
-
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var
|
|
2565
|
-
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
2783
|
+
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var _i45=0;_i45<tmpLoadedProviders.length;_i45++){var tmpProvider=this.pict.providers[tmpLoadedProviders[_i45]];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)
|
|
2784
|
+
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i46=0;_i46<tmpProvidersToInitialize.length;_i46++){tmpAnticipate.anticipate(tmpProvidersToInitialize[_i46].initializeAsync.bind(tmpProvidersToInitialize[_i46]));}// Now walk through any loaded views and initialize them as well.
|
|
2566
2785
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
2567
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var
|
|
2786
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var _i47=0;_i47<tmpLoadedViews.length;_i47++){var tmpView=this.pict.views[tmpLoadedViews[_i47]];if(tmpView.options.AutoInitialize){tmpViewsToInitialize.push(tmpView);}}// Sort the views by their priority
|
|
2568
2787
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
2569
|
-
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
2788
|
+
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i48=0;_i48<tmpViewsToInitialize.length;_i48++){var _tmpView=tmpViewsToInitialize[_i48];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){_this50.initializeTimestamp=_this50.fable.log.getTimeStamp();if(_this50.pict.LogNoisiness>2){_this50.log.trace("PictApp [".concat(_this50.UUID,"]::[").concat(_this50.Hash,"] ").concat(_this50.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?
|
|
2570
2789
|
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.
|
|
2571
|
-
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
|
|
2572
|
-
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){
|
|
2573
|
-
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
|
|
2574
|
-
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
|
|
2575
|
-
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){
|
|
2576
|
-
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
|
|
2577
|
-
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
|
|
2578
|
-
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){
|
|
2790
|
+
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 _i49=0;_i49<tmpViewsToMarshalFromViews.length;_i49++){tmpViewsToMarshalFromViews[_i49].marshalFromView();}this.onMarshalFromViews();this.onAfterMarshalFromViews();this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var _this51=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
2791
|
+
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){_this51.log.error("PictApp [".concat(_this51.UUID,"]::[").concat(_this51.Hash,"] ").concat(_this51.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.
|
|
2792
|
+
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 _i50=0;_i50<tmpViewsToMarshalFromViews.length;_i50++){tmpAnticipate.anticipate(tmpViewsToMarshalFromViews[_i50].marshalFromViewAsync.bind(tmpViewsToMarshalFromViews[_i50]));}tmpAnticipate.anticipate(this.onMarshalFromViewsAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalFromViewsAsync.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," marshalFromViewsAsync() complete."));}_this51.lastMarshalFromViewsTimestamp=_this51.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.
|
|
2793
|
+
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 _i51=0;_i51<tmpViewsToMarshalToViews.length;_i51++){tmpViewsToMarshalToViews[_i51].marshalToView();}this.onMarshalToViews();this.onAfterMarshalToViews();this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"marshalToViewsAsync",value:function marshalToViewsAsync(fCallback){var _this52=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
2794
|
+
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){_this52.log.error("PictApp [".concat(_this52.UUID,"]::[").concat(_this52.Hash,"] ").concat(_this52.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.
|
|
2795
|
+
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 _i52=0;_i52<tmpViewsToMarshalToViews.length;_i52++){tmpAnticipate.anticipate(tmpViewsToMarshalToViews[_i52].marshalToViewAsync.bind(tmpViewsToMarshalToViews[_i52]));}tmpAnticipate.anticipate(this.onMarshalToViewsAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalToViewsAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this52.pict.LogNoisiness>2){_this52.log.trace("PictApp [".concat(_this52.UUID,"]::[").concat(_this52.Hash,"] ").concat(_this52.options.Name," marshalToViewsAsync() complete."));}_this52.lastMarshalToViewsTimestamp=_this52.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!=='string'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash!=='string'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress!=='string'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress!=='string'?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
|
|
2796
|
+
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 _this53=this;var tmpViewIdentifier=typeof pViewIdentifier!=='string'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash!=='string'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress!=='string'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress!=='string'?this.options.MainViewportDefaultDataAddress:pTemplateDataAddress;// Allow the callback to be passed in as the last parameter no matter what
|
|
2797
|
+
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){_this53.log.error("PictApp [".concat(_this53.UUID,"]::[").concat(_this53.Hash,"] ").concat(_this53.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 _this54=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
|
|
2579
2798
|
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
2580
2799
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
2581
|
-
tmpLoadedViews.sort(function(a,b){return
|
|
2582
|
-
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){
|
|
2800
|
+
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){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 _this55=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
2801
|
+
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){_this55.log.error("PictApp [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.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
|
|
2583
2802
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
2584
2803
|
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
2585
2804
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
2586
|
-
tmpLoadedViews.sort(function(a,b){return
|
|
2805
|
+
tmpLoadedViews.sort(function(a,b){return _this55.pict.views[a].options.AutoRenderOrdinal-_this55.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){_this55.lastAutoRenderTimestamp=_this55.fable.log.getTimeStamp();if(_this55.pict.LogNoisiness>0){_this55.log.trace("PictApp [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.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.
|
|
2587
2806
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
2588
|
-
AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase15){function PictProvider(pFable,pOptions,pServiceHash){var
|
|
2589
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);
|
|
2590
|
-
|
|
2591
|
-
|
|
2807
|
+
AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase15){function PictProvider(pFable,pOptions,pServiceHash){var _this56;_classCallCheck2(this,PictProvider);// Intersect default options, parent constructor, service information
|
|
2808
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);_this56=_callSuper(this,PictProvider,[pFable,tmpOptions,pServiceHash]);if(!_this56.options.ProviderIdentifier){_this56.options.ProviderIdentifier="AutoProviderID-".concat(_this56.fable.getUUID());}_this56.serviceType='PictProvider';// Convenience and consistency naming
|
|
2809
|
+
_this56.pict=_this56.fable;// Wire in the essential Pict application state
|
|
2810
|
+
_this56.AppData=_this56.pict.AppData;_this56.initializeTimestamp=false;_this56.lastSolvedTimestamp=false;for(var i=0;i<_this56.options.Templates.length;i++){var tmpDefaultTemplate=_this56.options.Templates[i];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this56.log.error("PictProvider [".concat(_this56.UUID,"]::[").concat(_this56.Hash,"] ").concat(_this56.options.ProviderIdentifier," could not load Default Template ").concat(i," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictProvider [".concat(_this56.UUID,"]::[").concat(_this56.Hash,"] ").concat(_this56.options.ProviderIdentifier," options object.");}_this56.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}return _this56;}/* -------------------------------------------------------------------------- */ /* 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 _this57=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){_this57.initializeTimestamp=_this57.pict.log.getTimeStamp();if(_this57.pict.LogNoisiness>0){_this57.log.info("PictProvider [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.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?
|
|
2592
2811
|
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.
|
|
2593
2812
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
2594
2813
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
2595
2814
|
// After the App initializes, render will be called as soon as it's added.
|
|
2596
|
-
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
|
|
2597
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);
|
|
2598
|
-
|
|
2599
|
-
|
|
2815
|
+
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 _this58;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
2816
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this58=_callSuper(this,PictView,[pFable,tmpOptions,pServiceHash]);if(!_this58.options.ViewIdentifier){_this58.options.ViewIdentifier="AutoViewID-".concat(_this58.fable.getUUID());}_this58.serviceType='PictView';// Convenience and consistency naming
|
|
2817
|
+
_this58.pict=_this58.fable;// Wire in the essential Pict application state
|
|
2818
|
+
_this58.AppData=_this58.pict.AppData;_this58.initializeTimestamp=false;_this58.lastSolvedTimestamp=false;_this58.lastRenderedTimestamp=false;_this58.lastMarshalFromViewTimestamp=false;_this58.lastMarshalToViewTimestamp=false;// Load all templates from the array in the options
|
|
2600
2819
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
2601
|
-
for(var i=0;i<
|
|
2820
|
+
for(var i=0;i<_this58.options.Templates.length;i++){var tmpTemplate=_this58.options.Templates[i];if(!('Hash'in tmpTemplate)||!('Template'in tmpTemplate)){_this58.log.error("PictView [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.options.ViewIdentifier," options object.");}_this58.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
2602
2821
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
2603
|
-
for(var
|
|
2604
|
-
if(
|
|
2822
|
+
for(var _i53=0;_i53<_this58.options.DefaultTemplates.length;_i53++){var tmpDefaultTemplate=_this58.options.DefaultTemplates[_i53];if(!('Postfix'in tmpDefaultTemplate)||!('Template'in tmpDefaultTemplate)){_this58.log.error("PictView [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.options.ViewIdentifier," could not load Default Template ").concat(_i53," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.options.ViewIdentifier," options object.");}_this58.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load the CSS if it's available
|
|
2823
|
+
if(_this58.options.CSS){var tmpCSSHash=_this58.options.CSSHash?_this58.options.CSSHash:"View-".concat(_this58.options.ViewIdentifier);var tmpCSSProvider=_this58.options.CSSProvider?_this58.options.CSSProvider:tmpCSSHash;_this58.pict.CSSMap.addCSS(tmpCSSHash,_this58.options.CSS,tmpCSSProvider,_this58.options.CSSPriority);}// Load all renderables
|
|
2605
2824
|
// Renderables are launchable renderable instructions with templates
|
|
2606
2825
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
2607
2826
|
// The only parts that are necessary are Identifier and Template
|
|
2608
2827
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
2609
|
-
|
|
2828
|
+
_this58.renderables={};for(var _i54=0;_i54<_this58.options.Renderables.length;_i54++){var tmpRenderable=_this58.options.Renderables[_i54];_this58.addRenderable(_this58.options.Renderables[_i54]);}return _this58;}_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.
|
|
2610
2829
|
// Use theirs instead!
|
|
2611
|
-
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
|
|
2830
|
+
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 _this59=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){_this59.initializeTimestamp=_this59.pict.log.getTimeStamp();if(_this59.pict.LogNoisiness>0){_this59.log.info("PictView [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.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?
|
|
2612
2831
|
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
|
|
2613
2832
|
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
|
|
2614
2833
|
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
|
|
@@ -2616,13 +2835,13 @@ var tmpContent=this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,
|
|
|
2616
2835
|
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
|
|
2617
2836
|
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?
|
|
2618
2837
|
default:this.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);break;}// Execute the developer-overridable post-render behavior
|
|
2619
|
-
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var
|
|
2620
|
-
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){
|
|
2621
|
-
|
|
2622
|
-
switch(tmpRenderable.RenderMethod){case'append':
|
|
2623
|
-
var tmpExistingContent=
|
|
2624
|
-
|
|
2625
|
-
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
|
|
2838
|
+
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this60=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
|
|
2839
|
+
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){_this60.log.error("PictView [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.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){_this60.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);_this60.onBeforeRenderAsync(fOnBeforeRenderCallback);});tmpAnticipate.anticipate(function(fAsyncTemplateCallback){// Render the template (asynchronously)
|
|
2840
|
+
_this60.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this60.log.error("PictView [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it did not parse the template."),pError);return fAsyncTemplateCallback(pError);}if(_this60.pict.LogNoisiness>0){_this60.log.trace("PictView [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.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
|
|
2841
|
+
switch(tmpRenderable.RenderMethod){case'append':_this60.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,pContent);break;case'prepend':_this60.pict.ContentAssignment.prependContent(tmpRenderDestinationAddress,pContent);break;case'append_once':// Try to find the content in the destination address
|
|
2842
|
+
var tmpExistingContent=_this60.pict.ContentAssignment.getElement("#".concat(tmpRenderableHash));if(tmpExistingContent.length<1){_this60.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,pContent);}case'replace':default:_this60.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);break;}// Execute the developer-overridable asynchronous post-render behavior
|
|
2843
|
+
_this60.lastRenderedTimestamp=_this60.pict.log.getTimeStamp();return fAsyncTemplateCallback();},[_this60]);});tmpAnticipate.anticipate(function(fOnAfterRenderCallback){_this60.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);_this60.onAfterRenderAsync(fOnAfterRenderCallback);});tmpAnticipate.wait(tmpCallback);}},{key:"renderDefaultAsync",value:function renderDefaultAsync(fCallback){// Render the default renderable
|
|
2844
|
+
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 _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," 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){_this61.log.error("PictView [".concat(_this61.UUID,"]::[").concat(_this61.Hash,"] ").concat(_this61.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(_this61.pict.LogNoisiness>2){_this61.log.trace("PictView [".concat(_this61.UUID,"]::[").concat(_this61.Hash,"] ").concat(_this61.options.ViewIdentifier," solveAsync() complete."));}_this61.lastSolvedTimestamp=_this61.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 _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," 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){_this62.log.error("PictView [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.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(_this62.pict.LogNoisiness>2){_this62.log.trace("PictView [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.options.ViewIdentifier," marshalFromViewAsync() complete."));}_this62.lastMarshalFromViewTimestamp=_this62.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 _this63=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){_this63.log.error("PictView [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.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(_this63.pict.LogNoisiness>2){_this63.log.trace("PictView [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ViewIdentifier," marshalToViewAsync() complete."));}_this63.lastMarshalToViewTimestamp=_this63.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){/**
|
|
2626
2845
|
* Precedent Meta-Templating
|
|
2627
2846
|
*
|
|
2628
2847
|
* @license MIT
|
|
@@ -2725,7 +2944,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
2725
2944
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
2726
2945
|
* @return {bool} True if adding the pattern was successful
|
|
2727
2946
|
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
|
|
2728
|
-
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var
|
|
2947
|
+
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var _i55=0;_i55<tmpPatternEnd.length;_i55++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i55],_i55);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(){return fParser;}:function(pData){return pData;};return true;}}]);}();module.exports=WordTree;},{}],120:[function(require,module,exports){// shim for using process in browser
|
|
2729
2948
|
var process=module.exports={};// cached from whatever global is present so that test runners that stub it
|
|
2730
2949
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
2731
2950
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
@@ -3931,57 +4150,57 @@ if(pPictApplication&&'default_configuration'in pPictApplication&&'pict_configura
|
|
|
3931
4150
|
if(document.readyState!='loading')fCallback();// Modern browsers have event listener capabilities
|
|
3932
4151
|
else if(document.addEventListener)document.addEventListener('DOMContentLoaded',fCallback);// IE <= 8 and ... other abominations
|
|
3933
4152
|
else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')fCallback();});};},{}],162:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
|
|
3934
|
-
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase17){function PictCSS(pFable,pOptions,pServiceHash){var
|
|
3935
|
-
if(typeof
|
|
4153
|
+
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase17){function PictCSS(pFable,pOptions,pServiceHash){var _this64;_classCallCheck2(this,PictCSS);_this64=_callSuper(this,PictCSS,[pFable,pOptions,pServiceHash]);// No merging of options necessary
|
|
4154
|
+
if(typeof _this64.options.CSSElementAddress==='undefined'){_this64.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}_this64.inlineCSSMap={};return _this64;}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
|
|
3936
4155
|
// Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
|
|
3937
|
-
_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
|
|
3938
|
-
tmpCSSHashes.sort(function(a,b){return
|
|
4156
|
+
_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 _this65=this;var tmpCSS='';var tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
|
|
4157
|
+
tmpCSSHashes.sort(function(a,b){return _this65.inlineCSSMap[a].Priority-_this65.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
|
|
3939
4158
|
},{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;/**
|
|
3940
4159
|
* Class for moving content around in the DOM.
|
|
3941
4160
|
*/var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase18){/**
|
|
3942
4161
|
* @param {object} pFable - The Fable library instance.
|
|
3943
4162
|
* @param {object} pOptions - The options for the service.
|
|
3944
4163
|
* @param {object} pServiceHash - The hash of services.
|
|
3945
|
-
*/function PictContentAssignment(pFable,pOptions,pServiceHash){var
|
|
3946
|
-
|
|
3947
|
-
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){
|
|
3948
|
-
|
|
4164
|
+
*/function PictContentAssignment(pFable,pOptions,pServiceHash){var _this66;_classCallCheck2(this,PictContentAssignment);_this66=_callSuper(this,PictContentAssignment,[pFable,pOptions,pServiceHash]);_this66.serviceType='PictContentAssignment';// Check to see if we are running in a browser
|
|
4165
|
+
_this66.inBrowser=false;_this66.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this66.inBrowser=true;// Now check that the browser has a document object
|
|
4166
|
+
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this66.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
|
|
4167
|
+
_this66.hasJquery=false;_this66.jQuery=false;if(_this66.inBrowser&&typeof window.jQuery!=='undefined'){_this66.hasJquery=true;}/**
|
|
3949
4168
|
* Set this to override the default mechanism for setting the content of a DOM element.
|
|
3950
4169
|
*
|
|
3951
4170
|
* @type {Function}
|
|
3952
4171
|
* @param {string} pAddress - The address of the element. (a CSS selector)
|
|
3953
4172
|
* @param {string} pContent - The content to set.
|
|
3954
|
-
*/
|
|
4173
|
+
*/_this66.customAssignFunction=false;/**
|
|
3955
4174
|
* Set this to override the default mechanism for prepend content to a DOM element.
|
|
3956
4175
|
*
|
|
3957
4176
|
* @type {Function}
|
|
3958
4177
|
* @param {string} pAddress - The address of the element. (a CSS selector)
|
|
3959
4178
|
* @param {string} pContent - The content to prepend.
|
|
3960
|
-
*/
|
|
4179
|
+
*/_this66.customPrependFunction=false;/**
|
|
3961
4180
|
* Set this to override the default mechanism for appending content to a DOM element.
|
|
3962
4181
|
*
|
|
3963
4182
|
* @type {Function}
|
|
3964
4183
|
* @param {string} pAddress - The address of the element. (a CSS selector)
|
|
3965
4184
|
* @param {string} pContent - The content to append.
|
|
3966
|
-
*/
|
|
4185
|
+
*/_this66.customAppendFunction=false;/**
|
|
3967
4186
|
* Set this to override the default mechanism for reading content from the DOM.
|
|
3968
4187
|
*
|
|
3969
4188
|
* @type {Function}
|
|
3970
4189
|
* @param {string} pAddress - The address of the element. (a CSS selector)
|
|
3971
4190
|
* @return {string} - The content of the element.
|
|
3972
|
-
*/
|
|
4191
|
+
*/_this66.customReadFunction=false;/**
|
|
3973
4192
|
* Set this to override the default mechanism for getting elements.
|
|
3974
4193
|
*
|
|
3975
4194
|
* @type {Function}
|
|
3976
4195
|
* @param {string} pAddress - The address of the element.
|
|
3977
4196
|
* @return {Array<any>} - The matched elements.
|
|
3978
|
-
*/
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
4197
|
+
*/_this66.customGetElementFunction=false;// API Consumers can also craft their own attribute read function
|
|
4198
|
+
_this66.customReadAttributeFunction=false;// API Consumers can also craft their own attribute set function
|
|
4199
|
+
_this66.customSetAttributeFunction=false;// API Consumers can also craft their own attribute remove function
|
|
4200
|
+
_this66.customRemoveAttributeFunction=false;// API Consumers can also craft their own class read function
|
|
4201
|
+
_this66.customReadClassFunction=false;// API Consumers can also craft their own class set function
|
|
4202
|
+
_this66.customSetClassFunction=false;// API Consumers can also craft their own class remove function
|
|
4203
|
+
_this66.customRemoveClassFunction=false;return _this66;}/**
|
|
3985
4204
|
* Get an element from the DOM.
|
|
3986
4205
|
*
|
|
3987
4206
|
* @param {string} pAddress - The address of the element.
|
|
@@ -3990,7 +4209,7 @@ _this65.customRemoveClassFunction=false;return _this65;}/**
|
|
|
3990
4209
|
var tmpElementSet=[];for(var i=0;i<tmpElements.length;i++){tmpElementSet.push(tmpElements[i]);}return tmpElementSet;}}else if(this.inBrowser&&this.hasDocument){return window.document.querySelectorAll(pAddress);}else{// Just log it out for now
|
|
3991
4210
|
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
4211
|
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)
|
|
3993
|
-
var _tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var
|
|
4212
|
+
var _tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var _i56=0;_i56<_tmpTargetElementSet.length;_i56++){switch(_tmpTargetElementSet[_i56].tagName){case'INPUT':case'SELECT':case'TEXTAREA':_tmpTargetElementSet[_i56].value=pContent;break;case'SCRIPT':_tmpTargetElementSet[_i56].text=pContent;break;default:_tmpTargetElementSet[_i56].innerHTML=pContent;}}}else{// Just log it out for now
|
|
3994
4213
|
this.log.trace("PICT Content ASSIGN to [".concat(pAddress,"]:"),pContent);}}/**
|
|
3995
4214
|
* Append content to an element.
|
|
3996
4215
|
*
|
|
@@ -4045,27 +4264,27 @@ var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass
|
|
|
4045
4264
|
* @param {string} pClass - The class to check for.
|
|
4046
4265
|
*
|
|
4047
4266
|
* @return {boolean} - Whether the element has the class. If multiple elements are matched, returns true if any have the class.
|
|
4048
|
-
*/},{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++){if(tmpTargetElementSet[i].classList.contains(pClass)){return true;}}return false;}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
|
|
4267
|
+
*/},{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++){if(tmpTargetElementSet[i].classList.contains(pClass)){return true;}}return false;}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 _this67;_classCallCheck2(this,PictDataProvider);_this67=_callSuper(this,PictDataProvider,[pFable,pOptions,pServiceHash]);_this67.serviceType='PictDataProvider';return _this67;}_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 _this68;_classCallCheck2(this,PictMeadowEntityProvider);_this68=_callSuper(this,PictMeadowEntityProvider,[pFable,pOptions,pServiceHash]);_this68.serviceType='PictMeadowProvider';if(_this68.fable.settings.PictDefaultURLPrefix){_this68.options.urlPrefix=_this68.fable.settings.PictDefaultURLPrefix;}else if(!_this68.options.urlPrefix){_this68.options.urlPrefix='/1.0/';}if(_this68.fable.settings.PictDefaultDownloadBatchSize){_this68.options.downloadBatchSize=_this68.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this68.options.downloadBatchSize){_this68.options.downloadBatchSize=100;}_this68.restClient=_this68.fable.instantiateServiceProviderWithoutRegistration('RestClient');_this68.cache={};_this68.prepareRequestOptions=function(pOptions){return pOptions;};return _this68;}_inherits(PictMeadowEntityProvider,_libFableServiceBase20);return _createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
|
|
4049
4268
|
if(!(pEntity in this.cache)){this.cache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
4050
4269
|
// For now cache for 30 seconds.
|
|
4051
4270
|
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.
|
|
4052
|
-
this.cache[pEntity].prune(function(){var
|
|
4271
|
+
this.cache[pEntity].prune(function(){var _this69=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){_this69.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?
|
|
4053
4272
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
4054
4273
|
// If the list is mega-long we can parse it and break it into chunks.
|
|
4055
4274
|
this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
4056
|
-
this.cache[pEntity].prune(function(){var
|
|
4057
|
-
tmpDownloadURIFragments.push("".concat(
|
|
4058
|
-
|
|
4275
|
+
this.cache[pEntity].prune(function(){var _this70=this;return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this70.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=_this70.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
4276
|
+
tmpDownloadURIFragments.push("".concat(_this70.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)
|
|
4277
|
+
_this70.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){_this70.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
|
|
4059
4278
|
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){/**
|
|
4060
4279
|
* @param {Object} pFable - The Fable Framework instance
|
|
4061
4280
|
* @param {Object} pOptions - The options for the service
|
|
4062
4281
|
* @param {String} pServiceHash - The hash of the service
|
|
4063
|
-
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var
|
|
4282
|
+
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this71;_classCallCheck2(this,PictTemplateProvider);_this71=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this71.serviceType='PictTemplateProvider';_this71.templates={};_this71.templateSources={};// Default templates are stored by prefix.
|
|
4064
4283
|
// The longest prefix match is used.
|
|
4065
4284
|
// Case sensitive.
|
|
4066
|
-
|
|
4285
|
+
_this71.defaultTemplates=[];/**
|
|
4067
4286
|
* @property {Function} loadTemplateFunction - The function to load a template
|
|
4068
|
-
*/
|
|
4287
|
+
*/_this71.loadTemplateFunction=function(){return false;};return _this71;}/**
|
|
4069
4288
|
* Add a template to the provider.
|
|
4070
4289
|
*
|
|
4071
4290
|
* @param {String} pTemplateHash - The hash of the template
|
|
@@ -4108,7 +4327,7 @@ if(!(pTemplateHash in this.templates)){this.checkDefaultTemplateHash(pTemplateHa
|
|
|
4108
4327
|
* @param {Object} pFable - The Fable Framework instance
|
|
4109
4328
|
* @param {Object} pOptions - The options for the service
|
|
4110
4329
|
* @param {String} pServiceHash - The hash of the service
|
|
4111
|
-
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var
|
|
4330
|
+
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this72;_classCallCheck2(this,PictTemplateProvider);_this72=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);_this72.pict=_this72.fable;_this72.serviceType='PictTemplate';return _this72;}/**
|
|
4112
4331
|
* Render a template expression, returning a string with the resulting content.
|
|
4113
4332
|
*
|
|
4114
4333
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -4146,33 +4365,33 @@ if(!(pTemplateHash in this.templates)){this.checkDefaultTemplateHash(pTemplateHa
|
|
|
4146
4365
|
* Pict management object.
|
|
4147
4366
|
*/var Pict=/*#__PURE__*/function(_libFable){/**
|
|
4148
4367
|
* @param {Object<String, any>} pSettings - The settings for the Pict instance.
|
|
4149
|
-
*/function Pict(pSettings){var
|
|
4368
|
+
*/function Pict(pSettings){var _this73;_classCallCheck2(this,Pict);_this73=_callSuper(this,Pict,[pSettings]);_this73.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");/**
|
|
4150
4369
|
* The templateProvider provides a basic key->template mapping with default fallback capabilities
|
|
4151
4370
|
*
|
|
4152
4371
|
* @type {PictTemplateProvider}
|
|
4153
|
-
*/
|
|
4372
|
+
*/_this73.TemplateProvider=null;_this73.addAndInstantiateServiceType('TemplateProvider',PictTemplateProvider);/**
|
|
4154
4373
|
* The meadow entity provider.
|
|
4155
4374
|
*
|
|
4156
4375
|
* @type {PictMeadowEntityProvider}
|
|
4157
|
-
*/
|
|
4376
|
+
*/_this73.EntityProvider=null;_this73.addAndInstantiateServiceType('EntityProvider',PictMeadowEntityProvider);/**
|
|
4158
4377
|
* The data provider.
|
|
4159
4378
|
*
|
|
4160
4379
|
* @type {PictDataProvider}
|
|
4161
|
-
*/
|
|
4380
|
+
*/_this73.DataProvider=null;_this73.addAndInstantiateServiceType('DataProvider',PictDataProvider);/**
|
|
4162
4381
|
* The content assignment module.
|
|
4163
4382
|
*
|
|
4164
4383
|
* @type {PictContentAssignment}
|
|
4165
|
-
*/
|
|
4384
|
+
*/_this73.ContentAssignment=null;_this73.addAndInstantiateServiceType('ContentAssignment',PictContentAssignment);/**
|
|
4166
4385
|
* The CSS module.
|
|
4167
4386
|
*
|
|
4168
4387
|
* @type {PictCSS}
|
|
4169
4388
|
* @public
|
|
4170
|
-
*/
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
if(
|
|
4175
|
-
|
|
4389
|
+
*/_this73.CSSMap=null;_this73.addAndInstantiateServiceType('CSSMap',PictCSS);_this73.addServiceType('PictTemplate',require('./Pict-Template.js'));_this73.instantiateServiceProvider('MetaTemplate');_this73.instantiateServiceProvider('DataGeneration');_this73.manifest=_this73.instantiateServiceProvider('Manifest');_this73.AppData={};if('DefaultAppData'in _this73.fable.settings){_this73.AppData=_this73.fable.settings.DefaultAppData;}_this73.Bundle={};// Log noisness goes from 0 - 5, where 5 is show me everything.
|
|
4390
|
+
_this73.LogNoisiness=0;// Although we have log noisiness, sometimes we need control flow without all the other noise for hard to diagnose interpreters.
|
|
4391
|
+
_this73.LogControlFlow=false;// And an easy way to be introspective about data at various locations
|
|
4392
|
+
_this73.LogControlFlowWatchAddressList=[];// Load manifest sets
|
|
4393
|
+
if(_this73.settings.Manifests){_this73.loadManifestSet(_this73.settings.Manifests);}_this73._DefaultPictTemplatesInitialized=false;_this73.initializePictTemplateEngine();_this73.addServiceType('PictView',require('pict-view'));_this73.addServiceType('PictProvider',require('pict-provider'));_this73.addServiceType('PictApplication',require('pict-application'));// Expose the named views directly, through a convenience accessor
|
|
4394
|
+
_this73.providers=_this73.servicesMap.PictProvider;_this73.views=_this73.servicesMap.PictView;return _this73;}/**
|
|
4176
4395
|
* Load manifests in as Hashed services
|
|
4177
4396
|
*
|
|
4178
4397
|
* @param {Object<String, String>} pManifestSet - The manifest set to load.
|
|
@@ -4263,7 +4482,7 @@ this.addTemplate(require("./templates/debugging/Pict-Template-Breakpoint.js"));t
|
|
|
4263
4482
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
4264
4483
|
*
|
|
4265
4484
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
4266
|
-
*/},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var
|
|
4485
|
+
*/},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var _this74=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(_this74.LogControlFlow&&_this74.LogNoisiness>1){_this74.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;}}/**
|
|
4267
4486
|
* Parse a template by hash.
|
|
4268
4487
|
*
|
|
4269
4488
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -4282,8 +4501,8 @@ if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplate(tmpTempla
|
|
|
4282
4501
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
4283
4502
|
*
|
|
4284
4503
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
4285
|
-
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var
|
|
4286
|
-
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return
|
|
4504
|
+
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this75=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
4505
|
+
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this75.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],null,pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i57=0;_i57<tmpKeys.length;_i57++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i57]],null,pContextArray);}}return tmpValue;}else{return'';}}}/**
|
|
4287
4506
|
* Parse a template set by hash.
|
|
4288
4507
|
*
|
|
4289
4508
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -4396,11 +4615,11 @@ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".c
|
|
|
4396
4615
|
* @param {Object} pFable - The Fable Framework instance
|
|
4397
4616
|
* @param {Object} pOptions - The options for the service
|
|
4398
4617
|
* @param {String} pServiceHash - The hash of the service
|
|
4399
|
-
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var
|
|
4618
|
+
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var _this76;_classCallCheck2(this,PictTemplateProviderData);_this76=_callSuper(this,PictTemplateProviderData,[pFable,pOptions,pServiceHash]);_this76.addPattern('{~Data:','~}');_this76.addPattern('{~D:','~}');return _this76;}_inherits(PictTemplateProviderData,_libPictTemplate);return _createClass2(PictTemplateProviderData,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpRecord=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray);}if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;}}]);}(libPictTemplate);module.exports=PictTemplateProviderData;},{"../Pict-Template.js":167}],172:[function(require,module,exports){var libPictTemplate=require('../Pict-Template.js');var PictTemplateProviderEntity=/*#__PURE__*/function(_libPictTemplate2){/**
|
|
4400
4619
|
* @param {Object} pFable - The Fable Framework instance
|
|
4401
4620
|
* @param {Object} pOptions - The options for the service
|
|
4402
4621
|
* @param {String} pServiceHash - The hash of the service
|
|
4403
|
-
*/function PictTemplateProviderEntity(pFable,pOptions,pServiceHash){var
|
|
4622
|
+
*/function PictTemplateProviderEntity(pFable,pOptions,pServiceHash){var _this77;_classCallCheck2(this,PictTemplateProviderEntity);_this77=_callSuper(this,PictTemplateProviderEntity,[pFable,pOptions,pServiceHash]);_this77.addPattern('{~E:','~}');_this77.addPattern('{~Entity:','~}');return _this77;}_inherits(PictTemplateProviderEntity,_libPictTemplate2);return _createClass2(PictTemplateProviderEntity,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){// TODO: Better messaging
|
|
4404
4623
|
this.log.error("Pict: Entity Render [".concat(pTemplateHash,"]: Render called in a non-asynchronous fashion. This should not happen."));return'';}},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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.
|
|
4405
4624
|
var tmpAddressParts=tmpHash.split('^');if(tmpAddressParts.length<2){this.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){this.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
|
|
4406
4625
|
tmpEntityID=this.resolveStateFromAddress(tmpEntityID,tmpData,pContextArray);}// No Entity or EntityID
|
|
@@ -4410,7 +4629,7 @@ if(tmpEntityTemplate){return this.pict.parseTemplateByHash(tmpEntityTemplate,pRe
|
|
|
4410
4629
|
* @param {Object} pFable - The Fable Framework instance
|
|
4411
4630
|
* @param {Object} pOptions - The options for the service
|
|
4412
4631
|
* @param {String} pServiceHash - The hash of the service
|
|
4413
|
-
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var
|
|
4632
|
+
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var _this78;_classCallCheck2(this,PictTemplateProviderTemplate);_this78=_callSuper(this,PictTemplateProviderTemplate,[pFable,pOptions,pServiceHash]);_this78.addPattern('{~Template:','~}');_this78.addPattern('{~T:','~}');return _this78;}_inherits(PictTemplateProviderTemplate,_libPictTemplate3);return _createClass2(PictTemplateProviderTemplate,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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)
|
|
4414
4633
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4415
4634
|
if(!tmpTemplateHash){this.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.
|
|
4416
4635
|
return this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,null,pContextArray);}else{return this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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)
|
|
@@ -4421,7 +4640,7 @@ return this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,function(pError,pVa
|
|
|
4421
4640
|
* @param {Object} pFable - The Fable Framework instance
|
|
4422
4641
|
* @param {Object} pOptions - The options for the service
|
|
4423
4642
|
* @param {String} pServiceHash - The hash of the service
|
|
4424
|
-
*/function PictTemplateProviderTemplateFromMap(pFable,pOptions,pServiceHash){var
|
|
4643
|
+
*/function PictTemplateProviderTemplateFromMap(pFable,pOptions,pServiceHash){var _this79;_classCallCheck2(this,PictTemplateProviderTemplateFromMap);_this79=_callSuper(this,PictTemplateProviderTemplateFromMap,[pFable,pOptions,pServiceHash]);_this79.addPattern('{~TFM:','~}');_this79.addPattern('{~TemplateFromMap:','~}');return _this79;}_inherits(PictTemplateProviderTemplateFromMap,_libPictTemplate4);return _createClass2(PictTemplateProviderTemplateFromMap,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT TemplateFromMap [fTemplateFromMapRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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
|
|
4425
4644
|
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){this.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
|
|
4426
4645
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
4427
4646
|
var tmpMap=this.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=this.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){this.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.
|
|
@@ -4434,7 +4653,7 @@ return this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,function(pEr
|
|
|
4434
4653
|
* @param {Object} pFable - The Fable Framework instance
|
|
4435
4654
|
* @param {Object} pOptions - The options for the service
|
|
4436
4655
|
* @param {String} pServiceHash - The hash of the service
|
|
4437
|
-
*/function PictTemplateProviderTemplateSet(pFable,pOptions,pServiceHash){var
|
|
4656
|
+
*/function PictTemplateProviderTemplateSet(pFable,pOptions,pServiceHash){var _this80;_classCallCheck2(this,PictTemplateProviderTemplateSet);_this80=_callSuper(this,PictTemplateProviderTemplateSet,[pFable,pOptions,pServiceHash]);_this80.addPattern('{~TemplateSet:','~}');_this80.addPattern('{~TS:','~}');return _this80;}_inherits(PictTemplateProviderTemplateSet,_libPictTemplate5);return _createClass2(PictTemplateProviderTemplateSet,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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)
|
|
4438
4657
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4439
4658
|
if(!tmpTemplateHash){this.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.
|
|
4440
4659
|
return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArray);}else{return this.pict.parseTemplateSetByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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
|
|
@@ -4446,7 +4665,7 @@ return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(
|
|
|
4446
4665
|
* @param {Object} pFable - The Fable Framework instance
|
|
4447
4666
|
* @param {Object} pOptions - The options for the service
|
|
4448
4667
|
* @param {String} pServiceHash - The hash of the service
|
|
4449
|
-
*/function PictTemplateProviderTemplateSetFromMap(pFable,pOptions,pServiceHash){var
|
|
4668
|
+
*/function PictTemplateProviderTemplateSetFromMap(pFable,pOptions,pServiceHash){var _this81;_classCallCheck2(this,PictTemplateProviderTemplateSetFromMap);_this81=_callSuper(this,PictTemplateProviderTemplateSetFromMap,[pFable,pOptions,pServiceHash]);_this81.addPattern('{~TSFM:','~}');_this81.addPattern('{~TemplateSetFromMap:','~}');return _this81;}_inherits(PictTemplateProviderTemplateSetFromMap,_libPictTemplate6);return _createClass2(PictTemplateProviderTemplateSetFromMap,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT TemplateFromMap [fTemplateFromMapSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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
|
|
4450
4669
|
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){this.log.trace("PICT TemplateFromMap [fTemplateFromMapRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return'';}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfMap=tmpTemplateHashPart[1];tmpAddressOfKey=tmpTemplateHashPart[2];// No TemplateFromMap hash
|
|
4451
4670
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
4452
4671
|
var tmpMap=this.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=this.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){this.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.
|
|
@@ -4459,31 +4678,31 @@ return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(
|
|
|
4459
4678
|
* @param {Object} pFable - The Fable Framework instance
|
|
4460
4679
|
* @param {Object} pOptions - The options for the service
|
|
4461
4680
|
* @param {String} pServiceHash - The hash of the service
|
|
4462
|
-
*/function PictTemplateProviderTemplateValueSet(pFable,pOptions,pServiceHash){var
|
|
4681
|
+
*/function PictTemplateProviderTemplateValueSet(pFable,pOptions,pServiceHash){var _this82;_classCallCheck2(this,PictTemplateProviderTemplateValueSet);_this82=_callSuper(this,PictTemplateProviderTemplateValueSet,[pFable,pOptions,pServiceHash]);_this82.addPattern('{~TemplateValueSet:','~}');_this82.addPattern('{~TVS:','~}');return _this82;}_inherits(PictTemplateProviderTemplateValueSet,_libPictTemplate7);return _createClass2(PictTemplateProviderTemplateValueSet,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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)
|
|
4463
4682
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
4464
|
-
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var
|
|
4683
|
+
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i58=0;_i58<tmpValueKeys.length;_i58++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i58]],Key:tmpValueKeys[_i58]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
4465
4684
|
return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArray);}else{return this.pict.parseTemplateSetByHash(tmpTemplateHash,tmpData,null,pContextArray);}}},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.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
|
|
4466
4685
|
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
|
|
4467
4686
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
4468
|
-
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var
|
|
4687
|
+
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i59=0;_i59<tmpValueKeys.length;_i59++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i59]],Key:tmpData[tmpValueKeys[_i59]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
4469
4688
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
4470
4689
|
return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateValueSet;},{"../Pict-Template.js":167}],178:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderRandomNumber=/*#__PURE__*/function(_libPictTemplate8){/**
|
|
4471
4690
|
* @param {Object} pFable - The Fable Framework instance
|
|
4472
4691
|
* @param {Object} pOptions - The options for the service
|
|
4473
4692
|
* @param {String} pServiceHash - The hash of the service
|
|
4474
|
-
*/function PictTemplateProviderRandomNumber(pFable,pOptions,pServiceHash){var
|
|
4693
|
+
*/function PictTemplateProviderRandomNumber(pFable,pOptions,pServiceHash){var _this83;_classCallCheck2(this,PictTemplateProviderRandomNumber);_this83=_callSuper(this,PictTemplateProviderRandomNumber,[pFable,pOptions,pServiceHash]);_this83.addPattern('{~RandomNumber:','~}');_this83.addPattern('{~RN:','~}');return _this83;}_inherits(PictTemplateProviderRandomNumber,_libPictTemplate8);return _createClass2(PictTemplateProviderRandomNumber,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>3){this.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(_unused2){tmpMinimumNumber=0;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused3){tmpMaxNumber=9999999;}}}return this.fable.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);}}]);}(libPictTemplate);module.exports=PictTemplateProviderRandomNumber;},{"../../Pict-Template.js":167}],179:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderRandomNumberString=/*#__PURE__*/function(_libPictTemplate9){/**
|
|
4475
4694
|
* @param {Object} pFable - The Fable Framework instance
|
|
4476
4695
|
* @param {Object} pOptions - The options for the service
|
|
4477
4696
|
* @param {String} pServiceHash - The hash of the service
|
|
4478
|
-
*/function PictTemplateProviderRandomNumberString(pFable,pOptions,pServiceHash){var
|
|
4697
|
+
*/function PictTemplateProviderRandomNumberString(pFable,pOptions,pServiceHash){var _this84;_classCallCheck2(this,PictTemplateProviderRandomNumberString);_this84=_callSuper(this,PictTemplateProviderRandomNumberString,[pFable,pOptions,pServiceHash]);_this84.addPattern('{~RandomNumberString:','~}');_this84.addPattern('{~RNS:','~}');return _this84;}_inherits(PictTemplateProviderRandomNumberString,_libPictTemplate9);return _createClass2(PictTemplateProviderRandomNumberString,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>3){this.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(_unused4){tmpStringLength=4;}}if(tmpHashParts.length>1){try{tmpMaxNumber=parseInt(tmpHashParts[1]);}catch(_unused5){tmpMaxNumber=9999;}}}return this.fable.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);}}]);}(libPictTemplate);module.exports=PictTemplateProviderRandomNumberString;},{"../../Pict-Template.js":167}],180:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderDollars=/*#__PURE__*/function(_libPictTemplate10){/**
|
|
4479
4698
|
* @param {Object} pFable - The Fable Framework instance
|
|
4480
4699
|
* @param {Object} pOptions - The options for the service
|
|
4481
4700
|
* @param {String} pServiceHash - The hash of the service
|
|
4482
|
-
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var
|
|
4701
|
+
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var _this85;_classCallCheck2(this,PictTemplateProviderDollars);_this85=_callSuper(this,PictTemplateProviderDollars,[pFable,pOptions,pServiceHash]);_this85.addPattern('{~DataJson:','~}');_this85.addPattern('{~DJ:','~}');return _this85;}_inherits(PictTemplateProviderDollars,_libPictTemplate10);return _createClass2(PictTemplateProviderDollars,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDataJson]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDataJson]::[".concat(tmpHash,"]"));}var tmpDataToStringify=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(!tmpDataToStringify){tmpDataToStringify=pRecord;}return JSON.stringify(tmpDataToStringify);}}]);}(libPictTemplate);module.exports=PictTemplateProviderDollars;},{"../../Pict-Template.js":167}],181:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderDateFormat=/*#__PURE__*/function(_libPictTemplate11){/**
|
|
4483
4702
|
* @param {Object} pFable - The Fable Framework instance
|
|
4484
4703
|
* @param {Object} pOptions - The options for the service
|
|
4485
4704
|
* @param {String} pServiceHash - The hash of the service
|
|
4486
|
-
*/function PictTemplateProviderDateFormat(pFable,pOptions,pServiceHash){var
|
|
4705
|
+
*/function PictTemplateProviderDateFormat(pFable,pOptions,pServiceHash){var _this86;_classCallCheck2(this,PictTemplateProviderDateFormat);_this86=_callSuper(this,PictTemplateProviderDateFormat,[pFable,pOptions,pServiceHash]);_this86.addPattern('{~DateFormat:','~}');return _this86;}_inherits(PictTemplateProviderDateFormat,_libPictTemplate11);return _createClass2(PictTemplateProviderDateFormat,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpDateValueSet=tmpHash.split('^');if(tmpDateValueSet.length<2){this.log.error("PICT Template [fDateFormat]::[".concat(tmpHash,"] did not have a valid format string and date."));return'';}var tmpDateValue=this.resolveStateFromAddress(tmpDateValueSet[0],tmpData,pContextArray);if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
4487
4706
|
var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
|
|
4488
4707
|
if(this.options.Timezone){tmpDayJS=tmpDayJS.tz(this.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}}catch(_unused6){//this.log.error(`Error casting date passed timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
|
|
4489
4708
|
// Day.js will try to guess the user's timezone for us
|
|
@@ -4497,7 +4716,7 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
4497
4716
|
* @param {Object} pFable - The Fable Framework instance
|
|
4498
4717
|
* @param {Object} pOptions - The options for the service
|
|
4499
4718
|
* @param {String} pServiceHash - The hash of the service
|
|
4500
|
-
*/function PictTemplateProviderDateYMD(pFable,pOptions,pServiceHash){var
|
|
4719
|
+
*/function PictTemplateProviderDateYMD(pFable,pOptions,pServiceHash){var _this87;_classCallCheck2(this,PictTemplateProviderDateYMD);_this87=_callSuper(this,PictTemplateProviderDateYMD,[pFable,pOptions,pServiceHash]);_this87.addPattern('{~DateYMD:','~}');return _this87;}_inherits(PictTemplateProviderDateYMD,_libPictTemplate12);return _createClass2(PictTemplateProviderDateYMD,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpDateValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDateFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
4501
4720
|
var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);try{// Try to cast the day to be a specific timezone if one is set for the app
|
|
4502
4721
|
if(this.options.Timezone){tmpDayJS=tmpDayJS.tz(this.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}}catch(_unused7){//this.log.error(`Error casting timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
|
|
4503
4722
|
// Day.js will try to guess the user's timezone for us
|
|
@@ -4505,25 +4724,25 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
4505
4724
|
* @param {Object} pFable - The Fable Framework instance
|
|
4506
4725
|
* @param {Object} pOptions - The options for the service
|
|
4507
4726
|
* @param {String} pServiceHash - The hash of the service
|
|
4508
|
-
*/function PictTemplateProviderDigits(pFable,pOptions,pServiceHash){var
|
|
4727
|
+
*/function PictTemplateProviderDigits(pFable,pOptions,pServiceHash){var _this88;_classCallCheck2(this,PictTemplateProviderDigits);_this88=_callSuper(this,PictTemplateProviderDigits,[pFable,pOptions,pServiceHash]);_this88.addPattern('{~Digits:','~}');return _this88;}_inherits(PictTemplateProviderDigits,_libPictTemplate13);return _createClass2(PictTemplateProviderDigits,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"]"));}var tmpColumnData=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return this.fable.DataFormat.formatterAddCommasToNumber(this.fable.DataFormat.formatterRoundNumber(tmpColumnData,2));}}]);}(libPictTemplate);module.exports=PictTemplateProviderDigits;},{"../../Pict-Template.js":167}],184:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderDollars=/*#__PURE__*/function(_libPictTemplate14){/**
|
|
4509
4728
|
* @param {Object} pFable - The Fable Framework instance
|
|
4510
4729
|
* @param {Object} pOptions - The options for the service
|
|
4511
4730
|
* @param {String} pServiceHash - The hash of the service
|
|
4512
|
-
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var
|
|
4731
|
+
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var _this89;_classCallCheck2(this,PictTemplateProviderDollars);_this89=_callSuper(this,PictTemplateProviderDollars,[pFable,pOptions,pServiceHash]);_this89.addPattern('{~Dollars:','~}');return _this89;}_inherits(PictTemplateProviderDollars,_libPictTemplate14);return _createClass2(PictTemplateProviderDollars,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"]"));}var tmpColumnData=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return this.fable.DataFormat.formatterDollars(tmpColumnData);}}]);}(libPictTemplate);module.exports=PictTemplateProviderDollars;},{"../../Pict-Template.js":167}],185:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderJoin=/*#__PURE__*/function(_libPictTemplate15){/**
|
|
4513
4732
|
* @param {Object} pFable - The Fable Framework instance
|
|
4514
4733
|
* @param {Object} pOptions - The options for the service
|
|
4515
4734
|
* @param {String} pServiceHash - The hash of the service
|
|
4516
|
-
*/function PictTemplateProviderJoin(pFable,pOptions,pServiceHash){var
|
|
4735
|
+
*/function PictTemplateProviderJoin(pFable,pOptions,pServiceHash){var _this90;_classCallCheck2(this,PictTemplateProviderJoin);_this90=_callSuper(this,PictTemplateProviderJoin,[pFable,pOptions,pServiceHash]);_this90.addPattern('{~Join:','~}');_this90.addPattern('{~J:','~}');return _this90;}_inherits(PictTemplateProviderJoin,_libPictTemplate15);return _createClass2(PictTemplateProviderJoin,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash;var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Join [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
|
|
4517
4736
|
var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=this.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);}}]);}(libPictTemplate);module.exports=PictTemplateProviderJoin;},{"../../Pict-Template.js":167}],186:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderJoinUnique=/*#__PURE__*/function(_libPictTemplate16){/**
|
|
4518
4737
|
* @param {Object} pFable - The Fable Framework instance
|
|
4519
4738
|
* @param {Object} pOptions - The options for the service
|
|
4520
4739
|
* @param {String} pServiceHash - The hash of the service
|
|
4521
|
-
*/function PictTemplateProviderJoinUnique(pFable,pOptions,pServiceHash){var
|
|
4740
|
+
*/function PictTemplateProviderJoinUnique(pFable,pOptions,pServiceHash){var _this91;_classCallCheck2(this,PictTemplateProviderJoinUnique);_this91=_callSuper(this,PictTemplateProviderJoinUnique,[pFable,pOptions,pServiceHash]);_this91.addPattern('{~JoinUnique:','~}');_this91.addPattern('{~JU:','~}');return _this91;}_inherits(PictTemplateProviderJoinUnique,_libPictTemplate16);return _createClass2(PictTemplateProviderJoinUnique,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash;var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Join Unique [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<2){return'';}// Get the separator string
|
|
4522
4741
|
var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={};for(var i=0;i<tmpDataAddresses.length;i++){var tmpValueSet=this.resolveStateFromAddress(tmpDataAddresses[i],tmpData,pContextArray);if(tmpValueSet&&Array.isArray(tmpValueSet)){for(var j=0;j<tmpValueSet.length;j++){if(!(tmpValueSet[j]in tmpValueMap)){tmpValueMap[tmpValueSet[j]]=true;tmpValueList.push(tmpValueSet[j]);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}]);}(libPictTemplate);module.exports=PictTemplateProviderJoinUnique;},{"../../Pict-Template.js":167}],187:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderPascalCaseIdentifier=/*#__PURE__*/function(_libPictTemplate17){/**
|
|
4523
4742
|
* @param {Object} pFable - The Fable Framework instance
|
|
4524
4743
|
* @param {Object} pOptions - The options for the service
|
|
4525
4744
|
* @param {String} pServiceHash - The hash of the service
|
|
4526
|
-
*/function PictTemplateProviderPascalCaseIdentifier(pFable,pOptions,pServiceHash){var
|
|
4745
|
+
*/function PictTemplateProviderPascalCaseIdentifier(pFable,pOptions,pServiceHash){var _this92;_classCallCheck2(this,PictTemplateProviderPascalCaseIdentifier);_this92=_callSuper(this,PictTemplateProviderPascalCaseIdentifier,[pFable,pOptions,pServiceHash]);_this92.addPattern('{~PascalCaseIdentifier:','~}');return _this92;}_inherits(PictTemplateProviderPascalCaseIdentifier,_libPictTemplate17);return _createClass2(PictTemplateProviderPascalCaseIdentifier,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"]"));}var tmpValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return this.pict.DataFormat.cleanNonAlphaCharacters(this.pict.DataFormat.capitalizeEachWord(tmpValue));}}]);}(libPictTemplate);module.exports=PictTemplateProviderPascalCaseIdentifier;/*
|
|
4527
4746
|
# DEAR DEAD CODE DIARY:
|
|
4528
4747
|
|
|
4529
4748
|
```javascript
|
|
@@ -4533,31 +4752,31 @@ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={}
|
|
|
4533
4752
|
* @param {Object} pFable - The Fable Framework instance
|
|
4534
4753
|
* @param {Object} pOptions - The options for the service
|
|
4535
4754
|
* @param {String} pServiceHash - The hash of the service
|
|
4536
|
-
*/function PictTemplateProviderBreakpoint(pFable,pOptions,pServiceHash){var
|
|
4755
|
+
*/function PictTemplateProviderBreakpoint(pFable,pOptions,pServiceHash){var _this93;_classCallCheck2(this,PictTemplateProviderBreakpoint);_this93=_callSuper(this,PictTemplateProviderBreakpoint,[pFable,pOptions,pServiceHash]);_this93.addPattern('{~Breakpoint','~}');return _this93;}_inherits(PictTemplateProviderBreakpoint,_libPictTemplate18);return _createClass2(PictTemplateProviderBreakpoint,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpError=new Error("PICT Template Breakpoint: ".concat(tmpHash));this.log.trace("PICT Template Breakpoint: ".concat(tmpHash),tmpError.stack);//throw tmpError;
|
|
4537
4756
|
debugger;// eslint-disable-line no-debugger
|
|
4538
4757
|
return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderBreakpoint;},{"../../Pict-Template.js":167}],189:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderDataValueTree=/*#__PURE__*/function(_libPictTemplate19){/**
|
|
4539
4758
|
* @param {Object} pFable - The Fable Framework instance
|
|
4540
4759
|
* @param {Object} pOptions - The options for the service
|
|
4541
4760
|
* @param {String} pServiceHash - The hash of the service
|
|
4542
|
-
*/function PictTemplateProviderDataValueTree(pFable,pOptions,pServiceHash){var
|
|
4761
|
+
*/function PictTemplateProviderDataValueTree(pFable,pOptions,pServiceHash){var _this94;_classCallCheck2(this,PictTemplateProviderDataValueTree);_this94=_callSuper(this,PictTemplateProviderDataValueTree,[pFable,pOptions,pServiceHash]);_this94.addPattern('{~DataTree:','~}');_this94.addPattern('{~DT:','~}');return _this94;}_inherits(PictTemplateProviderDataValueTree,_libPictTemplate19);return _createClass2(PictTemplateProviderDataValueTree,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpData=_typeof(pRecord)==='object'?pRecord:{};tmpData.TemplateHash=pTemplateHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=this.resolveStateFromAddress(tmpData.ValueTreeParameters[0],tmpData,pContextArray);tmpData.ResolvedValueType=_typeof(tmpData.ResolvedValue);try{tmpData.TreeMaxDepth=tmpData.ValueTreeParameters.length<2?1:parseInt(tmpData.ValueTreeParameters[1]);}catch(_unused8){tmpData.TreeMaxDepth=1;}var tmpPictObjectWrapTemplate=this.pict.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
|
|
4543
4762
|
tmpPictObjectWrapTemplate="<div class=\"PICT PICTObjectSet\">{~D:Record.ObjectValueTree~}</div>";}if(tmpData.ResolvedValueType=='object'){tmpData.ObjectValueTree=this.dataValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ResolvedValue,0,tmpData.TreeMaxDepth,pContextArray);}else{this.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);tmpData.ObjectValueTree=tmpData.ResolveValue;}return this.pict.parseTemplate(tmpPictObjectWrapTemplate,tmpData,null,pContextArray);}},{key:"dataValueTreeObjectSet",value:function dataValueTreeObjectSet(pObject,pRootObject,pCurrentDepth,pMaxDepth,pContextArray){var tmpTemplateResult='';if(_typeof(pObject)!=='object'){return tmpTemplateResult;}var tmpObjectValueKeys=Object.keys(pObject);var tmpPictObjectBranchTemplate=this.pict.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
|
|
4544
4763
|
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=this.dataValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],pRootObject,pCurrentDepth+1,pMaxDepth,pContextArray);}break;default:tmpBranchValue=pObject[tmpObjectValueKeys[i]];break;}var tmpDataValue={AppData:this.AppData,Bundle:this.Bundle,RootContainer:pRootObject,Container:pObject,BranchEntryCount:tmpObjectValueKeys.length,BranchIndex:i,BranchKey:tmpObjectValueKeys[i],BranchValue:tmpBranchValue,BranchDataType:tmpBranchType,CurrentDepth:pCurrentDepth,MaxDepth:pMaxDepth};tmpTemplateResult+=this.pict.parseTemplate(tmpPictObjectBranchTemplate,tmpDataValue,null,pContextArray);}return tmpTemplateResult;}}]);}(libPictTemplate);module.exports=PictTemplateProviderDataValueTree;},{"../../Pict-Template.js":167}],190:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderLogStatement=/*#__PURE__*/function(_libPictTemplate20){/**
|
|
4545
4764
|
* @param {Object} pFable - The Fable Framework instance
|
|
4546
4765
|
* @param {Object} pOptions - The options for the service
|
|
4547
4766
|
* @param {String} pServiceHash - The hash of the service
|
|
4548
|
-
*/function PictTemplateProviderLogStatement(pFable,pOptions,pServiceHash){var
|
|
4767
|
+
*/function PictTemplateProviderLogStatement(pFable,pOptions,pServiceHash){var _this95;_classCallCheck2(this,PictTemplateProviderLogStatement);_this95=_callSuper(this,PictTemplateProviderLogStatement,[pFable,pOptions,pServiceHash]);_this95.addPattern('{~LogStatement:','~}');_this95.addPattern('{~LS:','~}');return _this95;}_inherits(PictTemplateProviderLogStatement,_libPictTemplate20);return _createClass2(PictTemplateProviderLogStatement,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();this.log.trace("PICT Template Log Message: ".concat(tmpHash));return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderLogStatement;},{"../../Pict-Template.js":167}],191:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderLogValue=/*#__PURE__*/function(_libPictTemplate21){/**
|
|
4549
4768
|
* @param {Object} pFable - The Fable Framework instance
|
|
4550
4769
|
* @param {Object} pOptions - The options for the service
|
|
4551
4770
|
* @param {String} pServiceHash - The hash of the service
|
|
4552
|
-
*/function PictTemplateProviderLogValue(pFable,pOptions,pServiceHash){var
|
|
4771
|
+
*/function PictTemplateProviderLogValue(pFable,pOptions,pServiceHash){var _this96;_classCallCheck2(this,PictTemplateProviderLogValue);_this96=_callSuper(this,PictTemplateProviderLogValue,[pFable,pOptions,pServiceHash]);_this96.addPattern('{~LogValue:','~}');_this96.addPattern('{~LV:','~}');return _this96;}_inherits(PictTemplateProviderLogValue,_libPictTemplate21);return _createClass2(PictTemplateProviderLogValue,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);var tmpValueType=_typeof(tmpValue);if(tmpValue==null||tmpValueType=='undefined'){this.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is ").concat(tmpValueType,"."));}else if(tmpValueType=='object'){this.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is an object."),tmpValue);}else{this.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is a ").concat(tmpValueType," = [").concat(tmpValue,"]"));}return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderLogValue;},{"../../Pict-Template.js":167}],192:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderLogValueTree=/*#__PURE__*/function(_libPictTemplate22){/**
|
|
4553
4772
|
* @param {Object} pFable - The Fable Framework instance
|
|
4554
4773
|
* @param {Object} pOptions - The options for the service
|
|
4555
4774
|
* @param {String} pServiceHash - The hash of the service
|
|
4556
|
-
*/function PictTemplateProviderLogValueTree(pFable,pOptions,pServiceHash){var
|
|
4775
|
+
*/function PictTemplateProviderLogValueTree(pFable,pOptions,pServiceHash){var _this97;_classCallCheck2(this,PictTemplateProviderLogValueTree);_this97=_callSuper(this,PictTemplateProviderLogValueTree,[pFable,pOptions,pServiceHash]);_defineProperty2(_this97,"logValueTreeObjectSet",function(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;}_this97.log.trace("[".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i],"] (").concat(tmpBranchType,"): ").concat(tmpBranchValue));if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=_this97.logValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],"".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i]),pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';});_this97.addPattern('{~LogValueTree:','~}');_this97.addPattern('{~LVT:','~}');return _this97;}_inherits(PictTemplateProviderLogValueTree,_libPictTemplate22);return _createClass2(PictTemplateProviderLogValueTree,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpData=_typeof(pRecord)==='object'?pRecord:{};tmpData.TemplateHash=pTemplateHash.trim();tmpData.ValueTreeParameters=tmpData.TemplateHash.split('^');if(tmpData.ValueTreeParameters.length<1){return'';}tmpData.ResolvedValue=this.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'){this.logValueTreeObjectSet(tmpData.ResolvedValue,tmpData.ValueTreeParameters[0],tmpData.ResolvedValue,0,tmpData.TreeMaxDepth);}else{this.log.trace("PICT Template Log Value Tree: [".concat(tmpData.TemplateHash,"] resolved data is not an object."),tmpData.ResolvedValue);}return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderLogValueTree;},{"../../Pict-Template.js":167}],193:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderNotEmpty=/*#__PURE__*/function(_libPictTemplate23){/**
|
|
4557
4776
|
* @param {Object} pFable - The Fable Framework instance
|
|
4558
4777
|
* @param {Object} pOptions - The options for the service
|
|
4559
4778
|
* @param {String} pServiceHash - The hash of the service
|
|
4560
|
-
*/function PictTemplateProviderNotEmpty(pFable,pOptions,pServiceHash){var
|
|
4779
|
+
*/function PictTemplateProviderNotEmpty(pFable,pOptions,pServiceHash){var _this98;_classCallCheck2(this,PictTemplateProviderNotEmpty);_this98=_callSuper(this,PictTemplateProviderNotEmpty,[pFable,pOptions,pServiceHash]);_this98.addPattern('{~NotEmpty:','~}');_this98.addPattern('{~NE:','~}');return _this98;}_inherits(PictTemplateProviderNotEmpty,_libPictTemplate23);return _createClass2(PictTemplateProviderNotEmpty,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>2){this.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"]"));}var tmpHashParts=tmpHash.split('^');// For now just check truthiness. Not sure if this is grand.
|
|
4561
4780
|
if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}else{return'';}}}]);}(libPictTemplate);module.exports=PictTemplateProviderNotEmpty;},{"../../Pict-Template.js":167}],194:[function(require,module,exports){var libPictTemplate=require('../../Pict-Template.js');var PictTemplateProviderTemplateIfBase=/*#__PURE__*/function(_libPictTemplate24){/**
|
|
4562
4781
|
* @param {Object} pFable - The Fable Framework instance
|
|
4563
4782
|
* @param {Object} pOptions - The options for the service
|
|
@@ -4566,7 +4785,7 @@ if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return t
|
|
|
4566
4785
|
* @param {Object} pFable - The Fable Framework instance
|
|
4567
4786
|
* @param {Object} pOptions - The options for the service
|
|
4568
4787
|
* @param {String} pServiceHash - The hash of the service
|
|
4569
|
-
*/function PictTemplateProviderTemplateIf(pFable,pOptions,pServiceHash){var
|
|
4788
|
+
*/function PictTemplateProviderTemplateIf(pFable,pOptions,pServiceHash){var _this99;_classCallCheck2(this,PictTemplateProviderTemplateIf);_this99=_callSuper(this,PictTemplateProviderTemplateIf,[pFable,pOptions,pServiceHash]);_this99.addPattern('{~TemplateIf:','~}');_this99.addPattern('{~TIf:','~}');return _this99;}_inherits(PictTemplateProviderTemplateIf,_libPictTemplateIf);return _createClass2(PictTemplateProviderTemplateIf,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){this.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
|
|
4570
4789
|
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
|
|
4571
4790
|
if(!tmpComparisonOperation){this.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...
|
|
4572
4791
|
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){this.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
|
|
@@ -4580,7 +4799,7 @@ var tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpCompa
|
|
|
4580
4799
|
* @param {Object} pFable - The Fable Framework instance
|
|
4581
4800
|
* @param {Object} pOptions - The options for the service
|
|
4582
4801
|
* @param {String} pServiceHash - The hash of the service
|
|
4583
|
-
*/function PictTemplateProviderTemplateIfAbsolute(pFable,pOptions,pServiceHash){var
|
|
4802
|
+
*/function PictTemplateProviderTemplateIfAbsolute(pFable,pOptions,pServiceHash){var _this100;_classCallCheck2(this,PictTemplateProviderTemplateIfAbsolute);_this100=_callSuper(this,PictTemplateProviderTemplateIfAbsolute,[pFable,pOptions,pServiceHash]);_this100.addPattern('{~TemplateIfAbsolute:','~}');_this100.addPattern('{~TIfAbs:','~}');return _this100;}_inherits(PictTemplateProviderTemplateIfAbsolute,_libPictTemplateIf2);return _createClass2(PictTemplateProviderTemplateIfAbsolute,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.log.trace("PICT Template [fTemplateIfAbsoluteValueRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;var tmpComparisonOperation=false;var tmpHashParts=tmpHash.split(':');if(tmpHashParts.length<3){this.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
|
|
4584
4803
|
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}// No comparison operation
|
|
4585
4804
|
if(!tmpComparisonOperation){this.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...
|
|
4586
4805
|
var tmpComparisonParts=tmpComparisonOperation.split('^');if(tmpComparisonParts.length<3){this.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
|