pict 1.0.271 → 1.0.273
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 +534 -437
- 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 +140 -43
- 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 +5 -5
- package/source/Pict-DataProvider.js +9 -1
- package/source/Pict-Meadow-EntityProvider.js +220 -13
- package/source/Pict.js +21 -6
- package/test/Pict_entityprovider_tests.js +51 -0
- package/test/Pict_template_tests.js +1 -0
- package/types/source/Pict-DataProvider.d.ts.map +1 -1
- package/types/source/Pict-Meadow-EntityProvider.d.ts +55 -2
- package/types/source/Pict-Meadow-EntityProvider.d.ts.map +1 -1
- package/types/source/Pict.d.ts +5 -3
- package/types/source/Pict.d.ts.map +1 -1
- package/types/source/templates/Pict-Template-DataWithTemplateFallback.d.ts +13 -0
- package/types/source/templates/Pict-Template-DataWithTemplateFallback.d.ts.map +1 -0
package/dist/pict.compatible.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t
|
|
1
|
+
"use strict";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t.return||t.return();}finally{if(u)throw o;}}};}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _defineProperty2(e,r,t){return(r=_toPropertyKey2(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _classCallCheck2(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey2(o.key),o);}}function _createClass2(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey2(t){var i=_toPrimitive2(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive2(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}(function(f){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&typeof module!=="undefined"){module.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else{var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else{g=this;}g.Pict=f();}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a;}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r);},p,p.exports,r,e,n,t);}return n[i].exports;}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o;}return r;}()({1:[function(require,module,exports){'use strict';var eachOfLimit=require('async.util.eachoflimit');var withoutIndex=require('async.util.withoutindex');module.exports=function eachLimit(arr,limit,iterator,cb){return eachOfLimit(limit)(arr,withoutIndex(iterator),cb);};},{"async.util.eachoflimit":3,"async.util.withoutindex":14}],2:[function(require,module,exports){'use strict';module.exports=function(tasks){function makeCallback(index){function fn(){if(tasks.length){tasks[index].apply(null,arguments);}return fn.next();}fn.next=function(){return index<tasks.length-1?makeCallback(index+1):null;};return fn;}return makeCallback(0);};},{}],3:[function(require,module,exports){var once=require('async.util.once');var noop=require('async.util.noop');var onlyOnce=require('async.util.onlyonce');var keyIterator=require('async.util.keyiterator');module.exports=function eachOfLimit(limit){return function(obj,iterator,cb){cb=once(cb||noop);obj=obj||[];var nextKey=keyIterator(obj);if(limit<=0){return cb(null);}var done=false;var running=0;var errored=false;(function replenish(){if(done&&running<=0){return cb(null);}while(running<limit&&!errored){var key=nextKey();if(key===null){done=true;if(running<=0){cb(null);}return;}running+=1;iterator(obj[key],key,onlyOnce(function(err){running-=1;if(err){cb(err);errored=true;}else{replenish();}}));}})();};};},{"async.util.keyiterator":7,"async.util.noop":9,"async.util.once":10,"async.util.onlyonce":11}],4:[function(require,module,exports){'use strict';var setImmediate=require('async.util.setimmediate');var restParam=require('async.util.restparam');module.exports=function(fn){return restParam(function(args){var callback=args.pop();args.push(function(){var innerArgs=arguments;if(sync){setImmediate(function(){callback.apply(null,innerArgs);});}else{callback.apply(null,innerArgs);}});var sync=true;fn.apply(this,args);sync=false;});};},{"async.util.restparam":12,"async.util.setimmediate":13}],5:[function(require,module,exports){'use strict';module.exports=Array.isArray||function isArray(obj){return Object.prototype.toString.call(obj)==='[object Array]';};},{}],6:[function(require,module,exports){'use strict';var isArray=require('async.util.isarray');module.exports=function isArrayLike(arr){return isArray(arr)||// has a positive integer length property
|
|
2
2
|
typeof arr.length==='number'&&arr.length>=0&&arr.length%1===0;};},{"async.util.isarray":5}],7:[function(require,module,exports){'use strict';var _keys=require('async.util.keys');var isArrayLike=require('async.util.isarraylike');module.exports=function keyIterator(coll){var i=-1;var len;var keys;if(isArrayLike(coll)){len=coll.length;return function next(){i++;return i<len?i:null;};}else{keys=_keys(coll);len=keys.length;return function next(){i++;return i<len?keys[i]:null;};}};},{"async.util.isarraylike":6,"async.util.keys":8}],8:[function(require,module,exports){'use strict';module.exports=Object.keys||function keys(obj){var _keys=[];for(var k in obj){if(obj.hasOwnProperty(k)){_keys.push(k);}}return _keys;};},{}],9:[function(require,module,exports){'use strict';module.exports=function noop(){};},{}],10:[function(require,module,exports){'use strict';module.exports=function once(fn){return function(){if(fn===null)return;fn.apply(this,arguments);fn=null;};};},{}],11:[function(require,module,exports){'use strict';module.exports=function only_once(fn){return function(){if(fn===null)throw new Error('Callback was already called.');fn.apply(this,arguments);fn=null;};};},{}],12:[function(require,module,exports){'use strict';module.exports=function restParam(func,startIndex){startIndex=startIndex==null?func.length-1:+startIndex;return function(){var length=Math.max(arguments.length-startIndex,0);var rest=new Array(length);for(var index=0;index<length;index++){rest[index]=arguments[index+startIndex];}switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);}};};},{}],13:[function(require,module,exports){(function(setImmediate){(function(){'use strict';var _setImmediate=typeof setImmediate==='function'&&setImmediate;var fallback=function fallback(fn){setTimeout(fn,0);};module.exports=function setImmediate(fn){// not a direct alias for IE10 compatibility
|
|
3
3
|
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":186}],14:[function(require,module,exports){'use strict';module.exports=function withoutIndex(iterator){return function(value,index,callback){return iterator(value,callback);};};},{}],15:[function(require,module,exports){'use strict';var once=require('async.util.once');var noop=require('async.util.noop');var isArray=require('async.util.isarray');var restParam=require('async.util.restparam');var ensureAsync=require('async.util.ensureasync');var iterator=require('async.iterator');module.exports=function(tasks,cb){cb=once(cb||noop);if(!isArray(tasks))return cb(new Error('First argument to waterfall must be an array of functions'));if(!tasks.length)return cb();function wrapIterator(iterator){return restParam(function(err,args){if(err){cb.apply(null,[err].concat(args));}else{var next=iterator.next();if(next){args.push(wrapIterator(next));}else{args.push(cb);}ensureAsync(iterator).apply(null,args);}});}wrapIterator(iterator(tasks))();};},{"async.iterator":2,"async.util.ensureasync":4,"async.util.isarray":5,"async.util.noop":9,"async.util.once":10,"async.util.restparam":12}],16:[function(require,module,exports){'use strict';exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;var code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}// Support decoding URL-safe base64 strings, as Node.js does.
|
|
4
4
|
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
|
@@ -493,7 +493,8 @@ else tmpNode=tmpNode.RightNode;// Call the actual action
|
|
|
493
493
|
// I hate this pattern because long tails eventually cause stack overflows.
|
|
494
494
|
fAction(tmpNode.Datum,tmpNode.Hash,_fIterator);};// Now kick off the iterator
|
|
495
495
|
return _fIterator();}// Seek a specific node, 0 is the index of the first node.
|
|
496
|
-
},{key:"seek",value:function seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;var tmpNode=this.head;for(var i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}]);}();module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var bind=require('function-bind');var $apply=require('./functionApply');var $call=require('./functionCall');var $reflectApply=require('./reflectApply');/** @type {import('./actualApply')} */module.exports=$reflectApply||bind.call($call,$apply);},{"./functionApply":26,"./functionCall":27,"./reflectApply":29,"function-bind":102}],26:[function(require,module,exports){'use strict';/** @type {import('./functionApply')} */module.exports=Function.prototype.apply;},{}],27:[function(require,module,exports){'use strict';/** @type {import('./functionCall')} */module.exports=Function.prototype.call;},{}],28:[function(require,module,exports){'use strict';var bind=require('function-bind');var $TypeError=require('es-errors/type');var $call=require('./functionCall');var $actualApply=require('./actualApply');/** @type {
|
|
496
|
+
},{key:"seek",value:function seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;var tmpNode=this.head;for(var i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}]);}();module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var bind=require('function-bind');var $apply=require('./functionApply');var $call=require('./functionCall');var $reflectApply=require('./reflectApply');/** @type {import('./actualApply')} */module.exports=$reflectApply||bind.call($call,$apply);},{"./functionApply":26,"./functionCall":27,"./reflectApply":29,"function-bind":102}],26:[function(require,module,exports){'use strict';/** @type {import('./functionApply')} */module.exports=Function.prototype.apply;},{}],27:[function(require,module,exports){'use strict';/** @type {import('./functionCall')} */module.exports=Function.prototype.call;},{}],28:[function(require,module,exports){'use strict';var bind=require('function-bind');var $TypeError=require('es-errors/type');var $call=require('./functionCall');var $actualApply=require('./actualApply');/** @type {import('.')} */module.exports=function callBindBasic(args){if(args.length<1||typeof args[0]!=='function'){throw new $TypeError('a function is required');}return $actualApply(bind,$call,args);};},{"./actualApply":25,"./functionCall":27,"es-errors/type":47,"function-bind":102}],29:[function(require,module,exports){'use strict';/** @type {import('./reflectApply')} */module.exports=typeof Reflect!=='undefined'&&Reflect&&Reflect.apply;},{}],30:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBindBasic=require('call-bind-apply-helpers');/** @type {(thisArg: string, searchString: string, position?: number) => number} */var $indexOf=callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);/** @type {import('.')} */module.exports=function callBoundIntrinsic(name,allowMissing){// eslint-disable-next-line no-extra-parens
|
|
497
|
+
var intrinsic=/** @type {Parameters<typeof callBindBasic>[0][0]} */GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==='function'&&$indexOf(name,'.prototype.')>-1){return callBindBasic([intrinsic]);}return intrinsic;};},{"call-bind-apply-helpers":28,"get-intrinsic":103}],31:[function(require,module,exports){/*!
|
|
497
498
|
* cookie
|
|
498
499
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|
499
500
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
@@ -634,7 +635,7 @@ return true;}}]);}(libFableServiceProviderBase);module.exports=BaseLogger;},{"fa
|
|
|
634
635
|
*
|
|
635
636
|
* @author Steven Velozo <steven@velozo.com>
|
|
636
637
|
*/// Return the providers that are available without extensions loaded
|
|
637
|
-
var getDefaultProviders=function getDefaultProviders(){var tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders
|
|
638
|
+
var getDefaultProviders=function getDefaultProviders(){var tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders.default=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":55}],54:[function(require,module,exports){module.exports=[{"loggertype":"console","streamtype":"console","level":"trace"}];},{}],55:[function(require,module,exports){var libBaseLogger=require('./Fable-Log-BaseLogger.js');var ConsoleLogger=/*#__PURE__*/function(_libBaseLogger){function ConsoleLogger(pLogStreamSettings,pFableLog){var _this7;_classCallCheck2(this,ConsoleLogger);_this7=_callSuper(this,ConsoleLogger,[pLogStreamSettings]);_this7._ShowTimeStamps='showtimestamps'in _this7._Settings?_this7._Settings.showtimestamps==true:true;_this7._FormattedTimeStamps='formattedtimestamps'in _this7._Settings?_this7._Settings.formattedtimestamps==true:true;_this7._ContextMessage='Context'in _this7._Settings?"(".concat(_this7._Settings.Context,")"):'Product'in pFableLog._Settings?"(".concat(pFableLog._Settings.Product,")"):'Unnamed_Log_Context';// Allow the user to decide what gets output to the console
|
|
638
639
|
_this7._OutputLogLinesToConsole='outputloglinestoconsole'in _this7._Settings?_this7._Settings.outputloglinestoconsole:true;_this7._OutputObjectsToConsole='outputobjectstoconsole'in _this7._Settings?_this7._Settings.outputobjectstoconsole:true;// Precompute the prefix for each level
|
|
639
640
|
_this7.prefixCache={};for(var i=0;i<=_this7.levels.length;i++){_this7.prefixCache[_this7.levels[i]]="[".concat(_this7.levels[i],"] ").concat(_this7._ContextMessage,": ");if(_this7._ShowTimeStamps){// If there is a timestamp we need a to prepend space before the prefixcache string, since the timestamp comes first
|
|
640
641
|
_this7.prefixCache[_this7.levels[i]]=' '+_this7.prefixCache[_this7.levels[i]];}}return _this7;}_inherits(ConsoleLogger,_libBaseLogger);return _createClass2(ConsoleLogger,[{key:"write",value:function write(pLevel,pLogText,pObject){var tmpTimeStamp='';if(this._ShowTimeStamps&&this._FormattedTimeStamps){tmpTimeStamp=new Date().toISOString();}else if(this._ShowTimeStamps){tmpTimeStamp=+new Date();}var tmpLogLine="".concat(tmpTimeStamp).concat(this.prefixCache[pLevel]).concat(pLogText);if(this._OutputLogLinesToConsole){console.log(tmpLogLine);}// Write out the object on a separate line if it is passed in
|
|
@@ -690,17 +691,17 @@ this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTempl
|
|
|
690
691
|
*
|
|
691
692
|
* @author Steven Velozo <steven@velozo.com>
|
|
692
693
|
* @module Fable Settings
|
|
693
|
-
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var libFableSettingsTemplateProcessor=require('./Fable-Settings-TemplateProcessor.js');var FableSettings=/*#__PURE__*/function(_libFableServiceProvi4){function FableSettings(pSettings,pServiceHash){var
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
var tmpSettings=
|
|
697
|
-
|
|
698
|
-
tmpSettings=
|
|
694
|
+
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var libFableSettingsTemplateProcessor=require('./Fable-Settings-TemplateProcessor.js');var FableSettings=/*#__PURE__*/function(_libFableServiceProvi4){function FableSettings(pSettings,pServiceHash){var _this10;_classCallCheck2(this,FableSettings);_this10=_callSuper(this,FableSettings,[pSettings,pServiceHash]);_this10.serviceType='SettingsManager';_this10._Package=require('../package.json');// Initialize the settings value template processor
|
|
695
|
+
_this10.settingsTemplateProcessor=new libFableSettingsTemplateProcessor();// set straight away so anything that uses it respects the initial setting
|
|
696
|
+
_this10._configureEnvTemplating(pSettings);_this10.default=_this10.buildDefaultSettings();// Construct a new settings object
|
|
697
|
+
var tmpSettings=_this10.merge(pSettings,_this10.buildDefaultSettings());// The base settings object (what they were on initialization, before other actors have altered them)
|
|
698
|
+
_this10.base=JSON.parse(JSON.stringify(tmpSettings));if(tmpSettings.DefaultConfigFile){try{// If there is a DEFAULT configuration file, try to load and merge it.
|
|
699
|
+
tmpSettings=_this10.merge(require(tmpSettings.DefaultConfigFile),tmpSettings);}catch(pException){// Why this? Often for an app we want settings to work out of the box, but
|
|
699
700
|
// would potentially want to have a config file for complex settings.
|
|
700
701
|
console.log('Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base.');console.log(' Loading Exception: '+pException);}}if(tmpSettings.ConfigFile){try{// If there is a configuration file, try to load and merge it.
|
|
701
|
-
tmpSettings=
|
|
702
|
+
tmpSettings=_this10.merge(require(tmpSettings.ConfigFile),tmpSettings);}catch(pException){// Why this? Often for an app we want settings to work out of the box, but
|
|
702
703
|
// would potentially want to have a config file for complex settings.
|
|
703
|
-
console.log('Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base.');console.log(' Loading Exception: '+pException);}}
|
|
704
|
+
console.log('Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base.');console.log(' Loading Exception: '+pException);}}_this10.settings=tmpSettings;return _this10;}// Build a default settings object. Use the JSON jimmy to ensure it is always a new object.
|
|
704
705
|
_inherits(FableSettings,_libFableServiceProvi4);return _createClass2(FableSettings,[{key:"buildDefaultSettings",value:function buildDefaultSettings(){return JSON.parse(JSON.stringify(require('./Fable-Settings-Default')));}// Update the configuration for environment variable templating based on the current settings object
|
|
705
706
|
},{key:"_configureEnvTemplating",value:function _configureEnvTemplating(pSettings){// default environment variable templating to on
|
|
706
707
|
this._PerformEnvTemplating=!pSettings||pSettings.NoEnvReplacement!==true;}// Resolve (recursive) any environment variables found in settings object.
|
|
@@ -708,8 +709,8 @@ this._PerformEnvTemplating=!pSettings||pSettings.NoEnvReplacement!==true;}// Res
|
|
|
708
709
|
* Check to see if a value is an object (but not an array).
|
|
709
710
|
*/},{key:"_isObject",value:function _isObject(value){return _typeof(value)==='object'&&!Array.isArray(value);}/**
|
|
710
711
|
* Merge two plain objects. Keys that are objects in both will be merged property-wise.
|
|
711
|
-
*/},{key:"_deepMergeObjects",value:function _deepMergeObjects(toObject,fromObject){var
|
|
712
|
-
|
|
712
|
+
*/},{key:"_deepMergeObjects",value:function _deepMergeObjects(toObject,fromObject){var _this11=this;if(!fromObject||!this._isObject(fromObject)){return;}Object.keys(fromObject).forEach(function(key){var fromValue=fromObject[key];if(_this11._isObject(fromValue)){var toValue=toObject[key];if(toValue&&_this11._isObject(toValue)){// both are objects, so do a recursive merge
|
|
713
|
+
_this11._deepMergeObjects(toValue,fromValue);return;}}toObject[key]=fromValue;});return toObject;}// Merge some new object into the existing settings.
|
|
713
714
|
},{key:"merge",value:function merge(pSettingsFrom,pSettingsTo){// If an invalid settings from object is passed in (e.g. object constructor without passing in anything) this should still work
|
|
714
715
|
var tmpSettingsFrom=_typeof(pSettingsFrom)==='object'?pSettingsFrom:{};// Default to the settings object if none is passed in for the merge.
|
|
715
716
|
var tmpSettingsTo=_typeof(pSettingsTo)==='object'?pSettingsTo:this.settings;// do not mutate the From object property values
|
|
@@ -718,7 +719,7 @@ this._configureEnvTemplating(tmpSettingsTo);return tmpSettingsTo;}// Fill in set
|
|
|
718
719
|
},{key:"fill",value:function fill(pSettingsFrom){// If an invalid settings from object is passed in (e.g. object constructor without passing in anything) this should still work
|
|
719
720
|
var tmpSettingsFrom=_typeof(pSettingsFrom)==='object'?pSettingsFrom:{};// do not mutate the From object property values
|
|
720
721
|
var tmpSettingsFromCopy=JSON.parse(JSON.stringify(tmpSettingsFrom));this.settings=this._deepMergeObjects(tmpSettingsFromCopy,this.settings);return this.settings;}}]);}(libFableServiceProviderBase);;// This is for backwards compatibility
|
|
721
|
-
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports
|
|
722
|
+
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports.new=autoConstruct;},{"../package.json":60,"./Fable-Settings-Default":61,"./Fable-Settings-TemplateProcessor.js":62,"fable-serviceproviderbase":59}],64:[function(require,module,exports){module.exports={"name":"fable-uuid","version":"3.0.11","description":"A simple UUID Generator.","main":"source/Fable-UUID.js","scripts":{"start":"node source/Fable-UUID.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":"./node_modules/.bin/gulp build","docker-dev-build-image":"docker build ./ -f Dockerfile_LUXURYCode -t retold/fable-uuid:local","docker-dev-run":"docker run -it -d --name retold-fable-uuid-dev -p 30002:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable-uuid\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable-uuid:local"},"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":"https://github.com/stevenvelozo/fable-uuid.git"},"keywords":["logging"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-uuid/issues"},"browser":{"./source/Fable-UUID-Random.js":"./source/Fable-UUID-Random-Browser.js"},"homepage":"https://github.com/stevenvelozo/fable-uuid","devDependencies":{"quackage":"^1.0.33"},"dependencies":{"fable-serviceproviderbase":"^3.0.15"}};},{}],65:[function(require,module,exports){/**
|
|
722
723
|
* Random Byte Generator - Browser version
|
|
723
724
|
*
|
|
724
725
|
*
|
|
@@ -738,45 +739,45 @@ this.getRandomValues(tmpBuffer);return tmpBuffer;}// Math.random()-based (RNG)
|
|
|
738
739
|
var tmpBuffer=new Uint8Array(16);// eslint-disable-line no-undef
|
|
739
740
|
for(var i=0,tmpValue;i<16;i++){if((i&0x03)===0){tmpValue=Math.random()*0x100000000;}tmpBuffer[i]=tmpValue>>>((i&0x03)<<3)&0xff;}return tmpBuffer;}},{key:"generate",value:function generate(){if(this.getRandomValues){return this.generateWhatWGBytes();}else{return this.generateRandomBytes();}}}]);}();module.exports=RandomBytes;},{}],66:[function(require,module,exports){/**
|
|
740
741
|
* Fable UUID Generator
|
|
741
|
-
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;0;var libRandomByteGenerator=require('./Fable-UUID-Random.js');var libPackage=require('../package.json');var FableUUID=/*#__PURE__*/function(_libFableServiceProvi5){function FableUUID(pSettings,pServiceHash){var
|
|
742
|
+
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;0;var libRandomByteGenerator=require('./Fable-UUID-Random.js');var libPackage=require('../package.json');var FableUUID=/*#__PURE__*/function(_libFableServiceProvi5){function FableUUID(pSettings,pServiceHash){var _this12;_classCallCheck2(this,FableUUID);_this12=_callSuper(this,FableUUID,[pSettings,pServiceHash]);_this12.serviceType='UUID';/** @type {Object} */_this12._Package=libPackage;// Determine if the module is in "Random UUID Mode" which means just use the random character function rather than the v4 random UUID spec.
|
|
742
743
|
// Note this allows UUIDs of various lengths (including very short ones) although guaranteed uniqueness goes downhill fast.
|
|
743
|
-
|
|
744
|
+
_this12._UUIDModeRandom=_typeof(pSettings)==='object'&&'UUIDModeRandom'in pSettings?pSettings.UUIDModeRandom==true:false;// These two properties are only useful if we are in Random mode. Otherwise it generates a v4 spec
|
|
744
745
|
// Length for "Random UUID Mode" is set -- if not set it to 8
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
746
|
+
_this12._UUIDLength=_typeof(pSettings)==='object'&&'UUIDLength'in pSettings?pSettings.UUIDLength+0:8;// Dictionary for "Random UUID Mode"
|
|
747
|
+
_this12._UUIDRandomDictionary=_typeof(pSettings)==='object'&&'UUIDDictionary'in pSettings?pSettings.UUIDDictionary+0:'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';_this12.randomByteGenerator=new libRandomByteGenerator();// Lookup table for hex codes
|
|
748
|
+
_this12._HexLookup=[];for(var i=0;i<256;++i){_this12._HexLookup[i]=(i+0x100).toString(16).substr(1);}return _this12;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
748
749
|
_inherits(FableUUID,_libFableServiceProvi5);return _createClass2(FableUUID,[{key:"bytesToUUID",value:function bytesToUUID(pBuffer){var i=0;// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
749
750
|
return[this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]]].join('');}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
750
751
|
},{key:"generateUUIDv4",value:function generateUUIDv4(){var tmpBuffer=new Array(16);var tmpRandomBytes=this.randomByteGenerator.generate();// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
751
752
|
tmpRandomBytes[6]=tmpRandomBytes[6]&0x0f|0x40;tmpRandomBytes[8]=tmpRandomBytes[8]&0x3f|0x80;return this.bytesToUUID(tmpRandomBytes);}// Simple random UUID generation
|
|
752
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)
|
|
753
754
|
},{key:"getUUID",value:function getUUID(){if(this._UUIDModeRandom){return this.generateRandom();}else{return this.generateUUIDv4();}}}]);}(libFableServiceProviderBase);// This is for backwards compatibility
|
|
754
|
-
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports
|
|
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.11","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.41"},"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){/**
|
|
755
756
|
* Fable Application Services Support Library
|
|
756
757
|
* @author <steven@velozo.com>
|
|
757
758
|
*/// Pre-init services
|
|
758
|
-
var libFableSettings=require('fable-settings');var libFableUUID=require('fable-uuid');var libFableLog=require('fable-log');var libPackage=require('../package.json');var libFableServiceBase=require('fable-serviceproviderbase');var Fable=/*#__PURE__*/function(_libFableServiceBase$){function Fable(pSettings){var
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
759
|
+
var libFableSettings=require('fable-settings');var libFableUUID=require('fable-uuid');var libFableLog=require('fable-log');var libPackage=require('../package.json');var libFableServiceBase=require('fable-serviceproviderbase');var Fable=/*#__PURE__*/function(_libFableServiceBase$){function Fable(pSettings){var _this13;_classCallCheck2(this,Fable);_this13=_callSuper(this,Fable,[pSettings]);// Initialization Phase 0: Set up the lowest level state (fable is a utility service manager at heart)
|
|
760
|
+
_this13.serviceType='ServiceManager';/** @type {Object} */_this13._Package=libPackage;// An array of the types of services available
|
|
761
|
+
_this13.serviceTypes=[];// A map of instantiated services
|
|
762
|
+
_this13.servicesMap={};// A map of the default instantiated service by type
|
|
763
|
+
_this13.services={};// A map of class constructors for services
|
|
764
|
+
_this13.serviceClasses={};// If we need extra service initialization capabilities
|
|
765
|
+
_this13.extraServiceInitialization=false;// Set how noisy the system is about signaling complexity
|
|
766
|
+
_this13.LogNoisiness=0;// Initialization Phase 1: Set up the core utility services
|
|
766
767
|
// These are things like power, water, and sewage. They are required for fable to run (e.g. logging, settings, etc)
|
|
767
768
|
// Instantiate the default Settings Manager
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
769
|
+
_this13.SettingsManager=new libFableSettings(pSettings);_this13.SettingsManager=_this13.SettingsManager;// Instantiate the UUID generator
|
|
770
|
+
_this13.UUID=new libFableUUID(_this13.SettingsManager.settings);// Instantiate the logging system
|
|
771
|
+
_this13.Logging=new libFableLog(_this13.SettingsManager.settings);_this13.Logging.initialize();// Initialization Phase 1.5: Instantiate the service manager
|
|
771
772
|
// This is the start actual bootstrapping point for fable.
|
|
772
773
|
// For consistency fable is treated as a service.
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
774
|
+
_this13.ServiceManager=_this13;// TODO: Remove this when Orator and meadow-endpoints are shifted to this new pattern
|
|
775
|
+
_this13.serviceManager=_this13;// END TODO
|
|
776
|
+
_this13.connectFable(_this13);// --> Bootstrapping of fable into the Service Manager is complete
|
|
776
777
|
// Initialization Phase 2: Map in the default services.
|
|
777
778
|
// They will then be available in the Default service provider set as well.
|
|
778
|
-
|
|
779
|
-
|
|
779
|
+
_this13.connectPreinitServiceProviderInstance(_this13.UUID);_this13.connectPreinitServiceProviderInstance(_this13.Logging);_this13.connectPreinitServiceProviderInstance(_this13.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
780
|
+
_this13.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));_this13.addServiceType('Template',require('./services/Fable-Service-Template.js'));_this13.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));_this13.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));_this13.addAndInstantiateServiceType('Dates',require('./services/Fable-Service-DateManipulation.js'));_this13.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));_this13.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));_this13.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));_this13.addAndInstantiateServiceType('Logic',require('./services/Fable-Service-Logic.js'));_this13.addAndInstantiateServiceType('Math',require('./services/Fable-Service-Math.js'));_this13.addServiceType('ExpressionParser',require('./services/Fable-Service-ExpressionParser.js'));_this13.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));_this13.addServiceType('Manifest',require('manyfest'));_this13.addServiceType('ObjectCache',require('cachetrax'));_this13.addAndInstantiateServiceType('ProgressTime',require('./services/Fable-Service-ProgressTime.js'));_this13.addServiceType('ProgressTrackerSet',require('./services/Fable-Service-ProgressTrackerSet.js'));_this13.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));_this13.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));_this13.addServiceType('FilePersistence',require('./services/Fable-Service-FilePersistence.js'));return _this13;}/* State Accessors */_inherits(Fable,_libFableServiceBase$);return _createClass2(Fable,[{key:"isFable",get:function get(){return true;}},{key:"settings",get:function get(){return this.SettingsManager.settings;}},{key:"settingsManager",get:function get(){return this.SettingsManager;}// For backwards compatibility
|
|
780
781
|
},{key:"getUUID",value:function getUUID(){return this.UUID.getUUID();}},{key:"newAnticipate",value:function newAnticipate(){return this.instantiateServiceProviderWithoutRegistration('Anticipate');}},{key:"newManyfest",value:function newManyfest(pManifestDefinition){return this.instantiateServiceProviderWithoutRegistration('Manifest',pManifestDefinition);}/* Service Manager Methods */},{key:"addServiceType",value:function addServiceType(pServiceType,pServiceClass){if(pServiceType in this.servicesMap){// TODO: Check if any services are running?
|
|
781
782
|
this.log.warn("Adding a service type [".concat(pServiceType,"] that already exists. This will change the default class prototype for this service."));}else{// Add the container for instantiated services to go in
|
|
782
783
|
this.servicesMap[pServiceType]={};// Add the type to the list of types
|
|
@@ -809,8 +810,8 @@ if(pServiceHash in this.servicesMap[pServiceType]){if(!(pServiceType in this)||t
|
|
|
809
810
|
* @param {Date} pDate - An optional javascript Date object to generate a datestamp for.
|
|
810
811
|
* @returns {string} - A string formatted as YYYY-MM-DD-HH-MM-SS
|
|
811
812
|
*/}],[{key:"generateFileNameDateStamp",value:function generateFileNameDateStamp(pDate){var tmpDate=pDate||new Date();var tmpYear=tmpDate.getFullYear();var tmpMonth=String(tmpDate.getMonth()+1).padStart(2,'0');var tmpDay=String(tmpDate.getDate()).padStart(2,'0');var tmpHour=String(tmpDate.getHours()).padStart(2,'0');var tmpMinute=String(tmpDate.getMinutes()).padStart(2,'0');var tmpSecond=String(tmpDate.getSeconds()).padStart(2,'0');return"".concat(tmpYear,"-").concat(tmpMonth,"-").concat(tmpDay,"-").concat(tmpHour,"-").concat(tmpMinute,"-").concat(tmpSecond);}}]);}(libFableServiceBase.CoreServiceProviderBase);// This is for backwards compatibility
|
|
812
|
-
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports
|
|
813
|
-
|
|
813
|
+
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports.new=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"../package.json":67,"./services/Fable-Service-Anticipate.js":69,"./services/Fable-Service-CSVParser.js":70,"./services/Fable-Service-DataFormat.js":71,"./services/Fable-Service-DataGeneration.js":73,"./services/Fable-Service-DateManipulation.js":74,"./services/Fable-Service-EnvironmentData.js":75,"./services/Fable-Service-ExpressionParser.js":76,"./services/Fable-Service-FilePersistence.js":86,"./services/Fable-Service-Logic.js":87,"./services/Fable-Service-Math.js":88,"./services/Fable-Service-MetaTemplate.js":89,"./services/Fable-Service-Operation.js":93,"./services/Fable-Service-ProgressTime.js":94,"./services/Fable-Service-ProgressTrackerSet.js":96,"./services/Fable-Service-RestClient.js":97,"./services/Fable-Service-Template.js":98,"./services/Fable-Service-Utility.js":99,"cachetrax":22,"fable-log":57,"fable-serviceproviderbase":59,"fable-settings":63,"fable-uuid":66,"manyfest":126}],69:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceAnticipate=/*#__PURE__*/function(_libFableServiceBase){function FableServiceAnticipate(pFable,pOptions,pServiceHash){var _this14;_classCallCheck2(this,FableServiceAnticipate);_this14=_callSuper(this,FableServiceAnticipate,[pFable,pOptions,pServiceHash]);_this14.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
|
|
814
|
+
_this14.operationQueue=[];_this14.erroredOperations=[];_this14.executingOperationCount=0;_this14.completedOperationCount=0;_this14.callDepth=0;_this14.maxOperations=1;_this14.lastError=undefined;_this14.waitingFunctions=[];return _this14;}_inherits(FableServiceAnticipate,_libFableServiceBase);return _createClass2(FableServiceAnticipate,[{key:"checkQueue",value:function checkQueue(){// This could be combined with the last else if stanza but the logic for errors and non-errors would be blended and more complex to follow so keeping it unrolled.
|
|
814
815
|
if(this.lastError){// If there are no operations left, and we have waiting functions, call them.
|
|
815
816
|
for(var i=0;i<this.waitingFunctions.length;i++){//this.log.trace('Calling waiting function.')
|
|
816
817
|
this.waitingFunctions[i](this.lastError);}// Reset our state
|
|
@@ -835,8 +836,8 @@ if(tmpCallbackState.OperationSet.callDepth>400){tmpCallbackState.OperationSet.ca
|
|
|
835
836
|
* do anything; unfortunately some files have a sequence issue with that.
|
|
836
837
|
*
|
|
837
838
|
* @class CSVParser
|
|
838
|
-
*/var CSVParser=/*#__PURE__*/function(_libFableServiceProvi6){function CSVParser(pFable,pOptions,pServiceHash){var
|
|
839
|
-
|
|
839
|
+
*/var CSVParser=/*#__PURE__*/function(_libFableServiceProvi6){function CSVParser(pFable,pOptions,pServiceHash){var _this15;_classCallCheck2(this,CSVParser);_this15=_callSuper(this,CSVParser,[pFable,pOptions,pServiceHash]);_this15.serviceType='CSVParser';_this15.Header=[];_this15.HeaderFieldNames=[];_this15.Delimiter=',';_this15.QuoteCharacter='"';_this15.CleanCharacters=['\r'];_this15.HeaderLineIndex=0;_this15.HasHeader=true;_this15.HasSetHeader=false;_this15.EmitHeader=false;_this15.EmitJSON=true;_this15.EscapedQuoteString='"';// Current Line Parsing State
|
|
840
|
+
_this15.CurrentLine='';_this15.CurrentRecord=[];_this15.InQuote=false;_this15.InEscapedQuote=false;_this15.LinesParsed=0;_this15.RowsEmitted=0;return _this15;}_inherits(CSVParser,_libFableServiceProvi6);return _createClass2(CSVParser,[{key:"marshalRowToJSON",value:function marshalRowToJSON(pRowArray){if(!Array.isArray(pRowArray)){return false;}for(var i=this.HeaderFieldNames.length;i<pRowArray.length;i++){this.HeaderFieldNames[i]="".concat(i);}var tmpObject={};for(var _i3=0;_i3<pRowArray.length;_i3++){tmpObject[this.HeaderFieldNames[_i3]]=pRowArray[_i3];}return tmpObject;}// Set the header data, for use in marshalling to JSON.
|
|
840
841
|
},{key:"setHeader",value:function setHeader(pHeaderArray){this.Header=pHeaderArray;for(var i=0;i<this.Header.length;i++){if(typeof this.Header[i]=='undefined'){this.HeaderFieldNames[i]="".concat(i);}else{this.HeaderFieldNames[i]=this.Header[i].toString().trim();}}}},{key:"resetRowState",value:function resetRowState(){this.CurrentRecord=[];}},{key:"pushLine",value:function pushLine(){for(var i=0;i<this.CleanCharacters.length;i++){this.CurrentLine=this.CurrentLine.replace(this.CleanCharacters[i],'');}this.CurrentRecord.push(this.CurrentLine);this.CurrentLine='';}},{key:"emitRow",value:function emitRow(pFormatAsJSON){var tmpFormatAsJSON=typeof pFormatAsJSON=='undefined'?this.EmitJSON:pFormatAsJSON;this.RowsEmitted++;var tmpCompletedRecord=this.CurrentRecord;this.CurrentRecord=[];if(tmpFormatAsJSON){return this.marshalRowToJSON(tmpCompletedRecord);}else{return tmpCompletedRecord;}}},{key:"parseCSVLine",value:function parseCSVLine(pLineString){this.LinesParsed++;for(var i=0;i<pLineString.length;i++){if(!this.InQuote&&pLineString[i]==this.Delimiter){this.pushLine();}else if(pLineString[i]==this.QuoteCharacter){// If we are in the second part of an escaped quote, ignore it.
|
|
841
842
|
if(this.InEscapedQuote){this.InEscapedQuote=false;}// If we aren't in a quote, enter quote
|
|
842
843
|
else if(!this.InQuote){this.InQuote=true;}// We are in a quote, so peek forward to see if this is an "escaped" quote pair
|
|
@@ -850,26 +851,26 @@ if(this.EmitHeader){return this.Header;}else{return false;}}else{return this.emi
|
|
|
850
851
|
* Data Formatting and Translation Functions
|
|
851
852
|
*
|
|
852
853
|
* @class DataFormat
|
|
853
|
-
*/var DataFormat=/*#__PURE__*/function(_libFableServiceProvi7){function DataFormat(pFable,pOptions,pServiceHash){var
|
|
854
|
+
*/var DataFormat=/*#__PURE__*/function(_libFableServiceProvi7){function DataFormat(pFable,pOptions,pServiceHash){var _this16;_classCallCheck2(this,DataFormat);_this16=_callSuper(this,DataFormat,[pFable,pOptions,pServiceHash]);/**
|
|
854
855
|
* Pad the start of a string.
|
|
855
856
|
*
|
|
856
857
|
* @param {*} pString
|
|
857
858
|
* @param {number} pTargetLength
|
|
858
859
|
* @returns {string} pPadString
|
|
859
|
-
*/_defineProperty2(
|
|
860
|
+
*/_defineProperty2(_this16,"stringPadStart",function(pString,pTargetLength,pPadString){var tmpString=pString.toString();return this.stringGeneratePaddingString(tmpString,pTargetLength,pPadString)+tmpString;});/**
|
|
860
861
|
* Pad the end of a string.
|
|
861
862
|
*
|
|
862
863
|
* @param {*} pString
|
|
863
864
|
* @param {number} pTargetLength
|
|
864
865
|
* @returns {string} pPadString
|
|
865
|
-
*/_defineProperty2(
|
|
866
|
+
*/_defineProperty2(_this16,"stringPadEnd",function(pString,pTargetLength,pPadString){var tmpString=pString.toString();return tmpString+this.stringGeneratePaddingString(tmpString,pTargetLength,pPadString);});_this16.serviceType='DataArithmatic';// Regular Expressions (so they don't have to be recompiled every time)
|
|
866
867
|
// These could be defined as static, but I'm not sure if that will work with browserify ... and specifically the QT browser.
|
|
867
|
-
|
|
868
|
+
_this16._Regex_formatterInsertCommas=/.{1,3}/g;// Match Function:
|
|
868
869
|
// function(pMatch, pSign, pZeros, pBefore, pDecimal, pAfter)
|
|
869
870
|
// Thoughts about below: /^([+-]?)(0*)(\d+)(\.(\d+))?$/;
|
|
870
|
-
|
|
871
|
+
_this16._Regex_formatterAddCommasToNumber=/^([-+]?)(0?)(\d+)(.?)(\d+)$/g;_this16._Regex_formatterDollarsRemoveCommas=/,/gi;_this16._Regex_formatterCleanNonAlphaChar=/[^a-zA-Z]/gi;_this16._Regex_formatterCapitalizeEachWord=/([a-zA-Z]+)/g;_this16._Regex_matcherHTMLEntities=/&(#?[a-zA-Z0-9]+);/g;// TODO: Potentially pull these in from a configuration.
|
|
871
872
|
// TODO: Use locale data for this if it's defaults all the way down.
|
|
872
|
-
|
|
873
|
+
_this16._Value_MoneySign_Currency='$';_this16._Value_NaN_Currency='--';_this16._Value_GroupSeparator_Number=',';_this16._Value_Prefix_StringHash='HSH';_this16._Value_Clean_formatterCleanNonAlpha='';_this16._UseEngineStringStartsWith=typeof String.prototype.startsWith==='function';_this16._UseEngineStringEndsWith=typeof String.prototype.endsWith==='function';return _this16;}/*************************************************************************
|
|
873
874
|
* String Manipulation and Comparison Functions
|
|
874
875
|
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//**
|
|
875
876
|
* Reverse a string
|
|
@@ -1165,7 +1166,7 @@ if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1)
|
|
|
1165
1166
|
* FableServiceDataGeneration class provides various methods for generating random data.
|
|
1166
1167
|
*
|
|
1167
1168
|
* @extends libFableServiceBase
|
|
1168
|
-
*/var FableServiceDataGeneration=/*#__PURE__*/function(_libFableServiceBase2){function FableServiceDataGeneration(pFable,pOptions,pServiceHash){var
|
|
1169
|
+
*/var FableServiceDataGeneration=/*#__PURE__*/function(_libFableServiceBase2){function FableServiceDataGeneration(pFable,pOptions,pServiceHash){var _this17;_classCallCheck2(this,FableServiceDataGeneration);_this17=_callSuper(this,FableServiceDataGeneration,[pFable,pOptions,pServiceHash]);_this17.serviceType='DataGeneration';_this17.defaultData=require('./Fable-Service-DataGeneration-DefaultValues.json');return _this17;}/**
|
|
1169
1170
|
* Generates a random integer between the specified minimum and maximum values.
|
|
1170
1171
|
*
|
|
1171
1172
|
* @param {number} pMinimum - The minimum value (inclusive).
|
|
@@ -1225,18 +1226,18 @@ if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1)
|
|
|
1225
1226
|
* Date management a la Moment using days.js
|
|
1226
1227
|
*
|
|
1227
1228
|
* @class DateManipulation
|
|
1228
|
-
*/var DateManipulation=/*#__PURE__*/function(_libFableServiceProvi8){function DateManipulation(pFable,pOptions,pServiceHash){var
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1229
|
+
*/var DateManipulation=/*#__PURE__*/function(_libFableServiceProvi8){function DateManipulation(pFable,pOptions,pServiceHash){var _this18;_classCallCheck2(this,DateManipulation);_this18=_callSuper(this,DateManipulation,[pFable,pOptions,pServiceHash]);_this18.serviceType='Dates';_this18.dayJS=require('dayjs');// Include the `weekOfYear` plugin
|
|
1230
|
+
_this18.plugin_weekOfYear=require('dayjs/plugin/weekOfYear');_this18.dayJS.extend(_this18.plugin_weekOfYear);// Include the `weekday` plugin
|
|
1231
|
+
_this18.plugin_weekday=require('dayjs/plugin/weekday');_this18.dayJS.extend(_this18.plugin_weekday);// Include the `isoWeek` plugin
|
|
1232
|
+
_this18.plugin_isoWeek=require('dayjs/plugin/isoWeek');_this18.dayJS.extend(_this18.plugin_isoWeek);// Include the `timezone` plugin
|
|
1233
|
+
_this18.plugin_timezone=require('dayjs/plugin/timezone');_this18.dayJS.extend(_this18.plugin_timezone);// Include the `relativetime` plugin
|
|
1234
|
+
_this18.plugin_relativetime=require('dayjs/plugin/relativeTime');_this18.dayJS.extend(_this18.plugin_relativetime);// Include the `utc` plugin
|
|
1235
|
+
_this18.plugin_utc=require('dayjs/plugin/utc');_this18.dayJS.extend(_this18.plugin_utc);// Include the `advancedFormat` plugin
|
|
1236
|
+
_this18.plugin_advancedFormat=require('dayjs/plugin/advancedFormat');_this18.dayJS.extend(_this18.plugin_advancedFormat);// A developer can include locales if they want
|
|
1236
1237
|
// You would do the following:
|
|
1237
1238
|
// const localeDE = require('dayjs/locale/de');
|
|
1238
1239
|
// _Fable.Dates.dayJS.locale('de');
|
|
1239
|
-
return
|
|
1240
|
+
return _this18;}/**
|
|
1240
1241
|
* Calculates the difference in days between two dates.
|
|
1241
1242
|
*
|
|
1242
1243
|
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
@@ -1272,7 +1273,7 @@ return tmpEndDate.diff(tmpStartDate,'month');}/**
|
|
|
1272
1273
|
*/},{key:"dateYearDifference",value:function dateYearDifference(pDateStart,pDateEnd){// If there is not a valid start date, return NaN
|
|
1273
1274
|
if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}var tmpStartDate=this.dayJS(pDateStart);// Without a valid end date, dayJS defaults to the current date
|
|
1274
1275
|
var tmpEndDate=this.dayJS(pDateEnd);// Returns the difference in years between two dates
|
|
1275
|
-
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
|
|
1276
|
+
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 ...
|
|
1276
1277
|
*
|
|
1277
1278
|
* This service is a simple expression parser that can handle math expressions, with magic(tm) lookup of addresses with a manifest.
|
|
1278
1279
|
*
|
|
@@ -1299,17 +1300,17 @@ return tmpEndDate.diff(tmpStartDate,'year');}}]);}(libFableServiceProviderBase);
|
|
|
1299
1300
|
* @param {Object} pFable - The Fable object.
|
|
1300
1301
|
* @param {Object} pOptions - The options for the service.
|
|
1301
1302
|
* @param {string} pServiceHash - The hash of the service.
|
|
1302
|
-
*/function FableServiceExpressionParser(pFable,pOptions,pServiceHash){var
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1303
|
+
*/function FableServiceExpressionParser(pFable,pOptions,pServiceHash){var _this20;_classCallCheck2(this,FableServiceExpressionParser);_this20=_callSuper(this,FableServiceExpressionParser,[pFable,pOptions,pServiceHash]);// The configuration for tokens that the solver recognizes, with precedence and friendly names.
|
|
1304
|
+
_this20.tokenMap=require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json');// Keep track of maximum token precedence
|
|
1305
|
+
_this20.tokenMaxPrecedence=4;// This isn't exactly a radix tree but close enough. It's a map of the first character of the token to the token.
|
|
1306
|
+
_this20.tokenRadix={};var tmpTokenKeys=Object.keys(_this20.tokenMap);for(var i=0;i<tmpTokenKeys.length;i++){var tmpTokenKey=tmpTokenKeys[i];var tmpToken=_this20.tokenMap[tmpTokenKey];tmpToken.Token=tmpTokenKey;tmpToken.Length=tmpTokenKey.length;var tmpTokenStartCharacter=tmpToken.Token[0];if(!(tmpTokenStartCharacter in _this20.tokenRadix)){// With a token count of 1 and a literal of true, we can assume it being in the radix is the token.
|
|
1307
|
+
_this20.tokenRadix[tmpTokenStartCharacter]={TokenCount:0,Literal:false,TokenKeys:[],TokenMap:{}};}_this20.tokenRadix[tmpTokenStartCharacter].TokenCount++;if(tmpTokenKey==tmpTokenStartCharacter){_this20.tokenRadix[tmpTokenStartCharacter].Literal=true;}_this20.tokenRadix[tmpTokenStartCharacter].TokenMap[tmpToken.Token]=tmpToken;_this20.tokenRadix[tmpTokenStartCharacter].TokenKeys.push(tmpTokenKey);_this20.tokenRadix[tmpTokenStartCharacter].TokenKeys.sort(function(pLeft,pRight){return pRight.length-pLeft.length;});if(_this20.tokenMaxPrecedence<tmpToken.Precedence){_this20.tokenMaxPrecedence=tmpToken.Precedence;}}// The configuration for which functions are available to the solver.
|
|
1308
|
+
_this20.functionMap=require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json');_this20.serviceType='ExpressionParser';// These are sub-services for the tokenizer, linter, compiler, marshaler and solver.
|
|
1309
|
+
_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Tokenizer',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Linter',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Postfix',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-ValueMarshal',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js'));_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Solver',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js'));// And the sub-service for the friendly user messaging
|
|
1310
|
+
_this20.fable.addServiceTypeIfNotExists('ExpressionParser-Messaging',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Messaging.js'));// This code instantitates these fable services to child objects of this service, but does not pollute the main fable with them.
|
|
1311
|
+
_this20.Tokenizer=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Tokenizer');_this20.Linter=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Linter');_this20.Postfix=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Postfix');_this20.ValueMarshal=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-ValueMarshal');_this20.Solver=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Solver');_this20.Messaging=_this20.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Messaging');// Wire each sub service into this instance of the solver.
|
|
1312
|
+
_this20.Tokenizer.connectExpressionParser(_this20);_this20.Linter.connectExpressionParser(_this20);_this20.Postfix.connectExpressionParser(_this20);_this20.ValueMarshal.connectExpressionParser(_this20);_this20.Solver.connectExpressionParser(_this20);_this20.Messaging.connectExpressionParser(_this20);_this20.GenericManifest=_this20.fable.newManyfest();// This will look for a LogNoisiness on fable (or one that falls in from pict) and if it doesn't exist, set one for this service.
|
|
1313
|
+
_this20.LogNoisiness='LogNoisiness'in _this20.fable?_this20.fable.LogNoisiness:0;return _this20;}/**
|
|
1313
1314
|
* Tokenizes the given mathematical expression string.
|
|
1314
1315
|
*
|
|
1315
1316
|
* @param {string} pExpression - The expression to tokenize.
|
|
@@ -1357,10 +1358,10 @@ _this18.LogNoisiness='LogNoisiness'in _this18.fable?_this18.fable.LogNoisiness:0
|
|
|
1357
1358
|
*/},{key:"solve",value:function solve(pExpression,pDataSourceObject,pResultObject,pManifest,pDataDestinationObject){var tmpResultsObject=_typeof(pResultObject)==='object'?pResultObject:{};var tmpDataSourceObject=_typeof(pDataSourceObject)==='object'?pDataSourceObject:{};var tmpDataDestinationObject=_typeof(pDataDestinationObject)==='object'?pDataDestinationObject:{};// This is technically a "pre-compile" and we can keep this Results Object around to reuse for better performance. Not required.
|
|
1358
1359
|
this.tokenize(pExpression,tmpResultsObject);this.lintTokenizedExpression(tmpResultsObject.RawTokens,tmpResultsObject);this.buildPostfixedSolveList(tmpResultsObject.RawTokens,tmpResultsObject);// This is where the data from variables gets marshaled into their symbols (from AppData or the like)
|
|
1359
1360
|
this.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects,tmpDataSourceObject,tmpResultsObject,pManifest);// Finally this is the expr solving method, which returns a string and also marshals it into tmpDataDestinationObject
|
|
1360
|
-
return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}]);}(libFableServiceBase);module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":78,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json":79,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js":80,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Messaging.js":81,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js":82,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js":83,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json":84,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js":85,"big.js":17,"fable-serviceproviderbase":59}],77:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');var ExpressionParserOperationBase=/*#__PURE__*/function(_libFableServiceProvi9){function ExpressionParserOperationBase(pFable,pOptions,pServiceHash){var
|
|
1361
|
+
return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}]);}(libFableServiceBase);module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":78,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json":79,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js":80,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Messaging.js":81,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js":82,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js":83,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json":84,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js":85,"big.js":17,"fable-serviceproviderbase":59}],77:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');var ExpressionParserOperationBase=/*#__PURE__*/function(_libFableServiceProvi9){function ExpressionParserOperationBase(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,ExpressionParserOperationBase);_this21=_callSuper(this,ExpressionParserOperationBase,[pFable,pOptions,pServiceHash]);_this21.serviceType='ExpressionParserOperationBase';_this21.numberTest=/^-{0,1}\d*\.{0,1}\d+$/;_this21.ExpressionParser=false;return _this21;}_inherits(ExpressionParserOperationBase,_libFableServiceProvi9);return _createClass2(ExpressionParserOperationBase,[{key:"connectExpressionParser",value:function connectExpressionParser(pExpressionParser){this.ExpressionParser=pExpressionParser;}},{key:"getTokenType",value:function getTokenType(pToken){if(pToken in this.ExpressionParser.tokenMap){return"Token.".concat(this.ExpressionParser.tokenMap[pToken].Type);}else if(pToken.length>2&&pToken[0]==='{'&&pToken[pToken.length-1]==='}'){return'Token.StateAddress';}else if(pToken.length>2&&pToken[0]==='"'&&pToken[pToken.length-1]==='"'){return'Token.String';}else if(this.numberTest.test(pToken)){return'Token.Constant';}else{return'Token.Symbol';}// Just for documentation sake:
|
|
1361
1362
|
// There is a fifth token type, VirtualSymbol
|
|
1362
1363
|
// This is a value that's added during solve and looked up by address in the VirtualSymbol object.
|
|
1363
|
-
}},{key:"getTokenContainerObject",value:function getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:pToken in this.ExpressionParser.tokenMap?this.ExpressionParser.tokenMap[pToken]:false};}}]);}(libFableServiceProviderBase);module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":59}],78:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionTokenizer=/*#__PURE__*/function(_libExpressionParserO){function ExpressionTokenizer(pFable,pOptions,pServiceHash){var
|
|
1364
|
+
}},{key:"getTokenContainerObject",value:function getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:pToken in this.ExpressionParser.tokenMap?this.ExpressionParser.tokenMap[pToken]:false};}}]);}(libFableServiceProviderBase);module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":59}],78:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionTokenizer=/*#__PURE__*/function(_libExpressionParserO){function ExpressionTokenizer(pFable,pOptions,pServiceHash){var _this22;_classCallCheck2(this,ExpressionTokenizer);_this22=_callSuper(this,ExpressionTokenizer,[pFable,pOptions,pServiceHash]);_this22.serviceType='ExpressionParser-Tokenizer';return _this22;}_inherits(ExpressionTokenizer,_libExpressionParserO);return _createClass2(ExpressionTokenizer,[{key:"tokenize",value:function tokenize(pExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.RawExpression=pExpression;tmpResults.RawTokens=[];tmpResults.ExpressionParserLog=[];if(typeof pExpression!=='string'){this.log.warn('ExpressionParser.tokenize was passed a non-string expression.');return tmpResults.RawTokens;}/* Tokenize the expression
|
|
1364
1365
|
*
|
|
1365
1366
|
* Current token types:
|
|
1366
1367
|
* - Value
|
|
@@ -1413,7 +1414,7 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
1413
1414
|
// }
|
|
1414
1415
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
1415
1416
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
1416
|
-
}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"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"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"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"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"},"countset":{"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"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"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"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal"},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal"},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"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"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"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"},"createValueObjectByHashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes"}};},{}],80:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserLinter=/*#__PURE__*/function(_libExpressionParserO2){function ExpressionParserLinter(pFable,pOptions,pServiceHash){var
|
|
1417
|
+
}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"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"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"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"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"},"countset":{"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"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"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"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal"},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal"},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"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"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"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"},"createValueObjectByHashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes"}};},{}],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
|
|
1417
1418
|
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
|
|
1418
1419
|
var tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
1419
1420
|
// State addresses are between squiggly brackets
|
|
@@ -1436,11 +1437,11 @@ if(pTokenizedExpression[_i6]!=='+'&&pTokenizedExpression[_i6]!=='-'){tmpResults.
|
|
|
1436
1437
|
* Represents a user-friendly messaging service for the ExpressionParser compiler output.
|
|
1437
1438
|
* @class ExpressionParserMessaging
|
|
1438
1439
|
* @extends libExpressionParserOperationBase
|
|
1439
|
-
*/var ExpressionParserMessaging=/*#__PURE__*/function(_libExpressionParserO3){function ExpressionParserMessaging(pFable,pOptions,pServiceHash){var
|
|
1440
|
+
*/var ExpressionParserMessaging=/*#__PURE__*/function(_libExpressionParserO3){function ExpressionParserMessaging(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,ExpressionParserMessaging);_this24=_callSuper(this,ExpressionParserMessaging,[pFable,pOptions,pServiceHash]);_this24.serviceType='ExpressionParser-Messaging';return _this24;}_inherits(ExpressionParserMessaging,_libExpressionParserO3);return _createClass2(ExpressionParserMessaging,[{key:"getOperationVirtualSymbolName",value:function getOperationVirtualSymbolName(pOperationToken){return pOperationToken&&'VirtualSymbolName'in pOperationToken?pOperationToken.VirtualSymbolName:pOperationToken.Type==='Token.VirtualSymbol'?pOperationToken.Token:'NO_VIRTUAL_SYMBOL_NAME_FOUND';}},{key:"getVirtualTokenValue",value:function getVirtualTokenValue(pToken,pOperationResults){var tmpVirtualSymbol=this.getOperationVirtualSymbolName(pToken);if((pToken.Type=='Token.Symbol'||pToken.Type=='Token.Constant')&&pToken.Value){return pToken.Value.toString();}var tmpVirtualSymbolData='VirtualSymbols'in pOperationResults?pOperationResults.VirtualSymbols:{};if(this.ExpressionParser.GenericManifest.checkAddressExists(tmpVirtualSymbolData,tmpVirtualSymbol)){var tmpValue=this.ExpressionParser.GenericManifest.getValueAtAddress(tmpVirtualSymbolData,tmpVirtualSymbol);if(_typeof(tmpValue)==='object'){return"{".concat(Object.keys(tmpValue).length," values}");}if(Array.isArray(tmpValue)){return"[".concat(Object.keys(tmpValue).length," values]");}return tmpValue;}return'NO_VALUE_FOUND';}},{key:"getTokenAddressString",value:function getTokenAddressString(pToken){return pExpression.Token;}},{key:"getTokenSymbolString",value:function getTokenSymbolString(pExpressionToken){return pExpressionToken.Token;}},{key:"getOperationSymbolMessage",value:function getOperationSymbolMessage(pOperation){if(!pOperation){return'INVALID_OPERATION';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pOperation);var tmpOperationLeftValue=this.getTokenSymbolString(pOperation.LeftValue);var tmpOperationSymbol=this.getTokenSymbolString(pOperation.Operation);var tmpOperationRightValue=this.getTokenSymbolString(pOperation.RightValue);var tmpVirtualSymbolPrefix=tmpOperationVirtualSymbol.substring(0,3);if(tmpOperationSymbol==='='){// Assignment operators are special
|
|
1440
1441
|
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue);}if(tmpVirtualSymbolPrefix==='VFE'){// Virtual Function Expression
|
|
1441
1442
|
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(tmpOperationLeftValue,")");}return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue," ").concat(tmpOperationSymbol," ").concat(tmpOperationRightValue);}},{key:"getOperationValueMessage",value:function getOperationValueMessage(pOperation,pResultObject){if(!pOperation){return'INVALID_OPERATION';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pOperation);var tmpOperationLeftValue=this.getVirtualTokenValue(pOperation.LeftValue,pResultObject);var tmpOperationSymbol=this.getTokenSymbolString(pOperation.Operation);var tmpOperationRightValue=this.getVirtualTokenValue(pOperation.RightValue,pResultObject);var tmpVirtualSymbolPrefix=tmpOperationVirtualSymbol.substring(0,3);if(tmpOperationSymbol==='='){// Assignment operators are special
|
|
1442
1443
|
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue);}if(tmpVirtualSymbolPrefix==='VFE'){// Virtual Function Expression
|
|
1443
|
-
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(tmpOperationLeftValue,")");}return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue," ").concat(tmpOperationSymbol," ").concat(tmpOperationRightValue);}},{key:"getOperationOutcomeMessage",value:function getOperationOutcomeMessage(pToken,pOperationResults){if(!pToken){return'INVALID_TOKEN';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pToken);var tmpOperationOutcomeValue=this.getVirtualTokenValue(pToken,pOperationResults);return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationOutcomeValue);}},{key:"logFunctionOutcome",value:function logFunctionOutcome(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log outcome.");return;}var tmpAssignmentAddress='PostfixedAssignmentAddress'in pResultObject?pResultObject.PostfixedAssignmentAddress:'NO_ASSIGNMENT_ADDRESS_FOUND';var tmpRawExpression='RawExpression'in pResultObject?pResultObject.RawExpression:'NO_EXPRESSION_FOUND';var tmpRawResult='RawResult'in pResultObject?pResultObject.RawResult:'NO_RESULT_FOUND';this.log.info("Solved f(".concat(tmpAssignmentAddress,") = {").concat(tmpRawExpression,"}"));for(var i=0;i<pResultObject.PostfixSolveList.length;i++){var tmpToken=pResultObject.PostfixSolveList[i];var tmpTokenSymbolMessage=this.getOperationSymbolMessage(tmpToken);this.log.info("".concat(i," Symbols: ").concat(tmpTokenSymbolMessage));var tmpTokenValueMessage=this.getOperationValueMessage(tmpToken,pResultObject);this.log.info("".concat(i," Values: ").concat(tmpTokenValueMessage));var tmpTokenOutcome=this.getOperationOutcomeMessage(tmpToken,pResultObject);this.log.info("".concat(i," Outcome: ").concat(tmpTokenOutcome));}this.log.info("{".concat(tmpRawExpression,"} = ").concat(tmpRawResult));}},{key:"logFunctionSolve",value:function logFunctionSolve(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log the solve.");return;}if(!('PostfixSolveList'in pResultObject)||!Array.isArray(pResultObject.PostfixSolveList)){this.log.error("Solver results object did not contain a PostfixSolveList array. Cannot log the solve.");return;}for(var i=0;i<pResultObject.PostfixSolveList.length;i++){var tmpToken=pResultObject.PostfixSolveList[i];console.log("".concat(i,": ").concat(tmpToken.VirtualSymbolName," = (").concat(tmpToken.LeftValue.Token,"::").concat(tmpToken.LeftValue.Value,") ").concat(tmpToken.Operation.Token," (").concat(tmpToken.RightValue.Token,"::").concat(tmpToken.RightValue.Value,") "));}this.logFunctionOutcome(pResultObject);}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserMessaging;},{"./Fable-Service-ExpressionParser-Base.js":77,"big.js":17}],82:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserPostfix=/*#__PURE__*/function(_libExpressionParserO4){function ExpressionParserPostfix(pFable,pOptions,pServiceHash){var
|
|
1444
|
+
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(tmpOperationLeftValue,")");}return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue," ").concat(tmpOperationSymbol," ").concat(tmpOperationRightValue);}},{key:"getOperationOutcomeMessage",value:function getOperationOutcomeMessage(pToken,pOperationResults){if(!pToken){return'INVALID_TOKEN';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pToken);var tmpOperationOutcomeValue=this.getVirtualTokenValue(pToken,pOperationResults);return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationOutcomeValue);}},{key:"logFunctionOutcome",value:function logFunctionOutcome(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log outcome.");return;}var tmpAssignmentAddress='PostfixedAssignmentAddress'in pResultObject?pResultObject.PostfixedAssignmentAddress:'NO_ASSIGNMENT_ADDRESS_FOUND';var tmpRawExpression='RawExpression'in pResultObject?pResultObject.RawExpression:'NO_EXPRESSION_FOUND';var tmpRawResult='RawResult'in pResultObject?pResultObject.RawResult:'NO_RESULT_FOUND';this.log.info("Solved f(".concat(tmpAssignmentAddress,") = {").concat(tmpRawExpression,"}"));for(var i=0;i<pResultObject.PostfixSolveList.length;i++){var tmpToken=pResultObject.PostfixSolveList[i];var tmpTokenSymbolMessage=this.getOperationSymbolMessage(tmpToken);this.log.info("".concat(i," Symbols: ").concat(tmpTokenSymbolMessage));var tmpTokenValueMessage=this.getOperationValueMessage(tmpToken,pResultObject);this.log.info("".concat(i," Values: ").concat(tmpTokenValueMessage));var tmpTokenOutcome=this.getOperationOutcomeMessage(tmpToken,pResultObject);this.log.info("".concat(i," Outcome: ").concat(tmpTokenOutcome));}this.log.info("{".concat(tmpRawExpression,"} = ").concat(tmpRawResult));}},{key:"logFunctionSolve",value:function logFunctionSolve(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log the solve.");return;}if(!('PostfixSolveList'in pResultObject)||!Array.isArray(pResultObject.PostfixSolveList)){this.log.error("Solver results object did not contain a PostfixSolveList array. Cannot log the solve.");return;}for(var i=0;i<pResultObject.PostfixSolveList.length;i++){var tmpToken=pResultObject.PostfixSolveList[i];console.log("".concat(i,": ").concat(tmpToken.VirtualSymbolName," = (").concat(tmpToken.LeftValue.Token,"::").concat(tmpToken.LeftValue.Value,") ").concat(tmpToken.Operation.Token," (").concat(tmpToken.RightValue.Token,"::").concat(tmpToken.RightValue.Value,") "));}this.logFunctionOutcome(pResultObject);}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserMessaging;},{"./Fable-Service-ExpressionParser-Base.js":77,"big.js":17}],82:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserPostfix=/*#__PURE__*/function(_libExpressionParserO4){function ExpressionParserPostfix(pFable,pOptions,pServiceHash){var _this25;_classCallCheck2(this,ExpressionParserPostfix);_this25=_callSuper(this,ExpressionParserPostfix,[pFable,pOptions,pServiceHash]);_this25.serviceType='ExpressionParser-Postfix';return _this25;}_inherits(ExpressionParserPostfix,_libExpressionParserO4);return _createClass2(ExpressionParserPostfix,[{key:"getPosfixSolveListOperation",value:function getPosfixSolveListOperation(pOperation,pLeftValue,pRightValue,pDepthSolveList,pDepthSolveIndex){var tmpOperation={VirtualSymbolName:pOperation.VirtualSymbolName,Operation:pOperation,LeftValue:pLeftValue,RightValue:pRightValue};var tmpDepthSolveList=Array.isArray(pDepthSolveList)?pDepthSolveList:false;/* These two if blocks are very complex -- they basically provide a
|
|
1444
1445
|
* way to deal with recursion that can be expressed to the user in
|
|
1445
1446
|
* a meaningful way.
|
|
1446
1447
|
*
|
|
@@ -1492,63 +1493,63 @@ tmpResults.PostfixLayerstackMap={};//FIXME: vet these - do we need a suffix vers
|
|
|
1492
1493
|
var unaryEligibleOperationTokens=['+','-'];var unaryOperationPrefixTriggerTypes=['Token.Operator','Token.Assignment'];for(var tmpSolveLayerIndex=0;tmpSolveLayerIndex<tmpSolveLayerKeys.length;tmpSolveLayerIndex++){var tmpSolveLayerTokens=tmpSolveLayerMap[tmpSolveLayerKeys[tmpSolveLayerIndex]];// For each precedence (this isn't strictly required here but makes the outcome for the user more readable)
|
|
1493
1494
|
for(var tmpPrecedence=0;tmpPrecedence<=this.ExpressionParser.tokenMaxPrecedence;tmpPrecedence++){// Enumerate all tokens in a layer's expression.
|
|
1494
1495
|
// There is a recursive way to do this, but given the short length of even the most complex equations we're favoring readability.
|
|
1495
|
-
for(var
|
|
1496
|
+
for(var _i10=0;_i10<tmpSolveLayerTokens.length;_i10++){var tmpToken=tmpSolveLayerTokens[_i10];if(unaryEligibleOperationTokens.includes(tmpToken.Token)&&(// promote to unary if:
|
|
1496
1497
|
// 1. we are the first token in our group
|
|
1497
1498
|
// 2. we are prefixed by a token type that is incompatible with us being binary
|
|
1498
|
-
|
|
1499
|
+
_i10==0||unaryOperationPrefixTriggerTypes.includes(tmpSolveLayerTokens[_i10-1].Type))){//FIXME: slow, but don't break the static data
|
|
1499
1500
|
tmpToken.Descriptor=JSON.parse(JSON.stringify(tmpToken.Descriptor));tmpToken.Descriptor.Precedence=1;}//FIXME: handle operators with dynamic precedence (ex. unary vs. bunary + and -)
|
|
1500
1501
|
// If the token is an operator and at the current precedence, add it to the postfix solve list and mutate the array.
|
|
1501
|
-
if(tmpSolveLayerTokens[
|
|
1502
|
-
if(tmpSolveLayerTokens.length===1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.buildPostfixedSolveList found a single operator in a solve layer expression at token index ".concat(
|
|
1503
|
-
else if(
|
|
1504
|
-
else if(
|
|
1505
|
-
else if(
|
|
1506
|
-
else if(
|
|
1502
|
+
if(tmpSolveLayerTokens[_i10].Type==='Token.Operator'&&tmpToken.Descriptor.Precedence===tmpPrecedence){// If there is a token and nothing else in this layer, then it's an error.
|
|
1503
|
+
if(tmpSolveLayerTokens.length===1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.buildPostfixedSolveList found a single operator in a solve layer expression at token index ".concat(_i10));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return tmpResults.PostfixSolveList;}// The - at the beginning of an expression is a number line orientation modifier
|
|
1504
|
+
else if(_i10==0&&(tmpToken.Token=='-'||tmpToken.Token=='+')){tmpToken.VirtualSymbolName="VNLO_".concat(tmpVirtualSymbolIndex);tmpResults.PostfixLayerstackMap[tmpToken.SolveLayerStack]=tmpToken.VirtualSymbolName;tmpVirtualSymbolIndex++;}// If the token is at the beginning of the expression and not a number line orientation modifier, it's an error.
|
|
1505
|
+
else if(_i10==0&&(tmpToken.Token!='+'||tmpToken.Token!='-')){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.buildPostfixedSolveList found an operator at the beginning of a solve layer expression at token index ".concat(_i10));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return tmpResults.PostfixSolveList;}// If the token is at the end of the expression, it is an error.
|
|
1506
|
+
else if(_i10==tmpSolveLayerTokens.length-1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.buildPostfixedSolveList found an operator at the end of a solve layer expression at token index ".concat(_i10));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return tmpResults.PostfixSolveList;}// The - after an operator or an open parenthesis is also a number line orientation modifier
|
|
1507
|
+
else if(_i10>0&&tmpToken.Token=='-'&&(tmpSolveLayerTokens[_i10-1].Type==='Token.Operator'||tmpSolveLayerTokens[_i10-1].Token==='(')){// The number line negation operator is a special case that generates a virtual constant (-1.0) and multiplies it by the next token
|
|
1507
1508
|
tmpToken.VirtualSymbolName="VNLO_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}// The + at the beginning is also a number line orientation modifier ... THAT WE IGNORE
|
|
1508
|
-
else if(
|
|
1509
|
-
else if(
|
|
1510
|
-
else if((tmpSolveLayerTokens[
|
|
1511
|
-
else{tmpToken.VirtualSymbolName="V_".concat(tmpVirtualSymbolIndex);tmpResults.PostfixLayerstackMap[tmpToken.SolveLayerStack]=tmpToken.VirtualSymbolName;tmpVirtualSymbolIndex++;}}else if(tmpSolveLayerTokens[
|
|
1509
|
+
else if(_i10==0&&tmpToken.Token=='+'){continue;}// The + after an operator or a parenthesis is also a number line orientation modifier ... THAT WE IGNORE
|
|
1510
|
+
else if(_i10>0&&tmpToken.Token=='+'&&(tmpSolveLayerTokens[_i10-1].Type==='Token.Operator'||tmpSolveLayerTokens[_i10-1].Token==='(')){continue;}// If the token is next to another operator it's a parsing error
|
|
1511
|
+
else if((tmpSolveLayerTokens[_i10-1].Type==='Token.Operator'||tmpSolveLayerTokens[_i10+1].Type==='Token.Operator')&&tmpSolveLayerTokens[_i10+1].Token!='-'&&tmpSolveLayerTokens[_i10+1].Token!='+'){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.buildPostfixedSolveList found an operator at token index ".concat(_i10," that is not surrounded by two values."));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return tmpResults.PostfixSolveList;}// Finally add a virtual symbol name to the dang thing.
|
|
1512
|
+
else{tmpToken.VirtualSymbolName="V_".concat(tmpVirtualSymbolIndex);tmpResults.PostfixLayerstackMap[tmpToken.SolveLayerStack]=tmpToken.VirtualSymbolName;tmpVirtualSymbolIndex++;}}else if(tmpSolveLayerTokens[_i10].Type==='Token.Function'&&tmpPrecedence===0){var _tmpToken=tmpSolveLayerTokens[_i10];_tmpToken.VirtualSymbolName="VFE_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;tmpResults.PostfixLayerstackMap[_tmpToken.SolveLayerStack]=_tmpToken.VirtualSymbolName;}}}}// 5.15 Generate Virtual Symbol Clusters for Functions and Parenthesis
|
|
1512
1513
|
// ... this gets funny because of precedence of operations surrounding them, parenthesis and functions.
|
|
1513
|
-
var tmpFunctionCacheLIFOStack=[];for(var
|
|
1514
|
+
var tmpFunctionCacheLIFOStack=[];for(var _i11=0;_i11<tmpResults.PostfixTokenObjects.length;_i11++){var tmpPostfixTokenObject=tmpResults.PostfixTokenObjects[_i11];if(tmpPostfixTokenObject.Type==='Token.Parenthesis'){// This is just to track the parenthesis stack level for User feedback
|
|
1514
1515
|
tmpPostfixTokenObject.ParenthesisStack=tmpPostfixTokenObject.VirtualSymbolName;// At the beginning of the expression, this must be an open parenthesis to be legal.
|
|
1515
|
-
if(
|
|
1516
|
+
if(_i11==0){tmpPostfixTokenObject.IsFunction=false;var tmpVirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];if(!tmpVirtualSymbolName){// ... this parenthesis group has no operators in it; make a virtual symbol name.
|
|
1516
1517
|
tmpVirtualSymbolName="VP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=tmpVirtualSymbolName;tmpFunctionCacheLIFOStack.push(tmpPostfixTokenObject);}// If it's an open parenthesis
|
|
1517
1518
|
else if(tmpPostfixTokenObject.Token==='('){// ... supporting a function
|
|
1518
|
-
if(tmpResults.PostfixTokenObjects[
|
|
1519
|
+
if(tmpResults.PostfixTokenObjects[_i11-1].Type==='Token.Function'){tmpPostfixTokenObject.IsFunction=true;tmpPostfixTokenObject.Function=tmpResults.PostfixTokenObjects[_i11-1];var _tmpVirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];if(!_tmpVirtualSymbolName){// ... this parenthesis group has no operators in it; make a virtual symbol name.
|
|
1519
1520
|
_tmpVirtualSymbolName="VFP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=_tmpVirtualSymbolName;}else{tmpPostfixTokenObject.IsFunction=false;var _tmpVirtualSymbolName2=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];if(!_tmpVirtualSymbolName2){// This is a parenthesis group with no operators in it; make a virtual symbol name.
|
|
1520
1521
|
_tmpVirtualSymbolName2="VP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=_tmpVirtualSymbolName2;}tmpFunctionCacheLIFOStack.push(tmpPostfixTokenObject);}else if(tmpPostfixTokenObject.Token===')'){var tmpOpenParenthesis=tmpFunctionCacheLIFOStack.pop();if(tmpOpenParenthesis.IsFunction){tmpPostfixTokenObject.IsFunction=true;tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.Function.VirtualSymbolName;}else{tmpPostfixTokenObject.IsFunction=false;tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.VirtualSymbolName;}}}}// X. Postprocess the parenthesis groups to ensure they respect the order of operations for their boundaries
|
|
1521
|
-
for(var _tmpSolveLayerIndex=0;_tmpSolveLayerIndex<tmpSolveLayerKeys.length;_tmpSolveLayerIndex++){var tmpParenthesisStack=[];var tmpLastOperator=false;var _tmpSolveLayerTokens=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex]];for(var
|
|
1522
|
+
for(var _tmpSolveLayerIndex=0;_tmpSolveLayerIndex<tmpSolveLayerKeys.length;_tmpSolveLayerIndex++){var tmpParenthesisStack=[];var tmpLastOperator=false;var _tmpSolveLayerTokens=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex]];for(var _i12=0;_i12<_tmpSolveLayerTokens.length;_i12++){var _tmpPostfixTokenObject=_tmpSolveLayerTokens[_i12];// Keep track of the last operator
|
|
1522
1523
|
if(_tmpPostfixTokenObject.Type==='Token.Operator'){tmpLastOperator=_tmpPostfixTokenObject;}// This is only important to do at the close parenthesis.
|
|
1523
1524
|
if(_tmpPostfixTokenObject.Type==='Token.Function'){_tmpPostfixTokenObject.PreviousOperator=tmpLastOperator;}else if(_tmpPostfixTokenObject.Type==='Token.Parenthesis'&&_tmpPostfixTokenObject.Token==='('&&_tmpPostfixTokenObject.IsFunction){tmpParenthesisStack.push(_tmpPostfixTokenObject);if(_tmpPostfixTokenObject.Function.PreviousOperator){_tmpPostfixTokenObject.PreviousOperator=_tmpPostfixTokenObject.Function.PreviousOperator;}}else if(_tmpPostfixTokenObject.Type==='Token.Parenthesis'&&_tmpPostfixTokenObject.Token==='('){_tmpPostfixTokenObject.PreviousOperator=tmpLastOperator;tmpParenthesisStack.push(_tmpPostfixTokenObject);}else if(_tmpPostfixTokenObject.Type==='Token.Parenthesis'&&_tmpPostfixTokenObject.Token===')'){// This is ultra complex, and binds the order of operations logic to the open parenthesis for the group
|
|
1524
|
-
var _tmpOpenParenthesis=tmpParenthesisStack.pop();if(
|
|
1525
|
+
var _tmpOpenParenthesis=tmpParenthesisStack.pop();if(_i12<_tmpSolveLayerTokens.length-1){for(var j=_i12+1;j<_tmpSolveLayerTokens.length;j++){if(_tmpSolveLayerTokens[j].Type==='Token.Operator'){_tmpOpenParenthesis.NextOperator=_tmpSolveLayerTokens[j];break;}}}if(_tmpOpenParenthesis.PreviousOperator&&_tmpOpenParenthesis.NextOperator){if(_tmpOpenParenthesis.PreviousOperator.Descriptor.Precedence<=_tmpOpenParenthesis.NextOperator.Descriptor.Precedence){_tmpOpenParenthesis.NextOperator.LeftVirtualSymbolName=_tmpOpenParenthesis.PreviousOperator.VirtualSymbolName;}else{_tmpOpenParenthesis.PreviousOperator.RightVirtualSymbolName=_tmpOpenParenthesis.NextOperator.VirtualSymbolName;}}}else{if(!('SolveLayerStack'in _tmpPostfixTokenObject)){// Decorate the solve layer stack for the token
|
|
1525
1526
|
if(tmpParenthesisStack.length>0){_tmpPostfixTokenObject.SolveLayerStack=tmpParenthesisStack[tmpParenthesisStack.length-1].SolveLayerStack;}else{_tmpPostfixTokenObject.SolveLayerStack='Expression_Root';}}}}}// 5.2.9: Make sure the affinity of operators is respecting order of operations.
|
|
1526
1527
|
// Walk backwards and forwards, hoisting same value precedence backwards/forwards
|
|
1527
1528
|
// across each layer... the precedence change needs to be decreasing to matter
|
|
1528
|
-
for(var _tmpSolveLayerIndex2=0;_tmpSolveLayerIndex2<tmpSolveLayerKeys.length;_tmpSolveLayerIndex2++){var tmpLastPrecedence=false;var tmpFinalChainToken=false;var _tmpSolveLayerTokens2=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex2]];for(var
|
|
1529
|
+
for(var _tmpSolveLayerIndex2=0;_tmpSolveLayerIndex2<tmpSolveLayerKeys.length;_tmpSolveLayerIndex2++){var tmpLastPrecedence=false;var tmpFinalChainToken=false;var _tmpSolveLayerTokens2=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex2]];for(var _i13=_tmpSolveLayerTokens2.length-1;_i13>=0;_i13--){var _tmpToken2=_tmpSolveLayerTokens2[_i13];if(_tmpToken2.Type==='Token.Operator'){if(!tmpFinalChainToken){tmpFinalChainToken=_tmpToken2;}else if(_tmpToken2.Descriptor.Precedence>tmpLastPrecedence){// This is less imporant than the last precedence, so hoist back the virtual value
|
|
1529
1530
|
_tmpToken2.RightVirtualSymbolName=tmpFinalChainToken.VirtualSymbolName;//console.log(`Hoisting ${tmpToken.Token} back to ${tmpFinalChainToken.Token}`);
|
|
1530
|
-
tmpFinalChainToken=_tmpToken2;}else if(_tmpToken2.Descriptor.Precedence<tmpLastPrecedence){tmpFinalChainToken=_tmpToken2;}tmpLastPrecedence=_tmpToken2.Descriptor.Precedence;}}var tmpDecreasingPrecedenceStack=[];var tmpLastToken=false;for(var
|
|
1531
|
+
tmpFinalChainToken=_tmpToken2;}else if(_tmpToken2.Descriptor.Precedence<tmpLastPrecedence){tmpFinalChainToken=_tmpToken2;}tmpLastPrecedence=_tmpToken2.Descriptor.Precedence;}}var tmpDecreasingPrecedenceStack=[];var tmpLastToken=false;for(var _i14=_tmpSolveLayerTokens2.length-1;_i14>=0;_i14--){var _tmpToken3=_tmpSolveLayerTokens2[_i14];if(_tmpToken3.Type==='Token.Operator'){if(!tmpLastToken){tmpLastToken=_tmpToken3;}else if(_tmpToken3.Descriptor.Precedence>tmpLastPrecedence){// Check and see if this needs to be resolved in the stack
|
|
1531
1532
|
if(tmpDecreasingPrecedenceStack.length>0){for(var _j=tmpDecreasingPrecedenceStack.length-1;_j>=0;_j--){if(tmpDecreasingPrecedenceStack[_j].Descriptor.Precedence>=_tmpToken3.Descriptor.Precedence){//console.log(`Hoisting ${tmpDecreasingPrecedenceStack[j].Token} up to ${tmpToken.Token}`);
|
|
1532
1533
|
tmpDecreasingPrecedenceStack[_j].LeftVirtualSymbolName=_tmpToken3.VirtualSymbolName;tmpDecreasingPrecedenceStack.slice(_j,1);break;}}}tmpLastToken=_tmpToken3;}else if(_tmpToken3.Descriptor.Precedence<tmpLastPrecedence){tmpDecreasingPrecedenceStack.push(tmpLastToken);tmpLastToken=_tmpToken3;}tmpLastPrecedence=_tmpToken3.Descriptor.Precedence;}}}// 5.3: Generate the Postfix Solve List
|
|
1533
1534
|
for(var _tmpSolveLayerIndex3=0;_tmpSolveLayerIndex3<tmpSolveLayerKeys.length;_tmpSolveLayerIndex3++){var _tmpSolveLayerTokens3=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex3]];// If this is a layer with one value, presume it's an assignment.
|
|
1534
1535
|
if(_tmpSolveLayerTokens3.length===1){// TODO: I think this is correct but with the addition of multiple assignment operators it's less clear.
|
|
1535
1536
|
var _tmpAbstractAssignToken=this.getTokenContainerObject('=');_tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixLayerstackMap[_tmpSolveLayerTokens3[0].SolveLayerStack];// If this doesn't have a matching solvelayerstack, get the virtual symbol name from the parenthesis group it's in
|
|
1536
|
-
if(!_tmpAbstractAssignToken.VirtualSymbolName){for(var
|
|
1537
|
+
if(!_tmpAbstractAssignToken.VirtualSymbolName){for(var _i15=0;_i15<tmpResults.PostfixTokenObjects.length;_i15++){if(tmpResults.PostfixTokenObjects[_i15].ParenthesisStack===_tmpSolveLayerTokens3[0].SolveLayerStack){_tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixTokenObjects[_i15].VirtualSymbolName;break;}}}tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpAbstractAssignToken,_tmpSolveLayerTokens3[0],this.getTokenContainerObject('0.0')));continue;}// For each precedence level in the layer
|
|
1537
1538
|
for(var _tmpPrecedence=0;_tmpPrecedence<=this.ExpressionParser.tokenMaxPrecedence;_tmpPrecedence++){// Enumerate all tokens in a layer's expression.
|
|
1538
1539
|
// There is a recursive way to do this, but given the short length of even the most complex equations we're favoring readability.
|
|
1539
|
-
for(var
|
|
1540
|
-
if(_tmpSolveLayerTokens3[
|
|
1541
|
-
if(
|
|
1540
|
+
for(var _i16=0;_i16<_tmpSolveLayerTokens3.length;_i16++){// If the token is an operator and at the current precedence, add it to the postfix solve list and mutate the array.
|
|
1541
|
+
if(_tmpSolveLayerTokens3[_i16].Type==='Token.Operator'&&_tmpSolveLayerTokens3[_i16].Descriptor.Precedence===_tmpPrecedence){var _tmpToken4=_tmpSolveLayerTokens3[_i16];// The - at the beginning of an expression is a number line orientation modifier
|
|
1542
|
+
if(_i16==0&&_tmpToken4.Token=='-'){// The number line negation operator is a special case that generates a virtual constant (-1.0) and multiplies it by the next token
|
|
1542
1543
|
// This is an abstract operation that isn't in the expression.
|
|
1543
|
-
var tmpAbstractMultiplyToken=this.getTokenContainerObject('*');tmpAbstractMultiplyToken.VirtualSymbolName=_tmpToken4.VirtualSymbolName;tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpAbstractMultiplyToken,this.getTokenContainerObject('-1.0'),_tmpSolveLayerTokens3[
|
|
1544
|
-
else if(
|
|
1545
|
-
var _tmpAbstractMultiplyToken=this.getTokenContainerObject('*');_tmpAbstractMultiplyToken.VirtualSymbolName=_tmpToken4.VirtualSymbolName;tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpAbstractMultiplyToken,this.getTokenContainerObject('-1.0'),_tmpSolveLayerTokens3[
|
|
1546
|
-
else if(
|
|
1547
|
-
else if(
|
|
1548
|
-
else{tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken4,_tmpSolveLayerTokens3[
|
|
1544
|
+
var tmpAbstractMultiplyToken=this.getTokenContainerObject('*');tmpAbstractMultiplyToken.VirtualSymbolName=_tmpToken4.VirtualSymbolName;tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpAbstractMultiplyToken,this.getTokenContainerObject('-1.0'),_tmpSolveLayerTokens3[_i16+1]));}// The - after an operator or an open parenthesis is also a number line orientation modifier
|
|
1545
|
+
else if(_i16>0&&_tmpToken4.Token=='-'&&(_tmpSolveLayerTokens3[_i16-1].Type==='Token.Operator'||_tmpSolveLayerTokens3[_i16-1].Token==='(')){// The number line negation operator is a special case that generates a virtual constant (-1.0) and multiplies it by the next token
|
|
1546
|
+
var _tmpAbstractMultiplyToken=this.getTokenContainerObject('*');_tmpAbstractMultiplyToken.VirtualSymbolName=_tmpToken4.VirtualSymbolName;tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpAbstractMultiplyToken,this.getTokenContainerObject('-1.0'),_tmpSolveLayerTokens3[_i16+1]));}// The + at the beginning is also a number line orientation modifier ... THAT WE IGNORE
|
|
1547
|
+
else if(_i16==0&&_tmpToken4.Token=='+'){continue;}// The + after an operator or a parenthesis is also a number line orientation modifier ... THAT WE IGNORE
|
|
1548
|
+
else if(_i16>0&&_tmpToken4.Token=='+'&&(_tmpSolveLayerTokens3[_i16-1].Type==='Token.Operator'||_tmpSolveLayerTokens3[_i16-1].Token==='(')){continue;}// Finally add the dang thing.
|
|
1549
|
+
else{tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken4,_tmpSolveLayerTokens3[_i16-1],_tmpSolveLayerTokens3[_i16+1],_tmpSolveLayerTokens3,_i16));}}else if(_tmpSolveLayerTokens3[_i16].Type==='Token.Function'&&_tmpPrecedence===0){var _tmpToken5=_tmpSolveLayerTokens3[_i16];tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(_tmpToken5,_tmpSolveLayerTokens3[_i16+1],this.getTokenContainerObject('0.0')));}}}}// 7. Lastly set the assignment address.
|
|
1549
1550
|
var tmpAbstractAssignToken='PostfixedAssignmentOperator'in tmpResults?this.getTokenContainerObject(tmpResults.PostfixedAssignmentOperator.Token):this.getTokenContainerObject('=');// The address we are assigning to
|
|
1550
1551
|
tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixedAssignmentAddress;// The address it's coming from
|
|
1551
|
-
var tmpSolveResultToken=this.getTokenContainerObject('Result','Token.LastResult');var tmpFinalAssignmentInstruction=this.getPosfixSolveListOperation(tmpAbstractAssignToken,tmpSolveResultToken,this.getTokenContainerObject('SolverMarshal','Token.SolverMarshal'));tmpResults.PostfixSolveList.push(tmpFinalAssignmentInstruction);return tmpResults.PostfixSolveList;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserPostfix;},{"./Fable-Service-ExpressionParser-Base.js":77}],83:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var libSetConcatArray=require('../Fable-SetConcatArray.js');var ExpressionParserSolver=/*#__PURE__*/function(_libExpressionParserO5){function ExpressionParserSolver(pFable,pOptions,pServiceHash){var
|
|
1552
|
+
var tmpSolveResultToken=this.getTokenContainerObject('Result','Token.LastResult');var tmpFinalAssignmentInstruction=this.getPosfixSolveListOperation(tmpAbstractAssignToken,tmpSolveResultToken,this.getTokenContainerObject('SolverMarshal','Token.SolverMarshal'));tmpResults.PostfixSolveList.push(tmpFinalAssignmentInstruction);return tmpResults.PostfixSolveList;}}]);}(libExpressionParserOperationBase);module.exports=ExpressionParserPostfix;},{"./Fable-Service-ExpressionParser-Base.js":77}],83:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var libSetConcatArray=require('../Fable-SetConcatArray.js');var ExpressionParserSolver=/*#__PURE__*/function(_libExpressionParserO5){function ExpressionParserSolver(pFable,pOptions,pServiceHash){var _this26;_classCallCheck2(this,ExpressionParserSolver);_this26=_callSuper(this,ExpressionParserSolver,[pFable,pOptions,pServiceHash]);_this26.serviceType='ExpressionParser-Solver';return _this26;}_inherits(ExpressionParserSolver,_libExpressionParserO5);return _createClass2(ExpressionParserSolver,[{key:"solvePostfixedExpression",value:function solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};var tmpManifest=_typeof(pManifest)==='object'?pManifest:this.fable.newManyfest();var tmpDataDestinationObject=_typeof(pDataDestinationObject)==='object'?pDataDestinationObject:{};// If there was a fable passed in (e.g. the results object was a service or such), we won't decorate
|
|
1552
1553
|
var tmpPassedInFable='fable'in tmpResults;if(!tmpPassedInFable){tmpResults.fable=this.fable;}if(!Array.isArray(pPostfixedExpression)){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression was passed a non-array postfixed expression.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}if(pPostfixedExpression.length<1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression was passed an empty postfixed expression.");this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// This is how the user communication magic happens.
|
|
1553
1554
|
tmpResults.VirtualSymbols={};for(var i=0;i<pPostfixedExpression.length;i++){// X = SUM(15, SUM(SIN(25), 10), (5 + 2), 3)
|
|
1554
1555
|
if(pPostfixedExpression[i].Operation.Type==='Token.SolverInstruction'){continue;}var tmpStepResultObject={ExpressionStep:pPostfixedExpression[i],ExpressionStepIndex:i,ResultsObject:tmpResults,Manifest:tmpManifest};if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.LastResult'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpResults.LastResult;}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.LastResult'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpResults.LastResult;}if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.VirtualSymbol'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.Token);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.VirtualSymbol'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.Token);}// Resolve the parenthesis to their actual values
|
|
@@ -1561,12 +1562,12 @@ var tmpIsFunction=false;if(tmpStepResultObject.ExpressionStep.Operation.Token in
|
|
|
1561
1562
|
tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName,tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)")));tmpResults.LastResult=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName);//this.log.trace(` ---> Step ${i}: ${tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]}`)
|
|
1562
1563
|
}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,": ").concat(pError));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}}// Equations don't always solve in virtual symbol order.
|
|
1563
1564
|
tmpResults.SolverFinalVirtualSymbol=tmpStepResultObject.ExpressionStep.VirtualSymbolName;}}var tmpSolverResultValue=tmpManifest.getValueAtAddress(tmpResults,"VirtualSymbols.".concat(tmpResults.SolverFinalVirtualSymbol));// Now deal with final assignment(s)
|
|
1564
|
-
for(var
|
|
1565
|
-
tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[
|
|
1566
|
-
if(pPostfixedExpression[
|
|
1567
|
-
if(this.fable.Utility.addressIsNullOrEmpty(tmpDataDestinationObject,pPostfixedExpression[
|
|
1568
|
-
tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[
|
|
1569
|
-
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-SetConcatArray.js":100,"./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":2,"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
|
|
1565
|
+
for(var _i17=0;_i17<pPostfixedExpression.length;_i17++){if(pPostfixedExpression[_i17].RightValue.Type==='Token.SolverMarshal'){// Set the result in the virtual symbols
|
|
1566
|
+
tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);// Set the value in the destination object
|
|
1567
|
+
if(pPostfixedExpression[_i17].Operation.Descriptor.OnlyEmpty){// If it is only on "empty" values, check if the value is empty before assigning
|
|
1568
|
+
if(this.fable.Utility.addressIsNullOrEmpty(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName)){tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);}}else{// Otherwise, just assign it.
|
|
1569
|
+
tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i17].VirtualSymbolName,tmpSolverResultValue);}}}tmpResults.RawResult=tmpSolverResultValue;// Clean up the fable reference if we added it to the object.
|
|
1570
|
+
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-SetConcatArray.js":100,"./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":2,"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;}/**
|
|
1570
1571
|
* Substitutes values in tokenized objects based on the provided data source and manifest.
|
|
1571
1572
|
*
|
|
1572
1573
|
* TODO: Move this to its own file in the "Fable-Service-ExpressionParser" directory.
|
|
@@ -1587,10 +1588,10 @@ if(Array.isArray(tmpValue)||_typeof(tmpValue)==='object'){tmpToken.Resolved=true
|
|
|
1587
1588
|
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}`);
|
|
1588
1589
|
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
|
|
1589
1590
|
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.
|
|
1590
|
-
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
|
|
1591
|
+
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
|
|
1591
1592
|
// return libPath.join(...pPathArray);
|
|
1592
|
-
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
|
|
1593
|
-
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var
|
|
1593
|
+
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.trace("CSV Reader received line ".concat(pRecord));};var tmpCompleteFunction=typeof fCompleteFunction==='function'?fCompleteFunction:function(){_this29.fable.log.info("CSV Read of ".concat(pFilePath," complete."));};var tmpErrorFunction=typeof fErrorFunction==='function'?fErrorFunction:function(pError){_this29.fable.log.error("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
|
|
1594
|
+
},{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
|
|
1594
1595
|
if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
|
|
1595
1596
|
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.
|
|
1596
1597
|
// Build the new base path
|
|
@@ -1598,8 +1599,8 @@ if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParamete
|
|
|
1598
1599
|
tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
1599
1600
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
1600
1601
|
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.
|
|
1601
|
-
return
|
|
1602
|
-
return
|
|
1602
|
+
return _this30.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
1603
|
+
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":149,"fable-serviceproviderbase":59,"fs":19,"path":137,"readline":19}],87:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceLogic=/*#__PURE__*/function(_libFableServiceBase6){/**
|
|
1603
1604
|
* @param {import('../Fable.js')} pFable - The fable object
|
|
1604
1605
|
* @param {Record<string, any>} [pOptions] - The options object
|
|
1605
1606
|
* @param {string} [pServiceHash] - The hash of the service
|
|
@@ -1632,9 +1633,9 @@ var tmpMathLeft=this.fable.Math.parsePrecise(pLeft,null);var tmpMathRight=this.f
|
|
|
1632
1633
|
* @description Simple functions that perform arbitrary precision math operations and return string resultant values. Wraps big.js
|
|
1633
1634
|
* @class FableServiceMath
|
|
1634
1635
|
* @extends libFableServiceBase
|
|
1635
|
-
*/var FableServiceMath=/*#__PURE__*/function(_libFableServiceBase7){function FableServiceMath(pFable,pOptions,pServiceHash){var
|
|
1636
|
-
|
|
1637
|
-
return
|
|
1636
|
+
*/var FableServiceMath=/*#__PURE__*/function(_libFableServiceBase7){function FableServiceMath(pFable,pOptions,pServiceHash){var _this31;_classCallCheck2(this,FableServiceMath);_this31=_callSuper(this,FableServiceMath,[pFable,pOptions,pServiceHash]);_this31.serviceType='Math';_this31.pi='3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679';// From NASA: https://apod.nasa.gov/htmltest/gifcity/e.2mil
|
|
1637
|
+
_this31.euler='2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664';// this.manifest = this.fable.newManyfest();
|
|
1638
|
+
return _this31;}/*
|
|
1638
1639
|
Pass-through Rounding Method Constants
|
|
1639
1640
|
|
|
1640
1641
|
Property Value BigDecimal Equiv Description
|
|
@@ -1827,13 +1828,13 @@ return 1;}return 0;}/**
|
|
|
1827
1828
|
*
|
|
1828
1829
|
* @param {Array|Object} pValueSet - The value set to be sorted.
|
|
1829
1830
|
* @returns {Array} - The sorted value set.
|
|
1830
|
-
*/},{key:"sortSetPrecise",value:function sortSetPrecise(pValueSet){var
|
|
1831
|
+
*/},{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;}/**
|
|
1831
1832
|
* Bucketizes a set of values based on a specified bucket size.
|
|
1832
1833
|
*
|
|
1833
1834
|
* @param {Array|Object} pValueSet - The set of values to be bucketized.
|
|
1834
1835
|
* @param {number} pBucketSize - The size of each bucket. Optional - If NaN, the values will be bucketized by their value.
|
|
1835
1836
|
* @returns {Object} - The bucketized set of values.
|
|
1836
|
-
*/},{key:"bucketSetPrecise",value:function bucketSetPrecise(pValueSet,pBucketSize){var tmpBucketedSet={};var tmpBucketSize=this.parsePrecise(pBucketSize,NaN);if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){var tmpValue=this.parsePrecise(pValueSet[i],NaN);var tmpBucket=tmpValue.toString();if(!isNaN(tmpBucketSize)){tmpBucket=this.dividePrecise(pValueSet[i],tmpBucketSize);}if(!(tmpBucket in tmpBucketedSet)){tmpBucketedSet[tmpBucket]=0;}tmpBucketedSet[tmpBucket]=tmpBucketedSet[tmpBucket]+1;}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var
|
|
1837
|
+
*/},{key:"bucketSetPrecise",value:function bucketSetPrecise(pValueSet,pBucketSize){var tmpBucketedSet={};var tmpBucketSize=this.parsePrecise(pBucketSize,NaN);if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){var tmpValue=this.parsePrecise(pValueSet[i],NaN);var tmpBucket=tmpValue.toString();if(!isNaN(tmpBucketSize)){tmpBucket=this.dividePrecise(pValueSet[i],tmpBucketSize);}if(!(tmpBucket in tmpBucketedSet)){tmpBucketedSet[tmpBucket]=0;}tmpBucketedSet[tmpBucket]=tmpBucketedSet[tmpBucket]+1;}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i19=0;_i19<tmpKeys.length;_i19++){var _tmpValue2=this.parsePrecise(pValueSet[tmpKeys[_i19]],NaN);var _tmpBucket=_tmpValue2.toString();if(!isNaN(tmpBucketSize)){_tmpBucket=this.dividePrecise(pValueSet[_i19],tmpBucketSize);}if(!(_tmpBucket in tmpBucketedSet)){tmpBucketedSet[_tmpBucket]=0;}tmpBucketedSet[_tmpBucket]=tmpBucketedSet[_tmpBucket]+1;}}return tmpBucketedSet;}/**
|
|
1837
1838
|
* Calculates the histogram using precise bucket set for the given pValueSet.
|
|
1838
1839
|
*
|
|
1839
1840
|
* @param {Array<number>} pValueSet - The array of p-values.
|
|
@@ -1865,7 +1866,7 @@ var tmpCleanedObject={};var tmpKeys=Object.keys(pValueObject);for(var i=0;i<tmpK
|
|
|
1865
1866
|
* @param {Array} pValueObjectSet
|
|
1866
1867
|
* @param {string} pValueAddress
|
|
1867
1868
|
* @param {Object} pManifest
|
|
1868
|
-
*/},{key:"entryInSet",value:function entryInSet(pValueObjectSet,pValueAddress,pEntryIndex){var
|
|
1869
|
+
*/},{key:"entryInSet",value:function entryInSet(pValueObjectSet,pValueAddress,pEntryIndex){var _this33=this;var tmpEntryIndex=typeof pEntryIndex==='number'?pEntryIndex:parseInt(pEntryIndex);if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress){return false;}if(isNaN(tmpEntryIndex)||tmpEntryIndex>=pValueObjectSet.length){return false;}var tmpValueArray=pValueObjectSet.toSorted(function(pLeft,pRight){return _this33.comparePrecise(pLeft[pValueAddress],pRight[pValueAddress]);});var tmpIndex=tmpEntryIndex<0?tmpValueArray.length+tmpEntryIndex:tmpEntryIndex;return tmpValueArray[tmpIndex];}/**
|
|
1869
1870
|
* Finds the smallest value in a set of objects based on a specified value address.
|
|
1870
1871
|
*
|
|
1871
1872
|
* @param {Object[]} pValueObjectSet - An array of objects to search through.
|
|
@@ -1886,17 +1887,17 @@ var tmpCleanedObject={};var tmpKeys=Object.keys(pValueObject);for(var i=0;i<tmpK
|
|
|
1886
1887
|
*
|
|
1887
1888
|
* @param {Array|Object} pValueSet - The set of values to find the maximum from.
|
|
1888
1889
|
* @returns {number} - The maximum value from the set.
|
|
1889
|
-
*/},{key:"maxPrecise",value:function maxPrecise(pValueSet){var tmpMaxValue=NaN;if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[i],NaN);}else{var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(this.gtPrecise(tmpComparisonValue,tmpMaxValue)){tmpMaxValue=tmpComparisonValue;}}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var
|
|
1890
|
+
*/},{key:"maxPrecise",value:function maxPrecise(pValueSet){var tmpMaxValue=NaN;if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[i],NaN);}else{var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(this.gtPrecise(tmpComparisonValue,tmpMaxValue)){tmpMaxValue=tmpComparisonValue;}}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i20=0;_i20<tmpKeys.length;_i20++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[tmpKeys[_i20]],NaN);}else{var _tmpComparisonValue=this.parsePrecise(pValueSet[tmpKeys[_i20]],NaN);if(this.gtPrecise(_tmpComparisonValue,tmpMaxValue)){tmpMaxValue=_tmpComparisonValue;}}}}return tmpMaxValue;}/**
|
|
1890
1891
|
* Finds the minimum value from a set of values.
|
|
1891
1892
|
*
|
|
1892
1893
|
* @param {Array|Object} pValueSet - The set of values to find the minimum from.
|
|
1893
1894
|
* @returns {number} The minimum value from the set.
|
|
1894
|
-
*/},{key:"minPrecise",value:function minPrecise(pValueSet){var tmpMinValue=NaN;if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[i],NaN);}else{var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)&&this.ltPrecise(tmpComparisonValue,tmpMinValue)){tmpMinValue=tmpComparisonValue;}}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var
|
|
1895
|
+
*/},{key:"minPrecise",value:function minPrecise(pValueSet){var tmpMinValue=NaN;if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[i],NaN);}else{var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)&&this.ltPrecise(tmpComparisonValue,tmpMinValue)){tmpMinValue=tmpComparisonValue;}}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i21=0;_i21<tmpKeys.length;_i21++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[tmpKeys[_i21]],NaN);}else{var _tmpComparisonValue2=this.parsePrecise(pValueSet[tmpKeys[_i21]],NaN);if(!isNaN(_tmpComparisonValue2)&&this.ltPrecise(_tmpComparisonValue2,tmpMinValue)){tmpMinValue=_tmpComparisonValue2;}}}}return tmpMinValue;}/**
|
|
1895
1896
|
* Calculates the precise sum of values in the given value set.
|
|
1896
1897
|
*
|
|
1897
1898
|
* @param {Array|Object} pValueSet - The value set to calculate the sum from.
|
|
1898
1899
|
* @returns {string} The precise sum value as a string.
|
|
1899
|
-
*/},{key:"sumPrecise",value:function sumPrecise(pValueSet){var tmpSumValue="0.0";if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)){tmpSumValue=this.addPrecise(tmpSumValue,tmpComparisonValue);}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var
|
|
1900
|
+
*/},{key:"sumPrecise",value:function sumPrecise(pValueSet){var tmpSumValue="0.0";if(Array.isArray(pValueSet)){for(var i=0;i<pValueSet.length;i++){var tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)){tmpSumValue=this.addPrecise(tmpSumValue,tmpComparisonValue);}}}else if(_typeof(pValueSet)==='object'){var tmpKeys=Object.keys(pValueSet);for(var _i22=0;_i22<tmpKeys.length;_i22++){var _tmpComparisonValue3=this.parsePrecise(pValueSet[tmpKeys[_i22]],NaN);if(!isNaN(_tmpComparisonValue3)){tmpSumValue=this.addPrecise(tmpSumValue,_tmpComparisonValue3);}}}return tmpSumValue;}/**
|
|
1900
1901
|
* Calculates the precise mean of a given value set.
|
|
1901
1902
|
*
|
|
1902
1903
|
* @param {Array<number>} pValueSet - The array of values to calculate the mean.
|
|
@@ -1924,7 +1925,7 @@ var tmpHistogramValueSet=Object.keys(tmpHistogram);var tmpModeValueSet=[];for(va
|
|
|
1924
1925
|
* Precedent Meta-Templating
|
|
1925
1926
|
* @author Steven Velozo <steven@velozo.com>
|
|
1926
1927
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
1927
|
-
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase8){function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var
|
|
1928
|
+
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase8){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,_libFableServiceBase8);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);}/**
|
|
1928
1929
|
* Parse a string with the existing parse tree
|
|
1929
1930
|
* @method parseString
|
|
1930
1931
|
* @param {string} pString - The string to parse
|
|
@@ -1979,10 +1980,10 @@ var _tmpFunctionContext='ParserContext'in pParserState.Pattern?pParserState.Patt
|
|
|
1979
1980
|
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)....
|
|
1980
1981
|
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
1981
1982
|
if(pCharacter in pParserState.ParseTree){// ... assign the root node as the matched node.
|
|
1982
|
-
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
|
|
1983
|
+
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.
|
|
1983
1984
|
// Trim the start and end tags off the output buffer now
|
|
1984
1985
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
1985
|
-
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){
|
|
1986
|
+
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
|
|
1986
1987
|
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();}}/**
|
|
1987
1988
|
* Parse a character in the buffer.
|
|
1988
1989
|
* @method parseCharacterAsync
|
|
@@ -2015,11 +2016,11 @@ return fCallback();}/**
|
|
|
2015
2016
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
2016
2017
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
2017
2018
|
* @param {array} pDataContext - The history of data objects/context already passed in
|
|
2018
|
-
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback,pDataContext){var
|
|
2019
|
+
*/},{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.
|
|
2019
2020
|
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.
|
|
2020
2021
|
this.parseCharacter(pString[i],tmpParserState,pData,tmpDataContext);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
2021
|
-
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var _loop=function _loop(
|
|
2022
|
-
|
|
2022
|
+
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
|
|
2023
|
+
_this36.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserState.Output);});}}}]);}();module.exports=StringParser;},{}],91:[function(require,module,exports){/**
|
|
2023
2024
|
* Word Tree
|
|
2024
2025
|
* @author Steven Velozo <steven@velozo.com>
|
|
2025
2026
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -2048,20 +2049,20 @@ _this34.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserSta
|
|
|
2048
2049
|
* @param {Object} pParserContext - The context to pass to the parser function
|
|
2049
2050
|
* @return {Object} The leaf parser from the tree
|
|
2050
2051
|
*/},{key:"addPatternBoth",value:function addPatternBoth(pPatternStart,pPatternEnd,fParser,fParserAsync,pParserContext){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
|
|
2051
|
-
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!('PatternEnd'in tmpLeaf)){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var
|
|
2052
|
+
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!('PatternEnd'in tmpLeaf)){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var _i24=0;_i24<tmpPatternEnd.length;_i24++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i24],_i24);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(pHash,pData){return fParser;}:function(pHash,pData){return pHash;};tmpLeaf.ParseAsync=typeof fParserAsync==='function'?fParserAsync:typeof fParserAsync==='string'?function(pHash,pData,fCallback){return fCallback(null,fParserAsync);}:function(pHash,pData,fCallback){return fCallback(null,tmpLeaf.Parse(pHash,pData));};// A "this" for every object
|
|
2052
2053
|
if(pParserContext){tmpLeaf.ParserContext=pParserContext;}tmpLeaf.isAsync=true;return tmpLeaf;}/** Add a Pattern to the Parse Tree with both function parameter types
|
|
2053
2054
|
* @method addPatternAll
|
|
2054
2055
|
* @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
|
|
2055
2056
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
2056
2057
|
* @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.
|
|
2057
2058
|
* @param {Object} pParserContext - The context to pass to the parser function
|
|
2058
|
-
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);}();module.exports=WordTree;},{}],92:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":1},"Steps":[],"Errors":[],"Log":[]};},{}],93:[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(_libFableServiceBase9){function FableOperation(pFable,pOptions,pServiceHash){var
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
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(
|
|
2063
|
-
tmpAnticipate.anticipate(
|
|
2064
|
-
tmpAnticipate.wait(function(pError){if(pError){
|
|
2059
|
+
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}]);}();module.exports=WordTree;},{}],92:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":1},"Steps":[],"Errors":[],"Log":[]};},{}],93:[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(_libFableServiceBase9){function FableOperation(pFable,pOptions,pServiceHash){var _this37;_classCallCheck2(this,FableOperation);_this37=_callSuper(this,FableOperation,[pFable,pOptions,pServiceHash]);// Timestamps will just be the long ints
|
|
2060
|
+
_this37.timeStamps={};_this37.serviceType='PhasedOperation';_this37.state=JSON.parse(_OperationStatePrototypeString);_this37.stepMap={};_this37.stepFunctions={};// Match the service instantiation to the operation.
|
|
2061
|
+
_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.
|
|
2062
|
+
_this37.log=_this37;return _this37;}_inherits(FableOperation,_libFableServiceBase9);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?
|
|
2063
|
+
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
|
|
2064
|
+
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
|
|
2065
|
+
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:
|
|
2065
2066
|
// 1. As a basic javascript function
|
|
2066
2067
|
// --
|
|
2067
2068
|
// This is the most basic, java"script" way to add a step. It will
|
|
@@ -2070,11 +2071,11 @@ tmpAnticipate.wait(function(pError){if(pError){_this36.fable.log.error("Operatio
|
|
|
2070
2071
|
},{key:"addStep",value:function addStep(fStepFunction,pStepMetadata,pStepName,pStepDescription,pGUIDStep){var tmpStep={};// GUID is optional
|
|
2071
2072
|
tmpStep.GUIDStep=typeof pGUIDStep!=='undefined'?pGUIDStep:"STEP-".concat(this.state.Steps.length,"-").concat(this.fable.DataGeneration.randomNumericString());// Name is optional
|
|
2072
2073
|
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
|
|
2073
|
-
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":92,"big.js":17,"fable-serviceproviderbase":59}],94:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(
|
|
2074
|
+
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":92,"big.js":17,"fable-serviceproviderbase":59}],94:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceProgressTime=/*#__PURE__*/function(_libFableServiceBase10){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,_libFableServiceBase10);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.
|
|
2074
2075
|
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.
|
|
2075
|
-
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}],95:[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;},{}],96:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');var FableServiceProgressTrackerSet=/*#__PURE__*/function(
|
|
2076
|
-
|
|
2077
|
-
|
|
2076
|
+
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}],95:[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;},{}],96:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');var FableServiceProgressTrackerSet=/*#__PURE__*/function(_libFableServiceBase11){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
|
|
2077
|
+
_this40.progressTimes=_this40.fable.instantiateServiceProviderWithoutRegistration('ProgressTime');// This timestamp is used and updated by *all* progress trackers.
|
|
2078
|
+
_this40.progressTimes.createTimeStamp('CurrentTime');return _this40;}_inherits(FableServiceProgressTrackerSet,_libFableServiceBase11);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%
|
|
2078
2079
|
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
|
|
2079
2080
|
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.
|
|
2080
2081
|
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
|
|
@@ -2095,20 +2096,20 @@ this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!(tmpProgressTrackerH
|
|
|
2095
2096
|
if(tmpProgressTracker.StartTimeStamp<1){return"ProgressTracker ".concat(tmpProgressTracker.Hash," has not been started yet.");}// 2. Started, but no operations completed
|
|
2096
2097
|
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
|
|
2097
2098
|
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
|
|
2098
|
-
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":95,"fable-serviceproviderbase":59}],97:[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(
|
|
2099
|
+
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":95,"fable-serviceproviderbase":59}],97:[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(_libFableServiceBase12){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
|
|
2099
2100
|
// of the request options before they are passed to the request library.
|
|
2100
|
-
|
|
2101
|
+
_this41.prepareRequestOptions=function(pOptions){return pOptions;};return _this41;}_inherits(FableServiceRestClient,_libFableServiceBase12);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.
|
|
2101
2102
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
2102
2103
|
var tmpOptions=this.prepareCookies(pOptions);// Prepend a string to the URL if it exists in the Fable Config
|
|
2103
|
-
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
|
|
2104
|
-
if(
|
|
2105
|
-
if(
|
|
2106
|
-
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(
|
|
2104
|
+
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.
|
|
2105
|
+
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.
|
|
2106
|
+
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.
|
|
2107
|
+
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
|
|
2107
2108
|
if (!('Content-Type' in tmpOptions.headers))
|
|
2108
2109
|
{
|
|
2109
2110
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
2110
2111
|
}
|
|
2111
|
-
*/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(
|
|
2112
|
+
*/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":165}],98:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase13){// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2112
2113
|
// string-based template with code snippets into simple executable pieces,
|
|
2113
2114
|
// with the added twist of returning a precompiled function ready to go.
|
|
2114
2115
|
//
|
|
@@ -2117,19 +2118,19 @@ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.
|
|
|
2117
2118
|
//
|
|
2118
2119
|
// This is an implementation of that.
|
|
2119
2120
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2120
|
-
function FableServiceTemplate(pFable,pOptions,pServiceHash){var
|
|
2121
|
+
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
|
|
2121
2122
|
// TODO: Switch this to precedent
|
|
2122
|
-
|
|
2123
|
+
_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.
|
|
2123
2124
|
GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper functions.
|
|
2124
2125
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
2125
|
-
|
|
2126
|
+
_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
|
|
2126
2127
|
// function on this class.
|
|
2127
|
-
|
|
2128
|
+
_this45.renderFunction=false;_this45.templateString=false;return _this45;}_inherits(FableServiceTemplate,_libFableServiceBase13);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
|
|
2128
2129
|
// underscore code until this is rewritten using precedent.
|
|
2129
|
-
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(
|
|
2130
|
+
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
|
|
2130
2131
|
// precompilation.
|
|
2131
2132
|
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);}(libFableServiceBase);module.exports=FableServiceTemplate;},{"fable-serviceproviderbase":59}],99:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2132
|
-
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var libBigNumber=require('big.js');var FableServiceUtility=/*#__PURE__*/function(
|
|
2133
|
+
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var libBigNumber=require('big.js');var FableServiceUtility=/*#__PURE__*/function(_libFableServiceBase14){// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2133
2134
|
// string-based template with code snippets into simple executable pieces,
|
|
2134
2135
|
// with the added twist of returning a precompiled function ready to go.
|
|
2135
2136
|
//
|
|
@@ -2138,12 +2139,12 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
2138
2139
|
//
|
|
2139
2140
|
// This is an implementation of that.
|
|
2140
2141
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2141
|
-
function FableServiceUtility(pFable,pOptions,pServiceHash){var
|
|
2142
|
-
|
|
2142
|
+
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
|
|
2143
|
+
_this47.waterfall=libAsyncWaterfall;_this47.eachLimit=libAsyncEachLimit;_this47.bigNumber=libBigNumber;return _this47;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
2143
2144
|
// Now that es6 gives us this, use the native thingy.
|
|
2144
2145
|
// Nevermind, the native thing is not stable enough across environments
|
|
2145
2146
|
// Basic shallow copy
|
|
2146
|
-
_inherits(FableServiceUtility,
|
|
2147
|
+
_inherits(FableServiceUtility,_libFableServiceBase14);return _createClass2(FableServiceUtility,[{key:"extend",value:function extend(pDestinationObject){for(var i=0;i<(arguments.length<=1?0:arguments.length-1);i++){var tmpSourceObject=i+1<1||arguments.length<=i+1?undefined:arguments[i+1];if(_typeof(tmpSourceObject)==='object'){var tmpObjectProperties=Object.keys(tmpSourceObject);for(var k=0;k<tmpObjectProperties.length;k++){pDestinationObject[tmpObjectProperties[k]]=tmpSourceObject[tmpObjectProperties[k]];}}}return pDestinationObject;}// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2147
2148
|
// string-based template with code snippets into simple executable pieces,
|
|
2148
2149
|
// with the added twist of returning a precompiled function ready to go.
|
|
2149
2150
|
},{key:"template",value:function template(pTemplateText,pData){var tmpTemplate=this.fable.instantiateServiceProviderWithoutRegistration('Template');return tmpTemplate.buildTemplateFunction(pTemplateText,pData);}// Build a template function from a template hash, and, register it with the service provider
|
|
@@ -2267,7 +2268,7 @@ var getEvalledConstructor=function getEvalledConstructor(expressionSyntax){try{r
|
|
|
2267
2268
|
arguments.callee;// IE 8 does not throw here
|
|
2268
2269
|
return throwTypeError;}catch(calleeThrows){try{// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
2269
2270
|
return $gOPD(arguments,'callee').get;}catch(gOPDthrows){return throwTypeError;}}}():throwTypeError;var hasSymbols=require('has-symbols')();var getProto=require('get-proto');var $ObjectGPO=require('get-proto/Object.getPrototypeOf');var $ReflectGPO=require('get-proto/Reflect.getPrototypeOf');var $apply=require('call-bind-apply-helpers/functionApply');var $call=require('call-bind-apply-helpers/functionCall');var needsEval={};var TypedArray=typeof Uint8Array==='undefined'||!getProto?undefined:getProto(Uint8Array);var INTRINSICS={__proto__:null,'%AggregateError%':typeof AggregateError==='undefined'?undefined:AggregateError,'%Array%':Array,'%ArrayBuffer%':typeof ArrayBuffer==='undefined'?undefined:ArrayBuffer,'%ArrayIteratorPrototype%':hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined,'%AsyncFromSyncIteratorPrototype%':undefined,'%AsyncFunction%':needsEval,'%AsyncGenerator%':needsEval,'%AsyncGeneratorFunction%':needsEval,'%AsyncIteratorPrototype%':needsEval,'%Atomics%':typeof Atomics==='undefined'?undefined:Atomics,'%BigInt%':typeof BigInt==='undefined'?undefined:BigInt,'%BigInt64Array%':typeof BigInt64Array==='undefined'?undefined:BigInt64Array,'%BigUint64Array%':typeof BigUint64Array==='undefined'?undefined:BigUint64Array,'%Boolean%':Boolean,'%DataView%':typeof DataView==='undefined'?undefined:DataView,'%Date%':Date,'%decodeURI%':decodeURI,'%decodeURIComponent%':decodeURIComponent,'%encodeURI%':encodeURI,'%encodeURIComponent%':encodeURIComponent,'%Error%':$Error,'%eval%':eval,// eslint-disable-line no-eval
|
|
2270
|
-
'%EvalError%':$EvalError,'%
|
|
2271
|
+
'%EvalError%':$EvalError,'%Float32Array%':typeof Float32Array==='undefined'?undefined:Float32Array,'%Float64Array%':typeof Float64Array==='undefined'?undefined:Float64Array,'%FinalizationRegistry%':typeof FinalizationRegistry==='undefined'?undefined:FinalizationRegistry,'%Function%':$Function,'%GeneratorFunction%':needsEval,'%Int8Array%':typeof Int8Array==='undefined'?undefined:Int8Array,'%Int16Array%':typeof Int16Array==='undefined'?undefined:Int16Array,'%Int32Array%':typeof Int32Array==='undefined'?undefined:Int32Array,'%isFinite%':isFinite,'%isNaN%':isNaN,'%IteratorPrototype%':hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,'%JSON%':(typeof JSON==="undefined"?"undefined":_typeof(JSON))==='object'?JSON:undefined,'%Map%':typeof Map==='undefined'?undefined:Map,'%MapIteratorPrototype%':typeof Map==='undefined'||!hasSymbols||!getProto?undefined:getProto(new Map()[Symbol.iterator]()),'%Math%':Math,'%Number%':Number,'%Object%':$Object,'%Object.getOwnPropertyDescriptor%':$gOPD,'%parseFloat%':parseFloat,'%parseInt%':parseInt,'%Promise%':typeof Promise==='undefined'?undefined:Promise,'%Proxy%':typeof Proxy==='undefined'?undefined:Proxy,'%RangeError%':$RangeError,'%ReferenceError%':$ReferenceError,'%Reflect%':typeof Reflect==='undefined'?undefined:Reflect,'%RegExp%':RegExp,'%Set%':typeof Set==='undefined'?undefined:Set,'%SetIteratorPrototype%':typeof Set==='undefined'||!hasSymbols||!getProto?undefined:getProto(new Set()[Symbol.iterator]()),'%SharedArrayBuffer%':typeof SharedArrayBuffer==='undefined'?undefined:SharedArrayBuffer,'%String%':String,'%StringIteratorPrototype%':hasSymbols&&getProto?getProto(''[Symbol.iterator]()):undefined,'%Symbol%':hasSymbols?Symbol:undefined,'%SyntaxError%':$SyntaxError,'%ThrowTypeError%':ThrowTypeError,'%TypedArray%':TypedArray,'%TypeError%':$TypeError,'%Uint8Array%':typeof Uint8Array==='undefined'?undefined:Uint8Array,'%Uint8ClampedArray%':typeof Uint8ClampedArray==='undefined'?undefined:Uint8ClampedArray,'%Uint16Array%':typeof Uint16Array==='undefined'?undefined:Uint16Array,'%Uint32Array%':typeof Uint32Array==='undefined'?undefined:Uint32Array,'%URIError%':$URIError,'%WeakMap%':typeof WeakMap==='undefined'?undefined:WeakMap,'%WeakRef%':typeof WeakRef==='undefined'?undefined:WeakRef,'%WeakSet%':typeof WeakSet==='undefined'?undefined:WeakSet,'%Function.prototype.call%':$call,'%Function.prototype.apply%':$apply,'%Object.defineProperty%':$defineProperty,'%Object.getPrototypeOf%':$ObjectGPO,'%Math.abs%':abs,'%Math.floor%':floor,'%Math.max%':max,'%Math.min%':min,'%Math.pow%':pow,'%Math.round%':round,'%Math.sign%':sign,'%Reflect.getPrototypeOf%':$ReflectGPO};if(getProto){try{null.error;// eslint-disable-line no-unused-expressions
|
|
2271
2272
|
}catch(e){// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
2272
2273
|
var errorProto=getProto(getProto(e));INTRINSICS['%Error.prototype%']=errorProto;}}var doEval=function doEval(name){var value;if(name==='%AsyncFunction%'){value=getEvalledConstructor('async function () {}');}else if(name==='%GeneratorFunction%'){value=getEvalledConstructor('function* () {}');}else if(name==='%AsyncGeneratorFunction%'){value=getEvalledConstructor('async function* () {}');}else if(name==='%AsyncGenerator%'){var fn=doEval('%AsyncGeneratorFunction%');if(fn){value=fn.prototype;}}else if(name==='%AsyncIteratorPrototype%'){var gen=doEval('%AsyncGenerator%');if(gen&&getProto){value=getProto(gen.prototype);}}INTRINSICS[name]=value;return value;};var LEGACY_ALIASES={__proto__:null,'%ArrayBufferPrototype%':['ArrayBuffer','prototype'],'%ArrayPrototype%':['Array','prototype'],'%ArrayProto_entries%':['Array','prototype','entries'],'%ArrayProto_forEach%':['Array','prototype','forEach'],'%ArrayProto_keys%':['Array','prototype','keys'],'%ArrayProto_values%':['Array','prototype','values'],'%AsyncFunctionPrototype%':['AsyncFunction','prototype'],'%AsyncGenerator%':['AsyncGeneratorFunction','prototype'],'%AsyncGeneratorPrototype%':['AsyncGeneratorFunction','prototype','prototype'],'%BooleanPrototype%':['Boolean','prototype'],'%DataViewPrototype%':['DataView','prototype'],'%DatePrototype%':['Date','prototype'],'%ErrorPrototype%':['Error','prototype'],'%EvalErrorPrototype%':['EvalError','prototype'],'%Float32ArrayPrototype%':['Float32Array','prototype'],'%Float64ArrayPrototype%':['Float64Array','prototype'],'%FunctionPrototype%':['Function','prototype'],'%Generator%':['GeneratorFunction','prototype'],'%GeneratorPrototype%':['GeneratorFunction','prototype','prototype'],'%Int8ArrayPrototype%':['Int8Array','prototype'],'%Int16ArrayPrototype%':['Int16Array','prototype'],'%Int32ArrayPrototype%':['Int32Array','prototype'],'%JSONParse%':['JSON','parse'],'%JSONStringify%':['JSON','stringify'],'%MapPrototype%':['Map','prototype'],'%NumberPrototype%':['Number','prototype'],'%ObjectPrototype%':['Object','prototype'],'%ObjProto_toString%':['Object','prototype','toString'],'%ObjProto_valueOf%':['Object','prototype','valueOf'],'%PromisePrototype%':['Promise','prototype'],'%PromiseProto_then%':['Promise','prototype','then'],'%Promise_all%':['Promise','all'],'%Promise_reject%':['Promise','reject'],'%Promise_resolve%':['Promise','resolve'],'%RangeErrorPrototype%':['RangeError','prototype'],'%ReferenceErrorPrototype%':['ReferenceError','prototype'],'%RegExpPrototype%':['RegExp','prototype'],'%SetPrototype%':['Set','prototype'],'%SharedArrayBufferPrototype%':['SharedArrayBuffer','prototype'],'%StringPrototype%':['String','prototype'],'%SymbolPrototype%':['Symbol','prototype'],'%SyntaxErrorPrototype%':['SyntaxError','prototype'],'%TypedArrayPrototype%':['TypedArray','prototype'],'%TypeErrorPrototype%':['TypeError','prototype'],'%Uint8ArrayPrototype%':['Uint8Array','prototype'],'%Uint8ClampedArrayPrototype%':['Uint8ClampedArray','prototype'],'%Uint16ArrayPrototype%':['Uint16Array','prototype'],'%Uint32ArrayPrototype%':['Uint32Array','prototype'],'%URIErrorPrototype%':['URIError','prototype'],'%WeakMapPrototype%':['WeakMap','prototype'],'%WeakSetPrototype%':['WeakSet','prototype']};var bind=require('function-bind');var hasOwn=require('hasown');var $concat=bind.call($call,Array.prototype.concat);var $spliceApply=bind.call($apply,Array.prototype.splice);var $replace=bind.call($call,String.prototype.replace);var $strSlice=bind.call($call,String.prototype.slice);var $exec=bind.call($call,RegExp.prototype.exec);/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */var rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;var reEscapeChar=/\\(\\)?/g;/** Used to match backslashes in property paths. */var stringToPath=function stringToPath(string){var first=$strSlice(string,0,1);var last=$strSlice(string,-1);if(first==='%'&&last!=='%'){throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');}else if(last==='%'&&first!=='%'){throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');}var result=[];$replace(string,rePropName,function(match,number,quote,subString){result[result.length]=quote?$replace(subString,reEscapeChar,'$1'):number||match;});return result;};/* end adaptation */var getBaseIntrinsic=function getBaseIntrinsic(name,allowMissing){var intrinsicName=name;var alias;if(hasOwn(LEGACY_ALIASES,intrinsicName)){alias=LEGACY_ALIASES[intrinsicName];intrinsicName='%'+alias[0]+'%';}if(hasOwn(INTRINSICS,intrinsicName)){var value=INTRINSICS[intrinsicName];if(value===needsEval){value=doEval(intrinsicName);}if(typeof value==='undefined'&&!allowMissing){throw new $TypeError('intrinsic '+name+' exists, but is not available. Please file an issue!');}return{alias:alias,name:intrinsicName,value:value};}throw new $SyntaxError('intrinsic '+name+' does not exist!');};module.exports=function GetIntrinsic(name,allowMissing){if(typeof name!=='string'||name.length===0){throw new $TypeError('intrinsic name must be a non-empty string');}if(arguments.length>1&&typeof allowMissing!=='boolean'){throw new $TypeError('"allowMissing" argument must be a boolean');}if($exec(/^%?[^%]*%?$/,name)===null){throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');}var parts=stringToPath(name);var intrinsicBaseName=parts.length>0?parts[0]:'';var intrinsic=getBaseIntrinsic('%'+intrinsicBaseName+'%',allowMissing);var intrinsicRealName=intrinsic.name;var value=intrinsic.value;var skipFurtherCaching=false;var alias=intrinsic.alias;if(alias){intrinsicBaseName=alias[0];$spliceApply(parts,$concat([0,1],alias));}for(var i=1,isOwn=true;i<parts.length;i+=1){var part=parts[i];var first=$strSlice(part,0,1);var last=$strSlice(part,-1);if((first==='"'||first==="'"||first==='`'||last==='"'||last==="'"||last==='`')&&first!==last){throw new $SyntaxError('property names with quotes must have matching quotes');}if(part==='constructor'||!isOwn){skipFurtherCaching=true;}intrinsicBaseName+='.'+part;intrinsicRealName='%'+intrinsicBaseName+'%';if(hasOwn(INTRINSICS,intrinsicRealName)){value=INTRINSICS[intrinsicRealName];}else if(value!=null){if(!(part in value)){if(!allowMissing){throw new $TypeError('base intrinsic for '+name+' exists, but the property is not available.');}return void undefined;}if($gOPD&&i+1>=parts.length){var desc=$gOPD(value,part);isOwn=!!desc;// By convention, when a data property is converted to an accessor
|
|
2273
2274
|
// property to emulate a data property that does not suffer from
|
|
@@ -2322,12 +2323,12 @@ var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pStr
|
|
|
2322
2323
|
*
|
|
2323
2324
|
* @class ManyfestHashTranslation
|
|
2324
2325
|
*/var ManyfestHashTranslation=/*#__PURE__*/function(){function ManyfestHashTranslation(pInfoLog,pErrorLog){_classCallCheck2(this,ManyfestHashTranslation);// Wire in logging
|
|
2325
|
-
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
|
|
2326
|
+
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:
|
|
2326
2327
|
// { "SourceHash": "DestinationHash", "SecondSourceHash":"SecondDestinationHash" }
|
|
2327
|
-
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'){
|
|
2328
|
+
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.
|
|
2328
2329
|
// If passed a string, just removes the single one.
|
|
2329
2330
|
// If passed an object, it does all the source keys.
|
|
2330
|
-
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var
|
|
2331
|
+
},{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":117}],117:[function(require,module,exports){/**
|
|
2331
2332
|
* @author <steven@velozo.com>
|
|
2332
2333
|
*//**
|
|
2333
2334
|
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
@@ -2589,13 +2590,13 @@ else if(_tmpBracketStartIndex2>0// 2) The end bracket is after the start brac
|
|
|
2589
2590
|
return false;}// We need to enumerate the array and grab the addresses from there.
|
|
2590
2591
|
var tmpArrayProperty=pObject[_tmpBoxedPropertyName4];// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
2591
2592
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpBoxedPropertyName4);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
2592
|
-
var tmpContainerObject={};for(var
|
|
2593
|
+
var tmpContainerObject={};for(var _i25=0;_i25<tmpArrayProperty.length;_i25++){var tmpPropertyParentAddress="".concat(tmpParentAddress,"[").concat(_i25,"]");var tmpValue=this.deleteValueAtAddress(pObject[_tmpBoxedPropertyName4][_i25],tmpNewAddress,tmpPropertyParentAddress);tmpContainerObject["".concat(tmpPropertyParentAddress,".").concat(tmpNewAddress)]=tmpValue;}return tmpContainerObject;}// OBJECT SET
|
|
2593
2594
|
// Note this will not work with a bracket in the same address box set
|
|
2594
2595
|
var _tmpObjectTypeMarkerIndex=pAddress.indexOf('{}');if(_tmpObjectTypeMarkerIndex>0){var _tmpObjectPropertyName=pAddress.substring(0,_tmpObjectTypeMarkerIndex).trim();if(_typeof(pObject[_tmpObjectPropertyName])!='object'){// We asked for a set from an array but it isnt' an array.
|
|
2595
2596
|
return false;}// We need to enumerate the Object and grab the addresses from there.
|
|
2596
2597
|
var tmpObjectProperty=pObject[_tmpObjectPropertyName];var tmpObjectPropertyKeys=Object.keys(tmpObjectProperty);// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
2597
2598
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpObjectPropertyName);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
2598
|
-
var _tmpContainerObject={};for(var
|
|
2599
|
+
var _tmpContainerObject={};for(var _i26=0;_i26<tmpObjectPropertyKeys.length;_i26++){var _tmpPropertyParentAddress="".concat(tmpParentAddress,".").concat(tmpObjectPropertyKeys[_i26]);var _tmpValue3=this.deleteValueAtAddress(pObject[_tmpObjectPropertyName][tmpObjectPropertyKeys[_i26]],tmpNewAddress,_tmpPropertyParentAddress);// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
2599
2600
|
var _tmpKeepRecord=this.checkRecordFilters(pAddress,_tmpValue3);if(_tmpKeepRecord){_tmpContainerObject["".concat(_tmpPropertyParentAddress,".").concat(tmpNewAddress)]=_tmpValue3;}}return _tmpContainerObject;}// If there is an object property already named for the sub object, but it isn't an object
|
|
2600
2601
|
// then the system can't set the value in there. Error and abort!
|
|
2601
2602
|
if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
|
|
@@ -2666,11 +2667,11 @@ var tmpFunctionArguments=_MockFable.DataFormat.stringGetSegments(_MockFable.Data
|
|
|
2666
2667
|
if(tmpFunctionAddress in pObject){try{return pObject[tmpFunctionAddress].apply(pObject);}catch(pError){// The function call failed, so the address doesn't exist
|
|
2667
2668
|
console.log("Error in getValueAtAddress calling function ".concat(tmpFunctionAddress," (address [").concat(pAddress,"]): ").concat(pError.message));return false;}}else{// The function doesn't exist, so the address doesn't exist
|
|
2668
2669
|
console.log("Function ".concat(tmpFunctionAddress," does not exist (address [").concat(pAddress,"])"));return false;}}else{var tmpArgumentValues=[];var _tmpRootObject2=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
|
|
2669
|
-
for(var
|
|
2670
|
+
for(var _i27=0;_i27<tmpFunctionArguments.length;_i27++){// Resolve the values for each subsequent entry
|
|
2670
2671
|
// Check if the argument value is a string literal or a reference to an address
|
|
2671
|
-
if(tmpFunctionArguments[
|
|
2672
|
-
tmpArgumentValues.push(tmpFunctionArguments[
|
|
2673
|
-
tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[
|
|
2672
|
+
if(tmpFunctionArguments[_i27].length>=2&&(tmpFunctionArguments[_i27].charAt(0)=='"'||tmpFunctionArguments[_i27].charAt(0)=="'"||tmpFunctionArguments[_i27].charAt(0)=="`")&&(tmpFunctionArguments[_i27].charAt(tmpFunctionArguments[_i27].length-1)=='"'||tmpFunctionArguments[_i27].charAt(tmpFunctionArguments[_i27].length-1)=="'"||tmpFunctionArguments[_i27].charAt(tmpFunctionArguments[_i27].length-1)=="`")){// This is a string literal
|
|
2673
|
+
tmpArgumentValues.push(tmpFunctionArguments[_i27].substring(1,tmpFunctionArguments[_i27].length-1));}else{// This is a hash address
|
|
2674
|
+
tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject2,tmpFunctionArguments[_i27]));}}if(tmpFunctionAddress in pObject){try{return pObject[tmpFunctionAddress].apply(pObject,tmpArgumentValues);}catch(pError){// The function call failed, so the address doesn't exist
|
|
2674
2675
|
console.log("Error in getValueAtAddress calling function ".concat(tmpFunctionAddress," (address [").concat(pAddress,"]): ").concat(pError.message));return false;}}else{// The function doesn't exist, so the address doesn't exist
|
|
2675
2676
|
console.log("Function ".concat(tmpFunctionAddress," does not exist (address [").concat(pAddress,"])"));return false;}}}// Boxed elements look like this:
|
|
2676
2677
|
// MyValues[10]
|
|
@@ -2703,8 +2704,8 @@ return pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference];}else{return pOb
|
|
|
2703
2704
|
else if(tmpBracketStartIndex>0// 2) The end bracket is after the start bracket
|
|
2704
2705
|
&&tmpBracketStopIndex>tmpBracketStartIndex// 3) There is nothing in the brackets
|
|
2705
2706
|
&&tmpBracketStopIndex-tmpBracketStartIndex==1){var _tmpBoxedPropertyName5=pAddress.substring(0,tmpBracketStartIndex).trim();if(!Array.isArray(pObject[_tmpBoxedPropertyName5])){// We asked for a set from an array but it isnt' an array.
|
|
2706
|
-
return false;}var tmpInputArray=pObject[_tmpBoxedPropertyName5];var tmpOutputArray=[];for(var
|
|
2707
|
-
var tmpKeepRecord=this.checkRecordFilters(pAddress,tmpInputArray[
|
|
2707
|
+
return false;}var tmpInputArray=pObject[_tmpBoxedPropertyName5];var tmpOutputArray=[];for(var _i28=0;_i28<tmpInputArray.length;_i28++){// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
2708
|
+
var tmpKeepRecord=this.checkRecordFilters(pAddress,tmpInputArray[_i28]);if(tmpKeepRecord){tmpOutputArray.push(tmpInputArray[_i28]);}}return tmpOutputArray;}// The object has been flagged as an object set, so treat it as such
|
|
2708
2709
|
else if(tmpObjectTypeMarkerIndex>0){var tmpObjectPropertyName=pAddress.substring(0,tmpObjectTypeMarkerIndex).trim();if(_typeof(pObject[tmpObjectPropertyName])!='object'){// We asked for a set from an array but it isnt' an array.
|
|
2709
2710
|
return false;}return pObject[tmpObjectPropertyName];}else{// Now is the point in recursion to return the value in the address
|
|
2710
2711
|
if(_typeof(pObject[pAddress])!=null){return pObject[pAddress];}else{return null;}}}else{//let tmpSubObjectName = pAddress.substring(0, tmpSeparatorIndex);
|
|
@@ -2733,11 +2734,11 @@ var _tmpFunctionArguments=_MockFable.DataFormat.stringGetSegments(_MockFable.Dat
|
|
|
2733
2734
|
if(_tmpFunctionAddress2 in pObject){try{return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject),tmpNewAddress,tmpParentAddress,tmpRootObject);}catch(pError){// The function call failed, so the address doesn't exist
|
|
2734
2735
|
console.log("Error in getValueAtAddress calling function ".concat(_tmpFunctionAddress2," (address [").concat(pAddress,"]): ").concat(pError.message));return false;}}else{// The function doesn't exist, so the address doesn't exist
|
|
2735
2736
|
console.log("Function ".concat(_tmpFunctionAddress2," does not exist (address [").concat(pAddress,"])"));return false;}}else{var _tmpArgumentValues=[];var _tmpRootObject3=typeof pRootObject=='undefined'?pObject:pRootObject;// Now get the value for each argument
|
|
2736
|
-
for(var
|
|
2737
|
+
for(var _i29=0;_i29<_tmpFunctionArguments.length;_i29++){// Resolve the values for each subsequent entry
|
|
2737
2738
|
// Check if the argument value is a string literal or a reference to an address
|
|
2738
|
-
if(_tmpFunctionArguments[
|
|
2739
|
-
_tmpArgumentValues.push(_tmpFunctionArguments[
|
|
2740
|
-
_tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3,_tmpFunctionArguments[
|
|
2739
|
+
if(_tmpFunctionArguments[_i29].length>=2&&(_tmpFunctionArguments[_i29].charAt(0)=='"'||_tmpFunctionArguments[_i29].charAt(0)=="'"||_tmpFunctionArguments[_i29].charAt(0)=="`")&&(_tmpFunctionArguments[_i29].charAt(_tmpFunctionArguments[_i29].length-1)=='"'||_tmpFunctionArguments[_i29].charAt(_tmpFunctionArguments[_i29].length-1)=="'"||_tmpFunctionArguments[_i29].charAt(_tmpFunctionArguments[_i29].length-1)=="`")){// This is a string literal
|
|
2740
|
+
_tmpArgumentValues.push(_tmpFunctionArguments[_i29].substring(1,_tmpFunctionArguments[_i29].length-1));}else{// This is a hash address
|
|
2741
|
+
_tmpArgumentValues.push(this.getValueAtAddress(_tmpRootObject3,_tmpFunctionArguments[_i29]));}}if(_tmpFunctionAddress2 in pObject){try{return this.getValueAtAddress(pObject[_tmpFunctionAddress2].apply(pObject,_tmpArgumentValues),tmpNewAddress,tmpParentAddress,_tmpRootObject3);}catch(pError){// The function call failed, so the address doesn't exist
|
|
2741
2742
|
console.log("Error in getValueAtAddress calling function ".concat(_tmpFunctionAddress2," (address [").concat(pAddress,"]): ").concat(pError.message));return false;}}else{// The function doesn't exist, so the address doesn't exist
|
|
2742
2743
|
console.log("Function ".concat(_tmpFunctionAddress2," does not exist (address [").concat(pAddress,"])"));return false;}}}// Boxed elements look like this:
|
|
2743
2744
|
// MyValues[42]
|
|
@@ -2781,13 +2782,13 @@ else if(_tmpBracketStartIndex3>0// 2) The end bracket is after the start brac
|
|
|
2781
2782
|
return false;}// We need to enumerate the array and grab the addresses from there.
|
|
2782
2783
|
var tmpArrayProperty=pObject[_tmpBoxedPropertyName7];// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
2783
2784
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpBoxedPropertyName7);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
2784
|
-
var tmpContainerObject={};for(var
|
|
2785
|
+
var tmpContainerObject={};for(var _i30=0;_i30<tmpArrayProperty.length;_i30++){var tmpPropertyParentAddress="".concat(tmpParentAddress,"[").concat(_i30,"]");var tmpValue=this.getValueAtAddress(pObject[_tmpBoxedPropertyName7][_i30],tmpNewAddress,tmpPropertyParentAddress,tmpRootObject);tmpContainerObject["".concat(tmpPropertyParentAddress,".").concat(tmpNewAddress)]=tmpValue;}return tmpContainerObject;}// OBJECT SET
|
|
2785
2786
|
// Note this will not work with a bracket in the same address box set
|
|
2786
2787
|
var _tmpObjectTypeMarkerIndex2=pAddress.indexOf('{}');if(_tmpObjectTypeMarkerIndex2>0){var _tmpObjectPropertyName2=pAddress.substring(0,_tmpObjectTypeMarkerIndex2).trim();if(_typeof(pObject[_tmpObjectPropertyName2])!='object'){// We asked for a set from an array but it isnt' an array.
|
|
2787
2788
|
return false;}// We need to enumerate the Object and grab the addresses from there.
|
|
2788
2789
|
var tmpObjectProperty=pObject[_tmpObjectPropertyName2];var tmpObjectPropertyKeys=Object.keys(tmpObjectProperty);// Managing the parent address is a bit more complex here -- the box will be added for each element.
|
|
2789
2790
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(_tmpObjectPropertyName2);// The container object is where we have the "Address":SOMEVALUE pairs
|
|
2790
|
-
var _tmpContainerObject2={};for(var
|
|
2791
|
+
var _tmpContainerObject2={};for(var _i31=0;_i31<tmpObjectPropertyKeys.length;_i31++){var _tmpPropertyParentAddress2="".concat(tmpParentAddress,".").concat(tmpObjectPropertyKeys[_i31]);var _tmpValue4=this.getValueAtAddress(pObject[_tmpObjectPropertyName2][tmpObjectPropertyKeys[_i31]],tmpNewAddress,_tmpPropertyParentAddress2,tmpRootObject);// The filtering is complex but allows config-based metaprogramming directly from schema
|
|
2791
2792
|
var _tmpKeepRecord2=this.checkRecordFilters(pAddress,_tmpValue4);if(_tmpKeepRecord2){_tmpContainerObject2["".concat(_tmpPropertyParentAddress2,".").concat(tmpNewAddress)]=_tmpValue4;}}return _tmpContainerObject2;}// If there is an object property already named for the sub object, but it isn't an object
|
|
2792
2793
|
// then the system can't set the value in there. Error and abort!
|
|
2793
2794
|
if(tmpSubObjectName in pObject&&_typeof(pObject[tmpSubObjectName])!=='object'){return undefined;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
|
|
@@ -2997,7 +2998,7 @@ this.logInfo=typeof pInfoLog=='function'?pInfoLog:libSimpleLog;this.logError=typ
|
|
|
2997
2998
|
// This will return a mega set of key:value pairs with all possible schema
|
|
2998
2999
|
// permutations and default values (when not an object) and everything else.
|
|
2999
3000
|
return _createClass2(ManyfestObjectAddressGeneration,[{key:"generateAddressses",value:function generateAddressses(pObject,pBaseAddress,pSchema){var tmpBaseAddress=typeof pBaseAddress=='string'?pBaseAddress:'';var tmpSchema=_typeof(pSchema)=='object'?pSchema:{};var tmpObjectType=_typeof(pObject);var tmpSchemaObjectEntry={Address:tmpBaseAddress,Hash:tmpBaseAddress,Name:tmpBaseAddress,// This is so scripts and UI controls can force a developer to opt-in.
|
|
3000
|
-
InSchema:false};if(tmpObjectType=='object'&&pObject==null){tmpObjectType='null';}switch(tmpObjectType){case'string':tmpSchemaObjectEntry.DataType='String';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'number':case'bigint':tmpSchemaObjectEntry.DataType='Number';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'undefined':case'null':tmpSchemaObjectEntry.DataType='Any';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'object':if(Array.isArray(pObject)){tmpSchemaObjectEntry.DataType='Array';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;}for(var i=0;i<pObject.length;i++){this.generateAddressses(pObject[i],"".concat(tmpBaseAddress,"[").concat(i,"]"),tmpSchema);}}else{tmpSchemaObjectEntry.DataType='Object';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;tmpBaseAddress+='.';}var tmpObjectProperties=Object.keys(pObject);for(var
|
|
3001
|
+
InSchema:false};if(tmpObjectType=='object'&&pObject==null){tmpObjectType='null';}switch(tmpObjectType){case'string':tmpSchemaObjectEntry.DataType='String';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'number':case'bigint':tmpSchemaObjectEntry.DataType='Number';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'undefined':case'null':tmpSchemaObjectEntry.DataType='Any';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'object':if(Array.isArray(pObject)){tmpSchemaObjectEntry.DataType='Array';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;}for(var i=0;i<pObject.length;i++){this.generateAddressses(pObject[i],"".concat(tmpBaseAddress,"[").concat(i,"]"),tmpSchema);}}else{tmpSchemaObjectEntry.DataType='Object';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;tmpBaseAddress+='.';}var tmpObjectProperties=Object.keys(pObject);for(var _i32=0;_i32<tmpObjectProperties.length;_i32++){this.generateAddressses(pObject[tmpObjectProperties[_i32]],"".concat(tmpBaseAddress).concat(tmpObjectProperties[_i32]),tmpSchema);}}break;case'symbol':case'function':// Symbols and functions neither recurse nor get added to the schema
|
|
3001
3002
|
break;}return tmpSchema;}}]);}();;module.exports=ManyfestObjectAddressGeneration;},{"./Manyfest-LogToConsole.js":117}],124:[function(require,module,exports){// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
3002
3003
|
//
|
|
3003
3004
|
// For instance:
|
|
@@ -3071,17 +3072,17 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
3071
3072
|
* Manyfest object address-based descriptions and manipulations.
|
|
3072
3073
|
*
|
|
3073
3074
|
* @class Manyfest
|
|
3074
|
-
*/var Manyfest=/*#__PURE__*/function(
|
|
3075
|
-
|
|
3076
|
-
|
|
3075
|
+
*/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
|
|
3076
|
+
_this50.logInfo=libSimpleLog;_this50.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
3077
|
+
_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);}/*************************************************************************
|
|
3077
3078
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
3078
3079
|
*/// Reset critical manifest properties
|
|
3079
|
-
_inherits(Manyfest,
|
|
3080
|
+
_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
|
|
3080
3081
|
var tmpNewOptions=JSON.parse(JSON.stringify(this.options));var tmpNewManyfest=new Manyfest(this.getManifest(),this.logInfo,this.logError,tmpNewOptions);// Import the hash translations
|
|
3081
3082
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);return tmpNewManyfest;}// Deserialize a Manifest from a string
|
|
3082
3083
|
},{key:"deserialize",value:function deserialize(pManifestString){// TODO: Add guards for bad manifest string
|
|
3083
3084
|
return this.loadManifest(JSON.parse(pManifestString));}// Load a manifest from an object
|
|
3084
|
-
},{key:"loadManifest",value:function loadManifest(pManifest){if(_typeof(pManifest)!=='object'){this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(pManifest),"."));}var tmpManifest=_typeof(pManifest)=='object'?pManifest:{};var tmpDescriptorKeys=Object.keys(_DefaultConfiguration);for(var i=0;i<tmpDescriptorKeys.length;i++){if(!(tmpDescriptorKeys[i]in tmpManifest)){tmpManifest[tmpDescriptorKeys[i]]=JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));}}if('Scope'in tmpManifest){if(typeof tmpManifest.Scope==='string'){this.scope=tmpManifest.Scope;}else{this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(tmpManifest.Scope),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."),tmpManifest);}if('Descriptors'in tmpManifest){if(_typeof(tmpManifest.Descriptors)==='object'){var tmpDescriptionAddresses=Object.keys(tmpManifest.Descriptors);for(var
|
|
3085
|
+
},{key:"loadManifest",value:function loadManifest(pManifest){if(_typeof(pManifest)!=='object'){this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(_typeof(pManifest),"."));}var tmpManifest=_typeof(pManifest)=='object'?pManifest:{};var tmpDescriptorKeys=Object.keys(_DefaultConfiguration);for(var i=0;i<tmpDescriptorKeys.length;i++){if(!(tmpDescriptorKeys[i]in tmpManifest)){tmpManifest[tmpDescriptorKeys[i]]=JSON.parse(JSON.stringify(_DefaultConfiguration[tmpDescriptorKeys[i]]));}}if('Scope'in tmpManifest){if(typeof tmpManifest.Scope==='string'){this.scope=tmpManifest.Scope;}else{this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(_typeof(tmpManifest.Scope),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading scope from manifest object. Property \"Scope\" does not exist in the root of the object."),tmpManifest);}if('Descriptors'in tmpManifest){if(_typeof(tmpManifest.Descriptors)==='object'){var tmpDescriptionAddresses=Object.keys(tmpManifest.Descriptors);for(var _i33=0;_i33<tmpDescriptionAddresses.length;_i33++){this.addDescriptor(tmpDescriptionAddresses[_i33],tmpManifest.Descriptors[tmpDescriptionAddresses[_i33]]);}}else{this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(_typeof(tmpManifest.Descriptors),"."),tmpManifest);}}else{this.logError("(".concat(this.scope,") Error loading object description from manifest object. Property \"Descriptors\" does not exist in the root of the Manifest object."),tmpManifest);}if('HashTranslations'in tmpManifest){if(_typeof(tmpManifest.HashTranslations)==='object'){for(var _i34=0;_i34<tmpManifest.HashTranslations.length;_i34++){// Each translation is
|
|
3085
3086
|
}}}}// Serialize the Manifest to a string
|
|
3086
3087
|
},{key:"serialize",value:function serialize(){return JSON.stringify(this.getManifest());}},{key:"getManifest",value:function getManifest(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))};}// Add a descriptor to the manifest
|
|
3087
3088
|
},{key:"addDescriptor",value:function addDescriptor(pAddress,pDescriptor){if(_typeof(pDescriptor)==='object'){// Add the Address into the Descriptor if it doesn't exist:
|
|
@@ -3124,19 +3125,19 @@ return null;}}}// Enumerate through the schema and populate default values if th
|
|
|
3124
3125
|
},{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.
|
|
3125
3126
|
function(pDescriptor){return'Default'in pDescriptor;});}// Forcefully populate all values even if they don't have defaults.
|
|
3126
3127
|
// Based on type, this can do unexpected things.
|
|
3127
|
-
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var
|
|
3128
|
+
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var _this51=this;// Automatically create an object if one isn't passed in.
|
|
3128
3129
|
var tmpObject=_typeof(pObject)==='object'?pObject:{};// Default to *NOT OVERWRITING* properties
|
|
3129
3130
|
var tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverwriteProperties;// This is a filter function, which is passed the schema and allows complex filtering of population
|
|
3130
3131
|
// The default filter function just returns true, populating everything.
|
|
3131
|
-
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=
|
|
3132
|
+
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.
|
|
3132
3133
|
if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
|
|
3133
|
-
if(tmpOverwriteProperties||!
|
|
3134
|
+
if(tmpOverwriteProperties||!_this51.checkAddressExists(tmpObject,pAddress)){_this51.setValueAtAddress(tmpObject,pAddress,_this51.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":116,"./Manyfest-LogToConsole.js":117,"./Manyfest-ObjectAddress-CheckAddressExists.js":118,"./Manyfest-ObjectAddress-DeleteValue.js":119,"./Manyfest-ObjectAddress-GetValue.js":120,"./Manyfest-ObjectAddress-SetValue.js":122,"./Manyfest-ObjectAddressGeneration.js":123,"./Manyfest-SchemaManipulation.js":125,"fable-serviceproviderbase":59}],127:[function(require,module,exports){'use strict';/** @type {import('./abs')} */module.exports=Math.abs;},{}],128:[function(require,module,exports){'use strict';/** @type {import('./floor')} */module.exports=Math.floor;},{}],129:[function(require,module,exports){'use strict';/** @type {import('./isNaN')} */module.exports=Number.isNaN||function isNaN(a){return a!==a;};},{}],130:[function(require,module,exports){'use strict';/** @type {import('./max')} */module.exports=Math.max;},{}],131:[function(require,module,exports){'use strict';/** @type {import('./min')} */module.exports=Math.min;},{}],132:[function(require,module,exports){'use strict';/** @type {import('./pow')} */module.exports=Math.pow;},{}],133:[function(require,module,exports){'use strict';/** @type {import('./round')} */module.exports=Math.round;},{}],134:[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":129}],135:[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
|
|
3134
3135
|
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
|
|
3135
3136
|
?function(O){return O.__proto__;// eslint-disable-line no-proto
|
|
3136
|
-
}: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
|
|
3137
|
-
if(
|
|
3137
|
+
}: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)
|
|
3138
|
+
if(int!==num){var intStr=String(int);var dec=$slice.call(str,intStr.length+1);return $replace.call(intStr,sepRegex,'$&_')+'.'+$replace.call($replace.call(dec,/([0-9]{3})/g,'$&_'),/_$/,'');}}return $replace.call(str,sepRegex,'$&_');}var utilInspect=require('./util.inspect');var inspectCustom=utilInspect.custom;var inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null;var quotes={__proto__:null,'double':'"',single:"'"};var quoteREs={__proto__:null,'double':/(["\\])/g,single:/(['\\])/g};module.exports=function inspect_(obj,options,depth,seen){var opts=options||{};if(has(opts,'quoteStyle')&&!has(quotes,opts.quoteStyle)){throw new TypeError('option "quoteStyle" must be "single" or "double"');}if(has(opts,'maxStringLength')&&(typeof opts.maxStringLength==='number'?opts.maxStringLength<0&&opts.maxStringLength!==Infinity:opts.maxStringLength!==null)){throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');}var customInspect=has(opts,'customInspect')?opts.customInspect:true;if(typeof customInspect!=='boolean'&&customInspect!=='symbol'){throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');}if(has(opts,'indent')&&opts.indent!==null&&opts.indent!=='\t'&&!(parseInt(opts.indent,10)===opts.indent&&opts.indent>0)){throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');}if(has(opts,'numericSeparator')&&typeof opts.numericSeparator!=='boolean'){throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');}var numericSeparator=opts.numericSeparator;if(typeof obj==='undefined'){return'undefined';}if(obj===null){return'null';}if(typeof obj==='boolean'){return obj?'true':'false';}if(typeof obj==='string'){return inspectString(obj,opts);}if(typeof obj==='number'){if(obj===0){return Infinity/obj>0?'0':'-0';}var str=String(obj);return numericSeparator?addNumericSeparator(obj,str):str;}if(typeof obj==='bigint'){var bigIntStr=String(obj)+'n';return numericSeparator?addNumericSeparator(obj,bigIntStr):bigIntStr;}var maxDepth=typeof opts.depth==='undefined'?5:opts.depth;if(typeof depth==='undefined'){depth=0;}if(depth>=maxDepth&&maxDepth>0&&_typeof(obj)==='object'){return isArray(obj)?'[Array]':'[Object]';}var indent=getIndent(opts,depth);if(typeof seen==='undefined'){seen=[];}else if(indexOf(seen,obj)>=0){return'[Circular]';}function inspect(value,from,noIndent){if(from){seen=$arrSlice.call(seen);seen.push(from);}if(noIndent){var newOpts={depth:opts.depth};if(has(opts,'quoteStyle')){newOpts.quoteStyle=opts.quoteStyle;}return inspect_(value,newOpts,depth+1,seen);}return inspect_(value,opts,depth+1,seen);}if(typeof obj==='function'&&!isRegExp(obj)){// in older engines, regexes are callable
|
|
3138
3139
|
var name=nameOf(obj);var keys=arrObjKeys(obj,inspect);return'[Function'+(name?': '+name:' (anonymous)')+']'+(keys.length>0?' { '+$join.call(keys,', ')+' }':'');}if(isSymbol(obj)){var symString=hasShammedSymbols?$replace.call(String(obj),/^(Symbol\(.*\))_[^)]*$/,'$1'):symToString.call(obj);return _typeof(obj)==='object'&&!hasShammedSymbols?markBoxed(symString):symString;}if(isElement(obj)){var s='<'+$toLowerCase.call(String(obj.nodeName));var attrs=obj.attributes||[];for(var i=0;i<attrs.length;i++){s+=' '+attrs[i].name+'='+wrapQuotes(quote(attrs[i].value),'double',opts);}s+='>';if(obj.childNodes&&obj.childNodes.length){s+='...';}s+='</'+$toLowerCase.call(String(obj.nodeName))+'>';return s;}if(isArray(obj)){if(obj.length===0){return'[]';}var xs=arrObjKeys(obj,inspect);if(indent&&!singleLineValues(xs)){return'['+indentedJoin(xs,indent)+']';}return'[ '+$join.call(xs,', ')+' ]';}if(isError(obj)){var parts=arrObjKeys(obj,inspect);if(!('cause'in Error.prototype)&&'cause'in obj&&!isEnumerable.call(obj,'cause')){return'{ ['+String(obj)+'] '+$join.call($concat.call('[cause]: '+inspect(obj.cause),parts),', ')+' }';}if(parts.length===0){return'['+String(obj)+']';}return'{ ['+String(obj)+'] '+$join.call(parts,', ')+' }';}if(_typeof(obj)==='object'&&customInspect){if(inspectSymbol&&typeof obj[inspectSymbol]==='function'&&utilInspect){return utilInspect(obj,{depth:maxDepth-depth});}else if(customInspect!=='symbol'&&typeof obj.inspect==='function'){return obj.inspect();}}if(isMap(obj)){var mapParts=[];if(mapForEach){mapForEach.call(obj,function(value,key){mapParts.push(inspect(key,obj,true)+' => '+inspect(value,obj));});}return collectionOf('Map',mapSize.call(obj),mapParts,indent);}if(isSet(obj)){var setParts=[];if(setForEach){setForEach.call(obj,function(value){setParts.push(inspect(value,obj));});}return collectionOf('Set',setSize.call(obj),setParts,indent);}if(isWeakMap(obj)){return weakCollectionOf('WeakMap');}if(isWeakSet(obj)){return weakCollectionOf('WeakSet');}if(isWeakRef(obj)){return weakCollectionOf('WeakRef');}if(isNumber(obj)){return markBoxed(inspect(Number(obj)));}if(isBigInt(obj)){return markBoxed(inspect(bigIntValueOf.call(obj)));}if(isBoolean(obj)){return markBoxed(booleanValueOf.call(obj));}if(isString(obj)){return markBoxed(inspect(String(obj)));}// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
3139
|
-
/* eslint-env browser */if(typeof window!=='undefined'&&obj===window){return'{ [object Window] }';}if(typeof globalThis!=='undefined'&&obj===globalThis||typeof global!=='undefined'&&obj===global){return'{ [object globalThis] }';}if(!isDate(obj)&&!isRegExp(obj)){var ys=arrObjKeys(obj,inspect);var isPlainObject=gPO?gPO(obj)===Object.prototype:obj instanceof Object||obj.constructor===Object;var protoTag=obj instanceof Object?'':'null prototype';var stringTag=!isPlainObject&&toStringTag&&Object(obj)===obj&&toStringTag in obj?$slice.call(toStr(obj),8,-1):protoTag?'Object':'';var constructorTag=isPlainObject||typeof obj.constructor!=='function'?'':obj.constructor.name?obj.constructor.name+' ':'';var tag=constructorTag+(stringTag||protoTag?'['+$join.call($concat.call([],stringTag||[],protoTag||[]),': ')+'] ':'');if(ys.length===0){return tag+'{}';}if(indent){return tag+'{'+indentedJoin(ys,indent)+'}';}return tag+'{ '+$join.call(ys,', ')+' }';}return String(obj);};function wrapQuotes(s,defaultStyle,opts){var style=opts.quoteStyle||defaultStyle;var quoteChar=quotes[style];return quoteChar+s+quoteChar;}function quote(s){return $replace.call(String(s),/"/g,'"');}function
|
|
3140
|
+
/* eslint-env browser */if(typeof window!=='undefined'&&obj===window){return'{ [object Window] }';}if(typeof globalThis!=='undefined'&&obj===globalThis||typeof global!=='undefined'&&obj===global){return'{ [object globalThis] }';}if(!isDate(obj)&&!isRegExp(obj)){var ys=arrObjKeys(obj,inspect);var isPlainObject=gPO?gPO(obj)===Object.prototype:obj instanceof Object||obj.constructor===Object;var protoTag=obj instanceof Object?'':'null prototype';var stringTag=!isPlainObject&&toStringTag&&Object(obj)===obj&&toStringTag in obj?$slice.call(toStr(obj),8,-1):protoTag?'Object':'';var constructorTag=isPlainObject||typeof obj.constructor!=='function'?'':obj.constructor.name?obj.constructor.name+' ':'';var tag=constructorTag+(stringTag||protoTag?'['+$join.call($concat.call([],stringTag||[],protoTag||[]),': ')+'] ':'');if(ys.length===0){return tag+'{}';}if(indent){return tag+'{'+indentedJoin(ys,indent)+'}';}return tag+'{ '+$join.call(ys,', ')+' }';}return String(obj);};function wrapQuotes(s,defaultStyle,opts){var style=opts.quoteStyle||defaultStyle;var quoteChar=quotes[style];return quoteChar+s+quoteChar;}function quote(s){return $replace.call(String(s),/"/g,'"');}function isArray(obj){return toStr(obj)==='[object Array]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}function isDate(obj){return toStr(obj)==='[object Date]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}function isRegExp(obj){return toStr(obj)==='[object RegExp]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}function isError(obj){return toStr(obj)==='[object Error]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}function isString(obj){return toStr(obj)==='[object String]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}function isNumber(obj){return toStr(obj)==='[object Number]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}function isBoolean(obj){return toStr(obj)==='[object Boolean]'&&(!toStringTag||!(_typeof(obj)==='object'&&toStringTag in obj));}// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
3140
3141
|
function isSymbol(obj){if(hasShammedSymbols){return obj&&_typeof(obj)==='object'&&obj instanceof Symbol;}if(_typeof(obj)==='symbol'){return true;}if(!obj||_typeof(obj)!=='object'||!symToString){return false;}try{symToString.call(obj);return true;}catch(e){}return false;}function isBigInt(obj){if(!obj||_typeof(obj)!=='object'||!bigIntValueOf){return false;}try{bigIntValueOf.call(obj);return true;}catch(e){}return false;}var hasOwn=Object.prototype.hasOwnProperty||function(key){return key in this;};function has(obj,key){return hasOwn.call(obj,key);}function toStr(obj){return objectToString.call(obj);}function nameOf(f){if(f.name){return f.name;}var m=$match.call(functionToString.call(f),/^function\s*([\w$]+)/);if(m){return m[1];}return null;}function indexOf(xs,x){if(xs.indexOf){return xs.indexOf(x);}for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x){return i;}}return-1;}function isMap(x){if(!mapSize||!x||_typeof(x)!=='object'){return false;}try{mapSize.call(x);try{setSize.call(x);}catch(s){return true;}return x instanceof Map;// core-js workaround, pre-v2.5.0
|
|
3141
3142
|
}catch(e){}return false;}function isWeakMap(x){if(!weakMapHas||!x||_typeof(x)!=='object'){return false;}try{weakMapHas.call(x,weakMapHas);try{weakSetHas.call(x,weakSetHas);}catch(s){return true;}return x instanceof WeakMap;// core-js workaround, pre-v2.5.0
|
|
3142
3143
|
}catch(e){}return false;}function isWeakRef(x){if(!weakRefDeref||!x||_typeof(x)!=='object'){return false;}try{weakRefDeref.call(x);return true;}catch(e){}return false;}function isSet(x){if(!setSize||!x||_typeof(x)!=='object'){return false;}try{setSize.call(x);try{mapSize.call(x);}catch(m){return true;}return x instanceof Set;// core-js workaround, pre-v2.5.0
|
|
@@ -3229,24 +3230,24 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
|
|
|
3229
3230
|
// have a good chance at having a non-empty extension
|
|
3230
3231
|
preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
|
|
3231
3232
|
preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
3232
|
-
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":149}],138:[function(require,module,exports){module.exports={"name":"pict-application","version":"1.0.
|
|
3233
|
+
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":149}],138:[function(require,module,exports){module.exports={"name":"pict-application","version":"1.0.27","description":"Application base class for a pict view-based application","main":"source/Pict-Application.js","scripts":{"test":"npx mocha -u tdd -R spec","start":"node source/Pict-Application.js","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-application-image:local","docker-dev-run":"docker run -it -d --name pict-application-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-application\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-application-image:local","docker-dev-shell":"docker exec -it pict-application-dev /bin/bash","tests":"npx mocha -u tdd --exit -R spec --grep","lint":"eslint source/**","types":"tsc -p ."},"types":"types/source/Pict-Application.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-application.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-application/issues"},"homepage":"https://github.com/stevenvelozo/pict-application#readme","devDependencies":{"@eslint/js":"^9.28.0","browser-env":"^3.3.0","eslint":"^9.28.0","pict":"^1.0.272","pict-provider":"^1.0.5","pict-view":"^1.0.60","quackage":"^1.0.41"},"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"}};},{}],139:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');var defaultPictSettings={Name:'DefaultPictApplication',// The main "viewport" is the view that is used to host our application
|
|
3233
3234
|
MainViewportViewIdentifier:'Default-View',MainViewportRenderableHash:false,MainViewportDestinationAddress:false,MainViewportDefaultDataAddress:false,// Whether or not we should automatically render the main viewport and other autorender views after we initialize the pict application
|
|
3234
|
-
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,AutoRenderViewsAfterInitialize:false,ConfigurationOnlyViews:[],Manifests:{},// The prefix to prepend on all template destination hashes
|
|
3235
|
+
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,AutoRenderViewsAfterInitialize:false,AutoLoginAfterInitialize:false,AutoLoadDataAfterLogin:false,ConfigurationOnlyViews:[],Manifests:{},// The prefix to prepend on all template destination hashes
|
|
3235
3236
|
IdentifierAddressPrefix:'PICT-'};/**
|
|
3236
3237
|
* Base class for pict applications.
|
|
3237
|
-
*/var PictApplication=/*#__PURE__*/function(
|
|
3238
|
+
*/var PictApplication=/*#__PURE__*/function(_libFableServiceBase15){/**
|
|
3238
3239
|
* @param {import('fable')} pFable
|
|
3239
|
-
* @param {any} [pOptions]
|
|
3240
|
+
* @param {Record<string, any>} [pOptions]
|
|
3240
3241
|
* @param {string} [pServiceHash]
|
|
3241
|
-
*/function PictApplication(pFable,pOptions,pServiceHash){var
|
|
3242
|
+
*/function PictApplication(pFable,pOptions,pServiceHash){var _this52;_classCallCheck2(this,PictApplication);var tmpCarryOverConfiguration=_typeof(pFable.settings.PictApplicationConfiguration)==='object'?pFable.settings.PictApplicationConfiguration:{};var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),tmpCarryOverConfiguration,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;/**
|
|
3242
3243
|
* @type {{ [key: string]: any }}
|
|
3243
|
-
*/
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
var tmpManifestKeys=Object.keys(
|
|
3247
|
-
var tmpManifestKey=tmpManifestKeys[i];
|
|
3244
|
+
*/_this52.servicesMap;_this52.serviceType='PictApplication';/** @type {Record<string, any>} */_this52._Package=libPackage;// Convenience and consistency naming
|
|
3245
|
+
_this52.pict=_this52.fable;// Wire in the essential Pict state
|
|
3246
|
+
/** @type {Record<string, any>} */_this52.AppData=_this52.fable.AppData;/** @type {Record<string, any>} */_this52.Bundle=_this52.fable.Bundle;/** @type {number} */_this52.initializeTimestamp;/** @type {number} */_this52.lastSolvedTimestamp;/** @type {number} */_this52.lastLoginTimestamp;/** @type {number} */_this52.lastMarshalFromViewsTimestamp;/** @type {number} */_this52.lastMarshalToViewsTimestamp;/** @type {number} */_this52.lastAutoRenderTimestamp;/** @type {number} */_this52.lastLoadDataTimestamp;// Load all the manifests for the application
|
|
3247
|
+
var tmpManifestKeys=Object.keys(_this52.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
3248
|
+
var tmpManifestKey=tmpManifestKeys[i];_this52.fable.instantiateServiceProvider('Manifest',_this52.options.Manifests[tmpManifestKey],tmpManifestKey);}}return _this52;}/* -------------------------------------------------------------------------- *//* Code Section: Solve All Views *//* -------------------------------------------------------------------------- *//**
|
|
3248
3249
|
* @return {boolean}
|
|
3249
|
-
*/_inherits(PictApplication,
|
|
3250
|
+
*/_inherits(PictApplication,_libFableServiceBase15);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;}/**
|
|
3250
3251
|
* @param {(error?: Error) => void} fCallback
|
|
3251
3252
|
*/},{key:"onPreSolveAsync",value:function onPreSolveAsync(fCallback){this.onPreSolve();return fCallback();}/**
|
|
3252
3253
|
* @return {boolean}
|
|
@@ -3259,21 +3260,57 @@ var tmpManifestKey=tmpManifestKeys[i];_this50.fable.instantiateServiceProvider('
|
|
|
3259
3260
|
*/},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}/**
|
|
3260
3261
|
* @return {boolean}
|
|
3261
3262
|
*/},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," executing solve() function..."));}// Walk through any loaded providers and solve them as well.
|
|
3262
|
-
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
|
|
3263
|
-
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var
|
|
3264
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var
|
|
3265
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
3263
|
+
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 providers by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3264
|
+
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i35=0;_i35<tmpProvidersToSolve.length;_i35++){tmpProvidersToSolve[_i35].solve(tmpProvidersToSolve[_i35]);}this.onBeforeSolve();// Now walk through any loaded views and initialize them as well.
|
|
3265
|
+
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)
|
|
3266
|
+
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;}/**
|
|
3266
3267
|
* @param {(error?: Error) => void} fCallback
|
|
3267
|
-
*/},{key:"solveAsync",value:function solveAsync(fCallback){var
|
|
3268
|
-
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){
|
|
3269
|
-
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
|
|
3270
|
-
tmpProvidersToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var
|
|
3271
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var
|
|
3272
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var
|
|
3268
|
+
*/},{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
|
|
3269
|
+
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.
|
|
3270
|
+
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 providers by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3271
|
+
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.
|
|
3272
|
+
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)
|
|
3273
|
+
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);});}/**
|
|
3273
3274
|
* @return {boolean}
|
|
3274
3275
|
*/},{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;}/**
|
|
3275
3276
|
* @param {(error?: Error) => void} fCallback
|
|
3276
|
-
*/},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}/* -------------------------------------------------------------------------- *//* Code Section:
|
|
3277
|
+
*/},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}/* -------------------------------------------------------------------------- *//* Code Section: Application Login *//* -------------------------------------------------------------------------- *//**
|
|
3278
|
+
* @param {(error?: Error) => void} fCallback
|
|
3279
|
+
*/},{key:"onBeforeLoginAsync",value:function onBeforeLoginAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeLoginAsync:"));}return fCallback();}/**
|
|
3280
|
+
* @param {(error?: Error) => void} fCallback
|
|
3281
|
+
*/},{key:"onLoginAsync",value:function onLoginAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onLoginAsync:"));}return fCallback();}/**
|
|
3282
|
+
* @param {(error?: Error) => void} fCallback
|
|
3283
|
+
*/},{key:"loginAsync",value:function loginAsync(fCallback){var _this54=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var tmpCallback=fCallback;if(typeof tmpCallback!=='function'){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," loginAsync 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," loginAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeLoginAsync.bind(this));tmpAnticipate.anticipate(this.onLoginAsync.bind(this));tmpAnticipate.anticipate(this.onAfterLoginAsync.bind(this));// check and see if we should automatically trigger a data load
|
|
3284
|
+
if(this.options.AutoLoadDataAfterLogin){tmpAnticipate.anticipate(function(fNext){if(!_this54.isLoggedIn()){return fNext();}if(_this54.pict.LogNoisiness>1){_this54.log.trace("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.options.Name," auto loading data after login..."));}//TODO: should data load errors funnel here? this creates a weird coupling between login and data load callbacks
|
|
3285
|
+
_this54.loadDataAsync(function(pError){fNext(pError);});});}tmpAnticipate.wait(function(pError){if(_this54.pict.LogNoisiness>2){_this54.log.trace("PictApp [".concat(_this54.UUID,"]::[").concat(_this54.Hash,"] ").concat(_this54.options.Name," loginAsync() complete."));}_this54.lastLoginTimestamp=_this54.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3286
|
+
* Check if the application state is logged in. Defaults to true. Override this method in your application based on login requirements.
|
|
3287
|
+
*
|
|
3288
|
+
* @return {boolean}
|
|
3289
|
+
*/},{key:"isLoggedIn",value:function isLoggedIn(){return true;}/**
|
|
3290
|
+
* @param {(error?: Error) => void} fCallback
|
|
3291
|
+
*/},{key:"onAfterLoginAsync",value:function onAfterLoginAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterLoginAsync:"));}return fCallback();}/* -------------------------------------------------------------------------- *//* Code Section: Application LoadData *//* -------------------------------------------------------------------------- *//**
|
|
3292
|
+
* @param {(error?: Error) => void} fCallback
|
|
3293
|
+
*/},{key:"onBeforeLoadDataAsync",value:function onBeforeLoadDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeLoadDataAsync:"));}return fCallback();}/**
|
|
3294
|
+
* @param {(error?: Error) => void} fCallback
|
|
3295
|
+
*/},{key:"onLoadDataAsync",value:function onLoadDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onLoadDataAsync:"));}return fCallback();}/**
|
|
3296
|
+
* @param {(error?: Error) => void} fCallback
|
|
3297
|
+
*/},{key:"loadDataAsync",value:function loadDataAsync(fCallback){var _this55=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var tmpCallback=fCallback;if(typeof tmpCallback!=='function'){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," loadDataAsync 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," loadDataAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeLoadDataAsync.bind(this));// Walk through any loaded providers and load their data as well.
|
|
3298
|
+
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToLoadData=[];for(var i=0;i<tmpLoadedProviders.length;i++){var tmpProvider=this.pict.providers[tmpLoadedProviders[i]];if(tmpProvider.options.AutoLoadDataWithApp){tmpProvidersToLoadData.push(tmpProvider);}}// Sort the providers by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3299
|
+
tmpProvidersToLoadData.sort(function(a,b){return a.options.AutoLoadDataOrdinal-b.options.AutoLoadDataOrdinal;});for(var _i41=0,_tmpProvidersToLoadDa=tmpProvidersToLoadData;_i41<_tmpProvidersToLoadDa.length;_i41++){var _tmpProvider=_tmpProvidersToLoadDa[_i41];tmpAnticipate.anticipate(_tmpProvider.onBeforeLoadDataAsync.bind(_tmpProvider));}tmpAnticipate.anticipate(this.onLoadDataAsync.bind(this));//TODO: think about ways to parallelize these
|
|
3300
|
+
for(var _i42=0,_tmpProvidersToLoadDa2=tmpProvidersToLoadData;_i42<_tmpProvidersToLoadDa2.length;_i42++){var _tmpProvider2=_tmpProvidersToLoadDa2[_i42];tmpAnticipate.anticipate(_tmpProvider2.onLoadDataAsync.bind(_tmpProvider2));}tmpAnticipate.anticipate(this.onAfterLoadDataAsync.bind(this));for(var _i43=0,_tmpProvidersToLoadDa3=tmpProvidersToLoadData;_i43<_tmpProvidersToLoadDa3.length;_i43++){var _tmpProvider3=_tmpProvidersToLoadDa3[_i43];tmpAnticipate.anticipate(_tmpProvider3.onAfterLoadDataAsync.bind(_tmpProvider3));}tmpAnticipate.wait(/** @param {Error} [pError] */function(pError){if(_this55.pict.LogNoisiness>2){_this55.log.trace("PictApp [".concat(_this55.UUID,"]::[").concat(_this55.Hash,"] ").concat(_this55.options.Name," loadDataAsync() complete."));}_this55.lastLoadDataTimestamp=_this55.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3301
|
+
* @param {(error?: Error) => void} fCallback
|
|
3302
|
+
*/},{key:"onAfterLoadDataAsync",value:function onAfterLoadDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterLoadDataAsync:"));}return fCallback();}/* -------------------------------------------------------------------------- *//* Code Section: Application SaveData *//* -------------------------------------------------------------------------- *//**
|
|
3303
|
+
* @param {(error?: Error) => void} fCallback
|
|
3304
|
+
*/},{key:"onBeforeSaveDataAsync",value:function onBeforeSaveDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeSaveDataAsync:"));}return fCallback();}/**
|
|
3305
|
+
* @param {(error?: Error) => void} fCallback
|
|
3306
|
+
*/},{key:"onSaveDataAsync",value:function onSaveDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onSaveDataAsync:"));}return fCallback();}/**
|
|
3307
|
+
* @param {(error?: Error) => void} fCallback
|
|
3308
|
+
*/},{key:"saveDataAsync",value:function saveDataAsync(fCallback){var _this56=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var tmpCallback=fCallback;if(typeof tmpCallback!=='function'){this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," saveDataAsync 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," saveDataAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeSaveDataAsync.bind(this));// Walk through any loaded providers and load their data as well.
|
|
3309
|
+
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToSaveData=[];for(var i=0;i<tmpLoadedProviders.length;i++){var tmpProvider=this.pict.providers[tmpLoadedProviders[i]];if(tmpProvider.options.AutoSaveDataWithApp){tmpProvidersToSaveData.push(tmpProvider);}}// Sort the providers by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3310
|
+
tmpProvidersToSaveData.sort(function(a,b){return a.options.AutoSaveDataOrdinal-b.options.AutoSaveDataOrdinal;});for(var _i44=0,_tmpProvidersToSaveDa=tmpProvidersToSaveData;_i44<_tmpProvidersToSaveDa.length;_i44++){var _tmpProvider4=_tmpProvidersToSaveDa[_i44];tmpAnticipate.anticipate(_tmpProvider4.onBeforeSaveDataAsync.bind(_tmpProvider4));}tmpAnticipate.anticipate(this.onSaveDataAsync.bind(this));//TODO: think about ways to parallelize these
|
|
3311
|
+
for(var _i45=0,_tmpProvidersToSaveDa2=tmpProvidersToSaveData;_i45<_tmpProvidersToSaveDa2.length;_i45++){var _tmpProvider5=_tmpProvidersToSaveDa2[_i45];tmpAnticipate.anticipate(_tmpProvider5.onSaveDataAsync.bind(_tmpProvider5));}tmpAnticipate.anticipate(this.onAfterSaveDataAsync.bind(this));for(var _i46=0,_tmpProvidersToSaveDa3=tmpProvidersToSaveData;_i46<_tmpProvidersToSaveDa3.length;_i46++){var _tmpProvider6=_tmpProvidersToSaveDa3[_i46];tmpAnticipate.anticipate(_tmpProvider6.onAfterSaveDataAsync.bind(_tmpProvider6));}tmpAnticipate.wait(/** @param {Error} [pError] */function(pError){if(_this56.pict.LogNoisiness>2){_this56.log.trace("PictApp [".concat(_this56.UUID,"]::[").concat(_this56.Hash,"] ").concat(_this56.options.Name," saveDataAsync() complete."));}_this56.lastSaveDataTimestamp=_this56.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3312
|
+
* @param {(error?: Error) => void} fCallback
|
|
3313
|
+
*/},{key:"onAfterSaveDataAsync",value:function onAfterSaveDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterSaveDataAsync:"));}return fCallback();}/* -------------------------------------------------------------------------- *//* Code Section: Initialize Application *//* -------------------------------------------------------------------------- *//**
|
|
3277
3314
|
* @return {boolean}
|
|
3278
3315
|
*/},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeInitialize:"));}return true;}/**
|
|
3279
3316
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3285,23 +3322,23 @@ tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.A
|
|
|
3285
3322
|
* @return {boolean}
|
|
3286
3323
|
*/},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow APPLICATION [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();if('ConfigurationOnlyViews'in this.options){// Load all the configuration only views
|
|
3287
3324
|
for(var i=0;i<this.options.ConfigurationOnlyViews.length;i++){var tmpViewIdentifier=typeof this.options.ConfigurationOnlyViews[i].ViewIdentifier==='undefined'?"AutoView-".concat(this.fable.getUUID()):this.options.ConfigurationOnlyViews[i].ViewIdentifier;this.log.info("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," adding configuration only view: ").concat(tmpViewIdentifier));this.pict.addView(tmpViewIdentifier,this.options.ConfigurationOnlyViews[i]);}}this.onInitialize();// Walk through any loaded providers and initialize them as well.
|
|
3288
|
-
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var
|
|
3289
|
-
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
3290
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var
|
|
3291
|
-
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
3325
|
+
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var _i47=0;_i47<tmpLoadedProviders.length;_i47++){var tmpProvider=this.pict.providers[tmpLoadedProviders[_i47]];if(tmpProvider.options.AutoInitialize){tmpProvidersToInitialize.push(tmpProvider);}}// Sort the providers by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3326
|
+
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i48=0;_i48<tmpProvidersToInitialize.length;_i48++){tmpProvidersToInitialize[_i48].initialize();}// Now walk through any loaded views and initialize them as well.
|
|
3327
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var _i49=0;_i49<tmpLoadedViews.length;_i49++){var tmpView=this.pict.views[tmpLoadedViews[_i49]];if(tmpView.options.AutoInitialize){tmpViewsToInitialize.push(tmpView);}}// Sort the views by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3328
|
+
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i50=0;_i50<tmpViewsToInitialize.length;_i50++){tmpViewsToInitialize[_i50].initialize();}this.onAfterInitialize();if(this.options.AutoSolveAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto solving after initialization..."));}// Solve the template synchronously
|
|
3292
3329
|
this.solve();}// Now check and see if we should automatically render as well
|
|
3293
3330
|
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
|
|
3294
3331
|
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;}}/**
|
|
3295
3332
|
* @param {(error?: Error) => void} fCallback
|
|
3296
|
-
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var
|
|
3297
|
-
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){
|
|
3333
|
+
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this57=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
|
|
3334
|
+
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){_this57.log.error("PictApp [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.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
|
|
3298
3335
|
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.
|
|
3299
|
-
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var
|
|
3300
|
-
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
3336
|
+
var tmpLoadedProviders=Object.keys(this.pict.providers);var tmpProvidersToInitialize=[];for(var _i51=0;_i51<tmpLoadedProviders.length;_i51++){var tmpProvider=this.pict.providers[tmpLoadedProviders[_i51]];if(tmpProvider.options.AutoInitialize){tmpProvidersToInitialize.push(tmpProvider);}}// Sort the providers by their priority (if they are all priority 0, it will end up being add order due to JSON Object Property Key order stuff)
|
|
3337
|
+
tmpProvidersToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i52=0;_i52<tmpProvidersToInitialize.length;_i52++){tmpAnticipate.anticipate(tmpProvidersToInitialize[_i52].initializeAsync.bind(tmpProvidersToInitialize[_i52]));}// Now walk through any loaded views and initialize them as well.
|
|
3301
3338
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
3302
|
-
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var
|
|
3339
|
+
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var _i53=0;_i53<tmpLoadedViews.length;_i53++){var tmpView=this.pict.views[tmpLoadedViews[_i53]];if(tmpView.options.AutoInitialize){tmpViewsToInitialize.push(tmpView);}}// Sort the views by their priority
|
|
3303
3340
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3304
|
-
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var
|
|
3341
|
+
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i54=0;_i54<tmpViewsToInitialize.length;_i54++){var _tmpView=tmpViewsToInitialize[_i54];tmpAnticipate.anticipate(_tmpView.initializeAsync.bind(_tmpView));}tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));if(this.options.AutoLoginAfterInitialize){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.loginAsync.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){_this57.log.error("PictApp [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.options.Name," initializeAsync Error: ").concat(pError.message||pError),{stack:pError.stack});}_this57.initializeTimestamp=_this57.fable.log.getTimeStamp();if(_this57.pict.LogNoisiness>2){_this57.log.trace("PictApp [".concat(_this57.UUID,"]::[").concat(_this57.Hash,"] ").concat(_this57.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?
|
|
3305
3342
|
return tmpCallback();}}/**
|
|
3306
3343
|
* @return {boolean}
|
|
3307
3344
|
*/},{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;}/**
|
|
@@ -3317,11 +3354,11 @@ return tmpCallback();}}/**
|
|
|
3317
3354
|
*/},{key:"onMarshalFromViewsAsync",value:function onMarshalFromViewsAsync(fCallback){this.onMarshalFromViews();return fCallback();}/**
|
|
3318
3355
|
* @return {boolean}
|
|
3319
3356
|
*/},{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.
|
|
3320
|
-
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
|
|
3357
|
+
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 _i55=0;_i55<tmpViewsToMarshalFromViews.length;_i55++){tmpViewsToMarshalFromViews[_i55].marshalFromView();}this.onMarshalFromViews();this.onAfterMarshalFromViews();this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp();return true;}/**
|
|
3321
3358
|
* @param {(error?: Error) => void} fCallback
|
|
3322
|
-
*/},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var
|
|
3323
|
-
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){
|
|
3324
|
-
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
|
|
3359
|
+
*/},{key:"marshalFromViewsAsync",value:function marshalFromViewsAsync(fCallback){var _this58=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
3360
|
+
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){_this58.log.error("PictApp [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.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.
|
|
3361
|
+
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 _i56=0;_i56<tmpViewsToMarshalFromViews.length;_i56++){tmpAnticipate.anticipate(tmpViewsToMarshalFromViews[_i56].marshalFromViewAsync.bind(tmpViewsToMarshalFromViews[_i56]));}tmpAnticipate.anticipate(this.onMarshalFromViewsAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalFromViewsAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this58.pict.LogNoisiness>2){_this58.log.trace("PictApp [".concat(_this58.UUID,"]::[").concat(_this58.Hash,"] ").concat(_this58.options.Name," marshalFromViewsAsync() complete."));}_this58.lastMarshalFromViewsTimestamp=_this58.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3325
3362
|
* @return {boolean}
|
|
3326
3363
|
*/},{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;}/**
|
|
3327
3364
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3336,11 +3373,11 @@ var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToMarshalFromViews=[
|
|
|
3336
3373
|
*/},{key:"onMarshalToViewsAsync",value:function onMarshalToViewsAsync(fCallback){this.onMarshalToViews();return fCallback();}/**
|
|
3337
3374
|
* @return {boolean}
|
|
3338
3375
|
*/},{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.
|
|
3339
|
-
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
|
|
3376
|
+
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 _i57=0;_i57<tmpViewsToMarshalToViews.length;_i57++){tmpViewsToMarshalToViews[_i57].marshalToView();}this.onMarshalToViews();this.onAfterMarshalToViews();this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp();return true;}/**
|
|
3340
3377
|
* @param {(error?: Error) => void} fCallback
|
|
3341
|
-
*/},{key:"marshalToViewsAsync",value:function marshalToViewsAsync(fCallback){var
|
|
3342
|
-
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){
|
|
3343
|
-
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
|
|
3378
|
+
*/},{key:"marshalToViewsAsync",value:function marshalToViewsAsync(fCallback){var _this59=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
3379
|
+
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){_this59.log.error("PictApp [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.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.
|
|
3380
|
+
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 _i58=0;_i58<tmpViewsToMarshalToViews.length;_i58++){tmpAnticipate.anticipate(tmpViewsToMarshalToViews[_i58].marshalToViewAsync.bind(tmpViewsToMarshalToViews[_i58]));}tmpAnticipate.anticipate(this.onMarshalToViewsAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalToViewsAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this59.pict.LogNoisiness>2){_this59.log.trace("PictApp [".concat(_this59.UUID,"]::[").concat(_this59.Hash,"] ").concat(_this59.options.Name," marshalToViewsAsync() complete."));}_this59.lastMarshalToViewsTimestamp=_this59.fable.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3344
3381
|
* @return {boolean}
|
|
3345
3382
|
*/},{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;}/**
|
|
3346
3383
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3368,8 +3405,8 @@ var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpVie
|
|
|
3368
3405
|
* @param {(error?: Error) => void} [fCallback] - The callback, if all other parameters are provided.
|
|
3369
3406
|
*
|
|
3370
3407
|
* TODO: Should we support objects for pTemplateDataAddress for parity with pict-view?
|
|
3371
|
-
*/},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var
|
|
3372
|
-
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){
|
|
3408
|
+
*/},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this60=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
|
|
3409
|
+
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){_this60.log.error("PictApp [".concat(_this60.UUID,"]::[").concat(_this60.Hash,"] ").concat(_this60.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);}/**
|
|
3373
3410
|
* @return {boolean}
|
|
3374
3411
|
*/},{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;}/**
|
|
3375
3412
|
* @param {(error?: Error) => void} fCallback
|
|
@@ -3379,28 +3416,28 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateDataAddr
|
|
|
3379
3416
|
* @param {(error?: Error) => void} fCallback
|
|
3380
3417
|
*/},{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);}/**
|
|
3381
3418
|
* @return {void}
|
|
3382
|
-
*/},{key:"renderAutoViews",value:function renderAutoViews(){var
|
|
3419
|
+
*/},{key:"renderAutoViews",value:function renderAutoViews(){var _this61=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
|
|
3383
3420
|
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
3384
3421
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3385
|
-
tmpLoadedViews.sort(function(a,b){return
|
|
3422
|
+
tmpLoadedViews.sort(function(a,b){return _this61.pict.views[a].options.AutoRenderOrdinal-_this61.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."));}}/**
|
|
3386
3423
|
* @param {(error?: Error) => void} fCallback
|
|
3387
|
-
*/},{key:"renderAutoViewsAsync",value:function renderAutoViewsAsync(fCallback){var
|
|
3388
|
-
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){
|
|
3424
|
+
*/},{key:"renderAutoViewsAsync",value:function renderAutoViewsAsync(fCallback){var _this62=this;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');// Allow the callback to be passed in as the last parameter no matter what
|
|
3425
|
+
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){_this62.log.error("PictApp [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.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
|
|
3389
3426
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
3390
3427
|
var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their priority
|
|
3391
3428
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3392
|
-
tmpLoadedViews.sort(function(a,b){return
|
|
3429
|
+
tmpLoadedViews.sort(function(a,b){return _this62.pict.views[a].options.AutoRenderOrdinal-_this62.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){_this62.lastAutoRenderTimestamp=_this62.fable.log.getTimeStamp();if(_this62.pict.LogNoisiness>0){_this62.log.trace("PictApp [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.options.Name," renderAutoViewsAsync complete."));}return tmpCallback(pError);});}/**
|
|
3393
3430
|
* @return {boolean}
|
|
3394
|
-
*/},{key:"isPictApplication",get:function get(){return true;}}]);}(libFableServiceBase);module.exports=PictApplication;},{"../package.json":138,"fable-serviceproviderbase":59}],140:[function(require,module,exports){module.exports={"name":"pict-provider","version":"1.0.
|
|
3431
|
+
*/},{key:"isPictApplication",get:function get(){return true;}}]);}(libFableServiceBase);module.exports=PictApplication;},{"../package.json":138,"fable-serviceproviderbase":59}],140:[function(require,module,exports){module.exports={"name":"pict-provider","version":"1.0.6","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","lint":"eslint source/**","types":"tsc -p ."},"types":"types/source/Pict-Provider.d.ts","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":{"@eslint/js":"^9.28.0","eslint":"^9.28.0","pict":"^1.0.270","quackage":"^1.0.41","typescript":"^5.8.3"},"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"]}};},{}],141:[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.
|
|
3395
3432
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
3396
|
-
AutoInitialize:true,AutoInitializeOrdinal:0,AutoLoadDataWithApp:true,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(
|
|
3433
|
+
AutoInitialize:true,AutoInitializeOrdinal:0,AutoLoadDataWithApp:true,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase16){/**
|
|
3397
3434
|
* @param {import('fable')} pFable - The Fable instance.
|
|
3398
3435
|
* @param {Record<string, any>} [pOptions] - The options for the provider.
|
|
3399
3436
|
* @param {string} [pServiceHash] - The service hash for the provider.
|
|
3400
|
-
*/function PictProvider(pFable,pOptions,pServiceHash){var
|
|
3401
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);
|
|
3402
|
-
|
|
3403
|
-
|
|
3437
|
+
*/function PictProvider(pFable,pOptions,pServiceHash){var _this63;_classCallCheck2(this,PictProvider);// Intersect default options, parent constructor, service information
|
|
3438
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);_this63=_callSuper(this,PictProvider,[pFable,tmpOptions,pServiceHash]);/** @type {import('fable') & import('pict') & { instantiateServiceProviderWithoutRegistration(pServiceType: string, pOptions?: Record<string, any>, pCustomServiceHash?: string): any }} */_this63.fable;/** @type {import('fable') & import('pict') & { instantiateServiceProviderWithoutRegistration(pServiceType: string, pOptions?: Record<string, any>, pCustomServiceHash?: string): any }} */_this63.pict;/** @type {any} */_this63.log;/** @type {Record<string, any>} */_this63.options;/** @type {string} */_this63.UUID;/** @type {string} */_this63.Hash;if(!_this63.options.ProviderIdentifier){_this63.options.ProviderIdentifier="AutoProviderID-".concat(_this63.fable.getUUID());}_this63.serviceType='PictProvider';/** @type {Record<string, any>} */_this63._Package=libPackage;// Convenience and consistency naming
|
|
3439
|
+
_this63.pict=_this63.fable;// Wire in the essential Pict application state
|
|
3440
|
+
/** @type {Record<string, any>} */_this63.AppData=_this63.pict.AppData;/** @type {Record<string, any>} */_this63.Bundle=_this63.pict.Bundle;_this63.initializeTimestamp=false;_this63.lastSolvedTimestamp=false;for(var i=0;i<_this63.options.Templates.length;i++){var tmpDefaultTemplate=_this63.options.Templates[i];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this63.log.error("PictProvider [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ProviderIdentifier," could not load Default Template ").concat(i," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictProvider [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ProviderIdentifier," options object.");}_this63.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}return _this63;}/* -------------------------------------------------------------------------- *//* Code Section: Initialization *//* -------------------------------------------------------------------------- */_inherits(PictProvider,_libFableServiceBase16);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 _this64=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){_this64.initializeTimestamp=_this64.pict.log.getTimeStamp();if(pError){_this64.log.error("PictProvider [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.options.ProviderIdentifier," initialization failed: ").concat(pError.message||pError),{Stack:pError.stack});}else if(_this64.pict.LogNoisiness>0){_this64.log.info("PictProvider [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.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?
|
|
3404
3441
|
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();}/**
|
|
3405
3442
|
* @param {(pError?: Error) => void} fCallback - The callback to call after the data pre-load.
|
|
3406
3443
|
*/},{key:"onBeforeLoadDataAsync",value:function onBeforeLoadDataAsync(fCallback){return fCallback();}/**
|
|
@@ -3409,16 +3446,24 @@ return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize
|
|
|
3409
3446
|
* @param {(pError?: Error) => void} fCallback - The callback to call after the data load.
|
|
3410
3447
|
*/},{key:"onLoadDataAsync",value:function onLoadDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onLoadDataAsync:"));}return fCallback();}/**
|
|
3411
3448
|
* @param {(pError?: Error) => void} fCallback - The callback to call after the data post-load.
|
|
3412
|
-
*/},{key:"onAfterLoadDataAsync",value:function onAfterLoadDataAsync(fCallback){return fCallback();}
|
|
3449
|
+
*/},{key:"onAfterLoadDataAsync",value:function onAfterLoadDataAsync(fCallback){return fCallback();}/**
|
|
3450
|
+
* @param {(pError?: Error) => void} fCallback - The callback to call after the data pre-load.
|
|
3451
|
+
*/},{key:"onBeforeSaveDataAsync",value:function onBeforeSaveDataAsync(fCallback){return fCallback();}/**
|
|
3452
|
+
* Hook to allow the provider to load data during application data load.
|
|
3453
|
+
*
|
|
3454
|
+
* @param {(pError?: Error) => void} fCallback - The callback to call after the data load.
|
|
3455
|
+
*/},{key:"onSaveDataAsync",value:function onSaveDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onSaveDataAsync:"));}return fCallback();}/**
|
|
3456
|
+
* @param {(pError?: Error) => void} fCallback - The callback to call after the data post-load.
|
|
3457
|
+
*/},{key:"onAfterSaveDataAsync",value:function onAfterSaveDataAsync(fCallback){return fCallback();}}]);}(libFableServiceBase);module.exports=PictProvider;},{"../package.json":140,"fable-serviceproviderbase":59}],142:[function(require,module,exports){module.exports={"name":"pict-template","version":"1.0.11","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.272","quackage":"^1.0.41","typescript":"^5.8.3"},"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"}};},{}],143:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');/** @typedef {import('pict') & {
|
|
3413
3458
|
* [key: string]: any, // represent services for now as a workaround
|
|
3414
3459
|
* }} Pict *//**
|
|
3415
3460
|
* @class PictTemplateExpression
|
|
3416
3461
|
* @classdesc The PictTemplateExpression class is a service provider for the pict anti-framework that provides template rendering services.
|
|
3417
|
-
*/var PictTemplateExpression=/*#__PURE__*/function(
|
|
3462
|
+
*/var PictTemplateExpression=/*#__PURE__*/function(_libFableServiceBase17){/**
|
|
3418
3463
|
* @param {Pict} pFable - The Fable Framework instance
|
|
3419
|
-
* @param {any} [pOptions] - The options for the service
|
|
3420
|
-
* @param {
|
|
3421
|
-
*/function PictTemplateExpression(pFable,pOptions,pServiceHash){var
|
|
3464
|
+
* @param {Record<string, any>} [pOptions] - The options for the service
|
|
3465
|
+
* @param {string} [pServiceHash] - The hash of the service
|
|
3466
|
+
*/function PictTemplateExpression(pFable,pOptions,pServiceHash){var _this65;_classCallCheck2(this,PictTemplateExpression);_this65=_callSuper(this,PictTemplateExpression,[pFable,pOptions,pServiceHash]);/** @type {Pict} */_this65.fable;/** @type {Pict} */_this65.pict=_this65.fable;_this65.serviceType='PictTemplate';/** @type {Record<string, any>} */_this65._Package=libPackage;return _this65;}/**
|
|
3422
3467
|
* Render a template expression, returning a string with the resulting content.
|
|
3423
3468
|
*
|
|
3424
3469
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -3426,7 +3471,7 @@ return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize
|
|
|
3426
3471
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
3427
3472
|
*
|
|
3428
3473
|
* @return {string} The rendered template
|
|
3429
|
-
*/_inherits(PictTemplateExpression,
|
|
3474
|
+
*/_inherits(PictTemplateExpression,_libFableServiceBase17);return _createClass2(PictTemplateExpression,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){return'';}/**
|
|
3430
3475
|
* Render a template expression, deliver a string with the resulting content to a callback function.
|
|
3431
3476
|
*
|
|
3432
3477
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -3446,12 +3491,12 @@ return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize
|
|
|
3446
3491
|
* Read a value from a nested object using a dot notation string.
|
|
3447
3492
|
*
|
|
3448
3493
|
* @param {string} pAddress - The address to resolve
|
|
3449
|
-
* @param {any} pRecord - The record to resolve
|
|
3450
|
-
* @param {Array<any>} pContextArray - The context array to resolve (optional)
|
|
3451
|
-
* @param {any} pRootDataObject - The root data object to resolve (optional)
|
|
3494
|
+
* @param {Record<string, any>} pRecord - The record to resolve
|
|
3495
|
+
* @param {Array<any>} [pContextArray] - The context array to resolve (optional)
|
|
3496
|
+
* @param {Record<string, any>} [pRootDataObject] - The root data object to resolve (optional)
|
|
3452
3497
|
*
|
|
3453
3498
|
* @return {any} The value at the given address, or undefined
|
|
3454
|
-
*/},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this.pict];var tmpRootDataObject=_typeof(pRootDataObject)==='object'?pRootDataObject:{};tmpRootDataObject.Pict=this.pict;tmpRootDataObject.AppData=this.pict.AppData;tmpRootDataObject.Bundle=this.pict.Bundle;tmpRootDataObject.Context=tmpContextArray;tmpRootDataObject.Record=pRecord;return this.pict.manifest.getValueByHash(tmpRootDataObject,pAddress);}}]);}(libFableServiceBase);module.exports=PictTemplateExpression;module.exports.template_hash='Default';},{"../package.json":142,"fable-serviceproviderbase":59}],144:[function(require,module,exports){module.exports={"name":"pict-view","version":"1.0.
|
|
3499
|
+
*/},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this.pict];var tmpRootDataObject=_typeof(pRootDataObject)==='object'?pRootDataObject:{};tmpRootDataObject.Fable=this.pict;tmpRootDataObject.Pict=this.pict;tmpRootDataObject.AppData=this.pict.AppData;tmpRootDataObject.Bundle=this.pict.Bundle;tmpRootDataObject.Context=tmpContextArray;tmpRootDataObject.Record=pRecord;return this.pict.manifest.getValueByHash(tmpRootDataObject,pAddress);}}]);}(libFableServiceBase);module.exports=PictTemplateExpression;module.exports.template_hash='Default';},{"../package.json":142,"fable-serviceproviderbase":59}],144:[function(require,module,exports){module.exports={"name":"pict-view","version":"1.0.61","description":"Pict View Base Class","main":"source/Pict-View.js","scripts":{"test":"./node_modules/.bin/mocha -u tdd -R spec","start":"node source/Pict-View.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-view-image:local","docker-dev-run":"docker run -it -d --name pict-view-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-view\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-view-image:local","docker-dev-shell":"docker exec -it pict-view-dev /bin/bash","types":"tsc -p .","lint":"eslint source/**"},"types":"types/source/Pict-View.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":{"@eslint/js":"^9.28.0","browser-env":"^3.3.0","eslint":"^9.28.0","pict":"^1.0.272","quackage":"^1.0.41","typescript":"^5.8.3"},"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":"^3.1.11","fable-serviceproviderbase":"^3.0.15"}};},{}],145:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
3455
3500
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
3456
3501
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
3457
3502
|
// After the App initializes, render will be called as soon as it's added.
|
|
@@ -3468,25 +3513,25 @@ AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSS
|
|
|
3468
3513
|
* @property {string} [TestAddress] - The address to use for testing the renderable.
|
|
3469
3514
|
*//**
|
|
3470
3515
|
* Represents a view in the Pict ecosystem.
|
|
3471
|
-
*/var PictView=/*#__PURE__*/function(
|
|
3516
|
+
*/var PictView=/*#__PURE__*/function(_libFableServiceBase18){/**
|
|
3472
3517
|
* @param {any} pFable - The Fable object that this service is attached to.
|
|
3473
3518
|
* @param {any} [pOptions] - (optional) The options for this service.
|
|
3474
3519
|
* @param {string} [pServiceHash] - (optional) The hash of the service.
|
|
3475
|
-
*/function PictView(pFable,pOptions,pServiceHash){var
|
|
3476
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);
|
|
3477
|
-
/** @type {any} */
|
|
3478
|
-
/** @type {import('pict') & { log: any, instantiateServiceProviderWithoutRegistration: (hash: String) => any }} */
|
|
3479
|
-
|
|
3520
|
+
*/function PictView(pFable,pOptions,pServiceHash){var _this66;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
3521
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this66=_callSuper(this,PictView,[pFable,tmpOptions,pServiceHash]);//FIXME: add types to fable and ancillaries
|
|
3522
|
+
/** @type {any} */_this66.fable;/** @type {any} */_this66.options;/** @type {String} */_this66.UUID;/** @type {String} */_this66.Hash;/** @type {any} */_this66.log;if(!_this66.options.ViewIdentifier){_this66.options.ViewIdentifier="AutoViewID-".concat(_this66.fable.getUUID());}_this66.serviceType='PictView';/** @type {Record<string, any>} */_this66._Package=libPackage;// Convenience and consistency naming
|
|
3523
|
+
/** @type {import('pict') & { log: any, instantiateServiceProviderWithoutRegistration: (hash: String) => any }} */_this66.pict=_this66.fable;// Wire in the essential Pict application state
|
|
3524
|
+
_this66.AppData=_this66.pict.AppData;_this66.Bundle=_this66.pict.Bundle;/** @type {PictTimestamp} */_this66.initializeTimestamp=false;/** @type {PictTimestamp} */_this66.lastSolvedTimestamp=false;/** @type {PictTimestamp} */_this66.lastRenderedTimestamp=false;/** @type {PictTimestamp} */_this66.lastMarshalFromViewTimestamp=false;/** @type {PictTimestamp} */_this66.lastMarshalToViewTimestamp=false;// Load all templates from the array in the options
|
|
3480
3525
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
3481
|
-
for(var i=0;i<
|
|
3526
|
+
for(var i=0;i<_this66.options.Templates.length;i++){var tmpTemplate=_this66.options.Templates[i];if(!('Hash'in tmpTemplate)||!('Template'in tmpTemplate)){_this66.log.error("PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," options object.");}_this66.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
3482
3527
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
3483
|
-
for(var
|
|
3484
|
-
if(
|
|
3528
|
+
for(var _i59=0;_i59<_this66.options.DefaultTemplates.length;_i59++){var tmpDefaultTemplate=_this66.options.DefaultTemplates[_i59];if(!('Postfix'in tmpDefaultTemplate)||!('Template'in tmpDefaultTemplate)){_this66.log.error("PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," could not load Default Template ").concat(_i59," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," options object.");}_this66.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load the CSS if it's available
|
|
3529
|
+
if(_this66.options.CSS){var tmpCSSHash=_this66.options.CSSHash?_this66.options.CSSHash:"View-".concat(_this66.options.ViewIdentifier);var tmpCSSProvider=_this66.options.CSSProvider?_this66.options.CSSProvider:tmpCSSHash;_this66.pict.CSSMap.addCSS(tmpCSSHash,_this66.options.CSS,tmpCSSProvider,_this66.options.CSSPriority);}// Load all renderables
|
|
3485
3530
|
// Renderables are launchable renderable instructions with templates
|
|
3486
3531
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
3487
3532
|
// The only parts that are necessary are Identifier and Template
|
|
3488
3533
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
3489
|
-
/** @type {Object<String, Renderable>} */
|
|
3534
|
+
/** @type {Object<String, Renderable>} */_this66.renderables={};for(var _i60=0;_i60<_this66.options.Renderables.length;_i60++){/** @type {Renderable} */var tmpRenderable=_this66.options.Renderables[_i60];_this66.addRenderable(tmpRenderable);}return _this66;}/**
|
|
3490
3535
|
* Adds a renderable to the view.
|
|
3491
3536
|
*
|
|
3492
3537
|
* @param {string | Renderable} pRenderableHash - The hash of the renderable, or a renderable object.
|
|
@@ -3494,7 +3539,7 @@ if(_this61.options.CSS){var tmpCSSHash=_this61.options.CSSHash?_this61.options.C
|
|
|
3494
3539
|
* @param {string} [pDefaultTemplateRecordAddress] - (optional) The default data address for the template.
|
|
3495
3540
|
* @param {string} [pDefaultDestinationAddress] - (optional) The default destination address for the renderable.
|
|
3496
3541
|
* @param {RenderMethod} [pRenderMethod=replace] - (optional) The method to use when rendering the renderable (ex. 'replace').
|
|
3497
|
-
*/_inherits(PictView,
|
|
3542
|
+
*/_inherits(PictView,_libFableServiceBase18);return _createClass2(PictView,[{key:"addRenderable",value:function addRenderable(pRenderableHash,pTemplateHash,pDefaultTemplateRecordAddress,pDefaultDestinationAddress,pRenderMethod){/** @type {Renderable} */var tmpRenderable;if(_typeof(pRenderableHash)=='object'){// The developer passed in the renderable as an object.
|
|
3498
3543
|
// Use theirs instead!
|
|
3499
3544
|
tmpRenderable=pRenderableHash;}else{/** @type {RenderMethod} */var tmpRenderMethod=typeof pRenderMethod!=='string'?pRenderMethod:'replace';tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateRecordAddress:pDefaultTemplateRecordAddress,ContentDestinationAddress:pDefaultDestinationAddress,RenderMethod:tmpRenderMethod};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}/* -------------------------------------------------------------------------- *//* Code Section: Initialization *//* -------------------------------------------------------------------------- *//**
|
|
3500
3545
|
* Lifecycle hook that triggers before the view is initialized.
|
|
@@ -3514,7 +3559,7 @@ tmpRenderable=pRenderableHash;}else{/** @type {RenderMethod} */var tmpRenderMeth
|
|
|
3514
3559
|
* Performs view initialization (async flow).
|
|
3515
3560
|
*
|
|
3516
3561
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3517
|
-
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var
|
|
3562
|
+
*/},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this67=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){_this67.log.error("PictView [".concat(_this67.UUID,"]::[").concat(_this67.Hash,"] ").concat(_this67.options.ViewIdentifier," initialization failed: ").concat(pError.message||pError),{stack:pError.stack});}_this67.initializeTimestamp=_this67.pict.log.getTimeStamp();if(_this67.pict.LogNoisiness>0){_this67.log.info("PictView [".concat(_this67.UUID,"]::[").concat(_this67.Hash,"] ").concat(_this67.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?
|
|
3518
3563
|
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;}/**
|
|
3519
3564
|
* Lifecycle hook that triggers after the view is initialized (async flow).
|
|
3520
3565
|
*
|
|
@@ -3568,10 +3613,10 @@ this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord,tmpConten
|
|
|
3568
3613
|
* @param {ErrorCallback} [fCallback] - The callback to call when the async operation is complete.
|
|
3569
3614
|
*
|
|
3570
3615
|
* @return {void}
|
|
3571
|
-
*/},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var
|
|
3572
|
-
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:
|
|
3573
|
-
|
|
3574
|
-
|
|
3616
|
+
*/},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var _this68=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
|
|
3617
|
+
/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:null;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){_this68.log.error("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.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(new 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;if(tmpRenderableHash=='__Virtual'){tmpRenderable={RenderableHash:'__Virtual',TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,DestinationAddress:pRenderDestinationAddress,RenderMethod:'virtual-assignment'};}else{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(new 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(new 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){_this68.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord);_this68.onBeforeRenderAsync(fOnBeforeRenderCallback);});var tmpContent;tmpAnticipate.anticipate(function(fAsyncTemplateCallback){// Render the template (asynchronously)
|
|
3618
|
+
_this68.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpRecord,function(pError,pContent){if(pError){_this68.log.error("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.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(_this68.pict.LogNoisiness>0){_this68.log.trace("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.options.ViewIdentifier," Assigning Renderable[").concat(tmpRenderableHash,"] content length ").concat(pContent.length," to Destination [").concat(tmpRenderDestinationAddress,"] using Async render method ").concat(tmpRenderable.RenderMethod,"."));}_this68.pict.ContentAssignment.projectContent(tmpRenderable.RenderMethod,tmpRenderDestinationAddress,pContent,tmpRenderable.TestAddress);// Execute the developer-overridable asynchronous post-render behavior
|
|
3619
|
+
_this68.lastRenderedTimestamp=_this68.pict.log.getTimeStamp();return fAsyncTemplateCallback();},[_this68]);});tmpAnticipate.anticipate(function(fOnAfterRenderCallback){_this68.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord,tmpContent);_this68.onAfterRenderAsync(fOnAfterRenderCallback);});tmpAnticipate.wait(tmpCallback);}/**
|
|
3575
3620
|
* Renders the default renderable.
|
|
3576
3621
|
*
|
|
3577
3622
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
@@ -3583,10 +3628,13 @@ this.renderAsync(fCallback);}/**
|
|
|
3583
3628
|
*/},{key:"basicRender",value:function basicRender(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress){var tmpRenderOptions=this.buildRenderOptions(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress);if(tmpRenderOptions.Valid){this.assignRenderContent(tmpRenderOptions.Renderable,tmpRenderOptions.DestinationAddress,this.pict.parseTemplateByHash(tmpRenderOptions.Renderable.TemplateHash,tmpRenderOptions.Record,null,[this]));return true;}else{this.log.error("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."));return false;}}/**
|
|
3584
3629
|
* @param {string|ErrorCallback} [pRenderableHash] - The hash of the renderable to render.
|
|
3585
3630
|
* @param {string|ErrorCallback} [pRenderDestinationAddress] - The address where the renderable will be rendered.
|
|
3586
|
-
* @param {string|
|
|
3631
|
+
* @param {string|Object|ErrorCallback} [pTemplateRecordAddress] - The address of (or actual obejct) where the data for the template is stored.
|
|
3587
3632
|
* @param {ErrorCallback} [fCallback] - The callback to call when the async operation is complete.
|
|
3588
|
-
*/},{key:"basicRenderAsync",value:function basicRenderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var
|
|
3589
|
-
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:
|
|
3633
|
+
*/},{key:"basicRenderAsync",value:function basicRenderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var _this69=this;// Allow the callback to be passed in as the last parameter no matter what
|
|
3634
|
+
/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:null;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," basicRenderAsync 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," basicRenderAsync Auto Callback Error: ").concat(pError),pError);}};}var tmpRenderOptions=this.buildRenderOptions(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress);if(tmpRenderOptions.Valid){this.pict.parseTemplateByHash(tmpRenderOptions.Renderable.TemplateHash,tmpRenderOptions.Record,/**
|
|
3635
|
+
* @param {Error} [pError] - The error that occurred during template parsing.
|
|
3636
|
+
* @param {string} [pContent] - The content that was rendered from the template.
|
|
3637
|
+
*/function(pError,pContent){if(pError){_this69.log.error("PictView [".concat(_this69.UUID,"]::[").concat(_this69.Hash,"] ").concat(_this69.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderOptions.RenderableHash," because it did not parse the template."),pError);return tmpCallback(pError);}_this69.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(new Error(tmpErrorMessage));}}/**
|
|
3590
3638
|
* Lifecycle hook that triggers after the view is rendered.
|
|
3591
3639
|
*
|
|
3592
3640
|
* @param {Renderable} pRenderable - The renderable that was rendered.
|
|
@@ -3617,7 +3665,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3617
3665
|
* Performs view solving and triggers lifecycle hooks (async flow).
|
|
3618
3666
|
*
|
|
3619
3667
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3620
|
-
*/},{key:"solveAsync",value:function solveAsync(fCallback){var
|
|
3668
|
+
*/},{key:"solveAsync",value:function solveAsync(fCallback){var _this70=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:null;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){_this70.log.error("PictView [".concat(_this70.UUID,"]::[").concat(_this70.Hash,"] ").concat(_this70.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(_this70.pict.LogNoisiness>2){_this70.log.trace("PictView [".concat(_this70.UUID,"]::[").concat(_this70.Hash,"] ").concat(_this70.options.ViewIdentifier," solveAsync() complete."));}_this70.lastSolvedTimestamp=_this70.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3621
3669
|
* Lifecycle hook that triggers after the view is solved.
|
|
3622
3670
|
*/},{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;}/**
|
|
3623
3671
|
* Lifecycle hook that triggers after the view is solved (async flow).
|
|
@@ -3645,7 +3693,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3645
3693
|
* Marshals data from the view (async flow).
|
|
3646
3694
|
*
|
|
3647
3695
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3648
|
-
*/},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var
|
|
3696
|
+
*/},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var _this71=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:null;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){_this71.log.error("PictView [".concat(_this71.UUID,"]::[").concat(_this71.Hash,"] ").concat(_this71.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(_this71.pict.LogNoisiness>2){_this71.log.trace("PictView [".concat(_this71.UUID,"]::[").concat(_this71.Hash,"] ").concat(_this71.options.ViewIdentifier," marshalFromViewAsync() complete."));}_this71.lastMarshalFromViewTimestamp=_this71.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3649
3697
|
* Lifecycle hook that triggers after data is marshaled from the view.
|
|
3650
3698
|
*/},{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;}/**
|
|
3651
3699
|
* Lifecycle hook that triggers after data is marshaled from the view (async flow).
|
|
@@ -3671,7 +3719,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3671
3719
|
* Marshals data into the view (async flow).
|
|
3672
3720
|
*
|
|
3673
3721
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3674
|
-
*/},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var
|
|
3722
|
+
*/},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var _this72=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:null;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){_this72.log.error("PictView [".concat(_this72.UUID,"]::[").concat(_this72.Hash,"] ").concat(_this72.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(_this72.pict.LogNoisiness>2){_this72.log.trace("PictView [".concat(_this72.UUID,"]::[").concat(_this72.Hash,"] ").concat(_this72.options.ViewIdentifier," marshalToViewAsync() complete."));}_this72.lastMarshalToViewTimestamp=_this72.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3675
3723
|
* Lifecycle hook that triggers after data is marshaled into the view.
|
|
3676
3724
|
*/},{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;}/**
|
|
3677
3725
|
* Lifecycle hook that triggers after data is marshaled into the view (async flow).
|
|
@@ -3780,7 +3828,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
3780
3828
|
* @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.
|
|
3781
3829
|
* @return {bool} True if adding the pattern was successful
|
|
3782
3830
|
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,fParser){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
|
|
3783
|
-
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var
|
|
3831
|
+
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}var tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(var _i61=0;_i61<tmpPatternEnd.length;_i61++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i61],_i61);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(){return fParser;}:function(pData){return pData;};return true;}}]);}();module.exports=WordTree;},{}],149:[function(require,module,exports){// shim for using process in browser
|
|
3784
3832
|
var process=module.exports={};// cached from whatever global is present so that test runners that stub it
|
|
3785
3833
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
3786
3834
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
@@ -4110,7 +4158,7 @@ if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHR
|
|
|
4110
4158
|
*/function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}ClientRequest.prototype._onXHRProgress=function(){var self=this;self._resetTimers(false);if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress(self._resetTimers.bind(self));};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode,self._resetTimers.bind(self));self._response.on('error',function(err){self.emit('error',err);});self.emit('response',self._response);};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb();};ClientRequest.prototype._resetTimers=function(done){var self=this;global.clearTimeout(self._socketTimer);self._socketTimer=null;if(done){global.clearTimeout(self._fetchTimer);self._fetchTimer=null;}else if(self._socketTimeout){self._socketTimer=global.setTimeout(function(){self.emit('timeout');},self._socketTimeout);}};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(err){var self=this;self._destroyed=true;self._resetTimers(true);if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();else if(self._fetchAbortController)self._fetchAbortController.abort();if(err)self.emit('error',err);};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==='function'){cb=data;data=undefined;}stream.Writable.prototype.end.call(self,data,encoding,cb);};ClientRequest.prototype.setTimeout=function(timeout,cb){var self=this;if(cb)self.once('timeout',cb);self._socketTimeout=timeout;self._resetTimers(false);};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
|
|
4111
4159
|
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":167,"./response":169,"_process":149,"buffer":20,"inherits":114,"readable-stream":184}],169:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,resetTimers){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
|
|
4112
4160
|
self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
|
|
4113
|
-
process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){var _read=function read(){reader.read().then(function(result){if(self._destroyed)return;resetTimers(result.done);if(result.done){self.push(null);return;}self.push(Buffer.from(result.value));_read();})
|
|
4161
|
+
process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){var _read=function read(){reader.read().then(function(result){if(self._destroyed)return;resetTimers(result.done);if(result.done){self.push(null);return;}self.push(Buffer.from(result.value));_read();}).catch(function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});};self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header);});if(capability.writableStream){var writable=new WritableStream({write:function write(chunk){resetTimers(false);return new Promise(function(resolve,reject){if(self._destroyed){reject();}else if(self.push(Buffer.from(chunk))){resolve();}else{self._resumeFetch=resolve;}});},close:function close(){resetTimers(true);if(!self._destroyed)self.push(null);},abort:function abort(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);}});try{response.body.pipeTo(writable).catch(function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});return;}catch(e){}// pipeTo method isn't defined. Can't find a better way to feature test this
|
|
4114
4162
|
}// fallback for when writableStream or pipeTo aren't available
|
|
4115
4163
|
var reader=response.body.getReader();_read();}else{self._xhr=xhr;self._pos=0;self.url=xhr.responseURL;self.statusCode=xhr.status;self.statusMessage=xhr.statusText;var headers=xhr.getAllResponseHeaders().split(/\r?\n/);headers.forEach(function(header){var matches=header.match(/^([^:]+):\s*(.*)/);if(matches){var key=matches[1].toLowerCase();if(key==='set-cookie'){if(self.headers[key]===undefined){self.headers[key]=[];}self.headers[key].push(matches[2]);}else if(self.headers[key]!==undefined){self.headers[key]+=', '+matches[2];}else{self.headers[key]=matches[2];}self.rawHeaders.push(matches[1],matches[2]);}});self._charset='x-user-defined';if(!capability.overrideMimeType){var mimeType=self.rawHeaders['mime-type'];if(mimeType){var charsetMatch=mimeType.match(/;\s*charset=([^;])(;|$)/);if(charsetMatch){self._charset=charsetMatch[1].toLowerCase();}}if(!self._charset)self._charset='utf-8';// best guess
|
|
4116
4164
|
}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){var self=this;var resolve=self._resumeFetch;if(resolve){self._resumeFetch=null;resolve();}};IncomingMessage.prototype._onXHRProgress=function(resetTimers){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case'text':response=xhr.responseText;if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==='x-user-defined'){var buffer=Buffer.alloc(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&0xff;self.push(buffer);}else{self.push(newData,self._charset);}self._pos=response.length;}break;case'arraybuffer':if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(Buffer.from(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
|
|
@@ -4611,7 +4659,7 @@ var realHasInstance;if(typeof Symbol==='function'&&Symbol.hasInstance&&typeof Fu
|
|
|
4611
4659
|
// Checking for a Stream.Duplex instance is faster here instead of inside
|
|
4612
4660
|
// the WritableState constructor, at least with V8 6.5
|
|
4613
4661
|
var isDuplex=this instanceof Duplex;if(!isDuplex&&!realHasInstance.call(Writable,this))return new Writable(options);this._writableState=new WritableState(options,this,isDuplex);// legacy.
|
|
4614
|
-
this.writable=true;if(options){if(typeof options.write==='function')this._write=options.write;if(typeof options.writev==='function')this._writev=options.writev;if(typeof options.destroy==='function')this._destroy=options.destroy;if(typeof options
|
|
4662
|
+
this.writable=true;if(options){if(typeof options.write==='function')this._write=options.write;if(typeof options.writev==='function')this._writev=options.writev;if(typeof options.destroy==='function')this._destroy=options.destroy;if(typeof options.final==='function')this._final=options.final;}Stream.call(this);}// Otherwise people can pipe Writable streams, which is just wrong.
|
|
4615
4663
|
Writable.prototype.pipe=function(){errorOrDestroy(this,new ERR_STREAM_CANNOT_PIPE());};function writeAfterEnd(stream,cb){var er=new ERR_STREAM_WRITE_AFTER_END();// TODO: defer error events consistently everywhere, not just the cb
|
|
4616
4664
|
errorOrDestroy(stream,er);process.nextTick(cb,er);}// Checks that a user-supplied chunk is valid, especially for the particular
|
|
4617
4665
|
// mode the stream is in. Currently this means that `null` is never accepted
|
|
@@ -4741,7 +4789,7 @@ exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encodi
|
|
|
4741
4789
|
StringDecoder.prototype.text=utf8Text;// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
|
|
4742
4790
|
StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length){buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal);}buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length);this.lastNeed-=buf.length;};// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
|
|
4743
4791
|
// continuation byte. If an invalid byte is detected, -2 is returned.
|
|
4744
|
-
function utf8CheckByte(
|
|
4792
|
+
function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an
|
|
4745
4793
|
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
|
|
4746
4794
|
// needed to complete the UTF-8 character (if applicable) are returned.
|
|
4747
4795
|
function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as
|
|
@@ -4979,7 +5027,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
4979
5027
|
// presumably different callback function.
|
|
4980
5028
|
// This makes sure that own properties are retained, so that
|
|
4981
5029
|
// decorations and such are not lost along the way.
|
|
4982
|
-
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;}}},{}],190:[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;}},{}],191:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.
|
|
5030
|
+
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;}}},{}],190:[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;}},{}],191:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.273","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.27.0","@types/jquery":"^3.5.32","@types/sinon":"^17.0.4","eslint":"^9.27.0","globals":"^16.2.0","quackage":"^1.0.41","sinon":"^20.0.0"},"dependencies":{"cachetrax":"^1.0.4","fable":"^3.1.11","pict-application":"^1.0.27","pict-provider":"^1.0.6","pict-template":"^1.0.11","pict-view":"^1.0.61","typescript":"^5.8.3"}};},{}],192:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
|
|
4983
5031
|
/* global Pict, _Pict: writeable *//**
|
|
4984
5032
|
* Simple function to load a pict Application
|
|
4985
5033
|
*
|
|
@@ -4994,64 +5042,64 @@ if(pPictApplication&&_typeof(pPictApplication['default_configuration'])==='objec
|
|
|
4994
5042
|
if(document.readyState!='loading')fCallback();// Modern browsers have event listener capabilities
|
|
4995
5043
|
else if(document.addEventListener)document.addEventListener('DOMContentLoaded',function(){fCallback();});//@ts-ignore IE <= 8 and ... other abominations
|
|
4996
5044
|
else document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')fCallback();});};},{}],194:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
|
|
4997
|
-
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(
|
|
4998
|
-
if(typeof
|
|
5045
|
+
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase19){function PictCSS(pFable,pOptions,pServiceHash){var _this73;_classCallCheck2(this,PictCSS);_this73=_callSuper(this,PictCSS,[pFable,pOptions,pServiceHash]);/** @type {any} */_this73.options;/** @type {{ ContentAssignment: import('./Pict-Content-Assignment') }} */_this73.services;// No merging of options necessary
|
|
5046
|
+
if(typeof _this73.options.CSSElementAddress==='undefined'){_this73.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}_this73.inlineCSSMap={};return _this73;}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
|
|
4999
5047
|
// Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
|
|
5000
|
-
_inherits(PictCSS,
|
|
5001
|
-
tmpCSSHashes.sort(function(a,b){return
|
|
5048
|
+
_inherits(PictCSS,_libFableServiceBase19);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 _this74=this;var tmpCSS='';var tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
|
|
5049
|
+
tmpCSSHashes.sort(function(a,b){return _this74.inlineCSSMap[a].Priority-_this74.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
|
|
5002
5050
|
},{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);}(libFableServiceBase);module.exports=PictCSS;},{"fable":68}],195:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;/**
|
|
5003
5051
|
* Class for moving content around in the DOM.
|
|
5004
|
-
*/var PictContentAssignment=/*#__PURE__*/function(
|
|
5052
|
+
*/var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase20){/**
|
|
5005
5053
|
* @param {import('fable')} pFable - The Fable library instance.
|
|
5006
5054
|
* @param {any} [pOptions] - The options for the service.
|
|
5007
5055
|
* @param {string} [pServiceHash] - The hash of services.
|
|
5008
|
-
*/function PictContentAssignment(pFable,pOptions,pServiceHash){var
|
|
5009
|
-
|
|
5010
|
-
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){
|
|
5011
|
-
|
|
5056
|
+
*/function PictContentAssignment(pFable,pOptions,pServiceHash){var _this75;_classCallCheck2(this,PictContentAssignment);_this75=_callSuper(this,PictContentAssignment,[pFable,pOptions,pServiceHash]);/** @type {any} */_this75.log;/** @type {any} */_this75.fable;_this75.serviceType='PictContentAssignment';_this75.manifest=pFable.newManyfest();// Check to see if we are running in a browser
|
|
5057
|
+
_this75.inBrowser=false;_this75.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this75.inBrowser=true;// Now check that the browser has a document object
|
|
5058
|
+
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this75.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
|
|
5059
|
+
_this75.hasJquery=false;_this75.jQuery=false;if(_this75.inBrowser&&typeof window.jQuery!=='undefined'){_this75.hasJquery=true;}/**
|
|
5012
5060
|
* Set this to override the default mechanism for setting the content of a DOM element.
|
|
5013
5061
|
*
|
|
5014
5062
|
* @type {Function}
|
|
5015
5063
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
5016
5064
|
* @param {string} pContent - The content to set.
|
|
5017
|
-
*/
|
|
5065
|
+
*/_this75.customAssignFunction=null;/**
|
|
5018
5066
|
* Set this to override the default mechanism for prepend content to a DOM element.
|
|
5019
5067
|
*
|
|
5020
5068
|
* @type {Function}
|
|
5021
5069
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
5022
5070
|
* @param {string} pContent - The content to prepend.
|
|
5023
|
-
*/
|
|
5071
|
+
*/_this75.customPrependFunction=null;/**
|
|
5024
5072
|
* Set this to override the default mechanism for appending content to a DOM element.
|
|
5025
5073
|
*
|
|
5026
5074
|
* @type {Function}
|
|
5027
5075
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
5028
5076
|
* @param {string} pContent - The content to append.
|
|
5029
|
-
*/
|
|
5077
|
+
*/_this75.customAppendFunction=null;/**
|
|
5030
5078
|
* Set this to override the default mechanism for reading content from the DOM.
|
|
5031
5079
|
*
|
|
5032
5080
|
* @type {Function}
|
|
5033
5081
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
5034
5082
|
* @return {string} - The content of the element.
|
|
5035
|
-
*/
|
|
5083
|
+
*/_this75.customReadFunction=null;/**
|
|
5036
5084
|
* Set this to override the default mechanism for getting elements.
|
|
5037
5085
|
*
|
|
5038
5086
|
* @type {Function}
|
|
5039
5087
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
5040
5088
|
* @return {Array<any>} - The matched elements.
|
|
5041
|
-
*/
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5089
|
+
*/_this75.customGetElementFunction=null;// API Consumers can also craft their own attribute read function
|
|
5090
|
+
_this75.customReadAttributeFunction=null;// API Consumers can also craft their own attribute set function
|
|
5091
|
+
_this75.customSetAttributeFunction=null;// API Consumers can also craft their own attribute remove function
|
|
5092
|
+
_this75.customRemoveAttributeFunction=null;// API Consumers can also craft their own class read function
|
|
5093
|
+
_this75.customReadClassFunction=null;// API Consumers can also craft their own class set function
|
|
5094
|
+
_this75.customSetClassFunction=null;// API Consumers can also craft their own class remove function
|
|
5095
|
+
_this75.customRemoveClassFunction=null;return _this75;}/**
|
|
5048
5096
|
* Get an element from the DOM.
|
|
5049
5097
|
*
|
|
5050
5098
|
* @param {string} pAddress - The address of the element.
|
|
5051
5099
|
* @return {Array<any>} - The matched elements.
|
|
5052
|
-
*/_inherits(PictContentAssignment,
|
|
5100
|
+
*/_inherits(PictContentAssignment,_libFableServiceBase20);return _createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return[];}// TODO: This isn't the most efficient method, but it is the most compatible.
|
|
5053
5101
|
var tmpElementSet=[];for(var i=0;i<tmpElements.length;i++){tmpElementSet.push(tmpElements[i]);}return tmpElementSet;}else if(this.inBrowser&&this.hasDocument){// convert from NodeList to Array for consistent return type
|
|
5054
|
-
var _tmpElements=window.document.querySelectorAll(pAddress);var _tmpElementSet=[];for(var
|
|
5102
|
+
var _tmpElements=window.document.querySelectorAll(pAddress);var _tmpElementSet=[];for(var _i62=0;_i62<_tmpElements.length;_i62++){_tmpElementSet.push(_tmpElements[_i62]);}return _tmpElementSet;}else{// Just log it out for now
|
|
5055
5103
|
this.log.trace("PICT Content GET ELEMENT for [".concat(pAddress,"] will return empty because none of the browser methods are available"));return[];}}/**
|
|
5056
5104
|
* @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
|
|
5057
5105
|
* @param {string|boolean} pContent - The content to assign.
|
|
@@ -5059,7 +5107,7 @@ this.log.trace("PICT Content GET ELEMENT for [".concat(pAddress,"] will return e
|
|
|
5059
5107
|
*/},{key:"assignContent",value:function assignContent(pAddress,pContent){if(this.customAssignFunction){return this.customAssignFunction(pAddress,pContent);}else if(this.hasJquery){// Get the element(s)
|
|
5060
5108
|
//FIXME: this is silly, but it makes the type system happy - it picks a different overload for each case
|
|
5061
5109
|
var tmpTargetElementSet=typeof pAddress==='string'?window.jQuery(pAddress):window.jQuery(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){var tmpElement=tmpTargetElementSet[i];switch(tmpElement.tagName){case'INPUT':if(tmpElement instanceof HTMLInputElement&&tmpElement.type=='checkbox'){tmpElement.checked=Boolean(pContent);}/* falls through */case'SELECT':case'TEXTAREA':if(tmpElement instanceof HTMLInputElement||tmpElement instanceof HTMLSelectElement||tmpElement instanceof HTMLTextAreaElement){tmpElement.value=String(pContent);}break;case'SCRIPT':if(tmpElement instanceof HTMLScriptElement){tmpElement.text=String(pContent);}break;default:tmpElement.innerHTML=String(pContent);}}}else if(this.inBrowser&&this.hasDocument){// Get the element(s)
|
|
5062
|
-
var _tmpTargetElementSet=typeof pAddress==='string'?window.document.querySelectorAll(pAddress):[pAddress];for(var
|
|
5110
|
+
var _tmpTargetElementSet=typeof pAddress==='string'?window.document.querySelectorAll(pAddress):[pAddress];for(var _i63=0;_i63<_tmpTargetElementSet.length;_i63++){var _tmpElement=_tmpTargetElementSet[_i63];switch(_tmpTargetElementSet[_i63].tagName){case'INPUT':if(_tmpElement instanceof HTMLInputElement&&_tmpElement.type=='checkbox'){_tmpElement.checked=Boolean(pContent);}/* falls through */case'SELECT':case'TEXTAREA':if(_tmpElement instanceof HTMLInputElement||_tmpElement instanceof HTMLSelectElement||_tmpElement instanceof HTMLTextAreaElement){_tmpElement.value=String(pContent);}break;case'SCRIPT':if(_tmpElement instanceof HTMLScriptElement){_tmpElement.text=String(pContent);}break;default:_tmpElement.innerHTML=String(pContent);}}}else{// Just log it out for now
|
|
5063
5111
|
this.log.trace("PICT Content ASSIGN to [".concat(pAddress,"]:"),pContent);}}/**
|
|
5064
5112
|
* Append content to an element.
|
|
5065
5113
|
*
|
|
@@ -5140,11 +5188,11 @@ var tmpTargetElement=typeof pAddress==='string'?window.jQuery(pAddress):window.j
|
|
|
5140
5188
|
*
|
|
5141
5189
|
* @return {boolean} - Whether the element has the class. If multiple elements are matched, returns true if any have the class.
|
|
5142
5190
|
*/},{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
|
|
5143
|
-
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}],196:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(
|
|
5191
|
+
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}],196:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase21){function PictDataProvider(pFable,pOptions,pServiceHash){var _this76;_classCallCheck2(this,PictDataProvider);_this76=_callSuper(this,PictDataProvider,[pFable,pOptions,pServiceHash]);/** @type {import('fable') & import('pict')} */_this76.fable;_this76.serviceType='PictDataProvider';return _this76;}/**
|
|
5144
5192
|
* @param {string} pAddress - The address of the data to retrieve
|
|
5145
5193
|
* @param {object} [pData] - (optional) The record to provide to the address resolver
|
|
5146
|
-
*/_inherits(PictDataProvider,
|
|
5147
|
-
|
|
5194
|
+
*/_inherits(PictDataProvider,_libFableServiceBase21);return _createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;var tmpAddressSpace={Fable:this.fable,Pict:this.fable,AppData:this.fable.AppData,Bundle:this.fable.Bundle,Record:tmpData};return this.fable.manifest.getValueByHash(tmpAddressSpace,pAddress);}}]);}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":68}],197:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase22){function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this77$fable$RestCli;var _this77;_classCallCheck2(this,PictMeadowEntityProvider);_this77=_callSuper(this,PictMeadowEntityProvider,[pFable,pOptions,pServiceHash]);/** @type {any} */_this77.options;/** @type {import('pict') & { settings: any } & { newAnticipate: any }} */_this77.fable;/** @type {any} */_this77.log;_this77.serviceType='PictMeadowProvider';if(_this77.fable.settings.PictDefaultURLPrefix){_this77.options.urlPrefix=_this77.fable.settings.PictDefaultURLPrefix;}else if(!_this77.options.urlPrefix){_this77.options.urlPrefix='/1.0/';}if(_this77.fable.settings.PictDefaultDownloadBatchSize){_this77.options.downloadBatchSize=_this77.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this77.options.downloadBatchSize){_this77.options.downloadBatchSize=100;}//@ts-ignore - FIXME - remove once we have fable types
|
|
5195
|
+
_this77.restClient=(_this77$fable$RestCli=_this77.fable.RestClient)!==null&&_this77$fable$RestCli!==void 0?_this77$fable$RestCli:_this77.fable.instantiateServiceProviderWithoutRegistration('RestClient');/** @type {Record<string, import('cachetrax')>} */_this77.recordCache={};/** @type {Record<string, import('cachetrax')>} */_this77.recordSetCache={};_this77.prepareRequestOptions=function(pOptions){return pOptions;};return _this77;}_inherits(PictMeadowEntityProvider,_libFableServiceBase22);return _createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
|
|
5148
5196
|
if(!(pEntity in this.recordCache)){//@ts-ignore - FIXME - remove once we have fable types
|
|
5149
5197
|
this.recordCache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
5150
5198
|
// For now cache for 30 seconds.
|
|
@@ -5152,63 +5200,112 @@ this.recordCache[pEntity].maxAge=30000;this.recordCache[pEntity].maxLength=10000
|
|
|
5152
5200
|
if(!(pEntity in this.recordSetCache)){//@ts-ignore - FIXME - remove once we have fable types
|
|
5153
5201
|
this.recordSetCache[pEntity]=this.fable.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
5154
5202
|
// For now cache for 10 seconds.
|
|
5155
|
-
this.recordSetCache[pEntity].maxAge=10000;this.recordSetCache[pEntity].maxLength=100;}}},{key:"gatherEntitySet",value:function gatherEntitySet(pEntityInformation,pContext,fCallback){var
|
|
5203
|
+
this.recordSetCache[pEntity].maxAge=10000;this.recordSetCache[pEntity].maxLength=100;}}},{key:"gatherEntitySet",value:function gatherEntitySet(pEntityInformation,pContext,fCallback){var _this78=this;// First sanity check the pEntityInformation
|
|
5156
5204
|
if(!('Entity'in pEntityInformation)||typeof pEntityInformation.Entity!='string'){this.log.warn("EntityBundleRequest failed to parse entity request because the entity stanza did not contain an Entity string.");return fCallback();}if(!('Destination'in pEntityInformation)||typeof pEntityInformation.Destination!='string'){this.log.warn("EntityBundleRequest failed to parse entity request because the entity stanza did not contain a Destination string.");return fCallback();}if(!('Filter'in pEntityInformation)||typeof pEntityInformation.Filter!='string'){pEntityInformation.Filter='';}if(!('FilterData'in pEntityInformation)||_typeof(pEntityInformation.FilterData)!='object'){pEntityInformation.FilterData={};}pContext.StepData=pEntityInformation.FilterData;if(!('RecordStartCursor'in pEntityInformation)||typeof pEntityInformation.RecordStartCursor!='number'){pEntityInformation.RecordStartCursor=0;}if(!('PageSize'in pEntityInformation)||typeof pEntityInformation.PageSize!='number'){pEntityInformation.PageSize=100;}var tmpRecordStartCursor=null;var tmpRecordCount=null;if(pEntityInformation.RecordCount){tmpRecordStartCursor=pEntityInformation.RecordStartCursor;tmpRecordCount=pEntityInformation.RecordCount;}// Parse the filter template
|
|
5157
5205
|
var tmpFilterString=this.fable.parseTemplate(pEntityInformation.Filter,pContext);// Create a callback function to handle receiving the record set
|
|
5158
|
-
var fRecordFetchComplete=function fRecordFetchComplete(pError,pRecordSet){if(pError){
|
|
5159
|
-
if(pEntityInformation.SingleRecord){if(pRecordSet.length>1){
|
|
5160
|
-
this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(_tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=_tmpSourceEntity;}else{pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(_tmpSourceEntity);}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}
|
|
5161
|
-
this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpSourceEntity;}else{tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(tmpSourceEntity);}}}
|
|
5206
|
+
var fRecordFetchComplete=function fRecordFetchComplete(pError,pRecordSet){if(pError){_this78.log.error("EntityBundleRequest request Error getting entity set for [".concat(pEntityInformation.Entity,"] with filter [").concat(tmpFilterString,"]: ").concat(pError),pError);return fCallback(pError,'');}_this78.log.trace("EntityBundleRequest found ".concat(pRecordSet.length," records for ").concat(pEntityInformation.Entity," filtered to [").concat(tmpFilterString,"]"));// Now assign it back to the destination; because this is not view specific it doesn't use the manifests from them (to deal with scope overlap with subgrids).
|
|
5207
|
+
if(pEntityInformation.SingleRecord){if(pRecordSet.length>1){_this78.log.warn("EntityBundleRequest found more than one record for ".concat(pEntityInformation.Entity," filtered to [").concat(tmpFilterString,"] but SingleRecord is true; setting the first record."));}if(pRecordSet.length<1){_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,false);}_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,pRecordSet[0]);}else{_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,pRecordSet);}return fCallback();};if(tmpRecordCount){this.getEntitySetPage(pEntityInformation.Entity,tmpFilterString,tmpRecordStartCursor,tmpRecordCount,fRecordFetchComplete);}else{this.getEntitySet(pEntityInformation.Entity,tmpFilterString,fRecordFetchComplete);}}},{key:"mapJoinSingleDestination",value:function mapJoinSingleDestination(pDestinationEntity,pCustomRequestInformation,pContext){var tmpSourceEntities=this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.JoinRecordSetAddress);if(!Array.isArray(tmpSourceEntities)){throw new Error("EntityBundleRequest failed to map join because the source [".concat(pCustomRequestInformation.JoinRecordSetAddress,"] did not return an array."));}var tmpSourceLookup={};var _iterator3=_createForOfIteratorHelper(tmpSourceEntities),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var tmpSourceEntity=_step3.value;var tmpSourceJoinValue=tmpSourceEntity[pCustomRequestInformation.JoinValue];tmpSourceLookup[tmpSourceJoinValue]=tmpSourceEntity;}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}var _iterator4=_createForOfIteratorHelper(tmpSourceEntities),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _tmpSourceEntity=_step4.value;if(!_tmpSourceEntity){this.log.error("EntityBundleRequest failed to map join because the source entity was not found in the source lookup.");continue;}if(pCustomRequestInformation.BucketBy||pCustomRequestInformation.BucketByTemplate){var tmpBucketValues=[];if(pCustomRequestInformation.BucketBy){var tmpBucketByKeys=Array.isArray(pCustomRequestInformation.BucketBy)?pCustomRequestInformation.BucketBy:[pCustomRequestInformation.BucketBy];var _iterator5=_createForOfIteratorHelper(tmpBucketByKeys),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var tmpBucketByKey=_step5.value;var tmpBucketValue=this.fable.manifest.getValueByHash(_tmpSourceEntity,tmpBucketByKey);tmpBucketValues.push(tmpBucketValue);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}else{var tmpBucketByTemplates=Array.isArray(pCustomRequestInformation.BucketByTemplate)?pCustomRequestInformation.BucketByTemplate:[pCustomRequestInformation.BucketByTemplate];var _iterator6=_createForOfIteratorHelper(tmpBucketByTemplates),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var tmpBucketByTemplate=_step6.value;var _tmpBucketValue=this.fable.parseTemplate(tmpBucketByTemplate,_tmpSourceEntity);tmpBucketValues.push(_tmpBucketValue);}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}var tmpBucketAddress="".concat(pCustomRequestInformation.RecordDestinationAddress,".").concat(tmpBucketValues.join('.'));if(pCustomRequestInformation.SingleRecord){//TODO: warn if there is a collision?
|
|
5208
|
+
this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(_tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=_tmpSourceEntity;}else{pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(_tmpSourceEntity);}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}return[pDestinationEntity];}},{key:"mapJoin",value:function mapJoin(pCustomRequestInformation,pContext){var tmpSingleDestinationEntity=pCustomRequestInformation.DestinationRecordAddress?this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.DestinationRecordAddress):null;var tmpDestinationEntities=pCustomRequestInformation.DestinationRecordSetAddress?this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.DestinationRecordSetAddress):null;if(!Array.isArray(tmpDestinationEntities)&&!tmpSingleDestinationEntity){throw new Error("EntityBundleRequest failed to map join because the destination [".concat(pCustomRequestInformation.DestinationRecordSetAddress,"] did not return an array."));}if(tmpSingleDestinationEntity){return this.mapJoinSingleDestination(tmpSingleDestinationEntity,pCustomRequestInformation,pContext);}var tmpJoinEntities=this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.Joins);if(!Array.isArray(tmpJoinEntities)){throw new Error("EntityBundleRequest failed to map join because the join [".concat(pCustomRequestInformation.Joins,"] did not return an array."));}var tmpSourceEntities=this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.JoinRecordSetAddress);if(!Array.isArray(tmpSourceEntities)){throw new Error("EntityBundleRequest failed to map join because the source [".concat(pCustomRequestInformation.JoinRecordSetAddress,"] did not return an array."));}var tmpLHSJoinKey=pCustomRequestInformation.JoinJoinValueLHS||pCustomRequestInformation.DestinationJoinValue;var tmpRHSJoinKey=pCustomRequestInformation.JoinJoinValueRHS||pCustomRequestInformation.JoinValue;var tmpDestinationLookup={};var tmpSourceLookup={};var tmpJoinMap={};var _iterator7=_createForOfIteratorHelper(tmpDestinationEntities||[]),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _tmpDestinationEntity=_step7.value;var tmpDestinationJoinValue=_tmpDestinationEntity[pCustomRequestInformation.DestinationJoinValue];tmpDestinationLookup[tmpDestinationJoinValue]=_tmpDestinationEntity;}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}var _iterator8=_createForOfIteratorHelper(tmpSourceEntities),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _tmpSourceEntity2=_step8.value;var tmpSourceJoinValue=_tmpSourceEntity2[pCustomRequestInformation.JoinValue];tmpSourceLookup[tmpSourceJoinValue]=_tmpSourceEntity2;}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}var _iterator9=_createForOfIteratorHelper(tmpJoinEntities),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var tmpJoinEntity=_step9.value;var _tmpLHSJoinValue=tmpJoinEntity[tmpLHSJoinKey];var _tmpRHSJoinValue=tmpJoinEntity[tmpRHSJoinKey];tmpJoinMap[_tmpLHSJoinValue]=tmpJoinMap[_tmpLHSJoinValue]||new Set();tmpJoinMap[_tmpLHSJoinValue].add(_tmpRHSJoinValue);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}for(var _i64=0,_Object$keys=Object.keys(tmpJoinMap);_i64<_Object$keys.length;_i64++){var tmpLHSJoinValue=_Object$keys[_i64];var tmpRHSJoinValues=Array.from(tmpJoinMap[tmpLHSJoinValue]);var tmpDestinationEntity=tmpDestinationLookup[tmpLHSJoinValue];if(!tmpDestinationEntity){this.log.error("EntityBundleRequest failed to map join because the LHS join value [".concat(tmpLHSJoinValue,"] was not found in the destination lookup."));continue;}for(var _i65=0,_tmpRHSJoinValues=tmpRHSJoinValues;_i65<_tmpRHSJoinValues.length;_i65++){var tmpRHSJoinValue=_tmpRHSJoinValues[_i65];var tmpSourceEntity=tmpSourceLookup[tmpRHSJoinValue];if(!tmpSourceEntity){this.log.error("EntityBundleRequest failed to map join because the RHS join value [".concat(tmpRHSJoinValue,"] was not found in the source lookup."));continue;}if(pCustomRequestInformation.BucketBy||pCustomRequestInformation.BucketByTemplate){var tmpBucketValues=[];if(pCustomRequestInformation.BucketBy){var tmpBucketByKeys=Array.isArray(pCustomRequestInformation.BucketBy)?pCustomRequestInformation.BucketBy:[pCustomRequestInformation.BucketBy];var _iterator10=_createForOfIteratorHelper(tmpBucketByKeys),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var tmpBucketByKey=_step10.value;var tmpBucketValue=this.fable.manifest.getValueByHash(tmpSourceEntity,tmpBucketByKey);tmpBucketValues.push(tmpBucketValue);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}else{var tmpBucketByTemplates=Array.isArray(pCustomRequestInformation.BucketByTemplate)?pCustomRequestInformation.BucketByTemplate:[pCustomRequestInformation.BucketByTemplate];var _iterator11=_createForOfIteratorHelper(tmpBucketByTemplates),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var tmpBucketByTemplate=_step11.value;var _tmpBucketValue2=this.fable.parseTemplate(tmpBucketByTemplate,tmpSourceEntity);tmpBucketValues.push(_tmpBucketValue2);}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}if(!tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]){tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]={};}var tmpBucketAddress="".concat(pCustomRequestInformation.RecordDestinationAddress,".").concat(tmpBucketValues.join('.'));if(pCustomRequestInformation.SingleRecord){//TODO: warn if there is a collision?
|
|
5209
|
+
this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpSourceEntity;}else{tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(tmpSourceEntity);}}}return tmpDestinationEntities;}/**
|
|
5210
|
+
* ExampleConfig:
|
|
5211
|
+
* {
|
|
5212
|
+
* "InputRecordsetAddress": "AppData.DocumentData.ReportData.Observations[]<<~?ObservationType,==,WalbecNDTRollerTests?~>>",
|
|
5213
|
+
* "OutputRecordsetAddress": "AppData.DocumentData.ReportData.FormData.ADDTests",
|
|
5214
|
+
* "OutputRecordsetAddressMapping":
|
|
5215
|
+
* {
|
|
5216
|
+
* "InputRecord.Tags[],AnyContains,HR": "AppData.DocumentData.ReportData.FormData.HRTests",
|
|
5217
|
+
* "InputRecord.Tags[],AnyContains,CR": "AppData.DocumentData.ReportData.FormData.CRTests",
|
|
5218
|
+
* "InputRecord.Tags[],AnyContains,IR": "AppData.DocumentData.ReportData.FormData.IRTests"
|
|
5219
|
+
* },
|
|
5220
|
+
* "RecordPrototypeAddress": "OutputRecordSet[]<<~?IDObservation,==,{~D:InputRecord.IDObservation~}?~>>",
|
|
5221
|
+
* "RecordFieldMapping":
|
|
5222
|
+
* {
|
|
5223
|
+
* "AppData.DocumentData.ReportData.FormData.HRTests":
|
|
5224
|
+
* {
|
|
5225
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.Temp",
|
|
5226
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.Density",
|
|
5227
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.Offset",
|
|
5228
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5229
|
+
* },
|
|
5230
|
+
* "AppData.DocumentData.ReportData.FormData.CRTests":
|
|
5231
|
+
* {
|
|
5232
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.CRTemp",
|
|
5233
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.CRDensity",
|
|
5234
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.CROffset",
|
|
5235
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5236
|
+
* },
|
|
5237
|
+
* "AppData.DocumentData.ReportData.FormData.IRTests":
|
|
5238
|
+
* {
|
|
5239
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.IRTemp",
|
|
5240
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.IRDensity",
|
|
5241
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.IROffset",
|
|
5242
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5243
|
+
* },
|
|
5244
|
+
* "Default":
|
|
5245
|
+
* {
|
|
5246
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.ADDTemp",
|
|
5247
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.ADDDensity",
|
|
5248
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.ADDOffset",
|
|
5249
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5250
|
+
* }
|
|
5251
|
+
* }
|
|
5252
|
+
* }
|
|
5253
|
+
*/},{key:"projectDataset",value:function projectDataset(pConfiguration,pContext){var tmpInputRecordset=this.fable.manifest.getValueByHash(pContext,pConfiguration.InputRecordsetAddress);if(!Array.isArray(tmpInputRecordset)){throw new Error("EntityBundleRequest failed to project dataset because the input recordset [".concat(pConfiguration.InputRecordsetAddress,"] did not return an array."));}var tmpDefaultOutputRecordset=this.fable.manifest.getValueByHash(pContext,pConfiguration.OutputRecordsetAddress);if(!tmpDefaultOutputRecordset){tmpDefaultOutputRecordset=[];this.fable.manifest.setValueByHash(pContext,pConfiguration.OutputRecordsetAddress,tmpDefaultOutputRecordset);}var _iterator12=_createForOfIteratorHelper(tmpInputRecordset),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var tmpInputRecord=_step12.value;var tmpOutputRecordset=tmpDefaultOutputRecordset;var tmpOutputRecordsetAddressOverride=void 0;if(_typeof(pConfiguration.OutputRecordsetAddressMapping)==='object'){tmpOutputRecordsetAddressOverride=this._resolveOutputRecordsetAddressMapping(pConfiguration,pContext,tmpInputRecord);if(tmpOutputRecordsetAddressOverride){tmpOutputRecordset=this.fable.manifest.getValueByHash(pContext,tmpOutputRecordsetAddressOverride);if(!tmpOutputRecordset){tmpOutputRecordset=[];this.fable.manifest.setValueByHash(pContext,tmpOutputRecordsetAddressOverride,tmpOutputRecordset);}}if(!tmpOutputRecordset||!Array.isArray(tmpOutputRecordset)){tmpOutputRecordset=tmpDefaultOutputRecordset;}}var tmpPrototypeAddress=this.fable.parseTemplate(pConfiguration.RecordPrototypeAddress,Object.assign({InputRecord:tmpInputRecord},pContext));var tmpRecordPrototype=this.fable.manifest.getValueByHash(Object.assign({InputRecord:tmpInputRecord,OutputRecordset:tmpOutputRecordset},pContext),tmpPrototypeAddress);var tmpOutputRecord={};if(Array.isArray(tmpRecordPrototype)&&tmpRecordPrototype.length>0){tmpOutputRecord=tmpRecordPrototype[0];}else{tmpOutputRecordset.push(tmpOutputRecord);}var tmpRecordFieldMapping=pConfiguration.RecordFieldMapping[tmpOutputRecordsetAddressOverride]||pConfiguration.RecordFieldMapping.Default;if(!tmpRecordFieldMapping){tmpRecordFieldMapping=pConfiguration.RecordFieldMapping[Object.keys(pConfiguration.RecordFieldMapping)[0]];}if(!tmpRecordFieldMapping){throw new Error("EntityBundleRequest failed to project dataset because the record field mapping for [".concat(tmpOutputRecordsetAddressOverride,"] did not return a mapping."));}for(var _i66=0,_Object$keys2=Object.keys(tmpRecordFieldMapping);_i66<_Object$keys2.length;_i66++){var tmpInputFieldAddress=_Object$keys2[_i66];var tmpOutputFieldAddress=tmpRecordFieldMapping[tmpInputFieldAddress];var tmpInputFieldValue=this.fable.manifest.getValueByHash(Object.assign({InputRecord:tmpInputRecord},pContext),tmpInputFieldAddress);this.fable.manifest.setValueByHash(Object.assign({OutputRecord:tmpOutputRecord},pContext),tmpOutputFieldAddress,tmpInputFieldValue);}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}},{key:"_resolveOutputRecordsetAddressMapping",value:function _resolveOutputRecordsetAddressMapping(pConfiguration,pContext,pInputRecord){var tmpAddressSpace=Object.assign({InputRecord:pInputRecord},pContext);for(var _i67=0,_Object$keys3=Object.keys(pConfiguration.OutputRecordsetAddressMapping);_i67<_Object$keys3.length;_i67++){var tmpRule=_Object$keys3[_i67];var _tmpRule$split=tmpRule.split(','),_tmpRule$split2=_slicedToArray(_tmpRule$split,3),tmpLHSAddress=_tmpRule$split2[0],tmpOperator=_tmpRule$split2[1],tmpMatchValue=_tmpRule$split2[2];var tmpLHS=this.fable.manifest.getValueByHash(tmpAddressSpace,tmpLHSAddress);if(!tmpLHS){if(this.fable.LogNoisiness>0){this.log.warn("EntityBundleRequest failed to project dataset because the LHS address [".concat(tmpLHSAddress,"] did not return a value."));}continue;}switch(tmpOperator){case'AnyContains':if(!Array.isArray(tmpLHS)){//TODO: consider making this use objects as well?
|
|
5254
|
+
this.log.error("EntityBundleRequest failed to project dataset because the LHS address [".concat(tmpLHSAddress,"] did not return an array."));continue;}var _iterator13=_createForOfIteratorHelper(tmpLHS),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var tmpLHSValue=_step13.value;if(String(tmpLHSValue).includes(tmpMatchValue)){return pConfiguration.OutputRecordsetAddressMapping[tmpRule];}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return null;}}}},{key:"gatherCustomDataSet",value:function gatherCustomDataSet(pCustomRequestInformation,pContext,fCallback){var _this79=this;// First sanity check the pCustomRequestInformation
|
|
5162
5255
|
if(!('URL'in pCustomRequestInformation)||typeof pCustomRequestInformation.URL!='string'){this.log.warn("EntityBundleRequest failed to parse custom data request because the stanza did not contain a URL string.");return fCallback();}if(!('URLData'in pCustomRequestInformation)||_typeof(pCustomRequestInformation.URLData)!='object'){pCustomRequestInformation.URLData={};}pContext.StepData=pCustomRequestInformation.URLData;// Parse the filter template
|
|
5163
5256
|
var tmpURLTemplateString=this.fable.parseTemplate(pCustomRequestInformation.URL,pContext);if(tmpURLTemplateString==''){// We may want to continue, but for now let's say nah and nope out.
|
|
5164
5257
|
this.log.warn("EntityBundleRequest failed to parse custom data request because the entity Filter did not return a string for FilterBy");}var tmpURLPrefix='';// This will only be true if the "Host" is set.
|
|
5165
5258
|
var tmpCustomURIHost=pCustomRequestInformation.Host?pCustomRequestInformation.Host:false;// If "Host" is set, protocol and port are optional.
|
|
5166
5259
|
var tmpCustomURIProtocol=pCustomRequestInformation.Protocol?pCustomRequestInformation.Protocol:'https';var tmpCustomURIPort=pCustomRequestInformation.Port?pCustomRequestInformation.Port:false;if(tmpCustomURIHost){tmpURLPrefix="".concat(tmpCustomURIProtocol,"://").concat(tmpCustomURIHost);if(tmpCustomURIPort){tmpURLPrefix+=":".concat(tmpCustomURIPort);}}else{tmpURLPrefix=this.fable.EntityProvider.options.urlPrefix;}// Now get the records
|
|
5167
|
-
var callback=function callback(pError,pResponse,pData){if(pError){
|
|
5168
|
-
if(pCustomRequestInformation.Destination){
|
|
5260
|
+
var callback=function callback(pError,pResponse,pData){if(pError){_this79.log.error("EntityBundleRequest request Error getting data set for [".concat(pCustomRequestInformation.Entity,"] with filter [").concat(tmpURLTemplateString,"]: ").concat(pError),pError);return fCallback(pError,'');}_this79.log.trace("EntityBundleRequest completed request for ".concat(pCustomRequestInformation.Entity," filtered to [").concat(tmpURLTemplateString,"]"));// Since this is a templated endpoint it can be used for logging etc.
|
|
5261
|
+
if(pCustomRequestInformation.Destination){_this79.fable.manifest.setValueByHash(pContext,pCustomRequestInformation.Destination,pData);}return fCallback();};var tmpOptions={url:"".concat(tmpURLPrefix).concat(tmpURLTemplateString)};tmpOptions=this.fable.EntityProvider.prepareRequestOptions(tmpOptions);return this.fable.EntityProvider.restClient.getJSON(tmpOptions,callback);}/**
|
|
5262
|
+
* Local version of gatherDataFromServer that only support synchronous operations.
|
|
5263
|
+
*
|
|
5264
|
+
* @param {Array<Record<string, any>>} pEntitiesBundleDescription - The entity bundle description object.
|
|
5265
|
+
*/},{key:"processBundle",value:function processBundle(pEntitiesBundleDescription){if(!Array.isArray(pEntitiesBundleDescription)){this.log.error("EntityBundleRequest failed to parse entity bundle request because the input was not an array.");throw new Error('EntityBundleRequest failed to parse entity bundle request because the input was not an array.');}var tmpStateStack=[];var tmpState={};var _iterator14=_createForOfIteratorHelper(pEntitiesBundleDescription),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var tmpEntityBundleEntry=_step14.value;try{switch(tmpEntityBundleEntry.Type){case'SetStateAddress':tmpStateStack.push(tmpState);tmpState=this.fable.manifest.getValueByHash(this.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};this.fable.manifest.setValueByHash(this.fable,tmpEntityBundleEntry.StateAddress,tmpState);}break;case'PopState':if(tmpStateStack.length>0){tmpState=tmpStateStack.pop();}else{this.log.warn("EntityBundleRequest encountered a PopState without a matching SetStateAddress.");}break;case'MapJoin':this.mapJoin(tmpEntityBundleEntry,this.prepareState(tmpState,tmpEntityBundleEntry));break;case'ProjectDataset':this.projectDataset(tmpEntityBundleEntry,this.prepareState(tmpState,tmpEntityBundleEntry));break;default:this.log.error("EntityBundleRequest encountered an unsupported type [".concat(tmpEntityBundleEntry.Type,"] in the entity bundle description."));}}catch(pError){this.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}/**
|
|
5169
5266
|
* Gather data from the server returning a promise when it is complete.
|
|
5170
5267
|
*
|
|
5171
5268
|
* @param {Array<Record<string, any>>} pEntitiesBundleDescription - The entity bundle description object.
|
|
5172
5269
|
* @param {(error?: Error) => void} fCallback - The callback function to call when the data gathering is complete.
|
|
5173
|
-
*/},{key:"gatherDataFromServer",value:function gatherDataFromServer(pEntitiesBundleDescription,fCallback){var
|
|
5174
|
-
case'MeadowEntity':default:return
|
|
5175
|
-
if(pError){
|
|
5270
|
+
*/},{key:"gatherDataFromServer",value:function gatherDataFromServer(pEntitiesBundleDescription,fCallback){var _this80=this;if(!Array.isArray(pEntitiesBundleDescription)){this.log.error("EntityBundleRequest failed to parse entity bundle request because the input was not an array.");return fCallback(new Error('EntityBundleRequest failed to parse entity bundle request because the input was not an array.'));}var tmpAnticipate=this.fable.newAnticipate();var tmpStateStack=[];var tmpState={};var _loop3=function _loop3(){var tmpEntityBundleEntry=pEntitiesBundleDescription[i];tmpAnticipate.anticipate(function(fNext){try{switch(tmpEntityBundleEntry.Type){case'SetStateAddress':tmpStateStack.push(tmpState);tmpState=_this80.fable.manifest.getValueByHash(_this80.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};_this80.fable.manifest.setValueByHash(_this80.fable,tmpEntityBundleEntry.StateAddress,tmpState);}return fNext();case'PopState':if(tmpStateStack.length>0){tmpState=tmpStateStack.pop();}else{_this80.log.warn("EntityBundleRequest encountered a PopState without a matching SetStateAddress.");}return fNext();case'Custom':return _this80.gatherCustomDataSet(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry),fNext);case'MapJoin':_this80.mapJoin(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry));return fNext();case'ProjectDataset':_this80.projectDataset(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry));return fNext();// This is the default case, for a meadow entity set or single entity
|
|
5271
|
+
case'MeadowEntity':default:return _this80.gatherEntitySet(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry),fNext);}}catch(pError){_this80.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});return fNext();}});};for(var i=0;i<pEntitiesBundleDescription.length;i++){_loop3();}tmpAnticipate.wait(function(pError){//FIXME: should we be ignoring this error? rejecting here is unsafe since the result isn't guaranteed to be handled, so will crash stuff currently
|
|
5272
|
+
if(pError){_this80.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});return fCallback(pError);}return fCallback();});}/**
|
|
5176
5273
|
* Creates a wrapper state object to allow referencing common global state in addition to flow-state.
|
|
5177
5274
|
*
|
|
5178
5275
|
* @param {Record<string, any>} pState - The state object to prepare.
|
|
5179
5276
|
* @param {any} [pStepConfiguration] - (optional) The step configuration object provided in the config, if any.
|
|
5180
5277
|
* @return {Record<string, any>} - The prepared state object.
|
|
5181
|
-
*/},{key:"prepareState",value:function prepareState(pState,pStepConfiguration){return{State:pState,AppData:this.fable.AppData,Pict:this.fable,Fable:this.fable,StepConfiguration:pStepConfiguration};}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
5182
|
-
this.recordCache[pEntity].prune(function(){var
|
|
5278
|
+
*/},{key:"prepareState",value:function prepareState(pState,pStepConfiguration){return{State:pState,AppData:this.fable.AppData,Bundle:this.fable.Bundle,Pict:this.fable,Fable:this.fable,StepConfiguration:pStepConfiguration};}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
5279
|
+
this.recordCache[pEntity].prune(function(){var _this81=this;var tmpPossibleRecord=this.recordCache[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){/*
|
|
5183
5280
|
* FIXME: This breaks entity reads for nonexistent records. Putting this back for now until we can audit and fix all the places that may rely on this.
|
|
5184
5281
|
if (pResponse && pResponse.statusCode && pResponse.statusCode >= 400)
|
|
5185
5282
|
{
|
|
5186
5283
|
this.log.error(`Error getting entity [${pEntity}] with ID [${pIDRecord}] from url [${tmpOptions.url}]: ${pResponse.statusCode} ${pResponse.statusMessage}`);
|
|
5187
5284
|
return fCallback(new Error(`Error getting entity [${pEntity}] with ID [${pIDRecord}] from url [${tmpOptions.url}]: ${pResponse.statusCode} ${JSON.stringify(pBody || {})}`));
|
|
5188
5285
|
}
|
|
5189
|
-
*/if(pBody){
|
|
5286
|
+
*/if(pBody){_this81.recordCache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});}.bind(this));}},{key:"getEntitySetPage",value:function getEntitySetPage(pEntity,pMeadowFilterExpression,pRecordStartCursor,pRecordCount,fCallback){var tmpFilterStanza=pMeadowFilterExpression?"/FilteredTo/".concat(pMeadowFilterExpression):'';var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s").concat(tmpFilterStanza,"/").concat(pRecordStartCursor,"/").concat(pRecordCount);return this.restClient.getJSON(tmpURL,function(pDownloadError,pDownloadResponse,pDownloadBody){if(pDownloadResponse&&pDownloadResponse.statusCode&&pDownloadResponse.statusCode>=400){this.log.error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pDownloadResponse.statusCode," ").concat(pDownloadResponse.statusMessage));return fCallback(new Error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pDownloadResponse.statusCode," ").concat(JSON.stringify(pDownloadBody||{}))));}return fCallback(pDownloadError,pDownloadBody);}.bind(this));}},{key:"getEntitySetRecordCount",value:function getEntitySetRecordCount(pEntity,pMeadowFilterExpression,fCallback){var tmpFilterStanza=pMeadowFilterExpression?"/FilteredTo/".concat(pMeadowFilterExpression):'';var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s/Count").concat(tmpFilterStanza);return this.restClient.getJSON(tmpURL,function(pError,pResponse,pBody){if(pResponse&&pResponse.statusCode&&pResponse.statusCode>=400){this.log.error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pResponse.statusCode," ").concat(pResponse.statusMessage));return fCallback(new Error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pResponse.statusCode," ").concat(JSON.stringify(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?
|
|
5190
5287
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
5191
5288
|
// If the list is mega-long we can parse it and break it into chunks.
|
|
5192
5289
|
this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
5193
|
-
this.recordSetCache[pEntity].prune(function(){var
|
|
5194
|
-
tmpDownloadURIFragments.push("".concat(
|
|
5195
|
-
|
|
5196
|
-
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){if(tmpEntitySet){
|
|
5290
|
+
this.recordSetCache[pEntity].prune(function(){var _this82=this;var tmpPossibleRecords=this.recordSetCache[pEntity].read(pMeadowFilterExpression);if(tmpPossibleRecords){return fCallback(null,tmpPossibleRecords);}return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this82.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=_this82.options.downloadBatchSize;var tmpFilterStanza=pMeadowFilterExpression?"/FilteredTo/".concat(pMeadowFilterExpression):'';for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
5291
|
+
tmpDownloadURIFragments.push("".concat(_this82.options.urlPrefix).concat(pEntity,"s").concat(tmpFilterStanza,"/").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)
|
|
5292
|
+
_this82.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){_this82.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){if(pDownloadResponse&&pDownloadResponse.statusCode&&pDownloadResponse.statusCode>=400){_this82.log.error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(pURIFragment,"]: ").concat(pDownloadResponse.statusCode," ").concat(pDownloadResponse.statusMessage));return fDownloadCallback(new Error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(pURIFragment,"]: ").concat(pDownloadResponse.statusCode," ").concat(JSON.stringify(pDownloadBody||{}))));}tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
|
|
5293
|
+
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){if(tmpEntitySet){_this82.recordSetCache[pEntity].put(tmpEntitySet,pMeadowFilterExpression);}return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":68}],198:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase23){/**
|
|
5197
5294
|
* @param {Object} pFable - The Fable Framework instance
|
|
5198
5295
|
* @param {Object} pOptions - The options for the service
|
|
5199
5296
|
* @param {String} pServiceHash - The hash of the service
|
|
5200
|
-
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var
|
|
5297
|
+
*/function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this83;_classCallCheck2(this,PictTemplateProvider);_this83=_callSuper(this,PictTemplateProvider,[pFable,pOptions,pServiceHash]);/** @type {any} */_this83.log;/** @type {string} */_this83.UUID;/** @type {string} */_this83.Hash;_this83.serviceType='PictTemplateProvider';_this83.templates={};_this83.templateSources={};// Default templates are stored by prefix.
|
|
5201
5298
|
// The longest prefix match is used.
|
|
5202
5299
|
// Case sensitive.
|
|
5203
|
-
|
|
5300
|
+
_this83.defaultTemplates=[];/**
|
|
5204
5301
|
* @type {(hash?: string) => { template: string, source: string }?} loadTemplateFunction - The function to load a template
|
|
5205
|
-
*/
|
|
5302
|
+
*/_this83.loadTemplateFunction=function(){return null;};return _this83;}/**
|
|
5206
5303
|
* Add a template to the provider.
|
|
5207
5304
|
*
|
|
5208
5305
|
* @param {String} pTemplateHash - The hash of the template
|
|
5209
5306
|
* @param {String} pTemplate - The template
|
|
5210
5307
|
* @param {String} [pTemplateSource] - (optional) The source of the template
|
|
5211
|
-
*/_inherits(PictTemplateProvider,
|
|
5308
|
+
*/_inherits(PictTemplateProvider,_libFableServiceBase23);return _createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}/**
|
|
5212
5309
|
* Add a default template to the provider.
|
|
5213
5310
|
*
|
|
5214
5311
|
* @param {String} pPrefix - The prefix of the template identifier.
|
|
@@ -5265,35 +5362,35 @@ if(!(pTemplateHash in this.templates)){this.checkDefaultTemplateHash(pTemplateHa
|
|
|
5265
5362
|
* Pict management object.
|
|
5266
5363
|
*/var Pict=/*#__PURE__*/function(_libFable){/**
|
|
5267
5364
|
* @param {Object<String, any>} pSettings - The settings for the Pict instance.
|
|
5268
|
-
*/function Pict(pSettings){var
|
|
5269
|
-
/** @type {any} */
|
|
5270
|
-
|
|
5365
|
+
*/function Pict(pSettings){var _this84;_classCallCheck2(this,Pict);_this84=_callSuper(this,Pict,[pSettings]);/** @type {any} */_this84.settings;_this84.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");/** @type {Object} */_this84._PackageFable=_this84._Package;/** @type {Record<string, any>} */_this84._Package=libPackage;_this84.browserAddress="window._Pict";if("BrowserAddress"in _this84.settings){_this84.browserAddress=_this84.settings.BrowserAddress;}_this84.children=[];/** @type {import('pict-application')} */_this84.PictApplication=null;// shim types from fable until we export types properly
|
|
5366
|
+
/** @type {any} */_this84.log;//NOTE: This needs to come before any other providers which may instantiate a rest client so we don't proliferate them
|
|
5367
|
+
_this84.instantiateServiceProvider("RestClient");/**
|
|
5271
5368
|
* The templateProvider provides a basic key->template mapping with default fallback capabilities
|
|
5272
5369
|
*
|
|
5273
5370
|
* @type {PictTemplateProvider}
|
|
5274
|
-
*/
|
|
5371
|
+
*/_this84.TemplateProvider=null;_this84.addAndInstantiateServiceType("TemplateProvider",PictTemplateProvider);/**
|
|
5275
5372
|
* The meadow entity provider.
|
|
5276
5373
|
*
|
|
5277
5374
|
* @type {PictMeadowEntityProvider}
|
|
5278
|
-
*/
|
|
5375
|
+
*/_this84.EntityProvider=null;_this84.addAndInstantiateServiceType("EntityProvider",PictMeadowEntityProvider);/**
|
|
5279
5376
|
* The data provider.
|
|
5280
5377
|
*
|
|
5281
5378
|
* @type {PictDataProvider}
|
|
5282
|
-
*/
|
|
5379
|
+
*/_this84.DataProvider=null;_this84.addAndInstantiateServiceType("DataProvider",PictDataProvider);/**
|
|
5283
5380
|
* The content assignment module.
|
|
5284
5381
|
*
|
|
5285
5382
|
* @type {PictContentAssignment}
|
|
5286
|
-
*/
|
|
5383
|
+
*/_this84.ContentAssignment=null;_this84.addAndInstantiateServiceType("ContentAssignment",PictContentAssignment);/**
|
|
5287
5384
|
* The CSS module.
|
|
5288
5385
|
*
|
|
5289
5386
|
* @type {PictCSS}
|
|
5290
5387
|
* @public
|
|
5291
|
-
*/
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
if(
|
|
5296
|
-
|
|
5388
|
+
*/_this84.CSSMap=null;_this84.addAndInstantiateServiceType("CSSMap",PictCSS);_this84.addServiceType("PictTemplate",require("pict-template"));_this84.instantiateServiceProvider("MetaTemplate");_this84.instantiateServiceProvider("DataGeneration");_this84.manifest=_this84.instantiateServiceProvider("Manifest");/** @type {Record<string, any>} */_this84.AppData={};if("DefaultAppData"in _this84.fable.settings){_this84.AppData=_this84.fable.settings.DefaultAppData;}/** @type {Record<string, any>} */_this84.Bundle={};if("DefaultBundle"in _this84.fable.settings){_this84.Bundle=_this84.fable.settings.DefaultBundle;}// Log noisness goes from 0 - 5, where 5 is show me everything.
|
|
5389
|
+
_this84.LogNoisiness=0;// Although we have log noisiness, sometimes we need control flow without all the other noise for hard to diagnose interpreters.
|
|
5390
|
+
_this84.LogControlFlow=false;// And an easy way to be introspective about data at various locations
|
|
5391
|
+
_this84.LogControlFlowWatchAddressList=[];// Load manifest sets
|
|
5392
|
+
if(_this84.settings.Manifests){_this84.loadManifestSet(_this84.settings.Manifests);}_this84._DefaultPictTemplatesInitialized=false;_this84.initializePictTemplateEngine();_this84.addServiceType("PictView",require("pict-view"));_this84.addServiceType("PictProvider",require("pict-provider"));_this84.addServiceType("PictApplication",require("pict-application"));// Expose the named views directly, through a convenience accessor
|
|
5393
|
+
_this84.providers=_this84.servicesMap.PictProvider;_this84.views=_this84.servicesMap.PictView;return _this84;}/**
|
|
5297
5394
|
* Load manifests in as Hashed services
|
|
5298
5395
|
*
|
|
5299
5396
|
* @param {Object<String, String>} pManifestSet - The manifest set to load.
|
|
@@ -5406,7 +5503,7 @@ this.addTemplate(require("./templates/debugging/Pict-Template-Breakpoint.js"));t
|
|
|
5406
5503
|
* @param {Array<any>} [pContextArray] - The context array to resolve
|
|
5407
5504
|
*
|
|
5408
5505
|
* @return {any} The value at the given address, or undefined
|
|
5409
|
-
*/},{key:"setStateValueAtAddress",value:function setStateValueAtAddress(pAddress,pRecord,pValue,pContextArray){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];
|
|
5506
|
+
*/},{key:"setStateValueAtAddress",value:function setStateValueAtAddress(pAddress,pRecord,pValue,pContextArray){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this];var tmpAddressSpace={Fable:this.fable,Pict:this,AppData:this.AppData,Bundle:this.Bundle,Context:tmpContextArray,Record:pRecord};return this.manifest.setValueByHash(tmpAddressSpace,pAddress,pValue);}/**
|
|
5410
5507
|
* Parse a template.
|
|
5411
5508
|
*
|
|
5412
5509
|
* @param {String} pTemplateString - The template string to parse
|
|
@@ -5415,7 +5512,7 @@ this.addTemplate(require("./templates/debugging/Pict-Template-Breakpoint.js"));t
|
|
|
5415
5512
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
5416
5513
|
*
|
|
5417
5514
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5418
|
-
*/},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var
|
|
5515
|
+
*/},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback,pContextArray){var _this85=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(_this85.LogControlFlow&&_this85.LogNoisiness>1){_this85.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;}}/**
|
|
5419
5516
|
* Parse a template by hash.
|
|
5420
5517
|
*
|
|
5421
5518
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5434,8 +5531,8 @@ if(!tmpTemplateString){tmpTemplateString="";}return this.parseTemplate(tmpTempla
|
|
|
5434
5531
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
5435
5532
|
*
|
|
5436
5533
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5437
|
-
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var
|
|
5438
|
-
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return
|
|
5534
|
+
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this86=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
5535
|
+
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this86.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 _i68=0;_i68<tmpKeys.length;_i68++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i68]],null,pContextArray);}}return tmpValue;}else{return"";}}}/**
|
|
5439
5536
|
* Parse a template set by hash.
|
|
5440
5537
|
*
|
|
5441
5538
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5454,8 +5551,8 @@ if(!tmpTemplateString){tmpTemplateString="";}return this.parseTemplateSet(tmpTem
|
|
|
5454
5551
|
* @param {Array<any>} [pContextArray] - The context array to use in the template
|
|
5455
5552
|
*
|
|
5456
5553
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5457
|
-
*/},{key:"parseTemplateSetWithPayload",value:function parseTemplateSetWithPayload(pTemplateString,pDataSet,pPayload,fCallback,pContextArray){var
|
|
5458
|
-
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return
|
|
5554
|
+
*/},{key:"parseTemplateSetWithPayload",value:function parseTemplateSetWithPayload(pTemplateString,pDataSet,pPayload,fCallback,pContextArray){var _this87=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
5555
|
+
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this87.parseTemplate(pTemplateString,{Data:pRecord,Payload:pPayload},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,{Data:pDataSet[i],Payload:pPayload},null,pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i69=0;_i69<tmpKeys.length;_i69++){tmpValue+=this.parseTemplate(pTemplateString,{Data:pDataSet[tmpKeys[_i69]],Payload:pPayload},null,pContextArray);}}return tmpValue;}else{return"";}}}/**
|
|
5459
5556
|
* Parse a template set by hash.
|
|
5460
5557
|
*
|
|
5461
5558
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5569,7 +5666,7 @@ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".c
|
|
|
5569
5666
|
* @param {Object} pFable - The Fable Framework instance
|
|
5570
5667
|
* @param {Object} pOptions - The options for the service
|
|
5571
5668
|
* @param {String} pServiceHash - The hash of the service
|
|
5572
|
-
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var
|
|
5669
|
+
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var _this88;_classCallCheck2(this,PictTemplateProviderData);_this88=_callSuper(this,PictTemplateProviderData,[pFable,pOptions,pServiceHash]);/** @type {any} */_this88.log;_this88.addPattern('{~Data:','~}');_this88.addPattern('{~D:','~}');return _this88;}/**
|
|
5573
5670
|
* Render a template expression, returning a string with the resulting content or an optional default value.
|
|
5574
5671
|
*
|
|
5575
5672
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5581,7 +5678,7 @@ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".c
|
|
|
5581
5678
|
* @param {Object} pFable - The Fable Framework instance
|
|
5582
5679
|
* @param {Object} pOptions - The options for the service
|
|
5583
5680
|
* @param {String} pServiceHash - The hash of the service
|
|
5584
|
-
*/function PictTemplateProviderDataValueByKey(pFable,pOptions,pServiceHash){var
|
|
5681
|
+
*/function PictTemplateProviderDataValueByKey(pFable,pOptions,pServiceHash){var _this89;_classCallCheck2(this,PictTemplateProviderDataValueByKey);_this89=_callSuper(this,PictTemplateProviderDataValueByKey,[pFable,pOptions,pServiceHash]);/** @type {any} */_this89.log;_this89.addPattern('{~DataValueByKey:','~}');_this89.addPattern('{~DVBK:','~}');return _this89;}/**
|
|
5585
5682
|
* Render a template expression, returning a string with the resulting content.
|
|
5586
5683
|
*
|
|
5587
5684
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5593,7 +5690,7 @@ return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".c
|
|
|
5593
5690
|
* @param {Object} pFable - The Fable Framework instance
|
|
5594
5691
|
* @param {Object} pOptions - The options for the service
|
|
5595
5692
|
* @param {String} pServiceHash - The hash of the service
|
|
5596
|
-
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var
|
|
5693
|
+
*/function PictTemplateProviderData(pFable,pOptions,pServiceHash){var _this90;_classCallCheck2(this,PictTemplateProviderData);_this90=_callSuper(this,PictTemplateProviderData,[pFable,pOptions,pServiceHash]);/** @type {any} */_this90.log;_this90.addPattern('{~DataWithTemplateFallback:','~}');_this90.addPattern('{~DWTF:','~}');return _this90;}/**
|
|
5597
5694
|
* Render a template expression, returning a string with the resulting content or an optional default template string from an address.
|
|
5598
5695
|
*
|
|
5599
5696
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5613,13 +5710,13 @@ return'';}if(this.pict.LogNoisiness>3){this.log.trace("PICT DataWithTemplateFall
|
|
|
5613
5710
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5614
5711
|
*
|
|
5615
5712
|
* @return {void} The result is passed to the callback function
|
|
5616
|
-
*/},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var
|
|
5617
|
-
this.pict.parseTemplateByHash(tmpTemplateFallbackAddress,tmpRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}if(pValue==null||pValue===''){
|
|
5618
|
-
return tmpCallback(null,'');}if(
|
|
5713
|
+
*/},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var _this91=this;var tmpHash=pTemplateHash.trim();var tmpRecord=_typeof(pRecord)==='object'?pRecord:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT DataWithTemplateFallback [fDataRender]::[".concat(tmpHash,"] with tmpRecord:"),tmpRecord);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT DataWithTemplateFallback [fDataRender]::[".concat(tmpHash,"]"));}var tmpTemplateFallbackAddress='';if(tmpHash.indexOf(':')>-1){tmpTemplateFallbackAddress=tmpHash.split(':')[1];tmpHash=tmpHash.split(':')[0];}var tmpValue='';if(tmpHash!=null){tmpValue=this.resolveStateFromAddress(tmpHash,tmpRecord,pContextArray);if(tmpValue&&tmpValue!=='undefined'){if(this.pict.LogNoisiness>3){this.log.trace("PICT DataWithTemplateFallback [fDataRender]::[".concat(tmpHash,"] - Found value: ").concat(tmpValue));}return tmpCallback(null,tmpValue);}}// If the value is not found or is undefined, try to use the fallback template
|
|
5714
|
+
this.pict.parseTemplateByHash(tmpTemplateFallbackAddress,tmpRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}if(pValue==null||pValue===''){_this91.log.warn("PICT DataWithTemplateFallback [fDataRender]::[".concat(tmpHash,"] - No fallback template found at address: ").concat(tmpTemplateFallbackAddress));// If no fallback template is found, return an empty string
|
|
5715
|
+
return tmpCallback(null,'');}if(_this91.pict.LogNoisiness>3){_this91.log.trace("PICT DataWithTemplateFallback [fDataRender]::[".concat(tmpHash,"] - Using fallback template from address: ").concat(tmpTemplateFallbackAddress));}return tmpCallback(null,pValue);},pContextArray);}}]);}(libPictTemplate);module.exports=PictTemplateProviderData;},{"pict-template":143}],205:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderEntity=/*#__PURE__*/function(_libPictTemplate4){/**
|
|
5619
5716
|
* @param {Object} pFable - The Fable Framework instance
|
|
5620
5717
|
* @param {Object} pOptions - The options for the service
|
|
5621
5718
|
* @param {String} pServiceHash - The hash of the service
|
|
5622
|
-
*/function PictTemplateProviderEntity(pFable,pOptions,pServiceHash){var
|
|
5719
|
+
*/function PictTemplateProviderEntity(pFable,pOptions,pServiceHash){var _this92;_classCallCheck2(this,PictTemplateProviderEntity);_this92=_callSuper(this,PictTemplateProviderEntity,[pFable,pOptions,pServiceHash]);/** @type {any} */_this92.log;_this92.addPattern('{~E:','~}');_this92.addPattern('{~Entity:','~}');return _this92;}/**
|
|
5623
5720
|
* Render a template expression, returning a string with the resulting content.
|
|
5624
5721
|
*
|
|
5625
5722
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5646,7 +5743,7 @@ if(tmpEntityTemplate){this.pict.parseTemplateByHash(tmpEntityTemplate,pRecord,tm
|
|
|
5646
5743
|
* @param {Object} pFable - The Fable Framework instance
|
|
5647
5744
|
* @param {Object} pOptions - The options for the service
|
|
5648
5745
|
* @param {String} pServiceHash - The hash of the service
|
|
5649
|
-
*/function PictTemplateProviderSelf(pFable,pOptions,pServiceHash){var
|
|
5746
|
+
*/function PictTemplateProviderSelf(pFable,pOptions,pServiceHash){var _this93;_classCallCheck2(this,PictTemplateProviderSelf);_this93=_callSuper(this,PictTemplateProviderSelf,[pFable,pOptions,pServiceHash]);_this93.addPattern('{~Pict','~}');_this93.addPattern('{~P','~}');_this93.addPattern('{~p','~}');return _this93;}/**
|
|
5650
5747
|
* Render a template expression, returning a string with the resulting content.
|
|
5651
5748
|
*
|
|
5652
5749
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5658,7 +5755,7 @@ if(tmpEntityTemplate){this.pict.parseTemplateByHash(tmpEntityTemplate,pRecord,tm
|
|
|
5658
5755
|
* @param {Object} pFable - The Fable Framework instance
|
|
5659
5756
|
* @param {Object} pOptions - The options for the service
|
|
5660
5757
|
* @param {String} pServiceHash - The hash of the service
|
|
5661
|
-
*/function PictTemplateProviderSolveByReference(pFable,pOptions,pServiceHash){var
|
|
5758
|
+
*/function PictTemplateProviderSolveByReference(pFable,pOptions,pServiceHash){var _this94;_classCallCheck2(this,PictTemplateProviderSolveByReference);_this94=_callSuper(this,PictTemplateProviderSolveByReference,[pFable,pOptions,pServiceHash]);/** @type {any} */_this94.log;_this94.addPattern('{~SolveByReference:','~}');_this94.addPattern('{~SBR:','~}');return _this94;}/**
|
|
5662
5759
|
* Render a template expression, returning a string with the resulting content.
|
|
5663
5760
|
*
|
|
5664
5761
|
* @param {string} pSolveParams - The solver parameters.
|
|
@@ -5671,7 +5768,7 @@ var _pSolveParams$trim$sp=pSolveParams.trim().split(':',3),_pSolveParams$trim$sp
|
|
|
5671
5768
|
* @param {Object} pFable - The Fable Framework instance
|
|
5672
5769
|
* @param {Object} pOptions - The options for the service
|
|
5673
5770
|
* @param {String} pServiceHash - The hash of the service
|
|
5674
|
-
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var
|
|
5771
|
+
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var _this95;_classCallCheck2(this,PictTemplateProviderTemplate);_this95=_callSuper(this,PictTemplateProviderTemplate,[pFable,pOptions,pServiceHash]);/** @type {any} */_this95.log;_this95.addPattern('{~Template:','~}');_this95.addPattern('{~T:','~}');return _this95;}/**
|
|
5675
5772
|
* Render a template expression, returning a string with the resulting content.
|
|
5676
5773
|
*
|
|
5677
5774
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5699,7 +5796,7 @@ this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,function(pError,pValue){if
|
|
|
5699
5796
|
* @param {Object} pFable - The Fable Framework instance
|
|
5700
5797
|
* @param {Object} pOptions - The options for the service
|
|
5701
5798
|
* @param {String} pServiceHash - The hash of the service
|
|
5702
|
-
*/function PictTemplateProviderTemplateByDataAddress(pFable,pOptions,pServiceHash){var
|
|
5799
|
+
*/function PictTemplateProviderTemplateByDataAddress(pFable,pOptions,pServiceHash){var _this96;_classCallCheck2(this,PictTemplateProviderTemplateByDataAddress);_this96=_callSuper(this,PictTemplateProviderTemplateByDataAddress,[pFable,pOptions,pServiceHash]);/** @type {any} */_this96.log;_this96.addPattern('{~TemplateByDataAddress:','~}');_this96.addPattern('{~TBDA:','~}');return _this96;}/**
|
|
5703
5800
|
* Render a template expression, returning a string with the resulting content.
|
|
5704
5801
|
*
|
|
5705
5802
|
* @param {string} pTemplateDataAddress - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5727,7 +5824,7 @@ this.pict.parseTemplate(tmpTemplate,pRecord,function(pError,pValue){if(pError){r
|
|
|
5727
5824
|
* @param {Object} pFable - The Fable Framework instance
|
|
5728
5825
|
* @param {Object} pOptions - The options for the service
|
|
5729
5826
|
* @param {String} pServiceHash - The hash of the service
|
|
5730
|
-
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var
|
|
5827
|
+
*/function PictTemplateProviderTemplate(pFable,pOptions,pServiceHash){var _this97;_classCallCheck2(this,PictTemplateProviderTemplate);_this97=_callSuper(this,PictTemplateProviderTemplate,[pFable,pOptions,pServiceHash]);/** @type {any} */_this97.log;_this97.addPattern('{~TemplateByReference:','~}');_this97.addPattern('{~TBR:','~}');return _this97;}/**
|
|
5731
5828
|
* Render a template expression, returning a string with the resulting content.
|
|
5732
5829
|
*
|
|
5733
5830
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5755,11 +5852,11 @@ if(!tmpTemplateHashReferenceLocation){this.log.warn("Pict: Template Render Async
|
|
|
5755
5852
|
var tmpTemplateHash=this.resolveStateFromAddress(tmpTemplateHashReferenceLocation,pRecord,pContextArray);// No template hash
|
|
5756
5853
|
if(!tmpTemplateHash){this.log.warn("Pict: Template Render Async: TemplateHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
5757
5854
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
5758
|
-
this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplate;},{"pict-template":143}],211:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateFromMap=/*#__PURE__*/function(
|
|
5855
|
+
this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplate;},{"pict-template":143}],211:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateFromMap=/*#__PURE__*/function(_libPictTemplate10){/**
|
|
5759
5856
|
* @param {Object} pFable - The Fable Framework instance
|
|
5760
5857
|
* @param {Object} pOptions - The options for the service
|
|
5761
5858
|
* @param {String} pServiceHash - The hash of the service
|
|
5762
|
-
*/function PictTemplateProviderTemplateFromMap(pFable,pOptions,pServiceHash){var
|
|
5859
|
+
*/function PictTemplateProviderTemplateFromMap(pFable,pOptions,pServiceHash){var _this98;_classCallCheck2(this,PictTemplateProviderTemplateFromMap);_this98=_callSuper(this,PictTemplateProviderTemplateFromMap,[pFable,pOptions,pServiceHash]);/** @type {any} */_this98.log;_this98.addPattern('{~TFM:','~}');_this98.addPattern('{~TemplateFromMap:','~}');return _this98;}/**
|
|
5763
5860
|
* Render a template expression, returning a string with the resulting content.
|
|
5764
5861
|
*
|
|
5765
5862
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5767,7 +5864,7 @@ this.pict.parseTemplateByHash(tmpTemplateHash,pRecord,function(pError,pValue){if
|
|
|
5767
5864
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5768
5865
|
*
|
|
5769
5866
|
* @return {string} The rendered template
|
|
5770
|
-
*/_inherits(PictTemplateProviderTemplateFromMap,
|
|
5867
|
+
*/_inherits(PictTemplateProviderTemplateFromMap,_libPictTemplate10);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
|
|
5771
5868
|
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
|
|
5772
5869
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
5773
5870
|
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.
|
|
@@ -5785,11 +5882,11 @@ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){this
|
|
|
5785
5882
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
5786
5883
|
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 fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
5787
5884
|
// The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
|
|
5788
|
-
this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateFromMap;},{"pict-template":143}],212:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateSet=/*#__PURE__*/function(
|
|
5885
|
+
this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateFromMap;},{"pict-template":143}],212:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateSet=/*#__PURE__*/function(_libPictTemplate11){/**
|
|
5789
5886
|
* @param {Object} pFable - The Fable Framework instance
|
|
5790
5887
|
* @param {Object} pOptions - The options for the service
|
|
5791
5888
|
* @param {String} pServiceHash - The hash of the service
|
|
5792
|
-
*/function PictTemplateProviderTemplateSet(pFable,pOptions,pServiceHash){var
|
|
5889
|
+
*/function PictTemplateProviderTemplateSet(pFable,pOptions,pServiceHash){var _this99;_classCallCheck2(this,PictTemplateProviderTemplateSet);_this99=_callSuper(this,PictTemplateProviderTemplateSet,[pFable,pOptions,pServiceHash]);/** @type {any} */_this99.log;_this99.addPattern('{~TemplateSet:','~}');_this99.addPattern('{~TS:','~}');return _this99;}/**
|
|
5793
5890
|
* Render a template expression, returning a string with the resulting content.
|
|
5794
5891
|
*
|
|
5795
5892
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5797,7 +5894,7 @@ this.pict.parseTemplateByHash(tmpTemplateFromMapHash,pRecord,function(pError,pVa
|
|
|
5797
5894
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5798
5895
|
*
|
|
5799
5896
|
* @return {string} The rendered template
|
|
5800
|
-
*/_inherits(PictTemplateProviderTemplateSet,
|
|
5897
|
+
*/_inherits(PictTemplateProviderTemplateSet,_libPictTemplate11);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)
|
|
5801
5898
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
5802
5899
|
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return'';}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
5803
5900
|
return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArray);}else{return this.pict.parseTemplateSetByHash(tmpTemplateHash,this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray),null,pContextArray);}}/**
|
|
@@ -5814,11 +5911,11 @@ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this
|
|
|
5814
5911
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
5815
5912
|
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
5816
5913
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
5817
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateSet;},{"pict-template":143}],213:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateSetFromMap=/*#__PURE__*/function(
|
|
5914
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateSet;},{"pict-template":143}],213:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateSetFromMap=/*#__PURE__*/function(_libPictTemplate12){/**
|
|
5818
5915
|
* @param {Object} pFable - The Fable Framework instance
|
|
5819
5916
|
* @param {Object} pOptions - The options for the service
|
|
5820
5917
|
* @param {String} pServiceHash - The hash of the service
|
|
5821
|
-
*/function PictTemplateProviderTemplateSetFromMap(pFable,pOptions,pServiceHash){var
|
|
5918
|
+
*/function PictTemplateProviderTemplateSetFromMap(pFable,pOptions,pServiceHash){var _this100;_classCallCheck2(this,PictTemplateProviderTemplateSetFromMap);_this100=_callSuper(this,PictTemplateProviderTemplateSetFromMap,[pFable,pOptions,pServiceHash]);/** @type {any} */_this100.log;_this100.addPattern('{~TSFM:','~}');_this100.addPattern('{~TemplateSetFromMap:','~}');return _this100;}/**
|
|
5822
5919
|
* Render a template expression, returning a string with the resulting content.
|
|
5823
5920
|
*
|
|
5824
5921
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5826,7 +5923,7 @@ this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,
|
|
|
5826
5923
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5827
5924
|
*
|
|
5828
5925
|
* @return {string} The rendered template
|
|
5829
|
-
*/_inherits(PictTemplateProviderTemplateSetFromMap,
|
|
5926
|
+
*/_inherits(PictTemplateProviderTemplateSetFromMap,_libPictTemplate12);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
|
|
5830
5927
|
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
|
|
5831
5928
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return'';}// Now resolve the data
|
|
5832
5929
|
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.
|
|
@@ -5844,11 +5941,11 @@ var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<3){this
|
|
|
5844
5941
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMapSet Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
5845
5942
|
var tmpMap=this.resolveStateFromAddress(tmpAddressOfMap,tmpData,pContextArray);var tmpKey=this.resolveStateFromAddress(tmpAddressOfKey,tmpData,pContextArray);if(!tmpMap){this.log.warn("Pict: TemplateFromMapSet Render: Map not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}tmpData=tmpMap[tmpKey];if(!tmpData){// No address was provided, just render the TemplateFromMap with what this TemplateFromMap has.
|
|
5846
5943
|
// The async portion of this is a mind bender because of how entry can happen dynamically from TemplateFromMaps
|
|
5847
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateSetFromMap;},{"pict-template":143}],214:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateSetWithPayload=/*#__PURE__*/function(
|
|
5944
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateSetFromMap;},{"pict-template":143}],214:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateSetWithPayload=/*#__PURE__*/function(_libPictTemplate13){/**
|
|
5848
5945
|
* @param {Object} pFable - The Fable Framework instance
|
|
5849
5946
|
* @param {Object} pOptions - The options for the service
|
|
5850
5947
|
* @param {String} pServiceHash - The hash of the service
|
|
5851
|
-
*/function PictTemplateProviderTemplateSetWithPayload(pFable,pOptions,pServiceHash){var
|
|
5948
|
+
*/function PictTemplateProviderTemplateSetWithPayload(pFable,pOptions,pServiceHash){var _this101;_classCallCheck2(this,PictTemplateProviderTemplateSetWithPayload);_this101=_callSuper(this,PictTemplateProviderTemplateSetWithPayload,[pFable,pOptions,pServiceHash]);/** @type {any} */_this101.log;_this101.addPattern('{~TemplateSetWithPayload:','~}');_this101.addPattern('{~TSWP:','~}');return _this101;}/**
|
|
5852
5949
|
* Render a template expression, returning a string with the resulting content.
|
|
5853
5950
|
*
|
|
5854
5951
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5856,7 +5953,7 @@ this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,
|
|
|
5856
5953
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5857
5954
|
*
|
|
5858
5955
|
* @return {string} The rendered template
|
|
5859
|
-
*/_inherits(PictTemplateProviderTemplateSetWithPayload,
|
|
5956
|
+
*/_inherits(PictTemplateProviderTemplateSetWithPayload,_libPictTemplate13);return _createClass2(PictTemplateProviderTemplateSetWithPayload,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateSetWithPayloadRender]::[".concat(tmpHash,"] with record:"),pRecord);}else if(this.pict.LogNoisiness>0){this.log.trace("PICT Template [fTemplateSetWithPayloadRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash;var tmpAddressOfData;var tmpAddressOfPayload;// This is just a simple 3 part hash (template, address of set, address of payload)
|
|
5860
5957
|
var tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){this.log.trace("PICT Template [fTemplateSetWithPayloadRender]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return"";}tmpTemplateHash=tmpTemplateHashes[0];tmpAddressOfData=tmpTemplateHashes[1];tmpAddressOfPayload=tmpTemplateHashes[2];var tmpData=this.resolveStateFromAddress(tmpAddressOfData,pRecord,pContextArray);if(!tmpData){tmpData=pRecord;}if(!tmpData){tmpData={};}var tmpPayloadData=this.resolveStateFromAddress(tmpAddressOfPayload,pRecord,pContextArray);if(!tmpPayloadData){tmpPayloadData=pRecord;}if(!tmpPayloadData){tmpPayloadData={};}return this.pict.parseTemplateSetWithPayloadByHash(tmpTemplateHash,tmpData,tmpPayloadData,null,pContextArray);}/**
|
|
5861
5958
|
* Render a template expression, deliver a string with the resulting content to a callback function.
|
|
5862
5959
|
*
|
|
@@ -5867,11 +5964,11 @@ var tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){t
|
|
|
5867
5964
|
*
|
|
5868
5965
|
* @return {void}
|
|
5869
5966
|
*/},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var tmpHash=pTemplateHash.trim();var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateSetWithPayloadRenderAsync]::[".concat(tmpHash,"]"));}else if(this.pict.LogNoisiness>0){this.log.trace("PICT Template [fTemplateSetWithPayloadRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateHash;var tmpAddressOfData;var tmpAddressOfPayload;// This is just a simple 3 part hash (template, address of set, address of payload)
|
|
5870
|
-
var tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){this.log.trace("PICT Template [fTemplateSetWithPayloadRender]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return fCallback(null,'');}tmpTemplateHash=tmpTemplateHashes[0];tmpAddressOfData=tmpTemplateHashes[1];tmpAddressOfPayload=tmpTemplateHashes[2];var tmpData=this.resolveStateFromAddress(tmpAddressOfData,pRecord,pContextArray);if(!tmpData){tmpData=pRecord;}if(!tmpData){tmpData={};}var tmpPayloadData=this.resolveStateFromAddress(tmpAddressOfPayload,pRecord,pContextArray);if(!tmpPayloadData){tmpPayloadData=pRecord;}if(!tmpPayloadData){tmpPayloadData={};}return this.pict.parseTemplateSetWithPayloadByHash(tmpTemplateHash,tmpData,tmpPayloadData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateSetWithPayload;},{"pict-template":143}],215:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateValueSet=/*#__PURE__*/function(
|
|
5967
|
+
var tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){this.log.trace("PICT Template [fTemplateSetWithPayloadRender]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return fCallback(null,'');}tmpTemplateHash=tmpTemplateHashes[0];tmpAddressOfData=tmpTemplateHashes[1];tmpAddressOfPayload=tmpTemplateHashes[2];var tmpData=this.resolveStateFromAddress(tmpAddressOfData,pRecord,pContextArray);if(!tmpData){tmpData=pRecord;}if(!tmpData){tmpData={};}var tmpPayloadData=this.resolveStateFromAddress(tmpAddressOfPayload,pRecord,pContextArray);if(!tmpPayloadData){tmpPayloadData=pRecord;}if(!tmpPayloadData){tmpPayloadData={};}return this.pict.parseTemplateSetWithPayloadByHash(tmpTemplateHash,tmpData,tmpPayloadData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateSetWithPayload;},{"pict-template":143}],215:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateValueSet=/*#__PURE__*/function(_libPictTemplate14){/**
|
|
5871
5968
|
* @param {Object} pFable - The Fable Framework instance
|
|
5872
5969
|
* @param {Object} pOptions - The options for the service
|
|
5873
5970
|
* @param {String} pServiceHash - The hash of the service
|
|
5874
|
-
*/function PictTemplateProviderTemplateValueSet(pFable,pOptions,pServiceHash){var
|
|
5971
|
+
*/function PictTemplateProviderTemplateValueSet(pFable,pOptions,pServiceHash){var _this102;_classCallCheck2(this,PictTemplateProviderTemplateValueSet);_this102=_callSuper(this,PictTemplateProviderTemplateValueSet,[pFable,pOptions,pServiceHash]);/** @type {any} */_this102.log;_this102.addPattern('{~TemplateValueSet:','~}');_this102.addPattern('{~TVS:','~}');return _this102;}/**
|
|
5875
5972
|
* Render a template expression, returning a string with the resulting content.
|
|
5876
5973
|
*
|
|
5877
5974
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5879,9 +5976,9 @@ var tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){t
|
|
|
5879
5976
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5880
5977
|
*
|
|
5881
5978
|
* @return {string} The rendered template
|
|
5882
|
-
*/_inherits(PictTemplateProviderTemplateValueSet,
|
|
5979
|
+
*/_inherits(PictTemplateProviderTemplateValueSet,_libPictTemplate14);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)
|
|
5883
5980
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
5884
|
-
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return'';}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
|
|
5981
|
+
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return'';}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 _i70=0;_i70<tmpValueKeys.length;_i70++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i70]],Key:tmpValueKeys[_i70]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
5885
5982
|
return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArray);}else{return this.pict.parseTemplateSetByHash(tmpTemplateHash,tmpData,null,pContextArray);}}/**
|
|
5886
5983
|
* Render a template expression, deliver a string with the resulting content to a callback function.
|
|
5887
5984
|
*
|
|
@@ -5894,13 +5991,13 @@ return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArr
|
|
|
5894
5991
|
*/},{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
|
|
5895
5992
|
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
|
|
5896
5993
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
5897
|
-
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
|
|
5994
|
+
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 _i71=0;_i71<tmpValueKeys.length;_i71++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i71]],Key:tmpData[tmpValueKeys[_i71]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
5898
5995
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
5899
|
-
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateValueSet;},{"pict-template":143}],216:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderView=/*#__PURE__*/function(
|
|
5996
|
+
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateValueSet;},{"pict-template":143}],216:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderView=/*#__PURE__*/function(_libPictTemplate15){/**
|
|
5900
5997
|
* @param {Object} pFable - The Fable Framework instance
|
|
5901
5998
|
* @param {Object} pOptions - The options for the service
|
|
5902
5999
|
* @param {String} pServiceHash - The hash of the service
|
|
5903
|
-
*/function PictTemplateProviderView(pFable,pOptions,pServiceHash){var
|
|
6000
|
+
*/function PictTemplateProviderView(pFable,pOptions,pServiceHash){var _this103;_classCallCheck2(this,PictTemplateProviderView);_this103=_callSuper(this,PictTemplateProviderView,[pFable,pOptions,pServiceHash]);/** @type {any} */_this103.log;_this103.addPattern('{~V:','~}');_this103.addPattern('{~View:','~}');if(!('__TemplateOutputCache'in _this103.pict)){_this103.pict.__TemplateOutputCache={};}return _this103;}/**
|
|
5904
6001
|
* Render a template expression, returning a string with the resulting content.
|
|
5905
6002
|
*
|
|
5906
6003
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5908,7 +6005,7 @@ this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,
|
|
|
5908
6005
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5909
6006
|
*
|
|
5910
6007
|
* @return {string} The rendered template
|
|
5911
|
-
*/_inherits(PictTemplateProviderView,
|
|
6008
|
+
*/_inherits(PictTemplateProviderView,_libPictTemplate15);return _createClass2(PictTemplateProviderView,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpViewHash=pTemplateHash.trim();if(!(tmpViewHash in this.pict.views)){this.log.warn("Pict: View Template Render: View not found for [".concat(tmpViewHash,"]"));return'';}var tmpRenderGUID=this.pict.getUUID();var tmpView=this.pict.views[tmpViewHash];tmpView.render('__Virtual',"__TemplateOutputCache.".concat(tmpRenderGUID),pRecord);var tmpResult=this.pict.__TemplateOutputCache[tmpRenderGUID];// TODO: Uncomment this when we like how it's working
|
|
5912
6009
|
//delete this.pict.__TemplateOutputCache[tmpRenderGUID];
|
|
5913
6010
|
return tmpResult;}/**
|
|
5914
6011
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5916,13 +6013,13 @@ return tmpResult;}/**
|
|
|
5916
6013
|
* @param {(pError?: Error, pResult?: string) => void} fCallback - The callback function to call with the result
|
|
5917
6014
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5918
6015
|
* @return {void}
|
|
5919
|
-
*/},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var
|
|
6016
|
+
*/},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var _this104=this;var tmpViewHash=pTemplateHash.trim();if(!(tmpViewHash in this.pict.views)){this.log.warn("Pict: View Template Render: View not found for [".concat(tmpViewHash,"]"));return fCallback(null,'');}var tmpRenderGUID=this.pict.getUUID();var tmpView=this.pict.views[tmpViewHash];return tmpView.renderAsync('__Virtual',"__TemplateOutputCache.".concat(tmpRenderGUID),pRecord,function(pError,pResult){if(pError){_this104.log.warn("Pict: View Template Render: Error rendering view [".concat(tmpViewHash,"]"),pError);return fCallback(pError,'');}var tmpResult=_this104.pict.__TemplateOutputCache[tmpRenderGUID];// TODO: Uncomment this when we like how it's working
|
|
5920
6017
|
//delete this.pict.__TemplateOutputCache[tmpRenderGUID];
|
|
5921
|
-
return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictTemplateProviderView;},{"pict-template":143}],217:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderRandomNumber=/*#__PURE__*/function(
|
|
6018
|
+
return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictTemplateProviderView;},{"pict-template":143}],217:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderRandomNumber=/*#__PURE__*/function(_libPictTemplate16){/**
|
|
5922
6019
|
* @param {Object} pFable - The Fable Framework instance
|
|
5923
6020
|
* @param {Object} pOptions - The options for the service
|
|
5924
6021
|
* @param {String} pServiceHash - The hash of the service
|
|
5925
|
-
*/function PictTemplateProviderRandomNumber(pFable,pOptions,pServiceHash){var
|
|
6022
|
+
*/function PictTemplateProviderRandomNumber(pFable,pOptions,pServiceHash){var _this105;_classCallCheck2(this,PictTemplateProviderRandomNumber);_this105=_callSuper(this,PictTemplateProviderRandomNumber,[pFable,pOptions,pServiceHash]);/** @type {any} */_this105.log;_this105.addPattern('{~RandomNumber:','~}');_this105.addPattern('{~RN:','~}');return _this105;}/**
|
|
5926
6023
|
* Render a template expression, returning a string with the resulting content.
|
|
5927
6024
|
*
|
|
5928
6025
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5930,11 +6027,11 @@ return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictT
|
|
|
5930
6027
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5931
6028
|
*
|
|
5932
6029
|
* @return {string} The rendered template
|
|
5933
|
-
*/_inherits(PictTemplateProviderRandomNumber,
|
|
6030
|
+
*/_inherits(PictTemplateProviderRandomNumber,_libPictTemplate16);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":143}],218:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderRandomNumberString=/*#__PURE__*/function(_libPictTemplate17){/**
|
|
5934
6031
|
* @param {Object} pFable - The Fable Framework instance
|
|
5935
6032
|
* @param {Object} pOptions - The options for the service
|
|
5936
6033
|
* @param {String} pServiceHash - The hash of the service
|
|
5937
|
-
*/function PictTemplateProviderRandomNumberString(pFable,pOptions,pServiceHash){var
|
|
6034
|
+
*/function PictTemplateProviderRandomNumberString(pFable,pOptions,pServiceHash){var _this106;_classCallCheck2(this,PictTemplateProviderRandomNumberString);_this106=_callSuper(this,PictTemplateProviderRandomNumberString,[pFable,pOptions,pServiceHash]);/** @type {any} */_this106.log;_this106.addPattern('{~RandomNumberString:','~}');_this106.addPattern('{~RNS:','~}');return _this106;}/**
|
|
5938
6035
|
* Render a template expression, returning a string with the resulting content.
|
|
5939
6036
|
*
|
|
5940
6037
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5942,11 +6039,11 @@ return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictT
|
|
|
5942
6039
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5943
6040
|
*
|
|
5944
6041
|
* @return {string} The rendered template
|
|
5945
|
-
*/_inherits(PictTemplateProviderRandomNumberString,
|
|
6042
|
+
*/_inherits(PictTemplateProviderRandomNumberString,_libPictTemplate17);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":143}],219:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDataEncodeJavascriptString=/*#__PURE__*/function(_libPictTemplate18){/**
|
|
5946
6043
|
* @param {Object} pFable - The Fable Framework instance
|
|
5947
6044
|
* @param {Object} pOptions - The options for the service
|
|
5948
6045
|
* @param {String} pServiceHash - The hash of the service
|
|
5949
|
-
*/function PictTemplateProviderDataEncodeJavascriptString(pFable,pOptions,pServiceHash){var
|
|
6046
|
+
*/function PictTemplateProviderDataEncodeJavascriptString(pFable,pOptions,pServiceHash){var _this107;_classCallCheck2(this,PictTemplateProviderDataEncodeJavascriptString);_this107=_callSuper(this,PictTemplateProviderDataEncodeJavascriptString,[pFable,pOptions,pServiceHash]);/** @type {any} */_this107.log;_this107.addPattern('{~DataEncodeJavascriptString:','~}');_this107.addPattern('{~DEJS:','~}');return _this107;}/**
|
|
5950
6047
|
* Render a template expression, returning a string with the resulting content.
|
|
5951
6048
|
*
|
|
5952
6049
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5954,11 +6051,11 @@ return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictT
|
|
|
5954
6051
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5955
6052
|
*
|
|
5956
6053
|
* @return {string} The rendered template
|
|
5957
|
-
*/_inherits(PictTemplateProviderDataEncodeJavascriptString,
|
|
6054
|
+
*/_inherits(PictTemplateProviderDataEncodeJavascriptString,_libPictTemplate18);return _createClass2(PictTemplateProviderDataEncodeJavascriptString,[{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 tmpDataToEncode=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);return this.pict.DataFormat.stringEncodeForJavascript(tmpDataToEncode);}}]);}(libPictTemplate);module.exports=PictTemplateProviderDataEncodeJavascriptString;},{"pict-template":143}],220:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderJSONOutput=/*#__PURE__*/function(_libPictTemplate19){/**
|
|
5958
6055
|
* @param {Object} pFable - The Fable Framework instance
|
|
5959
6056
|
* @param {Object} pOptions - The options for the service
|
|
5960
6057
|
* @param {String} pServiceHash - The hash of the service
|
|
5961
|
-
*/function PictTemplateProviderJSONOutput(pFable,pOptions,pServiceHash){var
|
|
6058
|
+
*/function PictTemplateProviderJSONOutput(pFable,pOptions,pServiceHash){var _this108;_classCallCheck2(this,PictTemplateProviderJSONOutput);_this108=_callSuper(this,PictTemplateProviderJSONOutput,[pFable,pOptions,pServiceHash]);/** @type {any} */_this108.log;_this108.addPattern('{~DataJson:','~}');_this108.addPattern('{~DJ:','~}');return _this108;}/**
|
|
5962
6059
|
* Render a template expression, returning a string with the resulting content.
|
|
5963
6060
|
*
|
|
5964
6061
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5966,11 +6063,11 @@ return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictT
|
|
|
5966
6063
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5967
6064
|
*
|
|
5968
6065
|
* @return {string} The rendered template
|
|
5969
|
-
*/_inherits(PictTemplateProviderJSONOutput,
|
|
6066
|
+
*/_inherits(PictTemplateProviderJSONOutput,_libPictTemplate19);return _createClass2(PictTemplateProviderJSONOutput,[{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=PictTemplateProviderJSONOutput;},{"pict-template":143}],221:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateOnlyFormat=/*#__PURE__*/function(_libPictTemplate20){/**
|
|
5970
6067
|
* @param {import('fable')} pFable - The Fable Framework instance
|
|
5971
6068
|
* @param {any} pOptions - The options for the service
|
|
5972
6069
|
* @param {String} pServiceHash - The hash of the service
|
|
5973
|
-
*/function PictTemplateProviderDateOnlyFormat(pFable,pOptions,pServiceHash){var
|
|
6070
|
+
*/function PictTemplateProviderDateOnlyFormat(pFable,pOptions,pServiceHash){var _this109;_classCallCheck2(this,PictTemplateProviderDateOnlyFormat);_this109=_callSuper(this,PictTemplateProviderDateOnlyFormat,[pFable,pOptions,pServiceHash]);/** @type {any} */_this109.options;/** @type {any} */_this109.log;_this109.addPattern('{~DateOnlyFormat:','~}');return _this109;}/**
|
|
5974
6071
|
* Render a template expression, returning a string with the resulting content.
|
|
5975
6072
|
*
|
|
5976
6073
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5978,18 +6075,18 @@ return fCallback(null,tmpResult);});}}]);}(libPictTemplate);module.exports=PictT
|
|
|
5978
6075
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5979
6076
|
*
|
|
5980
6077
|
* @return {string} The rendered template
|
|
5981
|
-
*/_inherits(PictTemplateProviderDateOnlyFormat,
|
|
6078
|
+
*/_inherits(PictTemplateProviderDateOnlyFormat,_libPictTemplate20);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
|
|
5982
6079
|
var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue).tz('UTC');return tmpDayJS.format(tmpDateValueSet[1]);}}]);}(libPictTemplate);module.exports=PictTemplateProviderDateOnlyFormat;/*
|
|
5983
6080
|
# DEAR DEAD CODE DIARY:
|
|
5984
6081
|
|
|
5985
6082
|
```javascript
|
|
5986
6083
|
|
|
5987
6084
|
```
|
|
5988
|
-
*/},{"pict-template":143}],222:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateOnlyYMD=/*#__PURE__*/function(
|
|
6085
|
+
*/},{"pict-template":143}],222:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateOnlyYMD=/*#__PURE__*/function(_libPictTemplate21){/**
|
|
5989
6086
|
* @param {Object} pFable - The Fable Framework instance
|
|
5990
6087
|
* @param {Object} pOptions - The options for the service
|
|
5991
6088
|
* @param {String} pServiceHash - The hash of the service
|
|
5992
|
-
*/function PictTemplateProviderDateOnlyYMD(pFable,pOptions,pServiceHash){var
|
|
6089
|
+
*/function PictTemplateProviderDateOnlyYMD(pFable,pOptions,pServiceHash){var _this110;_classCallCheck2(this,PictTemplateProviderDateOnlyYMD);_this110=_callSuper(this,PictTemplateProviderDateOnlyYMD,[pFable,pOptions,pServiceHash]);/** @type {any} */_this110.options;/** @type {any} */_this110.log;_this110.addPattern('{~DateOnlyYMD:','~}');return _this110;}/**
|
|
5993
6090
|
* Render a template expression, returning a string with the resulting content.
|
|
5994
6091
|
*
|
|
5995
6092
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -5997,15 +6094,15 @@ var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue).tz('UTC');return tmpDayJS.
|
|
|
5997
6094
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
5998
6095
|
*
|
|
5999
6096
|
* @return {string} The rendered template
|
|
6000
|
-
*/_inherits(PictTemplateProviderDateOnlyYMD,
|
|
6097
|
+
*/_inherits(PictTemplateProviderDateOnlyYMD,_libPictTemplate21);return _createClass2(PictTemplateProviderDateOnlyYMD,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpDateValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDateTimeYMD]::[".concat(tmpHash,"] with data:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDateTimeYMD]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
6001
6098
|
var tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue).tz('UTC');//FIXME: this is kind of wacked out; -62167219200000 is the unix ms timestamp for 0000-01-01 00:00:00 UTC
|
|
6002
6099
|
// not even sure showing negative is right; showing the era is probably better (BCE vs CE)
|
|
6003
|
-
var prefix=tmpDayJS.valueOf()<-62167219200000?'-':'';return prefix+tmpDayJS.format('YYYY-MM-DD');}}]);}(libPictTemplate);module.exports=PictTemplateProviderDateOnlyYMD;},{"pict-template":143}],223:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateTimeFormat=/*#__PURE__*/function(
|
|
6100
|
+
var prefix=tmpDayJS.valueOf()<-62167219200000?'-':'';return prefix+tmpDayJS.format('YYYY-MM-DD');}}]);}(libPictTemplate);module.exports=PictTemplateProviderDateOnlyYMD;},{"pict-template":143}],223:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateTimeFormat=/*#__PURE__*/function(_libPictTemplate22){/**
|
|
6004
6101
|
* @param {Object} pFable - The Fable Framework instance
|
|
6005
6102
|
* @param {Object} pOptions - The options for the service
|
|
6006
6103
|
* @param {String} pServiceHash - The hash of the service
|
|
6007
|
-
*/function PictTemplateProviderDateTimeFormat(pFable,pOptions,pServiceHash){var
|
|
6008
|
-
return
|
|
6104
|
+
*/function PictTemplateProviderDateTimeFormat(pFable,pOptions,pServiceHash){var _this111;_classCallCheck2(this,PictTemplateProviderDateTimeFormat);_this111=_callSuper(this,PictTemplateProviderDateTimeFormat,[pFable,pOptions,pServiceHash]);/** @type {any} */_this111.options;/** @type {any} */_this111.log;_this111.addPattern('{~DateTimeFormat:','~}');_this111.addPattern('{~DateFormat:','~}');// for backwards compatibility
|
|
6105
|
+
return _this111;}/**
|
|
6009
6106
|
* Render a template expression, returning a string with the resulting content.
|
|
6010
6107
|
*
|
|
6011
6108
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6013,7 +6110,7 @@ return _this106;}/**
|
|
|
6013
6110
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6014
6111
|
*
|
|
6015
6112
|
* @return {string} The rendered template
|
|
6016
|
-
*/_inherits(PictTemplateProviderDateTimeFormat,
|
|
6113
|
+
*/_inherits(PictTemplateProviderDateTimeFormat,_libPictTemplate22);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
|
|
6017
6114
|
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
|
|
6018
6115
|
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()}].`);
|
|
6019
6116
|
// Day.js will try to guess the user's timezone for us
|
|
@@ -6023,12 +6120,12 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
6023
6120
|
```javascript
|
|
6024
6121
|
|
|
6025
6122
|
```
|
|
6026
|
-
*/},{"pict-template":143}],224:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateTimeYMD=/*#__PURE__*/function(
|
|
6123
|
+
*/},{"pict-template":143}],224:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDateTimeYMD=/*#__PURE__*/function(_libPictTemplate23){/**
|
|
6027
6124
|
* @param {Object} pFable - The Fable Framework instance
|
|
6028
6125
|
* @param {Object} pOptions - The options for the service
|
|
6029
6126
|
* @param {String} pServiceHash - The hash of the service
|
|
6030
|
-
*/function PictTemplateProviderDateTimeYMD(pFable,pOptions,pServiceHash){var
|
|
6031
|
-
return
|
|
6127
|
+
*/function PictTemplateProviderDateTimeYMD(pFable,pOptions,pServiceHash){var _this112;_classCallCheck2(this,PictTemplateProviderDateTimeYMD);_this112=_callSuper(this,PictTemplateProviderDateTimeYMD,[pFable,pOptions,pServiceHash]);/** @type {any} */_this112.options;/** @type {any} */_this112.log;_this112.addPattern('{~DateTimeYMD:','~}');_this112.addPattern('{~DateYMD:','~}');// for backwards compatibility
|
|
6128
|
+
return _this112;}/**
|
|
6032
6129
|
* Render a template expression, returning a string with the resulting content.
|
|
6033
6130
|
*
|
|
6034
6131
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6036,15 +6133,15 @@ return _this107;}/**
|
|
|
6036
6133
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6037
6134
|
*
|
|
6038
6135
|
* @return {string} The rendered template
|
|
6039
|
-
*/_inherits(PictTemplateProviderDateTimeYMD,
|
|
6136
|
+
*/_inherits(PictTemplateProviderDateTimeYMD,_libPictTemplate23);return _createClass2(PictTemplateProviderDateTimeYMD,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpDateValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray);if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fDateTimeYMD]::[".concat(tmpHash,"] with data:"),tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace("PICT Template [fDateTimeYMD]::[".concat(tmpHash,"]"));}// TODO: Modularize this
|
|
6040
6137
|
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
|
|
6041
6138
|
if(this.options.Timezone){tmpDayJS=tmpDayJS.tz(this.options.Timezone);}else{try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.log.error("Error guessing dayJS guess() function; dates may be formatted to GMT by default. (".concat(pError.message||pError,")"));}}}catch(_unused7){//this.log.error(`Error casting timezone using tz .. casting to the browser guess which is [${this.fable.Dates.dayJS.tz.guess()}].`);
|
|
6042
6139
|
// Day.js will try to guess the user's timezone for us
|
|
6043
|
-
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,")"));}}return tmpDayJS.format('YYYY-MM-DD');}}]);}(libPictTemplate);module.exports=PictTemplateProviderDateTimeYMD;},{"pict-template":143}],225:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDigits=/*#__PURE__*/function(
|
|
6140
|
+
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,")"));}}return tmpDayJS.format('YYYY-MM-DD');}}]);}(libPictTemplate);module.exports=PictTemplateProviderDateTimeYMD;},{"pict-template":143}],225:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDigits=/*#__PURE__*/function(_libPictTemplate24){/**
|
|
6044
6141
|
* @param {Object} pFable - The Fable Framework instance
|
|
6045
6142
|
* @param {Object} pOptions - The options for the service
|
|
6046
6143
|
* @param {String} pServiceHash - The hash of the service
|
|
6047
|
-
*/function PictTemplateProviderDigits(pFable,pOptions,pServiceHash){var
|
|
6144
|
+
*/function PictTemplateProviderDigits(pFable,pOptions,pServiceHash){var _this113;_classCallCheck2(this,PictTemplateProviderDigits);_this113=_callSuper(this,PictTemplateProviderDigits,[pFable,pOptions,pServiceHash]);/** @type {any} */_this113.options;/** @type {any} */_this113.log;_this113.addPattern('{~Digits:','~}');return _this113;}/**
|
|
6048
6145
|
* Render a template expression, returning a string with the resulting content.
|
|
6049
6146
|
*
|
|
6050
6147
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6052,11 +6149,11 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
6052
6149
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6053
6150
|
*
|
|
6054
6151
|
* @return {string} The rendered template
|
|
6055
|
-
*/_inherits(PictTemplateProviderDigits,
|
|
6152
|
+
*/_inherits(PictTemplateProviderDigits,_libPictTemplate24);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":143}],226:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDollars=/*#__PURE__*/function(_libPictTemplate25){/**
|
|
6056
6153
|
* @param {Object} pFable - The Fable Framework instance
|
|
6057
6154
|
* @param {Object} pOptions - The options for the service
|
|
6058
6155
|
* @param {String} pServiceHash - The hash of the service
|
|
6059
|
-
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var
|
|
6156
|
+
*/function PictTemplateProviderDollars(pFable,pOptions,pServiceHash){var _this114;_classCallCheck2(this,PictTemplateProviderDollars);_this114=_callSuper(this,PictTemplateProviderDollars,[pFable,pOptions,pServiceHash]);/** @type {any} */_this114.options;/** @type {any} */_this114.log;_this114.addPattern('{~Dollars:','~}');return _this114;}/**
|
|
6060
6157
|
* Render a template expression, returning a string with the resulting content.
|
|
6061
6158
|
*
|
|
6062
6159
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6064,11 +6161,11 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
6064
6161
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6065
6162
|
*
|
|
6066
6163
|
* @return {string} The rendered template
|
|
6067
|
-
*/_inherits(PictTemplateProviderDollars,
|
|
6164
|
+
*/_inherits(PictTemplateProviderDollars,_libPictTemplate25);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":143}],227:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderHTMLCommandEnd=/*#__PURE__*/function(_libPictTemplate26){/**
|
|
6068
6165
|
* @param {Object} pFable - The Fable Framework instance
|
|
6069
6166
|
* @param {Object} pOptions - The options for the service
|
|
6070
6167
|
* @param {String} pServiceHash - The hash of the service
|
|
6071
|
-
*/function PictTemplateProviderHTMLCommandEnd(pFable,pOptions,pServiceHash){var
|
|
6168
|
+
*/function PictTemplateProviderHTMLCommandEnd(pFable,pOptions,pServiceHash){var _this115;_classCallCheck2(this,PictTemplateProviderHTMLCommandEnd);_this115=_callSuper(this,PictTemplateProviderHTMLCommandEnd,[pFable,pOptions,pServiceHash]);/** @type {any} */_this115.log;_this115.addPattern('{~HtmlCommentEnd:','~}');_this115.addPattern('{~HCE:','~}');return _this115;}/**
|
|
6072
6169
|
* Render a template expression, returning a string with the resulting content.
|
|
6073
6170
|
*
|
|
6074
6171
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6076,11 +6173,11 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
6076
6173
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6077
6174
|
*
|
|
6078
6175
|
* @return {string} The rendered template
|
|
6079
|
-
*/_inherits(PictTemplateProviderHTMLCommandEnd,
|
|
6176
|
+
*/_inherits(PictTemplateProviderHTMLCommandEnd,_libPictTemplate26);return _createClass2(PictTemplateProviderHTMLCommandEnd,[{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=PictTemplateProviderHTMLCommandEnd;},{"pict-template":143}],228:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderHTMLCommandStart=/*#__PURE__*/function(_libPictTemplate27){/**
|
|
6080
6177
|
* @param {Object} pFable - The Fable Framework instance
|
|
6081
6178
|
* @param {Object} pOptions - The options for the service
|
|
6082
6179
|
* @param {String} pServiceHash - The hash of the service
|
|
6083
|
-
*/function PictTemplateProviderHTMLCommandStart(pFable,pOptions,pServiceHash){var
|
|
6180
|
+
*/function PictTemplateProviderHTMLCommandStart(pFable,pOptions,pServiceHash){var _this116;_classCallCheck2(this,PictTemplateProviderHTMLCommandStart);_this116=_callSuper(this,PictTemplateProviderHTMLCommandStart,[pFable,pOptions,pServiceHash]);/** @type {any} */_this116.log;_this116.addPattern('{~HtmlCommentStart:','~}');_this116.addPattern('{~HCS:','~}');return _this116;}/**
|
|
6084
6181
|
* Render a template expression, returning a string with the resulting content.
|
|
6085
6182
|
*
|
|
6086
6183
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6088,11 +6185,11 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
6088
6185
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6089
6186
|
*
|
|
6090
6187
|
* @return {string} The rendered template
|
|
6091
|
-
*/_inherits(PictTemplateProviderHTMLCommandStart,
|
|
6188
|
+
*/_inherits(PictTemplateProviderHTMLCommandStart,_libPictTemplate27);return _createClass2(PictTemplateProviderHTMLCommandStart,[{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=PictTemplateProviderHTMLCommandStart;},{"pict-template":143}],229:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderJoin=/*#__PURE__*/function(_libPictTemplate28){/**
|
|
6092
6189
|
* @param {Object} pFable - The Fable Framework instance
|
|
6093
6190
|
* @param {Object} pOptions - The options for the service
|
|
6094
6191
|
* @param {String} pServiceHash - The hash of the service
|
|
6095
|
-
*/function PictTemplateProviderJoin(pFable,pOptions,pServiceHash){var
|
|
6192
|
+
*/function PictTemplateProviderJoin(pFable,pOptions,pServiceHash){var _this117;_classCallCheck2(this,PictTemplateProviderJoin);_this117=_callSuper(this,PictTemplateProviderJoin,[pFable,pOptions,pServiceHash]);/** @type {any} */_this117.options;/** @type {any} */_this117.log;_this117.addPattern('{~Join:','~}');_this117.addPattern('{~J:','~}');return _this117;}/**
|
|
6096
6193
|
* Render a template expression, returning a string with the resulting content.
|
|
6097
6194
|
*
|
|
6098
6195
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6100,12 +6197,12 @@ try{tmpDayJS=tmpDayJS.tz(this.fable.Dates.dayJS.tz.guess());}catch(pError){this.
|
|
|
6100
6197
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6101
6198
|
*
|
|
6102
6199
|
* @return {string} The rendered template
|
|
6103
|
-
*/_inherits(PictTemplateProviderJoin,
|
|
6104
|
-
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":143}],230:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderJoinUnique=/*#__PURE__*/function(
|
|
6200
|
+
*/_inherits(PictTemplateProviderJoin,_libPictTemplate28);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
|
|
6201
|
+
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":143}],230:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderJoinUnique=/*#__PURE__*/function(_libPictTemplate29){/**
|
|
6105
6202
|
* @param {Object} pFable - The Fable Framework instance
|
|
6106
6203
|
* @param {Object} pOptions - The options for the service
|
|
6107
6204
|
* @param {String} pServiceHash - The hash of the service
|
|
6108
|
-
*/function PictTemplateProviderJoinUnique(pFable,pOptions,pServiceHash){var
|
|
6205
|
+
*/function PictTemplateProviderJoinUnique(pFable,pOptions,pServiceHash){var _this118;_classCallCheck2(this,PictTemplateProviderJoinUnique);_this118=_callSuper(this,PictTemplateProviderJoinUnique,[pFable,pOptions,pServiceHash]);/** @type {any} */_this118.options;/** @type {any} */_this118.log;_this118.addPattern('{~JoinUnique:','~}');_this118.addPattern('{~JU:','~}');return _this118;}/**
|
|
6109
6206
|
* Render a template expression, returning a string with the resulting content.
|
|
6110
6207
|
*
|
|
6111
6208
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6113,12 +6210,12 @@ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];for(var i=0;i<tmpD
|
|
|
6113
6210
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6114
6211
|
*
|
|
6115
6212
|
* @return {string} The rendered template
|
|
6116
|
-
*/_inherits(PictTemplateProviderJoinUnique,
|
|
6117
|
-
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":143}],231:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderPascalCaseIdentifier=/*#__PURE__*/function(
|
|
6213
|
+
*/_inherits(PictTemplateProviderJoinUnique,_libPictTemplate29);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
|
|
6214
|
+
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":143}],231:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderPascalCaseIdentifier=/*#__PURE__*/function(_libPictTemplate30){/**
|
|
6118
6215
|
* @param {Object} pFable - The Fable Framework instance
|
|
6119
6216
|
* @param {Object} pOptions - The options for the service
|
|
6120
6217
|
* @param {String} pServiceHash - The hash of the service
|
|
6121
|
-
*/function PictTemplateProviderPascalCaseIdentifier(pFable,pOptions,pServiceHash){var
|
|
6218
|
+
*/function PictTemplateProviderPascalCaseIdentifier(pFable,pOptions,pServiceHash){var _this119;_classCallCheck2(this,PictTemplateProviderPascalCaseIdentifier);_this119=_callSuper(this,PictTemplateProviderPascalCaseIdentifier,[pFable,pOptions,pServiceHash]);/** @type {any} */_this119.options;/** @type {any} */_this119.log;_this119.addPattern('{~PascalCaseIdentifier:','~}');return _this119;}/**
|
|
6122
6219
|
* Render a template expression, returning a string with the resulting content.
|
|
6123
6220
|
*
|
|
6124
6221
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6126,17 +6223,17 @@ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={}
|
|
|
6126
6223
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6127
6224
|
*
|
|
6128
6225
|
* @return {string} The rendered template
|
|
6129
|
-
*/_inherits(PictTemplateProviderPascalCaseIdentifier,
|
|
6226
|
+
*/_inherits(PictTemplateProviderPascalCaseIdentifier,_libPictTemplate30);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;/*
|
|
6130
6227
|
# DEAR DEAD CODE DIARY:
|
|
6131
6228
|
|
|
6132
6229
|
```javascript
|
|
6133
6230
|
|
|
6134
6231
|
```
|
|
6135
|
-
*/},{"pict-template":143}],232:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderPluckJoinUnique=/*#__PURE__*/function(
|
|
6232
|
+
*/},{"pict-template":143}],232:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderPluckJoinUnique=/*#__PURE__*/function(_libPictTemplate31){/**
|
|
6136
6233
|
* @param {Object} pFable - The Fable Framework instance
|
|
6137
6234
|
* @param {Object} pOptions - The options for the service
|
|
6138
6235
|
* @param {String} pServiceHash - The hash of the service
|
|
6139
|
-
*/function PictTemplateProviderPluckJoinUnique(pFable,pOptions,pServiceHash){var
|
|
6236
|
+
*/function PictTemplateProviderPluckJoinUnique(pFable,pOptions,pServiceHash){var _this120;_classCallCheck2(this,PictTemplateProviderPluckJoinUnique);_this120=_callSuper(this,PictTemplateProviderPluckJoinUnique,[pFable,pOptions,pServiceHash]);/** @type {any} */_this120.options;/** @type {any} */_this120.log;_this120.addPattern('{~PluckJoinUnique:','~}');_this120.addPattern('{~PJU:','~}');return _this120;}/**
|
|
6140
6237
|
* Render a template expression, returning a string with the resulting content.
|
|
6141
6238
|
*
|
|
6142
6239
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6144,13 +6241,13 @@ var tmpSeparator=tmpDataAddresses.shift();var tmpValueList=[];var tmpValueMap={}
|
|
|
6144
6241
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6145
6242
|
*
|
|
6146
6243
|
* @return {string} The rendered template
|
|
6147
|
-
*/_inherits(PictTemplateProviderPluckJoinUnique,
|
|
6244
|
+
*/_inherits(PictTemplateProviderPluckJoinUnique,_libPictTemplate31);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
|
|
6148
6245
|
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.
|
|
6149
|
-
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":143}],233:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderBreakpoint=/*#__PURE__*/function(
|
|
6246
|
+
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":143}],233:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderBreakpoint=/*#__PURE__*/function(_libPictTemplate32){/**
|
|
6150
6247
|
* @param {Object} pFable - The Fable Framework instance
|
|
6151
6248
|
* @param {Object} pOptions - The options for the service
|
|
6152
6249
|
* @param {String} pServiceHash - The hash of the service
|
|
6153
|
-
*/function PictTemplateProviderBreakpoint(pFable,pOptions,pServiceHash){var
|
|
6250
|
+
*/function PictTemplateProviderBreakpoint(pFable,pOptions,pServiceHash){var _this121;_classCallCheck2(this,PictTemplateProviderBreakpoint);_this121=_callSuper(this,PictTemplateProviderBreakpoint,[pFable,pOptions,pServiceHash]);/** @type {any} */_this121.log;_this121.addPattern('{~Breakpoint','~}');return _this121;}/**
|
|
6154
6251
|
* Render a template expression, returning a string with the resulting content.
|
|
6155
6252
|
*
|
|
6156
6253
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6158,13 +6255,13 @@ for(var j=0;j<tmpValueSet.length;j++){if(tmpValueSet[j]===null||_typeof(tmpValue
|
|
|
6158
6255
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6159
6256
|
*
|
|
6160
6257
|
* @return {string} The rendered template
|
|
6161
|
-
*/_inherits(PictTemplateProviderBreakpoint,
|
|
6258
|
+
*/_inherits(PictTemplateProviderBreakpoint,_libPictTemplate32);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;
|
|
6162
6259
|
debugger;// eslint-disable-line no-debugger
|
|
6163
|
-
return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderBreakpoint;},{"pict-template":143}],234:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDataValueTree=/*#__PURE__*/function(
|
|
6260
|
+
return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderBreakpoint;},{"pict-template":143}],234:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderDataValueTree=/*#__PURE__*/function(_libPictTemplate33){/**
|
|
6164
6261
|
* @param {Object} pFable - The Fable Framework instance
|
|
6165
6262
|
* @param {Object} pOptions - The options for the service
|
|
6166
6263
|
* @param {String} pServiceHash - The hash of the service
|
|
6167
|
-
*/function PictTemplateProviderDataValueTree(pFable,pOptions,pServiceHash){var
|
|
6264
|
+
*/function PictTemplateProviderDataValueTree(pFable,pOptions,pServiceHash){var _this122;_classCallCheck2(this,PictTemplateProviderDataValueTree);_this122=_callSuper(this,PictTemplateProviderDataValueTree,[pFable,pOptions,pServiceHash]);/** @type {any} */_this122.log;_this122.addPattern('{~DataTree:','~}');_this122.addPattern('{~DT:','~}');return _this122;}/**
|
|
6168
6265
|
* Render a template expression, returning a string with the resulting content.
|
|
6169
6266
|
*
|
|
6170
6267
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6172,13 +6269,13 @@ return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderBreakpoint;}
|
|
|
6172
6269
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6173
6270
|
*
|
|
6174
6271
|
* @return {string} The rendered template
|
|
6175
|
-
*/_inherits(PictTemplateProviderDataValueTree,
|
|
6272
|
+
*/_inherits(PictTemplateProviderDataValueTree,_libPictTemplate33);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
|
|
6176
6273
|
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
|
|
6177
|
-
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":143}],235:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogStatement=/*#__PURE__*/function(
|
|
6274
|
+
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":143}],235:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogStatement=/*#__PURE__*/function(_libPictTemplate34){/**
|
|
6178
6275
|
* @param {Object} pFable - The Fable Framework instance
|
|
6179
6276
|
* @param {Object} pOptions - The options for the service
|
|
6180
6277
|
* @param {String} pServiceHash - The hash of the service
|
|
6181
|
-
*/function PictTemplateProviderLogStatement(pFable,pOptions,pServiceHash){var
|
|
6278
|
+
*/function PictTemplateProviderLogStatement(pFable,pOptions,pServiceHash){var _this123;_classCallCheck2(this,PictTemplateProviderLogStatement);_this123=_callSuper(this,PictTemplateProviderLogStatement,[pFable,pOptions,pServiceHash]);/** @type {any} */_this123.log;_this123.addPattern('{~LogStatement:','~}');_this123.addPattern('{~LS:','~}');return _this123;}/**
|
|
6182
6279
|
* Render a template expression, returning a string with the resulting content.
|
|
6183
6280
|
*
|
|
6184
6281
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6186,11 +6283,11 @@ tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.Cur
|
|
|
6186
6283
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6187
6284
|
*
|
|
6188
6285
|
* @return {string} The rendered template
|
|
6189
|
-
*/_inherits(PictTemplateProviderLogStatement,
|
|
6286
|
+
*/_inherits(PictTemplateProviderLogStatement,_libPictTemplate34);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":143}],236:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogValue=/*#__PURE__*/function(_libPictTemplate35){/**
|
|
6190
6287
|
* @param {Object} pFable - The Fable Framework instance
|
|
6191
6288
|
* @param {Object} pOptions - The options for the service
|
|
6192
6289
|
* @param {String} pServiceHash - The hash of the service
|
|
6193
|
-
*/function PictTemplateProviderLogValue(pFable,pOptions,pServiceHash){var
|
|
6290
|
+
*/function PictTemplateProviderLogValue(pFable,pOptions,pServiceHash){var _this124;_classCallCheck2(this,PictTemplateProviderLogValue);_this124=_callSuper(this,PictTemplateProviderLogValue,[pFable,pOptions,pServiceHash]);/** @type {any} */_this124.log;_this124.addPattern('{~LogValue:','~}');_this124.addPattern('{~LV:','~}');return _this124;}/**
|
|
6194
6291
|
* Render a template expression, returning a string with the resulting content.
|
|
6195
6292
|
*
|
|
6196
6293
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6198,11 +6295,11 @@ tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.Cur
|
|
|
6198
6295
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6199
6296
|
*
|
|
6200
6297
|
* @return {string} The rendered template
|
|
6201
|
-
*/_inherits(PictTemplateProviderLogValue,
|
|
6298
|
+
*/_inherits(PictTemplateProviderLogValue,_libPictTemplate35);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":143}],237:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderLogValueTree=/*#__PURE__*/function(_libPictTemplate36){/**
|
|
6202
6299
|
* @param {Object} pFable - The Fable Framework instance
|
|
6203
6300
|
* @param {Object} pOptions - The options for the service
|
|
6204
6301
|
* @param {String} pServiceHash - The hash of the service
|
|
6205
|
-
*/function PictTemplateProviderLogValueTree(pFable,pOptions,pServiceHash){var
|
|
6302
|
+
*/function PictTemplateProviderLogValueTree(pFable,pOptions,pServiceHash){var _this125;_classCallCheck2(this,PictTemplateProviderLogValueTree);_this125=_callSuper(this,PictTemplateProviderLogValueTree,[pFable,pOptions,pServiceHash]);/** @type {any} */_defineProperty2(_this125,"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;}_this125.log.trace("[".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i],"] (").concat(tmpBranchType,"): ").concat(tmpBranchValue));if(pCurrentDepth+1>pMaxDepth){return'';}else if(tmpBranchType=='object'){tmpBranchValue=_this125.logValueTreeObjectSet(pObject[tmpObjectValueKeys[i]],"".concat(pBaseAddress,".").concat(tmpObjectValueKeys[i]),pRootObject,pCurrentDepth+1,pMaxDepth);}}return'';});_this125.log;_this125.addPattern('{~LogValueTree:','~}');_this125.addPattern('{~LVT:','~}');return _this125;}/**
|
|
6206
6303
|
* Render a template expression, returning a string with the resulting content.
|
|
6207
6304
|
*
|
|
6208
6305
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6210,11 +6307,11 @@ tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.Cur
|
|
|
6210
6307
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6211
6308
|
*
|
|
6212
6309
|
* @return {string} The rendered template
|
|
6213
|
-
*/_inherits(PictTemplateProviderLogValueTree,
|
|
6310
|
+
*/_inherits(PictTemplateProviderLogValueTree,_libPictTemplate36);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":143}],238:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderNotEmpty=/*#__PURE__*/function(_libPictTemplate37){/**
|
|
6214
6311
|
* @param {Object} pFable - The Fable Framework instance
|
|
6215
6312
|
* @param {Object} pOptions - The options for the service
|
|
6216
6313
|
* @param {String} pServiceHash - The hash of the service
|
|
6217
|
-
*/function PictTemplateProviderNotEmpty(pFable,pOptions,pServiceHash){var
|
|
6314
|
+
*/function PictTemplateProviderNotEmpty(pFable,pOptions,pServiceHash){var _this126;_classCallCheck2(this,PictTemplateProviderNotEmpty);_this126=_callSuper(this,PictTemplateProviderNotEmpty,[pFable,pOptions,pServiceHash]);/** @type {any} */_this126.log;_this126.addPattern('{~NotEmpty:','~}');_this126.addPattern('{~NE:','~}');return _this126;}/**
|
|
6218
6315
|
* Render a template expression, returning a string with the resulting content.
|
|
6219
6316
|
*
|
|
6220
6317
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6222,16 +6319,16 @@ tmpPictObjectBranchTemplate="\n<div class=\"PICTObjectBranchDepth_{~D:Record.Cur
|
|
|
6222
6319
|
* @param {Array<any>} pContextArray - An array of context objects accessible from the template; safe to leave empty
|
|
6223
6320
|
*
|
|
6224
6321
|
* @return {string} The rendered template
|
|
6225
|
-
*/_inherits(PictTemplateProviderNotEmpty,
|
|
6226
|
-
if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderNotEmpty;},{"pict-template":143}],239:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateIfBase=/*#__PURE__*/function(
|
|
6322
|
+
*/_inherits(PictTemplateProviderNotEmpty,_libPictTemplate37);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.
|
|
6323
|
+
if(this.resolveStateFromAddress(tmpHashParts[0],tmpData,pContextArray)){return tmpHashParts[1];}return'';}}]);}(libPictTemplate);module.exports=PictTemplateProviderNotEmpty;},{"pict-template":143}],239:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderTemplateIfBase=/*#__PURE__*/function(_libPictTemplate38){/**
|
|
6227
6324
|
* @param {Object} pFable - The Fable Framework instance
|
|
6228
6325
|
* @param {Object} pOptions - The options for the service
|
|
6229
6326
|
* @param {String} pServiceHash - The hash of the service
|
|
6230
|
-
*/function PictTemplateProviderTemplateIfBase(pFable,pOptions,pServiceHash){_classCallCheck2(this,PictTemplateProviderTemplateIfBase);return _callSuper(this,PictTemplateProviderTemplateIfBase,[pFable,pOptions,pServiceHash]);}_inherits(PictTemplateProviderTemplateIfBase,
|
|
6327
|
+
*/function PictTemplateProviderTemplateIfBase(pFable,pOptions,pServiceHash){_classCallCheck2(this,PictTemplateProviderTemplateIfBase);return _callSuper(this,PictTemplateProviderTemplateIfBase,[pFable,pOptions,pServiceHash]);}_inherits(PictTemplateProviderTemplateIfBase,_libPictTemplate38);return _createClass2(PictTemplateProviderTemplateIfBase,[{key:"compareValues",value:function compareValues(pValueLeft,pOperator,pValueRight){switch(pOperator){case'TRUE':return pValueLeft===true;case'FALSE':return pValueLeft===false;case'LNGT':case'LENGTH_GREATER_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length>pValueRight;case'object':return pValueLeft.length>pValueRight;default:return false;}case'LNLT':case'LENGTH_LESS_THAN':switch(_typeof(pValueLeft)){case'string':return pValueLeft.length<pValueRight;case'object':return pValueLeft.length<pValueRight;default:return false;}case'!=':return pValueLeft!=pValueRight;case'<':return pValueLeft<pValueRight;case'>':return pValueLeft>pValueRight;case'<=':return pValueLeft<=pValueRight;case'>=':return pValueLeft>=pValueRight;case'===':return pValueLeft===pValueRight;case'==':return pValueLeft==pValueRight;default:return false;}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateIfBase;},{"pict-template":143}],240:[function(require,module,exports){var libPictTemplateIf=require('./Pict-Template-TemplateIf-Base.js');var PictTemplateProviderTemplateIf=/*#__PURE__*/function(_libPictTemplateIf){/**
|
|
6231
6328
|
* @param {Object} pFable - The Fable Framework instance
|
|
6232
6329
|
* @param {Object} pOptions - The options for the service
|
|
6233
6330
|
* @param {String} pServiceHash - The hash of the service
|
|
6234
|
-
*/function PictTemplateProviderTemplateIf(pFable,pOptions,pServiceHash){var
|
|
6331
|
+
*/function PictTemplateProviderTemplateIf(pFable,pOptions,pServiceHash){var _this127;_classCallCheck2(this,PictTemplateProviderTemplateIf);_this127=_callSuper(this,PictTemplateProviderTemplateIf,[pFable,pOptions,pServiceHash]);/** @type {any} */_this127.log;_this127.addPattern('{~TemplateIf:','~}');_this127.addPattern('{~TIf:','~}');return _this127;}/**
|
|
6235
6332
|
* Render a template expression, returning a string with the resulting content.
|
|
6236
6333
|
*
|
|
6237
6334
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -6262,7 +6359,7 @@ var tmpComparisonResult=this.compareValues(this.resolveStateFromAddress(tmpCompa
|
|
|
6262
6359
|
* @param {Object} pFable - The Fable Framework instance
|
|
6263
6360
|
* @param {Object} pOptions - The options for the service
|
|
6264
6361
|
* @param {String} pServiceHash - The hash of the service
|
|
6265
|
-
*/function PictTemplateProviderTemplateIfAbsolute(pFable,pOptions,pServiceHash){var
|
|
6362
|
+
*/function PictTemplateProviderTemplateIfAbsolute(pFable,pOptions,pServiceHash){var _this128;_classCallCheck2(this,PictTemplateProviderTemplateIfAbsolute);_this128=_callSuper(this,PictTemplateProviderTemplateIfAbsolute,[pFable,pOptions,pServiceHash]);/** @type {any} */_this128.log;_this128.addPattern('{~TemplateIfAbsolute:','~}');_this128.addPattern('{~TIfAbs:','~}');return _this128;}/**
|
|
6266
6363
|
* Render a template expression, returning a string with the resulting content.
|
|
6267
6364
|
*
|
|
6268
6365
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|