Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hpcc-js/util

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hpcc-js/util - npm Package Compare versions

Comparing version 0.0.41 to 0.0.42

lib-es6/debounce.d.ts

89

dist/util.js

@@ -351,2 +351,31 @@ (function (global, factory) {

function debounce(fn, timeout) {
var promise = null;
var clockStart;
return function () {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
if (promise)
return promise;
promise = fn.apply(void 0, params).then(function (response) {
if (timeout === undefined) {
promise = null;
}
else {
setTimeout(function () {
promise = null;
}, Math.max(timeout - (Date.now() - clockStart), 0));
}
return response;
}).catch(function (e) {
promise = null;
throw e;
});
clockStart = Date.now();
return promise;
};
}
var Dictionary = /** @class */ (function () {

@@ -1327,2 +1356,3 @@ function Dictionary(attrs) {

this._events = new Observable();
this._monitorTickCount = 0;
}

@@ -1335,2 +1365,3 @@ StateObject.prototype.clear = function (newVals) {

}
this._monitorTickCount = 0;
};

@@ -1431,2 +1462,59 @@ StateObject.prototype.get = function (key, defValue) {

};
// Monitoring ---
StateObject.prototype.refresh = function (full) {
if (full === void 0) { full = false; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.resolve()];
case 1:
_a.sent();
return [2 /*return*/, this];
}
});
});
};
StateObject.prototype._monitor = function () {
var _this = this;
if (this._monitorHandle) {
this._monitorTickCount = 0;
return;
}
this._monitorHandle = setTimeout(function () {
var refreshPromise = _this.hasEventListener() ? _this.refresh(true) : Promise.resolve();
refreshPromise.then(function () {
_this._monitor();
});
delete _this._monitorHandle;
}, this._monitorTimeoutDuraction());
};
StateObject.prototype._monitorTimeoutDuraction = function () {
++this._monitorTickCount;
if (this._monitorTickCount <= 1) {
return 0;
}
return 30000;
};
StateObject.prototype.watch = function (callback, triggerChange) {
var _this = this;
if (triggerChange === void 0) { triggerChange = true; }
if (typeof callback !== "function") {
throw new Error("Invalid Callback");
}
if (triggerChange) {
setTimeout(function () {
var props = _this.get();
var changes = [];
for (var key in props) {
if (props.hasOwnProperty(props)) {
changes.push({ id: key, newValue: props[key], oldValue: undefined });
}
}
callback(changes);
}, 0);
}
var retVal = this.addObserver("changed", callback);
this._monitor();
return retVal;
};
return StateObject;

@@ -1473,2 +1561,3 @@ }());

exports.AsyncCache = AsyncCache;
exports.debounce = debounce;
exports.Dictionary = Dictionary;

@@ -1475,0 +1564,0 @@ exports.espTime2Seconds = espTime2Seconds;

2

dist/util.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["@hpcc-js/util"]={})}(this,function(t){"use strict";function e(t,e){function r(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function n(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function o(t){return this instanceof o?(this.v=t,this):new o(t)}function i(t,e){for(;t.length<e;)t="0"+t;return t}function s(t,e){if(0===e.length)return t;for(var r=0;r<e.length;++r)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t<0?-2*t:t}function a(t,e,r){return Object.keys(e).sort().reduce(function(t,n){return u(t,e[n],n,r)},t)}function u(t,e,r,n){var o=s(s(s(t,r),c(e)),typeof e);return null===e?s(o,"null"):void 0===e?s(o,"undefined"):"object"==typeof e?-1!==n.indexOf(e)?s(o,"[Circular]"+r):(n.push(e),a(o,e,n)):s(o,e.toString())}function c(t){return Object.prototype.toString.call(t)}function h(t){return i(u(0,t,"",[]).toString(16),8)}function p(t,e){return void 0===e&&(e=!0),e&&M.filter(t),new T(t)}function f(t,e){if(void 0!==t&&void 0!==e){for(var r=0,n=t.split(".");r<n.length;r++){var o=n[r];if(!e.hasOwnProperty(o))return;e=e[o]}return e}}function l(t,e){var r={};for(var n in e){var o=e[n];o instanceof Array||"object"==typeof o&&(o=d(t[n],o)),n in t&&(t[n]===o||n in r&&r[n]===o)||(t[n]=o)}return t}function d(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if("object"!=typeof t)throw new Error('Destination "'+t+'" must be an object.');for(var n=0,o=e;n<o.length;n++)l(t,o[n]);return t}function v(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;y(t,e);)t=t.substring(0,t.length-1);return t}function y(t,e,r){var n=t.toString();("number"!=typeof r||!isFinite(r)||Math.floor(r)!==r||r>n.length)&&(r=n.length),r-=e.length;var o=n.lastIndexOf(e,r);return-1!==o&&o===r}var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},_=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},b=function(){function t(t){this._cache={},this._calcID=t}return t.hash=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return h(_({},t))},t.prototype.has=function(t){return this._calcID(t)in this._cache},t.prototype.set=function(t){return this._cache[this._calcID(t)]=t,t},t.prototype.get=function(t,e){var r=this._cache[this._calcID(t)];return r||(e?this.set(e()):null)},t}(),w=function(){function t(t){this._cache={},this._calcID=t}return t.hash=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return h(_({},t))},t.prototype.has=function(t){return this._calcID(t)in this._cache},t.prototype.set=function(t,e){return this._cache[this._calcID(t)]=e,e},t.prototype.get=function(t,e){var r=this._cache[this._calcID(t)];return r||(e?this.set(t,e()):Promise.resolve(null))},t}(),m=function(){function t(t){if(this.store={},t)for(var e in t)this.set(e,t[e])}return t.prototype.set=function(t,e){var r=this.store[t];return this.store[t]=e,r},t.prototype.get=function(t){return this.store[t]},t.prototype.has=function(t){return void 0!==this.store[t]},t.prototype.remove=function(t){delete this.store[t]},t.prototype.keys=function(){var t=[];for(var e in this.store)t.push(e);return t},t.prototype.values=function(){var t=[];for(var e in this.store)t.push(this.store[e]);return t},t}(),E=function(){function t(t,e,r,n){this._graph=t,this._parent=e,this._id=r,this._attrs=new m(n)}return t.prototype.className=function(){return this.constructor.name},t.prototype.id=function(){return this._id},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return this._parent},t.prototype.hasECLDefinition=function(){return void 0!==this._attrs.get("definition")},t.prototype.getECLDefinition=function(){var t=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(this._attrs.get("definition"));if(t){var e=t[1],r=t[2],n=t[3];return e.replace("/./","/"),{id:this.id(),file:e,line:+r,column:+n}}throw new Error("Bad definition: "+this._attrs.get("definition"))},t}(),S=function(t){function r(e,r,n,o){void 0===o&&(o={});var i=t.call(this,e,r,n,o)||this;return i._subgraphs=new m,i._vertices=new m,i._edges=new m,r&&r.addSubgraph(i),i}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeSubgraph(this),this._edges.values().forEach(function(e){return t._graph.destroyEdge(e)}),this._vertices.values().forEach(function(e){return t._graph.destroyVertex(e)}),this._subgraphs.values().forEach(function(e){return t._graph.destroySubgraph(e)})},r.prototype.remove=function(){this._graph.destroySubgraph(this)},r.prototype.createSubgraph=function(t,e){return this._graph.createSubgraph(this,t,e)},r.prototype.addSubgraph=function(t){if(this._subgraphs.has(t.id()))throw new Error("Subgraph already exists");this._subgraphs.set(t.id(),t)},r.prototype.removeSubgraph=function(t){if(!this._subgraphs.has(t.id()))throw new Error("Subgraph does not exist");this._subgraphs.remove(t.id())},r.prototype.createVertex=function(t,e,r){return this._graph.createVertex(this,t,e,r)},r.prototype.addVertex=function(t){if(this._vertices.has(t.id()))throw new Error("Vertex already exists");this._vertices.set(t.id(),t)},r.prototype.removeVertex=function(t){if(!this._vertices.has(t.id()))throw new Error("Vertex does not exist");this._vertices.remove(t.id())},r.prototype.createEdge=function(t,e,r,n){return this._graph.createEdge(this,t,e,r,n)},r.prototype.addEdge=function(t){if(this._edges.has(t.id()))throw new Error("Edge already exists");this._edges.set(t.id(),t)},r.prototype.removeEdge=function(t){if(!this._edges.has(t.id()))throw new Error("Edge does not exist");this._edges.remove(t.id())},r.prototype.add=function(t){t instanceof r?this.addSubgraph(t):t instanceof O?this.addVertex(t):this.addEdge(t)},r.prototype.subgraphs=function(){return this._subgraphs.values()},r.prototype.vertices=function(){return this._vertices.values()},r.prototype.edges=function(){return this._edges.values()},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!1),this.hasECLDefinition())return this.getECLDefinition();var e=this.vertices();t&&(e=e.reverse());var r=null;return e.some(function(e){return!!(r=e.getNearestDefinition(t))}),r},r}(E),O=function(t){function r(e,r,n,o,i){var s=t.call(this,e,r,n,i)||this;return s.inEdges=[],s.outEdges=[],s._label=o,r.addVertex(s),s}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeVertex(this),this.inEdges.forEach(function(e){return t._graph.destroyEdge(e)}),this.outEdges.forEach(function(e){return t._graph.destroyEdge(e)})},r.prototype.label=function(){return this._label},r.prototype.addInEdge=function(t){this.inEdges.push(t)},r.prototype.removeInEdge=function(t){var e=this.inEdges.indexOf(t);if(e<0)throw new Error("In edge does not exist");this.inEdges.splice(e,1)},r.prototype.addOutEdge=function(t){this.outEdges.push(t)},r.prototype.removeOutEdge=function(t){var e=this.outEdges.indexOf(t);if(e<0)throw new Error("Out edge does not exist");this.outEdges.splice(e,1)},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!0),this.hasECLDefinition())return this.getECLDefinition();var e=null;return this.inEdges.some(function(r){return!!(e=r.getNearestDefinition(t))}),e},r}(E),x=function(t){function r(e,r,n,o,i,s){var a=t.call(this,e,r,n,s)||this;if(!o)throw new Error("Missing source vertex");if(!i)throw new Error("Missing target vertex");return r.addEdge(a),a.source=o,a.source.addOutEdge(a),a.target=i,a.target.addInEdge(a),a}return e(r,t),r.prototype.sourceID=function(){return this.source.id()},r.prototype.targetID=function(){return this.target.id()},r.prototype.destroy=function(){this._parent&&this._parent.removeEdge(this),this.source.removeOutEdge(this),this.target.removeInEdge(this)},r.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this.hasECLDefinition()?this.getECLDefinition():this.source.getNearestDefinition(t)},r}(S),D=function(){function t(t,e){this._allSubgraphs=new m,this._allVertices=new m,this._allEdges=new m,this._attrs=new m,this._root=new S(this,null,t,e),this._allSubgraphs.set(t,this._root)}return t.prototype.className=function(){return"Graph"},t.prototype.id=function(){return this._root.id()},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return null},t.prototype.remove=function(){},t.prototype.subgraphs=function(){return this._root.subgraphs()},t.prototype.vertices=function(){return this._root.vertices()},t.prototype.edges=function(){return this._root.edges()},t.prototype.createSubgraph=function(t,e,r){if(this._allSubgraphs.has(e))throw new Error("Subgraph already exists");var n=new S(this,this._allSubgraphs.get(t.id()),e,r);return this._allSubgraphs.set(e,n),n},t.prototype.destroySubgraph=function(t){var e=this._allSubgraphs.get(t.id());if(!e)throw new Error("Subgraph does not exist");this._allSubgraphs.remove(e.id()),e.destroy()},t.prototype.createVertex=function(t,e,r,n){if(this._allVertices.has(e))throw new Error("Vertex already exists");var o=new O(this,this._allSubgraphs.get(t.id()),e,r,n);return this._allVertices.set(e,o),o},t.prototype.destroyVertex=function(t){var e=this._allVertices.get(t.id());if(!e)throw new Error("Vertex does not exist");this._allVertices.remove(e.id()),e.destroy()},t.prototype.createEdge=function(t,e,r,n,o){if(this._allEdges.has(e))throw new Error("Edge already exists");var i=new x(this,this._allSubgraphs.get(t.id()),e,this._allVertices.get(r),this._allVertices.get(n),o);return this._allEdges.set(e,i),i},t.prototype.destroyEdge=function(t){var e=this._allEdges.get(t.id());if(!e)throw new Error("Edge does not exist");this._allEdges.remove(e.id()),e.destroy()},t.prototype.allSubgraph=function(t){return this._allSubgraphs.get(t)},t.prototype.allSubgraphs=function(){var t=this;return this._allSubgraphs.values().filter(function(e){return e!==t._root})},t.prototype.allVertex=function(t){return this._allVertices.get(t)},t.prototype.allVertices=function(){return this._allVertices.values()},t.prototype.allEdge=function(t){return this._allEdges.get(t)},t.prototype.allEdges=function(){return this._allEdges.values()},t.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this._root.getNearestDefinition(t)},t.prototype.breakpointLocations=function(t){for(var e=[],r=0,n=this._allVertices.values();r<n.length;r++){var o=n[r];if(o.hasECLDefinition()){var i=o.getECLDefinition();(i&&!t||t===i.file)&&e.push(i)}}return e.sort(function(t,e){return t.line-e.line})},t}(),L=new Function("try{return global;}catch(e){return window;}")(),I=new Function("try{return this===window;}catch(e){return false;}"),k=new Function("try{return this===global;}catch(e){return false;}"),N=new Function("try{return process.env.TRAVIS;}catch(e){return false;}"),V=function(){function t(){this.stack=[]}return t.prototype.push=function(t){return this.stack.push(t),t},t.prototype.pop=function(){return this.stack.pop()},t.prototype.top=function(){return this.stack.length?this.stack[this.stack.length-1]:void 0},t.prototype.depth=function(){return this.stack.length},t}();!function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.notice=2]="notice",t[t.warning=3]="warning",t[t.error=4]="error",t[t.critical=5]="critical",t[t.alert=6]="alert",t[t.emergency=7]="emergency"}(t.Level=t.Level||(t.Level={}));var C={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},j=function(){function e(){}return e.prototype.write=function(e,r,n,o){k?console.log("["+e+"] "+t.Level[r].toUpperCase()+" "+n+": "+o):console.log("["+e+"] %c"+t.Level[r].toUpperCase()+"%c "+n+": "+o,"color:"+C[t.Level[r]],"")},e}(),P=function(){function e(){this._levelStack=new V,this._level=t.Level.info,this._filter="",this._writer=new j}return e.Instance=function(){return this._instance||(this._instance=new this)},e.prototype.stringify=function(t){var e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r},2)},e.prototype.writer=function(t){return void 0===t?this._writer:(this._writer=t,this)},e.prototype.log=function(t,e,r){t<this._level||this._filter&&this._filter!==e||("string"!=typeof r&&(r=this.stringify(r)),this._writer.write((new Date).toISOString(),t,e,r))},e.prototype.debug=function(e,r){this.log(t.Level.debug,e,r)},e.prototype.info=function(e,r){this.log(t.Level.info,e,r)},e.prototype.notice=function(e,r){this.log(t.Level.notice,e,r)},e.prototype.warning=function(e,r){this.log(t.Level.warning,e,r)},e.prototype.error=function(e,r){this.log(t.Level.error,e,r)},e.prototype.critical=function(e,r){this.log(t.Level.critical,e,r)},e.prototype.alert=function(e,r){this.log(t.Level.alert,e,r)},e.prototype.emergency=function(e,r){this.log(t.Level.emergency,e,r)},e.prototype.level=function(t){return void 0===t?this._level:(this._level=t,this)},e.prototype.pushLevel=function(t){return this._levelStack.push(this._level),this._level=t,this},e.prototype.popLevel=function(){return this._level=this._levelStack.pop(),this},e.prototype.filter=function(t){return void 0===t?this._filter:(this._filter=t,this)},e}(),M=P.Instance(),T=function(){function t(t){this._scopeID=t}return t.prototype.debug=function(t){M.debug(this._scopeID,t)},t.prototype.info=function(t){M.info(this._scopeID,t)},t.prototype.notice=function(t){M.notice(this._scopeID,t)},t.prototype.warning=function(t){M.warning(this._scopeID,t)},t.prototype.error=function(t){M.error(this._scopeID,t)},t.prototype.critical=function(t){M.critical(this._scopeID,t)},t.prototype.alert=function(t){M.alert(this._scopeID,t)},t.prototype.emergency=function(t){M.emergency(this._scopeID,t)},t.prototype.pushLevel=function(t){return M.pushLevel(t),this},t.prototype.popLevel=function(){return M.popLevel(),this},t}(),X=p("loader"),A=function(){function t(t,e,r){this.eventTarget=t,this.eventID=e,this.callback=r}return t.prototype.release=function(){this.eventTarget.removeObserver(this.eventID,this.callback)},t.prototype.unwatch=function(){this.release()},t}(),F=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._eventObservers={},this._knownEvents=t}return t.prototype.addObserver=function(t,e){var r=this._eventObservers[t];return r||(r=[],this._eventObservers[t]=r),r.push(e),new A(this,t,e)},t.prototype.removeObserver=function(t,e){var r=this._eventObservers[t];if(r)for(var n=r.length-1;n>=0;--n)r[n]===e&&r.splice(n,1);return this},t.prototype.dispatchEvent=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this._eventObservers[t];if(n)for(var o=0,i=n;o<i.length;o++)i[o].apply(void 0,e);return this},t.prototype._hasObserver=function(t){var e=this._eventObservers[t];for(var r in e)if(e[r])return!0;return!1},t.prototype.hasObserver=function(t){if(void 0!==t)return this._hasObserver(t);for(var e in this._eventObservers)if(this._hasObserver(e))return!0;return!1},t}(),R=function(){function t(t){this.name="",this.$={},this._children=[],this.content="",this.name=t}return t.prototype.appendAttribute=function(t,e){this.$[t]=e},t.prototype.appendContent=function(t){this.content+=t},t.prototype.appendChild=function(t){this._children.push(t)},t.prototype.children=function(t){return void 0===t?this._children:this._children.filter(function(e){return e.name===t})},t}(),q=function(){function t(){this.stack=new V}return t.prototype.walkDoc=function(t){var e=this._startXMLNode(t);if(t.attributes)for(n=0;n<t.attributes.length;++n){var r=t.attributes.item(n);this.attributes(r.nodeName,r.nodeValue)}if(this.startXMLNode(e),t.childNodes)for(var n=0;n<t.childNodes.length;++n){var o=t.childNodes.item(n);o.nodeType===o.TEXT_NODE?this.characters(o.nodeValue):this.walkDoc(o)}this.endXMLNode(this.stack.pop())},t.prototype._startXMLNode=function(t){var e=new R(t.nodeName);return this.stack.depth()?this.stack.top().appendChild(e):this.root=e,this.stack.push(e)},t.prototype.parse=function(t){var e=(new DOMParser).parseFromString(t,"application/xml");this.startDocument(),this.walkDoc(e),this.endDocument()},t.prototype.startDocument=function(){},t.prototype.endDocument=function(){},t.prototype.startXMLNode=function(t){},t.prototype.endXMLNode=function(t){},t.prototype.attributes=function(t,e){this.stack.top().appendAttribute(t,e)},t.prototype.characters=function(t){this.stack.top().appendContent(t)},t}(),G=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.startXMLNode=function(e){t.prototype.startXMLNode.call(this,e)},r.prototype.endXMLNode=function(e){t.prototype.endXMLNode.call(this,e)},r}(q),B=function(){function t(){this._espState={},this._espStateCache={},this._events=new F}return t.prototype.clear=function(t){this._espState={},this._espStateCache={},void 0!==t&&this.set(t)},t.prototype.get=function(t,e){return void 0===t?this._espState:this.has(t)?this._espState[t]:e},t.prototype.set=function(t,e,r){return void 0===r&&(r=!1),"string"==typeof t?this.setSingle(t,e,r):this.setAll(t)},t.prototype.setSingle=function(t,e,r){var n=this._espStateCache[t],o=h(e);if(n!==o){this._espStateCache[t]=o;var i=this._espState[t];this._espState[t]=e;var s={id:t,oldValue:i,newValue:e};return r||(this._events.dispatchEvent("propChanged",s),this._events.dispatchEvent("changed",[s])),s}return null},t.prototype.setAll=function(t){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var n=this.setSingle(r,t[r],!0);n&&e.push(n)}if(e.length){for(var o=0,i=e;o<i.length;o++){var s=i[o];this._events.dispatchEvent("propChanged",s)}this._events.dispatchEvent("changed",e)}return e},t.prototype.has=function(t){return void 0!==this._espState[t]},t.prototype.addObserver=function(t,e,r){if(this.isCallback(e)){if("changed"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,e)}if("propChanged"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,function(t){t.id===e&&r(t)})},t.prototype.on=function(t,e,r){if(this.isCallback(e))switch(t){case"changed":this._events.addObserver(t,e)}else switch(t){case"propChanged":this._events.addObserver(t,function(t){t.id===e&&r(t)})}return this},t.prototype.isCallback=function(t){return"function"==typeof t},t.prototype.hasEventListener=function(){return this._events.hasObserver()},t}();t.find=function(t,e){if(null==t)throw new TypeError('"o" is null or not defined');var r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var i=t[o];if(e.call(n,i,o,t))return i;o++}},t.compare=function(t,e){for(var r={unchanged:[],removed:[],added:e.slice(0)},n=0,o=t;n<o.length;n++){var i=o[n],s=r.added.indexOf(i);s>=0?(r.unchanged.push(i),r.added.splice(s,1)):r.removed.push(i)}return r},t.Cache=b,t.AsyncCache=w,t.Dictionary=m,t.espTime2Seconds=function(t){if(!t)return 0;if(!isNaN(Number(t)))return Number(t);var e=t.indexOf("ns");if(-1!==e)return parseFloat(t.substr(0,e))/1e9;var r=t.indexOf("ms");if(-1!==r)return parseFloat(t.substr(0,r))/1e3;var n=t.indexOf("s");if(-1!==n&&-1===t.indexOf("days"))return parseFloat(t.substr(0,n));for(var o=t.split(" days "),i=o.length>1?parseFloat(o[0]):0,s=0,a=(o.length>1?o[1]:o[0]).split(":").reverse(),u=0;u<a.length;++u)s+=parseFloat(a[u])*Math.pow(60,u);return 24*i*60*60+s},t.Graph=D,t.hashSum=h,t.dynamicImport=function(t){return new Promise(function(e,r){if(require)try{require([t],function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e(t[0])})}catch(e){X.error("require(["+t+"], ...) failed"),r("require(["+t+"], ...) failed")}else X.error('"require" is needed for dynamic loader.'),r('"require" is needed for dynamic loader.')})},t.Logging=P,t.logger=M,t.ScopedLogging=T,t.scopedLogger=p,t.inner=f,t.exists=function(t,e){return void 0!==f(t,e)},t.deepMixin=d,t.deepMixinT=function(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return d.apply(void 0,[t].concat(e))},t.safeStringify=function(t){var e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r})},t.Observable=F,t.root=L,t.isBrowser=I,t.isNode=k,t.isTravis=N,t.XMLNode=R,t.SAXStackParser=q,t.xml2json=function(t){var e=new G;return e.parse(t),e.root},t.Stack=V,t.StateObject=B,t.trim=v,t.endsWith=y,t.join=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(t.length&&t[0].length&&"/"===t[0].charAt(0)?"/":"")+t.map(function(t){return v(t,"/")}).join("/")},t.__extends=e,t.__assign=_,t.__rest=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]]);return r},t.__decorate=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},t.__param=function(t,e){return function(r,n){e(r,n,t)}},t.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},t.__awaiter=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},t.__generator=function(t,e){function r(t){return function(e){return n([t,e])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(s=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[0,s.value]),r[0]){case 0:case 1:s=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){u.label=r[1];break}if(6===r[0]&&u.label<s[1]){u.label=s[1],s=r;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(r);break}s[2]&&u.ops.pop(),u.trys.pop();continue}r=e.call(t,u)}catch(t){r=[6,t],i=0}finally{o=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}var o,i,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},t.__exportStar=function(t,e){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])},t.__values=r,t.__read=n,t.__spread=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t},t.__await=o,t.__asyncGenerator=function(t,e,r){function n(t){p[t]&&(h[t]=function(e){return new Promise(function(r,n){f.push([t,e,r,n])>1||i(t,e)})})}function i(t,e){try{s(p[t](e))}catch(t){c(f[0][3],t)}}function s(t){t.value instanceof o?Promise.resolve(t.value.v).then(a,u):c(f[0][2],t)}function a(t){i("next",t)}function u(t){i("throw",t)}function c(t,e){t(e),f.shift(),f.length&&i(f[0][0],f[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var h,p=r.apply(t,e||[]),f=[];return h={},n("next"),n("throw"),n("return"),h[Symbol.asyncIterator]=function(){return this},h},t.__asyncDelegator=function(t){function e(e,i){t[e]&&(r[e]=function(r){return(n=!n)?{value:o(t[e](r)),done:"return"===e}:i?i(r):r})}var r,n;return r={},e("next"),e("throw",function(t){throw t}),e("return"),r[Symbol.iterator]=function(){return this},r},t.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):"function"==typeof r?r(t):t[Symbol.iterator]()},t.__makeTemplateObject=function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["@hpcc-js/util"]={})}(this,function(t){"use strict";function e(t,e){function r(){this.constructor=t}v(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(function(t){try{s(n.next(t))}catch(t){i(t)}},function(t){try{s(n.throw(t))}catch(t){i(t)}})}s((n=n.apply(t,e||[])).next())})}function n(t,e){function r(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(i=o[2&r[0]?"return":r[0]?"throw":"next"])&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[0,i.value]),r[0]){case 0:case 1:i=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,o=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){a.label=r[1];break}if(6===r[0]&&a.label<i[1]){a.label=i[1],i=r;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(r);break}i[2]&&a.ops.pop(),a.trys.pop();continue}r=e.call(t,a)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}var n,o,i,s,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s}function o(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function i(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function s(t){return this instanceof s?(this.v=t,this):new s(t)}function a(t,e){if(0===e.length)return t;for(var r=0;r<e.length;++r){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t<0?-2*t:t}function u(t,e,r,n){var o=a(a(a(t,r),function(t){return Object.prototype.toString.call(t)}(e)),typeof e);return null===e?a(o,"null"):void 0===e?a(o,"undefined"):"object"==typeof e?-1!==n.indexOf(e)?a(o,"[Circular]"+r):(n.push(e),function(t,e,r){return Object.keys(e).sort().reduce(function(t,n){return u(t,e[n],n,r)},t)}(o,e,n)):a(o,e.toString())}function c(t){return function(t,e){for(;t.length<e;)t="0"+t;return t}(u(0,t,"",[]).toString(16),8)}function h(t,e){return void 0===e&&(e=!0),e&&j.filter(t),new T(t)}function p(t,e){if(void 0!==t&&void 0!==e){for(var r=0,n=t.split(".");r<n.length;r++){var o=n[r];if(!e.hasOwnProperty(o))return;e=e[o]}return e}}function f(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if("object"!=typeof t)throw new Error('Destination "'+t+'" must be an object.');for(var n=0,o=e;n<o.length;n++){!function(t,e){var r={};for(var n in e){var o=e[n];o instanceof Array||"object"==typeof o&&(o=f(t[n],o)),n in t&&(t[n]===o||n in r&&r[n]===o)||(t[n]=o)}}(t,o[n])}return t}function l(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;d(t,e);)t=t.substring(0,t.length-1);return t}function d(t,e,r){var n=t.toString();("number"!=typeof r||!isFinite(r)||Math.floor(r)!==r||r>n.length)&&(r=n.length),r-=e.length;var o=n.lastIndexOf(e,r);return-1!==o&&o===r}var v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},g=function(){function t(t){this._cache={},this._calcID=t}return t.hash=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return c(y({},t))},t.prototype.has=function(t){return this._calcID(t)in this._cache},t.prototype.set=function(t){return this._cache[this._calcID(t)]=t,t},t.prototype.get=function(t,e){var r=this._cache[this._calcID(t)];return r||(e?this.set(e()):null)},t}(),_=function(){function t(t){this._cache={},this._calcID=t}return t.hash=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return c(y({},t))},t.prototype.has=function(t){return this._calcID(t)in this._cache},t.prototype.set=function(t,e){return this._cache[this._calcID(t)]=e,e},t.prototype.get=function(t,e){var r=this._cache[this._calcID(t)];return r||(e?this.set(t,e()):Promise.resolve(null))},t}(),b=function(){function t(t){if(this.store={},t)for(var e in t)this.set(e,t[e])}return t.prototype.set=function(t,e){var r=this.store[t];return this.store[t]=e,r},t.prototype.get=function(t){return this.store[t]},t.prototype.has=function(t){return void 0!==this.store[t]},t.prototype.remove=function(t){delete this.store[t]},t.prototype.keys=function(){var t=[];for(var e in this.store)t.push(e);return t},t.prototype.values=function(){var t=[];for(var e in this.store)t.push(this.store[e]);return t},t}(),w=function(){function t(t,e,r,n){this._graph=t,this._parent=e,this._id=r,this._attrs=new b(n)}return t.prototype.className=function(){return this.constructor.name},t.prototype.id=function(){return this._id},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return this._parent},t.prototype.hasECLDefinition=function(){return void 0!==this._attrs.get("definition")},t.prototype.getECLDefinition=function(){var t=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(this._attrs.get("definition"));if(t){var e=t[1],r=t[2],n=t[3];return e.replace("/./","/"),{id:this.id(),file:e,line:+r,column:+n}}throw new Error("Bad definition: "+this._attrs.get("definition"))},t}(),m=function(t){function r(e,r,n,o){void 0===o&&(o={});var i=t.call(this,e,r,n,o)||this;return i._subgraphs=new b,i._vertices=new b,i._edges=new b,r&&r.addSubgraph(i),i}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeSubgraph(this),this._edges.values().forEach(function(e){return t._graph.destroyEdge(e)}),this._vertices.values().forEach(function(e){return t._graph.destroyVertex(e)}),this._subgraphs.values().forEach(function(e){return t._graph.destroySubgraph(e)})},r.prototype.remove=function(){this._graph.destroySubgraph(this)},r.prototype.createSubgraph=function(t,e){return this._graph.createSubgraph(this,t,e)},r.prototype.addSubgraph=function(t){if(this._subgraphs.has(t.id()))throw new Error("Subgraph already exists");this._subgraphs.set(t.id(),t)},r.prototype.removeSubgraph=function(t){if(!this._subgraphs.has(t.id()))throw new Error("Subgraph does not exist");this._subgraphs.remove(t.id())},r.prototype.createVertex=function(t,e,r){return this._graph.createVertex(this,t,e,r)},r.prototype.addVertex=function(t){if(this._vertices.has(t.id()))throw new Error("Vertex already exists");this._vertices.set(t.id(),t)},r.prototype.removeVertex=function(t){if(!this._vertices.has(t.id()))throw new Error("Vertex does not exist");this._vertices.remove(t.id())},r.prototype.createEdge=function(t,e,r,n){return this._graph.createEdge(this,t,e,r,n)},r.prototype.addEdge=function(t){if(this._edges.has(t.id()))throw new Error("Edge already exists");this._edges.set(t.id(),t)},r.prototype.removeEdge=function(t){if(!this._edges.has(t.id()))throw new Error("Edge does not exist");this._edges.remove(t.id())},r.prototype.add=function(t){t instanceof r?this.addSubgraph(t):t instanceof E?this.addVertex(t):this.addEdge(t)},r.prototype.subgraphs=function(){return this._subgraphs.values()},r.prototype.vertices=function(){return this._vertices.values()},r.prototype.edges=function(){return this._edges.values()},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!1),this.hasECLDefinition())return this.getECLDefinition();var e=this.vertices();t&&(e=e.reverse());var r=null;return e.some(function(e){return!!(r=e.getNearestDefinition(t))}),r},r}(w),E=function(t){function r(e,r,n,o,i){var s=t.call(this,e,r,n,i)||this;return s.inEdges=[],s.outEdges=[],s._label=o,r.addVertex(s),s}return e(r,t),r.prototype.destroy=function(){var t=this;this._parent&&this._parent.removeVertex(this),this.inEdges.forEach(function(e){return t._graph.destroyEdge(e)}),this.outEdges.forEach(function(e){return t._graph.destroyEdge(e)})},r.prototype.label=function(){return this._label},r.prototype.addInEdge=function(t){this.inEdges.push(t)},r.prototype.removeInEdge=function(t){var e=this.inEdges.indexOf(t);if(e<0)throw new Error("In edge does not exist");this.inEdges.splice(e,1)},r.prototype.addOutEdge=function(t){this.outEdges.push(t)},r.prototype.removeOutEdge=function(t){var e=this.outEdges.indexOf(t);if(e<0)throw new Error("Out edge does not exist");this.outEdges.splice(e,1)},r.prototype.getNearestDefinition=function(t){if(void 0===t&&(t=!0),this.hasECLDefinition())return this.getECLDefinition();var e=null;return this.inEdges.some(function(r){return!!(e=r.getNearestDefinition(t))}),e},r}(w),S=function(t){function r(e,r,n,o,i,s){var a=t.call(this,e,r,n,s)||this;if(!o)throw new Error("Missing source vertex");if(!i)throw new Error("Missing target vertex");return r.addEdge(a),a.source=o,a.source.addOutEdge(a),a.target=i,a.target.addInEdge(a),a}return e(r,t),r.prototype.sourceID=function(){return this.source.id()},r.prototype.targetID=function(){return this.target.id()},r.prototype.destroy=function(){this._parent&&this._parent.removeEdge(this),this.source.removeOutEdge(this),this.target.removeInEdge(this)},r.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this.hasECLDefinition()?this.getECLDefinition():this.source.getNearestDefinition(t)},r}(m),O=function(){function t(t,e){this._allSubgraphs=new b,this._allVertices=new b,this._allEdges=new b,this._attrs=new b,this._root=new m(this,null,t,e),this._allSubgraphs.set(t,this._root)}return t.prototype.className=function(){return"Graph"},t.prototype.id=function(){return this._root.id()},t.prototype.attrs=function(){return this._attrs},t.prototype.parent=function(){return null},t.prototype.remove=function(){},t.prototype.subgraphs=function(){return this._root.subgraphs()},t.prototype.vertices=function(){return this._root.vertices()},t.prototype.edges=function(){return this._root.edges()},t.prototype.createSubgraph=function(t,e,r){if(this._allSubgraphs.has(e))throw new Error("Subgraph already exists");var n=new m(this,this._allSubgraphs.get(t.id()),e,r);return this._allSubgraphs.set(e,n),n},t.prototype.destroySubgraph=function(t){var e=this._allSubgraphs.get(t.id());if(!e)throw new Error("Subgraph does not exist");this._allSubgraphs.remove(e.id()),e.destroy()},t.prototype.createVertex=function(t,e,r,n){if(this._allVertices.has(e))throw new Error("Vertex already exists");var o=new E(this,this._allSubgraphs.get(t.id()),e,r,n);return this._allVertices.set(e,o),o},t.prototype.destroyVertex=function(t){var e=this._allVertices.get(t.id());if(!e)throw new Error("Vertex does not exist");this._allVertices.remove(e.id()),e.destroy()},t.prototype.createEdge=function(t,e,r,n,o){if(this._allEdges.has(e))throw new Error("Edge already exists");var i=new S(this,this._allSubgraphs.get(t.id()),e,this._allVertices.get(r),this._allVertices.get(n),o);return this._allEdges.set(e,i),i},t.prototype.destroyEdge=function(t){var e=this._allEdges.get(t.id());if(!e)throw new Error("Edge does not exist");this._allEdges.remove(e.id()),e.destroy()},t.prototype.allSubgraph=function(t){return this._allSubgraphs.get(t)},t.prototype.allSubgraphs=function(){var t=this;return this._allSubgraphs.values().filter(function(e){return e!==t._root})},t.prototype.allVertex=function(t){return this._allVertices.get(t)},t.prototype.allVertices=function(){return this._allVertices.values()},t.prototype.allEdge=function(t){return this._allEdges.get(t)},t.prototype.allEdges=function(){return this._allEdges.values()},t.prototype.getNearestDefinition=function(t){return void 0===t&&(t=!1),this._root.getNearestDefinition(t)},t.prototype.breakpointLocations=function(t){for(var e=[],r=0,n=this._allVertices.values();r<n.length;r++){var o=n[r];if(o.hasECLDefinition()){var i=o.getECLDefinition();(i&&!t||t===i.file)&&e.push(i)}}return e.sort(function(t,e){return t.line-e.line})},t}(),x=new Function("try{return global;}catch(e){return window;}")(),D=new Function("try{return this===window;}catch(e){return false;}"),L=new Function("try{return this===global;}catch(e){return false;}"),I=new Function("try{return process.env.TRAVIS;}catch(e){return false;}"),k=function(){function t(){this.stack=[]}return t.prototype.push=function(t){return this.stack.push(t),t},t.prototype.pop=function(){return this.stack.pop()},t.prototype.top=function(){return this.stack.length?this.stack[this.stack.length-1]:void 0},t.prototype.depth=function(){return this.stack.length},t}();!function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.notice=2]="notice",t[t.warning=3]="warning",t[t.error=4]="error",t[t.critical=5]="critical",t[t.alert=6]="alert",t[t.emergency=7]="emergency"}(t.Level=t.Level||(t.Level={}));var C={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},N=function(){function e(){}return e.prototype.write=function(e,r,n,o){L?console.log("["+e+"] "+t.Level[r].toUpperCase()+" "+n+": "+o):console.log("["+e+"] %c"+t.Level[r].toUpperCase()+"%c "+n+": "+o,"color:"+C[t.Level[r]],"")},e}(),V=function(){function e(){this._levelStack=new k,this._level=t.Level.info,this._filter="",this._writer=new N}return e.Instance=function(){return this._instance||(this._instance=new this)},e.prototype.stringify=function(t){var e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r},2)},e.prototype.writer=function(t){return void 0===t?this._writer:(this._writer=t,this)},e.prototype.log=function(t,e,r){t<this._level||this._filter&&this._filter!==e||("string"!=typeof r&&(r=this.stringify(r)),this._writer.write((new Date).toISOString(),t,e,r))},e.prototype.debug=function(e,r){this.log(t.Level.debug,e,r)},e.prototype.info=function(e,r){this.log(t.Level.info,e,r)},e.prototype.notice=function(e,r){this.log(t.Level.notice,e,r)},e.prototype.warning=function(e,r){this.log(t.Level.warning,e,r)},e.prototype.error=function(e,r){this.log(t.Level.error,e,r)},e.prototype.critical=function(e,r){this.log(t.Level.critical,e,r)},e.prototype.alert=function(e,r){this.log(t.Level.alert,e,r)},e.prototype.emergency=function(e,r){this.log(t.Level.emergency,e,r)},e.prototype.level=function(t){return void 0===t?this._level:(this._level=t,this)},e.prototype.pushLevel=function(t){return this._levelStack.push(this._level),this._level=t,this},e.prototype.popLevel=function(){return this._level=this._levelStack.pop(),this},e.prototype.filter=function(t){return void 0===t?this._filter:(this._filter=t,this)},e}(),j=V.Instance(),T=function(){function t(t){this._scopeID=t}return t.prototype.debug=function(t){j.debug(this._scopeID,t)},t.prototype.info=function(t){j.info(this._scopeID,t)},t.prototype.notice=function(t){j.notice(this._scopeID,t)},t.prototype.warning=function(t){j.warning(this._scopeID,t)},t.prototype.error=function(t){j.error(this._scopeID,t)},t.prototype.critical=function(t){j.critical(this._scopeID,t)},t.prototype.alert=function(t){j.alert(this._scopeID,t)},t.prototype.emergency=function(t){j.emergency(this._scopeID,t)},t.prototype.pushLevel=function(t){return j.pushLevel(t),this},t.prototype.popLevel=function(){return j.popLevel(),this},t}(),P=h("loader"),M=function(){function t(t,e,r){this.eventTarget=t,this.eventID=e,this.callback=r}return t.prototype.release=function(){this.eventTarget.removeObserver(this.eventID,this.callback)},t.prototype.unwatch=function(){this.release()},t}(),X=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._eventObservers={},this._knownEvents=t}return t.prototype.addObserver=function(t,e){var r=this._eventObservers[t];return r||(r=[],this._eventObservers[t]=r),r.push(e),new M(this,t,e)},t.prototype.removeObserver=function(t,e){var r=this._eventObservers[t];if(r)for(var n=r.length-1;n>=0;--n)r[n]===e&&r.splice(n,1);return this},t.prototype.dispatchEvent=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this._eventObservers[t];if(n)for(var o=0,i=n;o<i.length;o++){i[o].apply(void 0,e)}return this},t.prototype._hasObserver=function(t){var e=this._eventObservers[t];for(var r in e)if(e[r])return!0;return!1},t.prototype.hasObserver=function(t){if(void 0!==t)return this._hasObserver(t);for(var e in this._eventObservers)if(this._hasObserver(e))return!0;return!1},t}(),A=function(){function t(t){this.name="",this.$={},this._children=[],this.content="",this.name=t}return t.prototype.appendAttribute=function(t,e){this.$[t]=e},t.prototype.appendContent=function(t){this.content+=t},t.prototype.appendChild=function(t){this._children.push(t)},t.prototype.children=function(t){return void 0===t?this._children:this._children.filter(function(e){return e.name===t})},t}(),F=function(){function t(){this.stack=new k}return t.prototype.walkDoc=function(t){var e=this._startXMLNode(t);if(t.attributes)for(n=0;n<t.attributes.length;++n){var r=t.attributes.item(n);this.attributes(r.nodeName,r.nodeValue)}if(this.startXMLNode(e),t.childNodes)for(var n=0;n<t.childNodes.length;++n){var o=t.childNodes.item(n);o.nodeType===o.TEXT_NODE?this.characters(o.nodeValue):this.walkDoc(o)}this.endXMLNode(this.stack.pop())},t.prototype._startXMLNode=function(t){var e=new A(t.nodeName);return this.stack.depth()?this.stack.top().appendChild(e):this.root=e,this.stack.push(e)},t.prototype.parse=function(t){var e=(new DOMParser).parseFromString(t,"application/xml");this.startDocument(),this.walkDoc(e),this.endDocument()},t.prototype.startDocument=function(){},t.prototype.endDocument=function(){},t.prototype.startXMLNode=function(t){},t.prototype.endXMLNode=function(t){},t.prototype.attributes=function(t,e){this.stack.top().appendAttribute(t,e)},t.prototype.characters=function(t){this.stack.top().appendContent(t)},t}(),R=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.startXMLNode=function(e){t.prototype.startXMLNode.call(this,e)},r.prototype.endXMLNode=function(e){t.prototype.endXMLNode.call(this,e)},r}(F),q=function(){function t(){this._espState={},this._espStateCache={},this._events=new X,this._monitorTickCount=0}return t.prototype.clear=function(t){this._espState={},this._espStateCache={},void 0!==t&&this.set(t),this._monitorTickCount=0},t.prototype.get=function(t,e){return void 0===t?this._espState:this.has(t)?this._espState[t]:e},t.prototype.set=function(t,e,r){return void 0===r&&(r=!1),"string"==typeof t?this.setSingle(t,e,r):this.setAll(t)},t.prototype.setSingle=function(t,e,r){var n=this._espStateCache[t],o=c(e);if(n!==o){this._espStateCache[t]=o;var i=this._espState[t];this._espState[t]=e;var s={id:t,oldValue:i,newValue:e};return r||(this._events.dispatchEvent("propChanged",s),this._events.dispatchEvent("changed",[s])),s}return null},t.prototype.setAll=function(t){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var n=this.setSingle(r,t[r],!0);n&&e.push(n)}if(e.length){for(var o=0,i=e;o<i.length;o++){var s=i[o];this._events.dispatchEvent("propChanged",s)}this._events.dispatchEvent("changed",e)}return e},t.prototype.has=function(t){return void 0!==this._espState[t]},t.prototype.addObserver=function(t,e,r){if(this.isCallback(e)){if("changed"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,e)}if("propChanged"!==t)throw new Error("Invalid eventID: "+t);return this._events.addObserver(t,function(t){t.id===e&&r(t)})},t.prototype.on=function(t,e,r){if(this.isCallback(e))switch(t){case"changed":this._events.addObserver(t,e)}else switch(t){case"propChanged":this._events.addObserver(t,function(t){t.id===e&&r(t)})}return this},t.prototype.isCallback=function(t){return"function"==typeof t},t.prototype.hasEventListener=function(){return this._events.hasObserver()},t.prototype.refresh=function(t){return void 0===t&&(t=!1),r(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,Promise.resolve()];case 1:return t.sent(),[2,this]}})})},t.prototype._monitor=function(){var t=this;this._monitorHandle?this._monitorTickCount=0:this._monitorHandle=setTimeout(function(){(t.hasEventListener()?t.refresh(!0):Promise.resolve()).then(function(){t._monitor()}),delete t._monitorHandle},this._monitorTimeoutDuraction())},t.prototype._monitorTimeoutDuraction=function(){return++this._monitorTickCount,this._monitorTickCount<=1?0:3e4},t.prototype.watch=function(t,e){var r=this;if(void 0===e&&(e=!0),"function"!=typeof t)throw new Error("Invalid Callback");e&&setTimeout(function(){var e=r.get(),n=[];for(var o in e)e.hasOwnProperty(e)&&n.push({id:o,newValue:e[o],oldValue:void 0});t(n)},0);var n=this.addObserver("changed",t);return this._monitor(),n},t}();t.find=function(t,e){if(null==t)throw new TypeError('"o" is null or not defined');var r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var i=t[o];if(e.call(n,i,o,t))return i;o++}},t.compare=function(t,e){for(var r={unchanged:[],removed:[],added:e.slice(0)},n=0,o=t;n<o.length;n++){var i=o[n],s=r.added.indexOf(i);s>=0?(r.unchanged.push(i),r.added.splice(s,1)):r.removed.push(i)}return r},t.Cache=g,t.AsyncCache=_,t.debounce=function(t,e){var r,n=null;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n||(n=t.apply(void 0,o).then(function(t){return void 0===e?n=null:setTimeout(function(){n=null},Math.max(e-(Date.now()-r),0)),t}).catch(function(t){throw n=null,t}),r=Date.now(),n)}},t.Dictionary=b,t.espTime2Seconds=function(t){if(!t)return 0;if(!isNaN(Number(t)))return Number(t);var e=t.indexOf("ns");if(-1!==e)return parseFloat(t.substr(0,e))/1e9;var r=t.indexOf("ms");if(-1!==r)return parseFloat(t.substr(0,r))/1e3;var n=t.indexOf("s");if(-1!==n&&-1===t.indexOf("days"))return parseFloat(t.substr(0,n));for(var o=t.split(" days "),i=o.length>1?parseFloat(o[0]):0,s=0,a=(o.length>1?o[1]:o[0]).split(":").reverse(),u=0;u<a.length;++u)s+=parseFloat(a[u])*Math.pow(60,u);return 24*i*60*60+s},t.Graph=O,t.hashSum=c,t.dynamicImport=function(t){return new Promise(function(e,r){if(require)try{require([t],function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e(t[0])})}catch(e){P.error("require(["+t+"], ...) failed"),r("require(["+t+"], ...) failed")}else P.error('"require" is needed for dynamic loader.'),r('"require" is needed for dynamic loader.')})},t.Logging=V,t.logger=j,t.ScopedLogging=T,t.scopedLogger=h,t.inner=p,t.exists=function(t,e){return void 0!==p(t,e)},t.deepMixin=f,t.deepMixinT=function(t){void 0===t&&(t={});for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return f.apply(void 0,[t].concat(e))},t.safeStringify=function(t){var e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r})},t.Observable=X,t.root=x,t.isBrowser=D,t.isNode=L,t.isTravis=I,t.XMLNode=A,t.SAXStackParser=F,t.xml2json=function(t){var e=new R;return e.parse(t),e.root},t.Stack=k,t.StateObject=q,t.trim=l,t.endsWith=d,t.join=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(t.length&&t[0].length&&"/"===t[0].charAt(0)?"/":"")+t.map(function(t){return l(t,"/")}).join("/")},t.__extends=e,t.__assign=y,t.__rest=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]]);return r},t.__decorate=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},t.__param=function(t,e){return function(r,n){e(r,n,t)}},t.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},t.__awaiter=r,t.__generator=n,t.__exportStar=function(t,e){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])},t.__values=o,t.__read=i,t.__spread=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t},t.__await=s,t.__asyncGenerator=function(t,e,r){function n(t){u[t]&&(a[t]=function(e){return new Promise(function(r,n){c.push([t,e,r,n])>1||o(t,e)})})}function o(t,e){try{!function(t){t.value instanceof s?Promise.resolve(t.value.v).then(function(t){o("next",t)},function(t){o("throw",t)}):i(c[0][2],t)}(u[t](e))}catch(t){i(c[0][3],t)}}function i(t,e){t(e),c.shift(),c.length&&o(c[0][0],c[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a,u=r.apply(t,e||[]),c=[];return a={},n("next"),n("throw"),n("return"),a[Symbol.asyncIterator]=function(){return this},a},t.__asyncDelegator=function(t){function e(e,o){t[e]&&(r[e]=function(r){return(n=!n)?{value:s(t[e](r)),done:"return"===e}:o?o(r):r})}var r,n;return r={},e("next"),e("throw",function(t){throw t}),e("return"),r[Symbol.iterator]=function(){return this},r},t.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):"function"==typeof o?o(t):t[Symbol.iterator]()},t.__makeTemplateObject=function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=util.min.js.map
export * from "./array";
export * from "./cache";
export * from "./debounce";
export * from "./dictionary";

@@ -4,0 +5,0 @@ export * from "./esp";

export * from "./array";
export * from "./cache";
export * from "./debounce";
export * from "./dictionary";

@@ -4,0 +5,0 @@ export * from "./esp";

@@ -14,2 +14,4 @@ import { IObserverHandle } from "./observer";

private _events;
private _monitorHandle;
protected _monitorTickCount: number;
protected clear(newVals?: Partial<I>): void;

@@ -29,2 +31,6 @@ protected get(): U;

protected hasEventListener(): boolean;
protected refresh(full?: boolean): Promise<this>;
protected _monitor(): void;
protected _monitorTimeoutDuraction(): number;
watch(callback: StateCallback, triggerChange?: boolean): IObserverHandle;
}

@@ -0,1 +1,2 @@

import * as tslib_1 from "tslib";
import { hashSum } from "./hashSum";

@@ -8,2 +9,3 @@ import { Observable } from "./observer";

this._events = new Observable();
this._monitorTickCount = 0;
}

@@ -16,2 +18,3 @@ StateObject.prototype.clear = function (newVals) {

}
this._monitorTickCount = 0;
};

@@ -112,2 +115,59 @@ StateObject.prototype.get = function (key, defValue) {

};
// Monitoring ---
StateObject.prototype.refresh = function (full) {
if (full === void 0) { full = false; }
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.resolve()];
case 1:
_a.sent();
return [2 /*return*/, this];
}
});
});
};
StateObject.prototype._monitor = function () {
var _this = this;
if (this._monitorHandle) {
this._monitorTickCount = 0;
return;
}
this._monitorHandle = setTimeout(function () {
var refreshPromise = _this.hasEventListener() ? _this.refresh(true) : Promise.resolve();
refreshPromise.then(function () {
_this._monitor();
});
delete _this._monitorHandle;
}, this._monitorTimeoutDuraction());
};
StateObject.prototype._monitorTimeoutDuraction = function () {
++this._monitorTickCount;
if (this._monitorTickCount <= 1) {
return 0;
}
return 30000;
};
StateObject.prototype.watch = function (callback, triggerChange) {
var _this = this;
if (triggerChange === void 0) { triggerChange = true; }
if (typeof callback !== "function") {
throw new Error("Invalid Callback");
}
if (triggerChange) {
setTimeout(function () {
var props = _this.get();
var changes = [];
for (var key in props) {
if (props.hasOwnProperty(props)) {
changes.push({ id: key, newValue: props[key], oldValue: undefined });
}
}
callback(changes);
}, 0);
}
var retVal = this.addObserver("changed", callback);
this._monitor();
return retVal;
};
return StateObject;

@@ -114,0 +174,0 @@ }());

export * from "./array";
export * from "./cache";
export * from "./debounce";
export * from "./dictionary";

@@ -4,0 +5,0 @@ export * from "./esp";

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "tslib", "./array", "./cache", "./dictionary", "./esp", "./graph", "./hashSum", "./loader", "./logging", "./object", "./observer", "./platform", "./saxParser", "./stack", "./stateful", "./string", "./url", "tslib"], factory);
define(["require", "exports", "tslib", "./array", "./cache", "./debounce", "./dictionary", "./esp", "./graph", "./hashSum", "./loader", "./logging", "./object", "./observer", "./platform", "./saxParser", "./stack", "./stateful", "./string", "./url", "tslib"], factory);
}

@@ -16,2 +16,3 @@ })(function (require, exports) {

tslib_1.__exportStar(require("./cache"), exports);
tslib_1.__exportStar(require("./debounce"), exports);
tslib_1.__exportStar(require("./dictionary"), exports);

@@ -18,0 +19,0 @@ tslib_1.__exportStar(require("./esp"), exports);

@@ -14,2 +14,4 @@ import { IObserverHandle } from "./observer";

private _events;
private _monitorHandle;
protected _monitorTickCount: number;
protected clear(newVals?: Partial<I>): void;

@@ -29,2 +31,6 @@ protected get(): U;

protected hasEventListener(): boolean;
protected refresh(full?: boolean): Promise<this>;
protected _monitor(): void;
protected _monitorTimeoutDuraction(): number;
watch(callback: StateCallback, triggerChange?: boolean): IObserverHandle;
}

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./hashSum", "./observer"], factory);
define(["require", "exports", "tslib", "./hashSum", "./observer"], factory);
}

@@ -13,2 +13,3 @@ })(function (require, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var hashSum_1 = require("./hashSum");

@@ -21,2 +22,3 @@ var observer_1 = require("./observer");

this._events = new observer_1.Observable();
this._monitorTickCount = 0;
}

@@ -29,2 +31,3 @@ StateObject.prototype.clear = function (newVals) {

}
this._monitorTickCount = 0;
};

@@ -125,2 +128,59 @@ StateObject.prototype.get = function (key, defValue) {

};
// Monitoring ---
StateObject.prototype.refresh = function (full) {
if (full === void 0) { full = false; }
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.resolve()];
case 1:
_a.sent();
return [2 /*return*/, this];
}
});
});
};
StateObject.prototype._monitor = function () {
var _this = this;
if (this._monitorHandle) {
this._monitorTickCount = 0;
return;
}
this._monitorHandle = setTimeout(function () {
var refreshPromise = _this.hasEventListener() ? _this.refresh(true) : Promise.resolve();
refreshPromise.then(function () {
_this._monitor();
});
delete _this._monitorHandle;
}, this._monitorTimeoutDuraction());
};
StateObject.prototype._monitorTimeoutDuraction = function () {
++this._monitorTickCount;
if (this._monitorTickCount <= 1) {
return 0;
}
return 30000;
};
StateObject.prototype.watch = function (callback, triggerChange) {
var _this = this;
if (triggerChange === void 0) { triggerChange = true; }
if (typeof callback !== "function") {
throw new Error("Invalid Callback");
}
if (triggerChange) {
setTimeout(function () {
var props = _this.get();
var changes = [];
for (var key in props) {
if (props.hasOwnProperty(props)) {
changes.push({ id: key, newValue: props[key], oldValue: undefined });
}
}
callback(changes);
}, 0);
}
var retVal = this.addObserver("changed", callback);
this._monitor();
return retVal;
};
return StateObject;

@@ -127,0 +187,0 @@ }());

{
"name": "@hpcc-js/util",
"version": "0.0.41",
"version": "0.0.42",
"description": "hpcc-js - Utilities",

@@ -8,2 +8,3 @@ "main": "lib/index.js",

"types": "lib/index.d.ts",
"unpkg": "dist/util.min.js",
"files": [

@@ -19,3 +20,6 @@ "lib/*",

"build-es6": "tsc --module esnext --outDir ./lib-es6",
"watch-es6": "tsc -w --module esnext --outDir ./lib-es6",
"bundle": "node ./node_modules/@hpcc-js/bundle/lib/rollup",
"watch-bundle": "node ./node_modules/@hpcc-js/bundle/lib/watch",
"watch": "concurrently --kill-others \"npm run watch-es6\" \"npm run watch-bundle\"",
"docs": "typedoc --options tdoptions.json ."

@@ -27,3 +31,4 @@ },

"devDependencies": {
"@hpcc-js/bundle": "^0.0.14",
"@hpcc-js/bundle": "^0.0.15",
"concurrently": "3.5.0",
"rimraf": "2.6.1",

@@ -30,0 +35,0 @@ "typedoc": "0.7.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc