@hpcc-js/util 2.52.0 → 3.1.0
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/index.js +1 -2590
- package/dist/index.js.map +7 -1
- package/package.json +27 -31
- package/src/__package__.ts +2 -2
- package/src/array.ts +1 -2
- package/src/cache.ts +1 -1
- package/src/debounce.ts +4 -4
- package/src/dispatch.ts +5 -5
- package/src/graph2.ts +1 -1
- package/src/index.ts +21 -21
- package/src/logging.ts +2 -2
- package/src/saxParser.ts +4 -4
- package/src/stateful.ts +4 -4
- package/src/url.ts +1 -1
- package/types/__package__.d.ts +2 -3
- package/types/array.d.ts +0 -1
- package/types/cache.d.ts +0 -1
- package/types/debounce.d.ts +0 -1
- package/types/dictionary.d.ts +0 -1
- package/types/dispatch.d.ts +1 -2
- package/types/esp.d.ts +0 -1
- package/types/graph.d.ts +0 -1
- package/types/graph2.d.ts +0 -1
- package/types/hashSum.d.ts +0 -1
- package/types/immutable.d.ts +0 -1
- package/types/index.d.ts +21 -22
- package/types/logging.d.ts +0 -1
- package/types/math.d.ts +0 -1
- package/types/object.d.ts +0 -1
- package/types/observer.d.ts +0 -1
- package/types/platform.d.ts +0 -1
- package/types/saxParser.d.ts +4 -5
- package/types/stack.d.ts +0 -1
- package/types/stateful.d.ts +1 -2
- package/types/string.d.ts +0 -1
- package/types/url.d.ts +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/lib-es6/__package__.js +0 -4
- package/lib-es6/__package__.js.map +0 -1
- package/lib-es6/array.js +0 -85
- package/lib-es6/array.js.map +0 -1
- package/lib-es6/cache.js +0 -61
- package/lib-es6/cache.js.map +0 -1
- package/lib-es6/debounce.js +0 -86
- package/lib-es6/debounce.js.map +0 -1
- package/lib-es6/dictionary.js +0 -62
- package/lib-es6/dictionary.js.map +0 -1
- package/lib-es6/dispatch.js +0 -102
- package/lib-es6/dispatch.js.map +0 -1
- package/lib-es6/esp.js +0 -33
- package/lib-es6/esp.js.map +0 -1
- package/lib-es6/graph.js +0 -349
- package/lib-es6/graph.js.map +0 -1
- package/lib-es6/graph2.js +0 -619
- package/lib-es6/graph2.js.map +0 -1
- package/lib-es6/hashSum.js +0 -50
- package/lib-es6/hashSum.js.map +0 -1
- package/lib-es6/immutable.js +0 -148
- package/lib-es6/immutable.js.map +0 -1
- package/lib-es6/index.js +0 -22
- package/lib-es6/index.js.map +0 -1
- package/lib-es6/logging.js +0 -179
- package/lib-es6/logging.js.map +0 -1
- package/lib-es6/math.js +0 -91
- package/lib-es6/math.js.map +0 -1
- package/lib-es6/object.js +0 -122
- package/lib-es6/object.js.map +0 -1
- package/lib-es6/observer.js +0 -80
- package/lib-es6/observer.js.map +0 -1
- package/lib-es6/platform.js +0 -18
- package/lib-es6/platform.js.map +0 -1
- package/lib-es6/saxParser.js +0 -126
- package/lib-es6/saxParser.js.map +0 -1
- package/lib-es6/stack.js +0 -42
- package/lib-es6/stack.js.map +0 -1
- package/lib-es6/stateful.js +0 -171
- package/lib-es6/stateful.js.map +0 -1
- package/lib-es6/string.js +0 -23
- package/lib-es6/string.js.map +0 -1
- package/lib-es6/url.js +0 -33
- package/lib-es6/url.js.map +0 -1
- package/types/__package__.d.ts.map +0 -1
- package/types/array.d.ts.map +0 -1
- package/types/cache.d.ts.map +0 -1
- package/types/debounce.d.ts.map +0 -1
- package/types/dictionary.d.ts.map +0 -1
- package/types/dispatch.d.ts.map +0 -1
- package/types/esp.d.ts.map +0 -1
- package/types/graph.d.ts.map +0 -1
- package/types/graph2.d.ts.map +0 -1
- package/types/hashSum.d.ts.map +0 -1
- package/types/immutable.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/logging.d.ts.map +0 -1
- package/types/math.d.ts.map +0 -1
- package/types/object.d.ts.map +0 -1
- package/types/observer.d.ts.map +0 -1
- package/types/platform.d.ts.map +0 -1
- package/types/saxParser.d.ts.map +0 -1
- package/types/stack.d.ts.map +0 -1
- package/types/stateful.d.ts.map +0 -1
- package/types/string.d.ts.map +0 -1
- package/types/url.d.ts.map +0 -1
- package/types-3.4/__package__.d.ts +0 -4
- package/types-3.4/array.d.ts +0 -14
- package/types-3.4/cache.d.ts +0 -21
- package/types-3.4/debounce.d.ts +0 -13
- package/types-3.4/dictionary.d.ts +0 -21
- package/types-3.4/dispatch.d.ts +0 -27
- package/types-3.4/esp.d.ts +0 -2
- package/types-3.4/graph.d.ts +0 -74
- package/types-3.4/graph2.d.ts +0 -112
- package/types-3.4/hashSum.d.ts +0 -2
- package/types-3.4/immutable.d.ts +0 -4
- package/types-3.4/index.d.ts +0 -22
- package/types-3.4/logging.d.ts +0 -58
- package/types-3.4/math.d.ts +0 -71
- package/types-3.4/object.d.ts +0 -52
- package/types-3.4/observer.d.ts +0 -19
- package/types-3.4/platform.d.ts +0 -6
- package/types-3.4/saxParser.d.ts +0 -29
- package/types-3.4/stack.d.ts +0 -29
- package/types-3.4/stateful.d.ts +0 -34
- package/types-3.4/string.d.ts +0 -3
- package/types-3.4/url.d.ts +0 -3
package/lib-es6/debounce.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { hashSum } from "./hashSum";
|
|
2
|
-
export function debounce(fn, timeout) {
|
|
3
|
-
var promises = {};
|
|
4
|
-
return function () {
|
|
5
|
-
var params = [];
|
|
6
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
7
|
-
params[_i] = arguments[_i];
|
|
8
|
-
}
|
|
9
|
-
var hash = hashSum(params);
|
|
10
|
-
if (!promises[hash]) {
|
|
11
|
-
promises[hash] = {
|
|
12
|
-
clockStart: Date.now(),
|
|
13
|
-
promise: fn.apply(void 0, params).then(function (response) {
|
|
14
|
-
if (timeout === undefined) {
|
|
15
|
-
promises[hash] = null;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
setTimeout(function () {
|
|
19
|
-
promises[hash] = null;
|
|
20
|
-
}, Math.max(timeout - (Date.now() - promises[hash].clockStart), 0));
|
|
21
|
-
}
|
|
22
|
-
return response;
|
|
23
|
-
}).catch(function (e) {
|
|
24
|
-
promises[hash] = null;
|
|
25
|
-
throw e;
|
|
26
|
-
})
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return promises[hash].promise;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export function promiseTimeout(ms, promise) {
|
|
33
|
-
var id;
|
|
34
|
-
var timeout = new Promise(function (resolve, reject) {
|
|
35
|
-
id = setTimeout(function () {
|
|
36
|
-
clearTimeout(id);
|
|
37
|
-
reject("Timed out in " + ms + "ms.");
|
|
38
|
-
}, ms);
|
|
39
|
-
});
|
|
40
|
-
return Promise.race([
|
|
41
|
-
promise,
|
|
42
|
-
timeout
|
|
43
|
-
]).then(function (response) {
|
|
44
|
-
clearTimeout(id);
|
|
45
|
-
return response;
|
|
46
|
-
}).catch(function (e) {
|
|
47
|
-
clearTimeout(id);
|
|
48
|
-
throw e;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
var AsyncOrderedQueue = /** @class */ (function () {
|
|
52
|
-
function AsyncOrderedQueue() {
|
|
53
|
-
this._q = [];
|
|
54
|
-
}
|
|
55
|
-
AsyncOrderedQueue.prototype.isTop = function (p) {
|
|
56
|
-
return this._q[0] === p;
|
|
57
|
-
};
|
|
58
|
-
AsyncOrderedQueue.prototype.push = function (p) {
|
|
59
|
-
var _this = this;
|
|
60
|
-
var retVal = p.then(function (response) {
|
|
61
|
-
if (_this.isTop(retVal)) {
|
|
62
|
-
_this._q.shift();
|
|
63
|
-
return response;
|
|
64
|
-
}
|
|
65
|
-
return new Promise(function (resolve, reject) {
|
|
66
|
-
var intervalHandler = setInterval(function () {
|
|
67
|
-
if (_this.isTop(retVal)) {
|
|
68
|
-
clearInterval(intervalHandler);
|
|
69
|
-
_this._q.shift();
|
|
70
|
-
resolve(response);
|
|
71
|
-
}
|
|
72
|
-
}, 20);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
this._q.push(retVal);
|
|
76
|
-
return retVal;
|
|
77
|
-
};
|
|
78
|
-
return AsyncOrderedQueue;
|
|
79
|
-
}());
|
|
80
|
-
export { AsyncOrderedQueue };
|
|
81
|
-
export function sleep(ms) {
|
|
82
|
-
return new Promise(function (resolve) {
|
|
83
|
-
setTimeout(function () { return resolve(); }, ms);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=debounce.js.map
|
package/lib-es6/debounce.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../src/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,MAAM,UAAU,QAAQ,CAAiC,EAA8B,EAAE,OAAgB;IACrG,IAAM,QAAQ,GAAiE,EAAE,CAAC;IAElF,OAAO;QAAC,gBAAS;aAAT,UAAS,EAAT,qBAAS,EAAT,IAAS;YAAT,2BAAS;;QACb,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAClB,QAAQ,CAAC,IAAI,CAAC,GAAG;gBACb,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;gBACtB,OAAO,EAAE,EAAE,eAAI,MAAM,EAAE,IAAI,CAAC,UAAA,QAAQ;oBAChC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;wBACxB,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;oBAC1B,CAAC;yBAAM,CAAC;wBACJ,UAAU,CAAC;4BACP,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;wBAC1B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;oBACzE,CAAC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,CAAC;gBACrB,KAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;gBAChB,OAAO,QAAQ,CAAC;YACpB,CAAC;YACD,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;gBAClC,IAAM,eAAe,GAAG,WAAW,CAAC;oBAChC,IAAI,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;wBACrB,aAAa,CAAC,eAAe,CAAC,CAAC;wBAC/B,KAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;wBAChB,OAAO,CAAC,QAAQ,CAAC,CAAC;oBACtB,CAAC;gBACL,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,wBAAC;AAAD,CAAC,AA1BD,IA0BC;;AAED,MAAM,UAAU,KAAK,CAAC,EAAU;IAC5B,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO;QACtB,UAAU,CAAC,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/lib-es6/dictionary.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
var Dictionary = /** @class */ (function () {
|
|
3
|
-
function Dictionary(attrs) {
|
|
4
|
-
this.store = {};
|
|
5
|
-
if (attrs) {
|
|
6
|
-
for (var key in attrs) {
|
|
7
|
-
this.set(key, attrs[key]);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
Dictionary.prototype.set = function (key, value) {
|
|
12
|
-
var retVal = this.store[key];
|
|
13
|
-
this.store[key] = value;
|
|
14
|
-
return retVal;
|
|
15
|
-
};
|
|
16
|
-
Dictionary.prototype.get = function (key) {
|
|
17
|
-
return this.store[key];
|
|
18
|
-
};
|
|
19
|
-
Dictionary.prototype.has = function (key) {
|
|
20
|
-
return this.store[key] !== undefined;
|
|
21
|
-
};
|
|
22
|
-
Dictionary.prototype.remove = function (key) {
|
|
23
|
-
delete this.store[key];
|
|
24
|
-
};
|
|
25
|
-
Dictionary.prototype.keys = function () {
|
|
26
|
-
var retVal = [];
|
|
27
|
-
for (var key in this.store) {
|
|
28
|
-
retVal.push(key);
|
|
29
|
-
}
|
|
30
|
-
return retVal;
|
|
31
|
-
};
|
|
32
|
-
Dictionary.prototype.values = function () {
|
|
33
|
-
var retVal = [];
|
|
34
|
-
for (var key in this.store) {
|
|
35
|
-
retVal.push(this.store[key]);
|
|
36
|
-
}
|
|
37
|
-
return retVal;
|
|
38
|
-
};
|
|
39
|
-
return Dictionary;
|
|
40
|
-
}());
|
|
41
|
-
export { Dictionary };
|
|
42
|
-
var DictionaryNoCase = /** @class */ (function (_super) {
|
|
43
|
-
__extends(DictionaryNoCase, _super);
|
|
44
|
-
function DictionaryNoCase(attrs) {
|
|
45
|
-
return _super.call(this, attrs) || this;
|
|
46
|
-
}
|
|
47
|
-
DictionaryNoCase.prototype.set = function (key, value) {
|
|
48
|
-
return _super.prototype.set.call(this, key.toLowerCase(), value);
|
|
49
|
-
};
|
|
50
|
-
DictionaryNoCase.prototype.get = function (key) {
|
|
51
|
-
return _super.prototype.get.call(this, key.toLowerCase());
|
|
52
|
-
};
|
|
53
|
-
DictionaryNoCase.prototype.has = function (key) {
|
|
54
|
-
return _super.prototype.has.call(this, key.toLowerCase());
|
|
55
|
-
};
|
|
56
|
-
DictionaryNoCase.prototype.remove = function (key) {
|
|
57
|
-
return _super.prototype.remove.call(this, key.toLowerCase());
|
|
58
|
-
};
|
|
59
|
-
return DictionaryNoCase;
|
|
60
|
-
}(Dictionary));
|
|
61
|
-
export { DictionaryNoCase };
|
|
62
|
-
//# sourceMappingURL=dictionary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|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jC,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,iBAAC;AAAD,CAAC,AA5CD,IA4CC;;AAED;IAAyC,oCAAa;IAClD,0BAAY,KAAoB;QAC5B,OAAA,MAAK,YAAC,KAAK,CAAC,SAAC;IACjB,CAAC;IAED,8BAAG,GAAH,UAAI,GAAW,EAAE,KAAQ;QACrB,OAAO,gBAAK,CAAC,GAAG,YAAC,GAAG,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,8BAAG,GAAH,UAAI,GAAW;QACX,OAAO,gBAAK,CAAC,GAAG,YAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,8BAAG,GAAH,UAAI,GAAW;QACX,OAAO,gBAAK,CAAC,GAAG,YAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,iCAAM,GAAN,UAAO,GAAW;QACd,OAAO,gBAAK,CAAC,MAAM,YAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3C,CAAC;IACL,uBAAC;AAAD,CAAC,AApBD,CAAyC,UAAU,GAoBlD"}
|
package/lib-es6/dispatch.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { root } from "./platform";
|
|
2
|
-
var requestAnimationFrame;
|
|
3
|
-
// let cancelAnimationFrame: CancelAnimationFrame;
|
|
4
|
-
(function () {
|
|
5
|
-
if (root.requestAnimationFrame) {
|
|
6
|
-
requestAnimationFrame = root.requestAnimationFrame;
|
|
7
|
-
// cancelAnimationFrame = root.cancelAnimationFrame;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
var lastTime_1 = 0;
|
|
11
|
-
requestAnimationFrame = function (callback) {
|
|
12
|
-
var currTime = new Date().getTime();
|
|
13
|
-
var timeToCall = Math.max(0, 16 - (currTime - lastTime_1));
|
|
14
|
-
var id = setTimeout(function () { return callback(currTime + timeToCall); }, timeToCall);
|
|
15
|
-
lastTime_1 = currTime + timeToCall;
|
|
16
|
-
return id;
|
|
17
|
-
};
|
|
18
|
-
// cancelAnimationFrame = function (handle: number): void {
|
|
19
|
-
// clearTimeout(handle);
|
|
20
|
-
// };
|
|
21
|
-
}
|
|
22
|
-
})();
|
|
23
|
-
var Message = /** @class */ (function () {
|
|
24
|
-
function Message() {
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(Message.prototype, "canConflate", {
|
|
27
|
-
get: function () { return false; },
|
|
28
|
-
enumerable: false,
|
|
29
|
-
configurable: true
|
|
30
|
-
});
|
|
31
|
-
Message.prototype.conflate = function (other) {
|
|
32
|
-
return false;
|
|
33
|
-
};
|
|
34
|
-
Message.prototype.void = function () {
|
|
35
|
-
return false;
|
|
36
|
-
};
|
|
37
|
-
return Message;
|
|
38
|
-
}());
|
|
39
|
-
export { Message };
|
|
40
|
-
var Dispatch = /** @class */ (function () {
|
|
41
|
-
function Dispatch() {
|
|
42
|
-
this._observerID = 0;
|
|
43
|
-
this._observers = [];
|
|
44
|
-
this._messageBuffer = [];
|
|
45
|
-
}
|
|
46
|
-
Dispatch.prototype.observers = function () {
|
|
47
|
-
return this._observers;
|
|
48
|
-
};
|
|
49
|
-
Dispatch.prototype.messages = function () {
|
|
50
|
-
var retVal = [];
|
|
51
|
-
this._messageBuffer.forEach(function (msg) {
|
|
52
|
-
if (!retVal.some(function (msg2) { return msg2.canConflate && msg2.conflate(msg); })) {
|
|
53
|
-
retVal.push(msg);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return retVal;
|
|
57
|
-
};
|
|
58
|
-
Dispatch.prototype.dispatchAll = function () {
|
|
59
|
-
this.dispatch(this.messages());
|
|
60
|
-
this.flush();
|
|
61
|
-
};
|
|
62
|
-
Dispatch.prototype.dispatch = function (messages) {
|
|
63
|
-
if (messages.length === 0)
|
|
64
|
-
return;
|
|
65
|
-
this.observers().forEach(function (o) {
|
|
66
|
-
var msgs = messages.filter(function (m) { return !m.void() && (o.type === undefined || m instanceof o.type); });
|
|
67
|
-
if (msgs.length) {
|
|
68
|
-
o.callback(msgs);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
Dispatch.prototype.hasObserver = function () {
|
|
73
|
-
return this._observers.length > 0;
|
|
74
|
-
};
|
|
75
|
-
Dispatch.prototype.flush = function () {
|
|
76
|
-
this._messageBuffer = [];
|
|
77
|
-
};
|
|
78
|
-
Dispatch.prototype.send = function (msg) {
|
|
79
|
-
this.dispatch([msg]);
|
|
80
|
-
};
|
|
81
|
-
Dispatch.prototype.post = function (msg) {
|
|
82
|
-
var _this = this;
|
|
83
|
-
this._messageBuffer.push(msg);
|
|
84
|
-
requestAnimationFrame(function () { return _this.dispatchAll(); });
|
|
85
|
-
};
|
|
86
|
-
Dispatch.prototype.attach = function (callback, type) {
|
|
87
|
-
var context = this;
|
|
88
|
-
var id = ++this._observerID;
|
|
89
|
-
this._observers.push({ id: id, type: type, callback: callback });
|
|
90
|
-
return {
|
|
91
|
-
release: function () {
|
|
92
|
-
context._observers = context._observers.filter(function (o) { return o.id !== id; });
|
|
93
|
-
},
|
|
94
|
-
unwatch: function () {
|
|
95
|
-
this.release();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
return Dispatch;
|
|
100
|
-
}());
|
|
101
|
-
export { Dispatch };
|
|
102
|
-
//# sourceMappingURL=dispatch.js.map
|
package/lib-es6/dispatch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKlC,IAAI,qBAA2C,CAAC;AAChD,kDAAkD;AAElD,CAAC;IACG,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;QACnD,oDAAoD;IACxD,CAAC;SAAM,CAAC;Q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AAkB,CAAC,CAAC;IACpD,CAAC;IAED,yBAAM,GAAN,UAAO,QAAqB,EAAE,IAA4B;QACtD,IAAM,OAAO,GAAG,IAAI,CAAC;QACrB,IAAM,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,IAAA,EAAE,IAAI,MAAA,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC;QAC7C,OAAO;YACH,OAAO;gBACH,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,EAAE,KAAK,EAAE,EAAX,CAAW,CAAC,CAAC;YACrE,CAAC;YACD,OAAO;gBACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;SACJ,CAAC;IACN,CAAC;IACL,eAAC;AAAD,CAAC,AApED,IAoEC"}
|
package/lib-es6/esp.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export function espTime2Seconds(duration) {
|
|
2
|
-
if (!duration) {
|
|
3
|
-
return 0;
|
|
4
|
-
}
|
|
5
|
-
else {
|
|
6
|
-
if (!isNaN(Number(duration))) {
|
|
7
|
-
return Number(duration);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
// GH: <n>ns or <m>ms or <s>s or [<d> days ][<h>:][<m>:]<s>[.<ms>]
|
|
11
|
-
var nsIndex = duration.indexOf("ns");
|
|
12
|
-
if (nsIndex !== -1) {
|
|
13
|
-
return parseFloat(duration.substr(0, nsIndex)) / 1000000000;
|
|
14
|
-
}
|
|
15
|
-
var msIndex = duration.indexOf("ms");
|
|
16
|
-
if (msIndex !== -1) {
|
|
17
|
-
return parseFloat(duration.substr(0, msIndex)) / 1000;
|
|
18
|
-
}
|
|
19
|
-
var sIndex = duration.indexOf("s");
|
|
20
|
-
if (sIndex !== -1 && duration.indexOf("days") === -1) {
|
|
21
|
-
return parseFloat(duration.substr(0, sIndex));
|
|
22
|
-
}
|
|
23
|
-
var dayTimeParts = duration.split(" days ");
|
|
24
|
-
var days = dayTimeParts.length > 1 ? parseFloat(dayTimeParts[0]) : 0.0;
|
|
25
|
-
var time = dayTimeParts.length > 1 ? dayTimeParts[1] : dayTimeParts[0];
|
|
26
|
-
var secs = 0.0;
|
|
27
|
-
var timeParts = time.split(":").reverse();
|
|
28
|
-
for (var j = 0; j < timeParts.length; ++j) {
|
|
29
|
-
secs += parseFloat(timeParts[j]) * Math.pow(60, j);
|
|
30
|
-
}
|
|
31
|
-
return (days * 24 * 60 * 60) + secs;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=esp.js.map
|
package/lib-es6/esp.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esp.js","sourceRoot":"","sources":["../src/esp.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,CAAC,CAAC;IACb,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;IACD,oEAAoE;IACpE,IAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,CAAC;IAChE,CAAC;IACD,IAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,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** @class */ (function () {
|
|
3
|
-
function GraphItem(graph, parent) {
|
|
4
|
-
this.props = {};
|
|
5
|
-
this._graph = graph;
|
|
6
|
-
this.parent = parent;
|
|
7
|
-
}
|
|
8
|
-
return GraphItem;
|
|
9
|
-
}());
|
|
10
|
-
export { GraphItem };
|
|
11
|
-
var Subgraph = /** @class */ (function (_super) {
|
|
12
|
-
__extends(Subgraph, _super);
|
|
13
|
-
function Subgraph(graph, parent, _) {
|
|
14
|
-
var _this = _super.call(this, graph, parent) || this;
|
|
15
|
-
_this.subgraphs = [];
|
|
16
|
-
_this.vertices = [];
|
|
17
|
-
_this.edges = [];
|
|
18
|
-
if (parent) { // Only needed for dummy root
|
|
19
|
-
parent._addSubgraph(_this);
|
|
20
|
-
}
|
|
21
|
-
_this._ = _;
|
|
22
|
-
return _this;
|
|
23
|
-
}
|
|
24
|
-
Subgraph.prototype.remove = function (full) {
|
|
25
|
-
if (full === void 0) { full = true; }
|
|
26
|
-
this._graph.removeSubgraph(this, full);
|
|
27
|
-
};
|
|
28
|
-
Subgraph.prototype.createSubgraph = function (_) {
|
|
29
|
-
return this._graph.createSubgraph(this, _);
|
|
30
|
-
};
|
|
31
|
-
Subgraph.prototype._addSubgraph = function (subgraph) {
|
|
32
|
-
if (this.subgraphs.indexOf(subgraph) >= 0) {
|
|
33
|
-
throw new Error("Subgraph already exists");
|
|
34
|
-
}
|
|
35
|
-
this.subgraphs.push(subgraph);
|
|
36
|
-
};
|
|
37
|
-
Subgraph.prototype._removeSubgraph = function (subgraph) {
|
|
38
|
-
var idx = this.subgraphs.indexOf(subgraph);
|
|
39
|
-
if (idx < 0) {
|
|
40
|
-
throw new Error("Subgraph does not exist");
|
|
41
|
-
}
|
|
42
|
-
this.subgraphs.splice(idx, 1);
|
|
43
|
-
};
|
|
44
|
-
Subgraph.prototype.removeAllSubgraphs = function () {
|
|
45
|
-
for (var i = this.subgraphs.length - 1; i >= 0; --i) {
|
|
46
|
-
this._graph.removeSubgraph(this.subgraphs[i], true);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Subgraph.prototype.createVertex = function (_) {
|
|
50
|
-
return this._graph.createVertex(this, _);
|
|
51
|
-
};
|
|
52
|
-
Subgraph.prototype._addVertex = function (vertex) {
|
|
53
|
-
if (this.vertices.indexOf(vertex) >= 0) {
|
|
54
|
-
throw new Error("Vertex already exists");
|
|
55
|
-
}
|
|
56
|
-
this.vertices.push(vertex);
|
|
57
|
-
};
|
|
58
|
-
Subgraph.prototype._removeVertex = function (vertex) {
|
|
59
|
-
var idx = this.vertices.indexOf(vertex);
|
|
60
|
-
if (idx < 0) {
|
|
61
|
-
throw new Error("Vertex does not exist");
|
|
62
|
-
}
|
|
63
|
-
this.vertices.splice(idx, 1);
|
|
64
|
-
};
|
|
65
|
-
Subgraph.prototype.removeAllVertices = function () {
|
|
66
|
-
for (var i = this.vertices.length - 1; i >= 0; --i) {
|
|
67
|
-
this._graph.removeVertex(this.vertices[i], true);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
Subgraph.prototype.createEdge = function (source, target, _) {
|
|
71
|
-
return this._graph.createEdge(this, source, target, _);
|
|
72
|
-
};
|
|
73
|
-
Subgraph.prototype._addEdge = function (edge) {
|
|
74
|
-
if (this.edges.indexOf(edge) >= 0) {
|
|
75
|
-
throw new Error("Edge already exists");
|
|
76
|
-
}
|
|
77
|
-
this.edges.push(edge);
|
|
78
|
-
};
|
|
79
|
-
Subgraph.prototype._removeEdge = function (edge) {
|
|
80
|
-
var idx = this.edges.indexOf(edge);
|
|
81
|
-
if (idx < 0) {
|
|
82
|
-
throw new Error("Edge does not exist");
|
|
83
|
-
}
|
|
84
|
-
this.edges.splice(idx, 1);
|
|
85
|
-
};
|
|
86
|
-
Subgraph.prototype._add = function (item) {
|
|
87
|
-
if (item instanceof Subgraph) {
|
|
88
|
-
this._addSubgraph(item);
|
|
89
|
-
}
|
|
90
|
-
else if (item instanceof Vertex) {
|
|
91
|
-
this._addVertex(item);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this._addEdge(item);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
return Subgraph;
|
|
98
|
-
}(GraphItem));
|
|
99
|
-
export { Subgraph };
|
|
100
|
-
var Vertex = /** @class */ (function (_super) {
|
|
101
|
-
__extends(Vertex, _super);
|
|
102
|
-
function Vertex(graph, parent, _) {
|
|
103
|
-
var _this = _super.call(this, graph, parent) || this;
|
|
104
|
-
_this.inEdges = [];
|
|
105
|
-
_this.outEdges = [];
|
|
106
|
-
parent._addVertex(_this);
|
|
107
|
-
_this._ = _;
|
|
108
|
-
return _this;
|
|
109
|
-
}
|
|
110
|
-
Object.defineProperty(Vertex.prototype, "edges", {
|
|
111
|
-
get: function () {
|
|
112
|
-
return __spreadArray(__spreadArray([], this.inEdges, true), this.outEdges, true);
|
|
113
|
-
},
|
|
114
|
-
enumerable: false,
|
|
115
|
-
configurable: true
|
|
116
|
-
});
|
|
117
|
-
Vertex.prototype.remove = function (full, _) {
|
|
118
|
-
if (full === void 0) { full = true; }
|
|
119
|
-
return this._graph.removeVertex(this, full, _);
|
|
120
|
-
};
|
|
121
|
-
Vertex.prototype.addInEdge = function (edge) {
|
|
122
|
-
this.inEdges.push(edge);
|
|
123
|
-
};
|
|
124
|
-
Vertex.prototype.removeInEdge = function (edge) {
|
|
125
|
-
var idx = this.inEdges.indexOf(edge);
|
|
126
|
-
if (idx < 0) {
|
|
127
|
-
throw new Error("In edge does not exist");
|
|
128
|
-
}
|
|
129
|
-
this.inEdges.splice(idx, 1);
|
|
130
|
-
};
|
|
131
|
-
Vertex.prototype.addOutEdge = function (edge) {
|
|
132
|
-
this.outEdges.push(edge);
|
|
133
|
-
};
|
|
134
|
-
Vertex.prototype.removeOutEdge = function (edge) {
|
|
135
|
-
var idx = this.outEdges.indexOf(edge);
|
|
136
|
-
if (idx < 0) {
|
|
137
|
-
throw new Error("Out edge does not exist");
|
|
138
|
-
}
|
|
139
|
-
this.outEdges.splice(idx, 1);
|
|
140
|
-
};
|
|
141
|
-
return Vertex;
|
|
142
|
-
}(GraphItem));
|
|
143
|
-
export { Vertex };
|
|
144
|
-
var Edge = /** @class */ (function (_super) {
|
|
145
|
-
__extends(Edge, _super);
|
|
146
|
-
function Edge(graph, parent, source, target, _) {
|
|
147
|
-
var _this = _super.call(this, graph, parent) || this;
|
|
148
|
-
if (!source) {
|
|
149
|
-
throw new Error("Missing source vertex");
|
|
150
|
-
}
|
|
151
|
-
if (!target) {
|
|
152
|
-
throw new Error("Missing target vertex");
|
|
153
|
-
}
|
|
154
|
-
parent._addEdge(_this);
|
|
155
|
-
_this.source = source;
|
|
156
|
-
_this.source.addOutEdge(_this);
|
|
157
|
-
_this.target = target;
|
|
158
|
-
_this.target.addInEdge(_this);
|
|
159
|
-
_this._ = _;
|
|
160
|
-
return _this;
|
|
161
|
-
}
|
|
162
|
-
Edge.prototype.remove = function () {
|
|
163
|
-
this._graph.removeEdge(this);
|
|
164
|
-
};
|
|
165
|
-
return Edge;
|
|
166
|
-
}(GraphItem));
|
|
167
|
-
export { Edge };
|
|
168
|
-
var Graph = /** @class */ (function () {
|
|
169
|
-
function Graph(idOf, _) {
|
|
170
|
-
if (idOf === void 0) { idOf = function (item) { return "" + item._; }; }
|
|
171
|
-
this._allSubgraphs = [];
|
|
172
|
-
this._allSubgraphsMap = {};
|
|
173
|
-
this._allVertices = [];
|
|
174
|
-
this._allVerticesMap = {};
|
|
175
|
-
this._allEdges = [];
|
|
176
|
-
this._allEdgesMap = {};
|
|
177
|
-
this.root = new Subgraph(this, null, _);
|
|
178
|
-
this.idOf = idOf;
|
|
179
|
-
}
|
|
180
|
-
Graph.prototype.createSubgraph = function (parent, _) {
|
|
181
|
-
var retVal = new Subgraph(this, parent || this.root, _);
|
|
182
|
-
this._allSubgraphs.push(retVal);
|
|
183
|
-
this._allSubgraphsMap[this.idOf(retVal)] = retVal;
|
|
184
|
-
return retVal;
|
|
185
|
-
};
|
|
186
|
-
Graph.prototype.removeSubgraph = function (subgraph, full) {
|
|
187
|
-
var _this = this;
|
|
188
|
-
if (full === void 0) { full = true; }
|
|
189
|
-
var idx = this._allSubgraphs.indexOf(subgraph);
|
|
190
|
-
if (idx < 0) {
|
|
191
|
-
throw new Error("Subgraph does not exist");
|
|
192
|
-
}
|
|
193
|
-
this._allSubgraphs.splice(idx, 1);
|
|
194
|
-
delete this._allSubgraphsMap[this.idOf(subgraph)];
|
|
195
|
-
if (subgraph.parent) {
|
|
196
|
-
subgraph.parent._removeSubgraph(subgraph);
|
|
197
|
-
}
|
|
198
|
-
subgraph.edges.forEach(function (edge) { return full ? _this.removeEdge(edge) : subgraph.parent._addEdge(edge); });
|
|
199
|
-
subgraph.vertices.forEach(function (vertex) { return full ? _this.removeVertex(vertex, full) : subgraph.parent._addVertex(vertex); });
|
|
200
|
-
subgraph.subgraphs.forEach(function (childSubgraph) { return full ? _this.removeSubgraph(childSubgraph, full) : subgraph.parent._addSubgraph(childSubgraph); });
|
|
201
|
-
};
|
|
202
|
-
Object.defineProperty(Graph.prototype, "subgraphs", {
|
|
203
|
-
get: function () {
|
|
204
|
-
return this._allSubgraphs;
|
|
205
|
-
},
|
|
206
|
-
enumerable: false,
|
|
207
|
-
configurable: true
|
|
208
|
-
});
|
|
209
|
-
Graph.prototype.subgraph = function (id) {
|
|
210
|
-
return this._allSubgraphsMap[id];
|
|
211
|
-
};
|
|
212
|
-
Graph.prototype.createVertex = function (parent, _) {
|
|
213
|
-
var retVal = new Vertex(this, parent, _);
|
|
214
|
-
this._allVertices.push(retVal);
|
|
215
|
-
this._allVerticesMap[this.idOf(retVal)] = retVal;
|
|
216
|
-
return retVal;
|
|
217
|
-
};
|
|
218
|
-
Graph.prototype.removeVertex = function (vertex, full, _) {
|
|
219
|
-
var _this = this;
|
|
220
|
-
if (full === void 0) { full = true; }
|
|
221
|
-
var idx = this._allVertices.indexOf(vertex);
|
|
222
|
-
if (idx < 0) {
|
|
223
|
-
throw new Error("Vertex does not exist");
|
|
224
|
-
}
|
|
225
|
-
this._allVertices.splice(idx, 1);
|
|
226
|
-
delete this._allVerticesMap[this.idOf(vertex)];
|
|
227
|
-
if (vertex.parent) {
|
|
228
|
-
vertex.parent._removeVertex(vertex);
|
|
229
|
-
}
|
|
230
|
-
if (!full) {
|
|
231
|
-
vertex.inEdges.forEach(function (inEdge) {
|
|
232
|
-
vertex.outEdges.forEach(function (outEdge) {
|
|
233
|
-
_this.createEdge(_this.root, inEdge.source, outEdge.target, _ ? _(inEdge.source._, outEdge.target._) : undefined);
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
vertex.inEdges.forEach(function (edge) { return _this.removeEdge(edge); });
|
|
238
|
-
vertex.outEdges.forEach(function (edge) { return _this.removeEdge(edge); });
|
|
239
|
-
};
|
|
240
|
-
Object.defineProperty(Graph.prototype, "vertices", {
|
|
241
|
-
get: function () {
|
|
242
|
-
return this._allVertices;
|
|
243
|
-
},
|
|
244
|
-
enumerable: false,
|
|
245
|
-
configurable: true
|
|
246
|
-
});
|
|
247
|
-
Graph.prototype.vertex = function (id) {
|
|
248
|
-
return this._allVerticesMap[id];
|
|
249
|
-
};
|
|
250
|
-
Graph.prototype.createEdge = function (parent, source, target, _) {
|
|
251
|
-
var retVal = new Edge(this, parent, source, target, _);
|
|
252
|
-
this._allEdges.push(retVal);
|
|
253
|
-
this._allEdgesMap[this.idOf(retVal)] = retVal;
|
|
254
|
-
return retVal;
|
|
255
|
-
};
|
|
256
|
-
Graph.prototype.removeEdge = function (edge) {
|
|
257
|
-
var idx = this._allEdges.indexOf(edge);
|
|
258
|
-
if (idx < 0) {
|
|
259
|
-
throw new Error("Edge does not exist");
|
|
260
|
-
}
|
|
261
|
-
this._allEdges.splice(idx, 1);
|
|
262
|
-
delete this._allEdgesMap[this.idOf(edge)];
|
|
263
|
-
if (edge.parent) {
|
|
264
|
-
edge.parent._removeEdge(edge);
|
|
265
|
-
}
|
|
266
|
-
edge.source.removeOutEdge(edge);
|
|
267
|
-
edge.target.removeInEdge(edge);
|
|
268
|
-
};
|
|
269
|
-
Object.defineProperty(Graph.prototype, "edges", {
|
|
270
|
-
get: function () {
|
|
271
|
-
return this._allEdges;
|
|
272
|
-
},
|
|
273
|
-
enumerable: false,
|
|
274
|
-
configurable: true
|
|
275
|
-
});
|
|
276
|
-
Graph.prototype.edge = function (id) {
|
|
277
|
-
return this._allEdgesMap[id];
|
|
278
|
-
};
|
|
279
|
-
Graph.prototype._walk = function (parent, visitor) {
|
|
280
|
-
for (var _i = 0, _a = parent.subgraphs; _i < _a.length; _i++) {
|
|
281
|
-
var subgraph = _a[_i];
|
|
282
|
-
switch (visitor(subgraph)) {
|
|
283
|
-
case "abort":
|
|
284
|
-
return true;
|
|
285
|
-
case "stepover":
|
|
286
|
-
break;
|
|
287
|
-
default:
|
|
288
|
-
if (this._walk(subgraph, visitor))
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
for (var _b = 0, _c = parent.vertices; _b < _c.length; _b++) {
|
|
293
|
-
var vertex = _c[_b];
|
|
294
|
-
if (visitor(vertex) === "abort")
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
Graph.prototype.walk = function (visitor) {
|
|
299
|
-
this._walk(this.root, visitor);
|
|
300
|
-
for (var _i = 0, _a = this._allEdges; _i < _a.length; _i++) {
|
|
301
|
-
var edge = _a[_i];
|
|
302
|
-
if (visitor(edge) === "abort")
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
Graph.prototype.clone = function () {
|
|
307
|
-
var ctor = this.constructor;
|
|
308
|
-
var retVal = new ctor(this.idOf, this.root._);
|
|
309
|
-
var map = ObjMap();
|
|
310
|
-
map.put(this.root, retVal.root);
|
|
311
|
-
this.walk(function (item) {
|
|
312
|
-
var parent = map.get(item.parent);
|
|
313
|
-
if (item instanceof Subgraph) {
|
|
314
|
-
map.put(item, parent.createSubgraph(item._));
|
|
315
|
-
}
|
|
316
|
-
else if (item instanceof Vertex) {
|
|
317
|
-
map.put(item, parent.createVertex(item._));
|
|
318
|
-
}
|
|
319
|
-
else if (item instanceof Edge) {
|
|
320
|
-
var source = map.get(item.source);
|
|
321
|
-
var target = map.get(item.target);
|
|
322
|
-
parent.createEdge(source, target, item._);
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
return retVal;
|
|
326
|
-
};
|
|
327
|
-
return Graph;
|
|
328
|
-
}());
|
|
329
|
-
export { Graph };
|
|
330
|
-
function ObjMap() {
|
|
331
|
-
var keys = [];
|
|
332
|
-
var values = [];
|
|
333
|
-
return {
|
|
334
|
-
put: function (key, value) {
|
|
335
|
-
var index = keys.indexOf(key);
|
|
336
|
-
if (index === -1) {
|
|
337
|
-
keys.push(key);
|
|
338
|
-
values.push(value);
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
values[index] = value;
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
get: function (key) {
|
|
345
|
-
return values[keys.indexOf(key)];
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
//# sourceMappingURL=graph.js.map
|