pict 1.0.113 → 1.0.115
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 +232 -174
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +156 -98
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +3 -3
package/dist/pict.compatible.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_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(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _defineProperty2(obj,key,value){key=_toPropertyKey2(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _classCallCheck2(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey2(descriptor.key),descriptor);}}function _createClass2(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey2(arg){var key=_toPrimitive2(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive2(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}(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
|
-
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":
|
|
3
|
+
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":106}],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
|
|
5
5
|
revLookup['-'.charCodeAt(0)]=62;revLookup['_'.charCodeAt(0)]=63;function getLens(b64){var len=b64.length;if(len%4>0){throw new Error('Invalid string. Length must be a multiple of 4');}// Trim off extra bytes after placeholder bytes are found
|
|
6
6
|
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
@@ -401,7 +401,7 @@ var tmpConstructedBufferOutputString='';for(var i=0;i<tmpLineStrings.length;i++)
|
|
|
401
401
|
tmpConstructedBufferOutputString+="".concat(tmpLineStrings[i],"\n");if(tmpObjectStrings[i]!==false){tmpConstructedBufferOutputString+="".concat(tmpObjectStrings[i],"\n");}}if(!this.fileWriter.write(tmpConstructedBufferOutputString,'utf8')){// If the streamwriter returns false, we need to wait for it to drain.
|
|
402
402
|
this.fileWriter.once('drain',this.completeBufferFlushToLogFile.bind(this,tmpFlushComplete));}else{return this.completeBufferFlushToLogFile(tmpFlushComplete);}}}},{key:"write",value:function write(pLevel,pLogText,pObject){var tmpLogLine=_get(_getPrototypeOf(SimpleFlatFileLogger.prototype),"write",this).call(this,pLevel,pLogText,pObject);// Use a very simple array as the write buffer
|
|
403
403
|
this.logLineStrings.push(tmpLogLine);// Write out the object on a separate line if it is passed in
|
|
404
|
-
if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}]);return SimpleFlatFileLogger;}(libConsoleLog);module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":29,"fs":18,"path":
|
|
404
|
+
if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}]);return SimpleFlatFileLogger;}(libConsoleLog);module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":29,"fs":18,"path":72}],31:[function(require,module,exports){/**
|
|
405
405
|
* Fable Logging Service
|
|
406
406
|
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var FableLog=/*#__PURE__*/function(_libFableServiceProvi2){_inherits(FableLog,_libFableServiceProvi2);var _super4=_createSuper(FableLog);function FableLog(pSettings,pServiceHash){var _this8;_classCallCheck2(this,FableLog);_this8=_super4.call(this,pSettings,pServiceHash);_this8.serviceType='Logging';var tmpSettings=_typeof(pSettings)==='object'?pSettings:{};_this8._Settings=tmpSettings;_this8._Providers=require('./Fable-Log-DefaultProviders-Node.js');_this8._StreamDefinitions=tmpSettings.hasOwnProperty('LogStreams')?tmpSettings.LogStreams:require('./Fable-Log-DefaultStreams.json');_this8.logStreams=[];// This object gets decorated for one-time instantiated providers that
|
|
407
407
|
// have multiple outputs, such as bunyan.
|
|
@@ -437,8 +437,7 @@ this.log=this.fable.log;this.servicesMap=this.fable.servicesMap;this.services=th
|
|
|
437
437
|
* @module Fable Settings
|
|
438
438
|
*/var libPrecedent=require('precedent');var FableSettingsTemplateProcessor=/*#__PURE__*/function(){function FableSettingsTemplateProcessor(pDependencies){_classCallCheck2(this,FableSettingsTemplateProcessor);// Use a no-dependencies templating engine to parse out environment variables
|
|
439
439
|
this.templateProcessor=new libPrecedent();// TODO: Make the environment variable wrap expression demarcation characters configurable?
|
|
440
|
-
this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|')
|
|
441
|
-
var tmpDefaultValue=tmpTemplateValue.substring(tmpSeparatorIndex+1);var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}_createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);return FableSettingsTemplateProcessor;}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":77,"precedent":74}],36:[function(require,module,exports){/**
|
|
440
|
+
this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|');var tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}_createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);return FableSettingsTemplateProcessor;}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":78,"precedent":75}],36:[function(require,module,exports){/**
|
|
442
441
|
* Fable Settings Add-on
|
|
443
442
|
*
|
|
444
443
|
*
|
|
@@ -552,7 +551,7 @@ this._coreServices.ServiceManager=new libFableServiceManager(this);this.serviceM
|
|
|
552
551
|
// They will then be available in the Default service provider set as well.
|
|
553
552
|
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.ServiceManager);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.UUID);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.Logging);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
554
553
|
this.serviceManager.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));this.serviceManager.addServiceType('Template',require('./services/Fable-Service-Template.js'));this.serviceManager.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));this.serviceManager.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));this.serviceManager.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));this.serviceManager.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));this.serviceManager.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));this.serviceManager.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));this.serviceManager.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));this.serviceManager.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));this.serviceManager.addServiceType('Manifest',require('manyfest'));this.serviceManager.addServiceType('ObjectCache',require('cachetrax'));this.serviceManager.addServiceType('FilePersistence',require('./services/Fable-Service-FilePersistence.js'));}_createClass2(Fable,[{key:"isFable",get:function get(){return true;}},{key:"settings",get:function get(){return this._coreServices.SettingsManager.settings;}},{key:"settingsManager",get:function get(){return this._coreServices.SettingsManager;}},{key:"log",get:function get(){return this._coreServices.Logging;}},{key:"services",get:function get(){return this._coreServices.ServiceManager.services;}},{key:"servicesMap",get:function get(){return this._coreServices.ServiceManager.servicesMap;}},{key:"getUUID",value:function getUUID(){return this._coreServices.UUID.getUUID();}},{key:"fable",get:function get(){return this;}}]);return Fable;}();// This is for backwards compatibility
|
|
555
|
-
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceManager.ServiceProviderBase;module.exports.CoreServiceProviderBase=libFableServiceManager.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./Fable-ServiceManager.js":39,"./services/Fable-Service-Anticipate.js":41,"./services/Fable-Service-CSVParser.js":42,"./services/Fable-Service-DataFormat.js":43,"./services/Fable-Service-DataGeneration.js":45,"./services/Fable-Service-EnvironmentData.js":46,"./services/Fable-Service-FilePersistence.js":47,"./services/Fable-Service-MetaTemplate.js":48,"./services/Fable-Service-Operation.js":52,"./services/Fable-Service-RestClient.js":53,"./services/Fable-Service-Template.js":54,"./services/Fable-Service-Utility.js":55,"cachetrax":21,"fable-log":31,"fable-settings":36,"fable-uuid":38,"manyfest":
|
|
554
|
+
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceManager.ServiceProviderBase;module.exports.CoreServiceProviderBase=libFableServiceManager.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./Fable-ServiceManager.js":39,"./services/Fable-Service-Anticipate.js":41,"./services/Fable-Service-CSVParser.js":42,"./services/Fable-Service-DataFormat.js":43,"./services/Fable-Service-DataGeneration.js":45,"./services/Fable-Service-EnvironmentData.js":46,"./services/Fable-Service-FilePersistence.js":47,"./services/Fable-Service-MetaTemplate.js":48,"./services/Fable-Service-Operation.js":52,"./services/Fable-Service-RestClient.js":53,"./services/Fable-Service-Template.js":54,"./services/Fable-Service-Utility.js":55,"cachetrax":21,"fable-log":31,"fable-settings":36,"fable-uuid":38,"manyfest":70}],41:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceAnticipate=/*#__PURE__*/function(_libFableServiceBase){_inherits(FableServiceAnticipate,_libFableServiceBase);var _super8=_createSuper(FableServiceAnticipate);function FableServiceAnticipate(pFable,pOptions,pServiceHash){var _this13;_classCallCheck2(this,FableServiceAnticipate);_this13=_super8.call(this,pFable,pOptions,pServiceHash);_this13.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
|
|
556
555
|
_this13.operationQueue=[];_this13.erroredOperations=[];_this13.executingOperationCount=0;_this13.completedOperationCount=0;_this13.maxOperations=1;_this13.lastError=undefined;_this13.waitingFunctions=[];return _this13;}_createClass2(FableServiceAnticipate,[{key:"checkQueue",value:function checkQueue(){// This checks to see if we need to start any operations.
|
|
557
556
|
if(this.operationQueue.length>0&&this.executingOperationCount<this.maxOperations){var tmpOperation=this.operationQueue.shift();this.executingOperationCount+=1;tmpOperation(this.buildAnticipatorCallback());}else if(this.waitingFunctions.length>0&&this.executingOperationCount<1){// If there are no operations left, and we have waiting functions, call them.
|
|
558
557
|
for(var i=0;i<this.waitingFunctions.length;i++){this.waitingFunctions[i](this.lastError);}// Reset our state
|
|
@@ -694,7 +693,7 @@ return pNumber.toString().replace(this._Regex_formatterAddCommasToNumber,this.pr
|
|
|
694
693
|
*
|
|
695
694
|
* @param {*} pValue
|
|
696
695
|
* @returns {string}
|
|
697
|
-
*/},{key:"formatterDollars",value:function formatterDollars(pValue){var tmpDollarAmount=
|
|
696
|
+
*/},{key:"formatterDollars",value:function formatterDollars(pValue){if(isNaN(pValue)){return this._Value_NaN_Currency;}var tmpDollarAmount=this.fable.Utility.bigDecimal.round(pValue,2);if(isNaN(tmpDollarAmount)){// Try again and see if what was passed in was a dollars string.
|
|
698
697
|
if(typeof pValue=='string'){// TODO: Better rounding function? This is a hack to get rid of the currency symbol and commas.
|
|
699
698
|
tmpDollarAmount=parseFloat(pValue.replace(this._Value_MoneySign_Currency,'').replace(this._Regex_formatterDollarsRemoveCommas,'')).toFixed(2);}// If we didn't get a number, return the "not a number" string.
|
|
700
699
|
if(isNaN(tmpDollarAmount)){return this._Value_NaN_Currency;}}// TODO: Get locale data and use that for this stuff.
|
|
@@ -704,7 +703,7 @@ return"$".concat(this.formatterAddCommasToNumber(tmpDollarAmount));}/**
|
|
|
704
703
|
* @param {*} pValue
|
|
705
704
|
* @param {number} pDigits
|
|
706
705
|
* @returns {string}
|
|
707
|
-
*/},{key:"formatterRoundNumber",value:function formatterRoundNumber(pValue,pDigits){var tmpDigits=typeof pDigits=='undefined'?2:pDigits;var
|
|
706
|
+
*/},{key:"formatterRoundNumber",value:function formatterRoundNumber(pValue,pDigits){var tmpDigits=typeof pDigits=='undefined'?2:pDigits;if(isNaN(pValue)){var tmpZed=0;return tmpZed.toFixed(tmpDigits);}var tmpValue=this.fable.Utility.bigDecimal.round(pValue,tmpDigits);if(isNaN(tmpValue)){var _tmpZed=0;return _tmpZed.toFixed(tmpDigits);}else{return tmpValue;}}/**
|
|
708
707
|
* Generate a reapeating padding string to be appended before or after depending on
|
|
709
708
|
* which padding function it uses.
|
|
710
709
|
*
|
|
@@ -789,10 +788,10 @@ tmpParameters.ActualPath=libPath.normalize(tmpParameters.Path);tmpParameters.Act
|
|
|
789
788
|
// Build the new base path
|
|
790
789
|
if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParameters.CurrentPath+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex];}else{tmpParameters.CurrentPath=tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex];}// Increment the path index
|
|
791
790
|
tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
792
|
-
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){fCallback(null);
|
|
791
|
+
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
793
792
|
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.
|
|
794
793
|
return _this19.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
795
|
-
return _this19.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);fCallback(pCreateError);
|
|
794
|
+
return _this19.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return _this19.makeFolderRecursive(tmpParameters,fCallback);}});}}]);return FableServiceFilePersistence;}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"../Fable-ServiceManager.js":39,"_process":78,"fs":18,"path":72}],48:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;/**
|
|
796
795
|
* Precedent Meta-Templating
|
|
797
796
|
* @author Steven Velozo <steven@velozo.com>
|
|
798
797
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
@@ -928,17 +927,19 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
928
927
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
929
928
|
* @return {bool} True if adding the pattern was successful
|
|
930
929
|
*/},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParser){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}]);return WordTree;}();module.exports=WordTree;},{}],51:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Title":"","Summary":"","Version":0},"Status":{"Completed":false,"CompletionProgress":0,"CompletionTimeElapsed":0,"Steps":1,"StepsCompleted":0,"StartTime":0,"EndTime":0},"Errors":[],"Log":[]};},{}],52:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase6){_inherits(FableOperation,_libFableServiceBase6);var _super15=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,FableOperation);_this23=_super15.call(this,pFable,pOptions,pServiceHash);_this23.serviceType='PhasedOperation';_this23.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
931
|
-
_this23.state.Metadata.Hash=_this23.Hash;_this23.state.Metadata.UUID=_this23.UUID;_this23.name=typeof _this23.options.Name=='string'?_this23.options.Name:"Unnamed Operation ".concat(_this23.state.Metadata.UUID);_this23.log=_assertThisInitialized(_this23);return _this23;}_createClass2(FableOperation,[{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":39,"./Fable-Service-Operation-DefaultSettings.js":51}],53:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceRestClient,_libFableServiceBase7);var _super16=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,FableServiceRestClient);_this24=_super16.call(this,pFable,pOptions,pServiceHash);_this24.TraceLog=false;if(_this24.options.TraceLog||_this24.fable.TraceLog){_this24.TraceLog=true;}_this24.dataFormat=_this24.fable.services.DataFormat;_this24.serviceType='RestClient';_this24.cookie=false;// This is a function that can be overridden, to allow the management
|
|
930
|
+
_this23.state.Metadata.Hash=_this23.Hash;_this23.state.Metadata.UUID=_this23.UUID;_this23.name=typeof _this23.options.Name=='string'?_this23.options.Name:"Unnamed Operation ".concat(_this23.state.Metadata.UUID);_this23.log=_assertThisInitialized(_this23);return _this23;}_createClass2(FableOperation,[{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":39,"./Fable-Service-Operation-DefaultSettings.js":51}],53:[function(require,module,exports){(function(Buffer){(function(){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceRestClient,_libFableServiceBase7);var _super16=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this24;_classCallCheck2(this,FableServiceRestClient);_this24=_super16.call(this,pFable,pOptions,pServiceHash);_this24.TraceLog=false;if(_this24.options.TraceLog||_this24.fable.TraceLog){_this24.TraceLog=true;}_this24.dataFormat=_this24.fable.services.DataFormat;_this24.serviceType='RestClient';_this24.cookie=false;// This is a function that can be overridden, to allow the management
|
|
932
931
|
// of the request options before they are passed to the request library.
|
|
933
|
-
_this24.prepareRequestOptions=function(pOptions){return pOptions;};return _this24;}_createClass2(FableServiceRestClient,[{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){var tmpCookieObject=this.cookie;if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
|
|
932
|
+
_this24.prepareRequestOptions=function(pOptions){return pOptions;};return _this24;}_createClass2(FableServiceRestClient,[{key:"simpleGet",get:function get(){return libSimpleGet;}},{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){var tmpCookieObject=this.cookie;if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
|
|
934
933
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
935
934
|
var tmpOptions=this.prepareCookies(pOptions);return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this25=this;var tmpOptions=this.preRequest(pOptions);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this25.TraceLog){var tmpConnectTime=_this25.fable.log.getTimeStamp();_this25.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this25.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpData='';pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
|
|
936
|
-
if(_this25.TraceLog){var tmpChunkTime=_this25.fable.log.getTimeStamp();_this25.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this25.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this25.TraceLog){var tmpCompletionTime=_this25.fable.log.getTimeStamp();_this25.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this25.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"
|
|
935
|
+
if(_this25.TraceLog){var tmpChunkTime=_this25.fable.log.getTimeStamp();_this25.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this25.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this25.TraceLog){var tmpCompletionTime=_this25.fable.log.getTimeStamp();_this25.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this25.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeChunkedRequestBinary",value:function executeChunkedRequestBinary(pOptions,fCallback){var _this26=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(_this26.TraceLog){var tmpConnectTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this26.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.
|
|
936
|
+
if(_this26.TraceLog){var tmpChunkTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this26.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.
|
|
937
|
+
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(_this26.TraceLog){var tmpCompletionTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpDataBuffer.length,"b received in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpDataBuffer);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this27=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!tmpOptions.hasOwnProperty('headers')){tmpOptions.headers={};}/* Automated headers break some APIs
|
|
937
938
|
if (!tmpOptions.headers.hasOwnProperty('Content-Type'))
|
|
938
939
|
{
|
|
939
940
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
940
941
|
}
|
|
941
|
-
*/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(
|
|
942
|
+
*/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(_this27.TraceLog){var tmpConnectTime=_this27.fable.log.getTimeStamp();_this27.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this27.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this27.TraceLog){var tmpChunkTime=_this27.fable.log.getTimeStamp();_this27.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this27.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this27.TraceLog){var tmpCompletionTime=_this27.fable.log.getTimeStamp();_this27.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this27.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);}}]);return FableServiceRestClient;}(libFableServiceBase);module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"../Fable-ServiceManager.js":39,"buffer":19,"cookie":24,"simple-get":85}],54:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase8){_inherits(FableServiceTemplate,_libFableServiceBase8);var _super17=_createSuper(FableServiceTemplate);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
942
943
|
// string-based template with code snippets into simple executable pieces,
|
|
943
944
|
// with the added twist of returning a precompiled function ready to go.
|
|
944
945
|
//
|
|
@@ -947,19 +948,19 @@ if(_this25.TraceLog){var tmpChunkTime=_this25.fable.log.getTimeStamp();_this25.f
|
|
|
947
948
|
//
|
|
948
949
|
// This is an implementation of that.
|
|
949
950
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
950
|
-
function FableServiceTemplate(pFable,pOptions,pServiceHash){var
|
|
951
|
+
function FableServiceTemplate(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,FableServiceTemplate);_this28=_super17.call(this,pFable,pOptions,pServiceHash);_this28.serviceType='Template';// These are the exact regex's used in lodash/underscore
|
|
951
952
|
// TODO: Switch this to precedent
|
|
952
|
-
|
|
953
|
+
_this28.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.
|
|
953
954
|
GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper functions.
|
|
954
955
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
955
|
-
|
|
956
|
+
_this28.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
|
|
956
957
|
// function on this class.
|
|
957
|
-
|
|
958
|
+
_this28.renderFunction=false;_this28.templateString=false;return _this28;}_createClass2(FableServiceTemplate,[{key:"renderTemplate",value:function renderTemplate(pData){return this.renderFunction(pData);}},{key:"templateFunction",value:function templateFunction(pData){var fRenderTemplateBound=this.renderTemplate.bind(this);return fRenderTemplateBound;}},{key:"buildTemplateFunction",value:function buildTemplateFunction(pTemplateText,pData){var _this29=this;// For now this is being kept in a weird form ... this is to mimic the old
|
|
958
959
|
// underscore code until this is rewritten using precedent.
|
|
959
|
-
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(
|
|
960
|
+
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(_this29.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
|
|
960
961
|
// precompilation.
|
|
961
962
|
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);return FableServiceTemplate;}(libFableServiceBase);module.exports=FableServiceTemplate;},{"../Fable-ServiceManager.js":39}],55:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;// TODO: These are still pretty big -- consider the smaller polyfills
|
|
962
|
-
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var FableServiceUtility=/*#__PURE__*/function(_libFableServiceBase9){_inherits(FableServiceUtility,_libFableServiceBase9);var _super18=_createSuper(FableServiceUtility);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
963
|
+
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var libBigDecimal=require('js-big-decimal');var FableServiceUtility=/*#__PURE__*/function(_libFableServiceBase9){_inherits(FableServiceUtility,_libFableServiceBase9);var _super18=_createSuper(FableServiceUtility);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
963
964
|
// string-based template with code snippets into simple executable pieces,
|
|
964
965
|
// with the added twist of returning a precompiled function ready to go.
|
|
965
966
|
//
|
|
@@ -968,8 +969,8 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
968
969
|
//
|
|
969
970
|
// This is an implementation of that.
|
|
970
971
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
971
|
-
function FableServiceUtility(pFable,pOptions,pServiceHash){var
|
|
972
|
-
|
|
972
|
+
function FableServiceUtility(pFable,pOptions,pServiceHash){var _this30;_classCallCheck2(this,FableServiceUtility);_this30=_super18.call(this,pFable,pOptions,pServiceHash);_this30.templates={};// These two functions are used extensively throughout
|
|
973
|
+
_this30.waterfall=libAsyncWaterfall;_this30.eachLimit=libAsyncEachLimit;_this30.bigDecimal=libBigDecimal;return _this30;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
973
974
|
// Now that es6 gives us this, use the native thingy.
|
|
974
975
|
// Nevermind, the native thing is not stable enough across environments
|
|
975
976
|
// Basic shallow copy
|
|
@@ -1012,9 +1013,68 @@ tmpTimeZoneOffsetInHours=parseInt(tmpDateParts[7])+tmpTimeZoneOffsetInMinutes;//
|
|
|
1012
1013
|
if(pISOString.substr(-6,1)=="+"){// Make the offset negative since the hours will need to be subtracted from the date.
|
|
1013
1014
|
tmpTimeZoneOffsetInHours*=-1;}}// Get the current hours for the date and add the offset to get the correct time adjusted for timezone.
|
|
1014
1015
|
tmpReturnDate.setHours(tmpReturnDate.getHours()+tmpTimeZoneOffsetInHours);// Return the Date object calculated from the string.
|
|
1015
|
-
return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"../Fable-ServiceManager.js":39,"async.eachlimit":1,"async.waterfall":15}],56:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":
|
|
1016
|
+
return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"../Fable-ServiceManager.js":39,"async.eachlimit":1,"async.waterfall":15,"js-big-decimal":59}],56:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":86,"url":107}],57:[function(require,module,exports){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],58:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
|
|
1016
1017
|
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});}};}else{// old school shim for old browsers
|
|
1017
|
-
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],59:[function(require,module,exports){
|
|
1018
|
+
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],59:[function(require,module,exports){(function(global){(function(){(function webpackUniversalModuleDefinition(root,factory){if(_typeof(exports)==='object'&&_typeof(module)==='object')module.exports=factory();else if(typeof define==='function'&&define.amd)define([],factory);else if(_typeof(exports)==='object')exports["bigDecimal"]=factory();else root["bigDecimal"]=factory();})(global,function(){return(/******/function(){// webpackBootstrap
|
|
1019
|
+
/******/"use strict";/******/var __webpack_modules__={/***/165:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.abs=void 0;function abs(n){if(typeof n=='number'||typeof n=='bigint')n=n.toString();if(n[0]=='-')return n.substring(1);return n;}exports.abs=abs;/***/},/***/217:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.pad=exports.trim=exports.add=void 0;//function add {
|
|
1020
|
+
function add(number1,number2){var _a;if(number2===void 0){number2="0";}var neg=0,ind=-1,neg_len;//check for negatives
|
|
1021
|
+
if(number1[0]=='-'){number1=number1.substring(1);if(!testZero(number1)){neg++;ind=1;neg_len=number1.length;}}if(number2[0]=='-'){number2=number2.substring(1);if(!testZero(number2)){neg++;ind=2;neg_len=number2.length;}}number1=trim(number1);number2=trim(number2);_a=pad(trim(number1),trim(number2)),number1=_a[0],number2=_a[1];if(neg==1){if(ind===1)number1=compliment(number1);else if(ind===2)number2=compliment(number2);}var res=addCore(number1,number2);if(!neg)return trim(res);else if(neg==2)return'-'+trim(res);else{if(number1.length<res.length)return trim(res.substring(1));else return'-'+trim(compliment(res));}}exports.add=add;function compliment(number){if(testZero(number)){return number;}var s='',l=number.length,dec=number.split('.')[1],ld=dec?dec.length:0;for(var i=0;i<l;i++){if(number[i]>='0'&&number[i]<='9')s+=9-parseInt(number[i]);else s+=number[i];}var one=ld>0?'0.'+new Array(ld).join('0')+'1':'1';return addCore(s,one);}function trim(number){var parts=number.split('.');if(!parts[0])parts[0]='0';while(parts[0][0]=='0'&&parts[0].length>1)parts[0]=parts[0].substring(1);return parts[0]+(parts[1]?'.'+parts[1]:'');}exports.trim=trim;function pad(number1,number2){var parts1=number1.split('.'),parts2=number2.split('.');//pad integral part
|
|
1022
|
+
var length1=parts1[0].length,length2=parts2[0].length;if(length1>length2){parts2[0]=new Array(Math.abs(length1-length2)+1).join('0')+(parts2[0]?parts2[0]:'');}else{parts1[0]=new Array(Math.abs(length1-length2)+1).join('0')+(parts1[0]?parts1[0]:'');}//pad fractional part
|
|
1023
|
+
length1=parts1[1]?parts1[1].length:0,length2=parts2[1]?parts2[1].length:0;if(length1||length2){if(length1>length2){parts2[1]=(parts2[1]?parts2[1]:'')+new Array(Math.abs(length1-length2)+1).join('0');}else{parts1[1]=(parts1[1]?parts1[1]:'')+new Array(Math.abs(length1-length2)+1).join('0');}}number1=parts1[0]+(parts1[1]?'.'+parts1[1]:'');number2=parts2[0]+(parts2[1]?'.'+parts2[1]:'');return[number1,number2];}exports.pad=pad;function addCore(number1,number2){var _a;_a=pad(number1,number2),number1=_a[0],number2=_a[1];var sum='',carry=0;for(var i=number1.length-1;i>=0;i--){if(number1[i]==='.'){sum='.'+sum;continue;}var temp=parseInt(number1[i])+parseInt(number2[i])+carry;sum=temp%10+sum;carry=Math.floor(temp/10);}return carry?carry.toString()+sum:sum;}function testZero(number){return /^0[0]*[.]{0,1}[0]*$/.test(number);}/***/},/***/423:/***/function _(module,__unused_webpack_exports,__webpack_require__){var add_1=__webpack_require__(217);var abs_1=__webpack_require__(165);var round_1=__webpack_require__(350);var multiply_1=__webpack_require__(182);var divide_1=__webpack_require__(415);var modulus_1=__webpack_require__(213);var compareTo_1=__webpack_require__(664);var subtract_1=__webpack_require__(26);var roundingModes_1=__webpack_require__(916);var bigDecimal=/** @class */function(){function bigDecimal(number){if(number===void 0){number='0';}this.value=bigDecimal.validate(number);}bigDecimal.validate=function(number){if(number){number=number.toString();if(isNaN(number))throw Error("Parameter is not a number: "+number);if(number[0]=='+')number=number.substring(1);}else number='0';//handle missing leading zero
|
|
1024
|
+
if(number.startsWith('.'))number='0'+number;else if(number.startsWith('-.'))number='-0'+number.substr(1);//handle exponentiation
|
|
1025
|
+
if(/e/i.test(number)){var _a=number.split(/[eE]/),mantisa=_a[0],exponent=_a[1];mantisa=(0,add_1.trim)(mantisa);var sign='';if(mantisa[0]=='-'){sign='-';mantisa=mantisa.substring(1);}if(mantisa.indexOf('.')>=0){exponent=parseInt(exponent)+mantisa.indexOf('.');mantisa=mantisa.replace('.','');}else{exponent=parseInt(exponent)+mantisa.length;}if(mantisa.length<exponent){number=sign+mantisa+new Array(exponent-mantisa.length+1).join('0');}else if(mantisa.length>=exponent&&exponent>0){number=sign+(0,add_1.trim)(mantisa.substring(0,exponent))+(mantisa.length>exponent?'.'+mantisa.substring(exponent):'');}else{number=sign+'0.'+new Array(-exponent+1).join('0')+mantisa;}}return number;};bigDecimal.prototype.getValue=function(){return this.value;};bigDecimal.prototype.setValue=function(num){this.value=bigDecimal.validate(num);};bigDecimal.getPrettyValue=function(number,digits,separator){if(!(digits||separator)){digits=3;separator=',';}else if(!(digits&&separator)){throw Error('Illegal Arguments. Should pass both digits and separator or pass none');}number=bigDecimal.validate(number);var neg=number.charAt(0)=='-';if(neg)number=number.substring(1);var len=number.indexOf('.');len=len>0?len:number.length;var temp='';for(var i=len;i>0;){if(i<digits){digits=i;i=0;}else i-=digits;temp=number.substring(i,i+digits)+(i<len-digits&&i>=0?separator:'')+temp;}return(neg?'-':'')+temp+number.substring(len);};bigDecimal.prototype.getPrettyValue=function(digits,separator){return bigDecimal.getPrettyValue(this.value,digits,separator);};bigDecimal.round=function(number,precision,mode){if(precision===void 0){precision=0;}if(mode===void 0){mode=roundingModes_1.RoundingModes.HALF_EVEN;}number=bigDecimal.validate(number);// console.log(number)
|
|
1026
|
+
if(isNaN(precision))throw Error("Precision is not a number: "+precision);return(0,round_1.roundOff)(number,precision,mode);};bigDecimal.prototype.round=function(precision,mode){if(precision===void 0){precision=0;}if(mode===void 0){mode=roundingModes_1.RoundingModes.HALF_EVEN;}if(isNaN(precision))throw Error("Precision is not a number: "+precision);return new bigDecimal((0,round_1.roundOff)(this.value,precision,mode));};bigDecimal.abs=function(number){number=bigDecimal.validate(number);return(0,abs_1.abs)(number);};bigDecimal.prototype.abs=function(){return new bigDecimal((0,abs_1.abs)(this.value));};bigDecimal.floor=function(number){number=bigDecimal.validate(number);if(number.indexOf('.')===-1)return number;return bigDecimal.round(number,0,roundingModes_1.RoundingModes.FLOOR);};bigDecimal.prototype.floor=function(){if(this.value.indexOf('.')===-1)return new bigDecimal(this.value);return new bigDecimal(this.value).round(0,roundingModes_1.RoundingModes.FLOOR);};bigDecimal.ceil=function(number){number=bigDecimal.validate(number);if(number.indexOf('.')===-1)return number;return bigDecimal.round(number,0,roundingModes_1.RoundingModes.CEILING);};bigDecimal.prototype.ceil=function(){if(this.value.indexOf('.')===-1)return new bigDecimal(this.value);return new bigDecimal(this.value).round(0,roundingModes_1.RoundingModes.CEILING);};bigDecimal.add=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,add_1.add)(number1,number2);};bigDecimal.prototype.add=function(number){return new bigDecimal((0,add_1.add)(this.value,number.getValue()));};bigDecimal.subtract=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,subtract_1.subtract)(number1,number2);};bigDecimal.prototype.subtract=function(number){return new bigDecimal((0,subtract_1.subtract)(this.value,number.getValue()));};bigDecimal.multiply=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,multiply_1.multiply)(number1,number2);};bigDecimal.prototype.multiply=function(number){return new bigDecimal((0,multiply_1.multiply)(this.value,number.getValue()));};bigDecimal.divide=function(number1,number2,precision){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,divide_1.divide)(number1,number2,precision);};bigDecimal.prototype.divide=function(number,precision){return new bigDecimal((0,divide_1.divide)(this.value,number.getValue(),precision));};bigDecimal.modulus=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,modulus_1.modulus)(number1,number2);};bigDecimal.prototype.modulus=function(number){return new bigDecimal((0,modulus_1.modulus)(this.value,number.getValue()));};bigDecimal.compareTo=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,compareTo_1.compareTo)(number1,number2);};bigDecimal.prototype.compareTo=function(number){return(0,compareTo_1.compareTo)(this.value,number.getValue());};bigDecimal.negate=function(number){number=bigDecimal.validate(number);return(0,subtract_1.negate)(number);};bigDecimal.prototype.negate=function(){return new bigDecimal((0,subtract_1.negate)(this.value));};bigDecimal.RoundingModes=roundingModes_1.RoundingModes;return bigDecimal;}();module.exports=bigDecimal;/***/},/***/664:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.compareTo=void 0;var add_1=__webpack_require__(217);function compareTo(number1,number2){var _a;var negative=false;if(number1[0]=='-'&&number2[0]!="-"){return-1;}else if(number1[0]!='-'&&number2[0]=='-'){return 1;}else if(number1[0]=='-'&&number2[0]=='-'){number1=number1.substr(1);number2=number2.substr(1);negative=true;}_a=(0,add_1.pad)(number1,number2),number1=_a[0],number2=_a[1];if(number1.localeCompare(number2)==0){return 0;}for(var i=0;i<number1.length;i++){if(number1[i]==number2[i]){continue;}else if(number1[i]>number2[i]){if(negative){return-1;}else{return 1;}}else{if(negative){return 1;}else{return-1;}}}return 0;}exports.compareTo=compareTo;/***/},/***/415:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.divide=void 0;var add_1=__webpack_require__(217);var round_1=__webpack_require__(350);function divide(dividend,divisor,precission){if(precission===void 0){precission=8;}if(divisor==0){throw new Error('Cannot divide by 0');}dividend=dividend.toString();divisor=divisor.toString();// remove trailing zeros in decimal ISSUE#18
|
|
1027
|
+
dividend=dividend.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,"");divisor=divisor.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,"");if(dividend==0)return'0';var neg=0;if(divisor[0]=='-'){divisor=divisor.substring(1);neg++;}if(dividend[0]=='-'){dividend=dividend.substring(1);neg++;}var pt_dvsr=divisor.indexOf('.')>0?divisor.length-divisor.indexOf('.')-1:-1;divisor=(0,add_1.trim)(divisor.replace('.',''));if(pt_dvsr>=0){var pt_dvnd=dividend.indexOf('.')>0?dividend.length-dividend.indexOf('.')-1:-1;if(pt_dvnd==-1){dividend=(0,add_1.trim)(dividend+new Array(pt_dvsr+1).join('0'));}else{if(pt_dvsr>pt_dvnd){dividend=dividend.replace('.','');dividend=(0,add_1.trim)(dividend+new Array(pt_dvsr-pt_dvnd+1).join('0'));}else if(pt_dvsr<pt_dvnd){dividend=dividend.replace('.','');var loc=dividend.length-pt_dvnd+pt_dvsr;dividend=(0,add_1.trim)(dividend.substring(0,loc)+'.'+dividend.substring(loc));}else if(pt_dvsr==pt_dvnd){dividend=(0,add_1.trim)(dividend.replace('.',''));}}}var prec=0,dl=divisor.length,rem='0',quotent='';var dvnd=dividend.indexOf('.')>-1&÷nd.indexOf('.')<dl?dividend.substring(0,dl+1):dividend.substring(0,dl);dividend=dividend.indexOf('.')>-1&÷nd.indexOf('.')<dl?dividend.substring(dl+1):dividend.substring(dl);if(dvnd.indexOf('.')>-1){var shift=dvnd.length-dvnd.indexOf('.')-1;dvnd=dvnd.replace('.','');if(dl>dvnd.length){shift+=dl-dvnd.length;dvnd=dvnd+new Array(dl-dvnd.length+1).join('0');}prec=shift;quotent='0.'+new Array(shift).join('0');}precission=precission+2;while(prec<=precission){var qt=0;while(parseInt(dvnd)>=parseInt(divisor)){dvnd=(0,add_1.add)(dvnd,'-'+divisor);qt++;}quotent+=qt;if(!dividend){if(!prec)quotent+='.';prec++;dvnd=dvnd+'0';}else{if(dividend[0]=='.'){quotent+='.';prec++;dividend=dividend.substring(1);}dvnd=dvnd+dividend.substring(0,1);dividend=dividend.substring(1);}}return(neg==1?'-':'')+(0,add_1.trim)((0,round_1.roundOff)(quotent,precission-2));}exports.divide=divide;/***/},/***/213:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.modulus=void 0;var divide_1=__webpack_require__(415);var round_1=__webpack_require__(350);var multiply_1=__webpack_require__(182);var subtract_1=__webpack_require__(26);var roundingModes_1=__webpack_require__(916);function modulus(dividend,divisor){if(divisor==0){throw new Error('Cannot divide by 0');}dividend=dividend.toString();divisor=divisor.toString();validate(dividend);validate(divisor);var sign='';if(dividend[0]=='-'){sign='-';dividend=dividend.substr(1);}if(divisor[0]=='-'){divisor=divisor.substr(1);}var result=(0,subtract_1.subtract)(dividend,(0,multiply_1.multiply)(divisor,(0,round_1.roundOff)((0,divide_1.divide)(dividend,divisor),0,roundingModes_1.RoundingModes.FLOOR)));return sign+result;}exports.modulus=modulus;function validate(oparand){if(oparand.indexOf('.')!=-1){throw new Error('Modulus of non-integers not supported');}}/***/},/***/182:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.multiply=void 0;function multiply(number1,number2){number1=number1.toString();number2=number2.toString();/*Filter numbers*/var negative=0;if(number1[0]=='-'){negative++;number1=number1.substr(1);}if(number2[0]=='-'){negative++;number2=number2.substr(1);}number1=trailZero(number1);number2=trailZero(number2);var decimalLength1=0;var decimalLength2=0;if(number1.indexOf('.')!=-1){decimalLength1=number1.length-number1.indexOf('.')-1;}if(number2.indexOf('.')!=-1){decimalLength2=number2.length-number2.indexOf('.')-1;}var decimalLength=decimalLength1+decimalLength2;number1=trailZero(number1.replace('.',''));number2=trailZero(number2.replace('.',''));if(number1.length<number2.length){var temp=number1;number1=number2;number2=temp;}if(number2=='0'){return'0';}/*
|
|
1028
|
+
* Core multiplication
|
|
1029
|
+
*/var length=number2.length;var carry=0;var positionVector=[];var currentPosition=length-1;var result="";for(var i=0;i<length;i++){positionVector[i]=number1.length-1;}for(var i=0;i<2*number1.length;i++){var sum=0;for(var j=number2.length-1;j>=currentPosition&&j>=0;j--){if(positionVector[j]>-1&&positionVector[j]<number1.length){sum+=parseInt(number1[positionVector[j]--])*parseInt(number2[j]);}}sum+=carry;carry=Math.floor(sum/10);result=sum%10+result;currentPosition--;}/*
|
|
1030
|
+
* Formatting result
|
|
1031
|
+
*/result=trailZero(adjustDecimal(result,decimalLength));if(negative==1){result='-'+result;}return result;}exports.multiply=multiply;/*
|
|
1032
|
+
* Add decimal point
|
|
1033
|
+
*/function adjustDecimal(number,decimal){if(decimal==0)return number;else{number=decimal>=number.length?new Array(decimal-number.length+1).join('0')+number:number;return number.substr(0,number.length-decimal)+'.'+number.substr(number.length-decimal,decimal);}}/*
|
|
1034
|
+
* Removes zero from front and back*/function trailZero(number){while(number[0]=='0'){number=number.substr(1);}if(number.indexOf('.')!=-1){while(number[number.length-1]=='0'){number=number.substr(0,number.length-1);}}if(number==""||number=="."){number='0';}else if(number[number.length-1]=='.'){number=number.substr(0,number.length-1);}if(number[0]=='.'){number='0'+number;}return number;}/***/},/***/350:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.roundOff=void 0;var roundingModes_1=__webpack_require__(916);/**
|
|
1035
|
+
*
|
|
1036
|
+
* @param input the number to round
|
|
1037
|
+
* @param n precision
|
|
1038
|
+
* @param mode Rounding Mode
|
|
1039
|
+
*/function roundOff(input,n,mode){if(n===void 0){n=0;}if(mode===void 0){mode=roundingModes_1.RoundingModes.HALF_EVEN;}if(mode===roundingModes_1.RoundingModes.UNNECESSARY){throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");}if(typeof input=='number'||typeof input=='bigint')input=input.toString();var neg=false;if(input[0]==='-'){neg=true;input=input.substring(1);}var parts=input.split('.'),partInt=parts[0],partDec=parts[1];//handle case of -ve n: roundOff(12564,-2)=12600
|
|
1040
|
+
if(n<0){n=-n;if(partInt.length<=n)return'0';else{var prefix=partInt.substr(0,partInt.length-n);input=prefix+'.'+partInt.substr(partInt.length-n)+partDec;prefix=roundOff(input,0,mode);return(neg?'-':'')+prefix+new Array(n+1).join('0');}}// handle case when integer output is desired
|
|
1041
|
+
if(n==0){var l=partInt.length;if(greaterThanFive(parts[1],partInt,neg,mode)){partInt=increment(partInt);}return(neg&&parseInt(partInt)?'-':'')+partInt;}// handle case when n>0
|
|
1042
|
+
if(!parts[1]){return(neg?'-':'')+partInt+'.'+new Array(n+1).join('0');}else if(parts[1].length<n){return(neg?'-':'')+partInt+'.'+parts[1]+new Array(n-parts[1].length+1).join('0');}partDec=parts[1].substring(0,n);var rem=parts[1].substring(n);if(rem&&greaterThanFive(rem,partDec,neg,mode)){partDec=increment(partDec);if(partDec.length>n){return(neg?'-':'')+increment(partInt,parseInt(partDec[0]))+'.'+partDec.substring(1);}}return(neg&&(parseInt(partInt)||parseInt(partDec))?'-':'')+partInt+'.'+partDec;}exports.roundOff=roundOff;function greaterThanFive(part,pre,neg,mode){if(!part||part===new Array(part.length+1).join('0'))return false;// #region UP, DOWN, CEILING, FLOOR
|
|
1043
|
+
if(mode===roundingModes_1.RoundingModes.DOWN||!neg&&mode===roundingModes_1.RoundingModes.FLOOR||neg&&mode===roundingModes_1.RoundingModes.CEILING)return false;if(mode===roundingModes_1.RoundingModes.UP||neg&&mode===roundingModes_1.RoundingModes.FLOOR||!neg&&mode===roundingModes_1.RoundingModes.CEILING)return true;// #endregion
|
|
1044
|
+
// case when part !== five
|
|
1045
|
+
var five='5'+new Array(part.length).join('0');if(part>five)return true;else if(part<five)return false;// case when part === five
|
|
1046
|
+
switch(mode){case roundingModes_1.RoundingModes.HALF_DOWN:return false;case roundingModes_1.RoundingModes.HALF_UP:return true;case roundingModes_1.RoundingModes.HALF_EVEN:default:return parseInt(pre[pre.length-1])%2==1;}}function increment(part,c){if(c===void 0){c=0;}if(!c)c=1;if(typeof part=='number')part.toString();var l=part.length-1,s='';for(var i=l;i>=0;i--){var x=parseInt(part[i])+c;if(x==10){c=1;x=0;}else{c=0;}s+=x;}if(c)s+=c;return s.split('').reverse().join('');}/***/},/***/916:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.RoundingModes=void 0;var RoundingModes;(function(RoundingModes){/**
|
|
1047
|
+
* Rounding mode to round towards positive infinity.
|
|
1048
|
+
*/RoundingModes[RoundingModes["CEILING"]=0]="CEILING";/**
|
|
1049
|
+
* Rounding mode to round towards zero.
|
|
1050
|
+
*/RoundingModes[RoundingModes["DOWN"]=1]="DOWN";/**
|
|
1051
|
+
* Rounding mode to round towards negative infinity.
|
|
1052
|
+
*/RoundingModes[RoundingModes["FLOOR"]=2]="FLOOR";/**
|
|
1053
|
+
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
|
|
1054
|
+
* in which case round down.
|
|
1055
|
+
*/RoundingModes[RoundingModes["HALF_DOWN"]=3]="HALF_DOWN";/**
|
|
1056
|
+
* Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
|
|
1057
|
+
* in which case, round towards the even neighbor.
|
|
1058
|
+
*/RoundingModes[RoundingModes["HALF_EVEN"]=4]="HALF_EVEN";/**
|
|
1059
|
+
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
|
|
1060
|
+
* in which case round up.
|
|
1061
|
+
*/RoundingModes[RoundingModes["HALF_UP"]=5]="HALF_UP";/**
|
|
1062
|
+
* Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
|
|
1063
|
+
* UNIMPLEMENTED
|
|
1064
|
+
*/RoundingModes[RoundingModes["UNNECESSARY"]=6]="UNNECESSARY";/**
|
|
1065
|
+
* Rounding mode to round away from zero.
|
|
1066
|
+
*/RoundingModes[RoundingModes["UP"]=7]="UP";})(RoundingModes=exports.RoundingModes||(exports.RoundingModes={}));/***/},/***/26:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.negate=exports.subtract=void 0;var add_1=__webpack_require__(217);function subtract(number1,number2){number1=number1.toString();number2=number2.toString();number2=negate(number2);return(0,add_1.add)(number1,number2);}exports.subtract=subtract;function negate(number){if(number[0]=='-'){number=number.substr(1);}else{number='-'+number;}return number;}exports.negate=negate;/***/}/******/};/************************************************************************/ /******/ // The module cache
|
|
1067
|
+
/******/var __webpack_module_cache__={};/******/ /******/ // The require function
|
|
1068
|
+
/******/function __webpack_require__(moduleId){/******/ // Check if module is in cache
|
|
1069
|
+
/******/var cachedModule=__webpack_module_cache__[moduleId];/******/if(cachedModule!==undefined){/******/return cachedModule.exports;/******/}/******/ // Create a new module (and put it into the cache)
|
|
1070
|
+
/******/var module=__webpack_module_cache__[moduleId]={/******/ // no module.id needed
|
|
1071
|
+
/******/ // no module.loaded needed
|
|
1072
|
+
/******/exports:{}/******/};/******/ /******/ // Execute the module function
|
|
1073
|
+
/******/__webpack_modules__[moduleId](module,module.exports,__webpack_require__);/******/ /******/ // Return the exports of the module
|
|
1074
|
+
/******/return module.exports;/******/}/******/ /************************************************************************/ /******/ /******/ // startup
|
|
1075
|
+
/******/ // Load entry module and return exports
|
|
1076
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
1077
|
+
/******/var __webpack_exports__=__webpack_require__(423);/******/ /******/return __webpack_exports__;/******/}());});}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],60:[function(require,module,exports){// When a boxed property is passed in, it should have quotes of some
|
|
1018
1078
|
// kind around it.
|
|
1019
1079
|
//
|
|
1020
1080
|
// For instance:
|
|
@@ -1029,7 +1089,7 @@ module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=super
|
|
|
1029
1089
|
//
|
|
1030
1090
|
// TODO: Should template literals be processed? If so what state do they have access to? That should happen here if so.
|
|
1031
1091
|
// TODO: Make a simple class include library with these
|
|
1032
|
-
var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pString.startsWith(pCharacter)&&pString.endsWith(pCharacter)){return pString.substring(1,pString.length-1);}else{return pString;}};module.exports=cleanWrapCharacters;},{}],
|
|
1092
|
+
var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pString.startsWith(pCharacter)&&pString.endsWith(pCharacter)){return pString.substring(1,pString.length-1);}else{return pString;}};module.exports=cleanWrapCharacters;},{}],61:[function(require,module,exports){/**
|
|
1033
1093
|
* @author <steven@velozo.com>
|
|
1034
1094
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
1035
1095
|
* Hash Translation
|
|
@@ -1046,16 +1106,16 @@ var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pStr
|
|
|
1046
1106
|
*
|
|
1047
1107
|
* @class ManyfestHashTranslation
|
|
1048
1108
|
*/var ManyfestHashTranslation=/*#__PURE__*/function(){function ManyfestHashTranslation(pInfoLog,pErrorLog){_classCallCheck2(this,ManyfestHashTranslation);// Wire in logging
|
|
1049
|
-
this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}_createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var
|
|
1109
|
+
this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}_createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var _this31=this;// This adds a translation in the form of:
|
|
1050
1110
|
// { "SourceHash": "DestinationHash", "SecondSourceHash":"SecondDestinationHash" }
|
|
1051
|
-
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'){
|
|
1111
|
+
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'){_this31.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{_this31.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}},{key:"removeTranslationHash",value:function removeTranslationHash(pTranslationHash){if(this.translationTable.hasOwnProperty(pTranslationHash)){delete this.translationTable[pTranslationHash];}}// This removes translations.
|
|
1052
1112
|
// If passed a string, just removes the single one.
|
|
1053
1113
|
// If passed an object, it does all the source keys.
|
|
1054
|
-
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var
|
|
1114
|
+
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var _this32=this;if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(_typeof(pTranslation)=='object'){var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){_this32.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(this.translationTable.hasOwnProperty(pTranslation)){return this.translationTable[pTranslation];}else{return pTranslation;}}}]);return ManyfestHashTranslation;}();module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":62}],62:[function(require,module,exports){/**
|
|
1055
1115
|
* @author <steven@velozo.com>
|
|
1056
1116
|
*/ /**
|
|
1057
1117
|
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
1058
|
-
*/var logToConsole=function logToConsole(pLogLine,pLogObject){var tmpLogLine=typeof pLogLine==='string'?pLogLine:'';console.log("[Manyfest] ".concat(tmpLogLine));if(pLogObject)console.log(JSON.stringify(pLogObject));};module.exports=logToConsole;},{}],
|
|
1118
|
+
*/var logToConsole=function logToConsole(pLogLine,pLogObject){var tmpLogLine=typeof pLogLine==='string'?pLogLine:'';console.log("[Manyfest] ".concat(tmpLogLine));if(pLogObject)console.log(JSON.stringify(pLogObject));};module.exports=logToConsole;},{}],63:[function(require,module,exports){/**
|
|
1059
1119
|
* @author <steven@velozo.com>
|
|
1060
1120
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
1061
1121
|
* Object Address Resolver
|
|
@@ -1154,7 +1214,7 @@ return this.checkAddressExists(pObject[_tmpBoxedPropertyName][_tmpBoxedPropertyN
|
|
|
1154
1214
|
// then the system can't set the value in there. Error and abort!
|
|
1155
1215
|
if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!=='object'){return false;}else if(pObject.hasOwnProperty(tmpSubObjectName)){// If there is already a subobject pass that to the recursive thingy
|
|
1156
1216
|
return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress);}else{// Create a subobject and then pass that
|
|
1157
|
-
pObject[tmpSubObjectName]={};return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress);}}}}]);return ManyfestObjectAddressResolverCheckAddressExists;}();;module.exports=ManyfestObjectAddressResolverCheckAddressExists;},{"./Manyfest-LogToConsole.js":
|
|
1217
|
+
pObject[tmpSubObjectName]={};return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress);}}}}]);return ManyfestObjectAddressResolverCheckAddressExists;}();;module.exports=ManyfestObjectAddressResolverCheckAddressExists;},{"./Manyfest-LogToConsole.js":62}],64:[function(require,module,exports){/**
|
|
1158
1218
|
* @author <steven@velozo.com>
|
|
1159
1219
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');var fCleanWrapCharacters=require('./Manyfest-CleanWrapCharacters.js');var fParseConditionals=require("../source/Manyfest-ParseConditionals.js");/**
|
|
1160
1220
|
* Object Address Resolver - DeleteValue
|
|
@@ -1281,7 +1341,7 @@ if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!
|
|
|
1281
1341
|
// Continue to manage the parent address for recursion
|
|
1282
1342
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}else{// Create a subobject and then pass that
|
|
1283
1343
|
// Continue to manage the parent address for recursion
|
|
1284
|
-
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);pObject[tmpSubObjectName]={};return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}}}}]);return ManyfestObjectAddressResolverDeleteValue;}();;module.exports=ManyfestObjectAddressResolverDeleteValue;},{"../source/Manyfest-ParseConditionals.js":
|
|
1344
|
+
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);pObject[tmpSubObjectName]={};return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}}}}]);return ManyfestObjectAddressResolverDeleteValue;}();;module.exports=ManyfestObjectAddressResolverDeleteValue;},{"../source/Manyfest-ParseConditionals.js":68,"./Manyfest-CleanWrapCharacters.js":60,"./Manyfest-LogToConsole.js":62}],65:[function(require,module,exports){/**
|
|
1285
1345
|
* @author <steven@velozo.com>
|
|
1286
1346
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');var fCleanWrapCharacters=require('./Manyfest-CleanWrapCharacters.js');var fParseConditionals=require("../source/Manyfest-ParseConditionals.js");/**
|
|
1287
1347
|
* Object Address Resolver - GetValue
|
|
@@ -1415,7 +1475,7 @@ if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!
|
|
|
1415
1475
|
// Continue to manage the parent address for recursion
|
|
1416
1476
|
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}else{// Create a subobject and then pass that
|
|
1417
1477
|
// Continue to manage the parent address for recursion
|
|
1418
|
-
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);pObject[tmpSubObjectName]={};return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}}}}]);return ManyfestObjectAddressResolverGetValue;}();;module.exports=ManyfestObjectAddressResolverGetValue;},{"../source/Manyfest-ParseConditionals.js":
|
|
1478
|
+
tmpParentAddress="".concat(tmpParentAddress).concat(tmpParentAddress.length>0?'.':'').concat(tmpSubObjectName);pObject[tmpSubObjectName]={};return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}}}}]);return ManyfestObjectAddressResolverGetValue;}();;module.exports=ManyfestObjectAddressResolverGetValue;},{"../source/Manyfest-ParseConditionals.js":68,"./Manyfest-CleanWrapCharacters.js":60,"./Manyfest-LogToConsole.js":62}],66:[function(require,module,exports){/**
|
|
1419
1479
|
* @author <steven@velozo.com>
|
|
1420
1480
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');var fCleanWrapCharacters=require('./Manyfest-CleanWrapCharacters.js');/**
|
|
1421
1481
|
* Object Address Resolver - SetValue
|
|
@@ -1504,7 +1564,7 @@ return this.setValueAtAddress(pObject[_tmpBoxedPropertyName8][_tmpBoxedPropertyN
|
|
|
1504
1564
|
if(pObject.hasOwnProperty(tmpSubObjectName)&&_typeof(pObject[tmpSubObjectName])!=='object'){if(!pObject.hasOwnProperty('__ERROR'))pObject['__ERROR']={};// Put it in an error object so data isn't lost
|
|
1505
1565
|
pObject['__ERROR'][pAddress]=pValue;return false;}else if(pObject.hasOwnProperty(tmpSubObjectName)){// If there is already a subobject pass that to the recursive thingy
|
|
1506
1566
|
return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}else{// Create a subobject and then pass that
|
|
1507
|
-
pObject[tmpSubObjectName]={};return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}}}}]);return ManyfestObjectAddressSetValue;}();;module.exports=ManyfestObjectAddressSetValue;},{"./Manyfest-CleanWrapCharacters.js":
|
|
1567
|
+
pObject[tmpSubObjectName]={};return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}}}}]);return ManyfestObjectAddressSetValue;}();;module.exports=ManyfestObjectAddressSetValue;},{"./Manyfest-CleanWrapCharacters.js":60,"./Manyfest-LogToConsole.js":62}],67:[function(require,module,exports){/**
|
|
1508
1568
|
* @author <steven@velozo.com>
|
|
1509
1569
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
1510
1570
|
* Object Address Generation
|
|
@@ -1539,7 +1599,7 @@ this.logInfo=typeof pInfoLog=='function'?pInfoLog:libSimpleLog;this.logError=typ
|
|
|
1539
1599
|
// permutations and default values (when not an object) and everything else.
|
|
1540
1600
|
_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.
|
|
1541
1601
|
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 _i9=0;_i9<tmpObjectProperties.length;_i9++){this.generateAddressses(pObject[tmpObjectProperties[_i9]],"".concat(tmpBaseAddress).concat(tmpObjectProperties[_i9]),tmpSchema);}}break;case'symbol':case'function':// Symbols and functions neither recurse nor get added to the schema
|
|
1542
|
-
break;}return tmpSchema;}}]);return ManyfestObjectAddressGeneration;}();;module.exports=ManyfestObjectAddressGeneration;},{"./Manyfest-LogToConsole.js":
|
|
1602
|
+
break;}return tmpSchema;}}]);return ManyfestObjectAddressGeneration;}();;module.exports=ManyfestObjectAddressGeneration;},{"./Manyfest-LogToConsole.js":62}],68:[function(require,module,exports){// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
1543
1603
|
//
|
|
1544
1604
|
// For instance:
|
|
1545
1605
|
// 'files[]<<~?format,==,Thumbnail?~>>'
|
|
@@ -1560,7 +1620,7 @@ var testCondition=function testCondition(pManyfest,pRecord,pSearchAddress,pSearc
|
|
|
1560
1620
|
2. Find stop points within each start point
|
|
1561
1621
|
3. Check the conditional
|
|
1562
1622
|
*/var tmpStartIndex=pAddress.indexOf(_ConditionalStanzaStart);while(tmpStartIndex!=-1){var tmpStopIndex=pAddress.indexOf(_ConditionalStanzaEnd,tmpStartIndex+_ConditionalStanzaStartLength);if(tmpStopIndex!=-1){var tmpMagicComparisonPatternSet=pAddress.substring(tmpStartIndex+_ConditionalStanzaStartLength,tmpStopIndex).split(',');var tmpSearchAddress=tmpMagicComparisonPatternSet[0];var tmpSearchComparator=tmpMagicComparisonPatternSet[1];var tmpSearchValue=tmpMagicComparisonPatternSet[2];// Process the piece
|
|
1563
|
-
tmpKeepRecord=tmpKeepRecord&&testCondition(pManyfest,pRecord,tmpSearchAddress,tmpSearchComparator,tmpSearchValue);tmpStartIndex=pAddress.indexOf(_ConditionalStanzaStart,tmpStopIndex+_ConditionalStanzaEndLength);}else{tmpStartIndex=-1;}}return tmpKeepRecord;};module.exports=parseConditionals;},{}],
|
|
1623
|
+
tmpKeepRecord=tmpKeepRecord&&testCondition(pManyfest,pRecord,tmpSearchAddress,tmpSearchComparator,tmpSearchValue);tmpStartIndex=pAddress.indexOf(_ConditionalStanzaStart,tmpStopIndex+_ConditionalStanzaEndLength);}else{tmpStartIndex=-1;}}return tmpKeepRecord;};module.exports=parseConditionals;},{}],69:[function(require,module,exports){/**
|
|
1564
1624
|
* @author <steven@velozo.com>
|
|
1565
1625
|
*/var libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
1566
1626
|
* Schema Manipulation Functions
|
|
@@ -1593,15 +1653,15 @@ if(tmpOldDescriptorAddress){tmpDescriptor=pManyfestSchemaDescriptors[tmpOldDescr
|
|
|
1593
1653
|
tmpDescriptor={Hash:pInputAddress};}// Now re-add the descriptor to the manyfest schema
|
|
1594
1654
|
pManyfestSchemaDescriptors[tmpNewDescriptorAddress]=tmpDescriptor;});return true;}},{key:"safeResolveAddressMappings",value:function safeResolveAddressMappings(pManyfestSchemaDescriptors,pAddressMapping){// This returns the descriptors as a new object, safely remapping without mutating the original schema Descriptors
|
|
1595
1655
|
var tmpManyfestSchemaDescriptors=JSON.parse(JSON.stringify(pManyfestSchemaDescriptors));this.resolveAddressMappings(tmpManyfestSchemaDescriptors,pAddressMapping);return tmpManyfestSchemaDescriptors;}},{key:"mergeAddressMappings",value:function mergeAddressMappings(pManyfestSchemaDescriptorsDestination,pManyfestSchemaDescriptorsSource){if(_typeof(pManyfestSchemaDescriptorsSource)!='object'||_typeof(pManyfestSchemaDescriptorsDestination)!='object'){this.logError("Attempted to merge two schema descriptors but both were not objects.");return false;}var tmpSource=JSON.parse(JSON.stringify(pManyfestSchemaDescriptorsSource));var tmpNewManyfestSchemaDescriptors=JSON.parse(JSON.stringify(pManyfestSchemaDescriptorsDestination));// The first passed-in set of descriptors takes precedence.
|
|
1596
|
-
var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach(function(pDescriptorAddress){if(!tmpNewManyfestSchemaDescriptors.hasOwnProperty(pDescriptorAddress)){tmpNewManyfestSchemaDescriptors[pDescriptorAddress]=tmpSource[pDescriptorAddress];}});return tmpNewManyfestSchemaDescriptors;}}]);return ManyfestSchemaManipulation;}();module.exports=ManyfestSchemaManipulation;},{"./Manyfest-LogToConsole.js":
|
|
1656
|
+
var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach(function(pDescriptorAddress){if(!tmpNewManyfestSchemaDescriptors.hasOwnProperty(pDescriptorAddress)){tmpNewManyfestSchemaDescriptors[pDescriptorAddress]=tmpSource[pDescriptorAddress];}});return tmpNewManyfestSchemaDescriptors;}}]);return ManyfestSchemaManipulation;}();module.exports=ManyfestSchemaManipulation;},{"./Manyfest-LogToConsole.js":62}],70:[function(require,module,exports){/**
|
|
1597
1657
|
* @author <steven@velozo.com>
|
|
1598
1658
|
*/var libFableServiceProviderBase=require('fable-serviceproviderbase');var libSimpleLog=require('./Manyfest-LogToConsole.js');var libHashTranslation=require('./Manyfest-HashTranslation.js');var libObjectAddressCheckAddressExists=require('./Manyfest-ObjectAddress-CheckAddressExists.js');var libObjectAddressGetValue=require('./Manyfest-ObjectAddress-GetValue.js');var libObjectAddressSetValue=require('./Manyfest-ObjectAddress-SetValue.js');var libObjectAddressDeleteValue=require('./Manyfest-ObjectAddress-DeleteValue.js');var libObjectAddressGeneration=require('./Manyfest-ObjectAddressGeneration.js');var libSchemaManipulation=require('./Manyfest-SchemaManipulation.js');var _DefaultConfiguration={Scope:'DEFAULT',Descriptors:{}};/**
|
|
1599
1659
|
* Manyfest object address-based descriptions and manipulations.
|
|
1600
1660
|
*
|
|
1601
1661
|
* @class Manyfest
|
|
1602
|
-
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi7){_inherits(Manyfest,_libFableServiceProvi7);var _super19=_createSuper(Manyfest);function Manyfest(pFable,pManifest,pServiceHash){var
|
|
1603
|
-
|
|
1604
|
-
|
|
1662
|
+
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi7){_inherits(Manyfest,_libFableServiceProvi7);var _super19=_createSuper(Manyfest);function Manyfest(pFable,pManifest,pServiceHash){var _this33;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this33=_super19.call(this,{});}else{_this33=_super19.call(this,pFable,pManifest,pServiceHash);}_this33.serviceType='Manifest';// Wire in logging
|
|
1663
|
+
_this33.logInfo=libSimpleLog;_this33.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
1664
|
+
_this33.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this33.logInfo,_this33.logError);_this33.objectAddressGetValue=new libObjectAddressGetValue(_this33.logInfo,_this33.logError);_this33.objectAddressSetValue=new libObjectAddressSetValue(_this33.logInfo,_this33.logError);_this33.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this33.logInfo,_this33.logError);if(!_this33.options.hasOwnProperty('defaultValues')){_this33.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this33.options.hasOwnProperty('strict')){_this33.options.strict=false;}_this33.scope=undefined;_this33.elementAddresses=undefined;_this33.elementHashes=undefined;_this33.elementDescriptors=undefined;_this33.reset();if(_typeof(_this33.options)==='object'){_this33.loadManifest(_this33.options);}_this33.schemaManipulations=new libSchemaManipulation(_this33.logInfo,_this33.logError);_this33.objectAddressGeneration=new libObjectAddressGeneration(_this33.logInfo,_this33.logError);_this33.hashTranslations=new libHashTranslation(_this33.logInfo,_this33.logError);return _possibleConstructorReturn(_this33);}/*************************************************************************
|
|
1605
1665
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
1606
1666
|
*/ // Reset critical manifest properties
|
|
1607
1667
|
_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
|
|
@@ -1652,13 +1712,13 @@ return null;}}}// Enumerate through the schema and populate default values if th
|
|
|
1652
1712
|
},{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.
|
|
1653
1713
|
function(pDescriptor){return pDescriptor.hasOwnProperty('Default');});}// Forcefully populate all values even if they don't have defaults.
|
|
1654
1714
|
// Based on type, this can do unexpected things.
|
|
1655
|
-
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var
|
|
1715
|
+
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var _this34=this;// Automatically create an object if one isn't passed in.
|
|
1656
1716
|
var tmpObject=_typeof(pObject)==='object'?pObject:{};// Default to *NOT OVERWRITING* properties
|
|
1657
1717
|
var tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverwriteProperties;// This is a filter function, which is passed the schema and allows complex filtering of population
|
|
1658
1718
|
// The default filter function just returns true, populating everything.
|
|
1659
|
-
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=
|
|
1719
|
+
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=_this34.getDescriptor(pAddress);// Check the filter function to see if this is an address we want to set the value for.
|
|
1660
1720
|
if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
|
|
1661
|
-
if(tmpOverwriteProperties||!
|
|
1721
|
+
if(tmpOverwriteProperties||!_this34.checkAddressExists(tmpObject,pAddress)){_this34.setValueAtAddress(tmpObject,pAddress,_this34.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);return Manyfest;}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":61,"./Manyfest-LogToConsole.js":62,"./Manyfest-ObjectAddress-CheckAddressExists.js":63,"./Manyfest-ObjectAddress-DeleteValue.js":64,"./Manyfest-ObjectAddress-GetValue.js":65,"./Manyfest-ObjectAddress-SetValue.js":66,"./Manyfest-ObjectAddressGeneration.js":67,"./Manyfest-SchemaManipulation.js":69,"fable-serviceproviderbase":33}],71:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function value(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function value(){return onceStrict(this);},configurable:true});});function once(fn){var f=function f(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function f(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":110}],72:[function(require,module,exports){(function(process){(function(){// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
1662
1722
|
// transplited with Babel
|
|
1663
1723
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
1664
1724
|
//
|
|
@@ -1740,60 +1800,60 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
|
|
|
1740
1800
|
// have a good chance at having a non-empty extension
|
|
1741
1801
|
preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
|
|
1742
1802
|
preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
1743
|
-
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":
|
|
1803
|
+
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":78}],73:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictSettings={Name:'DefaultPictApplication',// The main "viewport" is the view that is used to host our application
|
|
1744
1804
|
MainViewportViewIdentifier:'Default-View',MainViewportRenderableHash:false,MainViewportDestinationAddress:false,MainViewportDefaultDataAddress:false,// Whether or not we should automatically render the main viewport after we initialize the pict application
|
|
1745
1805
|
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,Manifests:{},// The prefix to prepend on all template destination hashes
|
|
1746
|
-
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
var tmpManifestKeys=Object.keys(
|
|
1750
|
-
var tmpManifestKey=tmpManifestKeys[i];
|
|
1806
|
+
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this35=_super20.call(this,pFable,tmpOptions,pServiceHash);_this35.serviceType='PictApplication';// Convenience and consistency naming
|
|
1807
|
+
_this35.pict=_this35.fable;// Wire in the essential Pict state
|
|
1808
|
+
_this35.AppData=_this35.fable.AppData;_this35.initializeTimestamp=false;_this35.lastSolvedTimestamp=false;// Load all the manifests for the application
|
|
1809
|
+
var tmpManifestKeys=Object.keys(_this35.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
1810
|
+
var tmpManifestKey=tmpManifestKeys[i];_this35.fable.serviceManager.instantiateServiceProvider('Manifest',_this35.options.Manifests[tmpManifestKey],tmpManifestKey);}}return _this35;}_createClass2(PictApplication,[{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," executing solve() function..."));}this.onBeforeSolve();// Now walk through any loaded views and initialize them as well.
|
|
1751
1811
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];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)
|
|
1752
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i12=0;_i12<tmpViewsToSolve.length;_i12++){tmpViewsToSolve[_i12].solve();}this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var
|
|
1812
|
+
tmpViewsToSolve.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i12=0;_i12<tmpViewsToSolve.length;_i12++){tmpViewsToSolve[_i12].solve();}this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.fable.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this36=this;var tmpAnticipate=this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Anticipate');tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));// Walk through any loaded views and solve them as well.
|
|
1753
1813
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToSolve=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];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)
|
|
1754
|
-
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i13=0;_i13<tmpViewsToSolve.length;_i13++){tmpAnticipate.anticipate(tmpViewsToSolve[_i13].solveAsync.bind(tmpViewsToSolve[_i13]));}tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(
|
|
1814
|
+
tmpViewsToSolve.sort(function(a,b){return a.options.AutoSolveOrdinal-b.options.AutoSolveOrdinal;});for(var _i13=0;_i13<tmpViewsToSolve.length;_i13++){tmpAnticipate.anticipate(tmpViewsToSolve[_i13].solveAsync.bind(tmpViewsToSolve[_i13]));}tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this36.pict.LogNoisiness>2){_this36.log.trace("PictApp [".concat(_this36.UUID,"]::[").concat(_this36.Hash,"] ").concat(_this36.options.Name," solveAsync() complete."));}_this36.lastSolvedTimestamp=_this36.fable.log.getTimeStamp();return fCallback(pError);});}},{key:"onAfterSolve",value:function onAfterSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterSolve:"));}return true;}},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();// Now walk through any loaded views and initialize them as well.
|
|
1755
1815
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];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)
|
|
1756
1816
|
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i14=0;_i14<tmpViewsToInitialize.length;_i14++){tmpViewsToInitialize[_i14].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
|
|
1757
1817
|
this.solve();}// Now check and see if we should automatically render as well
|
|
1758
1818
|
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
|
|
1759
|
-
this.render();}this.initializeTimestamp=this.fable.log.getTimeStamp();return true;}else{this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallBack){var
|
|
1819
|
+
this.render();}this.initializeTimestamp=this.fable.log.getTimeStamp();return true;}else{this.log.warn("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallBack){var _this37=this;if(!this.initializeTimestamp){var tmpAnticipate=this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));// Now walk through any loaded views and initialize them as well.
|
|
1760
1820
|
// TODO: Some optimization cleverness could be gained by grouping them into a parallelized async operation, by ordinal.
|
|
1761
1821
|
var tmpLoadedViews=Object.keys(this.pict.views);var tmpViewsToInitialize=[];for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];if(tmpView.options.AutoInitialize){tmpViewsToInitialize.push(tmpView);}}// Sort the views by their priority
|
|
1762
1822
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
1763
|
-
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i15=0;_i15<tmpViewsToInitialize.length;_i15++){var _tmpView=tmpViewsToInitialize[_i15];tmpAnticipate.anticipate(_tmpView.initializeAsync.bind(_tmpView));}tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));if(this.options.AutoSolveAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto solving (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.solveAsync.bind(this));}if(this.options.AutoRenderMainViewportViewAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto rendering (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.renderMainViewportAsync.bind(this));}tmpAnticipate.wait(function(pError){
|
|
1823
|
+
tmpViewsToInitialize.sort(function(a,b){return a.options.AutoInitializeOrdinal-b.options.AutoInitializeOrdinal;});for(var _i15=0;_i15<tmpViewsToInitialize.length;_i15++){var _tmpView=tmpViewsToInitialize[_i15];tmpAnticipate.anticipate(_tmpView.initializeAsync.bind(_tmpView));}tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));if(this.options.AutoSolveAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto solving (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.solveAsync.bind(this));}if(this.options.AutoRenderMainViewportViewAfterInitialize){if(this.pict.LogNoisiness>1){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," auto rendering (asynchronously) after initialization..."));}tmpAnticipate.anticipate(this.renderMainViewportAsync.bind(this));}tmpAnticipate.wait(function(pError){_this37.initializeTimestamp=_this37.fable.log.getTimeStamp();if(_this37.pict.LogNoisiness>2){_this37.log.trace("PictApp [".concat(_this37.UUID,"]::[").concat(_this37.Hash,"] ").concat(_this37.options.Name," initialization complete."));}return fCallBack();});}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?
|
|
1764
1824
|
return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}},{key:"render",value:function render(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpViewIdentifier=typeof pViewIdentifier==='undefined'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash==='undefined'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='undefined'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress==='undefined'?this.options.MainViewportDefaultDataAddress:pTemplateDataAddress;// Now get the view (by hash) from the loaded views
|
|
1765
|
-
var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpViewIdentifier]:false;if(!tmpView){this.log.error("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(tmpViewIdentifier," because it is not a valid view."));return false;}return tmpView.render(tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress);}},{key:"renderMainViewport",value:function renderMainViewport(){return this.render(this.options.MainViewportViewIdentifier,this.options.MainViewportRenderableHash,this.options.MainViewportDestinationAddress,this.options.MainViewportDefaultDataAddress);}},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var tmpViewIdentifier=typeof pViewIdentifier==='undefined'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash==='undefined'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='undefined'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress==='undefined'?this.options.MainViewportDefaultDataAddress:pTemplateDataAddress;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 fCallback(new Error(tmpErrorMessage));}return tmpView.renderAsync(tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress,fCallback);}},{key:"renderMainViewportAsync",value:function renderMainViewportAsync(fCallback){return this.renderAsync(this.options.MainViewportViewIdentifier,this.options.MainViewportRenderableHash,this.options.MainViewportDestinationAddress,this.options.MainViewportDefaultDataAddress,fCallback);}}]);return PictApplication;}(libFableServiceBase);module.exports=PictApplication;},{"fable-serviceproviderbase":33}],
|
|
1825
|
+
var tmpView=typeof tmpViewIdentifier==='string'?this.servicesMap.PictView[tmpViewIdentifier]:false;if(!tmpView){this.log.error("PictApp [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(tmpViewIdentifier," because it is not a valid view."));return false;}return tmpView.render(tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress);}},{key:"renderMainViewport",value:function renderMainViewport(){return this.render(this.options.MainViewportViewIdentifier,this.options.MainViewportRenderableHash,this.options.MainViewportDestinationAddress,this.options.MainViewportDefaultDataAddress);}},{key:"renderAsync",value:function renderAsync(pViewIdentifier,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var tmpViewIdentifier=typeof pViewIdentifier==='undefined'?this.options.MainViewportViewIdentifier:pViewIdentifier;var tmpRenderableHash=typeof pRenderableHash==='undefined'?this.options.MainViewportRenderableHash:pRenderableHash;var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='undefined'?this.options.MainViewportDestinationAddress:pRenderDestinationAddress;var tmpTemplateDataAddress=typeof pTemplateDataAddress==='undefined'?this.options.MainViewportDefaultDataAddress:pTemplateDataAddress;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 fCallback(new Error(tmpErrorMessage));}return tmpView.renderAsync(tmpRenderableHash,tmpRenderDestinationAddress,tmpTemplateDataAddress,fCallback);}},{key:"renderMainViewportAsync",value:function renderMainViewportAsync(fCallback){return this.renderAsync(this.options.MainViewportViewIdentifier,this.options.MainViewportRenderableHash,this.options.MainViewportDestinationAddress,this.options.MainViewportDefaultDataAddress,fCallback);}}]);return PictApplication;}(libFableServiceBase);module.exports=PictApplication;},{"fable-serviceproviderbase":33}],74:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
1766
1826
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
1767
1827
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
1768
1828
|
// After the App initializes, render will be called as soon as it's added.
|
|
1769
|
-
AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSSHash:false,CSS:false,CSSProvider:false,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var
|
|
1770
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);
|
|
1771
|
-
|
|
1772
|
-
|
|
1829
|
+
AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSSHash:false,CSS:false,CSSProvider:false,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this38;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
1830
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this38=_super21.call(this,pFable,tmpOptions,pServiceHash);if(!_this38.options.ViewIdentifier){_this38.options.ViewIdentifier="AutoViewID-".concat(_this38.fable.getUUID());}_this38.serviceType='PictView';// Convenience and consistency naming
|
|
1831
|
+
_this38.pict=_this38.fable;// Wire in the essential Pict application state
|
|
1832
|
+
_this38.AppData=_this38.pict.AppData;_this38.initializeTimestamp=false;_this38.lastSolvedTimestamp=false;_this38.lastRenderedTimestamp=false;// Load all templates from the array in the options
|
|
1773
1833
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
1774
|
-
for(var i=0;i<
|
|
1834
|
+
for(var i=0;i<_this38.options.Templates.length;i++){var tmpTemplate=_this38.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this38.log.error("PictView [".concat(_this38.UUID,"]::[").concat(_this38.Hash,"] ").concat(_this38.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this38.UUID,"]::[").concat(_this38.Hash,"] ").concat(_this38.options.ViewIdentifier," options object.");}_this38.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
1775
1835
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
1776
|
-
for(var _i16=0;_i16<
|
|
1777
|
-
if(
|
|
1836
|
+
for(var _i16=0;_i16<_this38.options.DefaultTemplates.length;_i16++){var tmpDefaultTemplate=_this38.options.DefaultTemplates[_i16];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this38.log.error("PictView [".concat(_this38.UUID,"]::[").concat(_this38.Hash,"] ").concat(_this38.options.ViewIdentifier," could not load Default Template ").concat(_i16," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this38.UUID,"]::[").concat(_this38.Hash,"] ").concat(_this38.options.ViewIdentifier," options object.");}_this38.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load the CSS if it's available
|
|
1837
|
+
if(_this38.options.CSS){var tmpCSSHash=_this38.options.CSSHash?_this38.options.CSSHash:"View-".concat(_this38.options.ViewIdentifier);var tmpCSSProvider=_this38.options.CSSProvider?_this38.options.CSSProvider:tmpCSSHash;_this38.pict.CSSMap.addCSS(tmpCSSHash,_this38.options.CSS,tmpCSSProvider,_this38.options.CSSPriority);}// Load all renderables
|
|
1778
1838
|
// Renderables are launchable renderable instructions with templates
|
|
1779
1839
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
1780
1840
|
// The only parts that are necessary are Identifier and Template
|
|
1781
1841
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
1782
|
-
|
|
1842
|
+
_this38.renderables={};for(var _i17=0;_i17<_this38.options.Renderables.length;_i17++){var tmpRenderable=_this38.options.Renderables[_i17];_this38.addRenderable(_this38.options.Renderables[_i17]);}return _this38;}_createClass2(PictView,[{key:"addRenderable",value:function addRenderable(pRenderableHash,pTemplateHash,pDefaultTemplateDataAddress,pDefaultDestinationAddress,pRenderMethod){var tmpRenderable=false;if(_typeof(pRenderableHash)=='object'){// The developer passed in the renderable as an object.
|
|
1783
1843
|
// Use theirs instead!
|
|
1784
|
-
tmpRenderable=pRenderableHash;}else{var tmpRenderMethod=typeof pRenderMethod!=='string'?pRenderMethod:'replace';tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateDataAddress:pDefaultTemplateDataAddress,DefaultDestinationAddress:pDefaultDestinationAddress,RenderMethod:tmpRenderMethod};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}},{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeSolve();this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var
|
|
1844
|
+
tmpRenderable=pRenderableHash;}else{var tmpRenderMethod=typeof pRenderMethod!=='string'?pRenderMethod:'replace';tmpRenderable={RenderableHash:pRenderableHash,TemplateHash:pTemplateHash,DefaultTemplateDataAddress:pDefaultTemplateDataAddress,DefaultDestinationAddress:pDefaultDestinationAddress,RenderMethod:tmpRenderMethod};}if(typeof tmpRenderable.RenderableHash!='string'||typeof tmpRenderable.TemplateHash!='string'){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not load Renderable; RenderableHash or TemplateHash are invalid."),tmpRenderable);}else{if(this.pict.LogNoisiness>0){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," adding renderable [").concat(tmpRenderable.RenderableHash,"] pointed to template ").concat(tmpRenderable.TemplateHash,"."));}this.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}},{key:"onBeforeSolve",value:function onBeforeSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeSolve:"));}return true;}},{key:"onBeforeSolveAsync",value:function onBeforeSolveAsync(fCallback){this.onBeforeSolve();return fCallback();}},{key:"onSolve",value:function onSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onSolve:"));}return true;}},{key:"onSolveAsync",value:function onSolveAsync(fCallback){this.onSolve();return fCallback();}},{key:"solve",value:function solve(){if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," executing solve() function..."));}this.onBeforeSolve();this.onSolve();this.onAfterSolve();this.lastSolvedTimestamp=this.pict.log.getTimeStamp();return true;}},{key:"solveAsync",value:function solveAsync(fCallback){var _this39=this;var tmpAnticipate=this.pict.serviceManager.instantiateServiceProviderWithoutRegistration('Anticipate');tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this39.pict.LogNoisiness>2){_this39.log.trace("PictView [".concat(_this39.UUID,"]::[").concat(_this39.Hash,"] ").concat(_this39.options.ViewIdentifier," solveAsync() complete."));}_this39.lastSolvedTimestamp=_this39.pict.log.getTimeStamp();return fCallback(pError);});}},{key:"onAfterSolve",value:function onAfterSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterSolve:"));}return true;}},{key:"onAfterSolveAsync",value:function onAfterSolveAsync(fCallback){this.onAfterSolve();return fCallback();}},{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this40=this;if(!this.initializeTimestamp){var tmpAnticipate=this.pict.serviceManager.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>0){this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));tmpAnticipate.wait(function(pError){_this40.initializeTimestamp=_this40.pict.log.getTimeStamp();if(_this40.pict.LogNoisiness>0){_this40.log.info("PictView [".concat(_this40.UUID,"]::[").concat(_this40.Hash,"] ").concat(_this40.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?
|
|
1785
1845
|
return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}},{key:"onBeforeRender",value:function onBeforeRender(pRenderable,pRenderDestinationAddress,pData){// Overload this to mess with stuff before the content gets generated from the template
|
|
1786
1846
|
if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onBeforeRender:"));}return true;}},{key:"onBeforeRenderAsync",value:function onBeforeRenderAsync(pRenderable,pRenderDestinationAddress,pData,fCallback){this.onBeforeRender(pRenderable,pRenderDestinationAddress,pData);return fCallback();}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpDataAddress):undefined;// Execute the developer-overridable pre-render behavior
|
|
1787
1847
|
this.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);// Generate the content output from the template and data
|
|
1788
1848
|
var tmpContent=this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData);// Assign the content to the destination address
|
|
1789
1849
|
switch(tmpRenderable.RenderMethod){case'append':this.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,tmpContent);break;case'prepend':this.pict.ContentAssignment.prependContent(tmpRenderDestinationAddress,tmpContent);break;case'append_once':// Try to find the content in the destination address
|
|
1790
1850
|
var tmpExistingContent=this.pict.ContentAssignment.getElement("#".concat(tmpRenderableHash));if(tmpExistingContent.length<1){this.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,tmpContent);}case'replace':default:this.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);break;}// Execute the developer-overridable post-render behavior
|
|
1791
|
-
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var
|
|
1851
|
+
this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,tmpContent);this.lastRenderedTimestamp=this.pict.log.getTimeStamp();}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this41=this;var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable.")));}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return fCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpDataAddress):undefined;// Execute the developer-overridable pre-render behavior
|
|
1792
1852
|
this.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpData);// Render the template (asynchronously)
|
|
1793
|
-
this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){
|
|
1794
|
-
switch(tmpRenderable.RenderMethod){case'append':
|
|
1795
|
-
var tmpExistingContent=
|
|
1796
|
-
|
|
1853
|
+
this.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this41.log.error("PictView [".concat(_this41.UUID,"]::[").concat(_this41.Hash,"] ").concat(_this41.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it did not parse the template."),pError);return fCallback(pError);}// Assign the content to the destination address
|
|
1854
|
+
switch(tmpRenderable.RenderMethod){case'append':_this41.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,pContent);break;case'prepend':_this41.pict.ContentAssignment.prependContent(tmpRenderDestinationAddress,pContent);break;case'append_once':// Try to find the content in the destination address
|
|
1855
|
+
var tmpExistingContent=_this41.pict.ContentAssignment.getElement("#".concat(tmpRenderableHash));if(tmpExistingContent.length<1){_this41.pict.ContentAssignment.appendContent(tmpRenderDestinationAddress,pContent);}case'replace':default:_this41.pict.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);break;}// Execute the developer-overridable post-render behavior
|
|
1856
|
+
_this41.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,pContent);_this41.lastRenderedTimestamp=_this41.pict.log.getTimeStamp();return fCallback(null,pContent);});}},{key:"onAfterRender",value:function onAfterRender(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterRender:"));}return true;}},{key:"onAfterRenderAsync",value:function onAfterRenderAsync(fCallback){this.onAfterRender();return fCallback();}}]);return PictView;}(libFableServiceBase);module.exports=PictView;},{"fable-serviceproviderbase":33}],75:[function(require,module,exports){/**
|
|
1797
1857
|
* Precedent Meta-Templating
|
|
1798
1858
|
*
|
|
1799
1859
|
* @license MIT
|
|
@@ -1816,7 +1876,7 @@ _this40.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,pContent
|
|
|
1816
1876
|
* @param {string} pString - The string to parse
|
|
1817
1877
|
* @param {object} pData - Data to pass in as the second argument
|
|
1818
1878
|
* @return {string} The result from the parser
|
|
1819
|
-
*/},{key:"parseString",value:function parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}]);return Precedent;}();module.exports=Precedent;},{"./StringParser.js":
|
|
1879
|
+
*/},{key:"parseString",value:function parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}]);return Precedent;}();module.exports=Precedent;},{"./StringParser.js":76,"./WordTree.js":77}],76:[function(require,module,exports){/**
|
|
1820
1880
|
* String Parser
|
|
1821
1881
|
* @author Steven Velozo <steven@velozo.com>
|
|
1822
1882
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
@@ -1828,16 +1888,7 @@ _this40.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpData,pContent
|
|
|
1828
1888
|
* @param {Object} pParseTree - A node on the parse tree to begin parsing from (usually root)
|
|
1829
1889
|
* @return {Object} A new parser state object for running a character parser on
|
|
1830
1890
|
* @private
|
|
1831
|
-
*/_createClass2(StringParser,[{key:"newParserState",value:function newParserState(pParseTree){return{ParseTree:pParseTree,Asynchronous:false,Output:'',OutputBuffer:'',Pattern:
|
|
1832
|
-
* Assign a node of the parser tree to be the next potential match.
|
|
1833
|
-
* If the node has a PatternEnd property, it is a valid match and supercedes the last valid match (or becomes the initial match).
|
|
1834
|
-
* @method assignNode
|
|
1835
|
-
* @param {Object} pNode - A node on the parse tree to assign
|
|
1836
|
-
* @param {Object} pParserState - The state object for the current parsing task
|
|
1837
|
-
* @private
|
|
1838
|
-
*/},{key:"assignNode",value:function assignNode(pNode,pParserState){pParserState.PatternMatch=pNode;// If the pattern has a END we can assume it has a parse function...
|
|
1839
|
-
if(pParserState.PatternMatch.hasOwnProperty('PatternEnd')){// ... this is the legitimate start of a pattern.
|
|
1840
|
-
pParserState.Pattern=pParserState.PatternMatch;}}/**
|
|
1891
|
+
*/_createClass2(StringParser,[{key:"newParserState",value:function newParserState(pParseTree){return{ParseTree:pParseTree,Asynchronous:false,Output:'',OutputBuffer:'',Pattern:{},PatternMatch:false,PatternMatchEnd:false};}/**
|
|
1841
1892
|
* Append a character to the output buffer in the parser state.
|
|
1842
1893
|
* This output buffer is used when a potential match is being explored, or a match is being explored.
|
|
1843
1894
|
* @method appendOutputBuffer
|
|
@@ -1849,35 +1900,36 @@ pParserState.Pattern=pParserState.PatternMatch;}}/**
|
|
|
1849
1900
|
* @method flushOutputBuffer
|
|
1850
1901
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
1851
1902
|
* @private
|
|
1852
|
-
*/},{key:"flushOutputBuffer",value:function flushOutputBuffer(pParserState){pParserState.Output+=pParserState.OutputBuffer;pParserState.OutputBuffer='';}
|
|
1853
|
-
* Check if the pattern has ended. If it has, properly flush the buffer and start looking for new patterns.
|
|
1854
|
-
* @method checkPatternEnd
|
|
1855
|
-
* @param {Object} pParserState - The state object for the current parsing task
|
|
1856
|
-
* @private
|
|
1857
|
-
*/},{key:"checkPatternEnd",value:function checkPatternEnd(pParserState,pData){if(pParserState.OutputBuffer.length>=pParserState.Pattern.PatternEnd.length+pParserState.Pattern.PatternStart.length&&pParserState.OutputBuffer.substr(-pParserState.Pattern.PatternEnd.length)===pParserState.Pattern.PatternEnd){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
1858
|
-
// Trim the start and end tags off the output buffer now
|
|
1859
|
-
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStart.length+pParserState.Pattern.PatternEnd.length)),pData);// Flush the output buffer.
|
|
1903
|
+
*/},{key:"flushOutputBuffer",value:function flushOutputBuffer(pParserState){pParserState.Output+=pParserState.OutputBuffer;pParserState.OutputBuffer='';}},{key:"resetOutputBuffer",value:function resetOutputBuffer(pParserState){// Flush the output buffer.
|
|
1860
1904
|
this.flushOutputBuffer(pParserState);// End pattern mode
|
|
1861
|
-
pParserState.Pattern=false;pParserState.PatternMatch=false;}
|
|
1905
|
+
pParserState.Pattern=false;pParserState.PatternStartNode=false;pParserState.StartPatternMatchComplete=false;pParserState.EndPatternMatchBegan=false;pParserState.PatternMatch=false;return true;}/**
|
|
1862
1906
|
* Parse a character in the buffer.
|
|
1863
1907
|
* @method parseCharacter
|
|
1864
1908
|
* @param {string} pCharacter - The character to append
|
|
1865
1909
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
1866
1910
|
* @private
|
|
1867
|
-
*/},{key:"parseCharacter",value:function parseCharacter(pCharacter,pParserState,pData){//
|
|
1868
|
-
if(
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
else{pParserState.
|
|
1911
|
+
*/},{key:"parseCharacter",value:function parseCharacter(pCharacter,pParserState,pData){// If we are already in a pattern match traversal
|
|
1912
|
+
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
1913
|
+
if(!pParserState.StartPatternMatchComplete&&pParserState.Pattern.hasOwnProperty(pCharacter)){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
1914
|
+
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
1915
|
+
this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
|
|
1916
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){// Run the function
|
|
1917
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);return this.resetOutputBuffer(pParserState);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
1918
|
+
pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if(pParserState.Pattern.hasOwnProperty('PatternEnd')){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This is the first character of the end pattern.
|
|
1919
|
+
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
1920
|
+
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
|
|
1921
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){// Run the t*mplate function
|
|
1922
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);return this.resetOutputBuffer(pParserState);}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
1923
|
+
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)....
|
|
1924
|
+
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
1925
|
+
if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
|
|
1926
|
+
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}/**
|
|
1875
1927
|
* Parse a string for matches, and process any template segments that occur.
|
|
1876
1928
|
* @method parseString
|
|
1877
1929
|
* @param {string} pString - The string to parse.
|
|
1878
1930
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
1879
1931
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
1880
|
-
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}]);return StringParser;}();module.exports=StringParser;},{}],
|
|
1932
|
+
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}]);return StringParser;}();module.exports=StringParser;},{}],77:[function(require,module,exports){/**
|
|
1881
1933
|
* Word Tree
|
|
1882
1934
|
* @author Steven Velozo <steven@velozo.com>
|
|
1883
1935
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -1888,17 +1940,23 @@ else{pParserState.Output+=pCharacter;}}/**
|
|
|
1888
1940
|
* @method addChild
|
|
1889
1941
|
* @param {Object} pTree - A parse tree to push the characters into
|
|
1890
1942
|
* @param {string} pPattern - The string to add to the tree
|
|
1891
|
-
* @param {number} pIndex - The index of the character in the pattern
|
|
1892
1943
|
* @returns {Object} The resulting leaf node that was added (or found)
|
|
1893
1944
|
* @private
|
|
1894
|
-
*/_createClass2(WordTree,[{key:"addChild",value:function addChild(pTree,pPattern
|
|
1945
|
+
*/_createClass2(WordTree,[{key:"addChild",value:function addChild(pTree,pPattern){if(!pTree.hasOwnProperty(pPattern)){pTree[pPattern]={};}return pTree[pPattern];}/**
|
|
1946
|
+
* Add a child character to a Parse Tree PatternEnd subtree
|
|
1947
|
+
* @method addChild
|
|
1948
|
+
* @param {Object} pTree - A parse tree to push the characters into
|
|
1949
|
+
* @param {string} pPattern - The string to add to the tree
|
|
1950
|
+
* @returns {Object} The resulting leaf node that was added (or found)
|
|
1951
|
+
* @private
|
|
1952
|
+
*/},{key:"addEndChild",value:function addEndChild(pTree,pPattern){if(!pTree.hasOwnProperty('PatternEnd')){pTree.PatternEnd={};}pTree.PatternEnd[pPattern]={};return pTree.PatternEnd[pPattern];}/** Add a Pattern to the Parse Tree
|
|
1895
1953
|
* @method addPattern
|
|
1896
1954
|
* @param {Object} pPatternStart - The starting string for the pattern (e.g. "${")
|
|
1897
1955
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
1898
|
-
* @param {
|
|
1956
|
+
* @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.
|
|
1899
1957
|
* @return {bool} True if adding the pattern was successful
|
|
1900
|
-
*/},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,
|
|
1901
|
-
for(var i=0;i<pPatternStart.length;i++)tmpLeaf=this.addChild(tmpLeaf,pPatternStart,i);tmpLeaf.
|
|
1958
|
+
*/},{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
|
|
1959
|
+
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 _i18=0;_i18<tmpPatternEnd.length;_i18++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[_i18],_i18);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?function(){return fParser;}:function(pData){return pData;};return true;}}]);return WordTree;}();module.exports=WordTree;},{}],78:[function(require,module,exports){// shim for using process in browser
|
|
1902
1960
|
var process=module.exports={};// cached from whatever global is present so that test runners that stub it
|
|
1903
1961
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
1904
1962
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
@@ -1916,7 +1974,7 @@ return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when
|
|
|
1916
1974
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
1917
1975
|
return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}queueIndex=-1;len=queue.length;}currentQueue=null;draining=false;runClearTimeout(timeout);}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};// v8 likes predictible objects
|
|
1918
1976
|
function Item(fun,array){this.fun=fun;this.array=array;}Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';// empty string to avoid regexp issues
|
|
1919
|
-
process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],
|
|
1977
|
+
process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],79:[function(require,module,exports){(function(global){(function(){/*! https://mths.be/punycode v1.4.1 by @mathias */;(function(root){/** Detect free variables */var freeExports=_typeof(exports)=='object'&&exports&&!exports.nodeType&&exports;var freeModule=_typeof(module)=='object'&&module&&!module.nodeType&&module;var freeGlobal=_typeof(global)=='object'&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal;}/**
|
|
1920
1978
|
* The `punycode` object.
|
|
1921
1979
|
* @name punycode
|
|
1922
1980
|
* @type Object
|
|
@@ -2071,7 +2129,7 @@ for/* no condition */(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:
|
|
|
2071
2129
|
if(typeof define=='function'&&_typeof(define.amd)=='object'&&define.amd){define('punycode',function(){return punycode;});}else if(freeExports&&freeModule){if(module.exports==freeExports){// in Node.js, io.js, or RingoJS v0.8.0+
|
|
2072
2130
|
freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
|
|
2073
2131
|
for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
|
|
2074
|
-
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
2132
|
+
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],80:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2075
2133
|
//
|
|
2076
2134
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2077
2135
|
// copy of this software and associated documentation files (the
|
|
@@ -2095,7 +2153,7 @@ root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="und
|
|
|
2095
2153
|
// obj.hasOwnProperty(prop) will break.
|
|
2096
2154
|
// See: https://github.com/joyent/node/issues/1707
|
|
2097
2155
|
function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}module.exports=function(qs,sep,eq,options){sep=sep||'&';eq=eq||'=';var obj={};if(typeof qs!=='string'||qs.length===0){return obj;}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1000;if(options&&typeof options.maxKeys==='number'){maxKeys=options.maxKeys;}var len=qs.length;// maxKeys <= 0 means that we should not limit keys count
|
|
2098
|
-
if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],
|
|
2156
|
+
if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],81:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2099
2157
|
//
|
|
2100
2158
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2101
2159
|
// copy of this software and associated documentation files (the
|
|
@@ -2115,10 +2173,10 @@ if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].repla
|
|
|
2115
2173
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
2116
2174
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
2117
2175
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
2118
|
-
'use strict';var stringifyPrimitive=function stringifyPrimitive(v){switch(_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(_typeof(obj)==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],
|
|
2176
|
+
'use strict';var stringifyPrimitive=function stringifyPrimitive(v){switch(_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(_typeof(obj)==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],82:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":80,"./encode":81}],83:[function(require,module,exports){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ /* eslint-disable node/no-deprecated-api */var buffer=require('buffer');var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers
|
|
2119
2177
|
function copyProps(src,dst){for(var key in src){dst[key]=src[key];}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer;}else{// Copy properties from require('buffer')
|
|
2120
2178
|
copyProps(buffer,exports);exports.Buffer=SafeBuffer;}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length);}SafeBuffer.prototype=Object.create(Buffer.prototype);// Copy static methods from Buffer
|
|
2121
|
-
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":19}],
|
|
2179
|
+
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":19}],84:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19}],85:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;var concat=require('simple-concat');var decompressResponse=require('decompress-response');// excluded from browser build
|
|
2122
2180
|
var http=require('http');var https=require('https');var once=require('once');var querystring=require('querystring');var url=require('url');var isStream=function isStream(o){return o!==null&&_typeof(o)==='object'&&typeof o.pipe==='function';};function simpleGet(opts,cb){opts=Object.assign({maxRedirects:10},typeof opts==='string'?{url:opts}:opts);cb=once(cb);if(opts.url){var _url$parse=url.parse(opts.url),hostname=_url$parse.hostname,port=_url$parse.port,_protocol=_url$parse.protocol,auth=_url$parse.auth,path=_url$parse.path;// eslint-disable-line node/no-deprecated-api
|
|
2123
2181
|
delete opts.url;if(!hostname&&!port&&!_protocol&&!auth)opts.path=path;// Relative redirect
|
|
2124
2182
|
else Object.assign(opts,{hostname:hostname,port:port,protocol:_protocol,auth:auth,path:path});// Absolute redirect
|
|
@@ -2130,13 +2188,13 @@ res.resume();// Discard response
|
|
|
2130
2188
|
var redirectHost=url.parse(opts.url).hostname;// eslint-disable-line node/no-deprecated-api
|
|
2131
2189
|
// If redirected host is different than original host, drop headers to prevent cookie leak (#73)
|
|
2132
2190
|
if(redirectHost!==null&&redirectHost!==originalHost){delete opts.headers.cookie;delete opts.headers.authorization;}if(opts.method==='POST'&&[301,302].includes(res.statusCode)){opts.method='GET';// On 301/302 redirect, change POST to GET (see #35)
|
|
2133
|
-
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}var tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',function(){req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=function(opts,cb){return simpleGet(opts,function(err,res){if(err)return cb(err);concat(res,function(err,data){if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(function(method){simpleGet[method]=function(opts,cb){if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19,"decompress-response":17,"http":
|
|
2191
|
+
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}var tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',function(){req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=function(opts,cb){return simpleGet(opts,function(err,res){if(err)return cb(err);concat(res,function(err,data){if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(function(method){simpleGet[method]=function(opts,cb){if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19,"decompress-response":17,"http":86,"https":56,"once":71,"querystring":82,"simple-concat":84,"url":107}],86:[function(require,module,exports){(function(global){(function(){var ClientRequest=require('./lib/request');var response=require('./lib/response');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
|
|
2134
2192
|
// will result in a (valid) protocol-relative url. However, this won't work if
|
|
2135
2193
|
// the protocol is something else, like 'file:'
|
|
2136
2194
|
var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?'http:':'';var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||'/';// Necessary for IPv6 addresses
|
|
2137
2195
|
if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
|
|
2138
2196
|
opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
|
|
2139
|
-
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":
|
|
2197
|
+
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":88,"./lib/response":89,"builtin-status-codes":20,"url":107,"xtend":111}],87:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);// The xhr request to example.com may violate some restrictive CSP configurations,
|
|
2140
2198
|
// so if we're running in a browser that supports `fetch`, avoid calling getXHR()
|
|
2141
2199
|
// and assume support for certain features below.
|
|
2142
2200
|
var xhr;function getXHR(){// Cache the xhr value
|
|
@@ -2151,7 +2209,7 @@ exports.arraybuffer=exports.fetch||checkTypeSupport('arraybuffer');// These next
|
|
|
2151
2209
|
exports.msstream=!exports.fetch&&checkTypeSupport('ms-stream');exports.mozchunkedarraybuffer=!exports.fetch&&checkTypeSupport('moz-chunked-arraybuffer');// If fetch is supported, then overrideMimeType will be supported too. Skip calling
|
|
2152
2210
|
// getXHR().
|
|
2153
2211
|
exports.overrideMimeType=exports.fetch||(getXHR()?isFunction(getXHR().overrideMimeType):false);function isFunction(value){return typeof value==='function';}xhr=null;// Help gc
|
|
2154
|
-
}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
2212
|
+
}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],88:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var response=require('./response');var stream=require('readable-stream');var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return'fetch';}else if(capability.mozchunkedarraybuffer){return'moz-chunked-arraybuffer';}else if(capability.msstream){return'ms-stream';}else if(capability.arraybuffer&&preferBinary){return'arraybuffer';}else{return'text';}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader('Authorization','Basic '+Buffer.from(opts.auth).toString('base64'));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name]);});var preferBinary;var useFetch=true;if(opts.mode==='disable-fetch'||'requestTimeout'in opts&&!capability.abortController){// If the use of XHR should be preferred. Not typically needed.
|
|
2155
2213
|
useFetch=false;preferBinary=true;}else if(opts.mode==='prefer-streaming'){// If streaming is a high priority but binary compatibility and
|
|
2156
2214
|
// the accuracy of the 'content-type' header aren't
|
|
2157
2215
|
preferBinary=false;}else if(opts.mode==='allow-wrong-content-type'){// If streaming is more important than preserving the 'content-type' header
|
|
@@ -2168,7 +2226,7 @@ if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHR
|
|
|
2168
2226
|
* Even though the spec says it should be available in readyState 3,
|
|
2169
2227
|
* accessing it throws an exception in IE8
|
|
2170
2228
|
*/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
|
|
2171
|
-
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":
|
|
2229
|
+
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":87,"./response":89,"_process":78,"buffer":19,"inherits":58,"readable-stream":104}],89:[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
|
|
2172
2230
|
self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
|
|
2173
2231
|
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
|
|
2174
2232
|
}// fallback for when writableStream or pipeTo aren't available
|
|
@@ -2176,13 +2234,13 @@ var reader=response.body.getReader();read();}else{self._xhr=xhr;self._pos=0;self
|
|
|
2176
2234
|
}}};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
|
|
2177
2235
|
response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(Buffer.from(new Uint8Array(response)));break;case'ms-stream':response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader();reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength;}};reader.onload=function(){resetTimers(true);self.push(null);};// reader.onerror = ??? // TODO: this
|
|
2178
2236
|
reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
|
|
2179
|
-
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":
|
|
2237
|
+
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":87,"_process":78,"buffer":19,"inherits":58,"readable-stream":104}],90:[function(require,module,exports){'use strict';function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var codes={};function createErrorType(code,message,Base){if(!Base){Base=Error;}function getMessage(arg1,arg2,arg3){if(typeof message==='string'){return message;}else{return message(arg1,arg2,arg3);}}var NodeError=/*#__PURE__*/function(_Base){_inheritsLoose(NodeError,_Base);function NodeError(arg1,arg2,arg3){return _Base.call(this,getMessage(arg1,arg2,arg3))||this;}return NodeError;}(Base);NodeError.prototype.name=Base.name;NodeError.prototype.code=code;codes[code]=NodeError;}// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
2180
2238
|
function oneOf(expected,thing){if(Array.isArray(expected)){var len=expected.length;expected=expected.map(function(i){return String(i);});if(len>2){return"one of ".concat(thing," ").concat(expected.slice(0,len-1).join(', '),", or ")+expected[len-1];}else if(len===2){return"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]);}else{return"of ".concat(thing," ").concat(expected[0]);}}else{return"of ".concat(thing," ").concat(String(expected));}}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
2181
2239
|
function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
2182
2240
|
function endsWith(str,search,this_len){if(this_len===undefined||this_len>str.length){this_len=str.length;}return str.substring(this_len-search.length,this_len)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
2183
2241
|
function includes(str,search,start){if(typeof start!=='number'){start=0;}if(start+search.length>str.length){return false;}else{return str.indexOf(search,start)!==-1;}}createErrorType('ERR_INVALID_OPT_VALUE',function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"';},TypeError);createErrorType('ERR_INVALID_ARG_TYPE',function(name,expected,actual){// determiner: 'must be' or 'must not be'
|
|
2184
2242
|
var determiner;if(typeof expected==='string'&&startsWith(expected,'not ')){determiner='must not be';expected=expected.replace(/^not /,'');}else{determiner='must be';}var msg;if(endsWith(name,' argument')){// For cases like 'first argument'
|
|
2185
|
-
msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(_typeof(actual));return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],
|
|
2243
|
+
msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(_typeof(actual));return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],91:[function(require,module,exports){(function(process){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2186
2244
|
//
|
|
2187
2245
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2188
2246
|
// copy of this software and associated documentation files (the
|
|
@@ -2227,7 +2285,7 @@ enumerable:false,get:function get(){if(this._readableState===undefined||this._wr
|
|
|
2227
2285
|
// has not been initialized yet
|
|
2228
2286
|
if(this._readableState===undefined||this._writableState===undefined){return;}// backward compatibility, the user is explicitly
|
|
2229
2287
|
// managing destroyed
|
|
2230
|
-
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":
|
|
2288
|
+
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":93,"./_stream_writable":95,"_process":78,"inherits":58}],92:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2231
2289
|
//
|
|
2232
2290
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2233
2291
|
// copy of this software and associated documentation files (the
|
|
@@ -2250,7 +2308,7 @@ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).c
|
|
|
2250
2308
|
// a passthrough stream.
|
|
2251
2309
|
// basically just the most minimal sort of Transform stream.
|
|
2252
2310
|
// Every written chunk gets output as-is.
|
|
2253
|
-
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":
|
|
2311
|
+
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":94,"inherits":58}],93:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2254
2312
|
//
|
|
2255
2313
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2256
2314
|
// copy of this software and associated documentation files (the
|
|
@@ -2502,7 +2560,7 @@ if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=s
|
|
|
2502
2560
|
ret=state.buffer.consume(n,state.decoder);}return ret;}function endReadable(stream){var state=stream._readableState;debug('endReadable',state.endEmitted);if(!state.endEmitted){state.ended=true;process.nextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){debug('endReadableNT',state.endEmitted,state.length);// Check that we didn't get one last unshift.
|
|
2503
2561
|
if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');if(state.autoDestroy){// In case of duplex streams we need a way to detect
|
|
2504
2562
|
// if the writable side is ready for autoDestroy as well
|
|
2505
|
-
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":
|
|
2563
|
+
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":90,"./_stream_duplex":91,"./internal/streams/async_iterator":96,"./internal/streams/buffer_list":97,"./internal/streams/destroy":98,"./internal/streams/from":100,"./internal/streams/state":102,"./internal/streams/stream":103,"_process":78,"buffer":19,"events":25,"inherits":58,"string_decoder/":105,"util":17}],94:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2506
2564
|
//
|
|
2507
2565
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2508
2566
|
// copy of this software and associated documentation files (the
|
|
@@ -2588,7 +2646,7 @@ ts.needTransform=true;}};Transform.prototype._destroy=function(err,cb){Duplex.pr
|
|
|
2588
2646
|
stream.push(data);// TODO(BridgeAR): Write a test for these two error cases
|
|
2589
2647
|
// if there's nothing in the write buffer, then that means
|
|
2590
2648
|
// that nothing more will ever be provided
|
|
2591
|
-
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":
|
|
2649
|
+
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":90,"./_stream_duplex":91,"inherits":58}],95:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2592
2650
|
//
|
|
2593
2651
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2594
2652
|
// copy of this software and associated documentation files (the
|
|
@@ -2723,7 +2781,7 @@ enumerable:false,get:function get(){if(this._writableState===undefined){return f
|
|
|
2723
2781
|
// has not been initialized yet
|
|
2724
2782
|
if(!this._writableState){return;}// backward compatibility, the user is explicitly
|
|
2725
2783
|
// managing destroyed
|
|
2726
|
-
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":
|
|
2784
|
+
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":90,"./_stream_duplex":91,"./internal/streams/destroy":98,"./internal/streams/state":102,"./internal/streams/stream":103,"_process":78,"buffer":19,"inherits":58,"util-deprecate":109}],96:[function(require,module,exports){(function(process){(function(){'use strict';var _Object$setPrototypeO;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var finished=require('./end-of-stream');var kLastResolve=Symbol('lastResolve');var kLastReject=Symbol('lastReject');var kError=Symbol('error');var kEnded=Symbol('ended');var kLastPromise=Symbol('lastPromise');var kHandlePromise=Symbol('handlePromise');var kStream=Symbol('stream');function createIterResult(value,done){return{value:value,done:done};}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();// we defer if data is null
|
|
2727
2785
|
// we can be expecting either 'end' or
|
|
2728
2786
|
// 'error'
|
|
2729
2787
|
if(data!==null){iter[kLastPromise]=null;iter[kLastResolve]=null;iter[kLastReject]=null;resolve(createIterResult(data,false));}}}function onReadable(iter){// we wait for the next tick, because it might
|
|
@@ -2745,7 +2803,7 @@ var data=this[kStream].read();if(data!==null){return Promise.resolve(createIterR
|
|
|
2745
2803
|
// Readable class this is attached to
|
|
2746
2804
|
return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return;}resolve(createIterResult(undefined,true));});});}),_Object$setPrototypeO),AsyncIteratorPrototype);var createReadableStreamAsyncIterator=function createReadableStreamAsyncIterator(stream){var _Object$create;var iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:true}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:true}),_defineProperty(_Object$create,kLastReject,{value:null,writable:true}),_defineProperty(_Object$create,kError,{value:null,writable:true}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:true}),_defineProperty(_Object$create,kHandlePromise,{value:function value(resolve,reject){var data=iterator[kStream].read();if(data){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(data,false));}else{iterator[kLastResolve]=resolve;iterator[kLastReject]=reject;}},writable:true}),_Object$create));iterator[kLastPromise]=null;finished(stream,function(err){if(err&&err.code!=='ERR_STREAM_PREMATURE_CLOSE'){var reject=iterator[kLastReject];// reject if we are waiting for data in the Promise
|
|
2747
2805
|
// returned by next() and store the error
|
|
2748
|
-
if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":
|
|
2806
|
+
if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":99,"_process":78}],97:[function(require,module,exports){'use strict';function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var _require=require('buffer'),Buffer=_require.Buffer;var _require2=require('util'),inspect=_require2.inspect;var custom=inspect&&inspect.custom||'inspect';function copyBuffer(src,target,offset){Buffer.prototype.copy.call(src,target,offset);}module.exports=/*#__PURE__*/function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0;}_createClass(BufferList,[{key:"push",value:function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;}},{key:"unshift",value:function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;}},{key:"shift",value:function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0;}},{key:"join",value:function join(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next)ret+=s+p.data;return ret;}},{key:"concat",value:function concat(n){if(this.length===0)return Buffer.alloc(0);var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next;}return ret;}// Consumes a specified amount of bytes or characters from the buffered data.
|
|
2749
2807
|
},{key:"consume",value:function consume(n,hasStrings){var ret;if(n<this.head.data.length){// `slice` is the same for buffers and strings.
|
|
2750
2808
|
ret=this.head.data.slice(0,n);this.head.data=this.head.data.slice(n);}else if(n===this.head.data.length){// First chunk is a perfect match.
|
|
2751
2809
|
ret=this.shift();}else{// Result spans more than one buffer.
|
|
@@ -2754,7 +2812,7 @@ ret=hasStrings?this._getString(n):this._getBuffer(n);}return ret;}},{key:"first"
|
|
|
2754
2812
|
},{key:"_getBuffer",value:function _getBuffer(n){var ret=Buffer.allocUnsafe(n);var p=this.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)this.head=p.next;else this.head=this.tail=null;}else{this.head=p;p.data=buf.slice(nb);}break;}++c;}this.length-=c;return ret;}// Make sure the linked list only shows the minimal necessary information.
|
|
2755
2813
|
},{key:custom,value:function value(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{// Only inspect one level.
|
|
2756
2814
|
depth:0,// It should not recurse.
|
|
2757
|
-
customInspect:false}));}}]);return BufferList;}();},{"buffer":19,"util":17}],
|
|
2815
|
+
customInspect:false}));}}]);return BufferList;}();},{"buffer":19,"util":17}],98:[function(require,module,exports){(function(process){(function(){'use strict';// undocumented cb() API, needed for core, not for public API
|
|
2758
2816
|
function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err);}else if(err){if(!this._writableState){process.nextTick(emitErrorNT,this,err);}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,err);}}return this;}// we set destroyed to true before firing error callbacks in order
|
|
2759
2817
|
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
2760
2818
|
if(this._readableState){this._readableState.destroyed=true;}// if this is a duplex stream mark the writable part as destroyed as well
|
|
@@ -2763,15 +2821,15 @@ if(this._writableState){this._writableState.destroyed=true;}this._destroy(err||n
|
|
|
2763
2821
|
// For now when you opt-in to autoDestroy we allow
|
|
2764
2822
|
// the error to be emitted nextTick. In a future
|
|
2765
2823
|
// semver major update we should change the default to this.
|
|
2766
|
-
var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":
|
|
2824
|
+
var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":78}],99:[function(require,module,exports){// Ported from https://github.com/mafintosh/end-of-stream with
|
|
2767
2825
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
2768
2826
|
'use strict';var ERR_STREAM_PREMATURE_CLOSE=require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=false;return function(){if(called)return;called=true;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}callback.apply(this,args);};}function noop(){}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function eos(stream,opts,callback){if(typeof opts==='function')return eos(stream,null,opts);if(!opts)opts={};callback=once(callback||noop);var readable=opts.readable||opts.readable!==false&&stream.readable;var writable=opts.writable||opts.writable!==false&&stream.writable;var onlegacyfinish=function onlegacyfinish(){if(!stream.writable)onfinish();};var writableEnded=stream._writableState&&stream._writableState.finished;var onfinish=function onfinish(){writable=false;writableEnded=true;if(!readable)callback.call(stream);};var readableEnded=stream._readableState&&stream._readableState.endEmitted;var onend=function onend(){readable=false;readableEnded=true;if(!writable)callback.call(stream);};var onerror=function onerror(err){callback.call(stream,err);};var onclose=function onclose(){var err;if(readable&&!readableEnded){if(!stream._readableState||!stream._readableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}if(writable&&!writableEnded){if(!stream._writableState||!stream._writableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}};var onrequest=function onrequest(){stream.req.on('finish',onfinish);};if(isRequest(stream)){stream.on('complete',onfinish);stream.on('abort',onclose);if(stream.req)onrequest();else stream.on('request',onrequest);}else if(writable&&!stream._writableState){// legacy streams
|
|
2769
|
-
stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":
|
|
2827
|
+
stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":90}],100:[function(require,module,exports){module.exports=function(){throw new Error('Readable.from is not available in the browser');};},{}],101:[function(require,module,exports){// Ported from https://github.com/mafintosh/pump with
|
|
2770
2828
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
2771
2829
|
'use strict';var eos;function once(callback){var called=false;return function(){if(called)return;called=true;callback.apply(void 0,arguments);};}var _require$codes=require('../../../errors').codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){// Rethrow the error if it exists to avoid swallowing it
|
|
2772
2830
|
if(err)throw err;}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=false;stream.on('close',function(){closed=true;});if(eos===undefined)eos=require('./end-of-stream');eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=true;callback();});var destroyed=false;return function(err){if(closed)return;if(destroyed)return;destroyed=true;// request.destroy just do .end - .abort is what we want
|
|
2773
|
-
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":
|
|
2774
|
-
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":
|
|
2831
|
+
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":90,"./end-of-stream":99}],102:[function(require,module,exports){'use strict';var ERR_INVALID_OPT_VALUE=require('../../../errors').codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null;}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:'highWaterMark';throw new ERR_INVALID_OPT_VALUE(name,hwm);}return Math.floor(hwm);}// Default value
|
|
2832
|
+
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":90}],103:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":25}],104:[function(require,module,exports){exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');exports.finished=require('./lib/internal/streams/end-of-stream.js');exports.pipeline=require('./lib/internal/streams/pipeline.js');},{"./lib/_stream_duplex.js":91,"./lib/_stream_passthrough.js":92,"./lib/_stream_readable.js":93,"./lib/_stream_transform.js":94,"./lib/_stream_writable.js":95,"./lib/internal/streams/end-of-stream.js":99,"./lib/internal/streams/pipeline.js":101}],105:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2775
2833
|
//
|
|
2776
2834
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2777
2835
|
// copy of this software and associated documentation files (the
|
|
@@ -2825,13 +2883,13 @@ function utf8End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)
|
|
|
2825
2883
|
function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we
|
|
2826
2884
|
// end on a partial character, we simply let v8 handle that.
|
|
2827
2885
|
function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString('base64',i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1];}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];}return buf.toString('base64',i,buf.length-n);}function base64End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)return r+this.lastChar.toString('base64',0,3-this.lastNeed);return r;}// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
|
2828
|
-
function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":
|
|
2886
|
+
function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":83}],106:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require('process/browser.js').nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;// DOM APIs, for completeness
|
|
2829
2887
|
exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close();};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id);};// Does not start the time, just sets up the members needed.
|
|
2830
2888
|
exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout();},msecs);}};// That's not how node.js implements it but the exposed api is the same.
|
|
2831
2889
|
exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){// fn.call() is faster so we optimize for the common use-case
|
|
2832
2890
|
// @see http://jsperf.com/call-apply-segu
|
|
2833
2891
|
if(args){fn.apply(null,args);}else{fn.call(null);}// Prevent ids from leaking
|
|
2834
|
-
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":
|
|
2892
|
+
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":78,"timers":106}],107:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2835
2893
|
//
|
|
2836
2894
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2837
2895
|
// copy of this software and associated documentation files (the
|
|
@@ -2978,7 +3036,7 @@ if(psychotic){result.hostname=result.host=isAbsolute?'':srcPath.length?srcPath.s
|
|
|
2978
3036
|
//this especially happens in cases like
|
|
2979
3037
|
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
2980
3038
|
var authInHost=result.host&&result.host.indexOf('@')>0?result.host.split('@'):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift();}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift('');}if(!srcPath.length){result.pathname=null;result.path=null;}else{result.pathname=srcPath.join('/');}//to support request.http
|
|
2981
|
-
if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host)this.hostname=host;};},{"./util":
|
|
3039
|
+
if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host)this.hostname=host;};},{"./util":108,"punycode":79,"querystring":82}],108:[function(require,module,exports){'use strict';module.exports={isString:function isString(arg){return typeof arg==='string';},isObject:function isObject(arg){return _typeof(arg)==='object'&&arg!==null;},isNull:function isNull(arg){return arg===null;},isNullOrUndefined:function isNullOrUndefined(arg){return arg==null;}};},{}],109:[function(require,module,exports){(function(global){(function(){/**
|
|
2982
3040
|
* Module exports.
|
|
2983
3041
|
*/module.exports=deprecate;/**
|
|
2984
3042
|
* Mark that a method should not be used.
|
|
@@ -3003,26 +3061,26 @@ if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(resu
|
|
|
3003
3061
|
* @returns {Boolean}
|
|
3004
3062
|
* @api private
|
|
3005
3063
|
*/function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
|
3006
|
-
try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
3064
|
+
try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],110:[function(require,module,exports){// Returns a wrapper function that returns a wrapped callback
|
|
3007
3065
|
// The wrapper function should do some stuff, and return a
|
|
3008
3066
|
// presumably different callback function.
|
|
3009
3067
|
// This makes sure that own properties are retained, so that
|
|
3010
3068
|
// decorations and such are not lost along the way.
|
|
3011
|
-
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;}}},{}],
|
|
3012
|
-
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase12){_inherits(PictCSS,_libFableServiceBase12);var _super22=_createSuper(PictCSS);function PictCSS(pFable,pOptions,pServiceHash){var
|
|
3013
|
-
if(typeof
|
|
3069
|
+
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;}}},{}],111:[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;}},{}],112:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultConfiguration={// This is the address for the <script /> tag that contains the CSS.
|
|
3070
|
+
CSSElementAddress:'#PICT-CSS'};var PictCSS=/*#__PURE__*/function(_libFableServiceBase12){_inherits(PictCSS,_libFableServiceBase12);var _super22=_createSuper(PictCSS);function PictCSS(pFable,pOptions,pServiceHash){var _this42;_classCallCheck2(this,PictCSS);_this42=_super22.call(this,pFable,pOptions,pServiceHash);// No merging of options necessary
|
|
3071
|
+
if(typeof _this42.options.CSSElementAddress==='undefined'){_this42.options.CSSElementAddress=defaultConfiguration.CSSElementAddress;}_this42.inlineCSSMap={};return _this42;}// Add a CSS fragment to the CSS map (each view can have its own CSS fragment)
|
|
3014
3072
|
// Hash is shared across all views, so if 10 views all load the "My-Table-View" fragment, it will only be loaded once.
|
|
3015
|
-
_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
|
|
3016
|
-
tmpCSSHashes.sort(function(a,b){return
|
|
3017
|
-
},{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);return PictCSS;}(libFableServiceBase);module.exports=PictCSS;},{"fable":40}],
|
|
3018
|
-
|
|
3019
|
-
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3073
|
+
_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 _this43=this;var tmpCSS='';var tmpCSSHashes=Object.keys(this.inlineCSSMap);// Sort the hashes by Priority
|
|
3074
|
+
tmpCSSHashes.sort(function(a,b){return _this43.inlineCSSMap[a].Priority-_this43.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
|
|
3075
|
+
},{key:"injectCSS",value:function injectCSS(){this.services.ContentAssignment.assignContent(this.options.CSSElementAddress,this.generateCSS());}}]);return PictCSS;}(libFableServiceBase);module.exports=PictCSS;},{"fable":40}],113:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase13){_inherits(PictContentAssignment,_libFableServiceBase13);var _super23=_createSuper(PictContentAssignment);function PictContentAssignment(pFable,pOptions,pServiceHash){var _this44;_classCallCheck2(this,PictContentAssignment);_this44=_super23.call(this,pFable,pOptions,pServiceHash);_this44.serviceType='PictContentAssignment';// Check to see if we are running in a browser
|
|
3076
|
+
_this44.inBrowser=false;_this44.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this44.inBrowser=true;// Now check that the browser has a document object
|
|
3077
|
+
if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this44.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
|
|
3078
|
+
_this44.hasJquery=false;_this44.jQuery=false;if(_this44.inBrowser&&typeof window.jQuery!=='undefined'){_this44.hasJquery=true;}// API Consumers can craft their own assign function
|
|
3079
|
+
_this44.customAssignFunction=false;// API Consumers can also craft their own prepend function
|
|
3080
|
+
_this44.customPrependFunction=false;// API Consumers can also craft their own append function
|
|
3081
|
+
_this44.customAppendFunction=false;// API Consumers can also craft their own read function
|
|
3082
|
+
_this44.customReadFunction=false;// API Consumers can even craft their own get element function.
|
|
3083
|
+
_this44.customGetElementFunction=false;return _this44;}_createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return[];}else{// TODO: This isn't the most efficient method, but it is the most compatible.
|
|
3026
3084
|
var tmpElementSet=[];for(var i=0;i<tmpElements.length;i++){tmpElementSet.push(tmpElements[0]);}return tmpElementSet;}}else if(this.inBrowser&&this.hasDocument){return window.document.querySelectorAll(pAddress);}else{// Just log it out for now
|
|
3027
3085
|
this.log.trace("PICT Content GET ELEMENT for [".concat(pAddress,"] will return empty because none of the browser methods are available"));return[];}}},{key:"assignContent",value:function assignContent(pAddress,pContent){if(this.customAssignFunction){return this.customAssignFunction(pAddress,pContent);}else if(this.hasJquery){// Get the element
|
|
3028
3086
|
var tmpTargetElement=window.jQuery(pAddress);// Should we ensure we matched 1 and exactly 1 element?
|
|
@@ -3038,21 +3096,21 @@ this.log.trace("PICT Content READ from [".concat(pAddress,"]..."));return'';}}},
|
|
|
3038
3096
|
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.addClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.add(pClass);}}else{this.log.trace("PICT Content ADDCLASS to [".concat(pAddress,"]:"),pClass);}}},{key:"removeClass",value:function removeClass(pAddress,pClass){if(this.customRemoveClassFunction){return this.customRemoveClassFunction(pAddress,pClass);}else if(this.hasJquery){// Get the element
|
|
3039
3097
|
var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.removeClass(pClass);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].classList.remove(pClass);}}else{this.log.trace("PICT Content REMOVECLASS from [".concat(pAddress,"]:"),pClass);}}},{key:"toggleClass",value:function toggleClass(pAddress,pClass){// STUB
|
|
3040
3098
|
}},{key:"hasClass",value:function hasClass(pAddress,pClass){// STUB
|
|
3041
|
-
}}]);return PictContentAssignment;}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":40}],
|
|
3099
|
+
}}]);return PictContentAssignment;}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":40}],114:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase14){_inherits(PictDataProvider,_libFableServiceBase14);var _super24=_createSuper(PictDataProvider);function PictDataProvider(pFable,pOptions,pServiceHash){var _this45;_classCallCheck2(this,PictDataProvider);_this45=_super24.call(this,pFable,pOptions,pServiceHash);_this45.serviceType='PictDataProvider';return _this45;}_createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);return PictDataProvider;}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":40}],115:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase15){_inherits(PictMeadowEntityProvider,_libFableServiceBase15);var _super25=_createSuper(PictMeadowEntityProvider);function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this46;_classCallCheck2(this,PictMeadowEntityProvider);_this46=_super25.call(this,pFable,pOptions,pServiceHash);_defineProperty2(_assertThisInitialized(_this46),"getEntitySet",function(pEntity,pMeadowFilterExpression,fCallback){var _this47=this;this.initializeCache(pEntity);// TODO: Should we test for too many record IDs here by string length?
|
|
3042
3100
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
3043
3101
|
// Discard anything from the cache that has expired or is over size.
|
|
3044
|
-
this.cache[pEntity].prune(function(){var tmpCountOptions={url:"".concat(
|
|
3045
|
-
tmpDownloadURIFragments.push("".concat(
|
|
3046
|
-
|
|
3047
|
-
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});});});
|
|
3102
|
+
this.cache[pEntity].prune(function(){var tmpCountOptions={url:"".concat(_this47.options.urlPrefix).concat(pEntity,"s/Count/FilteredTo/").concat(pMeadowFilterExpression)};tmpCountOptions=_this47.prepareRequestOptions(tmpCountOptions);return _this47.restClient.getJSON(tmpCountOptions,function(pError,pResponse,pBody){if(pError){_this47.log.error("Error getting bulk entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from server [").concat(tmpCountOptions.url,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this47.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
3103
|
+
tmpDownloadURIFragments.push("".concat(_this47.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(i*tmpDownloadBatchSize,"/").concat(tmpDownloadBatchSize));}var tmpEntitySet=[];// Now run these in series (it's possible to parallelize but no reason to)
|
|
3104
|
+
_this47.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){var tmpOptions={url:"".concat(_this47.options.urlPrefix).concat(pURIFragment)};tmpOptions=_this47.prepareRequestOptions(tmpOptions);_this47.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
|
|
3105
|
+
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});});});_this46.serviceType='PictMeadowProvider';if(_this46.fable.settings.PictDefaultURLPrefix){_this46.options.urlPrefix=_this46.fable.settings.PictDefaultURLPrefix;}else if(!_this46.options.urlPrefix){_this46.options.urlPrefix='/1.0/';}if(_this46.fable.settings.PictDefaultDownloadBatchSize){_this46.options.downloadBatchSize=_this46.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this46.options.downloadBatchSize){_this46.options.downloadBatchSize=100;}_this46.restClient=_this46.fable.serviceManager.instantiateServiceProviderWithoutRegistration('RestClient');_this46.cache={};_this46.prepareRequestOptions=function(pOptions){return pOptions;};return _this46;}_createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
|
|
3048
3106
|
if(!this.cache.hasOwnProperty(pEntity)){this.cache[pEntity]=this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
|
|
3049
3107
|
// For now cache for 30 seconds.
|
|
3050
|
-
this.cache[pEntity].maxAge=30000;this.cache[pEntity].maxLength=10000;this.fable.Bundle[pEntity]=this.cache[pEntity].RecordMap;}}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){var
|
|
3051
|
-
this.cache[pEntity].prune(function(){var tmpPossibleRecord=
|
|
3108
|
+
this.cache[pEntity].maxAge=30000;this.cache[pEntity].maxLength=10000;this.fable.Bundle[pEntity]=this.cache[pEntity].RecordMap;}}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){var _this48=this;this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
3109
|
+
this.cache[pEntity].prune(function(){var tmpPossibleRecord=_this48.cache[pEntity].read(pIDRecord);if(tmpPossibleRecord){return tmpPossibleRecord;}var tmpOptions={url:"".concat(_this48.options.urlPrefix).concat(pEntity,"/").concat(pIDRecord)};tmpOptions=_this48.prepareRequestOptions(tmpOptions);return _this48.restClient.getJSON(tmpOptions,function(pError,pResponse,pBody){if(pBody){_this48.cache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});});}}]);return PictMeadowEntityProvider;}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":40}],116:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase16){_inherits(PictTemplateProvider,_libFableServiceBase16);var _super26=_createSuper(PictTemplateProvider);function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this49;_classCallCheck2(this,PictTemplateProvider);_this49=_super26.call(this,pFable,pOptions,pServiceHash);_this49.serviceType='PictTemplateProvider';_this49.templates={};_this49.templateSources={};// Default templates are stored by prefix.
|
|
3052
3110
|
// The longest prefix match is used.
|
|
3053
3111
|
// Case sensitive.
|
|
3054
|
-
|
|
3055
|
-
|
|
3112
|
+
_this49.defaultTemplates=[];// This function can be overloaded to load templates from a database, in a page or other source.
|
|
3113
|
+
_this49.loadTemplateFunction=function(pTemplateHash){return false;};return _this49;}_createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}},{key:"addDefaultTemplate",value:function addDefaultTemplate(pPrefix,pPostfix,pTemplate,pSource){var tmpSource=typeof pSource=='string'?pSource:"Direct addDefaultTemplate('".concat(pPrefix,"','").concat(pPostfix,"',..) function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");var tmpDefaultTemplate={prefix:pPrefix,postfix:pPostfix,template:pTemplate,source:tmpSource};if(typeof pTemplate!='string'){this.log.error('PictTemplateProvider.addDefaultTemplate: pTemplate is not a string.');}this.defaultTemplates.push(tmpDefaultTemplate);}},{key:"checkDefaultTemplateHash",value:function checkDefaultTemplateHash(pTemplateHash){/*
|
|
3056
3114
|
* Default templates are managed by postfix and prefix. The use case is things like titles, headers, list
|
|
3057
3115
|
* wrappers, rows, etc.
|
|
3058
3116
|
*
|
|
@@ -3064,13 +3122,13 @@ _this48.loadTemplateFunction=function(pTemplateHash){return false;};return _this
|
|
|
3064
3122
|
*/for(var i=0;i<this.defaultTemplates.length;i++){if(pTemplateHash.indexOf(this.defaultTemplates[i].postfix)==pTemplateHash.length-this.defaultTemplates[i].postfix.length&&pTemplateHash.indexOf(this.defaultTemplates[i].prefix)==0){this.templates[pTemplateHash]=this.defaultTemplates[i].template;this.templateSources[pTemplateHash]="Auto created in checkDefaultTemplateHash('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(this.defaultTemplates[i].prefix,"]...[").concat(this.defaultTemplates[i].postfix,"]");return this.templates[pTemplateHash];}}return false;}},{key:"getTemplate",value:function getTemplate(pTemplateHash){// TODO: Optimize this.
|
|
3065
3123
|
// If the template doesn't exist, try to load it with the loading function
|
|
3066
3124
|
if(!this.templates.hasOwnProperty(pTemplateHash)){this.loadTemplate(pTemplateHash);}// If the loading function fails, try to load it from the default templates
|
|
3067
|
-
if(!this.templates.hasOwnProperty(pTemplateHash)){this.checkDefaultTemplateHash(pTemplateHash);}if(this.templates.hasOwnProperty(pTemplateHash)){return this.templates[pTemplateHash];}else{return false;}}},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);return PictTemplateProvider;}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":40}],
|
|
3125
|
+
if(!this.templates.hasOwnProperty(pTemplateHash)){this.checkDefaultTemplateHash(pTemplateHash);}if(this.templates.hasOwnProperty(pTemplateHash)){return this.templates[pTemplateHash];}else{return false;}}},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);return PictTemplateProvider;}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":40}],117:[function(require,module,exports){/**
|
|
3068
3126
|
* @author <steven@velozo.com>
|
|
3069
|
-
*/var libFable=require('fable');var Pict=/*#__PURE__*/function(_libFable){_inherits(Pict,_libFable);var _super27=_createSuper(Pict);function Pict(pSettings){var
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
if(
|
|
3073
|
-
|
|
3127
|
+
*/var libFable=require('fable');var Pict=/*#__PURE__*/function(_libFable){_inherits(Pict,_libFable);var _super27=_createSuper(Pict);function Pict(pSettings){var _this50;_classCallCheck2(this,Pict);_this50=_super27.call(this,pSettings);_this50.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");// The templateProvider provides a basic key->template mapping with default fallback capabilities
|
|
3128
|
+
_this50.serviceManager.addAndInstantiateServiceType('TemplateProvider',require('./Pict-Template-Provider.js'));_this50.serviceManager.addAndInstantiateServiceType('EntityProvider',require('./Pict-Meadow-EntityProvider.js'));_this50.serviceManager.addAndInstantiateServiceType('DataProvider',require('./Pict-DataProvider.js'));_this50.serviceManager.addAndInstantiateServiceType('ContentAssignment',require('./Pict-Content-Assignment.js'));_this50.serviceManager.addAndInstantiateServiceType('CSSMap',require('./Pict-CSS.js'));_this50.serviceManager.instantiateServiceProvider('MetaTemplate');_this50.serviceManager.instantiateServiceProvider('DataGeneration');_this50.manifest=_this50.serviceManager.instantiateServiceProvider('Manifest');_this50.AppData={};_this50.Bundle={};// Log noisness goes from 0 - 5, where 5 is show me everything.
|
|
3129
|
+
_this50.LogNoisiness=0;// Load manifest sets
|
|
3130
|
+
if(_this50.settings.Manifests){_this50.loadManifestSet(_this50.settings.Manifests);}_this50._DefaultPictTemplatesInitialized=false;_this50.initializePictTemplateEngine();_this50.serviceManager.addServiceType('PictView',require('pict-view'));_this50.serviceManager.addServiceType('PictApplication',require('pict-application'));// Expose the named views directly, through a convenience accessor
|
|
3131
|
+
_this50.views=_this50.serviceManager.servicesMap.PictView;return _this50;}// Load manifests in as Hashed services
|
|
3074
3132
|
_createClass2(Pict,[{key:"loadManifestSet",value:function loadManifestSet(pManifestSet){if(_typeof(pManifestSet)!='object'){this.log.warn("PICT [".concat(this.UUID,"] could not load Manifest Set; pManifestSet was not an object."));return false;}var tmpManifestKeys=Object.keys(pManifestSet);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
3075
3133
|
var tmpManifestKey=tmpManifestKeys[i];this.serviceManager.instantiateServiceProvider('Manifest',pManifestSet[tmpManifestKey],tmpManifestKey);}}}// Just passing an options will construct one for us.
|
|
3076
3134
|
// Passing a hash will set the hash.
|
|
@@ -3080,7 +3138,7 @@ if(pViewPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable
|
|
|
3080
3138
|
// Passing a hash will set the hash.
|
|
3081
3139
|
// Passing a prototype will use that!
|
|
3082
3140
|
},{key:"addApplication",value:function addApplication(pApplicationHash,pOptions,pApplicationPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpApplicationHash=typeof pApplicationHash=='string'?pApplicationHash:this.fable.getUUID();if(typeof pApplicationPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
|
|
3083
|
-
if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},pApplicationPrototype.default_configuration,tmpOptions);}return this.serviceManager.instantiateServiceProviderFromPrototype('PictApplication',tmpOptions,tmpApplicationHash,pApplicationPrototype);}else{return this.serviceManager.instantiateServiceProvider('PictApplication',tmpOptions,tmpApplicationHash);}}},{key:"initializePictTemplateEngine",value:function initializePictTemplateEngine(){var
|
|
3141
|
+
if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=this.fable.Utility.extend({},pApplicationPrototype.default_configuration,tmpOptions);}return this.serviceManager.instantiateServiceProviderFromPrototype('PictApplication',tmpOptions,tmpApplicationHash,pApplicationPrototype);}else{return this.serviceManager.instantiateServiceProvider('PictApplication',tmpOptions,tmpApplicationHash);}}},{key:"initializePictTemplateEngine",value:function initializePictTemplateEngine(){var _this51=this;/*
|
|
3084
3142
|
*
|
|
3085
3143
|
* To stave off madness, these are inefficient for now. The wkhtmltopdf renderer leaves much to be desired
|
|
3086
3144
|
* in the way of feedback with regards to javascript compatibility.
|
|
@@ -3092,30 +3150,30 @@ if(pApplicationPrototype.hasOwnProperty('default_configuration')){tmpOptions=thi
|
|
|
3092
3150
|
// ...meaning GET BOOK with IDBook FROM AppData.Some.Address.IDBook
|
|
3093
3151
|
// {~E:Book:AppData.Some.Address.IDBook:Render-Book-Template~}
|
|
3094
3152
|
// ...meaning GET BOOK with IDBook FROM AppData.Some.Address.IDBook and render it to Render-Book-Template
|
|
3095
|
-
var fEntityRender=function fEntityRender(pHash,pData,fCallback){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
3153
|
+
var fEntityRender=function fEntityRender(pHash,pData,fCallback){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>0){_this51.log.trace("PICT Template [fEntityRender]::[".concat(tmpHash,"]"));}var tmpEntity=false;var tmpEntityID=false;var tmpEntityTemplate=false;// This expression requires 2 parts -- a third is optional, and, if present, is the template to render to.
|
|
3096
3154
|
var tmpHashSeparator=tmpHash.indexOf('|');if(tmpHashSeparator<0){// This is just a simple 2 part hash (the entity and the ID)
|
|
3097
3155
|
var tmpHashEntitySeparator=tmpHash.indexOf(':');tmpEntity=tmpHash.substring(0,tmpHashEntitySeparator);tmpEntityID=tmpHash.substring(tmpHashEntitySeparator+1);}else{// This is a 3 part hash (the entity, the ID, and the template)
|
|
3098
3156
|
var _tmpHashEntitySeparator=tmpHash.indexOf(':');tmpEntity=tmpHash.substring(0,_tmpHashEntitySeparator);var tmpHashTemplateSeparator=tmpHash.indexOf('|');tmpEntityID=tmpHash.substring(_tmpHashEntitySeparator+1,tmpHashTemplateSeparator);tmpEntityTemplate=tmpHash.substring(tmpHashTemplateSeparator+1);}if(!isNaN(tmpEntityID)){tmpEntityID=parseInt(tmpEntityID);}else{// This is an address, so we need to get the value at the address
|
|
3099
|
-
tmpEntityID=
|
|
3100
|
-
if(!tmpEntity||!tmpEntityID){
|
|
3101
|
-
|
|
3102
|
-
if(tmpEntityTemplate){return fCallback(null,
|
|
3103
|
-
var fNotEmptyRender=function fNotEmptyRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
3157
|
+
tmpEntityID=_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpEntityID);}// No Entity or EntityID
|
|
3158
|
+
if(!tmpEntity||!tmpEntityID){_this51.log.warn("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]"));return fCallback(Error("Pict: Entity Render: Entity or entity ID not resolved for [".concat(tmpHash,"]")),'');}// Now try to get the entity
|
|
3159
|
+
_this51.EntityProvider.getEntity(tmpEntity,tmpEntityID,function(pError,pRecord){if(pError){_this51.log.error("Pict: Entity Render: Error getting entity [".concat(tmpEntity,"] with ID [").concat(tmpEntityID,"] for [").concat(tmpHash,"]: ").concat(pError),pError);return fCallback(pError,'');}// Now render the template
|
|
3160
|
+
if(tmpEntityTemplate){return fCallback(null,_this51.parseTemplateByHash(tmpEntityTemplate,pRecord));}else{return fCallback(null,'');}});};this.MetaTemplate.addPatternAsync('{~E:','~}',fEntityRender);this.MetaTemplate.addPatternAsync('{~Entity:','~}',fEntityRender);// {NE~Some.Address|If the left value is truthy, render this value.~}
|
|
3161
|
+
var fNotEmptyRender=function fNotEmptyRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>2){_this51.log.trace("PICT Template [fNotEmptyRender]::[".concat(tmpHash,"]"));}// Should switch this to indexOf so pipes can be in the content.
|
|
3104
3162
|
var tmpHashParts=tmpHash.split('|');// For now just check truthiness
|
|
3105
|
-
if(
|
|
3106
|
-
var fTemplateRender=function fTemplateRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
3163
|
+
if(_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpHashParts[0])){return tmpHashParts[1];}else{return'';}};this.MetaTemplate.addPattern('{~NotEmpty:','~}',fNotEmptyRender);this.MetaTemplate.addPattern('{~NE:','~}',fNotEmptyRender);// {~T:Template:AddressOfData~}
|
|
3164
|
+
var fTemplateRender=function fTemplateRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>0){_this51.log.trace("PICT Template [fTemplateRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
|
|
3107
3165
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
3108
|
-
if(!tmpTemplateHash){
|
|
3109
|
-
return
|
|
3110
|
-
var fTemplateSetRender=function fTemplateSetRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
3166
|
+
if(!tmpTemplateHash){_this51.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
3167
|
+
return _this51.parseTemplateByHash(tmpTemplateHash,pData);}else{return _this51.parseTemplateByHash(tmpTemplateHash,_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpAddressOfData));}};this.MetaTemplate.addPattern('{~T:','~}',fTemplateRender);this.MetaTemplate.addPattern('{~Template:','~}',fTemplateRender);// {~TS:Template:AddressOfDataSet~}
|
|
3168
|
+
var fTemplateSetRender=function fTemplateSetRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>0){_this51.log.trace("PICT Template [fTemplateSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash=false;var tmpAddressOfData=false;// This is just a simple 2 part hash (the entity and the ID)
|
|
3111
3169
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
3112
|
-
if(!tmpTemplateHash){
|
|
3113
|
-
return
|
|
3114
|
-
var fDataRender=function fDataRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(
|
|
3115
|
-
if(!tmpTemplateString){return'';}return this.parseTemplate(tmpTemplateString,pData,fCallback);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback){var
|
|
3116
|
-
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return
|
|
3170
|
+
if(!tmpTemplateHash){_this51.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return"Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]");}if(!tmpAddressOfData){// No address was provided, just render the template with what this template has.
|
|
3171
|
+
return _this51.parseTemplateSetByHash(tmpTemplateHash,pData);}else{return _this51.parseTemplateSetByHash(tmpTemplateHash,_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpAddressOfData));}};this.MetaTemplate.addPattern('{~TS:','~}',fTemplateSetRender);this.MetaTemplate.addPattern('{~TemplateSet:','~}',fTemplateSetRender);//{~Data:AppData.Some.Value.to.Render~}
|
|
3172
|
+
var fDataRender=function fDataRender(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>3){_this51.log.trace("PICT Template [fDataRender]::[".concat(tmpHash,"]"));}var tmpValue=_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpHash);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return tmpValue;};this.MetaTemplate.addPattern('{~D:','~}',fDataRender);this.MetaTemplate.addPattern('{~Data:','~}',fDataRender);this.MetaTemplate.addPattern('{~Dollars:','~}',function(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>3){_this51.log.trace("PICT Template [fDollars]::[".concat(tmpHash,"]"));}var tmpColumnData=_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpHash);return _this51.DataFormat.formatterDollars(tmpColumnData);});this.MetaTemplate.addPattern('{~Digits:','~}',function(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>3){_this51.log.trace("PICT Template [fDigits]::[".concat(tmpHash,"]"));}var tmpColumnData=_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpHash);return _this51.DataFormat.formatterAddCommasToNumber(_this51.DataFormat.formatterRoundNumber(tmpColumnData,2));});var fRandomNumberString=function fRandomNumberString(pHash,pData){var tmpHash=pHash.trim();if(_this51.LogNoisiness>3){_this51.log.trace("PICT Template [fRandomNumberString]::[".concat(tmpHash,"]"));}var tmpStringLength=4;var tmpMaxNumber=9999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){tmpStringLength=parseInt(tmpHashParts[0]);}if(tmpHashParts.length>1){tmpMaxNumber=parseInt(tmpHashParts[1]);}}return _this51.DataGeneration.randomNumericString(tmpStringLength,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumberString:','~}',fRandomNumberString);this.MetaTemplate.addPattern('{~RNS:','~}',fRandomNumberString);var fRandomNumber=function fRandomNumber(pHash,pData){var tmpHash=pHash.trim();if(_this51.LogNoisiness>3){_this51.log.trace("PICT Template [fRandomNumber]::[".concat(tmpHash,"]"));}var tmpMinimumNumber=0;var tmpMaxNumber=9999999;if(tmpHash.length>0){var tmpHashParts=tmpHash.split(',');if(tmpHashParts.length>0){tmpMinimumNumber=parseInt(tmpHashParts[0]);}if(tmpHashParts.length>1){tmpMaxNumber=parseInt(tmpHashParts[1]);}}return _this51.DataGeneration.randomIntegerBetween(tmpMinimumNumber,tmpMaxNumber);};this.MetaTemplate.addPattern('{~RandomNumber:','~}',fRandomNumber);this.MetaTemplate.addPattern('{~RN:','~}',fRandomNumber);var fPascalCaseIdentifier=function fPascalCaseIdentifier(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};if(_this51.LogNoisiness>4){_this51.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(_this51.LogNoisiness>3){_this51.log.trace("PICT Template [fPascalCaseIdentifier]::[".concat(tmpHash,"]"));}var tmpValue=_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpHash);if(tmpValue==null||tmpValue=='undefined'||typeof tmpValue=='undefined'){return'';}return _this51.DataFormat.cleanNonAlphaCharacters(_this51.DataFormat.capitalizeEachWord(tmpValue));};this.MetaTemplate.addPattern('{~PascalCaseIdentifier:','~}',fPascalCaseIdentifier);var fLogValue=function fLogValue(pHash,pData){var tmpHash=pHash.trim();var tmpData=_typeof(pData)==='object'?pData:{};var tmpValue=_this51.manifest.getValueByHash({AppData:_this51.AppData,Bundle:_this51.Bundle,Record:tmpData},tmpHash);var tmpValueType=_typeof(tmpValue);if(tmpValue==null||tmpValueType=='undefined'){_this51.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is ").concat(tmpValueType,"."));}else if(tmpValueType=='object'){_this51.log.trace("PICT Template Log Value: [".concat(tmpHash,"] is an obect."),tmpValue);}else{_this51.log.trace("PICT Template Log Value: [".concat(tmpHash,"] if a ").concat(tmpValueType," = [").concat(tmpValue,"]"));}return'';};this.MetaTemplate.addPattern('{~LogValue:','~}',fLogValue);this.MetaTemplate.addPattern('{~LV:','~}',fLogValue);var fLogStatement=function fLogStatement(pHash,pData){var tmpHash=pHash.trim();_this51.log.trace("PICT Template Log Message: ".concat(tmpHash));return'';};this.MetaTemplate.addPattern('{~LogStatement:','~}',fLogStatement);this.MetaTemplate.addPattern('{~LS:','~}',fLogStatement);var fBreakpoint=function fBreakpoint(pHash,pData){var tmpHash=pHash.trim();var tmpError=new Error("PICT Template Breakpoint: ".concat(tmpHash));_this51.log.trace("PICT Template Breakpoint: ".concat(tmpHash),tmpError.stack);debugger;return'';};this.MetaTemplate.addPattern('{~Breakpoint','~}',fBreakpoint);this._DefaultPictTemplatesInitialized=true;}}},{key:"parseTemplate",value:function parseTemplate(pTemplateString,pData,fCallback){var tmpData=_typeof(pData)==='object'?pData:{};return this.MetaTemplate.parseString(pTemplateString,tmpData,fCallback);}},{key:"parseTemplateByHash",value:function parseTemplateByHash(pTemplateHash,pData,fCallback){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
|
|
3173
|
+
if(!tmpTemplateString){return'';}return this.parseTemplate(tmpTemplateString,pData,fCallback);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback){var _this52=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
3174
|
+
var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this52.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error('Pict: Template Set: pDataSet is not an array or object.'),'');}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i]);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i19=0;_i19<tmpKeys.length;_i19++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i19]]);}}return tmpValue;}else{return'';}}}},{key:"parseTemplateSetByHash",value:function parseTemplateSetByHash(pTemplateHash,pDataSet,fCallback){var tmpTemplateString=this.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
|
|
3117
3175
|
if(!tmpTemplateString){return'';}return this.parseTemplateSet(tmpTemplateString,pDataSet,fCallback);}}]);return Pict;}(libFable);;module.exports=Pict;module.exports.PictApplicationClass=require('pict-application');module.exports.PictViewClass=require('pict-view');module.exports.EnvironmentLog=require('./environments/Pict-Environment-Log.js');// This is to help understand the type of enivironement we're executing in
|
|
3118
|
-
module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");},{"./Pict-CSS.js":
|
|
3176
|
+
module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");},{"./Pict-CSS.js":112,"./Pict-Content-Assignment.js":113,"./Pict-DataProvider.js":114,"./Pict-Meadow-EntityProvider.js":115,"./Pict-Template-Provider.js":116,"./environments/Pict-Environment-Log.js":118,"fable":40,"pict-application":73,"pict-view":74}],118:[function(require,module,exports){/**
|
|
3119
3177
|
* Pict browser shim loader
|
|
3120
3178
|
* @author <steven@velozo.com>
|
|
3121
3179
|
*
|
|
@@ -3140,4 +3198,4 @@ module.exports.isBrowser=new Function("try {return (this===window);} catch(pErro
|
|
|
3140
3198
|
*/var PictEnvironmentLog=/*#__PURE__*/function(){function PictEnvironmentLog(pPict,pContentMap){_classCallCheck2(this,PictEnvironmentLog);this.contentMap=_typeof(pContentMap)=='object'?pContentMap:{};this.pict=pPict;// If this is set to false, we won't keep an array-based log of every read, assignment, append or get.
|
|
3141
3199
|
this.truncateContentLength=256;this.storeEventLog=true;// Where to store each event type
|
|
3142
3200
|
this.eventLog={};this.eventLog.GetElement=[];this.eventLog.Read=[];this.eventLog.Prepend=[];this.eventLog.Append=[];this.eventLog.Assign=[];this.pict.ContentAssignment.customGetElementFunction=this.customGetElementFunction.bind(this);this.pict.ContentAssignment.customReadFunction=this.customReadFunction.bind(this);this.pict.ContentAssignment.customAppendFunction=this.customAppendFunction.bind(this);this.pict.ContentAssignment.customPrependFunction=this.customPrependFunction.bind(this);this.pict.ContentAssignment.customAssignFunction=this.customAssignFunction.bind(this);}_createClass2(PictEnvironmentLog,[{key:"createEventLogEntry",value:function createEventLogEntry(pAddress,pContent){var tmpContent=typeof pContent=='undefined'?'':pContent;return{TimeStamp:this.pict.log.getTimeStamp(),Hash:pAddress,Content:tmpContent};}},{key:"customGetElementFunction",value:function customGetElementFunction(pAddress){if(this.storeEventLog)this.eventLog.GetElement.push(this.createEventLogEntry(pAddress));this.pict.log.info("Mocking an GET of Address -> [".concat(pAddress,"]"));return'';}},{key:"customReadFunction",value:function customReadFunction(pAddress){if(this.storeEventLog)this.eventLog.Read.push(this.createEventLogEntry(pAddress));this.pict.log.info("Mocking an READ from Address -> [".concat(pAddress,"]"));if(this.contentMap.hasOwnProperty(pAddress)){// The data is in the content map!
|
|
3143
|
-
return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".concat(pAddress," did not find a value in the content map."));return'';}},{key:"customAppendFunction",value:function customAppendFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customPrependFunction",value:function customPrependFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customAssignFunction",value:function customAssignFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}}]);return PictEnvironmentLog;}();module.exports=PictEnvironmentLog;},{}]},{},[
|
|
3201
|
+
return this.contentMap[pAddress];}this.pict.log.warn("Mock read from Address ".concat(pAddress," did not find a value in the content map."));return'';}},{key:"customAppendFunction",value:function customAppendFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Append.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an APPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customPrependFunction",value:function customPrependFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Prepend.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an PREPEND to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}},{key:"customAssignFunction",value:function customAssignFunction(pAddress,pContent){if(this.storeEventLog)this.eventLog.Assign.push(this.createEventLogEntry(pAddress,pContent));if(pContent.length>this.truncateContentLength){this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"] (log truncated to first ").concat(this.truncateContentLength," characters)"),{Content:pContent.substring(0,this.truncateContentLength)});}else{this.pict.log.info("Mocking an ASSIGN to Address -> [".concat(pAddress,"]"),{Content:pContent});}return'';}}]);return PictEnvironmentLog;}();module.exports=PictEnvironmentLog;},{}]},{},[117])(117);});
|