pict 1.0.234 → 1.0.237
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 +312 -182
- package/dist/pict.compatible.js.map +1 -1
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +141 -11
- package/dist/pict.js.map +1 -1
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +6 -6
- package/types/source/Pict.d.ts.map +1 -1
- package/types/source/templates/debugging/Pict-Template-LogValueTree.d.ts.map +1 -1
package/dist/pict.compatible.js
CHANGED
|
@@ -752,7 +752,7 @@ return[this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLook
|
|
|
752
752
|
tmpRandomBytes[6]=tmpRandomBytes[6]&0x0f|0x40;tmpRandomBytes[8]=tmpRandomBytes[8]&0x3f|0x80;return this.bytesToUUID(tmpRandomBytes);}// Simple random UUID generation
|
|
753
753
|
},{key:"generateRandom",value:function generateRandom(){var tmpUUID='';for(var i=0;i<this._UUIDLength;i++){tmpUUID+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));}return tmpUUID;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
754
754
|
},{key:"getUUID",value:function getUUID(){if(this._UUIDModeRandom){return this.generateRandom();}else{return this.generateUUIDv4();}}}]);}(libFableServiceProviderBase);// This is for backwards compatibility
|
|
755
|
-
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports["new"]=autoConstruct;},{"../package.json":64,"./Fable-UUID-Random.js":65,"fable-serviceproviderbase":59}],67:[function(require,module,exports){module.exports={"name":"fable","version":"3.
|
|
755
|
+
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports["new"]=autoConstruct;},{"../package.json":64,"./Fable-UUID-Random.js":65,"fable-serviceproviderbase":59}],67:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.3","description":"A service dependency injection, configuration and logging library.","main":"source/Fable.js","scripts":{"start":"node source/Fable.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","test":"./node_modules/.bin/mocha -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t fable-image:local","docker-dev-run":"docker run -it -d --name fable-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" fable-image:local","docker-dev-shell":"docker exec -it fable-dev /bin/bash","tests":"./node_modules/mocha/bin/_mocha -u tdd --exit -R spec --grep"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"browser":{"./source/service/Fable-Service-EnvironmentData.js":"./source/service/Fable-Service-EnvironmentData-Web.js","./source/service/Fable-Service-FilePersistence.js":"./source/service/Fable-Service-FilePersistence-Web.js"},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable.git"},"keywords":["entity","behavior"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable/issues"},"homepage":"https://github.com/stevenvelozo/fable","devDependencies":{"quackage":"^1.0.38"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^6.2.2","cachetrax":"^1.0.4","cookie":"^0.6.0","data-arithmatic":"^1.0.7","dayjs":"^1.11.13","fable-log":"^3.0.16","fable-serviceproviderbase":"^3.0.15","fable-settings":"^3.0.12","fable-uuid":"^3.0.11","manyfest":"^1.0.38","simple-get":"^4.0.1"}};},{}],68:[function(require,module,exports){/**
|
|
756
756
|
* Fable Application Services Support Library
|
|
757
757
|
* @author <steven@velozo.com>
|
|
758
758
|
*/// Pre-init services
|
|
@@ -1163,7 +1163,43 @@ _this18.plugin_advancedFormat=require('dayjs/plugin/advancedFormat');_this18.day
|
|
|
1163
1163
|
// You would do the following:
|
|
1164
1164
|
// const localeDE = require('dayjs/locale/de');
|
|
1165
1165
|
// _Fable.Dates.dayJS.locale('de');
|
|
1166
|
-
return _this18;}
|
|
1166
|
+
return _this18;}/**
|
|
1167
|
+
* Calculates the difference in days between two dates.
|
|
1168
|
+
*
|
|
1169
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
1170
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
1171
|
+
* @returns {number} The difference in days between the start and end dates. Returns NaN if the start date is invalid.
|
|
1172
|
+
*/_inherits(DateManipulation,_libFableServiceProvi8);return _createClass2(DateManipulation,[{key:"dateDayDifference",value:function dateDayDifference(pDateStart,pDateEnd){// If there is not a valid start date, return NaN
|
|
1173
|
+
if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}var tmpStartDate=this.dayJS(pDateStart);// Without a valid end date, dayJS defaults to the current date
|
|
1174
|
+
var tmpEndDate=this.dayJS(pDateEnd);// Returns the difference in days between two dates
|
|
1175
|
+
return tmpEndDate.diff(tmpStartDate,'day');}/**
|
|
1176
|
+
* Calculates the difference in weeks between two dates.
|
|
1177
|
+
*
|
|
1178
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
1179
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
1180
|
+
* @returns {number} The difference in weeks between the two dates. Returns NaN if the start date is invalid.
|
|
1181
|
+
*/},{key:"dateWeekDifference",value:function dateWeekDifference(pDateStart,pDateEnd){// If there is not a valid start date, return NaN
|
|
1182
|
+
if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}var tmpStartDate=this.dayJS(pDateStart);// Without a valid end date, dayJS defaults to the current date
|
|
1183
|
+
var tmpEndDate=this.dayJS(pDateEnd);// Returns the difference in weeks between two dates
|
|
1184
|
+
return tmpEndDate.diff(tmpStartDate,'week');}/**
|
|
1185
|
+
* Calculates the difference in months between two dates.
|
|
1186
|
+
*
|
|
1187
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
1188
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
1189
|
+
* @returns {number} The difference in months between the two dates. Returns NaN if the start date is invalid.
|
|
1190
|
+
*/},{key:"dateMonthDifference",value:function dateMonthDifference(pDateStart,pDateEnd){// If there is not a valid start date, return NaN
|
|
1191
|
+
if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}var tmpStartDate=this.dayJS(pDateStart);// Without a valid end date, dayJS defaults to the current date
|
|
1192
|
+
var tmpEndDate=this.dayJS(pDateEnd);// Returns the difference in months between two dates
|
|
1193
|
+
return tmpEndDate.diff(tmpStartDate,'month');}/**
|
|
1194
|
+
* Calculates the difference in years between two dates.
|
|
1195
|
+
*
|
|
1196
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
1197
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
1198
|
+
* @returns {number} The difference in years between the two dates. Returns NaN if the start date is invalid.
|
|
1199
|
+
*/},{key:"dateYearDifference",value:function dateYearDifference(pDateStart,pDateEnd){// If there is not a valid start date, return NaN
|
|
1200
|
+
if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}var tmpStartDate=this.dayJS(pDateStart);// Without a valid end date, dayJS defaults to the current date
|
|
1201
|
+
var tmpEndDate=this.dayJS(pDateEnd);// Returns the difference in years between two dates
|
|
1202
|
+
return tmpEndDate.diff(tmpStartDate,'year');}}]);}(libFableServiceProviderBase);module.exports=DateManipulation;},{"dayjs":32,"dayjs/plugin/advancedFormat":33,"dayjs/plugin/isoWeek":34,"dayjs/plugin/relativeTime":35,"dayjs/plugin/timezone":36,"dayjs/plugin/utc":37,"dayjs/plugin/weekOfYear":38,"dayjs/plugin/weekday":39,"fable-serviceproviderbase":59}],75:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceEnvironmentData=/*#__PURE__*/function(_libFableServiceBase3){function FableServiceEnvironmentData(pFable,pOptions,pServiceHash){var _this19;_classCallCheck2(this,FableServiceEnvironmentData);_this19=_callSuper(this,FableServiceEnvironmentData,[pFable,pOptions,pServiceHash]);_this19.serviceType='EnvironmentData';_this19.Environment="node.js";return _this19;}_inherits(FableServiceEnvironmentData,_libFableServiceBase3);return _createClass2(FableServiceEnvironmentData);}(libFableServiceBase);module.exports=FableServiceEnvironmentData;},{"fable-serviceproviderbase":59}],76:[function(require,module,exports){var _require3=require('big.js'),PE=_require3.PE;var libFableServiceBase=require('fable-serviceproviderbase');/* Trying a different pattern for this service ...
|
|
1167
1203
|
*
|
|
1168
1204
|
* This service is a simple expression parser that can handle math expressions, with magic(tm) lookup of addresses with a manifest.
|
|
1169
1205
|
*
|
|
@@ -1302,7 +1338,7 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
1302
1338
|
// }
|
|
1303
1339
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
1304
1340
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
1305
|
-
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}return tmpResults.RawTokens;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":77}],79:[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"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"
|
|
1341
|
+
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}return tmpResults.RawTokens;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":77}],79:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"floor":{"Name":"Floor Value","Address":"fable.Math.floorPrecise"},"ceil":{"Name":"Ceiling Value","Address":"fable.Math.ceilPrecise"},"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"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"cumulativesummation":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.cumulativeSummation"},"countsetelements":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.countSetElements"},"getvalue":{"Name":"Get Value from Application State or Services (AppData, etc.)","Address":"fable.Utility.getInternalValueByHash"},"aggregationhistogram":{"Name":"Generate a Histogram by Exact Value Aggregation","Address":"fable.Math.histogramAggregationByExactValueFromInternalState"},"distributionhistogram":{"Name":"Generate a Histogram Based on Value Distribution","Address":"fable.Math.histogramDistributionByExactValueFromInternalState"},"getvaluearray":{"Name":"Get Value Array from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueArrayByHashParametersFromInternal"},"getvalueobject":{"Name":"Get Value Object from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueObjectByHashParametersFromInternal"},"cleanvaluearray":{"Name":"Clean Value Array","Address":"fable.Math.cleanValueArray"},"cleanvalueobject":{"Name":"Clean Value Object","Address":"fable.Math.cleanValueObject"},"randominteger":{"Name":"Random Integer","Address":"fable.DataGeneration.randomInteger"},"randomintegerbetween":{"Name":"Random Integer Between Two Numbers","Address":"fable.DataGeneration.randomIntegerBetween"},"randomintegerupto":{"Name":"Random Integer","Address":"fable.DataGeneration.randomIntegerUpTo"},"randomfloat":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloat"},"randomfloatbetween":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatBetween"},"randomfloatupto":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatUpTo"},"datedaydifference":{"Name":"Date Difference in Days","Address":"fable.Dates.dateDayDifference"},"dateweekdifference":{"Name":"Date Difference in Weeks","Address":"fable.Dates.dateWeekDifference"},"datemonthdifference":{"Name":"Date Difference in Months","Address":"fable.Dates.dateMonthDifference"},"dateyeardifference":{"Name":"Date Difference in Years","Address":"fable.Dates.dateYearDifference"}};},{}],80:[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
|
|
1306
1342
|
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
|
|
1307
1343
|
var tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
1308
1344
|
// State addresses are between squiggly brackets
|
|
@@ -1453,7 +1489,7 @@ tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[_i1
|
|
|
1453
1489
|
if(pPostfixedExpression[_i17].Operation.Descriptor.OnlyEmpty){// If it is only on "empty" values, check if the value is empty before assigning
|
|
1454
1490
|
if(this.fable.Utility.addressIsNullOrEmpty(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName)){tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);}}else{// Otherwise, just assign it.
|
|
1455
1491
|
tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);}}}tmpResults.RawResult=tmpSolverResultValue;// Clean up the fable reference if we added it to the object.
|
|
1456
|
-
if(!tmpPassedInFable){delete tmpResults.fable;}if(typeof tmpSolverResultValue!=='undefined'){return tmpSolverResultValue.toString();}else{return tmpSolverResultValue;}}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":77}],84:[function(require,module,exports){module.exports={"=":{"Name":"Assign Value","Token":"=","Function":"fable.Math.assignValue","Precedence":0,"Type":"Assignment"},"?=":{"Name":"Null or Empty Coalescing Assign Value","Token":"?=","Function":"fable.Math.assignValue","OnlyEmpty":true,"Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},",":{"Name":"Set Concatenate","Token":",","Function":"fable.Math.setConcatenate","Precedence":4,"Type":"Operator"},"*":{"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"}};},{}],85:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserValueMarshal=/*#__PURE__*/function(_libExpressionParserO6){function ExpressionParserValueMarshal(pFable,pOptions,pServiceHash){var _this27;_classCallCheck2(this,ExpressionParserValueMarshal);_this27=_callSuper(this,ExpressionParserValueMarshal,[pFable,pOptions,pServiceHash]);_this27.serviceType='ExpressionParser-ValueMarshal';return _this27;}/**
|
|
1492
|
+
if(!tmpPassedInFable){delete tmpResults.fable;}if(_typeof(tmpSolverResultValue)==='object'){return tmpSolverResultValue;}else if(typeof tmpSolverResultValue!=='undefined'){return tmpSolverResultValue.toString();}else{return tmpSolverResultValue;}}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":77}],84:[function(require,module,exports){module.exports={"=":{"Name":"Assign Value","Token":"=","Function":"fable.Math.assignValue","Precedence":0,"Type":"Assignment"},"?=":{"Name":"Null or Empty Coalescing Assign Value","Token":"?=","Function":"fable.Math.assignValue","OnlyEmpty":true,"Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},",":{"Name":"Set Concatenate","Token":",","Function":"fable.Math.setConcatenate","Precedence":4,"Type":"Operator"},"*":{"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"}};},{}],85:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserValueMarshal=/*#__PURE__*/function(_libExpressionParserO6){function ExpressionParserValueMarshal(pFable,pOptions,pServiceHash){var _this27;_classCallCheck2(this,ExpressionParserValueMarshal);_this27=_callSuper(this,ExpressionParserValueMarshal,[pFable,pOptions,pServiceHash]);_this27.serviceType='ExpressionParser-ValueMarshal';return _this27;}/**
|
|
1457
1493
|
* Substitutes values in tokenized objects based on the provided data source and manifest.
|
|
1458
1494
|
*
|
|
1459
1495
|
* TODO: Move this to its own file in the "Fable-Service-ExpressionParser" directory.
|
|
@@ -1474,8 +1510,10 @@ if(Array.isArray(tmpValue)||_typeof(tmpValue)==='object'){tmpToken.Resolved=true
|
|
|
1474
1510
|
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 [${tmpValue}] for the state address ${tmpToken.Token} at index ${i}`);
|
|
1475
1511
|
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.String'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push("INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [".concat(tmpToken.Token,"] for the string ").concat(tmpToken.Token," at index ").concat(i));if(this.LogNoisiness>1)this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=true;// Take the quotes off the string
|
|
1476
1512
|
tmpToken.Value=tmpToken.Token.substring(1,tmpToken.Token.length-1);}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));if(this.LogNoisiness>1)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.
|
|
1477
|
-
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;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserValueMarshal;},{"./Fable-Service-ExpressionParser-Base.js":77}],86:[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 _this28;_classCallCheck2(this,FableServiceFilePersistence);_this28=_callSuper(this,FableServiceFilePersistence,[pFable,pOptions,pServiceHash]);_this28.serviceType='FilePersistence';if(!('Mode'in _this28.options)){_this28.options.Mode=parseInt('0777',8)&~process.umask();}_this28.libFS=libFS;_this28.libPath=libPath;_this28.libReadline=libReadline;return _this28;}_inherits(FableServiceFilePersistence,_libFableServiceBase5);return _createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){
|
|
1478
|
-
|
|
1513
|
+
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;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserValueMarshal;},{"./Fable-Service-ExpressionParser-Base.js":77}],86:[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 _this28;_classCallCheck2(this,FableServiceFilePersistence);_this28=_callSuper(this,FableServiceFilePersistence,[pFable,pOptions,pServiceHash]);_this28.serviceType='FilePersistence';if(!('Mode'in _this28.options)){_this28.options.Mode=parseInt('0777',8)&~process.umask();}_this28.libFS=libFS;_this28.libPath=libPath;_this28.libReadline=libReadline;return _this28;}_inherits(FableServiceFilePersistence,_libFableServiceBase5);return _createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){// TODO: Fix anything that's using this before changing this to the new true node join
|
|
1514
|
+
// return libPath.join(...pPathArray);
|
|
1515
|
+
return libPath.resolve.apply(libPath,arguments);}},{key:"resolvePath",value:function resolvePath(){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:"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:"readFileCSV",value:function readFileCSV(pFilePath,pOptions,fRecordFunction,fCompleteFunction,fErrorFunction){var _this29=this;var tmpCSVParser=this.fable.instantiateServiceProviderWithoutRegistration('CSVParser',pOptions);var tmpRecordFunction=typeof fRecordFunction==='function'?fRecordFunction:function(pRecord){_this29.fable.log("CSV Reader received line ".concat(pRecord));};var tmpCompleteFunction=typeof fCompleteFunction==='function'?fCompleteFunction:function(){_this29.fable.log("CSV Read of ".concat(pFilePath," complete."));};var tmpErrorFunction=typeof fErrorFunction==='function'?fErrorFunction:function(pError){_this29.fable.log("CSV Read of ".concat(pFilePath," Error: ").concat(pError),pError);};return this.lineReaderFactory(pFilePath,function(pLine){var tmpRecord=tmpCSVParser.parseCSVLine(pLine);if(tmpRecord){tmpRecordFunction(tmpRecord,pLine);}},tmpCompleteFunction,tmpErrorFunction);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{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
|
|
1516
|
+
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this30=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
|
|
1479
1517
|
if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
|
|
1480
1518
|
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.
|
|
1481
1519
|
// Build the new base path
|
|
@@ -1483,8 +1521,8 @@ if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParamete
|
|
|
1483
1521
|
tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
1484
1522
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
1485
1523
|
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.
|
|
1486
|
-
return
|
|
1487
|
-
return
|
|
1524
|
+
return _this30.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
1525
|
+
return _this30.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return _this30.makeFolderRecursive(tmpParameters,fCallback);}});}}]);}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":147,"fable-serviceproviderbase":59,"fs":19,"path":135,"readline":19}],87:[function(require,module,exports){/**
|
|
1488
1526
|
* @file Fable-Service-Math.js
|
|
1489
1527
|
* @description This file contains the implementation of the FableServiceMath class, which provides simple functions for performing arbitrary precision math operations.
|
|
1490
1528
|
* @module FableServiceMath
|
|
@@ -1495,8 +1533,8 @@ return _this29.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pC
|
|
|
1495
1533
|
* @description Simple functions that perform arbitrary precision math operations and return string resultant values. Wraps big.js
|
|
1496
1534
|
* @class FableServiceMath
|
|
1497
1535
|
* @extends libFableServiceBase
|
|
1498
|
-
*/var FableServiceMath=/*#__PURE__*/function(_libFableServiceBase6){function FableServiceMath(pFable,pOptions,pServiceHash){var
|
|
1499
|
-
return
|
|
1536
|
+
*/var FableServiceMath=/*#__PURE__*/function(_libFableServiceBase6){function FableServiceMath(pFable,pOptions,pServiceHash){var _this31;_classCallCheck2(this,FableServiceMath);_this31=_callSuper(this,FableServiceMath,[pFable,pOptions,pServiceHash]);_this31.serviceType='Math';_this31.pi='3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679';// this.manifest = this.fable.newManyfest();
|
|
1537
|
+
return _this31;}/*
|
|
1500
1538
|
Pass-through Rounding Method Constants
|
|
1501
1539
|
|
|
1502
1540
|
Property Value BigDecimal Equiv Description
|
|
@@ -1591,6 +1629,16 @@ return _this30;}/*
|
|
|
1591
1629
|
* @param {number} pValue - The number to calculate the absolute value of.
|
|
1592
1630
|
* @returns {string} The absolute value of the input number as a string.
|
|
1593
1631
|
*/},{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();}/**
|
|
1632
|
+
* Calculates the floor of a number precisely.
|
|
1633
|
+
*
|
|
1634
|
+
* @param {number} pValue - The number to calculate the floor value of.
|
|
1635
|
+
* @returns {string} The floor value of the input number as a string.
|
|
1636
|
+
*/},{key:"floorPrecise",value:function floorPrecise(pValue){var tmpValue=isNaN(pValue)?0:pValue;var tmpResult=Math.floor(tmpValue);return tmpResult.toString();}/**
|
|
1637
|
+
* Calculates the ceiling of a number precisely.
|
|
1638
|
+
*
|
|
1639
|
+
* @param {number} pValue - The number to calculate the ceiling value of.
|
|
1640
|
+
* @returns {string} The ceiling value of the input number as a string.
|
|
1641
|
+
*/},{key:"ceilPrecise",value:function ceilPrecise(pValue){var tmpValue=isNaN(pValue)?0:pValue;var tmpResult=Math.ceil(tmpValue);return tmpResult.toString();}/**
|
|
1594
1642
|
* Compares two values precisely.
|
|
1595
1643
|
*
|
|
1596
1644
|
* @param {number} pLeftValue - The left value to compare.
|
|
@@ -1666,7 +1714,7 @@ return 1;}return 0;}/**
|
|
|
1666
1714
|
*
|
|
1667
1715
|
* @param {Array|Object} pValueSet - The value set to be sorted.
|
|
1668
1716
|
* @returns {Array} - The sorted value set.
|
|
1669
|
-
*/},{key:"sortSetPrecise",value:function sortSetPrecise(pValueSet){var
|
|
1717
|
+
*/},{key:"sortSetPrecise",value:function sortSetPrecise(pValueSet){var _this32=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 _this32.comparePrecise(pLeft,pRight);});return tmpSortedSet;}/**
|
|
1670
1718
|
* Bucketizes a set of values based on a specified bucket size.
|
|
1671
1719
|
*
|
|
1672
1720
|
* @param {Array|Object} pValueSet - The set of values to be bucketized.
|
|
@@ -1682,7 +1730,44 @@ return 1;}return 0;}/**
|
|
|
1682
1730
|
*
|
|
1683
1731
|
* @param {Object} pHistogram - The histogram object to be sorted.
|
|
1684
1732
|
* @returns {Object} - The sorted histogram object.
|
|
1685
|
-
*/},{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;}/**
|
|
1733
|
+
*/},{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;}},{key:"cleanValueArray",value:function cleanValueArray(pValueArray){if(!Array.isArray(pValueArray)){return[];}var tmpCleanedArray=[];for(var i=0;i<pValueArray.length;i++){var tmpValue=this.parsePrecise(pValueArray[i],NaN);if(!isNaN(tmpValue)){tmpCleanedArray.push(tmpValue);}}return tmpCleanedArray;}},{key:"cleanValueObject",value:function cleanValueObject(pValueObject){if(_typeof(pValueObject)!=='object'){return{};}var tmpCleanedObject={};var tmpKeys=Object.keys(pValueObject);for(var i=0;i<tmpKeys.length;i++){var tmpValue=this.parsePrecise(pValueObject[tmpKeys[i]],NaN);if(!isNaN(tmpValue)){tmpCleanedObject[tmpKeys[i]]=tmpValue;}}return tmpCleanedObject;}/**
|
|
1734
|
+
* Make a histogram of representative counts for exact values (.tostring() is the keys to count)
|
|
1735
|
+
* @param {Array} pValueSet
|
|
1736
|
+
* @param {string} pValueAddress
|
|
1737
|
+
*/},{key:"histogramDistributionByExactValue",value:function histogramDistributionByExactValue(pValueObjectSet,pValueAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress){return{};}var tmpHistogram={};for(var i=0;i<pValueObjectSet.length;i++){var tmpValue=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest).toString();if(!(tmpValue in tmpHistogram)){tmpHistogram[tmpValue]=0;}tmpHistogram[tmpValue]=tmpHistogram[tmpValue]+1;}return tmpHistogram;}},{key:"histogramDistributionByExactValueFromInternalState",value:function histogramDistributionByExactValueFromInternalState(pValueObjectSetAddress,pValueAddress){if(!pValueObjectSetAddress){return{};}var tmpValueObjectSet=this.fable.Utility.getInternalValueByHash(pValueObjectSetAddress);return this.histogramDistributionByExactValue(tmpValueObjectSet,pValueAddress);}/**
|
|
1738
|
+
* Make a histogram of representative counts for exact values (.tostring() is the keys to count)
|
|
1739
|
+
* @param {Array} pValueSet
|
|
1740
|
+
* @param {string} pValueAddress
|
|
1741
|
+
*/},{key:"histogramAggregationByExactValue",value:function histogramAggregationByExactValue(pValueObjectSet,pValueAddress,pValueAmountAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress||!pValueAmountAddress){return{};}var tmpHistogram={};for(var i=0;i<pValueObjectSet.length;i++){var tmpValue=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest).toString();var tmpAmount=this.parsePrecise(this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAmountAddress,pManifest),NaN);if(!(tmpValue in tmpHistogram)){tmpHistogram[tmpValue]=0;}if(!isNaN(tmpAmount)){tmpHistogram[tmpValue]=this.addPrecise(tmpHistogram[tmpValue],tmpAmount);}}return tmpHistogram;}/**
|
|
1742
|
+
* Aggregates a histogram by exact value from an internal state object.
|
|
1743
|
+
*
|
|
1744
|
+
* @param {string} pValueObjectSetAddress - The address of the internal value object set.
|
|
1745
|
+
* @param {string} pValueAddress - The address of the value to aggregate by.
|
|
1746
|
+
* @param {string} pValueAmountAddress - The address of the amount to aggregate.
|
|
1747
|
+
* @returns {Object} The aggregated histogram object. Returns an empty object if the value object set address is not provided.
|
|
1748
|
+
*/},{key:"histogramAggregationByExactValueFromInternalState",value:function histogramAggregationByExactValueFromInternalState(pValueObjectSetAddress,pValueAddress,pValueAmountAddress){if(!pValueObjectSetAddress){return{};}var tmpValueObjectSet=this.fable.Utility.getInternalValueByHash(pValueObjectSetAddress);return this.histogramAggregationByExactValue(tmpValueObjectSet,pValueAddress,pValueAmountAddress);}/**
|
|
1749
|
+
* Given a value object set (an array of objects), find a specific entry when
|
|
1750
|
+
* sorted by a specific value address. Supports -1 syntax for last entry.
|
|
1751
|
+
* @param {Array} pValueObjectSet
|
|
1752
|
+
* @param {string} pValueAddress
|
|
1753
|
+
* @param {Object} pManifest
|
|
1754
|
+
*/},{key:"entryInSet",value:function entryInSet(pValueObjectSet,pValueAddress,pEntryIndex){var _this33=this;if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress){return false;}if(isNaN(pEntryIndex)||pEntryIndex>=pValueObjectSet.length){return false;}var tmpValueArray=pValueObjectSet.toSorted(function(pLeft,pRight){return _this33.comparePrecise(pLeft,pRight);});var tmpIndex=pEntryIndex===-1?tmpValueArray.length-1:pEntryIndex;return tmpValueArray[tmpIndex];}/**
|
|
1755
|
+
* Finds the smallest value in a set of objects based on a specified value address.
|
|
1756
|
+
*
|
|
1757
|
+
* @param {Object[]} pValueObjectSet - An array of objects to search through.
|
|
1758
|
+
* @param {string} pValueAddress - The key or path used to access the value within each object.
|
|
1759
|
+
* @returns {*} The smallest value found in the set at the specified value address.
|
|
1760
|
+
*/},{key:"smallestInSet",value:function smallestInSet(pValueObjectSet,pValueAddress){return this.entryInSet(pValueObjectSet,pValueAddress,0);}/**
|
|
1761
|
+
* Finds the largest value in a set of objects based on a specified value address.
|
|
1762
|
+
*
|
|
1763
|
+
* @param {Object[]} pValueObjectSet - An array of objects to search through.
|
|
1764
|
+
* @param {string} pValueAddress - The address (key or path) within each object to compare values.
|
|
1765
|
+
* @returns {*} The largest value found at the specified address in the set of objects.
|
|
1766
|
+
*/},{key:"largestInSet",value:function largestInSet(pValueObjectSet,pValueAddress){return this.entryInSet(pValueObjectSet,pValueAddress,-1);}/**
|
|
1767
|
+
* Expects an array of objects, and an address in each object to sum. Expects
|
|
1768
|
+
* an address to put the cumulative summation as well.
|
|
1769
|
+
* @param {Array} pValueObjectSet
|
|
1770
|
+
*/},{key:"cumulativeSummation",value:function cumulativeSummation(pValueObjectSet,pValueAddress,pCumulationResultAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress||!pCumulationResultAddress){return pValueObjectSet;}var tmpSummationValue='0.0';for(var i=0;i<pValueObjectSet.length;i++){var tmpValue=this.parsePrecise(this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest));if(isNaN(tmpValue)){this.fable.Utility.setValueByHash(pValueObjectSet[i],pCumulationResultAddress,tmpSummationValue,pManifest);continue;}tmpSummationValue=this.addPrecise(tmpValue,tmpSummationValue);this.fable.Utility.setValueByHash(pValueObjectSet[i],pCumulationResultAddress,tmpSummationValue,pManifest);}return pValueObjectSet;}/**
|
|
1686
1771
|
* Finds the maximum value from a set of precise values.
|
|
1687
1772
|
*
|
|
1688
1773
|
* @param {Array|Object} pValueSet - The set of values to find the maximum from.
|
|
@@ -1725,7 +1810,7 @@ var tmpHistogramValueSet=Object.keys(tmpHistogram);var tmpModeValueSet=[];for(va
|
|
|
1725
1810
|
* Precedent Meta-Templating
|
|
1726
1811
|
* @author Steven Velozo <steven@velozo.com>
|
|
1727
1812
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
1728
|
-
*/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
|
|
1813
|
+
*/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 _this34;_classCallCheck2(this,FableServiceMetaTemplate);_this34=_callSuper(this,FableServiceMetaTemplate,[pFable,pOptions,pServiceHash]);_this34.serviceType='MetaTemplate';_this34.WordTree=new libWordTree();_this34.StringParser=new libStringParser(_this34.fable);_this34.ParseTree=_this34.WordTree.ParseTree;return _this34;}_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);}/**
|
|
1729
1814
|
* Parse a string with the existing parse tree
|
|
1730
1815
|
* @method parseString
|
|
1731
1816
|
* @param {string} pString - The string to parse
|
|
@@ -1780,10 +1865,10 @@ var _tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Patt
|
|
|
1780
1865
|
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)....
|
|
1781
1866
|
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
1782
1867
|
if(pCharacter in pParserState.ParseTree){// ... assign the root node as the matched node.
|
|
1783
|
-
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
|
|
1868
|
+
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 _this35=this;// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
1784
1869
|
// Trim the start and end tags off the output buffer now
|
|
1785
1870
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
1786
|
-
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){
|
|
1871
|
+
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){_this35.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this35.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){_this35.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this35.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}}else{// Run the t*mplate function
|
|
1787
1872
|
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();}}/**
|
|
1788
1873
|
* Parse a character in the buffer.
|
|
1789
1874
|
* @method parseCharacterAsync
|
|
@@ -1816,11 +1901,11 @@ return fCallback();}/**
|
|
|
1816
1901
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
1817
1902
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
1818
1903
|
* @param {array} pDataContext - The history of data objects/context already passed in
|
|
1819
|
-
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback,pDataContext){var
|
|
1904
|
+
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback,pDataContext){var _this36=this;// TODO: There is danger here if a template function attempts to functionally recurse and doesn't pass this in.
|
|
1820
1905
|
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.
|
|
1821
1906
|
this.parseCharacter(pString[i],tmpParserState,pData,tmpDataContext);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
1822
|
-
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var _loop=function _loop(_i23){tmpAnticipate.anticipate(function(fCallback){
|
|
1823
|
-
|
|
1907
|
+
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var _loop=function _loop(_i23){tmpAnticipate.anticipate(function(fCallback){_this36.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
|
|
1908
|
+
_this36.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserState.Output);});}}}]);}();module.exports=StringParser;},{}],90:[function(require,module,exports){/**
|
|
1824
1909
|
* Word Tree
|
|
1825
1910
|
* @author Steven Velozo <steven@velozo.com>
|
|
1826
1911
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -1856,13 +1941,13 @@ if(pParserContext){tmpLeaf.ParserContext=pParserContext;}tmpLeaf.isAsync=true;re
|
|
|
1856
1941
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
1857
1942
|
* @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.
|
|
1858
1943
|
* @param {Object} pParserContext - The context to pass to the parser function
|
|
1859
|
-
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);}();module.exports=WordTree;},{}],91:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
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(
|
|
1864
|
-
tmpAnticipate.anticipate(
|
|
1865
|
-
tmpAnticipate.wait(function(pError){if(pError){
|
|
1944
|
+
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);}();module.exports=WordTree;},{}],91:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":1},"Steps":[],"Errors":[],"Log":[]};},{}],92:[function(require,module,exports){var _require5=require('big.js'),PE=_require5.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 _this37;_classCallCheck2(this,FableOperation);_this37=_callSuper(this,FableOperation,[pFable,pOptions,pServiceHash]);// Timestamps will just be the long ints
|
|
1945
|
+
_this37.timeStamps={};_this37.serviceType='PhasedOperation';_this37.state=JSON.parse(_OperationStatePrototypeString);_this37.stepMap={};_this37.stepFunctions={};// Match the service instantiation to the operation.
|
|
1946
|
+
_this37.state.Metadata.Hash=_this37.Hash;_this37.state.Metadata.UUID=_this37.UUID;_this37.state.Metadata.Name=typeof _this37.options.Name=='string'?_this37.options.Name:"Unnamed Operation ".concat(_this37.state.Metadata.UUID);_this37.name=_this37.state.Metadata.Name;_this37.progressTrackerSet=_this37.fable.instantiateServiceProviderWithoutRegistration('ProgressTrackerSet');_this37.state.OverallProgressTracker=_this37.progressTrackerSet.createProgressTracker("Overall-".concat(_this37.state.Metadata.UUID));// This is here to use the pass-through logging functions in the operation itself.
|
|
1947
|
+
_this37.log=_this37;return _this37;}_inherits(FableOperation,_libFableServiceBase8);return _createClass2(FableOperation,[{key:"execute",value:function execute(fExecutionCompleteCallback){var _this38=this;// TODO: Should the same operation be allowed to execute more than one time?
|
|
1948
|
+
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(_this38));// Steps are executed in a custom context with
|
|
1949
|
+
tmpAnticipate.anticipate(_this38.stepFunctions[_this38.state.Steps[i].GUIDStep].bind({log:_this38,fable:_this38.fable,options:_this38.state.Steps[i].Metadata,metadata:_this38.state.Steps[i].Metadata,ProgressTracker:_this38.progressTrackerSet.getProgressTracker(_this38.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(_this38),OperationState:_this38.state,StepState:_this38.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(_this38));};for(var i=0;i<this.state.Steps.length;i++){_loop2(i);}// Wait for the anticipation to complete
|
|
1950
|
+
tmpAnticipate.wait(function(pError){if(pError){_this38.fable.log.error("Operation [".concat(_this38.state.Metadata.UUID,"] ").concat(_this38.state.Metadata.Name," had an error: ").concat(pError),pError);return fExecutionCompleteCallback(pError);}_this38.info("Operation [".concat(_this38.state.Metadata.UUID,"] ").concat(_this38.state.Metadata.Name," complete."));var tmpOperationTimingMessage=_this38.progressTrackerSet.getProgressTrackerStatusString(_this38.state.OverallProgressTracker.Hash);_this38.progressTrackerSet.endProgressTracker(_this38.state.OverallProgressTracker.Hash);_this38.fable.log.info("Operation [".concat(_this38.state.Metadata.UUID,"] ").concat(tmpOperationTimingMessage,"."));return fExecutionCompleteCallback();});}// There are three ways to add steps:
|
|
1866
1951
|
// 1. As a basic javascript function
|
|
1867
1952
|
// --
|
|
1868
1953
|
// This is the most basic, java"script" way to add a step. It will
|
|
@@ -1871,11 +1956,11 @@ tmpAnticipate.wait(function(pError){if(pError){_this36.fable.log.error("Operatio
|
|
|
1871
1956
|
},{key:"addStep",value:function addStep(fStepFunction,pStepMetadata,pStepName,pStepDescription,pGUIDStep){var tmpStep={};// GUID is optional
|
|
1872
1957
|
tmpStep.GUIDStep=typeof pGUIDStep!=='undefined'?pGUIDStep:"STEP-".concat(this.state.Steps.length,"-").concat(this.fable.DataGeneration.randomNumericString());// Name is optional
|
|
1873
1958
|
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
|
|
1874
|
-
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":91,"big.js":17,"fable-serviceproviderbase":59}],93:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase9){function FableServiceProgressTime(pFable,pOptions,pServiceHash){var
|
|
1959
|
+
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":91,"big.js":17,"fable-serviceproviderbase":59}],93:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase9){function FableServiceProgressTime(pFable,pOptions,pServiceHash){var _this39;_classCallCheck2(this,FableServiceProgressTime);_this39=_callSuper(this,FableServiceProgressTime,[pFable,pOptions,pServiceHash]);_this39.serviceType='ProgressTime';_this39.timeStamps={};return _this39;}_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.
|
|
1875
1960
|
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.
|
|
1876
|
-
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":59}],94:[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;},{}],95:[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
|
|
1877
|
-
|
|
1878
|
-
|
|
1961
|
+
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":59}],94:[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;},{}],95:[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 _this40;_classCallCheck2(this,FableServiceProgressTrackerSet);_this40=_callSuper(this,FableServiceProgressTrackerSet,[pFable,pOptions,pServiceHash]);_this40.serviceType='ProgressTrackerSet';_this40.progressTrackers={};// Create an internal PorgressTime service to track timestamps
|
|
1962
|
+
_this40.progressTimes=_this40.fable.instantiateServiceProviderWithoutRegistration('ProgressTime');// This timestamp is used and updated by *all* progress trackers.
|
|
1963
|
+
_this40.progressTimes.createTimeStamp('CurrentTime');return _this40;}_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%
|
|
1879
1964
|
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
|
|
1880
1965
|
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.
|
|
1881
1966
|
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
|
|
@@ -1896,20 +1981,20 @@ this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!(tmpProgressTrackerH
|
|
|
1896
1981
|
if(tmpProgressTracker.StartTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," has not been started yet.");}// 2. Started, but no operations completed
|
|
1897
1982
|
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
|
|
1898
1983
|
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
|
|
1899
|
-
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":94,"fable-serviceproviderbase":59}],96:[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
|
|
1984
|
+
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":94,"fable-serviceproviderbase":59}],96:[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 _this41;_classCallCheck2(this,FableServiceRestClient);_this41=_callSuper(this,FableServiceRestClient,[pFable,pOptions,pServiceHash]);_this41.TraceLog=false;if(_this41.options.TraceLog||_this41.fable.TraceLog){_this41.TraceLog=true;}_this41.dataFormat=_this41.fable.services.DataFormat;_this41.serviceType='RestClient';_this41.cookie=false;// This is a function that can be overridden, to allow the management
|
|
1900
1985
|
// of the request options before they are passed to the request library.
|
|
1901
|
-
|
|
1986
|
+
_this41.prepareRequestOptions=function(pOptions){return pOptions;};return _this41;}_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.
|
|
1902
1987
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
1903
1988
|
var tmpOptions=this.prepareCookies(pOptions);// Prepend a string to the URL if it exists in the Fable Config
|
|
1904
|
-
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
|
|
1905
|
-
if(
|
|
1906
|
-
if(
|
|
1907
|
-
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(
|
|
1989
|
+
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 _this42=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(_this42.TraceLog){var tmpConnectTime=_this42.fable.log.getTimeStamp();_this42.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this42.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.
|
|
1990
|
+
if(_this42.TraceLog){var tmpChunkTime=_this42.fable.log.getTimeStamp();_this42.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this42.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this42.TraceLog){var tmpCompletionTime=_this42.fable.log.getTimeStamp();_this42.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this42.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeChunkedRequestBinary",value:function executeChunkedRequestBinary(pOptions,fCallback){var _this43=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(_this43.TraceLog){var tmpConnectTime=_this43.fable.log.getTimeStamp();_this43.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this43.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.
|
|
1991
|
+
if(_this43.TraceLog){var tmpChunkTime=_this43.fable.log.getTimeStamp();_this43.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this43.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.
|
|
1992
|
+
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(_this43.TraceLog){var tmpCompletionTime=_this43.fable.log.getTimeStamp();_this43.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpDataBuffer.length,"b received in ").concat(_this43.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpDataBuffer);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this44=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!('headers'in tmpOptions)){tmpOptions.headers={};}/* Automated headers break some APIs
|
|
1908
1993
|
if (!('Content-Type' in tmpOptions.headers))
|
|
1909
1994
|
{
|
|
1910
1995
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
1911
1996
|
}
|
|
1912
|
-
*/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(
|
|
1997
|
+
*/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(_this44.TraceLog){var tmpConnectTime=_this44.fable.log.getTimeStamp();_this44.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this44.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this44.TraceLog){var tmpChunkTime=_this44.fable.log.getTimeStamp();_this44.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this44.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this44.TraceLog){var tmpCompletionTime=_this44.fable.log.getTimeStamp();_this44.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this44.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":31,"fable-serviceproviderbase":59,"simple-get":163}],97:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase12){// Underscore and lodash have a behavior, _.template, which compiles a
|
|
1913
1998
|
// string-based template with code snippets into simple executable pieces,
|
|
1914
1999
|
// with the added twist of returning a precompiled function ready to go.
|
|
1915
2000
|
//
|
|
@@ -1918,16 +2003,16 @@ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.
|
|
|
1918
2003
|
//
|
|
1919
2004
|
// This is an implementation of that.
|
|
1920
2005
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
1921
|
-
function FableServiceTemplate(pFable,pOptions,pServiceHash){var
|
|
2006
|
+
function FableServiceTemplate(pFable,pOptions,pServiceHash){var _this45;_classCallCheck2(this,FableServiceTemplate);_this45=_callSuper(this,FableServiceTemplate,[pFable,pOptions,pServiceHash]);_this45.serviceType='Template';// These are the exact regex's used in lodash/underscore
|
|
1922
2007
|
// TODO: Switch this to precedent
|
|
1923
|
-
|
|
2008
|
+
_this45.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.
|
|
1924
2009
|
GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper functions.
|
|
1925
2010
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
1926
|
-
|
|
2011
|
+
_this45.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
|
|
1927
2012
|
// function on this class.
|
|
1928
|
-
|
|
2013
|
+
_this45.renderFunction=false;_this45.templateString=false;return _this45;}_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 _this46=this;// For now this is being kept in a weird form ... this is to mimic the old
|
|
1929
2014
|
// underscore code until this is rewritten using precedent.
|
|
1930
|
-
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(
|
|
2015
|
+
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(_this46.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
|
|
1931
2016
|
// precompilation.
|
|
1932
2017
|
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);}(libFableServiceBase);module.exports=FableServiceTemplate;},{"fable-serviceproviderbase":59}],98:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');// TODO: These are still pretty big -- consider the smaller polyfills
|
|
1933
2018
|
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
|
|
@@ -1939,8 +2024,8 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
1939
2024
|
//
|
|
1940
2025
|
// This is an implementation of that.
|
|
1941
2026
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
1942
|
-
function FableServiceUtility(pFable,pOptions,pServiceHash){var
|
|
1943
|
-
|
|
2027
|
+
function FableServiceUtility(pFable,pOptions,pServiceHash){var _this47;_classCallCheck2(this,FableServiceUtility);_this47=_callSuper(this,FableServiceUtility,[pFable,pOptions,pServiceHash]);_this47.templates={};// These two functions are used extensively throughout
|
|
2028
|
+
_this47.waterfall=libAsyncWaterfall;_this47.eachLimit=libAsyncEachLimit;_this47.bigNumber=libBigNumber;return _this47;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
1944
2029
|
// Now that es6 gives us this, use the native thingy.
|
|
1945
2030
|
// Nevermind, the native thing is not stable enough across environments
|
|
1946
2031
|
// Basic shallow copy
|
|
@@ -1957,9 +2042,54 @@ _inherits(FableServiceUtility,_libFableServiceBase13);return _createClass2(Fable
|
|
|
1957
2042
|
var tmpChunkSize=typeof pChunkSize=='number'?pChunkSize:0;var tmpChunkCache=typeof pChunkCache!='undefined'?pChunkCache:[];if(tmpChunkSize<=0){return tmpChunkCache;}while(tmpInputArray.length){tmpChunkCache.push(tmpInputArray.splice(0,tmpChunkSize));}return tmpChunkCache;}/**
|
|
1958
2043
|
* Get a value from fable/pict by hash/address
|
|
1959
2044
|
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
1960
|
-
*/},{key:"
|
|
1961
|
-
|
|
1962
|
-
|
|
2045
|
+
*/},{key:"getInternalValueByHash",value:function getInternalValueByHash(pValueAddress){// Get the value from the internal manifest and return it
|
|
2046
|
+
return this.getValueByHash(this.fable,pValueAddress);}/**
|
|
2047
|
+
* Get a value from an object by hash/address
|
|
2048
|
+
* @param {object} pObject - The object to get the value from
|
|
2049
|
+
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
2050
|
+
* @param {object} [pManifest] - The manyfest object to use; constructs one inline if not provided
|
|
2051
|
+
* @returns {object} - The value from the object
|
|
2052
|
+
*/},{key:"getValueByHash",value:function getValueByHash(pObject,pValueAddress,pManifest){var tmpManifest=pManifest;if(typeof tmpManifest=='undefined'){// Lazily create a manifest if it doesn't exist
|
|
2053
|
+
if(!this.manifest){this.manifest=this.fable.newManyfest();}tmpManifest=this.manifest;}// Get the value from the internal manifest and return it
|
|
2054
|
+
return tmpManifest.getValueByHash(pObject,pValueAddress);}/**
|
|
2055
|
+
* Set a value to an object by hash/address
|
|
2056
|
+
* @param {object} pObject - The object to get the value from
|
|
2057
|
+
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
2058
|
+
* @param {object} pValue - The value to set
|
|
2059
|
+
* @param {object} [pManifest] - The manyfest object to use; constructs one inline if not provided
|
|
2060
|
+
* @returns {object} - The value from the object
|
|
2061
|
+
*/},{key:"setValueByHash",value:function setValueByHash(pObject,pValueAddress,pValue,pManifest){var tmpManifest=pManifest;if(typeof tmpManifest=='undefined'){// Lazily create a manifest if it doesn't exist
|
|
2062
|
+
if(!this.manifest){this.manifest=this.fable.newManyfest();}tmpManifest=this.manifest;}// Get the value from the internal manifest and return it
|
|
2063
|
+
return tmpManifest.setValueByHash(pObject,pValueAddress,pValue);}/**
|
|
2064
|
+
* Get a value array from an object by hash/address list
|
|
2065
|
+
* @param {object} pObject - The object to get the value from
|
|
2066
|
+
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
2067
|
+
* @param {object} [pManifest] - The manyfest object to use; constructs one inline if not provided
|
|
2068
|
+
* @returns {Array} - The value array built from the hash list
|
|
2069
|
+
*/},{key:"createValueArrayByHashes",value:function createValueArrayByHashes(pObject,pValueHashes,pManifest){var tmpManifest=pManifest;if(typeof tmpManifest=='undefined'){// Lazily create a manifest if it doesn't exist
|
|
2070
|
+
if(!this.manifest){this.manifest=this.fable.newManyfest();}tmpManifest=this.manifest;}if(!Array.isArray(pValueHashes)){return[];}var tmpValueArray=[];for(var i=0;i<pValueHashes.length;i++){tmpValueArray.push(tmpManifest.getValueByHash(pObject,pValueHashes[i]));}// Get the value from the internal manifest and return it
|
|
2071
|
+
return tmpValueArray;}/**
|
|
2072
|
+
* Get a value array by hash/address list from the internal fable/pict state
|
|
2073
|
+
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
2074
|
+
* @param {object} [pManifest] - The manyfest object to use; constructs one inline if not provided
|
|
2075
|
+
* @returns {Array} - The value array built from the hash list
|
|
2076
|
+
*/},{key:"createValueArrayByHashesFromInternal",value:function createValueArrayByHashesFromInternal(pValueHashes,pManifest){return this.createValueArrayByHashes(this.fable,pValueHashes,pManifest);}},{key:"createValueArrayByHashParametersFromInternal",value:function createValueArrayByHashParametersFromInternal(){if(arguments.length<2){return[];}var tmpValueHashes=Array.prototype.slice.call(arguments);return this.createValueArrayByHashes(this.fable,tmpValueHashes);}/**
|
|
2077
|
+
* Get a value object from a list of hash/addressese
|
|
2078
|
+
* @param {object} pObject - The object to get the value from
|
|
2079
|
+
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
2080
|
+
* @param {object} [pManifest] - The manyfest object to use; constructs one inline if not provided
|
|
2081
|
+
* @returns {Array} - The value object built from the hash list
|
|
2082
|
+
*/},{key:"createValueObjectByHashes",value:function createValueObjectByHashes(pObject,pValueHashes,pManifest){var tmpManifest=pManifest;if(typeof tmpManifest=='undefined'){// Lazily create a manifest if it doesn't exist
|
|
2083
|
+
if(!this.manifest){this.manifest=this.fable.newManyfest();}tmpManifest=this.manifest;}if(!Array.isArray(pValueHashes)){return{};}var tmpValueObject={};for(var i=0;i<pValueHashes.length;i++){tmpValueObject[pValueHashes[i]]=tmpManifest.getValueByHash(pObject,pValueHashes[i]);}// Get the value from the internal manifest and return it
|
|
2084
|
+
return tmpValueObject;}/**
|
|
2085
|
+
* Get a value object by hash/address list from the internal fable/pict state
|
|
2086
|
+
* @param {string} pValueAddress - The manyfest hash/address of the value to get
|
|
2087
|
+
* @param {object} [pManifest] - The manyfest object to use; constructs one inline if not provided
|
|
2088
|
+
* @returns {object} - The value object built from the hash list
|
|
2089
|
+
*/},{key:"createValueObjectByHashesFromInternal",value:function createValueObjectByHashesFromInternal(pValueHashes,pManifest){return this.createValueObjectByHashes(this.fable,pValueHashes,pManifest);}/**
|
|
2090
|
+
* Get a value object by hash/address list as parameters from the internal fable/pict state
|
|
2091
|
+
* @returns {Array} - The value array built from the hash list
|
|
2092
|
+
*/},{key:"createValueObjectByHashParametersFromInternal",value:function createValueObjectByHashParametersFromInternal(){var tmpValueHashes=Array.prototype.slice.call(arguments);return this.createValueObjectByHashes(this.fable,tmpValueHashes);}/**
|
|
1963
2093
|
* Check if a value is null or empty
|
|
1964
2094
|
* @param {object} pObject - The object to check
|
|
1965
2095
|
* @param {string} pValueAddress - The manyfest hash/address to check
|
|
@@ -2037,12 +2167,12 @@ var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pStr
|
|
|
2037
2167
|
*
|
|
2038
2168
|
* @class ManyfestHashTranslation
|
|
2039
2169
|
*/var ManyfestHashTranslation=/*#__PURE__*/function(){function ManyfestHashTranslation(pInfoLog,pErrorLog){_classCallCheck2(this,ManyfestHashTranslation);// Wire in logging
|
|
2040
|
-
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
|
|
2170
|
+
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 _this48=this;// This adds a translation in the form of:
|
|
2041
2171
|
// { "SourceHash": "DestinationHash", "SecondSourceHash":"SecondDestinationHash" }
|
|
2042
|
-
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'){
|
|
2172
|
+
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'){_this48.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{_this48.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}},{key:"removeTranslationHash",value:function removeTranslationHash(pTranslationHash){if(pTranslationHash in this.translationTable){delete this.translationTable[pTranslationHash];}}// This removes translations.
|
|
2043
2173
|
// If passed a string, just removes the single one.
|
|
2044
2174
|
// If passed an object, it does all the source keys.
|
|
2045
|
-
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var
|
|
2175
|
+
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var _this49=this;if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(_typeof(pTranslation)=='object'){var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){_this49.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":115}],115:[function(require,module,exports){/**
|
|
2046
2176
|
* @author <steven@velozo.com>
|
|
2047
2177
|
*//**
|
|
2048
2178
|
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
@@ -2786,9 +2916,9 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
2786
2916
|
* Manyfest object address-based descriptions and manipulations.
|
|
2787
2917
|
*
|
|
2788
2918
|
* @class Manyfest
|
|
2789
|
-
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi10){function Manyfest(pFable,pManifest,pServiceHash){var
|
|
2790
|
-
|
|
2791
|
-
|
|
2919
|
+
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi10){function Manyfest(pFable,pManifest,pServiceHash){var _this50;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this50=_callSuper(this,Manyfest,[{}]);}else{_this50=_callSuper(this,Manyfest,[pFable,pManifest,pServiceHash]);}_this50.serviceType='Manifest';// Wire in logging
|
|
2920
|
+
_this50.logInfo=libSimpleLog;_this50.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
2921
|
+
_this50.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this50.logInfo,_this50.logError);_this50.objectAddressGetValue=new libObjectAddressGetValue(_this50.logInfo,_this50.logError);_this50.objectAddressSetValue=new libObjectAddressSetValue(_this50.logInfo,_this50.logError);_this50.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this50.logInfo,_this50.logError);if(!('defaultValues'in _this50.options)){_this50.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 _this50.options)){_this50.options.strict=false;}_this50.scope=undefined;_this50.elementAddresses=undefined;_this50.elementHashes=undefined;_this50.elementDescriptors=undefined;_this50.reset();if(_typeof(_this50.options)==='object'){_this50.loadManifest(_this50.options);}_this50.schemaManipulations=new libSchemaManipulation(_this50.logInfo,_this50.logError);_this50.objectAddressGeneration=new libObjectAddressGeneration(_this50.logInfo,_this50.logError);_this50.hashTranslations=new libHashTranslation(_this50.logInfo,_this50.logError);_this50.numberRegex=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;return _assertThisInitialized(_this50);}/*************************************************************************
|
|
2792
2922
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
2793
2923
|
*/// Reset critical manifest properties
|
|
2794
2924
|
_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
|
|
@@ -2839,13 +2969,13 @@ return null;}}}// Enumerate through the schema and populate default values if th
|
|
|
2839
2969
|
},{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.
|
|
2840
2970
|
function(pDescriptor){return'Default'in pDescriptor;});}// Forcefully populate all values even if they don't have defaults.
|
|
2841
2971
|
// Based on type, this can do unexpected things.
|
|
2842
|
-
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var
|
|
2972
|
+
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var _this51=this;// Automatically create an object if one isn't passed in.
|
|
2843
2973
|
var tmpObject=_typeof(pObject)==='object'?pObject:{};// Default to *NOT OVERWRITING* properties
|
|
2844
2974
|
var tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverwriteProperties;// This is a filter function, which is passed the schema and allows complex filtering of population
|
|
2845
2975
|
// The default filter function just returns true, populating everything.
|
|
2846
|
-
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=
|
|
2976
|
+
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=_this51.getDescriptor(pAddress);// Check the filter function to see if this is an address we want to set the value for.
|
|
2847
2977
|
if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
|
|
2848
|
-
if(tmpOverwriteProperties||!
|
|
2978
|
+
if(tmpOverwriteProperties||!_this51.checkAddressExists(tmpObject,pAddress)){_this51.setValueAtAddress(tmpObject,pAddress,_this51.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":114,"./Manyfest-LogToConsole.js":115,"./Manyfest-ObjectAddress-CheckAddressExists.js":116,"./Manyfest-ObjectAddress-DeleteValue.js":117,"./Manyfest-ObjectAddress-GetValue.js":118,"./Manyfest-ObjectAddress-SetValue.js":120,"./Manyfest-ObjectAddressGeneration.js":121,"./Manyfest-SchemaManipulation.js":123,"fable-serviceproviderbase":59}],125:[function(require,module,exports){'use strict';/** @type {import('./abs')} */module.exports=Math.abs;},{}],126:[function(require,module,exports){'use strict';/** @type {import('./floor')} */module.exports=Math.floor;},{}],127:[function(require,module,exports){'use strict';/** @type {import('./isNaN')} */module.exports=Number.isNaN||function isNaN(a){return a!==a;};},{}],128:[function(require,module,exports){'use strict';/** @type {import('./max')} */module.exports=Math.max;},{}],129:[function(require,module,exports){'use strict';/** @type {import('./min')} */module.exports=Math.min;},{}],130:[function(require,module,exports){'use strict';/** @type {import('./pow')} */module.exports=Math.pow;},{}],131:[function(require,module,exports){'use strict';/** @type {import('./round')} */module.exports=Math.round;},{}],132:[function(require,module,exports){'use strict';var $isNaN=require('./isNaN');/** @type {import('./sign')} */module.exports=function sign(number){if($isNaN(number)||number===0){return number;}return number<0?-1:+1;};},{"./isNaN":127}],133:[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
|
|
2849
2979
|
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
|
|
2850
2980
|
?function(O){return O.__proto__;// eslint-disable-line no-proto
|
|
2851
2981
|
}: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)
|
|
@@ -2953,13 +3083,13 @@ IdentifierAddressPrefix:'PICT-'};/**
|
|
|
2953
3083
|
* @param {import('fable')} pFable
|
|
2954
3084
|
* @param {any} [pOptions]
|
|
2955
3085
|
* @param {string} [pServiceHash]
|
|
2956
|
-
*/function PictApplication(pFable,pOptions,pServiceHash){var
|
|
3086
|
+
*/function PictApplication(pFable,pOptions,pServiceHash){var _this52;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this52=_callSuper(this,PictApplication,[pFable,tmpOptions,pServiceHash]);/** @type {any} */_this52.options;/** @type {any} */_this52.log;/** @type {import('pict') & import('fable')} */_this52.fable;/** @type {string} */_this52.UUID;/** @type {string} */_this52.Hash;/**
|
|
2957
3087
|
* @type {{ [key: string]: any }}
|
|
2958
|
-
*/
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
var tmpManifestKeys=Object.keys(
|
|
2962
|
-
var tmpManifestKey=tmpManifestKeys[i];
|
|
3088
|
+
*/_this52.servicesMap;_this52.serviceType='PictApplication';/** @type {Object} */_this52._Package=libPackage;// Convenience and consistency naming
|
|
3089
|
+
_this52.pict=_this52.fable;// Wire in the essential Pict state
|
|
3090
|
+
_this52.AppData=_this52.fable.AppData;/** @type {number} */_this52.initializeTimestamp;/** @type {number} */_this52.lastSolvedTimestamp;/** @type {number} */_this52.lastMarshalFromViewsTimestamp;/** @type {number} */_this52.lastMarshalToViewsTimestamp;/** @type {number} */_this52.lastAutoRenderTimestamp;// Load all the manifests for the application
|
|
3091
|
+
var tmpManifestKeys=Object.keys(_this52.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
3092
|
+
var tmpManifestKey=tmpManifestKeys[i];_this52.fable.instantiateServiceProvider('Manifest',_this52.options.Manifests[tmpManifestKey],tmpManifestKey);}}return _this52;}/* -------------------------------------------------------------------------- *//* Code Section: Solve All Views *//* -------------------------------------------------------------------------- *//**
|
|
2963
3093
|
* @return {boolean}
|
|
2964
3094
|
*/_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;}/**
|
|
2965
3095
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -2979,12 +3109,12 @@ tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.optio
|
|
|
2979
3109
|
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)
|
|
2980
3110
|
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;}/**
|
|
2981
3111
|
* @param {(error?: Error) => void} fCallback
|
|
2982
|
-
*/},{key:"solveAsync",value:function solveAsync(fCallback){var
|
|
2983
|
-
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){
|
|
3112
|
+
*/},{key:"solveAsync",value:function solveAsync(fCallback){var _this53=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
|
|
3113
|
+
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){_this53.log.error("PictApp [".concat(_this53.UUID,"]::[").concat(_this53.Hash,"] ").concat(_this53.options.Name," solveAsync Auto Callback Error: ").concat(pError),pError);}};}// Walk through any loaded providers and solve them as well.
|
|
2984
3114
|
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)
|
|
2985
3115
|
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.
|
|
2986
3116
|
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)
|
|
2987
|
-
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(
|
|
3117
|
+
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(_this53.pict.LogNoisiness>2){_this53.log.trace("PictApp [".concat(_this53.UUID,"]::[").concat(_this53.Hash,"] ").concat(_this53.options.Name," solveAsync() complete."));}_this53.lastSolvedTimestamp=_this53.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
2988
3118
|
* @return {boolean}
|
|
2989
3119
|
*/},{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;}/**
|
|
2990
3120
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3008,15 +3138,15 @@ this.solve();}// Now check and see if we should automatically render as well
|
|
|
3008
3138
|
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
|
|
3009
3139
|
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;}}/**
|
|
3010
3140
|
* @param {(error?: Error) => void} fCallback
|
|
3011
|
-
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var
|
|
3012
|
-
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){
|
|
3141
|
+
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this54=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
|
|
3142
|
+
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){_this54.log.error("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.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
|
|
3013
3143
|
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.
|
|
3014
3144
|
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)
|
|
3015
3145
|
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.
|
|
3016
3146
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
3017
3147
|
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
|
|
3018
3148
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3019
|
-
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){if(pError){
|
|
3149
|
+
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){if(pError){_this54.log.error("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.options.Name," initializeAsync Error: ").concat(pError.message||pError),{stack:pError.stack});}_this54.initializeTimestamp=_this54.fable.log.getTimeStamp();if(_this54.pict.LogNoisiness>2){_this54.log.trace("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.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?
|
|
3020
3150
|
return tmpCallback();}}/**
|
|
3021
3151
|
* @return {boolean}
|
|
3022
3152
|
*/},{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;}/**
|
|
@@ -3034,9 +3164,9 @@ return tmpCallback();}}/**
|
|
|
3034
3164
|
*/},{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.
|
|
3035
3165
|
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;}/**
|
|
3036
3166
|
* @param {(error?: Error) => void} fCallback
|
|
3037
|
-
*/},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var
|
|
3038
|
-
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){
|
|
3039
|
-
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(
|
|
3167
|
+
*/},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var _this55=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
3168
|
+
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){_this55.log.error("PictApp [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.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.
|
|
3169
|
+
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(_this55.pict.LogNoisiness>2){_this55.log.trace("PictApp [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.options.Name," marshalFromViewsAsync() complete."));}_this55.lastMarshalFromViewsTimestamp=_this55.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3040
3170
|
* @return {boolean}
|
|
3041
3171
|
*/},{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;}/**
|
|
3042
3172
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3053,9 +3183,9 @@ var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalFromViews=[
|
|
|
3053
3183
|
*/},{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.
|
|
3054
3184
|
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;}/**
|
|
3055
3185
|
* @param {(error?: Error) => void} fCallback
|
|
3056
|
-
*/},{key:"marshalToViewsAsync",value:function marshalToViewsAsync(fCallback){var
|
|
3057
|
-
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){
|
|
3058
|
-
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(
|
|
3186
|
+
*/},{key:"marshalToViewsAsync",value:function marshalToViewsAsync(fCallback){var _this56=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
3187
|
+
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){_this56.log.error("PictApp [".concat(_this56.UUID,"]::[").concat(_this56.Hash,"] ").concat(_this56.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.
|
|
3188
|
+
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(_this56.pict.LogNoisiness>2){_this56.log.trace("PictApp [".concat(_this56.UUID,"]::[").concat(_this56.Hash,"] ").concat(_this56.options.Name," marshalToViewsAsync() complete."));}_this56.lastMarshalToViewsTimestamp=_this56.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3059
3189
|
* @return {boolean}
|
|
3060
3190
|
*/},{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;}/**
|
|
3061
3191
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3083,8 +3213,8 @@ var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpVie
|
|
|
3083
3213
|
* @param {(error?: Error) => void} [fCallback] - The callback, if all other parameters are provided.
|
|
3084
3214
|
*
|
|
3085
3215
|
* TODO: Should we support objects for pTemplateDataAddress for parity with pict-view?
|
|
3086
|
-
*/},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var
|
|
3087
|
-
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){
|
|
3216
|
+
*/},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this57=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
|
|
3217
|
+
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){_this57.log.error("PictApp [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.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 tmpRenderAnticipate=this.fable.newAnticipate();tmpRenderAnticipate.anticipate(this.onBeforeRenderAsync.bind(this));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));}tmpRenderAnticipate.anticipate(this.onRenderAsync.bind(this));tmpRenderAnticipate.anticipate(function(fNext){tmpView.renderAsync.call(tmpView,tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress,fNext);});tmpRenderAnticipate.anticipate(this.onAfterRenderAsync.bind(this));return tmpRenderAnticipate.wait(tmpCallback);}/**
|
|
3088
3218
|
* @return {boolean}
|
|
3089
3219
|
*/},{key:"onAfterRender",value:function onAfterRender(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterRender:"));}return true;}/**
|
|
3090
3220
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3094,24 +3224,24 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateDataAddr
|
|
|
3094
3224
|
* @param {(error?: Error) => void} fCallback
|
|
3095
3225
|
*/},{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);}/**
|
|
3096
3226
|
* @return {void}
|
|
3097
|
-
*/},{key:"renderAutoViews",value:function renderAutoViews(){var
|
|
3227
|
+
*/},{key:"renderAutoViews",value:function renderAutoViews(){var _this58=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
|
|
3098
3228
|
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
3099
3229
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3100
|
-
tmpLoadedViews.sort(function(a,b){return
|
|
3230
|
+
tmpLoadedViews.sort(function(a,b){return _this58.pict.views[a].options.AutoRenderOrdinal-_this58.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."));}}/**
|
|
3101
3231
|
* @param {(error?: Error) => void} fCallback
|
|
3102
|
-
*/},{key:"renderAutoViewsAsync",value:function renderAutoViewsAsync(fCallback){var
|
|
3103
|
-
var tmpCallback=typeof fCallback==='function'?fCallback: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){
|
|
3232
|
+
*/},{key:"renderAutoViewsAsync",value:function renderAutoViewsAsync(fCallback){var _this59=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
3233
|
+
var tmpCallback=typeof fCallback==='function'?fCallback: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){_this59.log.error("PictApp [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.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
|
|
3104
3234
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
3105
3235
|
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
3106
3236
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3107
|
-
tmpLoadedViews.sort(function(a,b){return
|
|
3237
|
+
tmpLoadedViews.sort(function(a,b){return _this59.pict.views[a].options.AutoRenderOrdinal-_this59.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){_this59.lastAutoRenderTimestamp=_this59.fable.log.getTimeStamp();if(_this59.pict.LogNoisiness>0){_this59.log.trace("PictApp [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.options.Name," renderAutoViewsAsync complete."));}return tmpCallback(pError);});}/**
|
|
3108
3238
|
* @return {boolean}
|
|
3109
3239
|
*/},{key:"isPictApplication",get:function get(){return true;}}]);}(libFableServiceBase);module.exports=PictApplication;},{"../package.json":136,"fable-serviceproviderbase":59}],138:[function(require,module,exports){module.exports={"name":"pict-provider","version":"1.0.3","description":"Pict Provider Base Class","main":"source/Pict-Provider.js","scripts":{"start":"node source/Pict-Provider.js","test":"npx mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-provider-image:local","docker-dev-run":"docker run -it -d --name pict-provider-dev -p 24125:8080 -p 30027:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-provider\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-provider-image:local","docker-dev-shell":"docker exec -it pict-provider-dev /bin/bash"},"repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-provider.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-provider/issues"},"homepage":"https://github.com/stevenvelozo/pict-provider#readme","devDependencies":{"pict":"^1.0.215","quackage":"^1.0.33"},"dependencies":{"fable-serviceproviderbase":"^3.0.15"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]}};},{}],139:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');var defaultPictProviderSettings={ProviderIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
3110
3240
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
3111
|
-
AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase15){function PictProvider(pFable,pOptions,pServiceHash){var
|
|
3112
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);
|
|
3113
|
-
|
|
3114
|
-
|
|
3241
|
+
AutoInitialize:true,AutoInitializeOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase15){function PictProvider(pFable,pOptions,pServiceHash){var _this60;_classCallCheck2(this,PictProvider);// Intersect default options, parent constructor, service information
|
|
3242
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);_this60=_callSuper(this,PictProvider,[pFable,tmpOptions,pServiceHash]);if(!_this60.options.ProviderIdentifier){_this60.options.ProviderIdentifier="AutoProviderID-".concat(_this60.fable.getUUID());}_this60.serviceType='PictProvider';/** @type {Object} */_this60._Package=libPackage;// Convenience and consistency naming
|
|
3243
|
+
_this60.pict=_this60.fable;// Wire in the essential Pict application state
|
|
3244
|
+
_this60.AppData=_this60.pict.AppData;_this60.initializeTimestamp=false;_this60.lastSolvedTimestamp=false;for(var i=0;i<_this60.options.Templates.length;i++){var tmpDefaultTemplate=_this60.options.Templates[i];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this60.log.error("PictProvider [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.options.ProviderIdentifier," could not load Default Template ").concat(i," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictProvider [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.options.ProviderIdentifier," options object.");}_this60.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}return _this60;}/* -------------------------------------------------------------------------- *//* 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 _this61=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){_this61.initializeTimestamp=_this61.pict.log.getTimeStamp();if(_this61.pict.LogNoisiness>0){_this61.log.info("PictProvider [".concat(_this61.UUID,"]::[").concat(_this61.Hash,"] ").concat(_this61.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?
|
|
3115
3245
|
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;},{"../package.json":138,"fable-serviceproviderbase":59}],140:[function(require,module,exports){module.exports={"name":"pict-template","version":"1.0.10","description":"Pict Template Base Class","main":"source/Pict-Template.js","scripts":{"start":"node source/Pict-Template.js","test":"npx mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","types":"tsc -p ."},"types":"types/source/Pict-Template.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-view.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-view/issues"},"homepage":"https://github.com/stevenvelozo/pict-view#readme","devDependencies":{"pict":"^1.0.227","quackage":"^1.0.36","typescript":"^5.7.2"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"dependencies":{"fable-serviceproviderbase":"^3.0.15"}};},{}],141:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');/** @typedef {import('pict') & {
|
|
3116
3246
|
* [key: string]: any, // represent services for now as a workaround
|
|
3117
3247
|
* }} Pict *//**
|
|
@@ -3121,7 +3251,7 @@ return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize
|
|
|
3121
3251
|
* @param {Pict} pFable - The Fable Framework instance
|
|
3122
3252
|
* @param {any} [pOptions] - The options for the service
|
|
3123
3253
|
* @param {String} [pServiceHash] - The hash of the service
|
|
3124
|
-
*/function PictTemplateExpression(pFable,pOptions,pServiceHash){var
|
|
3254
|
+
*/function PictTemplateExpression(pFable,pOptions,pServiceHash){var _this62;_classCallCheck2(this,PictTemplateExpression);_this62=_callSuper(this,PictTemplateExpression,[pFable,pOptions,pServiceHash]);/** @type {Pict} */_this62.fable;/** @type {Pict} */_this62.pict=_this62.fable;_this62.serviceType='PictTemplate';/** @type {Object} */_this62._Package=libPackage;return _this62;}/**
|
|
3125
3255
|
* Render a template expression, returning a string with the resulting content.
|
|
3126
3256
|
*
|
|
3127
3257
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -3175,21 +3305,21 @@ AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSS
|
|
|
3175
3305
|
* @param {any} pFable - The Fable object that this service is attached to.
|
|
3176
3306
|
* @param {any} [pOptions] - (optional) The options for this service.
|
|
3177
3307
|
* @param {string} [pServiceHash] - (optional) The hash of the service.
|
|
3178
|
-
*/function PictView(pFable,pOptions,pServiceHash){var
|
|
3179
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);
|
|
3180
|
-
/** @type {any} */
|
|
3181
|
-
/** @type {import('pict') & { log: any, instantiateServiceProviderWithoutRegistration: (hash: String) => any }} */
|
|
3182
|
-
|
|
3308
|
+
*/function PictView(pFable,pOptions,pServiceHash){var _this63;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
3309
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this63=_callSuper(this,PictView,[pFable,tmpOptions,pServiceHash]);//FIXME: add types to fable and ancillaries
|
|
3310
|
+
/** @type {any} */_this63.fable;/** @type {any} */_this63.options;/** @type {String} */_this63.UUID;/** @type {String} */_this63.Hash;/** @type {any} */_this63.log;if(!_this63.options.ViewIdentifier){_this63.options.ViewIdentifier="AutoViewID-".concat(_this63.fable.getUUID());}_this63.serviceType='PictView';/** @type {Object} */_this63._Package=libPackage;// Convenience and consistency naming
|
|
3311
|
+
/** @type {import('pict') & { log: any, instantiateServiceProviderWithoutRegistration: (hash: String) => any }} */_this63.pict=_this63.fable;// Wire in the essential Pict application state
|
|
3312
|
+
_this63.AppData=_this63.pict.AppData;/** @type {PictTimestamp} */_this63.initializeTimestamp=false;/** @type {PictTimestamp} */_this63.lastSolvedTimestamp=false;/** @type {PictTimestamp} */_this63.lastRenderedTimestamp=false;/** @type {PictTimestamp} */_this63.lastMarshalFromViewTimestamp=false;/** @type {PictTimestamp} */_this63.lastMarshalToViewTimestamp=false;// Load all templates from the array in the options
|
|
3183
3313
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
3184
|
-
for(var i=0;i<
|
|
3314
|
+
for(var i=0;i<_this63.options.Templates.length;i++){var tmpTemplate=_this63.options.Templates[i];if(!('Hash'in tmpTemplate)||!('Template'in tmpTemplate)){_this63.log.error("PictView [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ViewIdentifier," options object.");}_this63.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
3185
3315
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
3186
|
-
for(var _i53=0;_i53<
|
|
3187
|
-
if(
|
|
3316
|
+
for(var _i53=0;_i53<_this63.options.DefaultTemplates.length;_i53++){var tmpDefaultTemplate=_this63.options.DefaultTemplates[_i53];if(!('Postfix'in tmpDefaultTemplate)||!('Template'in tmpDefaultTemplate)){_this63.log.error("PictView [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ViewIdentifier," could not load Default Template ").concat(_i53," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ViewIdentifier," options object.");}_this63.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load the CSS if it's available
|
|
3317
|
+
if(_this63.options.CSS){var tmpCSSHash=_this63.options.CSSHash?_this63.options.CSSHash:"View-".concat(_this63.options.ViewIdentifier);var tmpCSSProvider=_this63.options.CSSProvider?_this63.options.CSSProvider:tmpCSSHash;_this63.pict.CSSMap.addCSS(tmpCSSHash,_this63.options.CSS,tmpCSSProvider,_this63.options.CSSPriority);}// Load all renderables
|
|
3188
3318
|
// Renderables are launchable renderable instructions with templates
|
|
3189
3319
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
3190
3320
|
// The only parts that are necessary are Identifier and Template
|
|
3191
3321
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
3192
|
-
/** @type {Object<String, Renderable>} */
|
|
3322
|
+
/** @type {Object<String, Renderable>} */_this63.renderables={};for(var _i54=0;_i54<_this63.options.Renderables.length;_i54++){/** @type {Renderable} */var tmpRenderable=_this63.options.Renderables[_i54];_this63.addRenderable(tmpRenderable);}return _this63;}/**
|
|
3193
3323
|
* Adds a renderable to the view.
|
|
3194
3324
|
*
|
|
3195
3325
|
* @param {string | Renderable} pRenderableHash - The hash of the renderable, or a renderable object.
|
|
@@ -3217,7 +3347,7 @@ tmpRenderable=pRenderableHash;}else{/** @type {RenderMethod} */var tmpRenderMeth
|
|
|
3217
3347
|
* Performs view initialization (async flow).
|
|
3218
3348
|
*
|
|
3219
3349
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3220
|
-
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var
|
|
3350
|
+
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this64=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(/** @param {Error} pError */function(pError){if(pError){_this64.log.error("PictView [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.options.ViewIdentifier," initialization failed: ").concat(pError.message||pError),{stack:pError.stack});}_this64.initializeTimestamp=_this64.pict.log.getTimeStamp();if(_this64.pict.LogNoisiness>0){_this64.log.info("PictView [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.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?
|
|
3221
3351
|
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;}/**
|
|
3222
3352
|
* Lifecycle hook that triggers after the view is initialized (async flow).
|
|
3223
3353
|
*
|
|
@@ -3271,10 +3401,10 @@ this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord,tmpConten
|
|
|
3271
3401
|
* @param {ErrorCallback} [fCallback] - The callback to call when the async operation is complete.
|
|
3272
3402
|
*
|
|
3273
3403
|
* @return {void}
|
|
3274
|
-
*/},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var
|
|
3275
|
-
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress: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){
|
|
3276
|
-
|
|
3277
|
-
|
|
3404
|
+
*/},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var _this65=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
|
|
3405
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress: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){_this65.log.error("PictView [".concat(_this65.UUID,"]::[").concat(_this65.Hash,"] ").concat(_this65.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 tmpRecordAddress;var tmpRecord;if(_typeof(pTemplateRecordAddress)==='object'){tmpRecord=pTemplateRecordAddress;tmpRecordAddress='Passed in as object';}else{tmpRecordAddress=typeof pTemplateRecordAddress==='string'?pTemplateRecordAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;tmpRecord=typeof tmpRecordAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpRecordAddress):undefined;}if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(tmpRenderableHash,"] Destination[").concat(tmpRenderDestinationAddress,"] TemplateRecordAddress[").concat(tmpRecordAddress,"] 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){_this65.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord);_this65.onBeforeRenderAsync(fOnBeforeRenderCallback);});var tmpContent;tmpAnticipate.anticipate(function(fAsyncTemplateCallback){// Render the template (asynchronously)
|
|
3406
|
+
_this65.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpRecord,function(pError,pContent){if(pError){_this65.log.error("PictView [".concat(_this65.UUID,"]::[").concat(_this65.Hash,"] ").concat(_this65.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it did not parse the template."),pError);return fAsyncTemplateCallback(pError);}tmpContent=pContent;if(_this65.pict.LogNoisiness>0){_this65.log.trace("PictView [".concat(_this65.UUID,"]::[").concat(_this65.Hash,"] ").concat(_this65.options.ViewIdentifier," Assigning Renderable[").concat(tmpRenderableHash,"] content length ").concat(pContent.length," to Destination [").concat(tmpRenderDestinationAddress,"] using Async render method ").concat(tmpRenderable.RenderMethod,"."));}_this65.pict.ContentAssignment.projectContent(tmpRenderable.RenderMethod,tmpRenderDestinationAddress,pContent,tmpRenderable.TestAddress);// Execute the developer-overridable asynchronous post-render behavior
|
|
3407
|
+
_this65.lastRenderedTimestamp=_this65.pict.log.getTimeStamp();return fAsyncTemplateCallback();},[_this65]);});tmpAnticipate.anticipate(function(fOnAfterRenderCallback){_this65.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord,tmpContent);_this65.onAfterRenderAsync(fOnAfterRenderCallback);});tmpAnticipate.wait(tmpCallback);}/**
|
|
3278
3408
|
* Renders the default renderable.
|
|
3279
3409
|
*
|
|
3280
3410
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
@@ -3288,8 +3418,8 @@ this.renderAsync(fCallback);}/**
|
|
|
3288
3418
|
* @param {string|ErrorCallback} [pRenderDestinationAddress] - The address where the renderable will be rendered.
|
|
3289
3419
|
* @param {string|object|ErrorCallback} [pTemplateRecordAddress] - The address of (or actual obejct) where the data for the template is stored.
|
|
3290
3420
|
* @param {ErrorCallback} [fCallback] - The callback to call when the async operation is complete.
|
|
3291
|
-
*/},{key:"basicRenderAsync",value:function basicRenderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var
|
|
3292
|
-
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:false;var tmpRenderOptions=this.buildRenderOptions(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress);if(tmpRenderOptions.Valid){this.pict.parseTemplateByHash(tmpRenderOptions.Renderable.TemplateHash,tmpRenderOptions.Record,function(pError,pContent){if(pError){
|
|
3421
|
+
*/},{key:"basicRenderAsync",value:function basicRenderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var _this66=this;// Allow the callback to be passed in as the last parameter no matter what
|
|
3422
|
+
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:false;var tmpRenderOptions=this.buildRenderOptions(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress);if(tmpRenderOptions.Valid){this.pict.parseTemplateByHash(tmpRenderOptions.Renderable.TemplateHash,tmpRenderOptions.Record,function(pError,pContent){if(pError){_this66.log.error("PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderOptions.RenderableHash," because it did not parse the template."),pError);return tmpCallback(pError);}_this66.assignRenderContent(tmpRenderOptions.Renderable,tmpRenderOptions.DestinationAddress,pContent);return tmpCallback();},[this]);}else{var tmpErrorMessage="PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(tmpRenderOptions.RenderableHash," because it is not valid.");this.log.error(tmpErrorMessage);return tmpCallback(tmpErrorMessage);}}/**
|
|
3293
3423
|
* Lifecycle hook that triggers after the view is rendered.
|
|
3294
3424
|
*
|
|
3295
3425
|
* @param {Renderable} pRenderable - The renderable that was rendered.
|
|
@@ -3320,7 +3450,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3320
3450
|
* Performs view solving and triggers lifecycle hooks (async flow).
|
|
3321
3451
|
*
|
|
3322
3452
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3323
|
-
*/},{key:"solveAsync",value:function solveAsync(fCallback){var
|
|
3453
|
+
*/},{key:"solveAsync",value:function solveAsync(fCallback){var _this67=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){_this67.log.error("PictView [".concat(_this67.UUID,"]::[").concat(_this67.Hash,"] ").concat(_this67.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(_this67.pict.LogNoisiness>2){_this67.log.trace("PictView [".concat(_this67.UUID,"]::[").concat(_this67.Hash,"] ").concat(_this67.options.ViewIdentifier," solveAsync() complete."));}_this67.lastSolvedTimestamp=_this67.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3324
3454
|
* Lifecycle hook that triggers after the view is solved.
|
|
3325
3455
|
*/},{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;}/**
|
|
3326
3456
|
* Lifecycle hook that triggers after the view is solved (async flow).
|
|
@@ -3348,7 +3478,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3348
3478
|
* Marshals data from the view (async flow).
|
|
3349
3479
|
*
|
|
3350
3480
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3351
|
-
*/},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var
|
|
3481
|
+
*/},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var _this68=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){_this68.log.error("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.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(_this68.pict.LogNoisiness>2){_this68.log.trace("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.options.ViewIdentifier," marshalFromViewAsync() complete."));}_this68.lastMarshalFromViewTimestamp=_this68.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3352
3482
|
* Lifecycle hook that triggers after data is marshaled from the view.
|
|
3353
3483
|
*/},{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;}/**
|
|
3354
3484
|
* Lifecycle hook that triggers after data is marshaled from the view (async flow).
|
|
@@ -3374,7 +3504,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3374
3504
|
* Marshals data into the view (async flow).
|
|
3375
3505
|
*
|
|
3376
3506
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3377
|
-
*/},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var
|
|
3507
|
+
*/},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var _this69=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){_this69.log.error("PictView [".concat(_this69.UUID,"]::[").concat(_this69.Hash,"] ").concat(_this69.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(_this69.pict.LogNoisiness>2){_this69.log.trace("PictView [".concat(_this69.UUID,"]::[").concat(_this69.Hash,"] ").concat(_this69.options.ViewIdentifier," marshalToViewAsync() complete."));}_this69.lastMarshalToViewTimestamp=_this69.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3378
3508
|
* Lifecycle hook that triggers after data is marshaled into the view.
|
|
3379
3509
|
*/},{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;}/**
|
|
3380
3510
|
* Lifecycle hook that triggers after data is marshaled into the view (async flow).
|
|
@@ -4682,7 +4812,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
4682
4812
|
// presumably different callback function.
|
|
4683
4813
|
// This makes sure that own properties are retained, so that
|
|
4684
4814
|
// decorations and such are not lost along the way.
|
|
4685
|
-
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],188:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],189:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.
|
|
4815
|
+
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],188:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],189:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.237","description":"Pict browser library.","main":"source/Pict.js","scripts":{"start":"node source/Pict.js","test":"npx mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-image:local","docker-dev-run":"docker run -it -d --name pict-dev -p 37447:8080 -p 19506:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-image:local","docker-dev-shell":"docker exec -it pict-dev /bin/bash","lint":"eslint source/**/*.js test/**/*.js","types":"tsc -p ."},"types":"types/source/Pict.d.ts","mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"repository":{"type":"git","url":"git+https://stevenvelozo@github.com/stevenvelozo/pict.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict/issues"},"homepage":"https://github.com/stevenvelozo/pict#readme","devDependencies":{"@eslint/js":"^9.25.1","@types/jquery":"^3.5.32","eslint":"^9.25.1","globals":"^16.0.0","quackage":"^1.0.38"},"dependencies":{"cachetrax":"^1.0.4","fable":"^3.1.3","pict-application":"^1.0.24","pict-provider":"^1.0.3","pict-template":"^1.0.10","pict-view":"^1.0.59","typescript":"^5.8.3"}};},{}],190:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
|
|
4686
4816
|
/* global Pict, _Pict: writeable *//**
|
|
4687
4817
|
* Simple function to load a pict Application
|
|
4688
4818
|
*
|
|
@@ -4697,57 +4827,57 @@ if(pPictApplication&&_typeof(pPictApplication['default_configuration'])==='objec
|
|
|
4697
4827
|
if(document.readyState!='loading')fCallback();// Modern browsers have event listener capabilities
|
|
4698
4828
|
else if(document.addEventListener)document.addEventListener('DOMContentLoaded',function(){fCallback();});//@ts-ignore IE <= 8 and ... other abominations
|
|
4699
4829
|
else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')fCallback();});};},{}],192:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
|
|
4700
|
-
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase18){function PictCSS(pFable,pOptions,pServiceHash){var
|
|
4701
|
-
if(typeof
|
|
4830
|
+
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase18){function PictCSS(pFable,pOptions,pServiceHash){var _this70;_classCallCheck2(this,PictCSS);_this70=_callSuper(this,PictCSS,[pFable,pOptions,pServiceHash]);/** @type {any} */_this70.options;/** @type {{ ContentAssignment: import('./Pict-Content-Assignment') }} */_this70.services;// No merging of options necessary
|
|
4831
|
+
if(typeof _this70.options.CSSElementAddress==='undefined'){_this70.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}_this70.inlineCSSMap={};return _this70;}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
|
|
4702
4832
|
// Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
|
|
4703
|
-
_inherits(PictCSS,_libFableServiceBase18);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
|
|
4704
|
-
tmpCSSHashes.sort(function(a,b){return
|
|
4833
|
+
_inherits(PictCSS,_libFableServiceBase18);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 _this71=this;var tmpCSS='';var tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
|
|
4834
|
+
tmpCSSHashes.sort(function(a,b){return _this71.inlineCSSMap[a].Priority-_this71.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
|
|
4705
4835
|
},{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);}(libFableServiceBase);module.exports=PictCSS;},{"fable":68}],193:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;/**
|
|
4706
4836
|
* Class for moving content around in the DOM.
|
|
4707
4837
|
*/var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase19){/**
|
|
4708
4838
|
* @param {import('fable')} pFable - The Fable library instance.
|
|
4709
4839
|
* @param {any} [pOptions] - The options for the service.
|
|
4710
4840
|
* @param {string} [pServiceHash] - The hash of services.
|
|
4711
|
-
*/function PictContentAssignment(pFable,pOptions,pServiceHash){var
|
|
4712
|
-
|
|
4713
|
-
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){
|
|
4714
|
-
|
|
4841
|
+
*/function PictContentAssignment(pFable,pOptions,pServiceHash){var _this72;_classCallCheck2(this,PictContentAssignment);_this72=_callSuper(this,PictContentAssignment,[pFable,pOptions,pServiceHash]);/** @type {any} */_this72.log;_this72.serviceType='PictContentAssignment';// Check to see if we are running in a browser
|
|
4842
|
+
_this72.inBrowser=false;_this72.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this72.inBrowser=true;// Now check that the browser has a document object
|
|
4843
|
+
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this72.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
|
|
4844
|
+
_this72.hasJquery=false;_this72.jQuery=false;if(_this72.inBrowser&&typeof window.jQuery!=='undefined'){_this72.hasJquery=true;}/**
|
|
4715
4845
|
* Set this to override the default mechanism for setting the content of a DOM element.
|
|
4716
4846
|
*
|
|
4717
4847
|
* @type {Function}
|
|
4718
4848
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
4719
4849
|
* @param {string} pContent - The content to set.
|
|
4720
|
-
*/
|
|
4850
|
+
*/_this72.customAssignFunction=null;/**
|
|
4721
4851
|
* Set this to override the default mechanism for prepend content to a DOM element.
|
|
4722
4852
|
*
|
|
4723
4853
|
* @type {Function}
|
|
4724
4854
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
4725
4855
|
* @param {string} pContent - The content to prepend.
|
|
4726
|
-
*/
|
|
4856
|
+
*/_this72.customPrependFunction=null;/**
|
|
4727
4857
|
* Set this to override the default mechanism for appending content to a DOM element.
|
|
4728
4858
|
*
|
|
4729
4859
|
* @type {Function}
|
|
4730
4860
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
4731
4861
|
* @param {string} pContent - The content to append.
|
|
4732
|
-
*/
|
|
4862
|
+
*/_this72.customAppendFunction=null;/**
|
|
4733
4863
|
* Set this to override the default mechanism for reading content from the DOM.
|
|
4734
4864
|
*
|
|
4735
4865
|
* @type {Function}
|
|
4736
4866
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
4737
4867
|
* @return {string} - The content of the element.
|
|
4738
|
-
*/
|
|
4868
|
+
*/_this72.customReadFunction=null;/**
|
|
4739
4869
|
* Set this to override the default mechanism for getting elements.
|
|
4740
4870
|
*
|
|
4741
4871
|
* @type {Function}
|
|
4742
4872
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
4743
4873
|
* @return {Array<any>} - The matched elements.
|
|
4744
|
-
*/
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4874
|
+
*/_this72.customGetElementFunction=null;// API Consumers can also craft their own attribute read function
|
|
4875
|
+
_this72.customReadAttributeFunction=null;// API Consumers can also craft their own attribute set function
|
|
4876
|
+
_this72.customSetAttributeFunction=null;// API Consumers can also craft their own attribute remove function
|
|
4877
|
+
_this72.customRemoveAttributeFunction=null;// API Consumers can also craft their own class read function
|
|
4878
|
+
_this72.customReadClassFunction=null;// API Consumers can also craft their own class set function
|
|
4879
|
+
_this72.customSetClassFunction=null;// API Consumers can also craft their own class remove function
|
|
4880
|
+
_this72.customRemoveClassFunction=null;return _this72;}/**
|
|
4751
4881
|
* Get an element from the DOM.
|
|
4752
4882
|
*
|
|
4753
4883
|
* @param {string} pAddress - The address of the element.
|
|
@@ -4843,32 +4973,32 @@ var tmpTargetElement=typeof pAddress==='string'?window.jQuery(pAddress):window.j
|
|
|
4843
4973
|
*
|
|
4844
4974
|
* @return {boolean} - Whether the element has the class. If multiple elements are matched, returns true if any have the class.
|
|
4845
4975
|
*/},{key:"hasClass",value:function hasClass(pAddress,pClass){if(this.customReadClassFunction){return this.customReadClassFunction(pAddress,pClass);}if(this.hasJquery){//FIXME: this is silly, but it makes the type system happy - it picks a different overload for each case
|
|
4846
|
-
var tmpTargetElement=typeof pAddress==='string'?window.jQuery(pAddress):window.jQuery(pAddress);return tmpTargetElement.hasClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=typeof pAddress==='string'?window.document.querySelectorAll(pAddress):[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,"]:"));return false;}}}]);}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":68}],194:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase20){function PictDataProvider(pFable,pOptions,pServiceHash){var
|
|
4976
|
+
var tmpTargetElement=typeof pAddress==='string'?window.jQuery(pAddress):window.jQuery(pAddress);return tmpTargetElement.hasClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=typeof pAddress==='string'?window.document.querySelectorAll(pAddress):[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,"]:"));return false;}}}]);}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":68}],194:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase20){function PictDataProvider(pFable,pOptions,pServiceHash){var _this73;_classCallCheck2(this,PictDataProvider);_this73=_callSuper(this,PictDataProvider,[pFable,pOptions,pServiceHash]);/** @type {import('fable') & import('pict')} */_this73.fable;_this73.serviceType='PictDataProvider';return _this73;}/**
|
|
4847
4977
|
* @param {string} pAddress - The address of the data to retrieve
|
|
4848
4978
|
* @param {object} [pData] - (optional) The record to provide to the address resolver
|
|
4849
|
-
*/_inherits(PictDataProvider,_libFableServiceBase20);return _createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.fable.AppData,Bundle:this.fable.Bundle,Record:tmpData},pAddress);}}]);}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":68}],195:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase21){function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var
|
|
4850
|
-
|
|
4979
|
+
*/_inherits(PictDataProvider,_libFableServiceBase20);return _createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.fable.AppData,Bundle:this.fable.Bundle,Record:tmpData},pAddress);}}]);}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":68}],195:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase21){function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this74;_classCallCheck2(this,PictMeadowEntityProvider);_this74=_callSuper(this,PictMeadowEntityProvider,[pFable,pOptions,pServiceHash]);/** @type {any} */_this74.options;/** @type {import('pict') & { settings: any }} */_this74.fable;_this74.serviceType='PictMeadowProvider';if(_this74.fable.settings.PictDefaultURLPrefix){_this74.options.urlPrefix=_this74.fable.settings.PictDefaultURLPrefix;}else if(!_this74.options.urlPrefix){_this74.options.urlPrefix='/1.0/';}if(_this74.fable.settings.PictDefaultDownloadBatchSize){_this74.options.downloadBatchSize=_this74.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this74.options.downloadBatchSize){_this74.options.downloadBatchSize=100;}//@ts-ignore - FIXME - remove once we have fable types
|
|
4980
|
+
_this74.restClient=_this74.fable.instantiateServiceProviderWithoutRegistration('RestClient');_this74.cache={};_this74.prepareRequestOptions=function(pOptions){return pOptions;};return _this74;}_inherits(PictMeadowEntityProvider,_libFableServiceBase21);return _createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
|
|
4851
4981
|
if(!(pEntity in this.cache)){//@ts-ignore - FIXME - remove once we have fable types
|
|
4852
4982
|
this.cache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
4853
4983
|
// For now cache for 30 seconds.
|
|
4854
4984
|
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.
|
|
4855
|
-
this.cache[pEntity].prune(function(){var
|
|
4985
|
+
this.cache[pEntity].prune(function(){var _this75=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){_this75.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?
|
|
4856
4986
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
4857
4987
|
// If the list is mega-long we can parse it and break it into chunks.
|
|
4858
4988
|
this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
4859
|
-
this.cache[pEntity].prune(function(){var
|
|
4860
|
-
tmpDownloadURIFragments.push("".concat(
|
|
4861
|
-
|
|
4989
|
+
this.cache[pEntity].prune(function(){var _this76=this;return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this76.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=_this76.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
4990
|
+
tmpDownloadURIFragments.push("".concat(_this76.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)
|
|
4991
|
+
_this76.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){_this76.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
|
|
4862
4992
|
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":68}],196:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase22){/**
|
|
4863
4993
|
* @param {Object} pFable - The Fable Framework instance
|
|
4864
4994
|
* @param {Object} pOptions - The options for the service
|
|
4865
4995
|
* @param {String} pServiceHash - The hash of the service
|
|
4866
|
-
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var
|
|
4996
|
+
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this77;_classCallCheck2(this,PictTemplateProvider);_this77=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);/** @type {any} */_this77.log;/** @type {string} */_this77.UUID;/** @type {string} */_this77.Hash;_this77.serviceType='PictTemplateProvider';_this77.templates={};_this77.templateSources={};// Default templates are stored by prefix.
|
|
4867
4997
|
// The longest prefix match is used.
|
|
4868
4998
|
// Case sensitive.
|
|
4869
|
-
|
|
4999
|
+
_this77.defaultTemplates=[];/**
|
|
4870
5000
|
* @type {(hash?: string) => { template: string, source: string }?} loadTemplateFunction - The function to load a template
|
|
4871
|
-
*/
|
|
5001
|
+
*/_this77.loadTemplateFunction=function(){return null;};return _this77;}/**
|
|
4872
5002
|
* Add a template to the provider.
|
|
4873
5003
|
*
|
|
4874
5004
|
* @param {String} pTemplateHash - The hash of the template
|
|
@@ -4931,34 +5061,34 @@ if(!(pTemplateHash in this.templates)){this.checkDefaultTemplateHash(pTemplateHa
|
|
|
4931
5061
|
* Pict management object.
|
|
4932
5062
|
*/var Pict=/*#__PURE__*/function(_libFable){/**
|
|
4933
5063
|
* @param {Object<String, any>} pSettings - The settings for the Pict instance.
|
|
4934
|
-
*/function Pict(pSettings){var
|
|
4935
|
-
/** @type {any} */
|
|
5064
|
+
*/function Pict(pSettings){var _this78;_classCallCheck2(this,Pict);_this78=_callSuper(this,Pict,[pSettings]);/** @type {any} */_this78.settings;_this78.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");/** @type {Object} */_this78._PackageFable=_this78._Package;_this78._Package=libPackage;_this78.browserAddress='window._Pict';if('BrowserAddress'in _this78.settings){_this78.browserAddress=_this78.settings.BrowserAddress;}_this78.children=[];/** @type {import('pict-application')} */_this78.PictApplication=null;// shim types from fable until we export types properly
|
|
5065
|
+
/** @type {any} */_this78.log;/**
|
|
4936
5066
|
* The templateProvider provides a basic key->template mapping with default fallback capabilities
|
|
4937
5067
|
*
|
|
4938
5068
|
* @type {PictTemplateProvider}
|
|
4939
|
-
*/
|
|
5069
|
+
*/_this78.TemplateProvider=null;_this78.addAndInstantiateServiceType('TemplateProvider',PictTemplateProvider);/**
|
|
4940
5070
|
* The meadow entity provider.
|
|
4941
5071
|
*
|
|
4942
5072
|
* @type {PictMeadowEntityProvider}
|
|
4943
|
-
*/
|
|
5073
|
+
*/_this78.EntityProvider=null;_this78.addAndInstantiateServiceType('EntityProvider',PictMeadowEntityProvider);/**
|
|
4944
5074
|
* The data provider.
|
|
4945
5075
|
*
|
|
4946
5076
|
* @type {PictDataProvider}
|
|
4947
|
-
*/
|
|
5077
|
+
*/_this78.DataProvider=null;_this78.addAndInstantiateServiceType('DataProvider',PictDataProvider);/**
|
|
4948
5078
|
* The content assignment module.
|
|
4949
5079
|
*
|
|
4950
5080
|
* @type {PictContentAssignment}
|
|
4951
|
-
*/
|
|
5081
|
+
*/_this78.ContentAssignment=null;_this78.addAndInstantiateServiceType('ContentAssignment',PictContentAssignment);/**
|
|
4952
5082
|
* The CSS module.
|
|
4953
5083
|
*
|
|
4954
5084
|
* @type {PictCSS}
|
|
4955
5085
|
* @public
|
|
4956
|
-
*/
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
if(
|
|
4961
|
-
|
|
5086
|
+
*/_this78.CSSMap=null;_this78.addAndInstantiateServiceType('CSSMap',PictCSS);_this78.addServiceType('PictTemplate',require('pict-template'));_this78.instantiateServiceProvider('MetaTemplate');_this78.instantiateServiceProvider('DataGeneration');_this78.manifest=_this78.instantiateServiceProvider('Manifest');_this78.AppData={};if('DefaultAppData'in _this78.fable.settings){_this78.AppData=_this78.fable.settings.DefaultAppData;}_this78.Bundle={};// Log noisness goes from 0 - 5, where 5 is show me everything.
|
|
5087
|
+
_this78.LogNoisiness=0;// Although we have log noisiness, sometimes we need control flow without all the other noise for hard to diagnose interpreters.
|
|
5088
|
+
_this78.LogControlFlow=false;// And an easy way to be introspective about data at various locations
|
|
5089
|
+
_this78.LogControlFlowWatchAddressList=[];// Load manifest sets
|
|
5090
|
+
if(_this78.settings.Manifests){_this78.loadManifestSet(_this78.settings.Manifests);}_this78._DefaultPictTemplatesInitialized=false;_this78.initializePictTemplateEngine();_this78.addServiceType('PictView',require('pict-view'));_this78.addServiceType('PictProvider',require('pict-provider'));_this78.addServiceType('PictApplication',require('pict-application'));// Expose the named views directly, through a convenience accessor
|
|
5091
|
+
_this78.providers=_this78.servicesMap.PictProvider;_this78.views=_this78.servicesMap.PictView;return _this78;}/**
|
|
4962
5092
|
* Load manifests in as Hashed services
|
|
4963
5093
|
*
|
|
4964
5094
|
* @param {Object<String, String>} pManifestSet - The manifest set to load.
|
|
@@ -5070,7 +5200,7 @@ this.addTemplate(require("./templates/debugging/Pict-Template-Breakpoint.js"));t
|
|
|
5070
5200
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
5071
5201
|
*
|
|
5072
5202
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5073
|
-
*/},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var
|
|
5203
|
+
*/},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var _this79=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(_this79.LogControlFlow&&_this79.LogNoisiness>1){_this79.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;}}/**
|
|
5074
5204
|
* Parse a template by hash.
|
|
5075
5205
|
*
|
|
5076
5206
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5089,8 +5219,8 @@ if(!tmpTemplateString){tmpTemplateString='';}return this.parseTemplate(tmpTempla
|
|
|
5089
5219
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
5090
5220
|
*
|
|
5091
5221
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5092
|
-
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var
|
|
5093
|
-
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return
|
|
5222
|
+
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this80=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
5223
|
+
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this80.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 _i58=0;_i58<tmpKeys.length;_i58++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i58]],null,pContextArray);}}return tmpValue;}else{return'';}}}/**
|
|
5094
5224
|
* Parse a template set by hash.
|
|
5095
5225
|
*
|
|
5096
5226
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5203,11 +5333,11 @@ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".c
|
|
|
5203
5333
|
* @param {Object} pFable - The Fable Framework instance
|
|
5204
5334
|
* @param {Object} pOptions - The options for the service
|
|
5205
5335
|
* @param {String} pServiceHash - The hash of the service
|
|
5206
|
-
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var
|
|
5336
|
+
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var _this81;_classCallCheck2(this,PictTemplateProviderData);_this81=_callSuper(this,PictTemplateProviderData,[pFable,pOptions,pServiceHash]);/** @type {any} */_this81.log;_this81.addPattern('{~Data:','~}');_this81.addPattern('{~D:','~}');return _this81;}_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":141}],201:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderEntity=/*#__PURE__*/function(_libPictTemplate2){/**
|
|
5207
5337
|
* @param {Object} pFable - The Fable Framework instance
|
|
5208
5338
|
* @param {Object} pOptions - The options for the service
|
|
5209
5339
|
* @param {String} pServiceHash - The hash of the service
|
|
5210
|
-
*/function PictTemplateProviderEntity(pFable,pOptions,pServiceHash){var
|
|
5340
|
+
*/function PictTemplateProviderEntity(pFable,pOptions,pServiceHash){var _this82;_classCallCheck2(this,PictTemplateProviderEntity);_this82=_callSuper(this,PictTemplateProviderEntity,[pFable,pOptions,pServiceHash]);/** @type {any} */_this82.log;_this82.addPattern('{~E:','~}');_this82.addPattern('{~Entity:','~}');return _this82;}/**
|
|
5211
5341
|
* Render a template expression, returning a string with the resulting content.
|
|
5212
5342
|
*
|
|
5213
5343
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5225,7 +5355,7 @@ if(tmpEntityTemplate){return this.pict.parseTemplateByHash(tmpEntityTemplate,pRe
|
|
|
5225
5355
|
* @param {Object} pFable - The Fable Framework instance
|
|
5226
5356
|
* @param {Object} pOptions - The options for the service
|
|
5227
5357
|
* @param {String} pServiceHash - The hash of the service
|
|
5228
|
-
*/function PictTemplateProviderSelf(pFable,pOptions,pServiceHash){var
|
|
5358
|
+
*/function PictTemplateProviderSelf(pFable,pOptions,pServiceHash){var _this83;_classCallCheck2(this,PictTemplateProviderSelf);_this83=_callSuper(this,PictTemplateProviderSelf,[pFable,pOptions,pServiceHash]);_this83.addPattern('{~Pict','~}');_this83.addPattern('{~P','~}');_this83.addPattern('{~p','~}');return _this83;}/**
|
|
5229
5359
|
* Render a template expression, returning a string with the resulting content.
|
|
5230
5360
|
*
|
|
5231
5361
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5237,7 +5367,7 @@ if(tmpEntityTemplate){return this.pict.parseTemplateByHash(tmpEntityTemplate,pRe
|
|
|
5237
5367
|
* @param {Object} pFable - The Fable Framework instance
|
|
5238
5368
|
* @param {Object} pOptions - The options for the service
|
|
5239
5369
|
* @param {String} pServiceHash - The hash of the service
|
|
5240
|
-
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var
|
|
5370
|
+
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var _this84;_classCallCheck2(this,PictTemplateProviderTemplate);_this84=_callSuper(this,PictTemplateProviderTemplate,[pFable,pOptions,pServiceHash]);/** @type {any} */_this84.log;_this84.addPattern('{~Template:','~}');_this84.addPattern('{~T:','~}');return _this84;}_inherits(PictTemplateProviderTemplate,_libPictTemplate4);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;var tmpAddressOfData;// This is just a simple 2 part hash (the entity and the ID)
|
|
5241
5371
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
5242
5372
|
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.
|
|
5243
5373
|
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;var tmpAddressOfData;// This is just a simple 2 part hash (the entity and the ID)
|
|
@@ -5248,7 +5378,7 @@ return this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,function(pError,pVa
|
|
|
5248
5378
|
* @param {Object} pFable - The Fable Framework instance
|
|
5249
5379
|
* @param {Object} pOptions - The options for the service
|
|
5250
5380
|
* @param {String} pServiceHash - The hash of the service
|
|
5251
|
-
*/function PictTemplateProviderTemplateFromMap(pFable,pOptions,pServiceHash){var
|
|
5381
|
+
*/function PictTemplateProviderTemplateFromMap(pFable,pOptions,pServiceHash){var _this85;_classCallCheck2(this,PictTemplateProviderTemplateFromMap);_this85=_callSuper(this,PictTemplateProviderTemplateFromMap,[pFable,pOptions,pServiceHash]);/** @type {any} */_this85.log;_this85.addPattern('{~TFM:','~}');_this85.addPattern('{~TemplateFromMap:','~}');return _this85;}_inherits(PictTemplateProviderTemplateFromMap,_libPictTemplate5);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;var tmpAddressOfMap;var tmpAddressOfKey;// This is a 3 part hash with the map address and the key address both
|
|
5252
5382
|
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
|
|
5253
5383
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
5254
5384
|
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.
|
|
@@ -5261,7 +5391,7 @@ return this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,function(pEr
|
|
|
5261
5391
|
* @param {Object} pFable - The Fable Framework instance
|
|
5262
5392
|
* @param {Object} pOptions - The options for the service
|
|
5263
5393
|
* @param {String} pServiceHash - The hash of the service
|
|
5264
|
-
*/function PictTemplateProviderTemplateSet(pFable,pOptions,pServiceHash){var
|
|
5394
|
+
*/function PictTemplateProviderTemplateSet(pFable,pOptions,pServiceHash){var _this86;_classCallCheck2(this,PictTemplateProviderTemplateSet);_this86=_callSuper(this,PictTemplateProviderTemplateSet,[pFable,pOptions,pServiceHash]);/** @type {any} */_this86.log;_this86.addPattern('{~TemplateSet:','~}');_this86.addPattern('{~TS:','~}');return _this86;}_inherits(PictTemplateProviderTemplateSet,_libPictTemplate6);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;var tmpAddressOfData;// This is just a simple 2 part hash (the entity and the ID)
|
|
5265
5395
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
5266
5396
|
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.
|
|
5267
5397
|
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;var tmpAddressOfData;// This is a 3 part hash with the map address and the key address both
|
|
@@ -5273,7 +5403,7 @@ return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(
|
|
|
5273
5403
|
* @param {Object} pFable - The Fable Framework instance
|
|
5274
5404
|
* @param {Object} pOptions - The options for the service
|
|
5275
5405
|
* @param {String} pServiceHash - The hash of the service
|
|
5276
|
-
*/function PictTemplateProviderTemplateSetFromMap(pFable,pOptions,pServiceHash){var
|
|
5406
|
+
*/function PictTemplateProviderTemplateSetFromMap(pFable,pOptions,pServiceHash){var _this87;_classCallCheck2(this,PictTemplateProviderTemplateSetFromMap);_this87=_callSuper(this,PictTemplateProviderTemplateSetFromMap,[pFable,pOptions,pServiceHash]);/** @type {any} */_this87.log;_this87.addPattern('{~TSFM:','~}');_this87.addPattern('{~TemplateSetFromMap:','~}');return _this87;}_inherits(PictTemplateProviderTemplateSetFromMap,_libPictTemplate7);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;var tmpAddressOfMap;var tmpAddressOfKey;// This is a 3 part hash with the map address and the key address both
|
|
5277
5407
|
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
|
|
5278
5408
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
5279
5409
|
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.
|
|
@@ -5286,7 +5416,7 @@ return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(
|
|
|
5286
5416
|
* @param {Object} pFable - The Fable Framework instance
|
|
5287
5417
|
* @param {Object} pOptions - The options for the service
|
|
5288
5418
|
* @param {String} pServiceHash - The hash of the service
|
|
5289
|
-
*/function PictTemplateProviderTemplateValueSet(pFable,pOptions,pServiceHash){var
|
|
5419
|
+
*/function PictTemplateProviderTemplateValueSet(pFable,pOptions,pServiceHash){var _this88;_classCallCheck2(this,PictTemplateProviderTemplateValueSet);_this88=_callSuper(this,PictTemplateProviderTemplateValueSet,[pFable,pOptions,pServiceHash]);/** @type {any} */_this88.log;_this88.addPattern('{~TemplateValueSet:','~}');_this88.addPattern('{~TVS:','~}');return _this88;}_inherits(PictTemplateProviderTemplateValueSet,_libPictTemplate8);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;var tmpAddressOfData;// This is just a simple 2 part hash (the entity and the ID)
|
|
5290
5420
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
5291
5421
|
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 _i59=0;_i59<tmpValueKeys.length;_i59++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i59]],Key:tmpValueKeys[_i59]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
5292
5422
|
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;var tmpAddressOfData;// This is a 3 part hash with the map address and the key address both
|
|
@@ -5298,19 +5428,19 @@ return this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(
|
|
|
5298
5428
|
* @param {Object} pFable - The Fable Framework instance
|
|
5299
5429
|
* @param {Object} pOptions - The options for the service
|
|
5300
5430
|
* @param {String} pServiceHash - The hash of the service
|
|
5301
|
-
*/function PictTemplateProviderRandomNumber(pFable,pOptions,pServiceHash){var
|
|
5431
|
+
*/function PictTemplateProviderRandomNumber(pFable,pOptions,pServiceHash){var _this89;_classCallCheck2(this,PictTemplateProviderRandomNumber);_this89=_callSuper(this,PictTemplateProviderRandomNumber,[pFable,pOptions,pServiceHash]);/** @type {any} */_this89.log;_this89.addPattern('{~RandomNumber:','~}');_this89.addPattern('{~RN:','~}');return _this89;}_inherits(PictTemplateProviderRandomNumber,_libPictTemplate9);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":141}],209:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderRandomNumberString=/*#__PURE__*/function(_libPictTemplate10){/**
|
|
5302
5432
|
* @param {Object} pFable - The Fable Framework instance
|
|
5303
5433
|
* @param {Object} pOptions - The options for the service
|
|
5304
5434
|
* @param {String} pServiceHash - The hash of the service
|
|
5305
|
-
*/function PictTemplateProviderRandomNumberString(pFable,pOptions,pServiceHash){var
|
|
5435
|
+
*/function PictTemplateProviderRandomNumberString(pFable,pOptions,pServiceHash){var _this90;_classCallCheck2(this,PictTemplateProviderRandomNumberString);_this90=_callSuper(this,PictTemplateProviderRandomNumberString,[pFable,pOptions,pServiceHash]);/** @type {any} */_this90.log;_this90.addPattern('{~RandomNumberString:','~}');_this90.addPattern('{~RNS:','~}');return _this90;}_inherits(PictTemplateProviderRandomNumberString,_libPictTemplate10);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":141}],210:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDollars=/*#__PURE__*/function(_libPictTemplate11){/**
|
|
5306
5436
|
* @param {Object} pFable - The Fable Framework instance
|
|
5307
5437
|
* @param {Object} pOptions - The options for the service
|
|
5308
5438
|
* @param {String} pServiceHash - The hash of the service
|
|
5309
|
-
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var
|
|
5439
|
+
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var _this91;_classCallCheck2(this,PictTemplateProviderDollars);_this91=_callSuper(this,PictTemplateProviderDollars,[pFable,pOptions,pServiceHash]);/** @type {any} */_this91.log;_this91.addPattern('{~DataJson:','~}');_this91.addPattern('{~DJ:','~}');return _this91;}_inherits(PictTemplateProviderDollars,_libPictTemplate11);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":141}],211:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateOnlyFormat=/*#__PURE__*/function(_libPictTemplate12){/**
|
|
5310
5440
|
* @param {import('fable')} pFable - The Fable Framework instance
|
|
5311
5441
|
* @param {any} pOptions - The options for the service
|
|
5312
5442
|
* @param {String} pServiceHash - The hash of the service
|
|
5313
|
-
*/function PictTemplateProviderDateOnlyFormat(pFable,pOptions,pServiceHash){var
|
|
5443
|
+
*/function PictTemplateProviderDateOnlyFormat(pFable,pOptions,pServiceHash){var _this92;_classCallCheck2(this,PictTemplateProviderDateOnlyFormat);_this92=_callSuper(this,PictTemplateProviderDateOnlyFormat,[pFable,pOptions,pServiceHash]);/** @type {any} */_this92.options;/** @type {any} */_this92.log;_this92.addPattern('{~DateOnlyFormat:','~}');return _this92;}_inherits(PictTemplateProviderDateOnlyFormat,_libPictTemplate12);return _createClass2(PictTemplateProviderDateOnlyFormat,[{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 [fDateOnlyFormat]::[".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 [fDateOnlyFormat]::[".concat(tmpHash,"] with data:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDateOnlyFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
5314
5444
|
var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue).tz('UTC');return tmpDayJS.format(tmpDateValueSet[1]);}}]);}(libPictTemplate);module.exports=PictTemplateProviderDateOnlyFormat;/*
|
|
5315
5445
|
# DEAR DEAD CODE DIARY:
|
|
5316
5446
|
|
|
@@ -5321,7 +5451,7 @@ var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue).tz('UTC');return tmpDayJS.
|
|
|
5321
5451
|
* @param {Object} pFable - The Fable Framework instance
|
|
5322
5452
|
* @param {Object} pOptions - The options for the service
|
|
5323
5453
|
* @param {String} pServiceHash - The hash of the service
|
|
5324
|
-
*/function PictTemplateProviderDateOnlyYMD(pFable,pOptions,pServiceHash){var
|
|
5454
|
+
*/function PictTemplateProviderDateOnlyYMD(pFable,pOptions,pServiceHash){var _this93;_classCallCheck2(this,PictTemplateProviderDateOnlyYMD);_this93=_callSuper(this,PictTemplateProviderDateOnlyYMD,[pFable,pOptions,pServiceHash]);/** @type {any} */_this93.options;/** @type {any} */_this93.log;_this93.addPattern('{~DateOnlyYMD:','~}');return _this93;}/**
|
|
5325
5455
|
* Render a template expression, returning a string with the resulting content.
|
|
5326
5456
|
*
|
|
5327
5457
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5336,8 +5466,8 @@ var prefix=tmpDayJS.valueOf()<-62167219200000?'-':'';return prefix+tmpDayJS.form
|
|
|
5336
5466
|
* @param {Object} pFable - The Fable Framework instance
|
|
5337
5467
|
* @param {Object} pOptions - The options for the service
|
|
5338
5468
|
* @param {String} pServiceHash - The hash of the service
|
|
5339
|
-
*/function PictTemplateProviderDateTimeFormat(pFable,pOptions,pServiceHash){var
|
|
5340
|
-
return
|
|
5469
|
+
*/function PictTemplateProviderDateTimeFormat(pFable,pOptions,pServiceHash){var _this94;_classCallCheck2(this,PictTemplateProviderDateTimeFormat);_this94=_callSuper(this,PictTemplateProviderDateTimeFormat,[pFable,pOptions,pServiceHash]);/** @type {any} */_this94.options;/** @type {any} */_this94.log;_this94.addPattern('{~DateTimeFormat:','~}');_this94.addPattern('{~DateFormat:','~}');// for backwards compatibility
|
|
5470
|
+
return _this94;}_inherits(PictTemplateProviderDateTimeFormat,_libPictTemplate14);return _createClass2(PictTemplateProviderDateTimeFormat,[{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 [fDateTimeFormat]::[".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 [fDateTimeFormat]::[".concat(tmpHash,"] with data:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDateTimeFormat]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
5341
5471
|
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
|
|
5342
5472
|
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()}].`);
|
|
5343
5473
|
// Day.js will try to guess the user's timezone for us
|
|
@@ -5351,8 +5481,8 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
5351
5481
|
* @param {Object} pFable - The Fable Framework instance
|
|
5352
5482
|
* @param {Object} pOptions - The options for the service
|
|
5353
5483
|
* @param {String} pServiceHash - The hash of the service
|
|
5354
|
-
*/function PictTemplateProviderDateTimeYMD(pFable,pOptions,pServiceHash){var
|
|
5355
|
-
return
|
|
5484
|
+
*/function PictTemplateProviderDateTimeYMD(pFable,pOptions,pServiceHash){var _this95;_classCallCheck2(this,PictTemplateProviderDateTimeYMD);_this95=_callSuper(this,PictTemplateProviderDateTimeYMD,[pFable,pOptions,pServiceHash]);/** @type {any} */_this95.options;/** @type {any} */_this95.log;_this95.addPattern('{~DateTimeYMD:','~}');_this95.addPattern('{~DateYMD:','~}');// for backwards compatibility
|
|
5485
|
+
return _this95;}/**
|
|
5356
5486
|
* Render a template expression, returning a string with the resulting content.
|
|
5357
5487
|
*
|
|
5358
5488
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5368,33 +5498,33 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
5368
5498
|
* @param {Object} pFable - The Fable Framework instance
|
|
5369
5499
|
* @param {Object} pOptions - The options for the service
|
|
5370
5500
|
* @param {String} pServiceHash - The hash of the service
|
|
5371
|
-
*/function PictTemplateProviderDigits(pFable,pOptions,pServiceHash){var
|
|
5501
|
+
*/function PictTemplateProviderDigits(pFable,pOptions,pServiceHash){var _this96;_classCallCheck2(this,PictTemplateProviderDigits);_this96=_callSuper(this,PictTemplateProviderDigits,[pFable,pOptions,pServiceHash]);/** @type {any} */_this96.options;/** @type {any} */_this96.log;_this96.addPattern('{~Digits:','~}');return _this96;}_inherits(PictTemplateProviderDigits,_libPictTemplate16);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":141}],216:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDollars=/*#__PURE__*/function(_libPictTemplate17){/**
|
|
5372
5502
|
* @param {Object} pFable - The Fable Framework instance
|
|
5373
5503
|
* @param {Object} pOptions - The options for the service
|
|
5374
5504
|
* @param {String} pServiceHash - The hash of the service
|
|
5375
|
-
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var
|
|
5505
|
+
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var _this97;_classCallCheck2(this,PictTemplateProviderDollars);_this97=_callSuper(this,PictTemplateProviderDollars,[pFable,pOptions,pServiceHash]);/** @type {any} */_this97.options;/** @type {any} */_this97.log;_this97.addPattern('{~Dollars:','~}');return _this97;}_inherits(PictTemplateProviderDollars,_libPictTemplate17);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":141}],217:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderData=/*#__PURE__*/function(_libPictTemplate18){/**
|
|
5376
5506
|
* @param {Object} pFable - The Fable Framework instance
|
|
5377
5507
|
* @param {Object} pOptions - The options for the service
|
|
5378
5508
|
* @param {String} pServiceHash - The hash of the service
|
|
5379
|
-
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var
|
|
5509
|
+
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var _this98;_classCallCheck2(this,PictTemplateProviderData);_this98=_callSuper(this,PictTemplateProviderData,[pFable,pOptions,pServiceHash]);/** @type {any} */_this98.log;_this98.addPattern('{~HtmlCommentEnd:','~}');_this98.addPattern('{~HCE:','~}');return _this98;}_inherits(PictTemplateProviderData,_libPictTemplate18);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=false;if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray);}if(!tmpValue){return' -->';}return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderData;},{"pict-template":141}],218:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderData=/*#__PURE__*/function(_libPictTemplate19){/**
|
|
5380
5510
|
* @param {Object} pFable - The Fable Framework instance
|
|
5381
5511
|
* @param {Object} pOptions - The options for the service
|
|
5382
5512
|
* @param {String} pServiceHash - The hash of the service
|
|
5383
|
-
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var
|
|
5513
|
+
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var _this99;_classCallCheck2(this,PictTemplateProviderData);_this99=_callSuper(this,PictTemplateProviderData,[pFable,pOptions,pServiceHash]);/** @type {any} */_this99.log;_this99.addPattern('{~HtmlCommentStart:','~}');_this99.addPattern('{~HCS:','~}');return _this99;}_inherits(PictTemplateProviderData,_libPictTemplate19);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=false;if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray);}if(!tmpValue){return'<!-- ';}return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderData;},{"pict-template":141}],219:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderJoin=/*#__PURE__*/function(_libPictTemplate20){/**
|
|
5384
5514
|
* @param {Object} pFable - The Fable Framework instance
|
|
5385
5515
|
* @param {Object} pOptions - The options for the service
|
|
5386
5516
|
* @param {String} pServiceHash - The hash of the service
|
|
5387
|
-
*/function PictTemplateProviderJoin(pFable,pOptions,pServiceHash){var
|
|
5517
|
+
*/function PictTemplateProviderJoin(pFable,pOptions,pServiceHash){var _this100;_classCallCheck2(this,PictTemplateProviderJoin);_this100=_callSuper(this,PictTemplateProviderJoin,[pFable,pOptions,pServiceHash]);/** @type {any} */_this100.options;/** @type {any} */_this100.log;_this100.addPattern('{~Join:','~}');_this100.addPattern('{~J:','~}');return _this100;}_inherits(PictTemplateProviderJoin,_libPictTemplate20);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
|
|
5388
5518
|
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":141}],220:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderJoinUnique=/*#__PURE__*/function(_libPictTemplate21){/**
|
|
5389
5519
|
* @param {Object} pFable - The Fable Framework instance
|
|
5390
5520
|
* @param {Object} pOptions - The options for the service
|
|
5391
5521
|
* @param {String} pServiceHash - The hash of the service
|
|
5392
|
-
*/function PictTemplateProviderJoinUnique(pFable,pOptions,pServiceHash){var
|
|
5522
|
+
*/function PictTemplateProviderJoinUnique(pFable,pOptions,pServiceHash){var _this101;_classCallCheck2(this,PictTemplateProviderJoinUnique);_this101=_callSuper(this,PictTemplateProviderJoinUnique,[pFable,pOptions,pServiceHash]);/** @type {any} */_this101.options;/** @type {any} */_this101.log;_this101.addPattern('{~JoinUnique:','~}');_this101.addPattern('{~JU:','~}');return _this101;}_inherits(PictTemplateProviderJoinUnique,_libPictTemplate21);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
|
|
5393
5523
|
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":141}],221:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderPascalCaseIdentifier=/*#__PURE__*/function(_libPictTemplate22){/**
|
|
5394
5524
|
* @param {Object} pFable - The Fable Framework instance
|
|
5395
5525
|
* @param {Object} pOptions - The options for the service
|
|
5396
5526
|
* @param {String} pServiceHash - The hash of the service
|
|
5397
|
-
*/function PictTemplateProviderPascalCaseIdentifier(pFable,pOptions,pServiceHash){var
|
|
5527
|
+
*/function PictTemplateProviderPascalCaseIdentifier(pFable,pOptions,pServiceHash){var _this102;_classCallCheck2(this,PictTemplateProviderPascalCaseIdentifier);_this102=_callSuper(this,PictTemplateProviderPascalCaseIdentifier,[pFable,pOptions,pServiceHash]);/** @type {any} */_this102.options;/** @type {any} */_this102.log;_this102.addPattern('{~PascalCaseIdentifier:','~}');return _this102;}_inherits(PictTemplateProviderPascalCaseIdentifier,_libPictTemplate22);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;/*
|
|
5398
5528
|
# DEAR DEAD CODE DIARY:
|
|
5399
5529
|
|
|
5400
5530
|
```javascript
|
|
@@ -5404,37 +5534,37 @@ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={}
|
|
|
5404
5534
|
* @param {Object} pFable - The Fable Framework instance
|
|
5405
5535
|
* @param {Object} pOptions - The options for the service
|
|
5406
5536
|
* @param {String} pServiceHash - The hash of the service
|
|
5407
|
-
*/function PictTemplateProviderPluckJoinUnique(pFable,pOptions,pServiceHash){var
|
|
5537
|
+
*/function PictTemplateProviderPluckJoinUnique(pFable,pOptions,pServiceHash){var _this103;_classCallCheck2(this,PictTemplateProviderPluckJoinUnique);_this103=_callSuper(this,PictTemplateProviderPluckJoinUnique,[pFable,pOptions,pServiceHash]);/** @type {any} */_this103.options;/** @type {any} */_this103.log;_this103.addPattern('{~PluckJoinUnique:','~}');_this103.addPattern('{~PJU:','~}');return _this103;}_inherits(PictTemplateProviderPluckJoinUnique,_libPictTemplate23);return _createClass2(PictTemplateProviderPluckJoinUnique,[{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 Pluck Join Unique [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Pluck Join Unique [fDataRender]::[".concat(tmpHash,"]"));}var tmpDataAddresses=tmpHash.split('^');if(tmpDataAddresses.length<3){return'';}// Get the separator string
|
|
5408
5538
|
var tmpSeparator=tmpDataAddresses.shift();var tmpAddress=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)){// This one only works on arrays of objects.
|
|
5409
5539
|
for(var j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||_typeof(tmpValueSet)!=='object'){continue;}var tmpValue=this.pict.manifest.getValueByHash(tmpValueSet[j],tmpAddress);if(!(tmpValue in tmpValueMap)){tmpValueMap[tmpValue]=true;tmpValueList.push(tmpValue);}}}else if(tmpValueSet){if(!(tmpValueSet in tmpValueMap)){tmpValueMap[tmpValueSet]=true;tmpValueList.push(tmpValueSet);}}}return tmpValueList.join(tmpSeparator);}}]);}(libPictTemplate);module.exports=PictTemplateProviderPluckJoinUnique;},{"pict-template":141}],223:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderBreakpoint=/*#__PURE__*/function(_libPictTemplate24){/**
|
|
5410
5540
|
* @param {Object} pFable - The Fable Framework instance
|
|
5411
5541
|
* @param {Object} pOptions - The options for the service
|
|
5412
5542
|
* @param {String} pServiceHash - The hash of the service
|
|
5413
|
-
*/function PictTemplateProviderBreakpoint(pFable,pOptions,pServiceHash){var
|
|
5543
|
+
*/function PictTemplateProviderBreakpoint(pFable,pOptions,pServiceHash){var _this104;_classCallCheck2(this,PictTemplateProviderBreakpoint);_this104=_callSuper(this,PictTemplateProviderBreakpoint,[pFable,pOptions,pServiceHash]);/** @type {any} */_this104.log;_this104.addPattern('{~Breakpoint','~}');return _this104;}_inherits(PictTemplateProviderBreakpoint,_libPictTemplate24);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;
|
|
5414
5544
|
debugger;// eslint-disable-line no-debugger
|
|
5415
5545
|
return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderBreakpoint;},{"pict-template":141}],224:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDataValueTree=/*#__PURE__*/function(_libPictTemplate25){/**
|
|
5416
5546
|
* @param {Object} pFable - The Fable Framework instance
|
|
5417
5547
|
* @param {Object} pOptions - The options for the service
|
|
5418
5548
|
* @param {String} pServiceHash - The hash of the service
|
|
5419
|
-
*/function PictTemplateProviderDataValueTree(pFable,pOptions,pServiceHash){var
|
|
5549
|
+
*/function PictTemplateProviderDataValueTree(pFable,pOptions,pServiceHash){var _this105;_classCallCheck2(this,PictTemplateProviderDataValueTree);_this105=_callSuper(this,PictTemplateProviderDataValueTree,[pFable,pOptions,pServiceHash]);/** @type {any} */_this105.log;_this105.addPattern('{~DataTree:','~}');_this105.addPattern('{~DT:','~}');return _this105;}_inherits(PictTemplateProviderDataValueTree,_libPictTemplate25);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
|
|
5420
5550
|
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
|
|
5421
5551
|
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.pict.AppData,Bundle:this.pict.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":141}],225:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogStatement=/*#__PURE__*/function(_libPictTemplate26){/**
|
|
5422
5552
|
* @param {Object} pFable - The Fable Framework instance
|
|
5423
5553
|
* @param {Object} pOptions - The options for the service
|
|
5424
5554
|
* @param {String} pServiceHash - The hash of the service
|
|
5425
|
-
*/function PictTemplateProviderLogStatement(pFable,pOptions,pServiceHash){var
|
|
5555
|
+
*/function PictTemplateProviderLogStatement(pFable,pOptions,pServiceHash){var _this106;_classCallCheck2(this,PictTemplateProviderLogStatement);_this106=_callSuper(this,PictTemplateProviderLogStatement,[pFable,pOptions,pServiceHash]);/** @type {any} */_this106.log;_this106.addPattern('{~LogStatement:','~}');_this106.addPattern('{~LS:','~}');return _this106;}_inherits(PictTemplateProviderLogStatement,_libPictTemplate26);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":141}],226:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogValue=/*#__PURE__*/function(_libPictTemplate27){/**
|
|
5426
5556
|
* @param {Object} pFable - The Fable Framework instance
|
|
5427
5557
|
* @param {Object} pOptions - The options for the service
|
|
5428
5558
|
* @param {String} pServiceHash - The hash of the service
|
|
5429
|
-
*/function PictTemplateProviderLogValue(pFable,pOptions,pServiceHash){var
|
|
5559
|
+
*/function PictTemplateProviderLogValue(pFable,pOptions,pServiceHash){var _this107;_classCallCheck2(this,PictTemplateProviderLogValue);_this107=_callSuper(this,PictTemplateProviderLogValue,[pFable,pOptions,pServiceHash]);/** @type {any} */_this107.log;_this107.addPattern('{~LogValue:','~}');_this107.addPattern('{~LV:','~}');return _this107;}_inherits(PictTemplateProviderLogValue,_libPictTemplate27);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":141}],227:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogValueTree=/*#__PURE__*/function(_libPictTemplate28){/**
|
|
5430
5560
|
* @param {Object} pFable - The Fable Framework instance
|
|
5431
5561
|
* @param {Object} pOptions - The options for the service
|
|
5432
5562
|
* @param {String} pServiceHash - The hash of the service
|
|
5433
|
-
*/function PictTemplateProviderLogValueTree(pFable,pOptions,pServiceHash){var
|
|
5563
|
+
*/function PictTemplateProviderLogValueTree(pFable,pOptions,pServiceHash){var _this108;_classCallCheck2(this,PictTemplateProviderLogValueTree);_this108=_callSuper(this,PictTemplateProviderLogValueTree,[pFable,pOptions,pServiceHash]);/** @type {any} */_defineProperty2(_this108,"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;}_this108.log.trace("[".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i],"] (").concat(tmpBranchType,"): ").concat(tmpBranchValue));if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=_this108.logValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],"".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i]),pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';});_this108.log;_this108.addPattern('{~LogValueTree:','~}');_this108.addPattern('{~LVT:','~}');return _this108;}_inherits(PictTemplateProviderLogValueTree,_libPictTemplate28);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":141}],228:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderNotEmpty=/*#__PURE__*/function(_libPictTemplate29){/**
|
|
5434
5564
|
* @param {Object} pFable - The Fable Framework instance
|
|
5435
5565
|
* @param {Object} pOptions - The options for the service
|
|
5436
5566
|
* @param {String} pServiceHash - The hash of the service
|
|
5437
|
-
*/function PictTemplateProviderNotEmpty(pFable,pOptions,pServiceHash){var
|
|
5567
|
+
*/function PictTemplateProviderNotEmpty(pFable,pOptions,pServiceHash){var _this109;_classCallCheck2(this,PictTemplateProviderNotEmpty);_this109=_callSuper(this,PictTemplateProviderNotEmpty,[pFable,pOptions,pServiceHash]);/** @type {any} */_this109.log;_this109.addPattern('{~NotEmpty:','~}');_this109.addPattern('{~NE:','~}');return _this109;}_inherits(PictTemplateProviderNotEmpty,_libPictTemplate29);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.
|
|
5438
5568
|
if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}else{return'';}}}]);}(libPictTemplate);module.exports=PictTemplateProviderNotEmpty;},{"pict-template":141}],229:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateIfBase=/*#__PURE__*/function(_libPictTemplate30){/**
|
|
5439
5569
|
* @param {Object} pFable - The Fable Framework instance
|
|
5440
5570
|
* @param {Object} pOptions - The options for the service
|
|
@@ -5443,7 +5573,7 @@ if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return t
|
|
|
5443
5573
|
* @param {Object} pFable - The Fable Framework instance
|
|
5444
5574
|
* @param {Object} pOptions - The options for the service
|
|
5445
5575
|
* @param {String} pServiceHash - The hash of the service
|
|
5446
|
-
*/function PictTemplateProviderTemplateIf(pFable,pOptions,pServiceHash){var
|
|
5576
|
+
*/function PictTemplateProviderTemplateIf(pFable,pOptions,pServiceHash){var _this110;_classCallCheck2(this,PictTemplateProviderTemplateIf);_this110=_callSuper(this,PictTemplateProviderTemplateIf,[pFable,pOptions,pServiceHash]);/** @type {any} */_this110.log;_this110.addPattern('{~TemplateIf:','~}');_this110.addPattern('{~TIf:','~}');return _this110;}_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;var tmpAddressOfData;var tmpComparisonOperation;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
|
|
5447
5577
|
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
|
|
5448
5578
|
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...
|
|
5449
5579
|
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
|
|
@@ -5457,7 +5587,7 @@ var tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpCompa
|
|
|
5457
5587
|
* @param {Object} pFable - The Fable Framework instance
|
|
5458
5588
|
* @param {Object} pOptions - The options for the service
|
|
5459
5589
|
* @param {String} pServiceHash - The hash of the service
|
|
5460
|
-
*/function PictTemplateProviderTemplateIfAbsolute(pFable,pOptions,pServiceHash){var
|
|
5590
|
+
*/function PictTemplateProviderTemplateIfAbsolute(pFable,pOptions,pServiceHash){var _this111;_classCallCheck2(this,PictTemplateProviderTemplateIfAbsolute);_this111=_callSuper(this,PictTemplateProviderTemplateIfAbsolute,[pFable,pOptions,pServiceHash]);/** @type {any} */_this111.log;_this111.addPattern('{~TemplateIfAbsolute:','~}');_this111.addPattern('{~TIfAbs:','~}');return _this111;}_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;var tmpAddressOfData;var tmpComparisonOperation;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
|
|
5461
5591
|
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
|
|
5462
5592
|
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...
|
|
5463
5593
|
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
|